Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	mkspecs/features/unix/separate_debug_info.prf
	src/gui/kernel/qwindow_p.h
	src/plugins/platforms/cocoa/qcocoacursor.mm
	tests/auto/tools/moc/tst_moc.cpp

Change-Id: Ieb57834c00f961a747ffe51e6eb9fc9612cebccf
This commit is contained in:
Frederik Gladhorn 2013-02-20 11:50:04 +01:00
commit dcb710dd87
38 changed files with 281 additions and 200 deletions

2
configure vendored
View File

@ -5393,9 +5393,11 @@ fi
if [ "$CFG_SHARED" = "yes" ]; then
QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
QT_CONFIG="$QT_CONFIG shared"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG shared"
elif [ "$CFG_SHARED" = "no" ]; then
QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
QT_CONFIG="$QT_CONFIG static"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG static"
fi
#FIXME: qpa is implicit this should all be removed

View File

@ -14,6 +14,7 @@ QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME += -Wl,-soname,
QMAKE_LFLAGS_THREAD +=
QMAKE_LFLAGS_RPATH = -Wl,-rpath,
QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link,
# -Bsymbolic-functions (ld) support
QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions

View File

@ -1,7 +0,0 @@
CONFIG -= release
QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_DEBUG
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
!debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(debug, release)

View File

@ -1 +0,0 @@
!macx-xcode:addExclusiveBuilds(debug, Debug, release, Release)

View File

