summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure7
-rw-r--r--examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc (renamed from examples/tools/doc/src/customcompleter.qdoc)40
-rw-r--r--mkspecs/blackberry-armv7le-qcc/qmake.conf2
-rw-r--r--mkspecs/common/qcc-base-qnx.conf3
-rw-r--r--mkspecs/devices/linux-imx53qsb-g++/qmake.conf37
-rw-r--r--mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h42
-rw-r--r--mkspecs/features/cmake_functions.prf26
-rw-r--r--mkspecs/features/create_cmake.prf16
-rw-r--r--mkspecs/features/ctest_testcase.prf14
-rw-r--r--mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in7
-rw-r--r--mkspecs/features/moc.prf14
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp7
-rw-r--r--qmake/generators/win32/winmakefile.cpp2
-rw-r--r--qmake/option.cpp3
-rw-r--r--qmake/option.h1
-rw-r--r--src/corelib/Qt5CTestMacros.cmake24
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in5
-rw-r--r--src/corelib/doc/src/objectmodel/object.qdoc6
-rw-r--r--src/corelib/global/qcompilerdetection.h1
-rw-r--r--src/corelib/global/qtypetraits.h4
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp7
-rw-r--r--src/corelib/io/qprocess_win.cpp6
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp4
-rw-r--r--src/corelib/io/qurlquery.cpp1
-rw-r--r--src/corelib/io/qwindowspipereader.cpp12
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp5
-rw-r--r--src/corelib/kernel/qcore_mac_p.h1
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp4
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h4
-rw-r--r--src/corelib/kernel/qpointer.cpp1
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp5
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp2
-rw-r--r--src/corelib/plugin/qplugin.qdoc2
-rw-r--r--src/corelib/tools/qdatetime.cpp10
-rw-r--r--src/corelib/tools/qlist.cpp3
-rw-r--r--src/corelib/tools/qlocale_mac.mm22
-rw-r--r--src/corelib/tools/qstring.cpp47
-rw-r--r--src/corelib/tools/qstringlist.cpp3
-rw-r--r--src/corelib/tools/qvector.cpp3
-rw-r--r--src/corelib/xml/qxmlstream.cpp2
-rw-r--r--src/corelib/xml/qxmlstream_p.h1
-rw-r--r--src/dbus/dbus.pro4
-rw-r--r--src/gui/QtGui.dynlist5
-rw-r--r--src/gui/gui.pro1
-rw-r--r--src/gui/image/qicon.cpp1
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h1
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qplatformwindow.cpp39
-rw-r--r--src/gui/kernel/qplatformwindow.h3
-rw-r--r--src/gui/kernel/qwindow.cpp30
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp17
-rw-r--r--src/gui/painting/qrasterizer.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp16
-rw-r--r--src/gui/text/qfontdatabase.cpp8
-rw-r--r--src/gui/text/qfontengine_ft.cpp26
-rw-r--r--src/gui/text/qharfbuzz_copy_p.h13
-rw-r--r--src/network/socket/qnativesocketengine.cpp10
-rw-r--r--src/opengl/qgl.cpp8
-rw-r--r--src/platformsupport/eglconvenience/eglconvenience.pri1
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp8
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp7
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp8
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch_p.h2
-rw-r--r--src/platformsupport/linuxaccessibility/application.cpp14
-rw-r--r--src/platformsupport/linuxaccessibility/application_p.h3
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp4
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux.cpp40
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux_p.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemsettings.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm42
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm46
-rw-r--r--src/plugins/platforms/qnx/qnx.pro7
-rw-r--r--src/plugins/platforms/qnx/qqnxcursor.cpp78
-rw-r--r--src/plugins/platforms/qnx/qqnxcursor.h67
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp13
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp29
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp213
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h15
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp29
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h10
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp60
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h1
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp4
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp38
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp3
-rw-r--r--src/tools/qdoc/codemarker.cpp5
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp9
-rw-r--r--src/tools/qdoc/doc.cpp2
-rw-r--r--src/tools/qdoc/generator.cpp2
-rw-r--r--src/tools/qdoc/main.cpp4
-rw-r--r--src/tools/qdoc/node.cpp24
-rw-r--r--src/tools/qdoc/node.h4
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp31
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp7
-rw-r--r--src/tools/qdoc/qmlvisitor.cpp57
-rw-r--r--src/tools/qdoc/qmlvisitor.h5
-rw-r--r--src/widgets/QtGui.dynlist8
-rw-r--r--src/widgets/QtWidgets.dynlist5
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/doc/images/customcompleter-example.png (renamed from doc/src/images/customcompleter-example.png)bin11636 -> 11636 bytes
-rw-r--r--src/widgets/doc/images/customcompleter-insertcompletion.png (renamed from doc/src/images/customcompleter-insertcompletion.png)bin1371 -> 1371 bytes
-rw-r--r--src/widgets/itemviews/qheaderview.cpp14
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp3
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp3
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp7
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp28
-rw-r--r--src/widgets/styles/qcommonstyle.cpp6
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm37
-rw-r--r--src/widgets/widgets.pro2
-rw-r--r--tests/auto/cmake/CMakeLists.txt37
-rw-r--r--tests/auto/cmake/test(needsquoting)dirname/CMakeLists.txt6
-rw-r--r--tests/auto/cmake/test_concurrent_module/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/test_dbus_module/CMakeLists.txt10
-rw-r--r--tests/auto/cmake/test_testlib_definitions/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_use_modules_function/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/test_use_modules_function/three.cpp4
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp6
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp14
-rw-r--r--tests/auto/corelib/kernel/kernel.pro1
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp4
-rw-r--r--tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp2
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp5
-rw-r--r--tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp2
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp9
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp4
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp54
-rw-r--r--tests/auto/tools/moc/parse-defines.h11
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp17
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp6
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp5
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp11
-rw-r--r--tests/manual/transientwindow/main.cpp51
-rw-r--r--tests/manual/transientwindow/mainwindow.cpp66
-rw-r--r--tests/manual/transientwindow/mainwindow.h64
-rw-r--r--tests/manual/transientwindow/transientwindow.pro6
-rw-r--r--tools/configure/configureapp.cpp2
161 files changed, 1520 insertions, 614 deletions
diff --git a/configure b/configure
index 2ea1ea435a6..acce06dfc41 100755
--- a/configure
+++ b/configure
@@ -2607,7 +2607,7 @@ if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
fi
if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG force_debug_info"
+ QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
fi
# pass on $CFG_SDK to the arch/configure tests.
@@ -3093,6 +3093,9 @@ Configure options:
-opensource ........ Compile and link the Open-Source Edition of Qt.
-commercial ........ Compile and link the Commercial Edition of Qt.
+ -confirm-license.... Automatically acknowledge the license (use with
+ either -opensource or -commercial)
+
-no-c++11 .......... Do not compile Qt with C++11 support enabled.
+ -c++11 ............. Compile Qt with C++11 support enabled.
@@ -3197,7 +3200,7 @@ Third Party Libraries:
Additional options:
-make <part> ....... Add part to the list of parts to be built at make time.
- ($QT_DEFAULT_BUILD_PARTS)
+ (defaults to: $QT_DEFAULT_BUILD_PARTS)
-nomake <part> ..... Exclude part from the list of parts to be built.
-skip <module> ..... Exclude an entire module from the build.
diff --git a/examples/tools/doc/src/customcompleter.qdoc b/examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc
index f9ad3a43e9a..a6c425d4c8d 100644
--- a/examples/tools/doc/src/customcompleter.qdoc
+++ b/examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -26,9 +26,11 @@
****************************************************************************/
/*!
- \example customcompleter
+ \example tools/customcompleter
\title Custom Completer Example
+ \ingroup examples-widgets-tools
+
\brief The Custom Completer example shows how to provide string-completion
facilities for an input widget based on data provided by a model. The
completer pops up suggestions for possible words based on the first three
@@ -43,7 +45,7 @@
that has a list of words to help QCompleter complete words. This file
contains the following:
- \quotefile customcompleter/customcompleter.qrc
+ \quotefile tools/customcompleter/customcompleter.qrc
\section1 TextEdit Class Definition
@@ -54,7 +56,7 @@
contains a private function \c textUnderCursor() and a private instance
of QCompleter, \c c.
- \snippet customcompleter/textedit.h 0
+ \snippet tools/customcompleter/textedit.h 0
\section1 TextEdit Class Implementation
@@ -63,11 +65,11 @@
the \c TextEdit object, using the
\l{QTextEdit::setPlainText()}{setPlainText()} function.
- \snippet customcompleter/textedit.cpp 0
+ \snippet tools/customcompleter/textedit.cpp 0
In addition, \c TextEdit also includes a default destructor:
- \snippet customcompleter/textedit.cpp 1
+ \snippet tools/customcompleter/textedit.cpp 1
The \c setCompleter() function accepts a \a completer and sets it up.
We use \c{if (c)} to check if \c c has been initialized. If it has been
@@ -75,7 +77,7 @@
the signal from the slot. This is to ensure that no previous completer
object is still connected to the slot.
- \snippet customcompleter/textedit.cpp 2
+ \snippet tools/customcompleter/textedit.cpp 2
We then instantiate \c c with \a completer and set it as \c{TextEdit}'s
widget. The completion mode and case sensitivity are also set and then
@@ -84,7 +86,7 @@
The \c completer() function is a getter function that returns \c c.
- \snippet customcompleter/textedit.cpp 3
+ \snippet tools/customcompleter/textedit.cpp 3
The completer pops up the options available, based on the contents of
\e wordlist.txt, but the text cursor is responsible for filling in the
@@ -99,7 +101,7 @@
completer's widget is \c TextEdit before using \c tc to insert the extra
characters to complete the word.
- \snippet customcompleter/textedit.cpp 4
+ \snippet tools/customcompleter/textedit.cpp 4
The figure below illustrates this process:
@@ -116,13 +118,13 @@
The \c textUnderCursor() function uses a QTextCursor, \c tc, to select a
word under the cursor and return it.
- \snippet customcompleter/textedit.cpp 5
+ \snippet tools/customcompleter/textedit.cpp 5
The \c TextEdit class reimplements \l{QWidget::focusInEvent()}
{focusInEvent()} function, which is an event handler used to receive
keyboard focus events for the widget.
- \snippet customcompleter/textedit.cpp 6
+ \snippet tools/customcompleter/textedit.cpp 6
The \l{QAbstractScrollArea::keyPressEvent()}{keyPressEvent()} is
reimplemented to ignore key events like Qt::Key_Enter, Qt::Key_Return,
@@ -131,12 +133,12 @@
If there is an active completer, we cannot process the shortcut, Ctrl+E.
- \snippet customcompleter/textedit.cpp 7
+ \snippet tools/customcompleter/textedit.cpp 7
We also handle other modifiers and shortcuts for which we do not want the
completer to respond to.
- \snippet customcompleter/textedit.cpp 8
+ \snippet tools/customcompleter/textedit.cpp 8
Finally, we pop up the completer.
@@ -147,7 +149,7 @@
\c createMenu() and \c modelFromFile() as well as private instances of
QCompleter and \c TextEdit.
- \snippet customcompleter/mainwindow.h 0
+ \snippet tools/customcompleter/mainwindow.h 0
\section1 MainWindow Class Implementation
@@ -157,31 +159,31 @@
to populate the \c completer. The \c{MainWindow}'s central widget is set
to \c TextEdit and its size is set to 500 x 300.
- \snippet customcompleter/mainwindow.cpp 0
+ \snippet tools/customcompleter/mainwindow.cpp 0
The \c createMenu() function creates the necessary QAction objects needed
for the "File" and "Help" menu and their \l{QAction::triggered()}
{triggered()} signals are connected to the \c quit(), \c about(), and
\c aboutQt() slots respectively.
- \snippet customcompleter/mainwindow.cpp 1
+ \snippet tools/customcompleter/mainwindow.cpp 1
The \c modelFromFile() function accepts a \a fileName and attempts to
extract the contents of this file into a QStringListModel. We display the
Qt::WaitCursor when we are populating the QStringList, \c words, and
restore the mouse cursor when we are done.
- \snippet customcompleter/mainwindow.cpp 2
+ \snippet tools/customcompleter/mainwindow.cpp 2
The \c about() function provides a brief description about the Custom
Completer example.
- \snippet customcompleter/mainwindow.cpp 3
+ \snippet tools/customcompleter/mainwindow.cpp 3
\section1 \c main() Function
The \c main() function instantiates \c MainWindow and invokes the
\l{QWidget::show()}{show()} function.
- \snippet customcompleter/main.cpp 0
+ \snippet tools/customcompleter/main.cpp 0
*/
diff --git a/mkspecs/blackberry-armv7le-qcc/qmake.conf b/mkspecs/blackberry-armv7le-qcc/qmake.conf
index 45883b05eca..2e24e4e0d30 100644
--- a/mkspecs/blackberry-armv7le-qcc/qmake.conf
+++ b/mkspecs/blackberry-armv7le-qcc/qmake.conf
@@ -15,7 +15,7 @@ contains(QT_CONFIG, stack-protector-strong) {
QMAKE_CFLAGS += -fstack-protector -fstack-protector-all
}
-QMAKE_CFLAGS += -mcpu=cortex-a9
+QMAKE_CFLAGS += -mcpu=cortex-a9 -mtune=cortex-a9 -mthumb -D_FORTIFY_SOURCE=2
QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now
diff --git a/mkspecs/common/qcc-base-qnx.conf b/mkspecs/common/qcc-base-qnx.conf
index b1bae7122d2..88b82ccd715 100644
--- a/mkspecs/common/qcc-base-qnx.conf
+++ b/mkspecs/common/qcc-base-qnx.conf
@@ -37,9 +37,8 @@ QMAKE_LIBS_EGL = -lEGL
# against the NDK's target directory which is referenced by the QNX_TARGET environment
# variable, and which is guaranteed by the NDK to be set.
QNX_DIR = $$(QNX_TARGET)
-
isEmpty(QNX_DIR) {
- error(QNX_TARGET environment variable not set)
+ error("QNX_TARGET environment variable not set")
}
QMAKE_INCDIR = $${QNX_DIR}/usr/include $${QNX_DIR}/usr/include/freetype2
diff --git a/mkspecs/devices/linux-imx53qsb-g++/qmake.conf b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf
new file mode 100644
index 00000000000..0a5ed89feba
--- /dev/null
+++ b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf
@@ -0,0 +1,37 @@
+#
+# qmake configuration for the Freescale iMX53 board
+#
+# This mkspec is based and tested on the Yocto Project's Poky Distribution
+# with libEGL.so from Freescale without the X11 dependency.
+#
+# This mkspec is tested with a framebuffer (eglfs) configuration
+#
+# A typical configure line looks like:
+#
+# export PATH=/opt/imx53qsb/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi:$PATH
+#
+# ./configure -prefix /usr/local/qt5-imx53 -hostprefix /opt/imx53qsb/x86_64-linux/usr/local/qt5-imx53 -release -device linux-imx53qsb-g++
+# -opensource -confirm-license -no-gtkstyle -device-option CROSS_COMPILE=arm-poky-linux-gnueabi- -sysroot /opt/imx53qsb/sysroot
+# -eglfs -no-pch -opengl es2 -no-xcb -silent
+
+include(../common/linux_device_pre.conf)
+
+QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include
+QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib
+
+QMAKE_LIBS_EGL += -lEGL
+QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL
+QMAKE_LIBS_OPENVG += -lOpenVG -lEGL
+
+QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib
+
+IMX5_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -Wno-psabi
+IMX5_CFLAGS_RELEASE = -O2 $$IMX5_CFLAGS
+QMAKE_CFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE
+QMAKE_CXXFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE
+QMAKE_CFLAGS_DEBUG += $$IMX5_CFLAGS
+QMAKE_CXXFLAGS_DEBUG += $$IMX5_CFLAGS
+
+include(../common/linux_device_post.conf)
+
+load(qt_config)
diff --git a/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h b/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h
new file mode 100644
index 00000000000..461f3d5589e
--- /dev/null
+++ b/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf
new file mode 100644
index 00000000000..62634d9b889
--- /dev/null
+++ b/mkspecs/features/cmake_functions.prf
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+defineReplace(cmakeModuleName) {
+ _module = $$1
+ _name = $$eval(QT.$${_module}.name)
+ cmake_module_name = $$replace(_name, ^Qt, )
+ return ($$cmake_module_name)
+}
+
+defineReplace(cmakeModuleList) {
+ variable = $$1
+ out =
+ for(v, variable) {
+ out += $$cmakeModuleName($$v)
+ }
+ return ($$join(out, ";"))
+}
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 43dca4cd701..428a3a4d43b 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -9,21 +9,7 @@
# We mean it.
#
-defineReplace(cmakeModuleName) {
- _module = $$1
- _name = $$eval(QT.$${_module}.name)
- cmake_module_name = $$replace(_name, ^Qt, )
- return ($$cmake_module_name)
-}
-
-defineReplace(cmakeModuleList) {
- variable = $$1
- out =
- for(v, variable) {
- out += $$cmakeModuleName($$v)
- }
- return ($$join(out, ";"))
-}
+load(cmake_functions)
defineReplace(cmakeRelativePath) {
path = $$relative_path($$1, $$2)
diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf
index 7f86ca00520..58c683ff055 100644
--- a/mkspecs/features/ctest_testcase.prf
+++ b/mkspecs/features/ctest_testcase.prf
@@ -31,6 +31,8 @@ isEmpty(CMAKE_VERSION) {
isEmpty(VERSION_OK) {
message("cmake $$CMAKE_VERSION is too old for this test.")
} else {
+ load(cmake_functions)
+
CMAKE_BUILD_TYPE = Debug
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\"
@@ -40,10 +42,18 @@ isEmpty(CMAKE_VERSION) {
for(d, $$list($$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))) {
CMAKE_PREFIX_PATH *= $$dirname(d)
}
+ CMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\"
+
+ !qtHaveModule(widgets): CMAKE_MODULE_DEFINES += -DNO_WIDGETS=True
+ !qtHaveModule(dbus): CMAKE_MODULE_DEFINES += -DNO_DBUS=True
+
+ dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.")
+ dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
+ dependentmodules = $$cmakeModuleList($$dependentmodules)
check.commands = \
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
- cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" && \
+ cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR $$CMAKE_MODULE_DEFINES -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \
$(TESTRUNNER) ctest --output-on-failure
}
@@ -54,6 +64,4 @@ insignificant_test:!isEmpty(check.commands) {
check.commands = -$${check.commands}
}
-!qtHaveModule(widgets): CONFIG += insignificant_test # QTBUG-28540
-
QMAKE_EXTRA_TARGETS *= check
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index d70dbedbf45..c28dd75d9b1 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -77,10 +77,15 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
if (Qt5$${CMAKE_MODULE_NAME}_FIND_QUIETLY)
set(_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET QUIET)
endif()
+ set(_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT)
+ if (Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT)
+ set(_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT EXACT)
+ endif()
foreach(_module_dep ${_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES})
if (NOT Qt5${_module_dep}_FOUND)
find_package(Qt5${_module_dep}
+ ${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING} ${_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT}
${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET}
${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED}
PATHS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}\" NO_DEFAULT_PATH
@@ -103,7 +108,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS)
if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
+ list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
endif()
set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\")
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index 8bd512844d9..3b0e511edb7 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -9,7 +9,7 @@ isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc
# has too many includes. We do this to overcome a command-line limit on Win < XP
INCLUDETEMP=
WIN_INCLUDETEMP=
-win32:count($$list($$INCLUDEPATH), 40, >) {
+win32:count(INCLUDEPATH, 40, >) {
INCLUDETEMP = $$MOC_DIR/mocinclude.tmp
WIN_INCLUDETEMP=$$INCLUDETEMP
@@ -23,7 +23,7 @@ win32:count($$list($$INCLUDEPATH), 40, >) {
unset(INCFILELIST)
RET =
- for(incfile, $$list($$INCLUDEPATH)) {
+ for(incfile, INCLUDEPATH) {
INCFILELIST = -I$$incfile
isEmpty(RET): RET += @echo $$INCFILELIST> $$WIN_INCLUDETEMP $$EOC
else: RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC
@@ -38,15 +38,17 @@ win32:count($$list($$INCLUDEPATH), 40, >) {
}
defineReplace(mocCmdBase) {
+ RET =
!isEmpty(WIN_INCLUDETEMP) {
- RET =
contains(TEMPLATE, "vc.*") {
RET += $$mocinclude.commands
}
- RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$QMAKE_MOC_OPTIONS
- return($$RET)
+ incvar = @$$WIN_INCLUDETEMP
+ } else {
+ incvar = $(INCPATH)
}
- return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$QMAKE_MOC_OPTIONS)
+ RET += $$QMAKE_MOC $(DEFINES) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$incvar $$join(QMAKE_DEFAULT_INCDIRS, " -I", -I) $$QMAKE_MOC_OPTIONS
+ return($$RET)
}
#moc headers
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 8b40d4e9359..299b115bdc1 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-NmakeMakefileGenerator::NmakeMakefileGenerator() : Win32MakefileGenerator(), init_flag(false)
+NmakeMakefileGenerator::NmakeMakefileGenerator() : Win32MakefileGenerator(), init_flag(false), usePCH(false)
{
}
@@ -304,6 +304,11 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
project->values("QMAKE_CLEAN").append("vc*.pdb");
project->values("QMAKE_CLEAN").append("vc*.idb");
+ project->values("DEFINES").removeAll("NDEBUG");
+ } else {
+ ProStringList &defines = project->values("DEFINES");
+ if (!defines.contains("NDEBUG"))
+ defines.append("NDEBUG");
}
}
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index cac63ed9323..c6a70c75392 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -122,7 +122,7 @@ Win32MakefileGenerator::findLibraries()
if(opt.startsWith("/LIBPATH:")) {
dirs.append(QMakeLocalFileName(opt.mid(9)));
} else if(opt.startsWith("-L") || opt.startsWith("/L")) {
- QString libpath = opt.mid(2);
+ QString libpath = Option::fixPathToTargetOS(opt.mid(2), false, false);
QMakeLocalFileName l(libpath);
if(!dirs.contains(l)) {
dirs.append(l);
diff --git a/qmake/option.cpp b/qmake/option.cpp
index fdf11d92661..983d3490d81 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -57,7 +57,6 @@ ProFileCache *Option::proFileCache;
QMakeParser *Option::parser;
//convenience
-const char *Option::application_argv0 = 0;
QString Option::prf_ext;
QString Option::prl_ext;
QString Option::libtool_ext;
@@ -318,13 +317,11 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
int
Option::init(int argc, char **argv)
{
- Option::application_argv0 = 0;
Option::prf_ext = ".prf";
Option::pro_ext = ".pro";
Option::field_sep = ' ';
if(argc && argv) {
- Option::application_argv0 = argv[0];
QString argv0 = argv[0];
if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING)
Option::qmake_mode = default_mode(argv0);
diff --git a/qmake/option.h b/qmake/option.h
index 541757b2640..6225f6b4d2f 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -109,7 +109,6 @@ struct Option
static QString pro_ext;
static QString res_ext;
static char field_sep;
- static const char *application_argv0;
enum CmdLineFlags {
QMAKE_CMDLINE_SUCCESS = 0x00,
diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake
index 60b98a71384..297a9e07f6d 100644
--- a/src/corelib/Qt5CTestMacros.cmake
+++ b/src/corelib/Qt5CTestMacros.cmake
@@ -19,6 +19,13 @@ if (CMAKE_TOOLCHAIN_FILE)
list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()
+if (NO_WIDGETS)
+ list(APPEND BUILD_OPTIONS_LIST "-DNO_WIDGETS=True")
+endif()
+if (NO_DBUS)
+ list(APPEND BUILD_OPTIONS_LIST "-DNO_DBUS=True")
+endif()
+
macro(expect_pass _dir)
string(REPLACE "(" "_" testname "${_dir}")
string(REPLACE ")" "_" testname "${testname}")
@@ -80,7 +87,7 @@ function(test_module_includes)
set(packages_string
"
${packages_string}
- find_package(Qt5${_package} REQUIRED)
+ find_package(Qt5${_package} 5.0.0 REQUIRED)
"
)
endforeach()
@@ -90,7 +97,7 @@ function(test_module_includes)
list(REMOVE_AT all_args 0 1)
set(packages_string
"${packages_string}
- find_package(Qt5${qtmodule} REQUIRED)
+ find_package(Qt5${qtmodule} 5.0.0 REQUIRED)
include_directories(\${Qt5${qtmodule}_INCLUDE_DIRS})
add_definitions(\${Qt5${qtmodule}_DEFINITIONS})\n"
)
@@ -127,18 +134,23 @@ function(test_module_includes)
set(instances_string "")
while(all_args)
list(GET all_args 0 qtmodule)
- list(GET all_args 1 qtinclude)
+ list(GET all_args 1 qtclass)
+ if (${qtclass}_NAMESPACE)
+ set(qtinstancetype ${${qtclass}_NAMESPACE}::${qtclass})
+ else()
+ set(qtinstancetype ${qtclass})
+ endif()
list(REMOVE_AT all_args 0 1)
set(includes_string
"${includes_string}
- #include <${qtinclude}>
- #include <Qt${qtmodule}/${qtinclude}>
+ #include <${qtclass}>
+ #include <Qt${qtmodule}/${qtclass}>
#include <Qt${qtmodule}>
#include <Qt${qtmodule}/Qt${qtmodule}>"
)
set(instances_string
"${instances_string}
- ${qtinclude} local${qtinclude};
+ ${qtinstancetype} local${qtclass};
")
endwhile()
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 4e0fcda20e1..29e37be64aa 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -41,6 +41,11 @@ set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake)
set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
+set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_MAJOR_VERSION 5)
+set_property(TARGET Qt5::Core APPEND PROPERTY
+ COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION
+)
+
!!IF isEmpty(CMAKE_ARCHDATA_DIR_IS_ABSOLUTE)
list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5Core_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5Core_install_prefix}/$${CMAKE_ARCHDATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
!!ELSE
diff --git a/src/corelib/doc/src/objectmodel/object.qdoc b/src/corelib/doc/src/objectmodel/object.qdoc
index 281c1a30cb6..1d33c14d0fa 100644
--- a/src/corelib/doc/src/objectmodel/object.qdoc
+++ b/src/corelib/doc/src/objectmodel/object.qdoc
@@ -66,11 +66,7 @@
by Qt's own \l{moc}{Meta-Object Compiler (moc)}.
The meta-object system is a C++ extension that makes the language
- better suited to true component GUI programming. Although
- templates can be used to extend C++, the meta-object system
- provides benefits using standard C++ that cannot be achieved with
- templates; see \l{Why Doesn't Qt Use Templates for Signals and
- Slots?}
+ better suited to true component GUI programming.
\section1 Important Classes
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index d062ea0d158..15229e03a0f 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -862,6 +862,7 @@
const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\
+ Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\
} while (0)
#endif // QCOMPILERDETECTION_H
diff --git a/src/corelib/global/qtypetraits.h b/src/corelib/global/qtypetraits.h
index 54b48667b4f..692a982adf6 100644
--- a/src/corelib/global/qtypetraits.h
+++ b/src/corelib/global/qtypetraits.h
@@ -246,6 +246,10 @@ template<> struct is_integral<unsigned long long> : true_type { };
template <class T> struct is_integral<const T> : is_integral<T> { };
template <class T> struct is_integral<volatile T> : is_integral<T> { };
template <class T> struct is_integral<const volatile T> : is_integral<T> { };
+#if defined (Q_COMPILER_UNICODE_STRINGS)
+template<> struct is_integral<char16_t> : true_type { };
+template<> struct is_integral<char32_t> : true_type { };
+#endif
// is_floating_point is false except for the built-in floating-point types.
// A cv-qualified type is integral if and only if the underlying type is.
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index b1d7ca9dd17..39634160846 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -128,7 +128,7 @@ void QFSFileEnginePrivate::init()
#ifdef Q_OS_WIN
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
- mapHandle = INVALID_HANDLE_VALUE;
+ mapHandle = NULL;
#ifndef Q_OS_WINCE
cachedFd = -1;
#endif
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 1cb3c03c308..24631f11c7f 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -900,7 +900,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
return 0;
}
- if (mapHandle == INVALID_HANDLE_VALUE) {
+ if (mapHandle == NULL) {
// get handle to the file
HANDLE handle = fileHandle;
@@ -933,7 +933,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
// first create the file mapping handle
DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY;
mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0);
- if (mapHandle == INVALID_HANDLE_VALUE) {
+ if (mapHandle == NULL) {
q->setError(QFile::PermissionsError, qt_error_string());
#ifdef Q_USE_DEPRECATED_MAP_API
::CloseHandle(handle);
@@ -976,6 +976,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
}
::CloseHandle(mapHandle);
+ mapHandle = NULL;
return 0;
}
@@ -995,7 +996,7 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr)
maps.remove(ptr);
if (maps.isEmpty()) {
::CloseHandle(mapHandle);
- mapHandle = INVALID_HANDLE_VALUE;
+ mapHandle = NULL;
}
return true;
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 693778e6298..ab1f05777a2 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -312,11 +312,13 @@ void QProcessPrivate::destroyChannel(Channel *channel)
}
} else if (channel == &stdoutChannel) {
if (stdoutReader) {
+ stdoutReader->stop();
stdoutReader->deleteLater();
stdoutReader = 0;
}
} else if (channel == &stderrChannel) {
if (stderrReader) {
+ stderrReader->stop();
stderrReader->deleteLater();
stderrReader = 0;
}
@@ -795,8 +797,8 @@ void QProcessPrivate::findExitCode()
DWORD theExitCode;
if (GetExitCodeProcess(pid->hProcess, &theExitCode)) {
exitCode = theExitCode;
- //### for now we assume a crash if exit code is less than -1 or the magic number
- crashed = (exitCode == 0xf291 || (int)exitCode < 0);
+ crashed = (exitCode == 0xf291 // our magic number, see killProcess
+ || (theExitCode >= 0x80000000 && theExitCode < 0xD0000000));
}
}
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 478db6c299a..d4e0779381c 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -160,10 +160,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
// Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache
// location for everyone. Most applications seem to be using a
// cache directory located in their AppData directory
- return writableLocation(DataLocation) + QLatin1String("\\cache");
+ return writableLocation(DataLocation) + QLatin1String("/cache");
case GenericCacheLocation:
- return writableLocation(GenericDataLocation) + QLatin1String("\\cache");
+ return writableLocation(GenericDataLocation) + QLatin1String("/cache");
case RuntimeLocation:
case HomeLocation:
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index 23c0b948e83..547084840fb 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QUrlQuery
\inmodule QtCore
+ \since 5.0
\brief The QUrlQuery class provides a way to manipulate a key-value pairs in
a URL's query.
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index efadb357a94..2cb58457687 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -64,7 +64,7 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
connect(dataReadNotifier, &QWinOverlappedIoNotifier::notified, this, &QWindowsPipeReader::notified);
}
-static void qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped)
+static bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped)
{
typedef BOOL (WINAPI *PtrCancelIoEx)(HANDLE, LPOVERLAPPED);
static PtrCancelIoEx ptrCancelIoEx = 0;
@@ -74,16 +74,18 @@ static void qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped)
ptrCancelIoEx = PtrCancelIoEx(GetProcAddress(kernel32, "CancelIoEx"));
}
if (ptrCancelIoEx)
- ptrCancelIoEx(handle, overlapped);
+ return ptrCancelIoEx(handle, overlapped);
else
- CancelIo(handle);
+ return CancelIo(handle);
}
QWindowsPipeReader::~QWindowsPipeReader()
{
if (readSequenceStarted) {
- qt_cancelIo(handle, &overlapped);
- dataReadNotifier->waitForNotified(-1, &overlapped);
+ if (qt_cancelIo(handle, &overlapped))
+ dataReadNotifier->waitForNotified(-1, &overlapped);
+ else
+ qErrnoWarning("QWindowsPipeReader: qt_cancelIo on handle %x failed.", handle);
}
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 12029f4a23f..0f51147252f 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -2088,9 +2088,8 @@ void QAbstractItemModel::fetchMore(const QModelIndex &)
The default implementation always returns false.
- If canFetchMore() returns true, QAbstractItemView will call fetchMore().
- However, the fetchMore() function is only called when the model is being
- populated incrementally.
+ If canFetchMore() returns true, the fetchMore() function should
+ be called. This is the behavior of QAbstractItemView, for example.
\sa fetchMore()
*/
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index c3a3afaf6cf..cbbbc18814d 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -106,6 +106,7 @@ public:
return *this;
}
inline T *operator&() { return &type; }
+ template <typename X> X as() const { return reinterpret_cast<X>(type); }
static QCFType constructFromGet(const T &t)
{
CFRetain(t);
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index ec808424f9f..02d4d0376a3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -638,6 +638,8 @@ void QCoreApplication::init()
d->processCommandLineArguments();
qt_startup_hook();
+
+ QCoreApplicationPrivate::is_app_running = true; // No longer starting up.
}
/*!
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index a82242939dd..36db55d25a6 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4194,7 +4194,7 @@ void qDeleteInEventHandler(QObject *o)
connecting to a static function or a functor
\a slot a pointer only used when using Qt::UniqueConnection
\a type the Qt::ConnctionType passed as argument to connect
- \a types an array of integer with the metatype id of the parametter of the signal
+ \a types an array of integer with the metatype id of the parameter of the signal
to be used with queued connection
must stay valid at least for the whole time of the connection, this function
do not take ownership. typically static data.
@@ -4209,7 +4209,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
const int *types, const QMetaObject *senderMetaObject)
{
if (!sender || !signal || !slotObj || !senderMetaObject) {
- qWarning("QObject::connect: invalid null parametter");
+ qWarning("QObject::connect: invalid null parameter");
if (slotObj)
slotObj->destroyIfLastRef();
return QMetaObject::Connection();
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index 68d8fdf9612..1452e720ad0 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -59,7 +59,7 @@ namespace QtPrivate {
/*
The following List classes are used to help to handle the list of arguments.
It follow the same principles as the lisp lists.
- List_Left<L,N> take a list and a number as a parametter and returns (via the Value typedef,
+ List_Left<L,N> take a list and a number as a parameter and returns (via the Value typedef,
the list composed of the first N element of the list
*/
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
@@ -113,7 +113,7 @@ namespace QtPrivate {
- ArgumentCount is the number of argument, or -1 if it is unknown
- the Object typedef is the Object of a pointer to member function
- the Arguments typedef is the list of argument (in a QtPrivate::List)
- - the Function typedef is an alias to the template parametter Func
+ - the Function typedef is an alias to the template parameter Func
- the call<Args, R>(f,o,args) method is used to call that slot
Args is the list of argument of the signal
R is the return type of the signal
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index eea90be5eb0..4fd6cd1779a 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -158,6 +158,7 @@
/*!
\fn void QPointer::clear()
+ \since 5.0
Clears this QPointer object.
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index 0eee425cf9c..7a29247fc5d 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -94,8 +94,7 @@ timeval QTimerInfoList::updateCurrentTime()
#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED)
-template <>
-timeval qAbs(const timeval &t)
+timeval qAbsTimeval(const timeval &t)
{
timeval tmp = t;
if (tmp.tv_sec < 0) {
@@ -144,7 +143,7 @@ bool QTimerInfoList::timeChanged(timeval *delta)
timeval tickGranularity;
tickGranularity.tv_sec = 0;
tickGranularity.tv_usec = msPerTick * 1000;
- return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
+ return elapsedTimeTicks < ((qAbsTimeval(*delta) - tickGranularity) * 10);
}
/*
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index d8b7a02a1b8..a5f5a326d41 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -418,7 +418,7 @@ QMimeType QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode
} else {
// Implemented as a wrapper around mimeTypeForFile(QFileInfo), so no mutex.
QFileInfo fileInfo(fileName);
- return mimeTypeForFile(fileInfo);
+ return mimeTypeForFile(fileInfo, mode);
}
}
diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc
index 74c4289017c..eacfe995aef 100644
--- a/src/corelib/plugin/qplugin.qdoc
+++ b/src/corelib/plugin/qplugin.qdoc
@@ -43,7 +43,7 @@
to the interface class called \a ClassName. The \a Identifier must
be unique. For example:
- \snippet tools/plugandpaint/interfaces.h 3
+ \snippet plugins/interfaces.h 3
This macro is normally used right after the class definition for
\a ClassName, in a header file. See the
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 86a6a020cde..413dfb8d88c 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -4045,6 +4045,16 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
_tzset();
#endif
time_t secsSince1Jan1970UTC = mktime(&localTM);
+#ifdef Q_OS_QNX
+ //mktime sometimes fails on QNX. Following workaround converts the date and time then manually
+ if (secsSince1Jan1970UTC == (time_t)-1) {
+ QDateTime tempTime = QDateTime(date, time, Qt::UTC);;
+ tempTime = tempTime.addMSecs(timezone * 1000);
+ date = tempTime.date();
+ time = tempTime.time();
+ return;
+ }
+#endif
#endif
tm *brokenDown = 0;
#if defined(Q_OS_WINCE)
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 49f5ae42100..760c944c29c 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -511,7 +511,8 @@ void **QListData::erase(void **xi)
Construct a list from the std::initializer_list specified by \a args.
- This constructor is only enabled if the compiler supports C++0x
+ This constructor is only enabled if the compiler supports C++11 initializer
+ lists.
*/
/*! \fn QList::~QList()
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 0dc6f389b32..0c35860b56f 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -434,18 +434,26 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case CurrencyToString:
return macFormatCurrency(in.value<QSystemLocale::CurrencyToStringArgument>());
case UILanguages: {
- QCFType<CFArrayRef> languages = (CFArrayRef)CFPreferencesCopyValue(
+ QCFType<CFPropertyListRef> languages = (CFArrayRef)CFPreferencesCopyValue(
CFSTR("AppleLanguages"),
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
- const int cnt = languages == NULL ? 0 : CFArrayGetCount(languages);
QStringList result;
- result.reserve(cnt);
- for (int i = 0; i < cnt; ++i) {
- const QString lang = QCFString::toQString(
- static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages, i)));
- result.append(lang);
+ CFTypeID typeId = CFGetTypeID(languages);
+ if (typeId == CFArrayGetTypeID()) {
+ const int cnt = CFArrayGetCount(languages.as<CFArrayRef>());
+ result.reserve(cnt);
+ for (int i = 0; i < cnt; ++i) {
+ const QString lang = QCFString::toQString(
+ static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i)));
+ result.append(lang);
+ }
+ } else if (typeId == CFStringGetTypeID()) {
+ result = QStringList(QCFString::toQString(languages.as<CFStringRef>()));
+ } else {
+ qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt-project.org",
+ qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId))));
}
return QVariant(result);
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 6c64ea9f6dd..7d39025e8c6 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -4094,6 +4094,13 @@ QString::Data *QString::fromAscii_helper(const char *str, int size)
\sa toLatin1(), fromUtf8(), fromLocal8Bit()
*/
+/*!
+ \fn QString QString::fromLatin1(const QByteArray &str)
+ \overload
+ \since 5.0
+
+ Returns a QString initialized with the Latin-1 string \a str.
+*/
/*! \fn QString QString::fromLocal8Bit(const char *str, int size)
Returns a QString initialized with the first \a size characters
@@ -4106,6 +4113,14 @@ QString::Data *QString::fromAscii_helper(const char *str, int size)
\sa toLocal8Bit(), fromLatin1(), fromUtf8()
*/
+
+/*!
+ \fn QString QString::fromLocal8Bit(const QByteArray &str)
+ \overload
+ \since 5.0
+
+ Returns a QString initialized with the 8-bit string \a str.
+*/
QString QString::fromLocal8Bit_helper(const char *str, int size)
{
if (!str)
@@ -4138,6 +4153,15 @@ QString QString::fromLocal8Bit_helper(const char *str, int size)
\sa toAscii(), fromLatin1(), fromUtf8(), fromLocal8Bit()
*/
+/*!
+ \fn QString QString::fromAscii(const QByteArray &str)
+ \deprecated
+ \overload
+ \since 5.0
+
+ Returns a QString initialized with the string \a str.
+*/
+
/*! \fn QString QString::fromUtf8(const char *str, int size)
Returns a QString initialized with the first \a size bytes
of the UTF-8 string \a str.
@@ -4159,6 +4183,14 @@ QString QString::fromLocal8Bit_helper(const char *str, int size)
\sa toUtf8(), fromLatin1(), fromLocal8Bit()
*/
+
+/*!
+ \fn QString QString::fromUtf8(const QByteArray &str)
+ \overload
+ \since 5.0
+
+ Returns a QString initialized with the UTF-8 string \a str.
+*/
QString QString::fromUtf8_helper(const char *str, int size)
{
if (!str)
@@ -9169,6 +9201,8 @@ QVector<uint> QStringRef::toUcs4() const
*/
/*!
+ \since 5.0
+
Converts a plain text string to an HTML string with
HTML metacharacters \c{<}, \c{>}, \c{&}, and \c{"} replaced by HTML
entities.
@@ -9237,6 +9271,19 @@ QString QString::toHtmlEscaped() const
\code
if (attribute.name() == QLatin1String("http-contents-length")) //...
\endcode
+
+ \note There some restrictions when using the MSVC 2010 or 2012 compilers. The example snippets provided here
+ fail to compile with them.
+ \list
+ \li Concatenated string literals cannot be used with QStringLiteral.
+ \code
+ QString s = QStringLiteral("a" "b");
+ \endcode
+ \li QStringLiteral cannot be used to initialize lists or arrays of QString.
+ \code
+ QString a[] = { QStringLiteral("a"), QStringLiteral("b") };
+ \endcode
+ \endlist
*/
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index f48db4a6432..f38acef6643 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -738,7 +738,8 @@ int QtPrivate::QStringList_removeDuplicates(QStringList *that)
Construct a list from a std::initializer_list given by \a args.
- This constructor is only enabled if the compiler supports C++0x
+ This constructor is only enabled if the compiler supports C++11 initializer
+ lists.
*/
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index efc4b6a446b..448c8e4c6a6 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -230,7 +230,8 @@
Construct a vector from the std::initilizer_list given by \a args.
- This constructor is only enabled if the compiler supports C++0x
+ This constructor is only enabled if the compiler supports C++11 initializer
+ lists.
*/
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 4be4593e95b..372b1d91fe2 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -784,6 +784,7 @@ QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack()
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
namespaceDeclaration.prefix = addToStringStorage(QLatin1String("xml"));
namespaceDeclaration.namespaceUri = addToStringStorage(QLatin1String("http://www.w3.org/XML/1998/namespace"));
+ initialTagStackStringStorageSize = tagStackStringStorageSize;
}
#ifndef QT_NO_XMLSTREAMREADER
@@ -854,6 +855,7 @@ void QXmlStreamReaderPrivate::init()
rawReadBuffer.clear();
dataBuffer.clear();
readBuffer.clear();
+ tagStackStringStorageSize = initialTagStackStringStorageSize;
type = QXmlStreamReader::NoToken;
error = QXmlStreamReader::NoError;
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index 68b7ff7af34..448764ab58a 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -697,6 +697,7 @@ public:
QXmlStreamSimpleStack<NamespaceDeclaration> namespaceDeclarations;
QString tagStackStringStorage;
int tagStackStringStorageSize;
+ int initialTagStackStringStorageSize;
bool tagsDone;
inline QStringRef addToStringStorage(const QStringRef &s) {
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 5ad77ddf951..2e4119ba930 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -6,6 +6,8 @@ MODULE_CONFIG = dbusadaptors dbusinterfaces
!isEmpty(DBUS_PATH) {
INCLUDEPATH += $$DBUS_PATH/include
QMAKE_LIBDIR += $$DBUS_PATH/lib
+ win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d
+ else:QT_LIBS_DBUS += -ldbus-1
}
DEFINES += DBUS_API_SUBJECT_TO_CHANGE
@@ -21,8 +23,6 @@ win32 {
-ladvapi32 \
-lnetapi32 \
-luser32
- CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d
- else:LIBS_PRIVATE += -ldbus-1
}
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf
diff --git a/src/gui/QtGui.dynlist b/src/gui/QtGui.dynlist
new file mode 100644
index 00000000000..7e15e37845a
--- /dev/null
+++ b/src/gui/QtGui.dynlist
@@ -0,0 +1,5 @@
+{
+ extern "C++" {
+ "QGuiApplication::notify(QObject*, QEvent*)";
+ };
+};
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 058cfe92ecb..33fa1c6e07a 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -37,3 +37,4 @@ include(itemmodels/itemmodels.pri)
QMAKE_LIBS += $$QMAKE_LIBS_GUI
+QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index dce902301cb..a297c32b3c0 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -945,6 +945,7 @@ void QIcon::setThemeName(const QString &name)
*/
QString QIcon::themeName()
{
+ QIconLoader::instance()->ensureInitialized();
return QIconLoader::instance()->themeName();
}
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index d6161671b15..d5d742c9b3b 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -2714,7 +2714,7 @@ bool QStandardItemModel::hasChildren(const QModelIndex &parent) const
*/
QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const
{
- return createIndex(row, column, idx.internalPointer());
+ return QAbstractItemModel::sibling(row, column, idx);
}
/*!
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index b4f03008fdf..0d6649039c0 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -332,6 +332,7 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
+ // Qt 6: Remove
QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c155ecfe0cd..d42da6ee79c 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -926,6 +926,8 @@ static bool runningUnderDebugger()
void QGuiApplicationPrivate::init()
{
+ QCoreApplicationPrivate::is_app_running = false; // Starting up.
+
bool doGrabUnderDebugger = false;
QList<QByteArray> pluginList;
// Get command line params
@@ -1559,6 +1561,8 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
}
QGuiApplicationPrivate::focus_window = newFocus;
+ if (!qApp)
+ return;
if (previous) {
QFocusEvent focusOut(QEvent::FocusOut);
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index b710701e7f8..79e4cbf6744 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -41,11 +41,13 @@
#include "qplatformwindow.h"
#include "qplatformwindow_p.h"
+#include "qplatformscreen.h"
#include <private/qguiapplication_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/qwindow.h>
#include <QtGui/qscreen.h>
+#include <private/qwindow_p.h>
QT_BEGIN_NAMESPACE
@@ -449,6 +451,43 @@ QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &
}
/*!
+ Helper function to get initial geometry on windowing systems which do not
+ do smart positioning and also do not provide a means of centering a
+ transient window w.r.t. its parent. For example this is useful on Windows
+ and MacOS but not X11, because an X11 window manager typically tries to
+ layout new windows to optimize usage of the available desktop space.
+ However if the given window already has geometry which the application has
+ initialized, it takes priority.
+*/
+QRect QPlatformWindow::initialGeometry(const QWindow *w,
+ const QRect &initialGeometry, int defaultWidth, int defaultHeight)
+{
+ QRect rect(initialGeometry);
+ if (rect.isNull()) {
+ QSize minimumSize = w->minimumSize();
+ if (minimumSize.width() > 0 || minimumSize.height() > 0) {
+ rect.setSize(minimumSize);
+ } else {
+ rect.setWidth(defaultWidth);
+ rect.setHeight(defaultHeight);
+ }
+ }
+ if (w->isTopLevel() && qt_window_private(const_cast<QWindow*>(w))->positionAutomatic) {
+ const QWindow *tp = w->transientParent();
+ if (tp) {
+ // A transient window should be centered w.r.t. its transient parent.
+ rect.moveCenter(tp->geometry().center());
+ } else {
+ // Center the window on the screen. (Only applicable on platforms
+ // which do not provide a better way.)
+ QPlatformScreen *scr = QPlatformScreen::platformScreenForWindow(w);
+ rect.moveCenter(scr->availableGeometry().center());
+ }
+ }
+ return rect;
+}
+
+/*!
\class QPlatformWindow
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index fe62d7b67b8..410e7ea9bbb 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -130,6 +130,9 @@ public:
virtual void setFrameStrutEventsEnabled(bool enabled);
virtual bool frameStrutEventsEnabled() const;
+ static QRect initialGeometry(const QWindow *w,
+ const QRect &initialGeometry, int defaultWidth, int defaultHeight);
+
protected:
static QString formatWindowTitle(const QString &title, const QString &separator);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 2fcad5706f9..65530f676a6 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -126,6 +126,18 @@ QT_BEGIN_NAMESPACE
and can keep rendering until it isExposed() returns false. To find out when
isExposed() changes, reimplement exposeEvent(). The window will always get
a resize event before the first expose event.
+
+ \section1 Initial geometry
+
+ If the window's width and height are left uninitialized, the window will
+ get a reasonable default geometry from the platform window. If the position
+ is left uninitialized, then the platform window will allow the windowing
+ system to position the window. For example on X11, the window manager
+ usually does some kind of smart positioning to try to avoid having new
+ windows completely obscure existing windows. However setGeometry()
+ initializes both the position and the size, so if you want a fixed size but
+ an automatic position, you should call resize() or setWidth() and
+ setHeight() instead.
*/
/*!
@@ -962,7 +974,7 @@ void QWindow::setY(int arg)
void QWindow::setWidth(int arg)
{
if (width() != arg)
- setGeometry(QRect(x(), y(), arg, height()));
+ resize(arg, height());
}
/*!
@@ -972,7 +984,7 @@ void QWindow::setWidth(int arg)
void QWindow::setHeight(int arg)
{
if (height() != arg)
- setGeometry(QRect(x(), y(), width(), arg));
+ resize(width(), arg);
}
/*!
@@ -1095,6 +1107,7 @@ void QWindow::setGeometry(int posx, int posy, int w, int h)
void QWindow::setGeometry(const QRect &rect)
{
Q_D(QWindow);
+ d->positionAutomatic = false;
if (rect == geometry())
return;
QRect oldRect = geometry();
@@ -1246,7 +1259,12 @@ void QWindow::resize(const QSize &newSize)
if (d->platformWindow) {
d->platformWindow->setGeometry(QRect(position(), newSize));
} else {
+ const QSize oldSize = d->geometry.size();
d->geometry.setSize(newSize);
+ if (newSize.width() != oldSize.width())
+ emit widthChanged(newSize.width());
+ if (newSize.height() != oldSize.height())
+ emit heightChanged(newSize.height());
}
}
@@ -1436,13 +1454,15 @@ QObject *QWindow::focusObject() const
Shows the window.
This equivalent to calling showFullScreen() or showNormal(), depending
- on whether the platform defaults to windows being fullscreen or not.
+ on whether the platform defaults to windows being fullscreen or not, and
+ whether the window is a popup.
- \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen()
+ \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
*/
void QWindow::show()
{
- if (qApp->styleHints()->showIsFullScreen())
+ bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window;
+ if (!isPopup && qApp->styleHints()->showIsFullScreen())
showFullScreen();
else
showNormal();
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 6933c892a02..26bf0700f2b 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -88,6 +88,7 @@ public:
, resizeEventPending(true)
, receivedExpose(false)
, positionPolicy(WindowFrameExclusive)
+ , positionAutomatic(true)
, contentOrientation(Qt::PrimaryOrientation)
, opacity(qreal(1.0))
, minimumSize(0, 0)
@@ -137,6 +138,7 @@ public:
bool resizeEventPending;
bool receivedExpose;
PositionPolicy positionPolicy;
+ bool positionAutomatic;
Qt::ScreenOrientation contentOrientation;
qreal opacity;
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 3659c56ac70..0f3cde3efd0 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -583,6 +583,7 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
patternOffset = state->lastPen.dashOffset()*64;
lastPixel.x = -1;
+ const qreal *begin = points;
const qreal *end = points + 2*path.elementCount();
// handle closed path case
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
@@ -592,6 +593,7 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
}
+ bool fastPenAliased = (state->flags.fast_pen && !state->flags.antialiased);
points += 2;
while (points < end) {
QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
@@ -599,9 +601,22 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
if (!closed && drawCaps && points == end - 2)
caps |= CapEnd;
+ QCosmeticStroker::Point last = this->lastPixel;
stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
- p = p2;
+ /* fix for gaps in polylines with fastpen and aliased in a sequence
+ of points with small distances: if current point p2 has been dropped
+ out, keep last non dropped point p. */
+ if (fastPenAliased) {
+ if (last.x != lastPixel.x || last.y != lastPixel.y ||
+ points == begin + 2 || points == end - 2 ) {
+ {
+ p = p2;
+ }
+ }
+ } else {
+ p = p2;
+ }
points += 2;
caps = NoCaps;
}
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 8483a05d60f..a6be7c6c782 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -891,6 +891,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
const Q16Dot16 rowHeight = qMin(yFP + Q16Dot16Factor, yPb)
- qMax(yFP, yPa);
const int y = Q16Dot16ToInt(yFP);
+ if (y > d->clipRect.bottom())
+ break;
for (int i = 0; i < n; ++i) {
buffer.addSpan(x[i], len[i], y,
Q16Dot16ToInt(Q16Dot16Multiply(rowHeight, coverage[i])));
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 2ffdc9cd598..ed0473749e5 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -109,7 +109,8 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_current_fontengine = fontEngine;
const int margin = m_current_fontengine->glyphMargin(m_type);
- const int paddingDoubled = glyphPadding() * 2;
+ const int padding = glyphPadding();
+ const int paddingDoubled = padding * 2;
bool supportsSubPixelPositions = fontEngine->supportsSubPixelPositions();
if (fontEngine->m_subPixelPositionCount == 0) {
@@ -122,6 +123,11 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
}
}
+ if (m_cx == 0 && m_cy == 0) {
+ m_cx = padding;
+ m_cy = padding;
+ }
+
QHash<GlyphAndSubPixelPosition, Coord> listItemCoordinates;
int rowHeight = 0;
@@ -202,21 +208,21 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2);
- if (m_cx + c.w > requiredWidth) {
+ if (m_cx + c.w + padding > requiredWidth) {
int new_width = requiredWidth*2;
- while (new_width < m_cx + c.w)
+ while (new_width < m_cx + c.w + padding)
new_width *= 2;
if (new_width <= maxTextureWidth()) {
requiredWidth = new_width;
} else {
// no room on the current line, start new glyph strip
- m_cx = 0;
+ m_cx = padding;
m_cy += m_currentRowHeight + paddingDoubled;
m_currentRowHeight = c.h + margin * 2; // New row
}
}
- if (maxTextureHeight() > 0 && m_cy + c.h > maxTextureHeight()) {
+ if (maxTextureHeight() > 0 && m_cy + c.h + padding > maxTextureHeight()) {
// We can't make a cache of the required size, so we bail out
return false;
}
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 5b728403cb1..48769107d0e 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -631,14 +631,6 @@ static const int scriptForWritingSystem[] = {
QUnicodeTables::Common, // Japanese
QUnicodeTables::Hangul, // Korean
QUnicodeTables::Common, // Vietnamese
- QUnicodeTables::Common, // Yi
- QUnicodeTables::Common, // Tagalog
- QUnicodeTables::Common, // Hanunoo
- QUnicodeTables::Common, // Buhid
- QUnicodeTables::Common, // Tagbanwa
- QUnicodeTables::Common, // Limbu
- QUnicodeTables::Common, // TaiLe
- QUnicodeTables::Common, // Braille
QUnicodeTables::Common, // Symbol
QUnicodeTables::Ogham, // Ogham
QUnicodeTables::Runic, // Runic
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 07e4cae1eea..83ba89263a2 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -889,18 +889,28 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
info.yOff = 0;
if ((set && set->outline_drawing) || fetchMetricsOnly) {
- // If the advance doesn't fit in signed char, don't cache it
- if (qAbs(info.xOff) >= 128)
- return 0;
- g = new Glyph;
- g->data = 0;
- g->linearAdvance = slot->linearHoriAdvance >> 10;
int left = FLOOR(slot->metrics.horiBearingX);
int right = CEIL(slot->metrics.horiBearingX + slot->metrics.width);
int top = CEIL(slot->metrics.horiBearingY);
int bottom = FLOOR(slot->metrics.horiBearingY - slot->metrics.height);
- g->width = TRUNC(right-left);
- g->height = TRUNC(top-bottom);
+ int width = right-left;
+ int height = top-bottom;
+
+ // If any of the metrics are too large to fit, don't cache them
+ if (qAbs(info.xOff) >= 128
+ || qAbs(TRUNC(top)) >= 128
+ || TRUNC(width) >= 256
+ || TRUNC(height) >= 256
+ || qAbs(TRUNC(left)) >= 128
+ || qAbs(TRUNC(ROUND(slot->advance.x))) >= 128) {
+ return 0;
+ }
+
+ g = new Glyph;
+ g->data = 0;
+ g->linearAdvance = slot->linearHoriAdvance >> 10;
+ g->width = TRUNC(width);
+ g->height = TRUNC(height);
g->x = TRUNC(left);
g->y = TRUNC(top);
g->advance = TRUNC(ROUND(slot->advance.x));
diff --git a/src/gui/text/qharfbuzz_copy_p.h b/src/gui/text/qharfbuzz_copy_p.h
index 34acca3f9a3..7225ff77171 100644
--- a/src/gui/text/qharfbuzz_copy_p.h
+++ b/src/gui/text/qharfbuzz_copy_p.h
@@ -69,8 +69,9 @@ typedef enum {
typedef QT_PREPEND_NAMESPACE(quint32) HB_Glyph;
typedef void * HB_Font;
typedef void * HB_Face;
-typedef void * HB_FontRec;
typedef QT_PREPEND_NAMESPACE(quint32) hb_uint32;
+typedef QT_PREPEND_NAMESPACE(quint16) HB_UShort;
+typedef QT_PREPEND_NAMESPACE(qint32) HB_16Dot16;
typedef QT_PREPEND_NAMESPACE(qint32) HB_Fixed;
typedef struct {
@@ -88,6 +89,16 @@ typedef struct {
hb_bitfield combiningClass :8;
} HB_GlyphAttributes;
+typedef struct HB_Font_ {
+ const void *klass;
+
+ /* Metrics */
+ HB_UShort x_ppem, y_ppem;
+ HB_16Dot16 x_scale, y_scale;
+
+ void *userData;
+} HB_FontRec;
+
}
#endif // ifdef QT_BUILD_GUI_LIB
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 6dbc25db4c5..02f78aeaed0 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -623,8 +623,8 @@ int QNativeSocketEngine::accept()
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::accept(), -1);
- Q_CHECK_STATE(QNativeSocketEngine::accept(), QAbstractSocket::ListeningState, false);
- Q_CHECK_TYPE(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, false);
+ Q_CHECK_STATE(QNativeSocketEngine::accept(), QAbstractSocket::ListeningState, -1);
+ Q_CHECK_TYPE(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, -1);
return d->nativeAccept();
}
@@ -702,7 +702,7 @@ qint64 QNativeSocketEngine::bytesAvailable() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
- Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, false);
+ Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
return d->nativeBytesAvailable();
}
@@ -732,7 +732,7 @@ qint64 QNativeSocketEngine::pendingDatagramSize() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::pendingDatagramSize(), -1);
- Q_CHECK_TYPE(QNativeSocketEngine::pendingDatagramSize(), QAbstractSocket::UdpSocket, false);
+ Q_CHECK_TYPE(QNativeSocketEngine::pendingDatagramSize(), QAbstractSocket::UdpSocket, -1);
return d->nativePendingDatagramSize();
}
@@ -757,7 +757,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxSize, QHostAddres
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::readDatagram(), -1);
- Q_CHECK_TYPE(QNativeSocketEngine::readDatagram(), QAbstractSocket::UdpSocket, false);
+ Q_CHECK_TYPE(QNativeSocketEngine::readDatagram(), QAbstractSocket::UdpSocket, -1);
return d->nativeReceiveDatagram(data, maxSize, address, port);
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 6476e2b26cb..71f1bd2b548 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -3786,7 +3786,7 @@ void QGLWidget::setFormat(const QGLFormat &format)
attributes that were requested.
*/
-/*
+/*!
\fn void QGLWidget::setContext(QGLContext *context,
const QGLContext* shareContext,
bool deleteOldContext)
@@ -3812,6 +3812,12 @@ void QGLWidget::setFormat(const QGLFormat &format)
to the old context (as returned by context()), and want to restore
that context later.
+ \note This function is obsolete and should no longer be used. If you were
+ using it to recreate the context for a QGLWidget, you should instead create a
+ new QGLWidget or use the QOpenGLContext API in conjunction with QWindow.
+ There is currently no officially supported way to substitute QGLWidget's
+ context with your own implementation of QGLContext.
+
\sa context(), isSharing()
*/
diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri
index 188eb1ce644..3257bcb8d2b 100644
--- a/src/platformsupport/eglconvenience/eglconvenience.pri
+++ b/src/platformsupport/eglconvenience/eglconvenience.pri
@@ -12,5 +12,6 @@ contains(QT_CONFIG,egl) {
SOURCES += \
$$PWD/qxlibeglintegration.cpp
}
+ CONFIG += egl
}
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
index 81acc161fe1..4932087c5f1 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -57,7 +57,13 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
{
Q_UNUSED(key);
- QStringList args = specification.split(QLatin1Char(':'));
+
+ QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_KEYBOARD_PARAMETERS"));
+
+ if (spec.isEmpty())
+ spec = specification;
+
+ QStringList args = spec.split(QLatin1Char(':'));
QStringList devices;
foreach (const QString &arg, args) {
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index 415cffa4ae7..6c430091c1e 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -59,7 +59,12 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
{
Q_UNUSED(key);
- QStringList args = specification.split(QLatin1Char(':'));
+ QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_MOUSE_PARAMETERS"));
+
+ if (spec.isEmpty())
+ spec = specification;
+
+ QStringList args = spec.split(QLatin1Char(':'));
QStringList devices;
foreach (const QString &arg, args) {
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index 8c86eee469a..2c93da147e6 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -159,7 +159,7 @@ static inline bool testBit(long bit, const long *array)
return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1;
}
-QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &spec, QObject *parent)
+QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QObject *parent)
: QObject(parent), m_notify(0), m_fd(-1), d(0)
#ifdef USE_MTDEV
, m_mtdev(0)
@@ -170,7 +170,13 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &spec, QObject
QString dev;
// only the first device argument is used for now
+ QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS"));
+
+ if (spec.isEmpty())
+ spec = specification;
+
QStringList args = spec.split(QLatin1Char(':'));
+
for (int i = 0; i < args.count(); ++i) {
if (args.at(i).startsWith(QLatin1String("/dev/"))) {
dev = args.at(i);
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h
index b4de2ca0880..7e838c91344 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h
@@ -63,7 +63,7 @@ class QEvdevTouchScreenHandler : public QObject
Q_OBJECT
public:
- explicit QEvdevTouchScreenHandler(const QString &spec = QString(), QObject *parent = 0);
+ explicit QEvdevTouchScreenHandler(const QString &specification = QString(), QObject *parent = 0);
~QEvdevTouchScreenHandler();
private slots:
diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp
index 6e826e44328..5c8f2e5fe24 100644
--- a/src/platformsupport/linuxaccessibility/application.cpp
+++ b/src/platformsupport/linuxaccessibility/application.cpp
@@ -174,7 +174,7 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout);
if (sent) {
//queue the event and send it after callback
- keyEvents.enqueue(QPair<QObject*, QKeyEvent*> (target, copyKeyEvent(keyEvent)));
+ keyEvents.enqueue(QPair<QPointer<QObject>, QKeyEvent*> (QPointer<QObject>(target), copyKeyEvent(keyEvent)));
#ifdef KEYBOARD_DEBUG
qDebug() << QStringLiteral("Sent key: ") << de.text;
#endif
@@ -200,11 +200,12 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage&
}
Q_ASSERT(message.arguments().length() == 1);
if (message.arguments().at(0).toBool() == true) {
- QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
+ QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
delete event.second;
} else {
- QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
- QCoreApplication::postEvent(event.first, event.second);
+ QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
+ if (event.first)
+ QCoreApplication::postEvent(event.first.data(), event.second);
}
}
@@ -212,8 +213,9 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error
{
qWarning() << QStringLiteral("QSpiApplication::keyEventError ") << error.name() << error.message();
while (!keyEvents.isEmpty()) {
- QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
- QCoreApplication::postEvent(event.first, event.second);
+ QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
+ if (event.first)
+ QCoreApplication::postEvent(event.first.data(), event.second);
}
}
diff --git a/src/platformsupport/linuxaccessibility/application_p.h b/src/platformsupport/linuxaccessibility/application_p.h
index 9b6763f1118..754d98495a5 100644
--- a/src/platformsupport/linuxaccessibility/application_p.h
+++ b/src/platformsupport/linuxaccessibility/application_p.h
@@ -42,6 +42,7 @@
#ifndef Q_SPI_APPLICATION_H
#define Q_SPI_APPLICATION_H
+#include <QtCore/QPointer>
#include <QtCore/QQueue>
#include <QtDBus/QDBusConnection>
#include <QtGui/QAccessibleInterface>
@@ -76,7 +77,7 @@ private Q_SLOTS:
private:
static QKeyEvent* copyKeyEvent(QKeyEvent*);
- QQueue<QPair<QObject*, QKeyEvent*> > keyEvents;
+ QQueue<QPair<QPointer<QObject>, QKeyEvent*> > keyEvents;
QDBusConnection dbusConnection;
};
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index f2babe41a43..6e40bbfa15f 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -380,7 +380,7 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(QGenericUnixTheme::xdgIconThemePaths());
case QPlatformTheme::StyleNames: {
QStringList styleNames;
- styleNames << QStringLiteral("GTK+") << QStringLiteral("cleanlooks") << QStringLiteral("windows");
+ styleNames << QStringLiteral("GTK+") << QStringLiteral("fusion") << QStringLiteral("windows");
return QVariant(styleNames);
}
case QPlatformTheme::KeyboardScheme:
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 2b28cdbf61f..589b0e2c248 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -159,7 +159,7 @@ void QConnmanEngine::connectToId(const QString &id)
QOfonoDataConnectionManagerInterface dc(modemPath,0);
foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) {
if(dcPath.path().contains(servicePath.section("_",-1))) {
- QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0);
+ QOfonoConnectionContextInterface primaryContext(dcPath.path(),0);
primaryContext.setActive(true);
}
}
@@ -183,7 +183,7 @@ void QConnmanEngine::disconnectFromId(const QString &id)
QOfonoDataConnectionManagerInterface dc(modemPath,0);
foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) {
if(dcPath.path().contains(servicePath.section("_",-1))) {
- QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0);
+ QOfonoConnectionContextInterface primaryContext(dcPath.path(),0);
primaryContext.setActive(false);
}
}
diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp
index f6fb55522ec..1983276d944 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux.cpp
+++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp
@@ -108,7 +108,7 @@ QDBusObjectPath QOfonoManagerInterface::currentModem()
foreach (const QDBusObjectPath &modem, modems) {
QOfonoModemInterface device(modem.path());
if (device.isPowered() && device.isOnline())
- return modem;;
+ return modem;
}
return QDBusObjectPath();
}
@@ -770,7 +770,7 @@ QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
return reply.value();
}
-QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent)
+QOfonoConnectionContextInterface::QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent)
: QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
dbusPathName,
OFONO_DATA_CONTEXT_INTERFACE,
@@ -778,68 +778,68 @@ QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QStri
{
}
-QOfonoPrimaryDataContextInterface::~QOfonoPrimaryDataContextInterface()
+QOfonoConnectionContextInterface::~QOfonoConnectionContextInterface()
{
}
-bool QOfonoPrimaryDataContextInterface::isActive()
+bool QOfonoConnectionContextInterface::isActive()
{
QVariant var = getProperty("Active");
return qdbus_cast<bool>(var);
}
-QString QOfonoPrimaryDataContextInterface::getApName()
+QString QOfonoConnectionContextInterface::getApName()
{
QVariant var = getProperty("AccessPointName");
return qdbus_cast<QString>(var);
}
-QString QOfonoPrimaryDataContextInterface::getType()
+QString QOfonoConnectionContextInterface::getType()
{
QVariant var = getProperty("Type");
return qdbus_cast<QString>(var);
}
-QString QOfonoPrimaryDataContextInterface::getName()
+QString QOfonoConnectionContextInterface::getName()
{
QVariant var = getProperty("Name");
return qdbus_cast<QString>(var);
}
-QVariantMap QOfonoPrimaryDataContextInterface::getSettings()
+QVariantMap QOfonoConnectionContextInterface::getSettings()
{
QVariant var = getProperty("Settings");
return qdbus_cast<QVariantMap>(var);
}
-QString QOfonoPrimaryDataContextInterface::getInterface()
+QString QOfonoConnectionContextInterface::getInterface()
{
QVariant var = getProperty("Interface");
return qdbus_cast<QString>(var);
}
-QString QOfonoPrimaryDataContextInterface::getAddress()
+QString QOfonoConnectionContextInterface::getAddress()
{
QVariant var = getProperty("Address");
return qdbus_cast<QString>(var);
}
-bool QOfonoPrimaryDataContextInterface::setActive(bool on)
+bool QOfonoConnectionContextInterface::setActive(bool on)
{
// this->setProperty("Active", QVariant(on));
return setProp("Active", QVariant::fromValue(on));
}
-bool QOfonoPrimaryDataContextInterface::setApn(const QString &name)
+bool QOfonoConnectionContextInterface::setApn(const QString &name)
{
return setProp("AccessPointName", QVariant::fromValue(name));
}
-void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
+void QOfonoConnectionContextInterface::connectNotify(const QMetaMethod &signal)
{
Q_UNUSED(signal);
-// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChanged);
// if (signal == propertyChangedSignal) {
// if (!connection().connect(QLatin1String(OFONO_SERVICE),
// this->path(),
@@ -850,7 +850,7 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
// }
// }
-// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChangedContext);
+// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChangedContext);
// if (signal == propertyChangedContextSignal) {
// QOfonoDBusHelper *helper;
// helper = new QOfonoDBusHelper(this);
@@ -867,16 +867,16 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
// }
}
-void QOfonoPrimaryDataContextInterface::disconnectNotify(const QMetaMethod &signal)
+void QOfonoConnectionContextInterface::disconnectNotify(const QMetaMethod &signal)
{
Q_UNUSED(signal);
-// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChanged);
// if (signal == propertyChangedSignal) {
// }
}
-QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property)
+QVariant QOfonoConnectionContextInterface::getProperty(const QString &property)
{
QVariant var;
QVariantMap map = getProperties();
@@ -888,13 +888,13 @@ QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property)
return var;
}
-QVariantMap QOfonoPrimaryDataContextInterface::getProperties()
+QVariantMap QOfonoConnectionContextInterface::getProperties()
{
QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
return reply.value();
}
-bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const QVariant &var)
+bool QOfonoConnectionContextInterface::setProp(const QString &property, const QVariant &var)
{
QList<QVariant> args;
args << QVariant::fromValue(property) << QVariant::fromValue(QDBusVariant(var));
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h
index 00be9aa6750..c73e8231a20 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux_p.h
+++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h
@@ -76,7 +76,7 @@
#define OFONO_NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator"
#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.DataConnectionManager"
#define OFONO_SIM_MANAGER_INTERFACE "org.ofono.SimManager"
-#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.PrimaryDataContext"
+#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.ConnectionContext"
#define OFONO_SMS_MANAGER_INTERFACE "org.ofono.SmsManager"
#define OFONO_PHONEBOOK_INTERFACE "org.ofono.Phonebook"
@@ -281,14 +281,14 @@ protected:
};
-class QOfonoPrimaryDataContextInterface : public QDBusAbstractInterface
+class QOfonoConnectionContextInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
- explicit QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent = 0);
- ~QOfonoPrimaryDataContextInterface();
+ explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QOfonoConnectionContextInterface();
QVariantMap getProperties();
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 7f022da4c3a..31726268f1b 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -73,7 +73,9 @@ QPaintDevice *QCocoaBackingStore::paintDevice()
}
#endif
- m_qImage = QImage(m_requestedSize * scaleFactor, QImage::Format_ARGB32_Premultiplied);
+ QImage::Format format = window()->format().hasAlpha()
+ ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
+ m_qImage = QImage(m_requestedSize * scaleFactor, format);
m_qImage.setDevicePixelRatio(scaleFactor);
}
return &m_qImage;
@@ -91,7 +93,7 @@ void QCocoaBackingStore::flush(QWindow *win, const QRegion &region, const QPoint
CGImageRelease(m_cgImage);
m_cgImage = 0;
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(win->handle()))
- [cocoaWindow->m_contentView flushBackingStore:this region:region offset:offset];
+ [cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset];
}
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 7fcdab4d975..93831158d0b 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -170,13 +170,13 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
windowSize.setHeight(windowRect.height());
}
- QPixmap windowPixmap(windowSize);
+ QPixmap windowPixmap(windowSize * devicePixelRatio());
windowPixmap.fill(Qt::transparent);
for (uint i = 0; i < displayCount; ++i) {
const CGRect bounds = CGDisplayBounds(displays[i]);
- int w = (width < 0 ? bounds.size.width : width);
- int h = (height < 0 ? bounds.size.height : height);
+ int w = (width < 0 ? bounds.size.width : width) * devicePixelRatio();
+ int h = (height < 0 ? bounds.size.height : height) * devicePixelRatio();
QRect displayRect = QRect(x, y, w, h);
QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displays[i],
CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height()));
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index bae52c91b85..c0c8caed058 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -77,8 +77,10 @@ QCocoaMenuBar::~QCocoaMenuBar()
[m_nativeMenu release];
static_menubars.removeOne(this);
- if (m_window)
+ if (m_window && m_window->menubar() == this) {
m_window->setMenubar(0);
+ updateMenuBarImmediately();
+ }
}
void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before)
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index d78ff73bb6f..40cffab3c96 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -195,7 +195,7 @@ NSMenuItem *QCocoaMenuItem::sync()
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
switch (m_role) {
case ApplicationSpecificRole:
- mergeItem = [loader appSpecificMenuItem];
+ mergeItem = [loader appSpecificMenuItem:reinterpret_cast<NSInteger>(this)];
break;
case AboutRole:
mergeItem = [loader aboutMenuItem];
@@ -315,9 +315,12 @@ NSMenuItem *QCocoaMenuItem::sync()
return m_native;
}
+QT_BEGIN_NAMESPACE
+extern QString qt_mac_applicationmenu_string(int type);
+QT_END_NAMESPACE
+
QString QCocoaMenuItem::mergeText()
{
- extern QString qt_mac_applicationmenu_string(int type);
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
if (m_native == [loader aboutMenuItem]) {
return qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName());
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.h b/src/plugins/platforms/cocoa/qcocoamenuloader.h
index f95f684e8c4..a45ec0fa895 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.h
@@ -79,7 +79,7 @@
- (NSMenuItem *)aboutMenuItem;
- (NSMenuItem *)aboutQtMenuItem;
- (NSMenuItem *)hideMenuItem;
-- (NSMenuItem *)appSpecificMenuItem;
+- (NSMenuItem *)appSpecificMenuItem:(NSInteger)tag;
- (IBAction)terminate:(id)sender;
- (IBAction)orderFrontStandardAboutPanel:(id)sender;
- (IBAction)hideOtherApplications:(id)sender;
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index 2a9dcec64b6..726fe5c6d2c 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -246,11 +246,17 @@ QT_END_NAMESPACE
return [[hideItem retain] autorelease];
}
-- (NSMenuItem *)appSpecificMenuItem
+- (NSMenuItem *)appSpecificMenuItem:(NSInteger)tag
{
+ NSMenuItem *item = [appMenu itemWithTag:tag];
+
+ // No reason to create the item if it already exists. See QTBUG-27202.
+ if (item)
+ return [[item retain] autorelease];
+
// Create an App-Specific menu item, insert it into the menu and return
// it as an autorelease item.
- NSMenuItem *item = [[NSMenuItem alloc] init];
+ item = [[NSMenuItem alloc] init];
NSInteger location;
if (lastAppSpecificItem == nil) {
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index 9506f862381..2f79b495348 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -102,6 +102,9 @@ private:
// QImage <-> CGImage conversion functions
static CGImageRef qImageToCGImage(const QImage &image);
static QImage cgImageToQImage(CGImageRef image);
+
+ // Embedding NSViews as child QWindows
+ static void setWindowContentView(QPlatformWindow *window, void *nsViewContentView);
};
#endif // QCOCOANATIVEINTERFACE_H
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index bd3a9091371..9990537c1f6 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -113,6 +113,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::qImageToCGImage);
if (resource.toLower() == "cgimagetoqimage")
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::cgImageToQImage);
+ if (resource.toLower() == "setwindowcontentview")
+ return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setWindowContentView);
return 0;
}
@@ -198,5 +200,10 @@ QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image)
return qt_mac_toQImage(image);
}
+void QCocoaNativeInterface::setWindowContentView(QPlatformWindow *window, void *contentView)
+{
+ QCocoaWindow *cocoaPlatformWindow = static_cast<QCocoaWindow *>(window);
+ cocoaPlatformWindow->setContentView(reinterpret_cast<NSView *>(contentView));
+}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
index 6f8d0fa22ac..8b0c14a9846 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
@@ -179,14 +179,14 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
if (mac_widget_colors[i].active != 0) {
qc = qt_mac_colorForThemeTextColor(mac_widget_colors[i].active);
pal.setColor(QPalette::Active, QPalette::Text, qc);
+ pal.setColor(QPalette::Inactive, QPalette::Text, qc);
pal.setColor(QPalette::Active, QPalette::WindowText, qc);
+ pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
+ pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
qc = qt_mac_colorForThemeTextColor(mac_widget_colors[i].inactive);
- pal.setColor(QPalette::Inactive, QPalette::Text, qc);
pal.setColor(QPalette::Disabled, QPalette::Text, qc);
- pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
}
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette) {
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 7140a68d49f..08c516b4f43 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -120,6 +120,7 @@ public:
void setParent(const QPlatformWindow *window);
NSView *contentView() const;
+ void setContentView(NSView *contentView);
void windowWillMove();
void windowDidMove();
@@ -163,8 +164,11 @@ public: // for QNSView
friend class QCocoaBackingStore;
friend class QCocoaNativeInterface;
- QNSView *m_contentView;
+ NSView *m_contentView;
+ QNSView *m_qtView;
NSWindow *m_nsWindow;
+ bool m_contentViewIsEmbedded; // true if the m_contentView is embedded in a "foregin" NSView hiearchy
+
QNSWindowDelegate *m_nsWindowDelegate;
Qt::WindowFlags m_windowFlags;
Qt::WindowState m_synchedWindowState;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 7c665a35c53..467025c77b5 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -58,6 +58,11 @@
#include <QDebug>
+enum {
+ defaultWindowWidth = 160,
+ defaultWindowHeight = 160
+};
+
static bool isMouseEvent(NSEvent *ev)
{
switch ([ev type]) {
@@ -186,6 +191,7 @@ static bool isMouseEvent(NSEvent *ev)
QCocoaWindow::QCocoaWindow(QWindow *tlw)
: QPlatformWindow(tlw)
, m_nsWindow(0)
+ , m_contentViewIsEmbedded(false)
, m_nsWindowDelegate(0)
, m_synchedWindowState(Qt::WindowActive)
, m_windowModality(Qt::NonModal)
@@ -201,7 +207,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
#endif
QCocoaAutoReleasePool pool;
- m_contentView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
+ m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
+ m_contentView = m_qtView;
setGeometry(tlw->geometry());
recreateWindow(parent());
@@ -238,6 +245,10 @@ void QCocoaWindow::setGeometry(const QRect &rect)
void QCocoaWindow::setCocoaGeometry(const QRect &rect)
{
QCocoaAutoReleasePool pool;
+
+ if (m_contentViewIsEmbedded)
+ return;
+
if (m_nsWindow) {
NSRect bounds = qt_mac_flipRect(rect, window());
[m_nsWindow setContentSize : bounds.size];
@@ -367,7 +378,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
NSInteger styleMask = NSBorderlessWindowMask;
if ((type & Qt::Popup) == Qt::Popup) {
- if (!windowIsPopupType(type))
+ if (!windowIsPopupType(type) && !(flags & Qt::FramelessWindowHint))
styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSTitledWindowMask);
} else {
@@ -536,7 +547,7 @@ void QCocoaWindow::setMask(const QRegion &region)
[m_nsWindow setBackgroundColor:[NSColor clearColor]];
}
- [m_contentView setMaskRegion:&region];
+ [m_qtView setMaskRegion:&region];
}
bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
@@ -580,6 +591,19 @@ NSView *QCocoaWindow::contentView() const
return m_contentView;
}
+void QCocoaWindow::setContentView(NSView *contentView)
+{
+ // Remove and release the previous content view
+ [m_contentView removeFromSuperview];
+ [m_contentView release];
+
+ // Insert and retain the new content view
+ [contentView retain];
+ m_contentView = contentView;
+ m_qtView = 0; // The new content view is not a QNSView.
+ recreateWindow(parent()); // Adds the content view to parent NSView
+}
+
void QCocoaWindow::windowWillMove()
{
// Close any open popups on window move
@@ -592,7 +616,7 @@ void QCocoaWindow::windowWillMove()
void QCocoaWindow::windowDidMove()
{
- [m_contentView updateGeometry];
+ [m_qtView updateGeometry];
}
void QCocoaWindow::windowDidResize()
@@ -600,7 +624,7 @@ void QCocoaWindow::windowDidResize()
if (!m_nsWindow)
return;
- [m_contentView updateGeometry];
+ [m_qtView updateGeometry];
}
void QCocoaWindow::windowWillClose()
@@ -641,7 +665,9 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
m_nsWindowDelegate = 0;
}
- if (!parentWindow) {
+ if (window()->type() == Qt::SubWindow) {
+ // Subwindows don't have a NSWindow.
+ } else if (!parentWindow) {
// Create a new NSWindow if this is a top-level window.
m_nsWindow = createNSWindow();
setNSWindow(m_nsWindow);
@@ -669,7 +695,8 @@ NSWindow * QCocoaWindow::createNSWindow()
{
QCocoaAutoReleasePool pool;
- NSRect frame = qt_mac_flipRect(window()->geometry(), window());
+ QRect rect = initialGeometry(window(), window()->geometry(), defaultWindowWidth, defaultWindowHeight);
+ NSRect frame = qt_mac_flipRect(rect, window());
Qt::WindowType type = window()->type();
Qt::WindowFlags flags = window()->flags();
@@ -734,7 +761,6 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
{
m_nsWindowDelegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:this];
[window setDelegate:m_nsWindowDelegate];
- [window setAcceptsMouseMovedEvents:YES];
// Prevent Cocoa from releasing the window on close. Qt
// handles the close event asynchronously and we want to
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index fae68493f14..0c122eaf2d1 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -174,6 +174,36 @@ static QTouchDevice *touchDevice = 0;
QWindowSystemInterface::handleExposeEvent(m_window, m_window->geometry());
}
+- (void)viewDidMoveToSuperview
+{
+ if (!(m_window->type() & Qt::SubWindow))
+ return;
+
+ if ([self superview]) {
+ m_platformWindow->m_contentViewIsEmbedded = true;
+ QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry());
+ QWindowSystemInterface::handleExposeEvent(m_window, m_platformWindow->geometry());
+ QWindowSystemInterface::flushWindowSystemEvents();
+ } else {
+ m_platformWindow->m_contentViewIsEmbedded = false;
+ }
+}
+
+- (void)viewWillMoveToWindow:(NSWindow *)newWindow
+{
+ // ### Merge "normal" window code path with this one for 5.1.
+ if (!(m_window->type() & Qt::SubWindow))
+ return;
+
+ if (newWindow) {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(windowNotification:)
+ name:nil // Get all notifications
+ object:newWindow];
+ } else {
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:[self window]];
+ }
+}
- (void)updateGeometry
{
QRect geometry;
@@ -182,6 +212,9 @@ static QTouchDevice *touchDevice = 0;
NSRect rect = [self frame];
NSRect windowRect = [[self window] frame];
geometry = QRect(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
+ } else if (m_window->type() & Qt::SubWindow) {
+ // embedded child window, use the frame rect ### merge with case below
+ geometry = qt_mac_toQRect([self bounds]);
} else {
// child window, use the frame rect
geometry = qt_mac_toQRect([self frame]);
@@ -199,6 +232,12 @@ static QTouchDevice *touchDevice = 0;
// an infinite loop when this notification is triggered again.)
m_platformWindow->QPlatformWindow::setGeometry(geometry);
+ // Don't send the geometry change if the QWindow is designated to be
+ // embedded in a foregin view hiearchy but has not actually been
+ // embedded yet - it's too early.
+ if ((m_window->type() & Qt::SubWindow) && !m_platformWindow->m_contentViewIsEmbedded)
+ return;
+
// Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
@@ -337,7 +376,12 @@ static QTouchDevice *touchDevice = 0;
);
CGImageRef bsCGImage = m_backingStore->getBackingStoreCGImage();
CGImageRef cleanImg = CGImageCreateWithImageInRect(bsCGImage, backingStoreRect);
- CGContextSetBlendMode(cgContext, kCGBlendModeCopy);
+
+ // Optimization: Copy frame buffer content instead of blending for
+ // top-level windows where Qt fills the entire window content area.
+ if (m_platformWindow->m_nsWindow)
+ CGContextSetBlendMode(cgContext, kCGBlendModeCopy);
+
CGContextDrawImage(cgContext, dirtyWindowRect, cleanImg);
// Clean-up:
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 8367513fc53..203cdebda91 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -39,6 +39,7 @@ CONFIG(blackberry) {
#DEFINES += QQNXSCREEN_DEBUG
#DEFINES += QQNXVIRTUALKEYBOARD_DEBUG
#DEFINES += QQNXWINDOW_DEBUG
+#DEFINES += QQNXCURSOR_DEBUG
SOURCES = main.cpp \
@@ -54,7 +55,8 @@ SOURCES = main.cpp \
qqnxnavigatoreventhandler.cpp \
qqnxabstractnavigator.cpp \
qqnxabstractvirtualkeyboard.cpp \
- qqnxservices.cpp
+ qqnxservices.cpp \
+ qqnxcursor.cpp
HEADERS = main.h \
qqnxbuffer.h \
@@ -70,7 +72,8 @@ HEADERS = main.h \
qqnxnavigatoreventhandler.h \
qqnxabstractnavigator.h \
qqnxabstractvirtualkeyboard.h \
- qqnxservices.h
+ qqnxservices.h \
+ qqnxcursor.h
LIBS += -lscreen
diff --git a/src/plugins/platforms/qnx/qqnxcursor.cpp b/src/plugins/platforms/qnx/qqnxcursor.cpp
new file mode 100644
index 00000000000..4fdff666d74
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxcursor.cpp
@@ -0,0 +1,78 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxcursor.h"
+
+#include <QtCore/QDebug>
+
+#ifdef QQNXCURSOR_DEBUG
+#define qCursorDebug qDebug
+#else
+#define qCursorDebug QT_NO_QDEBUG_MACRO
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QQnxCursor::QQnxCursor()
+{
+}
+
+#ifndef QT_NO_CURSOR
+void QQnxCursor::changeCursor(QCursor *windowCursor, QWindow *window)
+{
+ Q_UNUSED(windowCursor);
+ Q_UNUSED(window);
+}
+#endif
+
+void QQnxCursor::setPos(const QPoint &pos)
+{
+ qCursorDebug() << "QQnxCursor::setPos -" << pos;
+ m_pos = pos;
+}
+
+QPoint QQnxCursor::pos() const
+{
+ qCursorDebug() << "QQnxCursor::pos -" << m_pos;
+ return m_pos;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxcursor.h b/src/plugins/platforms/qnx/qqnxcursor.h
new file mode 100644
index 00000000000..5d6a8b2c309
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxcursor.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQNXCURSOR_H
+#define QQNXCURSOR_H
+
+#include <qpa/qplatformcursor.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQnxCursor : public QPlatformCursor
+{
+public:
+ QQnxCursor();
+
+#ifndef QT_NO_CURSOR
+ void changeCursor(QCursor *windowCursor, QWindow *window);
+#endif
+ void setPos(const QPoint &pos);
+
+ QPoint pos() const;
+
+private:
+ QPoint m_pos;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXCURSOR_H
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 1e58f047abf..dfd7ccf0cc2 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -41,6 +41,7 @@
#include "qqnxscreen.h"
#include "qqnxwindow.h"
+#include "qqnxcursor.h"
#include <QtCore/QThread>
#include <QtCore/QDebug>
@@ -110,7 +111,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
m_posted(false),
m_keyboardHeight(0),
m_nativeOrientation(Qt::PrimaryOrientation),
- m_platformContext(0)
+ m_platformContext(0),
+ m_cursor(new QQnxCursor())
{
qScreenDebug() << Q_FUNC_INFO;
// Cache initial orientation of this display
@@ -149,6 +151,10 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
QQnxScreen::~QQnxScreen()
{
qScreenDebug() << Q_FUNC_INFO;
+ Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
+ childWindow->setScreen(0);
+
+ delete m_cursor;
}
static int defaultDepth()
@@ -492,6 +498,11 @@ void QQnxScreen::onWindowPost(QQnxWindow *window)
}
}
+QPlatformCursor * QQnxScreen::cursor() const
+{
+ return m_cursor;
+}
+
void QQnxScreen::keyboardHeightChanged(int height)
{
if (height == m_keyboardHeight)
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index 2851c13c52c..39cd4159d15 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -95,6 +95,8 @@ public:
QSharedPointer<QQnxRootWindow> rootWindow() const;
+ QPlatformCursor *cursor() const;
+
public Q_SLOTS:
void setRotation(int rotation);
void newWindowCreated(void *window);
@@ -130,6 +132,8 @@ private:
QList<QQnxWindow *> m_childWindows;
QList<screen_window_t> m_overlays;
+
+ QPlatformCursor *m_cursor;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 4412bb34bdc..2d3c7608bf8 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -347,6 +347,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType)
qFatal("QQNX: failed to query event position, errno=%d", errno);
}
+ QCursor::setPos(pos[0], pos[1]);
+
// get window coordinates of touch
errno = 0;
int windowPos[2];
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index ab9c94772bf..cabbd405e50 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -156,7 +156,8 @@ QQnxWindow::~QQnxWindow()
// Remove from parent's Hierarchy.
removeFromParent();
- m_screen->updateHierarchy();
+ if (m_screen)
+ m_screen->updateHierarchy();
// Cleanup QNX window and its buffers
screen_destroy_window(m_window);
@@ -272,9 +273,9 @@ void QQnxWindow::setVisible(bool visible)
window()->requestActivate();
if (window()->isTopLevel()) {
- if (visible) {
- QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
- } else {
+ QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
+
+ if (!visible) {
// Flush the context, otherwise it won't disappear immediately
screen_flush_context(m_screenContext, 0);
}
@@ -497,6 +498,11 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen)
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen;
+ if (platformScreen == 0) { // The screen has been destroyed
+ m_screen = 0;
+ return;
+ }
+
if (m_screen == platformScreen)
return;
@@ -539,7 +545,7 @@ void QQnxWindow::removeFromParent()
m_parentWindow = 0;
else
qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
- } else {
+ } else if (m_screen) {
m_screen->removeWindow(this);
}
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 88c9bf448d1..febf25baea9 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -858,10 +858,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return true;
case QtWindows::ShowEvent:
platformWindow->handleShown();
- return true;
+ return false; // Indicate transient children should be shown by windows (SW_PARENTOPENING)
case QtWindows::HideEvent:
platformWindow->handleHidden();
- return true;
+ return false;// Indicate transient children should be hidden by windows (SW_PARENTCLOSING)
case QtWindows::CloseEvent:
QWindowSystemInterface::handleCloseEvent(platformWindow->window());
return true;
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index daa4369d88e..2c738e76eb0 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -1225,8 +1225,9 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
// Apply settings.
const QSharedPointer<QFileDialogOptions> &opts = options();
+ const QFileDialogOptions::FileMode mode = opts->fileMode();
result->setWindowTitle(opts->windowTitle());
- result->setMode(opts->fileMode(), opts->options());
+ result->setMode(mode, opts->options());
result->setHideFiltersDetails(opts->testOption(QFileDialogOptions::HideNameFilterDetails));
const QStringList nameFilters = opts->nameFilters();
if (!nameFilters.isEmpty())
@@ -1244,9 +1245,12 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
if (!info.isDir())
result->selectFile(info.fileName());
}
- const QString initialNameFilter = opts->initiallySelectedNameFilter();
- if (!initialNameFilter.isEmpty())
- result->selectNameFilter(initialNameFilter);
+ // No need to select initialNameFilter if mode is Dir
+ if (mode != QFileDialogOptions::Directory && mode != QFileDialogOptions::DirectoryOnly) {
+ const QString initialNameFilter = opts->initiallySelectedNameFilter();
+ if (!initialNameFilter.isEmpty())
+ result->selectNameFilter(initialNameFilter);
+ }
const QString defaultSuffix = opts->defaultSuffix();
if (!defaultSuffix.isEmpty())
result->setDefaultSuffix(defaultSuffix);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 24dc01f0bda..ca484415bef 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -78,7 +78,7 @@ public:
# ifndef QT_NO_DRAGANDDROP
virtual QPlatformDrag *drag() const;
# endif
-#endif !QT_NO_CLIPBOARD
+#endif // !QT_NO_CLIPBOARD
virtual QPlatformInputContext *inputContext() const;
#ifndef QT_NO_ACCESSIBILITY
virtual QPlatformAccessibility *accessibility() const;
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index b3bfa033808..caf30e6b1a4 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -109,6 +109,8 @@ Qt::KeyboardModifiers QWindowsMouseHandler::keyStateToModifiers(int wParam)
mods |= Qt::ControlModifier;
if (wParam & MK_SHIFT)
mods |= Qt::ShiftModifier;
+ if (GetKeyState(VK_MENU) < 0)
+ mods |= Qt::AltModifier;
return mods;
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 07dc668b3fa..60b455bac9a 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -64,6 +64,11 @@
QT_BEGIN_NAMESPACE
+enum {
+ defaultWindowWidth = 160,
+ defaultWindowHeight = 160
+};
+
Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
static QByteArray debugWinStyle(DWORD style)
@@ -198,17 +203,16 @@ static inline QSize clientSize(HWND hwnd)
return qSizeOfRect(rect);
}
-// from qwidget_win.cpp/maximum layout size check removed.
-static bool shouldShowMaximizeButton(Qt::WindowFlags flags)
+// from qwidget_win.cpp
+static bool shouldShowMaximizeButton(const QWindow *w)
{
- if (flags & Qt::MSWindowsFixedSizeDialogHint)
+ const Qt::WindowFlags flags = w->flags();
+ if ((flags & Qt::MSWindowsFixedSizeDialogHint) || !(flags & Qt::WindowMaximizeButtonHint))
return false;
// if the user explicitly asked for the maximize button, we try to add
// it even if the window has fixed size.
- if (flags & Qt::CustomizeWindowHint &&
- flags & Qt::WindowMaximizeButtonHint)
- return true;
- return flags & Qt::WindowMaximizeButtonHint;
+ return (flags & Qt::CustomizeWindowHint) ||
+ w->maximumSize() == QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX);
}
// Set the WS_EX_LAYERED flag on a HWND if required. This is required for
@@ -253,6 +257,8 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qr
} else {
QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, (int)(level * 255), LWA_ALPHA);
}
+ } else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered.
+ InvalidateRect(hwnd, NULL, TRUE);
}
#endif // !Q_OS_WINCE
}
@@ -427,7 +433,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
style |= WS_SYSMENU;
if (flags & Qt::WindowMinimizeButtonHint)
style |= WS_MINIMIZEBOX;
- if (shouldShowMaximizeButton(flags))
+ if (shouldShowMaximizeButton(w))
style |= WS_MAXIMIZEBOX;
if (tool)
exStyle |= WS_EX_TOOLWINDOW;
@@ -468,6 +474,8 @@ QWindowsWindow::WindowData
const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w, isGL);
+ QRect rect = QPlatformWindow::initialGeometry(w, geometry, defaultWindowWidth, defaultWindowHeight);
+
if (title.isEmpty() && (result.flags & Qt::WindowTitleHint))
title = topLevel ? qAppName() : w->objectName();
@@ -475,14 +483,14 @@ QWindowsWindow::WindowData
const wchar_t *classNameUtf16 = reinterpret_cast<const wchar_t *>(windowClassName.utf16());
// Capture events before CreateWindowEx() returns.
- const QWindowCreationContextPtr context(new QWindowCreationContext(w, geometry, style, exStyle));
+ const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, style, exStyle));
QWindowsContext::instance()->setWindowCreationContext(context);
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< "CreateWindowEx: " << w << *this
<< " class=" <<windowClassName << " title=" << title
- << "\nrequested: " << geometry << ": "
+ << "\nrequested: " << rect << ": "
<< context->frameWidth << 'x' << context->frameHeight
<< '+' << context->frameX << '+' << context->frameY;
@@ -775,6 +783,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
QWindowsWindow::~QWindowsWindow()
{
#ifndef Q_OS_WINCE
+ QWindowSystemInterface::flushWindowSystemEvents();
if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd);
#endif // !Q_OS_WINCE
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 11c74edc45e..2a6ef5a6eef 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -104,57 +104,6 @@ static Window createDummyWindow(QXcbScreen *screen, GLXFBConfig config)
return window;
}
-// Per-window data for active OpenGL contexts.
-struct QOpenGLContextData
-{
- QOpenGLContextData(Display *display, Window window, GLXContext context)
- : m_display(display),
- m_window(window),
- m_context(context)
- {}
-
- QOpenGLContextData()
- : m_display(0),
- m_window(0),
- m_context(0)
- {}
-
- Display *m_display;
- Window m_window;
- GLXContext m_context;
-};
-
-static inline QOpenGLContextData currentOpenGLContextData()
-{
- QOpenGLContextData result;
- result.m_display = glXGetCurrentDisplay();
- result.m_window = glXGetCurrentDrawable();
- result.m_context = glXGetCurrentContext();
- return result;
-}
-
-static inline QOpenGLContextData createDummyWindowOpenGLContextData(QXcbScreen *screen)
-{
- QOpenGLContextData result;
- result.m_display = DISPLAY_FROM_XCB(screen);
-
- QSurfaceFormat format;
- GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen), screen->screenNumber(), format);
- if (config) {
- result.m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, true);
- result.m_window = createDummyWindow(screen, config);
- } else {
- XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(screen), screen->screenNumber(), &format);
- if (!visualInfo)
- qFatal("Could not initialize GLX");
- result.m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, 0, true);
- result.m_window = createDummyWindow(screen, visualInfo);
- XFree(visualInfo);
- }
-
- return result;
-}
-
static inline QByteArray getGlString(GLenum param)
{
if (const GLubyte *s = glGetString(param))
@@ -202,70 +151,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
format.setProfile(QSurfaceFormat::CompatibilityProfile);
}
-/*!
- \class QOpenGLTemporaryContext
- \brief A temporary context that can be instantiated on the stack.
-
- Functions like glGetString() only work if there is a current GL context.
-
- \internal
- \ingroup qt-lighthouse-xcb
-*/
-class QOpenGLTemporaryContext
-{
- Q_DISABLE_COPY(QOpenGLTemporaryContext)
-public:
- QOpenGLTemporaryContext(QXcbScreen *screen);
- ~QOpenGLTemporaryContext();
-
-private:
- const QOpenGLContextData m_previous;
- const QOpenGLContextData m_current;
-};
-
-QOpenGLTemporaryContext::QOpenGLTemporaryContext(QXcbScreen *screen)
- : m_previous(currentOpenGLContextData()),
- m_current(createDummyWindowOpenGLContextData(screen))
-{
- // Make our temporary context current on our temporary window
- glXMakeCurrent(m_current.m_display, m_current.m_window, m_current.m_context);
-}
-
-QOpenGLTemporaryContext::~QOpenGLTemporaryContext()
-{
- // Restore the previous context if possible, otherwise just release our temporary context
- if (m_previous.m_display)
- glXMakeCurrent(m_previous.m_display, m_previous.m_window, m_previous.m_context);
- else
- glXMakeCurrent(m_current.m_display, 0, 0);
-
- // Destroy our temporary window
- XDestroyWindow(m_current.m_display, m_current.m_window);
-
- // Finally destroy our temporary context itself
- glXDestroyContext(m_current.m_display, m_current.m_context);
-}
-
-QOpenGLDefaultContextInfo::QOpenGLDefaultContextInfo()
- : vendor(getGlString(GL_VENDOR)),
- renderer(getGlString(GL_RENDERER))
-{
- updateFormatFromContext(format);
-}
-
-QOpenGLDefaultContextInfo *QOpenGLDefaultContextInfo::create(QXcbScreen *screen)
-{
- // We need a current context for getGLString() to work. To have
- // the QOpenGLDefaultContextInfo contain the latest supported
- // context version, we rely upon the QOpenGLTemporaryContext to
- // correctly obtain a context with the latest version
- QScopedPointer<QOpenGLTemporaryContext> temporaryContext(new QOpenGLTemporaryContext(screen));
- QOpenGLDefaultContextInfo *result = new QOpenGLDefaultContextInfo;
- return result;
-}
-
-
-QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo)
+QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: QPlatformOpenGLContext()
, m_screen(screen)
, m_context(0)
@@ -287,51 +173,60 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' ');
bool supportsProfiles = glxExt.contains("GLX_ARB_create_context_profile");
- // Use glXCreateContextAttribsARB if is available
+ // Use glXCreateContextAttribsARB if available
if (glxExt.contains("GLX_ARB_create_context") && glXCreateContextAttribsARB != 0) {
- // We limit the requested version by the version of the static context as
- // glXCreateContextAttribsARB fails and returns NULL if the requested context
- // version is not supported. This means that we will get the closest supported
- // context format that that which was requested and is supported by the driver
- const int maxSupportedVersion = (defaultContextInfo->format.majorVersion() << 8)
- + defaultContextInfo->format.minorVersion();
- const int requestedVersion = qMin((format.majorVersion() << 8) + format.minorVersion(),
- maxSupportedVersion);
- const int majorVersion = requestedVersion >> 8;
- const int minorVersion = requestedVersion & 0xFF;
-
- QVector<int> contextAttributes;
- contextAttributes << GLX_CONTEXT_MAJOR_VERSION_ARB << majorVersion
- << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion;
-
- // If asking for OpenGL 3.2 or newer we should also specify a profile
- if (supportsProfiles && (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1))) {
- if (m_format.profile() == QSurfaceFormat::CoreProfile)
- contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
- else
- contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
- }
-
- int flags = 0;
-
- if (m_format.testOption(QSurfaceFormat::DebugContext))
- flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
-
- // A forward-compatible context may be requested for 3.0 and later
- if (m_format.majorVersion() >= 3 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions))
- flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
-
- if (flags != 0)
- contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags;
-
- contextAttributes << None;
-
- m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data());
- if (!m_context && m_shareContext) {
- // re-try without a shared glx context
- m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data());
- if (m_context)
- m_shareContext = 0;
+ // Try to create an OpenGL context for each known OpenGL version in descending
+ // order from the requested version.
+ const int requestedVersion = format.majorVersion() * 10 + qMin(format.minorVersion(), 9);
+
+ QVector<int> glVersions;
+ if (requestedVersion > 43)
+ glVersions << requestedVersion;
+
+ // Don't bother with versions below 2.0
+ glVersions << 43 << 42 << 41 << 40 << 33 << 32 << 31 << 30 << 21 << 20;
+
+ for (int i = 0; !m_context && i < glVersions.count(); i++) {
+ const int version = glVersions[i];
+ if (version > requestedVersion)
+ continue;
+
+ const int majorVersion = version / 10;
+ const int minorVersion = version % 10;
+
+ QVector<int> contextAttributes;
+ contextAttributes << GLX_CONTEXT_MAJOR_VERSION_ARB << majorVersion
+ << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion;
+
+ // If asking for OpenGL 3.2 or newer we should also specify a profile
+ if (version >= 32 && supportsProfiles) {
+ if (m_format.profile() == QSurfaceFormat::CoreProfile)
+ contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
+ else
+ contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ }
+
+ int flags = 0;
+
+ if (m_format.testOption(QSurfaceFormat::DebugContext))
+ flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
+
+ // A forward-compatible context may be requested for 3.0 and later
+ if (version >= 30 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions))
+ flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+
+ if (flags != 0)
+ contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags;
+
+ contextAttributes << None;
+
+ m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data());
+ if (!m_context && m_shareContext) {
+ // re-try without a shared glx context
+ m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data());
+ if (m_context)
+ m_shareContext = 0;
+ }
}
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 78e99853348..98aee78b149 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -54,23 +54,10 @@
QT_BEGIN_NAMESPACE
-class QOpenGLDefaultContextInfo
-{
- Q_DISABLE_COPY(QOpenGLDefaultContextInfo)
- QOpenGLDefaultContextInfo();
-public:
- static QOpenGLDefaultContextInfo *create(QXcbScreen *screen);
-
- const QByteArray vendor;
- const QByteArray renderer;
- QSurfaceFormat format;
-};
-
-
class QGLXContext : public QPlatformOpenGLContext
{
public:
- QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo);
+ QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
~QGLXContext();
bool makeCurrent(QPlatformSurface *surface);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 32de54562a9..4525cb8ccb1 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -222,7 +222,6 @@ void QXcbConnection::updateScreens()
// Delete any existing screens which are not in activeScreens
for (int i = m_screens.count() - 1; i >= 0; --i) {
if (!activeScreens.contains(m_screens[i])) {
- ((QXcbIntegration*)QGuiApplicationPrivate::platformIntegration())->removeDefaultOpenGLContextInfo(m_screens[i]);
delete m_screens[i];
m_screens.removeAt(i);
}
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 1840dd1ce5b..60acf1ff02b 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -121,9 +121,6 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
QXcbIntegration::~QXcbIntegration()
{
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
- qDeleteAll(m_defaultContextInfos);
-#endif
qDeleteAll(m_connections);
}
@@ -181,14 +178,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
{
QXcbScreen *screen = static_cast<QXcbScreen *>(context->screen()->handle());
#if defined(XCB_USE_GLX)
- QOpenGLDefaultContextInfo *defaultContextInfo;
- if (m_defaultContextInfos.contains(screen)) {
- defaultContextInfo = m_defaultContextInfos.value(screen);
- } else {
- defaultContextInfo = QOpenGLDefaultContextInfo::create(screen);
- m_defaultContextInfos.insert(screen, defaultContextInfo);
- }
- return new QGLXContext(screen, context->format(), context->shareHandle(), defaultContextInfo);
+ return new QGLXContext(screen, context->format(), context->shareHandle());
#elif defined(XCB_USE_EGL)
return new QEGLXcbPlatformContext(context->format(), context->shareHandle(),
screen->connection()->egl_display(), screen->connection());
@@ -293,21 +283,4 @@ QPlatformTheme *QXcbIntegration::createPlatformTheme(const QString &name) const
return QGenericUnixTheme::createUnixTheme(name);
}
-/*!
- Called by QXcbConnection prior to a QQnxScreen being deleted.
-
- Destroys and cleans up any default OpenGL context info for this screen.
-*/
-void QXcbIntegration::removeDefaultOpenGLContextInfo(QXcbScreen *screen)
-{
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
- if (!m_defaultContextInfos.contains(screen))
- return;
- QOpenGLDefaultContextInfo* info = m_defaultContextInfos.take(screen);
- delete info;
-#else
- Q_UNUSED(screen);
-#endif
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index cd6c2fd73c5..1dd8d4576b7 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -52,10 +52,6 @@ class QAbstractEventDispatcher;
class QXcbNativeInterface;
class QXcbScreen;
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
-class QOpenGLDefaultContextInfo;
-#endif
-
class QXcbIntegration : public QPlatformIntegration
{
public:
@@ -97,8 +93,6 @@ public:
QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const;
- void removeDefaultOpenGLContextInfo(QXcbScreen *screen);
-
private:
QList<QXcbConnection *> m_connections;
@@ -108,10 +102,6 @@ private:
QScopedPointer<QPlatformInputContext> m_inputContext;
QAbstractEventDispatcher *m_eventDispatcher;
-#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX)
- mutable QHash<QXcbScreen *, QOpenGLDefaultContextInfo *> m_defaultContextInfos;
-#endif
-
#ifndef QT_NO_ACCESSIBILITY
QScopedPointer<QPlatformAccessibility> m_accessibility;
#endif
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c0ddf5c0ae7..11ce1126ae6 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -113,6 +113,10 @@
#endif
#define XCOORD_MAX 16383
+enum {
+ defaultWindowWidth = 160,
+ defaultWindowHeight = 160
+};
//#ifdef NET_WM_STATE_DEBUG
@@ -152,6 +156,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
, m_gravity(XCB_GRAVITY_STATIC)
, m_mapped(false)
, m_transparent(false)
+ , m_usingSyncProtocol(false)
, m_deferredActivation(false)
, m_netWmUserTimeWindow(XCB_NONE)
, m_dirtyFrameMargins(false)
@@ -219,8 +224,16 @@ void QXcbWindow::create()
QRect rect = window()->geometry();
QPlatformWindow::setGeometry(rect);
- rect.setWidth(qBound(1, rect.width(), XCOORD_MAX));
- rect.setHeight(qBound(1, rect.height(), XCOORD_MAX));
+ QSize minimumSize = window()->minimumSize();
+ if (rect.width() > 0 || rect.height() > 0) {
+ rect.setWidth(qBound(1, rect.width(), XCOORD_MAX));
+ rect.setHeight(qBound(1, rect.height(), XCOORD_MAX));
+ } else if (minimumSize.width() > 0 || minimumSize.height() > 0) {
+ rect.setSize(minimumSize);
+ } else {
+ rect.setWidth(defaultWindowWidth);
+ rect.setHeight(defaultWindowHeight);
+ }
xcb_window_t xcb_parent_id = m_screen->root();
if (parent())
@@ -306,7 +319,9 @@ void QXcbWindow::create()
properties[propertyCount++] = atom(QXcbAtom::WM_TAKE_FOCUS);
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_PING);
- if (m_screen->syncRequestSupported())
+ m_usingSyncProtocol = m_screen->syncRequestSupported() && window()->surfaceType() != QSurface::OpenGLSurface;
+
+ if (m_usingSyncProtocol)
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
if (window()->flags() & Qt::WindowContextHelpButtonHint)
@@ -323,7 +338,7 @@ void QXcbWindow::create()
m_syncValue.hi = 0;
m_syncValue.lo = 0;
- if (m_screen->syncRequestSupported()) {
+ if (m_usingSyncProtocol) {
m_syncCounter = xcb_generate_id(xcb_connection());
Q_XCB_CALL(xcb_sync_create_counter(xcb_connection(), m_syncCounter, m_syncValue));
@@ -406,7 +421,7 @@ void QXcbWindow::destroy()
if (connection()->focusWindow() == this)
connection()->setFocusWindow(0);
- if (m_syncCounter && m_screen->syncRequestSupported())
+ if (m_syncCounter && m_usingSyncProtocol)
Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter));
if (m_window) {
if (m_netWmUserTimeWindow) {
@@ -436,15 +451,23 @@ void QXcbWindow::setGeometry(const QRect &rect)
propagateSizeHints();
const QRect wmGeometry = windowToWmGeometry(rect);
- const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
- const qint32 values[] = {
- qBound<qint32>(-XCOORD_MAX, wmGeometry.x(), XCOORD_MAX),
- qBound<qint32>(-XCOORD_MAX, wmGeometry.y(), XCOORD_MAX),
- qBound<qint32>(1, wmGeometry.width(), XCOORD_MAX),
- qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
- };
-
- Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values)));
+ if (qt_window_private(window())->positionAutomatic) {
+ const quint32 mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ const qint32 values[] = {
+ qBound<qint32>(1, wmGeometry.width(), XCOORD_MAX),
+ qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
+ };
+ Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values)));
+ } else {
+ const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ const qint32 values[] = {
+ qBound<qint32>(-XCOORD_MAX, wmGeometry.x(), XCOORD_MAX),
+ qBound<qint32>(-XCOORD_MAX, wmGeometry.y(), XCOORD_MAX),
+ qBound<qint32>(1, wmGeometry.width(), XCOORD_MAX),
+ qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
+ };
+ Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values)));
+ }
xcb_flush(xcb_connection());
}
@@ -563,6 +586,7 @@ void QXcbWindow::show()
if (!transientXcbParent)
transientXcbParent = static_cast<QXcbScreen *>(screen())->clientLeader();
if (transientXcbParent) { // ICCCM 4.1.2.6
+ m_gravity = XCB_GRAVITY_CENTER;
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
1, &transientXcbParent));
@@ -1221,8 +1245,10 @@ void QXcbWindow::propagateSizeHints()
QWindow *win = window();
- xcb_size_hints_set_position(&hints, true, rect.x(), rect.y());
- xcb_size_hints_set_size(&hints, true, rect.width(), rect.height());
+ if (!qt_window_private(win)->positionAutomatic)
+ xcb_size_hints_set_position(&hints, true, rect.x(), rect.y());
+ if (rect.width() < QWINDOWSIZE_MAX || rect.height() < QWINDOWSIZE_MAX)
+ xcb_size_hints_set_size(&hints, true, rect.width(), rect.height());
xcb_size_hints_set_win_gravity(&hints, m_gravity);
QSize minimumSize = win->minimumSize();
@@ -1671,7 +1697,7 @@ void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *)
void QXcbWindow::updateSyncRequestCounter()
{
- if (m_screen->syncRequestSupported() && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) {
+ if (m_usingSyncProtocol && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) {
Q_XCB_CALL(xcb_sync_set_counter(xcb_connection(), m_syncCounter, m_syncValue));
xcb_flush(xcb_connection());
connection()->sync();
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 3b5404684f4..6a8b98ff0dc 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -181,6 +181,7 @@ private:
bool m_mapped;
bool m_transparent;
+ bool m_usingSyncProtocol;
bool m_deferredActivation;
bool m_deferredExpose;
bool m_configureNotifyPending;
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 9517d95fc40..c6fd49d1eaa 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -1407,7 +1407,7 @@ bool QODBCResult::exec()
// (How many leading digits do we want to keep? With SQL Server 2005, this should be 3: 123000000)
int keep = (int)qPow(10.0, 9 - qMin(9, precision));
- dt->fraction /= keep * keep;
+ dt->fraction = (dt->fraction / keep) * keep;
}
r = SQLBindParameter(d->hStmt,
@@ -1592,7 +1592,7 @@ bool QODBCResult::exec()
}
}
r = SQLExecute(d->hStmt);
- if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
+ if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r != SQL_NO_DATA) {
qWarning() << "QODBCResult::exec: Unable to execute statement:" << qODBCWarn(d);
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
"Unable to execute statement"), QSqlError::StatementError, d));
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 0eadceb1d18..2bc03715ee3 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -124,7 +124,16 @@ inline void qPQfreemem(void *buffer)
class QPSQLDriverPrivate
{
public:
- QPSQLDriverPrivate(QPSQLDriver *qq) : q(qq), connection(0), isUtf8(false), pro(QPSQLDriver::Version6), sn(0), pendingNotifyCheck(false) {}
+ QPSQLDriverPrivate(QPSQLDriver *qq)
+ : q(qq),
+ connection(0),
+ isUtf8(false),
+ pro(QPSQLDriver::Version6),
+ sn(0),
+ pendingNotifyCheck(false),
+ hasBackslashEscape(false)
+ { }
+
QPSQLDriver *q;
PGconn *connection;
bool isUtf8;
@@ -132,6 +141,7 @@ public:
QSocketNotifier *sn;
QStringList seid;
mutable bool pendingNotifyCheck;
+ bool hasBackslashEscape;
void appendTables(QStringList &tl, QSqlQuery &t, QChar type);
PGresult * exec(const char * stmt) const;
@@ -139,6 +149,7 @@ public:
QPSQLDriver::Protocol getPSQLVersion();
bool setEncodingUtf8();
void setDatestyle();
+ void detectBackslashEscape();
};
void QPSQLDriverPrivate::appendTables(QStringList &tl, QSqlQuery &t, QChar type)
@@ -615,6 +626,23 @@ void QPSQLDriverPrivate::setDatestyle()
PQclear(result);
}
+void QPSQLDriverPrivate::detectBackslashEscape()
+{
+ // standard_conforming_strings option introduced in 8.2
+ // http://www.postgresql.org/docs/8.2/static/runtime-config-compatible.html
+ if (pro < QPSQLDriver::Version82) {
+ hasBackslashEscape = true;
+ } else {
+ hasBackslashEscape = false;
+ PGresult* result = exec(QLatin1Literal("SELECT '\\\\' x"));
+ int status = PQresultStatus(result);
+ if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK)
+ if (QString::fromLatin1(PQgetvalue(result, 0, 0)) == QLatin1Literal("\\"))
+ hasBackslashEscape = true;
+ PQclear(result);
+ }
+}
+
static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
{
switch (vMaj) {
@@ -726,6 +754,7 @@ QPSQLDriver::QPSQLDriver(PGconn *conn, QObject *parent)
d->connection = conn;
if (conn) {
d->pro = d->getPSQLVersion();
+ d->detectBackslashEscape();
setOpen(true);
setOpenError(false);
}
@@ -827,6 +856,7 @@ bool QPSQLDriver::open(const QString & db,
}
d->pro = d->getPSQLVersion();
+ d->detectBackslashEscape();
d->isUtf8 = d->setEncodingUtf8();
d->setDatestyle();
@@ -1212,12 +1242,10 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
}
break;
case QVariant::String:
- {
- // Escape '\' characters
r = QSqlDriver::formatValue(field, trimStrings);
- r.replace(QLatin1String("\\"), QLatin1String("\\\\"));
+ if (d->hasBackslashEscape)
+ r.replace(QLatin1String("\\"), QLatin1String("\\\\"));
break;
- }
case QVariant::Bool:
if (field.value().toBool())
r = QLatin1String("TRUE");
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index f11279f2622..04c88dd188a 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -206,8 +206,7 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
}
}
- int dotIdx = colName.lastIndexOf(QLatin1Char('.'));
- QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), fieldType);
+ QSqlField fld(colName, fieldType);
fld.setSqlType(stp);
rInf.append(fld);
}
diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp
index ff360649410..6095d0d2fa5 100644
--- a/src/tools/qdoc/codemarker.cpp
+++ b/src/tools/qdoc/codemarker.cpp
@@ -382,7 +382,7 @@ QString CodeMarker::sortName(const Node *node, const QString* name)
(node->type() == Node::QmlSignal) ||
(node->type() == Node::QmlSignalHandler)) {
const FunctionNode* func = static_cast<const FunctionNode *>(node);
- return QLatin1Char('E') + func->signature();
+ return QLatin1Char('E') + func->name();
}
return QLatin1Char('B') + nodeName;
@@ -438,8 +438,7 @@ void CodeMarker::insert(FastSection &fastSection,
if (!irrelevant) {
if (!inheritedMember || style == Subpage) {
QString key = sortName(node);
- if (!fastSection.memberMap.contains(key))
- fastSection.memberMap.insert(key, node);
+ fastSection.memberMap.insertMulti(key, node);
}
else {
if (node->parent()->type() == Node::Class) {
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index ff7d9254fc2..f0cfc18515d 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -1259,7 +1259,6 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
}
else {
FastSection all(qmlClassNode,QString(),QString(),"member","members");
-
const QmlClassNode* current = qmlClassNode;
while (current != 0) {
NodeList::ConstIterator c = current->childNodes().constBegin();
@@ -1271,9 +1270,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
if ((*p)->type() == Node::QmlProperty) {
QString key = current->name() + "::" + (*p)->name();
key = sortName(*p, &key);
- if (!all.memberMap.contains(key))
+ if (!all.memberMap.contains(key)) {
all.memberMap.insert(key,*p);
- //insert(all,*p,style,Okay);
+ }
}
++p;
}
@@ -1281,9 +1280,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
else {
QString key = current->name() + "::" + (*c)->name();
key = sortName(*c, &key);
- if (!all.memberMap.contains(key))
+ if (!all.memberMap.contains(key)) {
all.memberMap.insert(key,*c);
- //insert(all,*c,style,Okay);
+ }
}
++c;
}
diff --git a/src/tools/qdoc/doc.cpp b/src/tools/qdoc/doc.cpp
index a0a2e511989..e20e85028f6 100644
--- a/src/tools/qdoc/doc.cpp
+++ b/src/tools/qdoc/doc.cpp
@@ -3291,7 +3291,7 @@ QString Doc::canonicalTitle(const QString &title)
for (int i = 0; i != title.size(); ++i) {
uint c = title.at(i).unicode();
if (c >= 'A' && c <= 'Z')
- c -= 'A' - 'a';
+ c += 'a' - 'A';
bool alnum = (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
if (alnum) {
result += QLatin1Char(c);
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index 95ba6d28bf6..47ebded1b1c 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -360,7 +360,7 @@ QString Generator::fileBase(const Node *node) const
QChar c = base.at(i);
uint u = c.unicode();
if (u >= 'A' && u <= 'Z')
- u -= 'A' - 'a';
+ u += 'a' - 'A';
if ((u >= 'a' && u <= 'z') || (u >= '0' && u <= '9')) {
res += QLatin1Char(u);
begun = true;
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index 50632f1da46..6c8b947c469 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -371,7 +371,9 @@ static void processQdocconfFile(const QString &fileName)
excludedDirsList = config.getCanonicalRelativePathList(CONFIG_EXCLUDEDIRS);
foreach (const QString &excludeDir, excludedDirsList) {
QString p = QDir::fromNativeSeparators(excludeDir);
- excludedDirs.insert(p);
+ QDir tmp(p);
+ if (tmp.exists())
+ excludedDirs.insert(p);
}
Generator::debugSegfault("Reading excludefiles");
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index abb348eb510..c293d486735 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -662,6 +662,16 @@ bool InnerNode::hasMembers() const
}
/*!
+ Appends \a node to the members list, if and only if it
+ isn't already in the members list.
+ */
+void InnerNode::addMember(Node* node)
+{
+ if (!members_.contains(node))
+ members_.append(node);
+}
+
+/*!
Returns true if this node's members collection contains at
least one namespace node.
*/
@@ -2188,6 +2198,20 @@ bool Node::setQmlModuleInfo(const QString& arg)
}
/*!
+ If this QML type node has a base type node,
+ return the fully qualified name of that QML
+ type, i.e. <QML-module-name>::<QML-type-name>.
+ */
+QString QmlClassNode::qmlFullBaseName() const
+{
+ QString result;
+ if (baseNode_) {
+ result = baseNode_->qmlModuleIdentifier() + "::" + baseNode_->name();
+ }
+ return result;
+}
+
+/*!
The name of this QML class node might be the same as the
name of some other QML class node. If so, then this node's
parent will be a NameCollisionNode.This function sets the
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index f76b1154163..4802b6de541 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -240,6 +240,7 @@ public:
QString guid() const;
QString extractClassName(const QString &string) const;
virtual QString qmlTypeName() const { return name_; }
+ virtual QString qmlFullBaseName() const { return QString(); }
virtual QString qmlModuleName() const { return qmlModuleName_; }
virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; }
virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; }
@@ -332,7 +333,7 @@ public:
const NodeList & childNodes() const { return children_; }
const NodeList & relatedNodes() const { return related_; }
- virtual void addMember(Node* node) { members_.append(node); }
+ virtual void addMember(Node* node);
const NodeList& members() const { return members_; }
virtual bool hasMembers() const;
virtual bool hasNamespaces() const;
@@ -563,6 +564,7 @@ public:
virtual bool isAbstract() const { return abstract_; }
virtual void setAbstract(bool b) { abstract_ = b; }
virtual bool isInternal() const { return (status() == Internal); }
+ virtual QString qmlFullBaseName() const;
const ImportList& importList() const { return importList_; }
void setImportList(const ImportList& il) { importList_ = il; }
const QString& qmlBaseName() const { return baseName_; }
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 256bc62dd21..191da5caf84 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -291,29 +291,29 @@ DocNode* QDocDatabase::addToModule(const QString& name, Node* node)
*/
DocNode* QDocDatabase::addToQmlModule(const QString& name, Node* node)
{
- QString longQmid, shortQmid;
+ QStringList qmid;
QStringList dotSplit;
QStringList blankSplit = name.split(QLatin1Char(' '));
+ qmid.append(blankSplit[0]);
if (blankSplit.size() > 1) {
- longQmid = blankSplit[0] + blankSplit[1];
+ qmid.append(blankSplit[0] + blankSplit[1]);
dotSplit = blankSplit[1].split(QLatin1Char('.'));
- shortQmid = blankSplit[0] + dotSplit[0];
+ qmid.append(blankSplit[0] + dotSplit[0]);
}
DocNode* dn = findQmlModule(name);
dn->addMember(node);
node->setQmlModuleInfo(name);
if (node->subType() == Node::QmlClass) {
QmlClassNode* n = static_cast<QmlClassNode*>(node);
- QString key = longQmid + "::" + node->name();
- for (int i=0; i<2; ++i) {
+ for (int i=0; i<qmid.size(); ++i) {
+ QString key = qmid[i] + "::" + node->name();
if (!qmlTypeMap_.contains(key))
qmlTypeMap_.insert(key,n);
if (!masterMap_.contains(key))
masterMap_.insert(key,node);
- if (!masterMap_.contains(node->name(),node))
- masterMap_.insert(node->name(),node);
- key = shortQmid + "::" + node->name();
}
+ if (!masterMap_.contains(node->name(),node))
+ masterMap_.insert(node->name(),node);
}
return dn;
}
@@ -886,11 +886,16 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root)
QmlClassNode* qcn = static_cast<QmlClassNode*>(child);
if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) {
QmlClassNode* bqcn = 0;
- const ImportList& imports = qcn->importList();
- for (int i=0; i<imports.size(); ++i) {
- bqcn = findQmlType(imports[i], qcn->qmlBaseName());
- if (bqcn)
- break;
+ if (qcn->qmlBaseName().contains("::")) {
+ bqcn = qmlTypeMap_.value(qcn->qmlBaseName());
+ }
+ else {
+ const ImportList& imports = qcn->importList();
+ for (int i=0; i<imports.size(); ++i) {
+ bqcn = findQmlType(imports[i], qcn->qmlBaseName());
+ if (bqcn)
+ break;
+ }
}
if (bqcn == 0) {
bqcn = findQmlType(QString(), qcn->qmlBaseName());
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 63d8639d0f8..466742ee3ad 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -193,6 +193,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QString qmlModuleName = element.attribute("qml-module-name");
QString qmlModuleVersion = element.attribute("qml-module-version");
qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn);
+ QString qmlFullBaseName = element.attribute("qml-base-type");
+ if (!qmlFullBaseName.isEmpty())
+ qcn->setQmlBaseName(qmlFullBaseName);
if (element.hasAttribute("location"))
name = element.attribute("location", QString());
if (!indexUrl.isEmpty())
@@ -597,6 +600,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
QString nodeName;
QString qmlModuleName;
QString qmlModuleVersion;
+ QString qmlFullBaseName;
switch (node->type()) {
case Node::Namespace:
nodeName = "namespace";
@@ -610,6 +614,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
nodeName = "qmlclass";
qmlModuleName = node->qmlModuleName();
qmlModuleVersion = node->qmlModuleVersion();
+ qmlFullBaseName = node->qmlFullBaseName();
}
else if (node->subType() == Node::QmlBasicType)
nodeName = "qmlbasictype";
@@ -728,6 +733,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!qmlModuleName.isEmpty()) {
writer.writeAttribute("qml-module-name", qmlModuleName);
writer.writeAttribute("qml-module-version", qmlModuleVersion);
+ if (!qmlFullBaseName.isEmpty())
+ writer.writeAttribute("qml-base-type", qmlFullBaseName);
}
QString fullName = node->fullDocumentName();
if (fullName != objName)
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp
index 8b6f81de3e9..ffe1afe28b2 100644
--- a/src/tools/qdoc/qmlvisitor.cpp
+++ b/src/tools/qdoc/qmlvisitor.cpp
@@ -88,6 +88,7 @@ QmlDocVisitor::QmlDocVisitor(const QString &filePath,
QSet<QString> &topics)
: nestingLevel(0)
{
+ lastEndOffset = 0;
this->filePath = filePath;
this->name = QFileInfo(filePath).baseName();
document = code;
@@ -117,21 +118,21 @@ QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) cons
QQmlJS::AST::SourceLocation loc = it.previous();
- if (loc.begin() <= lastEndOffset)
+ if (loc.begin() <= lastEndOffset) {
// Return if we reach the end of the preceding structure.
break;
-
- else if (usedComments.contains(loc.begin()))
+ }
+ else if (usedComments.contains(loc.begin())) {
// Return if we encounter a previously used comment.
break;
-
+ }
else if (loc.begin() > lastEndOffset && loc.end() < offset) {
-
// Only examine multiline comments in order to avoid snippet markers.
if (document.at(loc.offset - 1) == QLatin1Char('*')) {
QString comment = document.mid(loc.offset, loc.length);
- if (comment.startsWith(QLatin1Char('!')) || comment.startsWith(QLatin1Char('*')))
+ if (comment.startsWith(QLatin1Char('!')) || comment.startsWith(QLatin1Char('*'))) {
return loc;
+ }
}
}
}
@@ -165,8 +166,9 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
node->setDoc(doc);
applyMetacommands(loc, node, doc);
usedComments.insert(loc.offset);
- if (doc.isEmpty())
+ if (doc.isEmpty()) {
return false;
+ }
return true;
}
Location codeLoc(filePath);
@@ -424,8 +426,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
*/
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition)
{
- if (nestingLevel > 0)
+ if (nestingLevel > 0) {
--nestingLevel;
+ }
lastEndOffset = definition->lastSourceLocation().end();
}
@@ -461,6 +464,26 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
lastEndOffset = definition->lastSourceLocation().end();
}
+bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectBinding *)
+{
+ ++nestingLevel;
+ return true;
+}
+
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectBinding *)
+{
+ --nestingLevel;
+}
+
+bool QmlDocVisitor::visit(QQmlJS::AST::UiArrayBinding *)
+{
+ return true;
+}
+
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiArrayBinding *)
+{
+}
+
/*!
Visits the public \a member declaration, which can be a
signal or a property. It is a custom signal or property.
@@ -468,8 +491,9 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
{
- if (nestingLevel > 1)
+ if (nestingLevel > 1) {
return true;
+ }
switch (member->type) {
case QQmlJS::AST::UiPublicMember::Signal:
{
@@ -535,8 +559,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::IdentifierPropertyName *)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
{
- if (nestingLevel > 1)
+ if (nestingLevel > 1) {
return true;
+ }
if (current->type() == Node::Document) {
QmlClassNode* qmlClass = static_cast<QmlClassNode*>(current);
if (qmlClass) {
@@ -578,11 +603,18 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration* fd)
/*!
Begin the visit of the signal handler declaration \a sb, but only
if the nesting level is 1.
+
+ This visit is now deprecated. It has been decided to document
+ public signals. If a signal handler must be discussed in the
+ documentation, that discussion must take place in the comment
+ for the signal.
*/
-bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* sb)
+bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* )
{
- if (nestingLevel > 1)
+#if 0
+ if (nestingLevel > 1) {
return true;
+ }
if (current->type() == Node::Document) {
QString handler = sb->qualifiedId->name.toString();
if (handler.length() > 2 && handler.startsWith("on") && handler.at(2).isUpper()) {
@@ -593,6 +625,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* sb)
}
}
}
+#endif
return true;
}
diff --git a/src/tools/qdoc/qmlvisitor.h b/src/tools/qdoc/qmlvisitor.h
index bfec61eb34c..cc00ccbe6ce 100644
--- a/src/tools/qdoc/qmlvisitor.h
+++ b/src/tools/qdoc/qmlvisitor.h
@@ -85,6 +85,11 @@ public:
bool visit(QQmlJS::AST::UiPublicMember *member);
void endVisit(QQmlJS::AST::UiPublicMember *definition);
+ virtual bool visit(QQmlJS::AST::UiObjectBinding *);
+ virtual void endVisit(QQmlJS::AST::UiObjectBinding *);
+ virtual void endVisit(QQmlJS::AST::UiArrayBinding *);
+ virtual bool visit(QQmlJS::AST::UiArrayBinding *);
+
bool visit(QQmlJS::AST::IdentifierPropertyName *idproperty);
bool visit(QQmlJS::AST::FunctionDeclaration *);
diff --git a/src/widgets/QtGui.dynlist b/src/widgets/QtGui.dynlist
deleted file mode 100644
index ea47f598a74..00000000000
--- a/src/widgets/QtGui.dynlist
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- extern "C++" {
- "qt_x11ft_convert_pattern(_FcPattern*, QByteArray*, int*, bool*)";
- "QApplication::x11ClientMessage(QWidget*, _XEvent*, bool)";
- "QApplication::notify(QObject*, QEvent*)";
- "QApplication::qwsEventFilter(QWSEvent*)";
- };
-};
diff --git a/src/widgets/QtWidgets.dynlist b/src/widgets/QtWidgets.dynlist
new file mode 100644
index 00000000000..94fd207dde0
--- /dev/null
+++ b/src/widgets/QtWidgets.dynlist
@@ -0,0 +1,5 @@
+{
+ extern "C++" {
+ "QApplication::notify(QObject*, QEvent*)";
+ };
+};
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index fc86576f553..98cde84450e 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -238,7 +238,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
#endif
#ifdef Q_OS_WIN
- if (fileInfo.isSymLink() && m_resolveSymlinks) {
+ if (m_resolveSymlinks && fileInfo.isSymLink()) {
QFileInfo resolvedInfo(fileInfo.symLinkTarget());
resolvedInfo = resolvedInfo.canonicalFilePath();
if (resolvedInfo.exists()) {
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 4d3c7a24ec2..9a81e0f02ff 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -800,7 +800,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const
if (!index.isValid())
return QString();
QFileSystemNode *dirNode = node(index);
- if (dirNode->isSymLink() && fileInfoGatherer.resolveSymlinks()) {
+ if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() && dirNode->isSymLink()) {
QString fullPath = QDir::fromNativeSeparators(filePath(index));
if (resolvedSymLinks.contains(fullPath))
return resolvedSymLinks[fullPath];
diff --git a/doc/src/images/customcompleter-example.png b/src/widgets/doc/images/customcompleter-example.png
index a525208118a..a525208118a 100644
--- a/doc/src/images/customcompleter-example.png
+++ b/src/widgets/doc/images/customcompleter-example.png
Binary files differ
diff --git a/doc/src/images/customcompleter-insertcompletion.png b/src/widgets/doc/images/customcompleter-insertcompletion.png
index 0bb2c25c399..0bb2c25c399 100644
--- a/doc/src/images/customcompleter-insertcompletion.png
+++ b/src/widgets/doc/images/customcompleter-insertcompletion.png
Binary files differ
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index ec5620c14c4..5599d251a12 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1082,6 +1082,8 @@ int QHeaderView::logicalIndex(int visualIndex) const
}
/*!
+ \since 5.0
+
If \a movable is true, the header may be moved by the user; otherwise it
is fixed in place.
@@ -1105,6 +1107,8 @@ void QHeaderView::setSectionsMovable(bool movable)
*/
/*!
+ \since 5.0
+
Returns true if the header can be moved by the user; otherwise returns
false.
@@ -1128,6 +1132,8 @@ bool QHeaderView::sectionsMovable() const
*/
/*!
+ \since 5.0
+
If \a clickable is true, the header will respond to single clicks.
\sa sectionsClickable(), sectionClicked(), sectionPressed(),
@@ -1151,6 +1157,8 @@ void QHeaderView::setSectionsClickable(bool clickable)
*/
/*!
+ \since 5.0
+
Returns true if the header is clickable; otherwise returns false. A
clickable header could be set up to allow the user to change the
representation of the data in the view related to the header.
@@ -1187,6 +1195,8 @@ bool QHeaderView::highlightSections() const
}
/*!
+ \since 5.0
+
Sets the constraints on how the header can be resized to those described
by the given \a mode.
@@ -1205,6 +1215,8 @@ void QHeaderView::setSectionResizeMode(ResizeMode mode)
}
/*!
+ \since 5.0
+
Sets the constraints on how the section specified by \a logicalIndex in
the header can be resized to those described by the given \a mode. The logical
index should exist at the time this function is called.
@@ -1259,6 +1271,8 @@ void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode)
*/
/*!
+ \since 5.0
+
Returns the resize mode that applies to the section specified by the given
\a logicalIndex.
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 299f9160988..98687313ed6 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -1299,6 +1299,9 @@ QStyleOptionViewItem QItemDelegate::setOptions(const QModelIndex &index,
if (value.canConvert<QBrush>())
opt.palette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
+ // disable style animations for checkboxes etc. within itemviews (QTBUG-30146)
+ opt.styleObject = 0;
+
return opt;
}
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 995be3e786f..540ea27b889 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -388,6 +388,9 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
}
option->backgroundBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
+
+ // disable style animations for checkboxes etc. within itemviews (QTBUG-30146)
+ option->styleObject = 0;
}
/*!
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 4c6d8cfdc72..7f41e5c5769 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -588,6 +588,8 @@ extern void qRegisterWidgetsVariant();
*/
void QApplicationPrivate::initialize()
{
+ is_app_running = false; // Starting up.
+
QWidgetPrivate::mapper = new QWidgetMapper;
QWidgetPrivate::allWidgets = new QWidgetSet;
@@ -601,8 +603,6 @@ void QApplicationPrivate::initialize()
qRegisterGuiStateMachine();
#endif
- is_app_running = true; // no longer starting up
-
Q_Q(QApplication);
if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0)
@@ -629,6 +629,8 @@ void QApplicationPrivate::initialize()
if (QApplication::desktopSettingsAware())
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
+
+ is_app_running = true; // no longer starting up
}
/*****************************************************************************
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 5ec713140e0..f82d33f2835 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6916,14 +6916,15 @@ void QWidget::setUpdatesEnabled(bool enable)
Shows the widget and its child widgets. This function is
equivalent to setVisible(true) in the normal case, and equivalent
to showFullScreen() if the QStyleHints::showIsFullScreen() hint
- is true.
+ is true and the window is not a popup.
\sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(),
- showNormal(), isVisible()
+ showNormal(), isVisible(), windowFlags()
*/
void QWidget::show()
{
- if (isWindow() && qApp->styleHints()->showIsFullScreen())
+ bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window;
+ if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen())
showFullScreen();
else
setVisible(true);
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 84693d02a5a..2ffe9c5de5f 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -109,7 +109,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setFlags(data.window_flags);
fixPosIncludesFrame();
- win->setGeometry(q->geometry());
+ if (q->testAttribute(Qt::WA_Moved))
+ win->setGeometry(q->geometry());
+ else
+ win->resize(q->size());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
if (q->testAttribute(Qt::WA_TranslucentBackground)) {
@@ -466,19 +469,6 @@ void QWidget::activateWindow()
wnd->requestActivate();
}
-// Position top level windows at the center, avoid showing
-// Windows at the default 0,0 position excluding the frame.
-static inline QRect positionTopLevelWindow(QRect geometry, const QScreen *screen)
-{
- if (screen && geometry.x() == 0 && geometry.y() == 0) {
- const QRect availableGeometry = screen->availableGeometry();
- if (availableGeometry.width() > geometry.width()
- && availableGeometry.height() > geometry.height())
- geometry.moveCenter(availableGeometry.center());
- }
- return geometry;
-}
-
// move() was invoked with Qt::WA_WState_Created not set (frame geometry
// unknown), that is, crect has a position including the frame.
// If we can determine the frame strut, fix that and clear the flag.
@@ -529,16 +519,16 @@ void QWidgetPrivate::show_sys()
if (q->isWindow())
fixPosIncludesFrame();
QRect geomRect = q->geometry();
- if (q->isWindow()) {
- if (!q->testAttribute(Qt::WA_Moved))
- geomRect = positionTopLevelWindow(geomRect, window->screen());
- } else {
+ if (!q->isWindow()) {
QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint());
geomRect.moveTopLeft(topLeftOfWindow);
}
const QRect windowRect = window->geometry();
if (windowRect != geomRect) {
- window->setGeometry(geomRect);
+ if (q->testAttribute(Qt::WA_Moved))
+ window->setGeometry(geomRect);
+ else
+ window->resize(geomRect.size());
}
if (QBackingStore *store = q->backingStore()) {
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index d1d80f5af05..4b6ba17595d 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -2265,11 +2265,11 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case QFrame::VLine: {
QPoint p1, p2;
if (frameShape == QFrame::HLine) {
- p1 = QPoint(opt->rect.x(), opt->rect.height() / 2);
+ p1 = QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height() / 2);
p2 = QPoint(opt->rect.x() + opt->rect.width(), p1.y());
} else {
- p1 = QPoint(opt->rect.x()+opt->rect.width() / 2, 0);
- p2 = QPoint(p1.x(), opt->rect.height());
+ p1 = QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y());
+ p2 = QPoint(p1.x(), p1.y() + opt->rect.height());
}
if (frameShadow == QFrame::Plain) {
QPen oldPen = p->pen();
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index dab8e3fe74f..a4573ebb015 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1208,7 +1208,6 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn,
const ThemeDrawState tds,
HIThemeButtonDrawInfo *bdi) const
{
- bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
ThemeDrawState tdsModified = tds;
if (btn->state & QStyle::State_On)
tdsModified = kThemeStatePressed;
@@ -1216,7 +1215,7 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn,
bdi->state = tdsModified;
bdi->value = kThemeButtonOff;
- if (drawColorless && tdsModified == kThemeStateInactive)
+ if (tds == kThemeStateInactive)
bdi->state = kThemeStateActive;
if (btn->state & QStyle::State_HasFocus)
bdi->adornment = kThemeAdornmentFocus;
@@ -1287,10 +1286,9 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
bdi->value = kThemeButtonOff;
if (combo->state & QStyle::State_HasFocus)
bdi->adornment = kThemeAdornmentFocus;
- bool drawColorless = combo->palette.currentColorGroup() == QPalette::Active && tds == kThemeStateInactive;
if (combo->activeSubControls & QStyle::SC_ComboBoxArrow)
bdi->state = kThemeStatePressed;
- else if (drawColorless)
+ else if (tds == kThemeStateInactive)
bdi->state = kThemeStateActive;
else
bdi->state = tds;
@@ -1611,8 +1609,6 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
tdi->enableState = (slider->state & QStyle::State_Enabled) ? kThemeTrackActive
: kThemeTrackDisabled;
- if (!(slider->state & QStyle::State_Active))
- tdi->enableState = kThemeTrackInactive;
if (!isScrollbar) {
if (slider->state & QStyle::QStyle::State_HasFocus)
tdi->attributes |= kThemeTrackHasFocus;
@@ -3033,12 +3029,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_IndicatorViewItemCheck:
case PE_IndicatorRadioButton:
case PE_IndicatorCheckBox: {
- bool drawColorless = (!(opt->state & State_Active))
- && opt->palette.currentColorGroup() == QPalette::Active;
+ bool drawColorless = tds == kThemeStateInactive;
HIThemeButtonDrawInfo bdi;
bdi.version = qt_mac_hitheme_version;
bdi.state = tds;
- if (drawColorless && tds == kThemeStateInactive)
+ if (drawColorless)
bdi.state = kThemeStateActive;
bdi.adornment = kThemeDrawIndicatorOnly;
if (opt->state & State_HasFocus)
@@ -3572,13 +3567,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2;
HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset,
ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2);
- bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
- if (drawColorless && tds == kThemeStateInactive)
- tds = kThemeStateActive;
HIThemePopupArrowDrawInfo pdi;
pdi.version = qt_mac_hitheme_version;
- pdi.state = tds;
+ pdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds;
pdi.orientation = kThemeArrowDown;
if (arrowRect.size.width < 8.)
pdi.size = kThemeArrow5pt;
@@ -5019,6 +5011,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bgColor.blue() < 128;
if (isDarkBg)
[scroller setKnobStyle:NSScrollerKnobStyleLight];
+ else
+ [scroller setKnobStyle:NSScrollerKnobStyleDefault];
[scroller setControlSize:(tdi.kind == kThemeSmallScrollBar ? NSMiniControlSize
: NSRegularControlSize)];
@@ -5136,7 +5130,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
HIThemeFrameDrawInfo fdi;
fdi.version = qt_mac_hitheme_version;
- fdi.state = tds;
+ fdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds;
fdi.kind = kHIThemeFrameTextFieldSquare;
fdi.isFocused = false;
HIRect hirect = qt_hirectForQRect(lineeditRect);
@@ -5167,11 +5161,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
else if (sb->activeSubControls == SC_SpinBoxUp
&& (sb->state & State_Sunken))
tds = kThemeStatePressedUp;
- bdi.state = tds;
- if (!(sb->state & State_Active)
- && sb->palette.currentColorGroup() == QPalette::Active
- && tds == kThemeStateInactive)
+ if (tds == kThemeStateInactive)
bdi.state = kThemeStateActive;
+ else
+ bdi.state = tds;
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
@@ -5188,7 +5181,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
int(outRect.size.height - newRect.size.height));
newRect = qt_hirectForQRect(updown, off_rct);
- HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
+ if (tds == kThemeStateInactive)
+ d->drawColorlessButton(newRect, &bdi, p, sb);
+ else
+ HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
}
}
break;
@@ -5196,8 +5192,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)){
HIThemeButtonDrawInfo bdi;
d->initComboboxBdi(combo, &bdi, widget, d->getDrawState(opt->state));
- bool drawColorless = combo->palette.currentColorGroup() == QPalette::Active && tds == kThemeStateInactive;
- if (!drawColorless)
+ if (!tds == kThemeStateInactive)
QMacStylePrivate::drawCombobox(qt_hirectForQRect(combo->rect), bdi, p);
else
d->drawColorlessButton(qt_hirectForQRect(combo->rect), &bdi, p, opt);
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index 6b9aa92fd93..18a4d57900d 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -32,7 +32,7 @@ QMAKE_LIBS += $$QMAKE_LIBS_GUI
contains(DEFINES,QT_EVAL):include($$QT_SOURCE_TREE/src/corelib/eval.pri)
-QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
+QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtWidgets.dynlist
# Code coverage with TestCocoon
# The following is required as extra compilers use $$QMAKE_CXX instead of $(CXX).
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 6da0c9bfa68..7be3116cbd4 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -55,16 +55,16 @@ else()
message("CMake version older than 2.8.9 (Found ${CMAKE_VERSION}). Not running test \"test_use_modules_function\"")
endif()
expect_pass(test_wrap_cpp_and_resources)
-expect_pass(test_dependent_modules)
+if (NOT NO_WIDGETS)
+ expect_pass(test_dependent_modules)
+ expect_pass("test(needsquoting)dirname")
+endif()
expect_fail(test_add_resource_options)
expect_fail(test_wrap_cpp_options)
-expect_pass("test(needsquoting)dirname")
expect_pass(test_platform_defs_include)
expect_pass(test_qtmainwin_library)
-# If Qt D-Bus has been installed then run the tests for its macros.
-find_package(Qt5DBus QUIET)
-if (Qt5DBus_FOUND AND NOT APPLE)
+if (NOT NO_DBUS)
expect_pass(test_dbus_module)
endif()
expect_pass(test_multiple_find_package)
@@ -78,30 +78,37 @@ expect_pass(test_testlib_definitions)
expect_pass(test_json_plugin_includes)
expect_fail(test_testlib_no_link_gui)
-expect_fail(test_testlib_no_link_widgets)
-
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_gui/test_testlib_no_link_gui/"
)
-execute_process(COMMAND ${CMAKE_COMMAND} -E copy
- "${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
- "${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"
-)
+
+if (NOT NO_WIDGETS)
+ expect_fail(test_testlib_no_link_widgets)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
+ "${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"
+ )
+endif()
set(qt_module_includes
Core QObject
Gui QImage
- Widgets QWidget
Network QHostInfo
- OpenGL QGLBuffer
Sql QSqlError
Test QTestEventList
Xml QDomDocument
- PrintSupport QPrintDialog
)
-if (UNIX AND NOT APPLE AND NOT QNXNTO)
+if (NOT NO_WIDGETS)
+ list(APPEND qt_module_includes
+ Widgets QWidget
+ OpenGL QGLBuffer
+ PrintSupport QPrintDialog
+ )
+endif()
+
+if (NOT NO_DBUS)
list(APPEND qt_module_includes
DBus QDBusMessage
)
diff --git a/tests/auto/cmake/test(needsquoting)dirname/CMakeLists.txt b/tests/auto/cmake/test(needsquoting)dirname/CMakeLists.txt
index 12ce93ca267..e4c7f07256c 100644
--- a/tests/auto/cmake/test(needsquoting)dirname/CMakeLists.txt
+++ b/tests/auto/cmake/test(needsquoting)dirname/CMakeLists.txt
@@ -3,13 +3,11 @@ cmake_minimum_required(VERSION 2.8)
project("test(needsquoting)dirname")
-find_package(Qt5Core REQUIRED)
-find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
-include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
+include_directories(${Qt5Widgets_INCLUDE_DIRS})
-add_definitions(${Qt5Core_DEFINITIONS})
+add_definitions(${Qt5Widgets_DEFINITIONS})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/tests/auto/cmake/test_concurrent_module/CMakeLists.txt b/tests/auto/cmake/test_concurrent_module/CMakeLists.txt
index efd7b725ea4..7014fe51cd2 100644
--- a/tests/auto/cmake/test_concurrent_module/CMakeLists.txt
+++ b/tests/auto/cmake/test_concurrent_module/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8)
project(test_concurrent_module)
-find_package(Qt5Concurrent REQUIRED)
+find_package(Qt5Concurrent 5.0.0 REQUIRED)
include_directories(
${Qt5Concurrent_INCLUDE_DIRS}
diff --git a/tests/auto/cmake/test_dbus_module/CMakeLists.txt b/tests/auto/cmake/test_dbus_module/CMakeLists.txt
index 6bbb52697c3..36480e85e87 100644
--- a/tests/auto/cmake/test_dbus_module/CMakeLists.txt
+++ b/tests/auto/cmake/test_dbus_module/CMakeLists.txt
@@ -3,17 +3,15 @@ cmake_minimum_required(VERSION 2.8)
project(test_dbus_module)
-find_package(Qt5Core REQUIRED)
-find_package(Qt5DBus REQUIRED)
+find_package(Qt5DBus 5.0.0 REQUIRED)
include_directories(
- ${Qt5Core_INCLUDE_DIRS}
${Qt5DBus_INCLUDE_DIRS}
)
-add_definitions(${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS})
+add_definitions(${Qt5DBus_DEFINITIONS})
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5DBus_EXECUTABLE_COMPILE_FLAGS}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -33,4 +31,4 @@ qt5_add_dbus_adaptor(my_srcs
)
add_executable(myobject ${my_srcs} ${moc_files})
-target_link_libraries(myobject ${Qt5DBus_LIBRARIES} ${Qt5Core_LIBRARIES})
+target_link_libraries(myobject ${Qt5DBus_LIBRARIES})
diff --git a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
index c370e8effab..cc54bf5bc39 100644
--- a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
+++ b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
@@ -35,4 +35,6 @@ endmacro()
add_subdirectory(core_only)
add_subdirectory(gui)
-add_subdirectory(widgets)
+if(NOT NO_WIDGETS)
+ add_subdirectory(widgets)
+endif()
diff --git a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
index 4ce01938cbf..bfcdd9d1d70 100644
--- a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
+++ b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
@@ -13,4 +13,4 @@ add_executable(three three.cpp)
find_package(Qt5Core)
qt5_use_modules(two Test)
-qt5_use_modules(three Widgets Test)
+qt5_use_modules(three Gui Test)
diff --git a/tests/auto/cmake/test_use_modules_function/three.cpp b/tests/auto/cmake/test_use_modules_function/three.cpp
index c3aff71b034..42ae9109810 100644
--- a/tests/auto/cmake/test_use_modules_function/three.cpp
+++ b/tests/auto/cmake/test_use_modules_function/three.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include <QtTest>
-#include <QWidget>
+#include <QWindow>
class Three : public QObject
{
@@ -48,7 +48,7 @@ class Three : public QObject
public:
Three(QObject *parent = 0)
{
- QWidget *w = new QWidget;
+ QWindow *w = new QWindow;
w->show();
}
};
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index df7b3974819..6fa222dd72c 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -82,6 +82,12 @@ QT_END_NAMESPACE
# include <qplatformdefs.h>
#endif
+#ifdef Q_OS_QNX
+#ifdef open
+#undef open
+#endif
+#endif
+
#include <stdio.h>
#include <errno.h>
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index c4453fd5f2c..f94c8eac4fc 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -45,6 +45,7 @@
#include <qstandardpaths.h>
#include <qfileinfo.h>
#include <qsysinfo.h>
+#include <qregexp.h>
#ifdef Q_OS_UNIX
#include <unistd.h>
@@ -72,6 +73,7 @@ private slots:
void testCustomRuntimeDirectory();
void testAllWritableLocations_data();
void testAllWritableLocations();
+ void testCleanPath();
private:
#ifdef Q_XDG_PLATFORM
@@ -430,6 +432,18 @@ void tst_qstandardpaths::testAllWritableLocations()
QCOMPARE(loc.endsWith(QLatin1Char('/')), false);
}
+void tst_qstandardpaths::testCleanPath()
+{
+ const QRegExp filter(QStringLiteral("\\\\"));
+ QVERIFY(filter.isValid());
+ for (int i = 0; i <= QStandardPaths::GenericCacheLocation; ++i) {
+ const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::StandardLocation(i));
+ QVERIFY2(paths.filter(filter).isEmpty(),
+ qPrintable(QString::fromLatin1("Backslash found in %1 %2")
+ .arg(i).arg(paths.join(QLatin1Char(',')))));
+ }
+}
+
QTEST_MAIN(tst_qstandardpaths)
#include "tst_qstandardpaths.moc"
diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro
index 839d652be13..57d52117c79 100644
--- a/tests/auto/corelib/kernel/kernel.pro
+++ b/tests/auto/corelib/kernel/kernel.pro
@@ -28,3 +28,4 @@ SUBDIRS=\
# This test is only applicable on Windows
!win32*:SUBDIRS -= qwineventnotifier
+qnx: SUBDIRS -= qsharedmemory qsystemsemaphore
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 79d8b3dfe4d..a90bfadd737 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -442,6 +442,8 @@ void tst_QMimeDatabase::mimeTypeForFileWithContent()
txtTempFile.close();
mime = db.mimeTypeForFile(txtTempFileName);
QCOMPARE(mime.name(), QString::fromLatin1("text/plain"));
+ mime = db.mimeTypeForFile(txtTempFileName, QMimeDatabase::MatchContent);
+ QCOMPARE(mime.name(), QString::fromLatin1("application/smil"));
}
// Test what happens with an incorrect path
@@ -714,6 +716,8 @@ void tst_QMimeDatabase::findByData()
QFileInfo info(filePath);
QString mimeForInfo = database.mimeTypeForFile(info, QMimeDatabase::MatchContent).name();
QCOMPARE(mimeForInfo, resultMimeTypeName);
+ QString mimeForFile = database.mimeTypeForFile(filePath, QMimeDatabase::MatchContent).name();
+ QCOMPARE(mimeForFile, resultMimeTypeName);
}
void tst_QMimeDatabase::findByFile_data()
diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
index 5fb8df3f59f..085dfd0461a 100644
--- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -718,6 +718,8 @@ void tst_QStandardItemModel::checkChildren()
QVERIFY(!model.hasChildren());
QCOMPARE(model.rowCount(), 0);
QCOMPARE(model.columnCount(), 1);
+
+ QVERIFY(!model.index(0,0).sibling(100,100).isValid());
}
void tst_QStandardItemModel::data()
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index 4470961f7b2..89807f3747e 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -208,11 +208,12 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt
// Windows: Due to implementation changes, the event loop needs
// to be spun since we ourselves also need to answer the
// WM_DRAWCLIPBOARD message as we are in the chain of clipboard
- // viewers.
+ // viewers. Check for running before waitForFinished() in case
+ // the process terminated while processEvents() was executed.
bool running = true;
for (int i = 0; i < 60 && running; ++i) {
QGuiApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
- if (process.waitForFinished(500))
+ if (process.state() != QProcess::Running || process.waitForFinished(500))
running = false;
}
if (running) {
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
index 50952237fac..40f22d6d1e4 100644
--- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
+++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
@@ -139,7 +139,7 @@ void tst_PlatformSocketEngine::construction()
QVERIFY(socketDevice.error() == QAbstractSocket::UnknownSocketError);
QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::bytesAvailable() was called in QAbstractSocket::UnconnectedState");
- QVERIFY(socketDevice.bytesAvailable() == 0);
+ QVERIFY(socketDevice.bytesAvailable() == -1);
QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::hasPendingDatagrams() was called in QAbstractSocket::UnconnectedState");
QVERIFY(!socketDevice.hasPendingDatagrams());
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index e950ae1d281..b9ab4825d4b 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -1571,7 +1571,14 @@ void tst_QSslSocket::setReadBufferSize_task_250027()
setReadBufferSize_task_250027_handler.waitSomeMore(socket.data());
QByteArray secondRead = socket->readAll();
// second read should be some more data
- QVERIFY(secondRead.size() > 0);
+
+ int secondReadSize = secondRead.size();
+
+ if (secondReadSize <= 0) {
+ QEXPECT_FAIL("", "QTBUG-29730", Continue);
+ }
+
+ QVERIFY(secondReadSize > 0);
socket->close();
}
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index d4d109b9812..00973cf533d 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -78,7 +78,6 @@ private slots:
void shareRegister();
void textureCleanup();
#endif
- void graphicsViewClipping();
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
void glWidgetWithAlpha();
@@ -98,6 +97,7 @@ private slots:
void destroyFBOAfterContext();
void threadImages();
void nullRectCrash();
+ void graphicsViewClipping();
};
tst_QGL::tst_QGL()
@@ -874,7 +874,7 @@ void tst_QGL::graphicsViewClipping()
scene.setSceneRect(view.viewport()->rect());
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_VERIFY(widget->painted);
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 1d2a60506f5..1fbdd31a8fb 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -221,6 +221,9 @@ private slots:
void QTBUG_16967(); //clean close
void QTBUG_23895_data() { generic_data("QSQLITE"); }
void QTBUG_23895(); //sqlite boolean type
+ void QTBUG_14904_data() { generic_data("QSQLITE"); }
+ void QTBUG_14904();
+
void QTBUG_2192_data() { generic_data(); }
void QTBUG_2192();
@@ -1027,6 +1030,10 @@ void tst_QSqlQuery::isActive()
QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
QVERIFY( q.isActive() );
+
+ QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
+
+ QVERIFY( q.isActive() );
}
void tst_QSqlQuery::numRowsAffected()
@@ -3407,6 +3414,42 @@ void tst_QSqlQuery::QTBUG_23895()
QVERIFY(!q.next());
}
+/**
+ * Test for aliases with dots
+ */
+void tst_QSqlQuery::QTBUG_14904()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlQuery q(db);
+
+ QString tableName(qTableName("bug14904", __FILE__ ));
+ tst_Databases::safeDropTable( db, tableName );
+
+ q.prepare("create table " + tableName + "(val1 bool)");
+ QVERIFY_SQL(q, exec());
+ q.prepare("insert into " + tableName + "(val1) values(?);");
+ q.addBindValue(true);
+ QVERIFY_SQL(q, exec());
+
+ QString sql="select val1 AS value1 from " + tableName;
+ QVERIFY_SQL(q, exec(sql));
+ QVERIFY_SQL(q, next());
+
+ QCOMPARE(q.record().indexOf("value1"), 0);
+ QCOMPARE(q.record().field(0).type(), QVariant::Bool);
+ QCOMPARE(q.value(0).toBool(), true);
+
+ sql="select val1 AS 'value.one' from " + tableName;
+ QVERIFY_SQL(q, exec(sql));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.record().indexOf("value.one"), 0); // was -1 before bug fix
+ QCOMPARE(q.record().field(0).type(), QVariant::Bool);
+ QCOMPARE(q.value(0).toBool(), true);
+}
+
void tst_QSqlQuery::QTBUG_2192()
{
QFETCH( QString, dbName );
@@ -3419,14 +3462,19 @@ void tst_QSqlQuery::QTBUG_2192()
QSqlQuery q(db);
QVERIFY_SQL(q, exec(QString("CREATE TABLE " + tableName + " (dt %1)").arg(tst_Databases::dateTimeTypeName(db))));
+ QDateTime dt = QDateTime(QDate(2012, 7, 4), QTime(23, 59, 59, 999));
QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (dt) VALUES (?)"));
- q.bindValue(0, QVariant(QDateTime(QDate(2012, 7, 4), QTime(23, 59, 59, 999))));
+ q.bindValue(0, dt);
QVERIFY_SQL(q, exec());
- // Check if value was stored with at least second precision.
QVERIFY_SQL(q, exec("SELECT dt FROM " + tableName));
QVERIFY_SQL(q, next());
- QVERIFY(q.value(0).toDateTime().msecsTo(QDateTime(QDate(2012, 7, 4), QTime(23, 59, 59, 999))) < 1000 );
+
+ // Check if retrieved value preserves reported precision
+ int precision = qMax(0, q.record().field("dt").precision());
+ int diff = qAbs(q.value(0).toDateTime().msecsTo(dt));
+ int keep = qMin(1000, (int)qPow(10.0, precision));
+ QVERIFY(diff <= 1000 - keep);
}
}
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h
index f12899e3686..aaadcef601a 100644
--- a/tests/auto/tools/moc/parse-defines.h
+++ b/tests/auto/tools/moc/parse-defines.h
@@ -64,7 +64,7 @@
#define PD_CLASSINFO Q_CLASSINFO
-#if defined(Q_COMPILER_VARIADIC_MACROS)
+#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN)
#define PD_VARARG(x, ...) x(__VA_ARGS__)
#if defined(Q_CC_GNU) || defined(Q_MOC_RUN)
@@ -104,7 +104,7 @@ public slots:
PD_TEST_IDENTIFIER_ARG(void, combined6()) {}
-#if defined(Q_COMPILER_VARIADIC_MACROS)
+#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN)
PD_VARARG(void vararg1) {}
PD_VARARG(void vararg2, int) {}
PD_VARARG(void vararg3, int, int) {}
@@ -112,6 +112,13 @@ public slots:
PD_VARARGEXT(void vararg4) {}
PD_VARARGEXT(void vararg5, int) {}
PD_VARARGEXT(void vararg6, int, int) {}
+#else
+ void vararg1() {}
+ void vararg2(int) {}
+ void vararg3(int,int) {}
+ void vararg4() {}
+ void vararg5(int) {}
+ void vararg6(int,int) {}
#endif
#define OUTERFUNCTION(x) x
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index ee82dc0652d..909c220669e 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -2738,7 +2738,6 @@ void tst_Moc::parseDefines()
index = mo->indexOfSlot("combined6()");
QVERIFY(index != -1);
-#if defined(Q_COMPILER_VARIADIC_MACROS)
index = mo->indexOfSlot("vararg1()");
QVERIFY(index != -1);
index = mo->indexOfSlot("vararg2(int)");
@@ -2751,7 +2750,6 @@ void tst_Moc::parseDefines()
QVERIFY(index != -1);
index = mo->indexOfSlot("vararg6(int,int)");
QVERIFY(index != -1);
-#endif
index = mo->indexOfSlot("INNERFUNCTION(int)");
QVERIFY(index != -1);
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index ba60dd0c01d..c446513fe75 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -4239,11 +4239,11 @@ void tst_QWidget::isOpaque()
*/
void tst_QWidget::scroll()
{
- if (m_platform == QStringLiteral("xcb"))
- QSKIP("X11: Skip unstable test");
+ const int w = qMin(500, qApp->desktop()->availableGeometry().width() / 2);
+ const int h = qMin(500, qApp->desktop()->availableGeometry().height() / 2);
UpdateWidget updateWidget;
- updateWidget.resize(500, 500);
+ updateWidget.resize(w, h);
updateWidget.reset();
updateWidget.move(QGuiApplication::primaryScreen()->geometry().center() - QPoint(250, 250));
updateWidget.show();
@@ -4255,8 +4255,8 @@ void tst_QWidget::scroll()
updateWidget.reset();
updateWidget.scroll(10, 10);
qApp->processEvents();
- QRegion dirty(QRect(0, 0, 500, 10));
- dirty += QRegion(QRect(0, 10, 10, 490));
+ QRegion dirty(QRect(0, 0, w, 10));
+ dirty += QRegion(QRect(0, 10, 10, h - 10));
QTRY_COMPARE(updateWidget.paintedRegion, dirty);
}
@@ -4265,11 +4265,14 @@ void tst_QWidget::scroll()
updateWidget.update(0, 0, 10, 10);
updateWidget.scroll(0, 10);
qApp->processEvents();
- QRegion dirty(QRect(0, 0, 500, 10));
+ QRegion dirty(QRect(0, 0, w, 10));
dirty += QRegion(QRect(0, 10, 10, 10));
QTRY_COMPARE(updateWidget.paintedRegion, dirty);
}
+ if (updateWidget.width() < 200 || updateWidget.height() < 200)
+ QSKIP("Skip this test due to too small screen geometry.");
+
{
updateWidget.reset();
updateWidget.update(0, 0, 100, 100);
@@ -5434,7 +5437,7 @@ void tst_QWidget::setToolTip()
QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup));
popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass));
popup->setWindowTitle(popup->objectName());
- popup->resize(150, 50);
+ popup->setGeometry(50, 50, 150, 50);
QFrame *frame = new QFrame(popup.data());
frame->setGeometry(0, 0, 50, 50);
frame->setFrameStyle(QFrame::Box | QFrame::Plain);
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index fa0db593113..a53da5275c9 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -153,7 +153,6 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
QCOMPARE( s1->state(), QScroller::Inactive );
QScrollerProperties sp1 = QScroller::scroller(sw)->scrollerProperties();
- int fps = 60;
QTouchEvent::TouchPoint rawTouchPoint;
rawTouchPoint.setId(0);
@@ -192,8 +191,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
QCOMPARE( sw->receivedPrepare, true );
- QTest::qWait(1000 / fps * 2); // wait until the first scroll move
- QCOMPARE( sw->receivedFirst, true );
+ QTRY_COMPARE( sw->receivedFirst, true );
QCOMPARE( sw->receivedScroll, true );
QCOMPARE( sw->receivedOvershoot, false );
@@ -406,7 +404,7 @@ void tst_QScroller::scroll()
QScroller *s1 = QScroller::scroller(sw);
kineticScroll(sw, QPointF(500, 500), QPoint(0, 0), QPoint(100, 100), QPoint(200, 200));
// now we should be scrolling
- QCOMPARE( s1->state(), QScroller::Scrolling );
+ QTRY_COMPARE( s1->state(), QScroller::Scrolling );
// wait until finished, check that no further first scroll is send
sw->receivedFirst = false;
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 210e52f0aa9..3fa669c1fb5 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3902,6 +3902,11 @@ void tst_QLineEdit::inputMethod()
// removing focus allows input method to commit preedit
testWidget->setText("");
testWidget->activateWindow();
+ // TODO setFocus should not be necessary here, because activateWindow
+ // should focus it, and the window is the QLineEdit. But the test can fail
+ // on Windows if we don't do this. If each test had a unique QLineEdit
+ // instance, maybe such problems would go away.
+ testWidget->setFocus();
QTRY_VERIFY(testWidget->hasFocus());
QTRY_COMPARE(qApp->focusObject(), testWidget);
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index 5ad9aa76906..0696aa11d2d 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
@@ -113,7 +113,9 @@ void tst_QProgressBar::minMaxSameValue()
QProgressBar bar;
bar.setRange(10, 10);
bar.setValue(10);
+ bar.move(300, 300);
bar.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&bar));
}
void tst_QProgressBar::destroyIndeterminate()
@@ -123,7 +125,9 @@ void tst_QProgressBar::destroyIndeterminate()
// it's deleted.
QPointer<QProgressBar> bar = new QProgressBar;
bar->setMaximum(0);
+ bar->move(300, 300);
bar->show();
+ QVERIFY(QTest::qWaitForWindowExposed(bar.data()));
QEventLoop loop;
QTimer::singleShot(500, bar, SLOT(deleteLater()));
@@ -166,8 +170,10 @@ void tst_QProgressBar::format()
ProgressBar bar;
bar.setRange(0, 10);
bar.setValue(1);
+ bar.move(300, 300);
bar.show();
QVERIFY(QTest::qWaitForWindowExposed(&bar));
+ QVERIFY(QTest::qWaitForWindowExposed(&bar));
QTest::qWait(20);
bar.repainted = false;
@@ -202,6 +208,7 @@ void tst_QProgressBar::setValueRepaint()
pbar.setMinimum(0);
pbar.setMaximum(10);
pbar.setFormat("%v");
+ pbar.move(300, 300);
pbar.show();
QVERIFY(QTest::qWaitForWindowExposed(&pbar));
@@ -224,7 +231,9 @@ void tst_QProgressBar::setMinMaxRepaint()
pbar.setMinimum(0);
pbar.setMaximum(10);
pbar.setFormat("%v");
+ pbar.move(300, 300);
pbar.show();
+ qApp->setActiveWindow(&pbar);
QVERIFY(QTest::qWaitForWindowActive(&pbar));
// No repaint when setting minimum to the current minimum
@@ -319,7 +328,9 @@ void tst_QProgressBar::task245201_testChangeStyleAndDelete()
QStyle *style = QStyleFactory::create(style1_str);
bar->setStyle(style);
+ bar->move(300, 300);
bar->show();
+ QVERIFY(QTest::qWaitForWindowExposed(bar));
QStyle *style2 = QStyleFactory::create(style2_str);
bar->setStyle(style2);
QTest::qWait(10);
diff --git a/tests/manual/transientwindow/main.cpp b/tests/manual/transientwindow/main.cpp
new file mode 100644
index 00000000000..aebb051688a
--- /dev/null
+++ b/tests/manual/transientwindow/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/transientwindow/mainwindow.cpp b/tests/manual/transientwindow/mainwindow.cpp
new file mode 100644
index 00000000000..25123c49365
--- /dev/null
+++ b/tests/manual/transientwindow/mainwindow.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwindow.h"
+#include <QDebug>
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent), m_showButton("Toggle visible", this), m_window(0)
+{
+ connect(&m_showButton, SIGNAL(clicked()), this, SLOT(toggleVisible()));
+ setWindowTitle(QString::fromLatin1("Main Window"));
+ m_showButton.setVisible(true);
+ setMinimumSize(300, 200);
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void MainWindow::toggleVisible()
+{
+ if (!m_window) {
+ m_window = new QWindow();
+ m_window->setTransientParent(windowHandle());
+ m_window->setMinimumSize(QSize(200, 100));
+ m_window->setTitle("Transient Window");
+ }
+ m_window->setVisible(!m_window->isVisible());
+}
diff --git a/tests/manual/transientwindow/mainwindow.h b/tests/manual/transientwindow/mainwindow.h
new file mode 100644
index 00000000000..352fc961e10
--- /dev/null
+++ b/tests/manual/transientwindow/mainwindow.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QPushButton>
+#include <QWindow>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+public slots:
+ void toggleVisible();
+
+private:
+ QPushButton m_showButton;
+ QWindow* m_window;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/manual/transientwindow/transientwindow.pro b/tests/manual/transientwindow/transientwindow.pro
new file mode 100644
index 00000000000..a07ee09dbc8
--- /dev/null
+++ b/tests/manual/transientwindow/transientwindow.pro
@@ -0,0 +1,6 @@
+QT += core gui widgets
+TARGET = transientwindow
+TEMPLATE = app
+SOURCES += main.cpp\
+ mainwindow.cpp
+HEADERS += mainwindow.h
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 22ee456038b..c1e1b2c8dce 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -2548,7 +2548,7 @@ void Configure::generateOutputVars()
qtConfig += "build_all";
}
if (dictionary[ "FORCEDEBUGINFO" ] == "yes")
- qtConfig += "force_debug_info";
+ qmakeConfig += "force_debug_info";
qmakeConfig += dictionary[ "BUILD" ];
dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];