@ -4,14 +4,11 @@ contains(TEMPLATE, ".*(lib|app)"):CONFIG += have_target
!have_target:!force_qt: CONFIG -= qt
!shared:!dll:!static:!staticlib {
contains(QT_CONFIG, static): CONFIG += static
else: CONFIG += shared
}
load(resolve_config)
QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH)
!isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ...
!staticlib:!static:CONFIG(release, debug|release):have_target: \ # is it applicable?
!static:release:have_target: \ # is it applicable?
!contains(TARGET, .*phony_target.*): \ # monster hack, you don't really see this here, right? ;)
system($$QT_BREAKPAD_ROOT_PATH/qtbreakpadsymbols --breakpad-exists) { # do we really have it?
CONFIG += breakpad force_debug_info
@ -24,9 +21,27 @@ force_debug_info {
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
}
CONFIG(debug, debug|release):load(debug)
else:load(release)
debug_and_release:load(debug_and_release)
debug {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_DEBUG
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
} else {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_RELEASE
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
}
dll:win32: QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL
static:mac: QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB
staticlib:unix {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB
}
incredibuild_xge {
CONFIG -= incredibuild_xge
CONFIG = incredibuild_xge $$CONFIG

View File

@ -1,2 +0,0 @@
CONFIG += shared

View File

@ -125,7 +125,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
}
isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:wince*: {
QT_ITEM =
CONFIG(debug, debug|release): QT_ITEM = $${QTPLUG}d4.dll
debug: QT_ITEM = $${QTPLUG}d4.dll
else: QT_ITEM = $${QTPLUG}4.dll
eval(qt_additional_plugin_$${QTPLUG}.files = $$[QT_INSTALL_PLUGINS/get]/$${QT_PLUGINPATH}/$${QT_ITEM})

View File

@ -10,7 +10,7 @@ defineReplace(qtPlatformTargetSuffix) {
defineReplace(qtLibraryTarget) {
LIBRARY_NAME = $$1
mac:!static:contains(QT_CONFIG, qt_framework) {
mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
QMAKE_FRAMEWORK_BUNDLE_NAME = $$LIBRARY_NAME
export(QMAKE_FRAMEWORK_BUNDLE_NAME)
} else {

View File

@ -25,12 +25,6 @@ isEmpty(VERSION):VERSION = $$QT_VERSION
# Compile as shared/DLL or static according to the option given to configure
# unless overridden. Host builds are always static
host_build|staticlib: CONFIG += static
!static:!shared {
contains(QT_CONFIG, static): \
CONFIG += static
else: \
CONFIG += shared
}
ucmodule = $$upper($$MODULE)
@ -87,7 +81,7 @@ contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_no
contains(QT_CONFIG, c++11):CONFIG += c++11
#mac frameworks
mac:!static:contains(QT_CONFIG, qt_framework) {
mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
#QMAKE_FRAMEWORK_VERSION = 4.0
CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
CONFIG(release, debug|release) {

View File

@ -28,10 +28,7 @@ contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
contains(QT_CONFIG, c++11):CONFIG += c++11
contains(QT_CONFIG, static):CONFIG += static
else:CONFIG += shared
static {
CONFIG(static, static|shared) {
isEmpty(MODULE): MODULE = $$basename(TARGET)
MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_plugin_$${MODULE}.pri

View File

@ -1,7 +0,0 @@
CONFIG -= debug
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_RELEASE
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
!debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(release, debug)

View File

@ -0,0 +1,46 @@
#
# W A R N I N G
# -------------
#
# This file is not part of the Qt API. It exists purely as an
# implementation detail. It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#
staticlib: \
CONFIG += static
else: dll: \
CONFIG += shared
CONFIG(static, static|shared) {
CONFIG -= shared dll
contains(TEMPLATE, ".*lib"): CONFIG += staticlib
} else {
CONFIG -= static staticlib
contains(TEMPLATE, ".*lib"): CONFIG += dll
}
static_and_shared {
!macx-xcode: addExclusiveBuilds(static, Static, shared, Shared)
} else: fix_output_dirs {
static: \
fixExclusiveOutputDirs(static, shared)
else: \
fixExclusiveOutputDirs(shared, static)
}
CONFIG(debug, debug|release): \
CONFIG -= release
else: \
CONFIG -= debug
debug_and_release {
!macx-xcode: addExclusiveBuilds(debug, Debug, release, Release)
} else: fix_output_dirs {
debug: \
fixExclusiveOutputDirs(debug, release)
else: \
fixExclusiveOutputDirs(release, debug)
}

View File

@ -9,6 +9,8 @@
# We mean it.
#
load(resolve_config)
QMAKE_RESOLVED_TARGET = $$absolute_path($$DESTDIR, $$OUT_PWD)/
win32 {

View File

@ -1,7 +0,0 @@
CONFIG -= static
contains(TEMPLATE, ".*lib"): {
CONFIG += dll
CONFIG -= staticlib
win32:QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL
}
!static_and_shared:fix_output_dirs:fixExclusiveOutputDirs(shared, static)

View File

@ -1,14 +0,0 @@
CONFIG -= shared dll
contains(TEMPLATE, ".*lib"):{
CONFIG += staticlib
unix {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB
}
}
mac {
QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB
}
!static_and_shared:fix_output_dirs:fixExclusiveOutputDirs(static, shared)

View File

@ -1,3 +0,0 @@
have_target:!macx-xcode {
addExclusiveBuilds(static, Static, shared, Shared)
}

View File

@ -1 +0,0 @@
CONFIG += static

View File

@ -1,5 +1,5 @@
!staticlib:!static:contains(TEMPLATE, lib) {
dll {
QMAKE_LFLAGS_SHLIB += $$QMAKE_LFLAGS_BSYMBOLIC_FUNC
!isEmpty(QMAKE_DYNAMIC_LIST_FILE):QMAKE_LFLAGS_SHLIB += $$QMAKE_LFLAGS_DYNAMIC_LIST$$QMAKE_DYNAMIC_LIST_FILE

View File

@ -1,4 +1,4 @@
!CONFIG(separate_debug_info):CONFIG(debug, debug|release):have_target:!staticlib:!static:!isEmpty(QMAKE_OBJCOPY) {
!separate_debug_info:have_target:debug:!static:!isEmpty(QMAKE_OBJCOPY) {
contains(TEMPLATE, "lib") {
QMAKE_GDB_INDEX = { test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\"; } &&

View File

@ -1,5 +1,5 @@
!separate_debug_info_nocopy:have_target:!staticlib:!static:!isEmpty(QMAKE_OBJCOPY) {
!separate_debug_info_nocopy:have_target:!static:!isEmpty(QMAKE_OBJCOPY) {
qnx {
debug_info_suffix = sym
debug_info_keep = --keep-file-symbols

View File

@ -269,7 +269,8 @@
This is the result of running the code:
\badcode
\code
//bad code
hello from GUI thread 3079423696
hello from worker thread 3076111216
\endcode

View File

@ -642,12 +642,30 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
\sa Q_UINT64_C(), qint64, qulonglong
*/
/*!
\typedef qintptr
\relates <QtGlobal>
Integral type for representing pointers in a signed integer (useful for
hashing, etc.).
Typedef for either qint32 or qint64. This type is guaranteed to
be the same size as a pointer on all platforms supported by Qt. On
a system with 32-bit pointers, qintptr is a typedef for qint32;
on a system with 64-bit pointers, qintptr is a typedef for
qint64.
Note that qintptr is signed. Use quintptr for unsigned values.
\sa qptrdiff, qint32, qint64
*/
/*!
\typedef quintptr
\relates <QtGlobal>
Integral type for representing a pointers (useful for hashing,
etc.).
Integral type for representing pointers in an unsigned integer (useful for
hashing, etc.).
Typedef for either quint32 or quint64. This type is guaranteed to
be the same size as a pointer on all platforms supported by Qt. On

View File

@ -212,7 +212,8 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d)
The following example illustrates this wrong usage
in context of a class that may contain invalid data:
\badcode
\code
//bad code
// Wrongly marshall the MyTime data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const MyTime &mytime)
{

View File

@ -46,6 +46,9 @@
QT_BEGIN_NAMESPACE
#if defined(B0)
#undef B0 // Terminal hang-up. We assume that you do not want that.
#endif
class QPagedPaintDevicePrivate;

View File

@ -229,7 +229,7 @@ QTransform QPainterPrivate::hidpiScaleTransform() const
{
#ifdef Q_OS_MAC
// Limited feature introduction for Qt 5.0.0, remove ifdef in a later release.
if (device->physicalDpiX() == 0 || device->logicalDpiX() == 0)
if (device->devType() == QInternal::Printer || device->physicalDpiX() == 0 || device->logicalDpiX() == 0)
return QTransform();
const qreal deviceScale = (device->physicalDpiX() / device->logicalDpiX());
if (deviceScale > 1.0)
@ -1839,7 +1839,7 @@ bool QPainter::begin(QPaintDevice *pd)
#ifdef Q_OS_MAC
// Limited feature introduction for Qt 5.0.0, remove ifdef in a later release.
const bool isHighDpi = (d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ?
const bool isHighDpi = (pd->devType() == QInternal::Printer || d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ?
false : (d->device->physicalDpiX() / d->device->logicalDpiX() > 1);
#else
const bool isHighDpi = false;

View File

@ -313,15 +313,15 @@
or the proxy server stopped responding in the authentication phase.
\value ProxyNotFoundError The proxy address set with setProxy() (or the application
proxy) was not found.
\value ProxyProtocolError The connection negotiation with the proxy server
\value ProxyProtocolError The connection negotiation with the proxy server failed,
because the response from the proxy server could not be understood.
\value OperationError An operation was attempted while the socket was in a state that
did not permit it.
\value SslInternalError The SSL library being used reported a internal error, this is
\value SslInternalError The SSL library being used reported an internal error. This is
probably the result of a bad installation or misconfiguration of the library.
\value SslInvalidUserDataError Invalid data(certificate, key, cypher, etc.) was
\value SslInvalidUserDataError Invalid data (certificate, key, cypher, etc.) was
provided and its use resulted in an error in the SSL library.
\value TemporaryError A temporary error occurred(e.g., operation would block and socket
\value TemporaryError A temporary error occurred (e.g., operation would block and socket
is non-blocking).
\value UnknownSocketError An unidentified error occurred.

View File

@ -53,6 +53,7 @@ class QCocoaCursor : public QPlatformCursor
{
public:
QCocoaCursor();
~QCocoaCursor();
virtual void changeCursor(QCursor * widgetCursor, QWindow * widget);
virtual QPoint pos() const;

View File

@ -48,6 +48,10 @@
QT_BEGIN_NAMESPACE
QCocoaCursor::QCocoaCursor()
{
}
QCocoaCursor::~QCocoaCursor()
{
// release cursors
QHash<Qt::CursorShape, NSCursor *>::const_iterator i = m_cursors.constBegin();
@ -97,10 +101,15 @@ void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window)
break;
case Qt::DragLinkCursor:
[[NSCursor dragLinkCursor] set];
break;
default : {
// No suitable OS cursor exist, use cursors provided
// by Qt for the rest. Check for a cached cursor:
NSCursor *cocoaCursor = m_cursors.value(newShape);
if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) {
[cocoaCursor release];
cocoaCursor = 0;
}
if (cocoaCursor == 0) {
cocoaCursor = createCursorData(cursor);
if (cocoaCursor == 0) {

View File

@ -335,7 +335,11 @@ void QQnxWindow::setBufferSize(const QSize &size)
// Set window buffer size
errno = 0;
int val[2] = { size.width(), size.height() };
// libscreen fails when creating empty buffers
const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size;
int val[2] = { nonEmptySize.width(), nonEmptySize.height() };
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
if (result != 0) {
qFatal("QQnxWindow: failed to set window buffer size, errno=%d", errno);
@ -362,6 +366,7 @@ void QQnxWindow::setBufferSize(const QSize &size)
errno = 0;
result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT);
if (result != 0) {
qWarning() << "QQnxWindow: Buffer size was" << size;
qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno);
}
@ -380,7 +385,7 @@ void QQnxWindow::setBufferSize(const QSize &size)
}
// Cache new buffer size
m_bufferSize = size;
m_bufferSize = nonEmptySize;
// Buffers were destroyed; reacquire them
m_currentBufferIndex = -1;

View File

@ -243,7 +243,6 @@
\li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract}
\li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {06-qdoc-commands-includecodeinline.html#badcode-command} {\\badcode}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)}
\li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief}
\li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c}
@ -1175,8 +1174,7 @@
snippets. It renders the code verbatim in a separate paragraph in
the code font.
When processing any of the \\code, \l {badcode-command}
{\\badcode}, \l {newcode-command} {\\newcode} or \l
When processing any of the \\code, \l {newcode-command} {\\newcode} or \l
{oldcode-command} {\\oldcode} commands, QDoc removes all
indentation that is common for the verbatim code blocks within a
\c{/}\c{*!} ... \c{*}\c{/} comment before it adds the standard
@ -1225,67 +1223,9 @@
See also \l {c-command} {\\c}, \l
{07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command}
{\\quotefromfile}, \l {badcode-command} {\\badcode}, \l
{newcode-command} {\\newcode} and \l {oldcode-command}
{\\quotefromfile}, \l{newcode-command} {\\newcode} and \l {oldcode-command}
{\\oldcode}.
\target badcode-command
\section1 \\badcode
The \\badcode and \\endcode commands delimit a snippet of code
that doesn't compile or is wrong for some other reason.
The \\badcode command is similar to the \l {code-command} {\\code}
command, but it renders the code snippet using a grey font instead
of black.
Like the \l {code-command} {\\code} command, this command begins
its code snippet on a new line rendered in the code font and with
the standard indentation.
\code
/ *!
The statement below is rendered using the
regular \\code command:
\code
statusbar()->message(tr("Host %1 found").arg(hostName));
\ endcode
While the following statement is rendered using
the \\badcode command:
\badcode
statusbar()->message(tr("Host" + hostName + " found"));
\ endcode
* /
\endcode
QDoc renders this as:
\quotation
The statement below is rendered using the
regular \\code command:
\code
statusbar()->message(tr("Host %1 found").arg(hostName));
\endcode
While the following statement is rendered using
the \\badcode command:
\badcode
statusbar()->message(tr("Host" + hostName + " found"));
\endcode
\endquotation
Other QDoc commands are disabled within \\badcode... \\endcode,
and the special character '\\' is accepted and rendered like the
rest of the code.
See also \l {code-command} {\\code}, \l {newcode-command}
{\\newcode} and \l {oldcode-command} {\\oldcode}.
\target newcode-command
\section1 \\newcode
@ -1293,14 +1233,12 @@
show how to port a snippet of code to a new version of an API.
The \\newcode command, and its companion the \\oldcode command, is
a convenience combination of the \l {code-command} {\\code} and \l
{badcode-command} {\\badcode} commands: The combination provides a
text relating the two code snippets to each other. The command
requires a preceding \\oldcode statement.
a convenience combination of the \l {code-command} {\\code} commands:
The combination provides a text relating the two code snippets to each
other. The command requires a preceding \\oldcode statement.
Like the \l {code-command} {\\code} and \l {badcode-command}
{\\badcode} commands, the \\newcode command renders its code on a
new line in the documentation using a typewriter font and the
Like the \l{code-command}{\\code} command, the \\newcode command renders its
code on a new line in the documentation using a typewriter font and the
standard indentation.
\code
@ -1339,7 +1277,7 @@
\\newcode statement; otherwise QDoc fails to parse the command
and emits a warning.
See also \l {newcode-command} {\\newcode} and \l {badcode-command} {\\badcode}.
See also \l {newcode-command} {\\newcode}.
\target qml-command
\section1 \\qml
@ -8688,7 +8626,6 @@
\li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)}
\li \l { 22-qdoc-configuration-generalvariables.html#basedir-variable} {basedir} \span {class="newStuff"} {(experimental)}
\li \l {06-qdoc-commands-includecodeinline.html#badcode-command} {\\badcode}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)}
\li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief}
\li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c}

View File

@ -1735,8 +1735,9 @@ QColor QColorDialog::selectedColor() const
*/
void QColorDialog::setOption(ColorDialogOption option, bool on)
{
Q_D(QColorDialog);
d->options->setOption(static_cast<QColorDialogOptions::ColorDialogOption>(option), on);
const QColorDialog::ColorDialogOptions previousOptions = options();
if (!(previousOptions & option) != !on)
setOptions(previousOptions ^ option);
}
/*!

View File

@ -853,8 +853,9 @@ QFont QFontDialog::selectedFont() const
*/
void QFontDialog::setOption(FontDialogOption option, bool on)
{
Q_D(QFontDialog);
d->options->setOption(static_cast<QFontDialogOptions::FontDialogOption>(option), on);
const QFontDialog::FontDialogOptions previousOptions = options();
if (!(previousOptions & option) != !on)
setOptions(previousOptions ^ option);
}
/*!

View File

@ -300,7 +300,9 @@ void QStackedLayout::setCurrentIndex(int index)
parent->setUpdatesEnabled(false);
}
QWidget *fw = parent ? parent->window()->focusWidget() : 0;
QPointer<QWidget> fw = parent ? parent->window()->focusWidget() : 0;
const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw));
if (prev) {
prev->clearFocus();
if (d->stackingMode == StackOne)
@ -315,24 +317,25 @@ void QStackedLayout::setCurrentIndex(int index)
// was somewhere on the outgoing widget.
if (parent) {
if (fw && (prev && prev->isAncestorOf(fw))) { // focus was on old page
if (focusWasOnOldPage) {
// look for the best focus widget we can find
if (QWidget *nfw = next->focusWidget())
nfw->setFocus();
else {
// second best: first child widget in the focus chain
QWidget *i = fw;
while ((i = i->nextInFocusChain()) != fw) {
if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus)
&& !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled()
&& next->isAncestorOf(i)) {
i->setFocus();
break;
if (QWidget *i = fw) {
while ((i = i->nextInFocusChain()) != fw) {
if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus)
&& !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled()
&& next->isAncestorOf(i)) {
i->setFocus();
break;
}
}
// third best: incoming widget
if (i == fw )
next->setFocus();
}
// third best: incoming widget
if (i == fw )
next->setFocus();
}
}
}

View File

@ -1000,6 +1000,14 @@ void QDockWidgetPrivate::plug(const QRect &rect)
setWindowState(false, false, rect);
}
static void setFrameStrutEventsEnabled(const QWidget *w, bool enabled)
{
if (const QWindow *window = w->windowHandle())
if (QPlatformWindow *platformWindow = window->handle())
if (platformWindow->frameStrutEventsEnabled() != enabled)
platformWindow->setFrameStrutEventsEnabled(enabled);
}
void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect &rect)
{
Q_Q(QDockWidget);
@ -1053,9 +1061,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
}
if (floating && nativeDeco)
if (const QWindow *window = q->windowHandle())
if (QPlatformWindow *platformWindow = window->handle())
platformWindow->setFrameStrutEventsEnabled(true);
setFrameStrutEventsEnabled(q, true);
resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco);
}
@ -1391,6 +1397,8 @@ bool QDockWidget::event(QEvent *event)
emit visibilityChanged(false);
break;
case QEvent::Show:
if (static_cast<QDockWidgetLayout *>(QDockWidget::layout())->nativeWindowDeco(isFloating()))
setFrameStrutEventsEnabled(this, true);
d->toggleViewAction->setChecked(true);
emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
break;

View File

@ -160,7 +160,7 @@
#include <QMainWindow>
#include <QScrollBar>
#include <QDebug>
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
#include <private/qmacstyle_mac_p.h>
#endif
#include <QMdiArea>
@ -296,7 +296,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti
Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
Q_ASSERT(widget);
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
// Native Mac windows don't show tool tip.
if (qobject_cast<QMacStyle *>(widget->style()))
return;
@ -1071,7 +1071,7 @@ void QMdiSubWindowPrivate::updateCursor()
{
#ifndef QT_NO_CURSOR
Q_Q(QMdiSubWindow);
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
return;
#endif
@ -1491,7 +1491,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
q->showNormal();
break;
case QStyle::SC_TitleBarMinButton:
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style())) {
if (q->isMinimized())
q->showNormal();
@ -1508,7 +1508,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
q->showNormal();
break;
case QStyle::SC_TitleBarMaxButton:
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style())) {
if (q->isMaximized())
q->showNormal();
@ -1555,7 +1555,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const
}
QRegion region;
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
return region;
#endif
@ -1709,7 +1709,7 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co
}
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
// ### Fix mac style, the +4 pixels hack is not necessary anymore
if (qobject_cast<QMacStyle *>(q->style()))
height -= 4;
@ -1764,7 +1764,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (isChildOfTabbedQMdiArea(q))
return false;
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM)
return true;
#else
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
@ -2172,7 +2172,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
return;
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
bool putSizeGripInLayout = layout ? true : false;
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
putSizeGripInLayout = false;
#endif
@ -2228,7 +2228,8 @@ void QMdiSubWindowPrivate::updateInternalWindowTitle()
Note that only \l{QMdiSubWindow}s can be set as children of
QMdiArea; you cannot, for instance, write:
\badcode
\code
//bad code
QMdiArea mdiArea;
QTextEdit editor(&mdiArea); // invalid child widget
\endcode
@ -2255,7 +2256,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
d->titleBarPalette = d->desktopPalette();
d->font = QApplication::font("QMdiSubWindowTitleBar");
// We don't want the menu icon by default on mac.
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
if (windowIcon().isNull())
d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this);
else
@ -2823,7 +2824,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->isMaximizeMode = false;
d->isWidgetHiddenByUs = false;
if (!parent()) {
#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(style()))
delete d->sizeGrip;
#endif
@ -2918,7 +2919,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
return;
}
#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
&& !(windowFlags() & Qt::FramelessWindowHint)) {
d->setSizeGrip(new QSizeGrip(0));
@ -3312,7 +3313,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
d->hoveredSubControl, this);
}
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty())
hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
#endif
@ -3522,7 +3523,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
int sizeGripHeight = 0;
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
sizeGripHeight = d->sizeGrip->height();
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip)
sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
#endif

View File

@ -600,9 +600,6 @@ void tst_QMdiSubWindow::showShaded()
else
#endif
mouseReceiver = window;
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-25297", Abort);
#endif
QVERIFY(mouseReceiver);
sendMouseMove(mouseReceiver, mousePosition, Qt::NoButton);
sendMousePress(mouseReceiver, mousePosition);
@ -711,9 +708,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove()
mouseReceiver = qFindChild<QSizeGrip *>(window);
else
mouseReceiver = window;
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-25297", Abort);
#endif
QVERIFY(mouseReceiver);
// ----------------------------- resize -----------------------------
@ -1451,9 +1445,6 @@ void tst_QMdiSubWindow::defaultSizeGrip()
// QSizeGrip on windows with decoration.
QMdiSubWindow *windowWithDecoration = mdiArea.addSubWindow(new QWidget);
windowWithDecoration->show();
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-25297", Abort);
#endif
QVERIFY(qFindChild<QSizeGrip *>(windowWithDecoration));
// ...but not on windows without decoration (Qt::FramelessWindowHint).
@ -1713,9 +1704,6 @@ void tst_QMdiSubWindow::fixedMinMaxSize()
// to minimize the window.
subWindow->showMinimized();
QVERIFY(subWindow->isMinimized());
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-25297", Abort);
#endif
QCOMPARE(subWindow->size(), minimizedSize);
QCOMPARE(subWindow->minimumSize(), minimizedSize);

View File

@ -47,6 +47,7 @@
#include <qstackedwidget.h>
#include <qpushbutton.h>
#include <QHBoxLayout>
#include <qlineedit.h>
class tst_QStackedWidget : public QObject
{
@ -58,7 +59,8 @@ public:
private slots:
void getSetCheck();
void testMinimumSize();
void testMinimumSize();
void dynamicPages();
};
tst_QStackedWidget::tst_QStackedWidget()
@ -72,15 +74,15 @@ tst_QStackedWidget::~tst_QStackedWidget()
// Testing that stackedwidget respect the minimum size of it's contents (task 95319)
void tst_QStackedWidget::testMinimumSize()
{
QWidget w;
QWidget w;
QStackedWidget sw(&w);
QPushButton button("Text", &sw);
sw.addWidget(&button);
sw.addWidget(&button);
QHBoxLayout hboxLayout;
hboxLayout.addWidget(&sw);
w.setLayout(&hboxLayout);
w.show();
QVERIFY(w.minimumSize() != QSize(0, 0));
QVERIFY(w.minimumSize() != QSize(0, 0));
}
// Testing get/set functions
@ -111,11 +113,97 @@ void tst_QStackedWidget::getSetCheck()
// has no problem handling out-of-bounds indices.
// ("convenience function" => "just another way of achieving the
// same goal")
obj1.setCurrentWidget((QWidget *)0);
obj1.setCurrentWidget((QWidget *)0);
QCOMPARE(obj1.currentWidget(), var2);
#endif
delete var2;
}
// QTBUG-18242, a widget that deletes its children in hideEvent().
// This caused a crash in QStackedLayout::setCurrentIndex() since
// the focus widget was destroyed while hiding the previous page.
class TestPage : public QWidget
{
public:
TestPage (bool staticWidgets = false) : QWidget(0), m_staticWidgets(staticWidgets)
{
new QVBoxLayout (this);
}
~TestPage() {
destroyWidgets();
}
void setN(int n)
{
m_n = n;
if (m_staticWidgets)
createWidgets();
}
virtual void showEvent (QShowEvent *)
{
if (!m_staticWidgets)
createWidgets();
}
virtual void hideEvent (QHideEvent *)
{
if (!m_staticWidgets)
destroyWidgets();
}
private:
void createWidgets() {
for (int i = 0; i < m_n; ++i) {
QLineEdit *le = new QLineEdit(this);
le->setObjectName(QString::fromLatin1("lineEdit%1").arg(i));
layout ()->addWidget(le);
m_les << le;
}
}
void destroyWidgets()
{
qDeleteAll(m_les);
m_les.clear ();
}
int m_n;
const bool m_staticWidgets;
QList<QLineEdit*> m_les;
};
void tst_QStackedWidget::dynamicPages()
{
QStackedWidget *sw = new QStackedWidget;
TestPage *w1 = new TestPage(true);
w1->setN(3);
TestPage *w2 = new TestPage;
w2->setN(3);
sw->addWidget(w1);
sw->addWidget(w2);
QLineEdit *le11 = w1->findChild<QLineEdit*>(QLatin1String("lineEdit1"));
le11->setFocus(); // set focus to second widget in the page
sw->resize(200, 200);
sw->show();
qApp->setActiveWindow(sw);
QTest::qWaitForWindowActive(sw);
QTRY_COMPARE(QApplication::focusWidget(), le11);
sw->setCurrentIndex(1);
QLineEdit *le22 = w2->findChild<QLineEdit*>(QLatin1String("lineEdit2"));
le22->setFocus();
QTRY_COMPARE(QApplication::focusWidget(), le22);
// Going back should move focus back to le11
sw->setCurrentIndex(0);
QTRY_COMPARE(QApplication::focusWidget(), le11);
}
QTEST_MAIN(tst_QStackedWidget)
#include "tst_qstackedwidget.moc"

View File

@ -3029,6 +3029,7 @@ void Configure::generateQConfigPri()
configStream << "CONFIG+= ";
configStream << dictionary[ "BUILD" ];
configStream << (dictionary[ "SHARED" ] == "no" ? " static" : " shared");
if (dictionary[ "LTCG" ] == "yes")
configStream << " ltcg";