summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-26 21:43:25 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-26 21:43:25 +0200
commit06bd93c4acf49fc24408a60ebdf7a46caf02f9b3 (patch)
treeeedbdaa40fbf20bb99187084dd9edf14f73f05bd
parentbafad505a0adb21b819f7617e5e802bf2d52fd54 (diff)
parent41a7d74385eece725435159ca021151e871bf116 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: src/plugins/platforms/ios/qiosmessagedialog.mm Change-Id: Icfbf55c3215ec088e552d0b42a5c94d04b17c65f
-rw-r--r--config.tests/unix/libjpeg/libjpeg.cpp3
-rw-r--r--dist/changes-5.6.2339
-rw-r--r--examples/gui/doc/src/openglwindow.qdoc12
-rw-r--r--examples/gui/doc/src/rasterwindow.qdoc15
-rw-r--r--examples/gui/openglwindow/openglwindow.cpp7
-rw-r--r--examples/gui/openglwindow/openglwindow.h1
-rw-r--r--examples/gui/rasterwindow/rasterwindow.cpp10
-rw-r--r--examples/gui/rasterwindow/rasterwindow.h1
-rw-r--r--examples/widgets/dialogs/findfiles/window.cpp10
-rw-r--r--mkspecs/features/qt.prf14
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp23
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp4
-rw-r--r--src/angle/src/common/common.pri2
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h49
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm57
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.pro5
-rw-r--r--src/corelib/global/qlogging.cpp3
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.cpp2
-rw-r--r--src/corelib/kernel/qabstractnativeeventfilter.cpp15
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/kernel/qobjectdefs.h2
-rw-r--r--src/corelib/tools/qdatetime.cpp31
-rw-r--r--src/corelib/tools/qstring.h23
-rw-r--r--src/dbus/qdbusconnection.cpp20
-rw-r--r--src/dbus/qdbusconnection_p.h19
-rw-r--r--src/dbus/qdbuserror.h7
-rw-r--r--src/dbus/qdbusintegrator.cpp18
-rw-r--r--src/dbus/qdbusserver.cpp2
-rw-r--r--src/dbus/qdbusutil_p.h3
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qguivariant.cpp3
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp8
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp3
-rw-r--r--src/gui/kernel/qwindow.cpp13
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h4
-rw-r--r--src/gui/painting/qbrush.cpp14
-rw-r--r--src/gui/painting/qcolor.cpp95
-rw-r--r--src/gui/painting/qcolor.h13
-rw-r--r--src/gui/painting/qcolor_p.h5
-rw-r--r--src/gui/painting/qdrawhelper.cpp185
-rw-r--r--src/gui/text/qrawfont.cpp13
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/platformsupport/dbusmenu/qdbusplatformmenu.cpp4
-rw-r--r--src/platformsupport/dbustray/qdbustrayicon.cpp5
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp34
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h17
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp30
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping.cpp12
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping_p.h4
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp2
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp14
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp14
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp2
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbintegration.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm5
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm14
-rw-r--r--src/plugins/platforms/eglfs/api/api.pri10
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscontext.cpp (renamed from src/plugins/platforms/eglfs/qeglfscontext.cpp)4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscontext_p.h (renamed from src/plugins/platforms/eglfs/qeglfscontext.h)13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor.cpp2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsglobal_p.h (renamed from src/plugins/platforms/eglfs/api/qeglfsglobal.h)11
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfshooks_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp (renamed from src/plugins/platforms/eglfs/qeglfsintegration.cpp)6
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h (renamed from src/plugins/platforms/eglfs/qeglfsintegration.h)13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp (renamed from src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp)2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h (renamed from src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h)13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp50
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h10
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro2
-rw-r--r--src/plugins/platforms/eglfs/eglfs-plugin.pro2
-rw-r--r--src/plugins/platforms/eglfs/eglfsdeviceintegration.pro13
-rw-r--r--src/plugins/platforms/eglfs/qeglfsmain.cpp2
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm7
-rw-r--r--src/plugins/platforms/ios/qiosmessagedialog.mm2
-rw-r--r--src/plugins/platforms/ios/qiostextinputoverlay.mm4
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm4
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm2
-rw-r--r--src/plugins/platforms/ios/quiview.mm3
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h11
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp12
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp16
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp10
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp80
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp9
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp15
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro8
-rw-r--r--src/sql/configure.json2
-rw-r--r--src/testlib/3rdparty/CALLGRIND_LICENSE.txt35
-rw-r--r--src/testlib/3rdparty/CYCLE_LICENSE.txt18
-rw-r--r--src/testlib/3rdparty/LINUX_LICENSE.txt351
-rw-r--r--src/testlib/3rdparty/qt_attribution.json42
-rw-r--r--src/testlib/doc/src/qttest-index.qdoc13
-rw-r--r--src/tools/qlalr/lalr.cpp2
-rw-r--r--src/tools/qlalr/lalr.h1
-rw-r--r--src/tools/qlalr/main.cpp2
-rw-r--r--src/tools/qlalr/recognizer.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp18
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp68
-rw-r--r--src/widgets/styles/qstyleoption.h8
-rw-r--r--src/widgets/widgets/qmenu.cpp86
-rw-r--r--src/widgets/widgets/qmenu_p.h23
-rw-r--r--src/widgets/widgets/qmenubar.cpp52
-rw-r--r--src/widgets/widgets/qmenubar_p.h4
-rw-r--r--src/widgets/widgets/qtabbar.cpp3
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp3
-rw-r--r--src/winmain/qtmain_winrt.cpp8
-rw-r--r--src/xml/sax/qxml.h11
-rw-r--r--tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp57
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp2
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp52
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp18
-rw-r--r--tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp2
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp45
-rw-r--r--tests/auto/testlib/selftests/test/BLACKLIST3
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp53
-rw-r--r--tests/manual/qopenglwindow/multiwindow/main.cpp145
140 files changed, 2035 insertions, 721 deletions
diff --git a/config.tests/unix/libjpeg/libjpeg.cpp b/config.tests/unix/libjpeg/libjpeg.cpp
index 9187133393..106043c608 100644
--- a/config.tests/unix/libjpeg/libjpeg.cpp
+++ b/config.tests/unix/libjpeg/libjpeg.cpp
@@ -43,9 +43,10 @@ extern "C" {
#include <jpeglib.h>
}
+j_compress_ptr cinfo;
+
int main(int, char **)
{
- j_compress_ptr cinfo;
jpeg_create_compress(cinfo);
return 0;
}
diff --git a/dist/changes-5.6.2 b/dist/changes-5.6.2
new file mode 100644
index 0000000000..7b62a018f3
--- /dev/null
+++ b/dist/changes-5.6.2
@@ -0,0 +1,339 @@
+Qt 5.6.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.6.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.6 series is binary compatible with the 5.5.x series.
+Applications compiled for 5.5 will continue to run with 5.6.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+******************************************************************************
+* Important Behavior Changes *
+******************************************************************************
+
+ - [QTBUG-45031] The NSURLConnection backend of QNetworkAccessManager has
+ been removed, since SecureTransport is the default SSL backend on iOS
+ and is enabled by default. This means that building with -no-openssl
+ -no-securetransport will no longer provide SSL capabilities on iOS.
+
+ - QUrl::resolved() no longer treats a URL with a scheme as a relative URL
+ if it matches this URL's scheme. For now it still treats "file:name.txt"
+ as relative for compatibility, but be warned that in Qt 5.8 it will no
+ longer consider those to be relative. Both isRelative() and RFC 3986 say
+ that such URLs are not relative, so starting from Qt 5.8, resolved() will
+ return them as is.
+
+ - [QTBUG-47815] QDateTime now uses QLocale to get the "AM" and "PM" strings
+ when parsing times, instead of strings obtained from the loaded
+ translations.
+
+******************************************************************************
+* Library *
+******************************************************************************
+
+QtCore
+------
+
+ - Optimized toLatin1()/toUtf8() called on a QStringBuilder expression.
+ - [QTBUG-18729][QTBUG-32457] Fixed a bug that caused Windows to show
+ dialogs prompting the user to insert media when certain operations were
+ made with Qt I/O classes, particularly QStorageInfo::mountedVolumes().
+
+ - QCommandLineParser:
+ * The methods that exit() the application will now call cleanup routines
+ registered with qAddPostRoutine.
+
+ - QDataStream:
+ * Fixed compatibility of QTime serialization with Qt 3.
+
+ - QDebug:
+ * Fixed streaming of QChars.
+
+ - QJsonObject:
+ * Optimized equality operator.
+
+ - QJsonValue:
+ * Fixed use-after-free in assignment operator.
+
+ - QLockFile:
+ * Fixed permissions on lock files on Unix to allow for adjustments via
+ umask.
+ * [QTBUG-53392] Improved the robustness of detecting stale lock files on
+ Windows.
+
+ - QMutex:
+ * [QTBUG-54831] Fixed a bug that caused some applications to crash on
+ exit, depending on the order of creation of certain statics inside Qt.
+
+ - QObject:
+ * Fixed a crash when connecting a signal to a lambda or functor while
+ using Qt::UniqueConnection (note: the connection is still not unique).
+
+ - QStringListModel:
+ * Fixed dataChanged()'s 'roles' parameter to always contain both
+ Qt::EditRole and Qt::DisplayRole.
+
+ - QTemporaryFile:
+ * [QTBUG-54810] Fixed a bug that caused QTemporaryFile to fail when the
+ file name contained non-ASCII characters, on Windows.
+
+ - QTimeZone:
+ * [QTBUG-53071] Fixed a bug that caused QTimeZone to mis-parse time zones
+ whose names were not simple letter and digit combinations.
+
+ - QUrl:
+ * Made QUrl stricter in what it accepts for schemes, to comply with the
+ relevant standards. QUrl will no longer accept schemes starting with a
+ plus (+), a dash (-) or a dot (.).
+
+ - QVariant:
+ * [QTBUG-53384] Fixed QVariant::canConvert and conversion from integer
+ types to enumeration types.
+ * [QTBUG-54893] Fixed a bug that caused QVariants not to compare properly
+ if they contained QStringLists.
+
+ - QVector:
+ * [QTBUG-51758] Fixed a bug that would cause QVector to crash if one
+ called reserve(0).
+
+ - QXmlStreamReader:
+ * Fixed a bug in the XML parser that prevented to load XML that
+ contained invalid characters for XML 1.0.
+
+ - QXmlStreamWriter:
+ * Fixed a bug that prevented the generation of valid XML files when
+ using encoding with 8 bit per character but not ASCII compatible.
+ QXMLStreamWriter generated XML markup using always ASCII in this case.
+
+QtGui
+-----
+
+ - Fixed UBSan errors in
+ * QColor
+ * QGrayRaster
+ * QRasterizer
+
+ - Removed a total of 1610 relocations from the library.
+
+ - QGuiApplication:
+ * [QTBUG-51703] Fixed a bug that would cause QGuiApplication::sync() to
+ be left undefined for Qt builds without session management support.
+
+ - QIconLoaderEngine:
+ * Fixed theme lookup for scalable entries.
+
+ - Text:
+ * [QTBUG-42033] Fixed bug where a QTextLayout with
+ ShowLineAndParagraphSeparators would modify the layout's input string.
+ * [QTBUG-49452] Fixed a performance regression in Freetype engine that
+ was introduced in Qt 5.5.
+ * [QTBUG-54180] Fixed performance regression when rapidly switching
+ between a large set of fonts.
+
+ - Windows:
+ * [QTBUG-54494] Fixed stretch when combined with either no or vertical
+ hinting preference or a device pixel ratio different from 1.
+ * [QTBUG-51024] Fixed height of text bounding box when using no or
+ vertical hinting preference, or when the device pixel ratio is
+ different from 1.
+
+QtNetwork
+---------
+
+ - QAuthenticator:
+ * [QTBUG-53338] Fixed crash when comparing an initialized QAuthenticator
+ with an uninitialized QAuthenticator.
+
+QtSql
+-----
+
+ - [QTBUG-53969][QTBUG-53237] Fixed QSqlQuery::prepare value truncation
+ error when using UNSIGNED values in a MySQL database.
+
+QtWidgets
+---------
+
+ - Fixed UBSan/Coverity errors in:
+ * QAbstractItemView
+ * QDataWidgetMapper
+ * QTreeWidget
+ * QWidgetLineControl
+
+ - Removed a total of 167 relocations from the library.
+
+ - QAbstractItemDelegate:
+ * [QTBUG-16469] Show localized detailed tooltips and "What's this?"
+ texts.
+
+- QAbstractItemView:
+ * [QTBUG-53541] Fixed a bug involving drawing the drop indicator
+ where it shouldn't be drawn.
+ * Fixed a bug in setSelectionModel() which could lead to model indexes
+ from a different model be reused on a new model.
+
+ - QAbstractSpinBox:
+ * [QTBUG-55249] Fixed a bug related to first key press.
+
+ - QColorDialog:
+ * Fixed ignored alpha channel in getRgb().
+
+ - QComboBox:
+ * [QTBUG-54191] Fixed a crash on setEditable(false) called from
+ editTextChanged().
+
+ - QCompleter:
+ * [QTBUG-54642] Fixed wrong completion role after a QFileSystemModel
+ has been used.
+
+ - QDesktopWidget:
+ * [QTBUG-52101] Fixed tracking of QScreens.
+ * [QTBUG-52606] Fixed a bug related to DPI-scaling in screenNumber().
+
+ - QDialog:
+ * [QTBUG-52735] Fixed a bug involving moves between screens with
+ different DPI-scaling factors.
+
+ - QDockWidget:
+ * [QTBUG-52107][QTBUG-53754] Fixed bugs related to floating group tab
+ window title.
+ * [QTBUG-52108] A QDockWidgetGroupWindow can now be dragged into one of
+ its QDockWidgets.
+ * [QTBUG-53808] Fixed a bug that caused an undocked dock widget to lose
+ its decoration.
+ * [QTBUG-54185] Unbroke drag-and-drop.
+
+ - QGraphicsProxyWidget:
+ * [QTBUG-55112] Fixed a bug that caused the widget to receive events
+ during construction.
+
+ - QLineEdit:
+ * [QTBUG-49374] Fixed icons being too small on a High DPI screen
+ without scaling.
+ * [QTBUG-52796] Fixed QKeySequence::MoveToStartOfLine shortcut
+ being ignored.
+ * [QTBUG-54425] Fixed missing clear button on macOS.
+
+ - QMainWindow:
+ * [QTBUG-50491] Fixed a bug related to restoring dock widgets with
+ GroupedDragging.
+ * [QTBUG-52108] Fixed a bug related to context menus in the presence of
+ floating tabs.
+
+ - QMenu:
+ * [QTBUG-53054] Submenus can now be opened on left mouse button
+ press, too.
+
+ - QMenuBar:
+ * [QTBUG-53205] Fixed bugs (incl. crashes) involving reparented
+ menu bars.
+
+ - QOpenGLWidget:
+ * [QTBUG-50818][QTBUG-51815][QTBUG-54241][QTBUG-52419] Fixed several
+ repainting bugs and other drawing artifacts.
+
+ - QSideBar:
+ * Fixed a nullptr dereference on platforms that do not support
+ QFileSystemWatcher.
+
+ - QSystemTrayIcon:
+ * [QTBUG-53591] Use large icon for balloon message on Windows systems.
+
+ - QTabBar:
+ * Fixed a performance problem involving font metrics.
+
+ - QTreeView:
+ * [QTBUG-52793] Fixed a key navigation bug when the columns were
+ reordered.
+
+- QTreeWidget:
+ * [QTBUG-50207] Now handles device pixel ratio in animations correctly.
+
+- QWidget:
+ * [QTBUG-39887] Restored documented behavior for the
+ WA_X11NetWmWindowType* attributes.
+ * [QTBUG-41135][QTBUG-50030][QTBUG-50136][QTBUG-52507] Fixed
+ mapTo/FromGlobal() in case of widget hierarchies embedded into
+ QGraphicsView with transformations.
+ * [QTBUG-45484] Fixed setWindowRole().
+ * [QTBUG-50796] Reduced paint-events when resizing native widgets.
+ * [QTBUG-52123] Fixed a bug by which opaque texture-based widgets
+ were not always shown.
+ * [QTBUG-53515] Added a workaround for render-to-texture widgets in
+ fullscreen windows.
+ * [QTBUG-54734] Worked around an issue with translucent GL windows
+ on Windows.
+ * [QTBUG-54906] Fixed a bug relaed to fullscreen handling on Windows.
+
+ - Styles:
+ * Fixed several cases of QStyleOptions being created with null
+ version.
+ * [QTBUG-51266] Fixed painting of small progress bars on Vista+.
+ * [QTBUG-54630] Fixed a crash in QMacStyle::styleHint().
+ * [QTBUG-49374] The Windows style now takes the monitor's differing
+ logical DPI into account when calculating native metrics.
+
+******************************************************************************
+* Platform-specific Changes *
+******************************************************************************
+
+Android
+-------
+
+ - [QTBUG-50724] Added support for clang compiler.
+ - [QTBUG-53511] Fixed CJK font resolution on Android 7.
+
+BSDs
+----
+
+ - The freebsd-g++ mkspec was moved back and no longer requires the
+ "unsupported/" prefix, matching the FreeBSD ports tree, as FreeBSD 9.3
+ still defaults to using GCC. Users of GCC that did not previously use
+ the ports patch will need to adapt their build scripts and drop the
+ "unsupported/" prefix.
+ - Fixed a number of compilation issues on FreeBSD, NetBSD and OpenBSD. Qt
+ should now build out-of-the-box (no patches needed) on those systems.
+
+Linux
+-----
+
+ - [QTBUG-54733] It is now possible to opt out from installing signal
+ handlers when running with eglfs and linuxfb by setting the
+ QT_QPA_NO_SIGNAL_HANDLER environment variable to a non-zero value.
+ - Fixed the value of the 'defined' field in ATSPI GetAttributeValue
+ results.
+
+macOS
+-----
+
+ - [QTBUG-48953] Pasting text from Qt applications to Apple Mail now works.
+ - [QTBUG-48953] “text/vcard” is now required as the mime type when
+ placing vCards on the clipboard.
+ - OS X => macOS rename in Q_OS_ macros/docs, qmake scopes,
+ file selectors, etc.
+ - Add new QSysInfo values and MAC_OS_X / __MAC_ / __IPHONE_ values for
+ macOS 10.12 and iOS 9.1 through 10.0.
+ - Update prettyProductName with new macOS "Sierra" codename.
+
+Windows
+-------
+
+ - Fixed a new[]/delete mismatch in Windows tablet support.
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+moc
+---
+ - [QTBUG-53441] Fixed crash on file ending with a backslash followed by
+ carriage return
diff --git a/examples/gui/doc/src/openglwindow.qdoc b/examples/gui/doc/src/openglwindow.qdoc
index e93451c9a5..f283c7cfc0 100644
--- a/examples/gui/doc/src/openglwindow.qdoc
+++ b/examples/gui/doc/src/openglwindow.qdoc
@@ -34,6 +34,9 @@
\image openglwindow-example.png Screenshot of the OpenGLWindow example
+ \note This is a low level example of how to use QWindow with OpenGL.
+ In practice you should consider using the higher level QOpenGLWindow class.
+
\section1 OpenGLWindow Super Class
Our OpenGLWindow class acts as an API which is then subclassed to do the
@@ -70,9 +73,8 @@
\snippet openglwindow/openglwindow.cpp 2
- The renderLater() function simply puts an update request event on
- the event loop, which leads to renderNow() being called once the event
- gets processed.
+ The renderLater() function simply calls QWindow::requestUpdate() to schedule
+ an update for when the system is ready to repaint.
We also call renderNow() when we get an expose event. The exposeEvent() is
the notification to the window that its exposure, meaning visibility, on
@@ -109,11 +111,11 @@
\l {http://www.khronos.org/registry/gles/}{Khronos OpenGL ES API Registry}.
If animation has been enabled with OpenGLWindow::setAnimating(true), we
- call renderLater() to put another update request on the event loop.
+ call renderLater() to schedule another update request.
\snippet openglwindow/openglwindow.cpp 4
- Enabling animation also triggers an update request as shown in the
+ Enabling animation also schedules an update request as shown in the
following code snippet.
\snippet openglwindow/openglwindow.cpp 5
diff --git a/examples/gui/doc/src/rasterwindow.qdoc b/examples/gui/doc/src/rasterwindow.qdoc
index 963d09971d..d276925059 100644
--- a/examples/gui/doc/src/rasterwindow.qdoc
+++ b/examples/gui/doc/src/rasterwindow.qdoc
@@ -143,19 +143,16 @@
\snippet rasterwindow/rasterwindow.cpp 6
We went through a few places where the window needed to repainted
- immediately. There are some cases where this is not desierable,
+ immediately. There are some cases where this is not desirable,
but rather let the application return to the event loop and
- later. We acheive this by posting an even to ourself which will
- then be delivered when the application returns to the \l
- QGuiApplication event loop. To avoid posting new requests when one
- is already pending, we store this state in the \c m_update_pending
- variable.
+ schedule the repaint for later. We achieve this by requesting
+ an update, using QWindow::requestUpdate(), which will then be
+ delivered when the system is ready to repaint.
\snippet rasterwindow/rasterwindow.cpp 7
We reimplement the virtual \l QObject::event() function to handle
- the update event we posted to ourselves. When the event comes in
- we reset the pending update flag and call renderNow() to render
- the window right away.
+ the update event. When the event comes in we call renderNow() to
+ render the window right away.
*/
diff --git a/examples/gui/openglwindow/openglwindow.cpp b/examples/gui/openglwindow/openglwindow.cpp
index d36614f6a0..57a996a876 100644
--- a/examples/gui/openglwindow/openglwindow.cpp
+++ b/examples/gui/openglwindow/openglwindow.cpp
@@ -59,7 +59,6 @@
//! [1]
OpenGLWindow::OpenGLWindow(QWindow *parent)
: QWindow(parent)
- , m_update_pending(false)
, m_animating(false)
, m_context(0)
, m_device(0)
@@ -99,17 +98,13 @@ void OpenGLWindow::render()
//! [3]
void OpenGLWindow::renderLater()
{
- if (!m_update_pending) {
- m_update_pending = true;
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
- }
+ requestUpdate();
}
bool OpenGLWindow::event(QEvent *event)
{
switch (event->type()) {
case QEvent::UpdateRequest:
- m_update_pending = false;
renderNow();
return true;
default:
diff --git a/examples/gui/openglwindow/openglwindow.h b/examples/gui/openglwindow/openglwindow.h
index 276f94f84c..6e6c1d7449 100644
--- a/examples/gui/openglwindow/openglwindow.h
+++ b/examples/gui/openglwindow/openglwindow.h
@@ -82,7 +82,6 @@ protected:
void exposeEvent(QExposeEvent *event) override;
private:
- bool m_update_pending;
bool m_animating;
QOpenGLContext *m_context;
diff --git a/examples/gui/rasterwindow/rasterwindow.cpp b/examples/gui/rasterwindow/rasterwindow.cpp
index eb34bec252..fb717a4c8a 100644
--- a/examples/gui/rasterwindow/rasterwindow.cpp
+++ b/examples/gui/rasterwindow/rasterwindow.cpp
@@ -53,7 +53,6 @@
//! [1]
RasterWindow::RasterWindow(QWindow *parent)
: QWindow(parent)
- , m_update_pending(false)
{
create();
m_backingStore = new QBackingStore(this);
@@ -68,7 +67,6 @@ RasterWindow::RasterWindow(QWindow *parent)
bool RasterWindow::event(QEvent *event)
{
if (event->type() == QEvent::UpdateRequest) {
- m_update_pending = false;
renderNow();
return true;
}
@@ -79,10 +77,7 @@ bool RasterWindow::event(QEvent *event)
//! [6]
void RasterWindow::renderLater()
{
- if (!m_update_pending) {
- m_update_pending = true;
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
- }
+ requestUpdate();
}
//! [6]
@@ -99,9 +94,8 @@ void RasterWindow::resizeEvent(QResizeEvent *resizeEvent)
//! [2]
void RasterWindow::exposeEvent(QExposeEvent *)
{
- if (isExposed()) {
+ if (isExposed())
renderNow();
- }
}
//! [2]
diff --git a/examples/gui/rasterwindow/rasterwindow.h b/examples/gui/rasterwindow/rasterwindow.h
index be640814d4..2ccecbf704 100644
--- a/examples/gui/rasterwindow/rasterwindow.h
+++ b/examples/gui/rasterwindow/rasterwindow.h
@@ -74,7 +74,6 @@ protected:
private:
QBackingStore *m_backingStore;
- bool m_update_pending;
};
//! [1]
#endif // RASTERWINDOW_H
diff --git a/examples/widgets/dialogs/findfiles/window.cpp b/examples/widgets/dialogs/findfiles/window.cpp
index 05e160ed87..f2ce853d99 100644
--- a/examples/widgets/dialogs/findfiles/window.cpp
+++ b/examples/widgets/dialogs/findfiles/window.cpp
@@ -304,15 +304,19 @@ void Window::contextMenu(const QPoint &pos)
if (!item)
return;
QMenu menu;
+#ifndef QT_NO_CLIPBOARD
QAction *copyAction = menu.addAction("Copy Name");
+#endif
QAction *openAction = menu.addAction("Open");
QAction *action = menu.exec(filesTable->mapToGlobal(pos));
if (!action)
return;
const QString fileName = fileNameOfItem(item);
- if (action == copyAction)
- QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
- else if (action == openAction)
+ if (action == openAction)
openFile(fileName);
+#ifndef QT_NO_CLIPBOARD
+ else if (action == copyAction)
+ QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
+#endif
}
//! [16]
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 7b669b902f..e58e452620 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -203,10 +203,10 @@ contains(qt_module_deps, qml): \
# run qmlimportscanner
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, , system)
for (QMLPATH, QMLPATHS): \
- IMPORTPATHS += -importPath $$QMLPATH
+ IMPORTPATHS += -importPath $$system_quote($$QMLPATH)
#message(run $$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
- JSON = $$system($$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
+ JSON = $$system($$QMLIMPORTSCANNER $$system_quote($$_PRO_FILE_PWD_) $$IMPORTPATHS)
parseJson(JSON, IMPORTS)| error("Failed to parse qmlimportscanner output.")
@@ -267,13 +267,13 @@ contains(qt_module_deps, qml): \
# But strip away archives and other files that are not needed:
!isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
QMAKE_POST_LINK += \
- "cp $$OUT_PWD/qt.conf $$qtconfTargetPath; " \
- "test -d $$qmlTargetPath && rm -r $$qmlTargetPath; " \
- "mkdir -p $$qmlTargetPath && " \
+ "cp $$shell_quote($$OUT_PWD/qt.conf) \"$$qtconfTargetPath\"; " \
+ "test -d \"$$qmlTargetPath\" && rm -r \"$$qmlTargetPath\"; " \
+ "mkdir -p \"$$qmlTargetPath\" && " \
"for p in $$QMLPATHS; do" \
"rsync -r --exclude='*.a' --exclude='*.prl' --exclude='*.qmltypes' "
- macx-xcode: QMAKE_POST_LINK += "$p/ $$qmlTargetPath; done"
- else: QMAKE_POST_LINK += "\$\$p/ $$qmlTargetPath; done"
+ macx-xcode: QMAKE_POST_LINK += "$p/ \"$$qmlTargetPath\"; done"
+ else: QMAKE_POST_LINK += "\$\$p/ \"$$qmlTargetPath\"; done"
}
}
}
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 51c39a66d9..c0f968e335 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -33,6 +33,7 @@
#include <qregexp.h>
#include <qcryptographichash.h>
#include <qdebug.h>
+#include <qsettings.h>
#include <qstring.h>
#include <stdlib.h>
#include <time.h>
@@ -1449,6 +1450,28 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString configName = (as_release ? "Release" : "Debug");
QMap<QString, QString> settings;
+ if (!project->isActiveConfig("no_xcode_development_team")) {
+ const QSettings xcodeSettings(
+ QDir::homePath() + QLatin1String("/Library/Preferences/com.apple.dt.Xcode.plist"),
+ QSettings::NativeFormat);
+ const QVariantMap teams = xcodeSettings.value(QLatin1String("IDEProvisioningTeams")).toMap();
+ if (!teams.isEmpty()) {
+ for (QVariantMap::const_iterator it = teams.begin(), end = teams.end(); it != end; ++it) {
+ const QVariantMap team = it.value().toMap();
+ const QString teamType = team.value(QLatin1String("teamType")).toString();
+
+ // Skip Company teams because signing permissions may not be available under all
+ // circumstances for users who are not the Team Agent
+ if (teamType != QLatin1String("Company")) {
+ const QString teamId = team.value(QLatin1String("teamID")).toString();
+ settings.insert("DEVELOPMENT_TEAM", teamId);
+
+ // first suitable team we found is the one we'll use by default
+ break;
+ }
+ }
+ }
+ }
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 1155e45bd7..cb44937bea 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -969,7 +969,7 @@ void VcprojGenerator::initProject()
vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString();
if (!project->isEmpty("VCPROJ_ARCH")) {
vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString();
- } else if (project->isHostBuild()) {
+ } else {
vcProject.PlatformName = (is64Bit ? "x64" : "Win32");
}
vcProject.SdkVersion = project->first("WINSDK_VER").toQString();
@@ -1051,7 +1051,7 @@ void VcprojGenerator::initConfiguration()
conf.ConfigurationName = conf.Name;
if (!project->isEmpty("VCPROJ_ARCH")) {
conf.Name += "|" + project->first("VCPROJ_ARCH");
- } else if (project->isHostBuild()) {
+ } else {
conf.Name += (is64Bit ? "|x64" : "|Win32");
}
conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True);
diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
index e9351b2c42..3da59c61e2 100644
--- a/src/angle/src/common/common.pri
+++ b/src/angle/src/common/common.pri
@@ -1,5 +1,5 @@
# static builds should still link ANGLE dynamically when dynamic GL is enabled
-include(../../../gui/qtgui-config.pri)
+include($$OUT_PWD/../../../gui/qtgui-config.pri)
static:qtConfig(dynamicgl) {
CONFIG -= static
CONFIG += shared
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
new file mode 100644
index 0000000000..6666bc56c5
--- /dev/null
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include <QAbstractNativeEventFilter>
+
+class MyCocoaEventFilter : public QAbstractNativeEventFilter
+{
+public:
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE;
+};
+//! [0]
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm
new file mode 100644
index 0000000000..8abd576259
--- /dev/null
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include "mycocoaeventfilter.h"
+
+#import <AppKit/AppKit.h>
+
+bool CocoaNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *)
+{
+ if (eventType == "mac_generic_NSEvent") {
+ NSEvent *event = static_cast<NSEvent *>(message);
+ if ([event type] == NSKeyDown) {
+ // Handle key event
+ qDebug() << QString::fromNSString([event characters]);
+ }
+ }
+ return false;
+}
+//! [0]
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.pro b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.pro
new file mode 100644
index 0000000000..8f447be514
--- /dev/null
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.pro
@@ -0,0 +1,5 @@
+#! [0]
+HEADERS += mycocoaeventfilter.h
+OBJECTIVE_SOURCES += mycocoaeventfilter.mm
+LIBS += -framework AppKit
+#! [0]
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index a6da9567c6..6c7cd9c5c6 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1199,7 +1199,8 @@ void QMessagePattern::setPattern(const QString &pattern)
#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
// make sure the function has "Message" in the name so the function is removed
-#if (defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)
+#if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)) \
+ && !defined(Q_CC_INTEL)
// force skipping the frame pointer, to save the backtrace() function some work
__attribute__((optimize("omit-frame-pointer")))
#endif
diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp
index 886b2d0d27..39bfdd7782 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.cpp
+++ b/src/corelib/itemmodels/qabstractproxymodel.cpp
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
/*!
\property QAbstractProxyModel::sourceModel
- \brief the source model this proxy model.
+ \brief the source model of this proxy model.
*/
//detects the deletion of the source model
diff --git a/src/corelib/kernel/qabstractnativeeventfilter.cpp b/src/corelib/kernel/qabstractnativeeventfilter.cpp
index 351657d42c..dcbb92f044 100644
--- a/src/corelib/kernel/qabstractnativeeventfilter.cpp
+++ b/src/corelib/kernel/qabstractnativeeventfilter.cpp
@@ -96,14 +96,25 @@ QAbstractNativeEventFilter::~QAbstractNativeEventFilter()
In both cases, the \a message can be casted to a MSG pointer.
The \a result pointer is only used on Windows, and corresponds to the LRESULT pointer.
- On Mac, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an EventRef.
+ On macOS, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an NSEvent pointer.
In your reimplementation of this function, if you want to filter
the \a message out, i.e. stop it being handled further, return
true; otherwise return false.
- Example:
+ \b {Linux example}
\snippet code/src_corelib_kernel_qabstractnativeeventfilter.cpp 0
+
+ \b {macOS example}
+
+ mycocoaeventfilter.h:
+ \snippet code/src_corelib_kernel_qabstractnativeeventfilter.h 0
+
+ mycocoaeventfilter.mm:
+ \snippet code/src_corelib_kernel_qabstractnativeeventfilter.mm 0
+
+ myapp.pro:
+ \snippet code/src_corelib_kernel_qabstractnativeeventfilter.pro 0
*/
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 4ca90b8acf..d7cc0bce46 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -222,7 +222,7 @@ QObjectPrivate::QObjectPrivate(int version)
blockSig = false; // not blocking signals
wasDeleted = false; // double-delete catcher
isDeletingChildren = false; // set by deleteChildren()
- sendChildEvents = true; // if we should send ChildInsert and ChildRemove events to parent
+ sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 7ed6088d3b..5cdbef443b 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -185,7 +185,7 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
#if defined(Q_CC_CLANG) && Q_CC_CLANG >= 306
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override")
-#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 510
+#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 501
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_GCC("-Wsuggest-override")
#else
# define Q_OBJECT_NO_OVERRIDE_WARNING
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 6aae4ce871..ac8054ce82 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -845,7 +845,7 @@ static QString toStringIsoDate(qint64 jd)
range 0 to 9999. This restriction may apply to locale-aware
formats as well, depending on the locale settings.
- \sa shortDayName(), shortMonthName()
+ \sa fromString(), shortDayName(), shortMonthName(), QLocale::toString()
*/
QString QDate::toString(Qt::DateFormat format) const
{
@@ -921,7 +921,7 @@ QString QDate::toString(Qt::DateFormat format) const
If the datetime is invalid, an empty string will be returned.
- \sa QDateTime::toString(), QTime::toString(), QLocale::toString()
+ \sa fromString(), QDateTime::toString(), QTime::toString(), QLocale::toString()
*/
QString QDate::toString(const QString& format) const
@@ -1201,6 +1201,8 @@ qint64 QDate::daysTo(const QDate &d) const
Note for Qt::TextDate: It is recommended that you use the
English short month names (e.g. "Jan"). Although localized month
names can also be used, they depend on the user's locale settings.
+
+ \sa toString(), QLocale::toDate()
*/
QDate QDate::fromString(const QString& string, Qt::DateFormat format)
{
@@ -1319,8 +1321,8 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format)
\snippet code/src_corelib_tools_qdatetime.cpp 3
- \sa QDateTime::fromString(), QTime::fromString(), QDate::toString(),
- QDateTime::toString(), QTime::toString()
+ \sa toString(), QDateTime::fromString(), QTime::fromString(),
+ QLocale::toDate()
*/
QDate QDate::fromString(const QString &string, const QString &format)
@@ -1588,7 +1590,7 @@ int QTime::msec() const
If the time is invalid, an empty string will be returned.
- \sa QDate::toString(), QDateTime::toString()
+ \sa fromString(), QDate::toString(), QDateTime::toString(), QLocale::toString()
*/
QString QTime::toString(Qt::DateFormat format) const
@@ -1661,7 +1663,7 @@ QString QTime::toString(Qt::DateFormat format) const
If the time is invalid, an empty string will be returned.
If \a format is empty, the default format "hh:mm:ss" is used.
- \sa QDate::toString(), QDateTime::toString(), QLocale::toString()
+ \sa fromString(), QDate::toString(), QDateTime::toString(), QLocale::toString()
*/
QString QTime::toString(const QString& format) const
{
@@ -1933,6 +1935,8 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format,
this may result in two conversion attempts (if the conversion
fails for the default locale). This should be considered an
implementation detail.
+
+ \sa toString(), QLocale::toTime()
*/
QTime QTime::fromString(const QString& string, Qt::DateFormat format)
{
@@ -2006,8 +2010,8 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
\snippet code/src_corelib_tools_qdatetime.cpp 8
- \sa QDateTime::fromString(), QDate::fromString(), QDate::toString(),
- QDateTime::toString(), QTime::toString()
+ \sa toString(), QDateTime::fromString(), QDate::fromString(),
+ QLocale::toTime()
*/
QTime QTime::fromString(const QString &string, const QString &format)
@@ -3734,7 +3738,8 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
range 0 to 9999. This restriction may apply to locale-aware
formats as well, depending on the locale settings.
- \sa QDate::toString(), QTime::toString(), Qt::DateFormat
+ \sa fromString(), QDate::toString(), QTime::toString(),
+ QLocale::toString()
*/
QString QDateTime::toString(Qt::DateFormat format) const
@@ -3874,7 +3879,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
If the datetime is invalid, an empty string will be returned.
- \sa QDate::toString(), QTime::toString(), QLocale::toString()
+ \sa fromString(), QDate::toString(), QTime::toString(), QLocale::toString()
*/
QString QDateTime::toString(const QString& format) const
{
@@ -4617,6 +4622,8 @@ int QDateTime::utcOffset() const
Note for Qt::TextDate: It is recommended that you use the
English short month names (e.g. "Jan"). Although localized month
names can also be used, they depend on the user's locale settings.
+
+ \sa toString(), QLocale::toDateTime()
*/
QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
{
@@ -4918,8 +4925,8 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
\snippet code/src_corelib_tools_qdatetime.cpp 14
- \sa QDate::fromString(), QTime::fromString(), QDate::toString(),
- QDateTime::toString(), QTime::toString()
+ \sa toString(), QDate::fromString(), QTime::fromString(),
+ QLocale::toDateTime()
*/
QDateTime QDateTime::fromString(const QString &string, const QString &format)
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 53a28d9278..b50b2ee4e5 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -976,6 +976,7 @@ inline QString QString::section(QChar asep, int astart, int aend, SectionFlags a
QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4127) // "conditional expression is constant"
+QT_WARNING_DISABLE_INTEL(111) // "statement is unreachable"
inline int QString::toWCharArray(wchar_t *array) const
{
@@ -1157,21 +1158,21 @@ inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); }
inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
inline bool operator==(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
-{ return (s1.size() == s2.size() && !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
+{ return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
inline bool operator!=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
-{ return (s1.size() != s2.size() || memcmp(s1.latin1(), s2.latin1(), s1.size())); }
+{ return !operator==(s1, s2); }
inline bool operator<(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
-{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
- return (r < 0) || (r == 0 && s1.size() < s2.size()); }
-inline bool operator<=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
-{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
- return (r < 0) || (r == 0 && s1.size() <= s2.size()); }
+{
+ const int len = qMin(s1.size(), s2.size());
+ const int r = len ? memcmp(s1.latin1(), s2.latin1(), len) : 0;
+ return r < 0 || (r == 0 && s1.size() < s2.size());
+}
inline bool operator>(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
-{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
- return (r > 0) || (r == 0 && s1.size() > s2.size()); }
+{ return operator<(s2, s1); }
+inline bool operator<=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
+{ return !operator>(s1, s2); }
inline bool operator>=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
-{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
- return (r > 0) || (r == 0 && s1.size() >= s2.size()); }
+{ return !operator<(s1, s2); }
inline bool QLatin1String::operator==(const QString &s) const Q_DECL_NOTHROW
{ return s == *this; }
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index cddb7dfb95..f95cc3a15d 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -71,24 +71,6 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager)
-// can be replaced with a lambda in Qt 5.7
-class QDBusConnectionDispatchEnabler : public QObject
-{
- Q_OBJECT
- QDBusConnectionPrivate *con;
-public:
- QDBusConnectionDispatchEnabler(QDBusConnectionPrivate *con) : con(con) {}
-
-public slots:
- void execute()
- {
- con->setDispatchEnabled(true);
- if (!con->ref.deref())
- con->deleteLater();
- deleteLater();
- }
-};
-
struct QDBusConnectionManager::ConnectionRequestData
{
enum RequestType {
@@ -1280,6 +1262,4 @@ QByteArray QDBusConnection::localMachineId()
QT_END_NAMESPACE
-#include "qdbusconnection.moc"
-
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 0b7c731810..a63e976f99 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -381,6 +381,25 @@ extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNod
const QDBusMessage &msg);
extern QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg);
+
+// can be replaced with a lambda in Qt 5.7
+class QDBusConnectionDispatchEnabler : public QObject
+{
+ Q_OBJECT
+ QDBusConnectionPrivate *con;
+public:
+ QDBusConnectionDispatchEnabler(QDBusConnectionPrivate *con) : con(con) {}
+
+public slots:
+ void execute()
+ {
+ con->setDispatchEnabled(true);
+ if (!con->ref.deref())
+ con->deleteLater();
+ deleteLater();
+ }
+};
+
#endif // QT_BOOTSTRAPPED
QT_END_NAMESPACE
diff --git a/src/dbus/qdbuserror.h b/src/dbus/qdbuserror.h
index 7c3abc9cc7..c264f62b7d 100644
--- a/src/dbus/qdbuserror.h
+++ b/src/dbus/qdbuserror.h
@@ -100,8 +100,8 @@ public:
QDBusError(const QDBusError &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDBusError(QDBusError &&other) Q_DECL_NOTHROW
- : code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm)), unused(other.unused)
- { other.unused = Q_NULLPTR; }
+ : code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm))
+ {}
QDBusError &operator=(QDBusError &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDBusError &operator=(const QDBusError &other);
@@ -114,7 +114,6 @@ public:
qSwap(code, other.code);
qSwap(msg, other.msg);
qSwap(nm, other.nm);
- qSwap(unused, other.unused);
}
ErrorType type() const;
@@ -128,6 +127,8 @@ private:
ErrorType code;
QString msg;
QString nm;
+ // ### This class has an implicit (therefore inline) destructor
+ // so the following field cannot be used:
void *unused;
};
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QDBusError)
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 21bc3c8ac2..c63fb05e74 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -315,9 +315,21 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
// setPeer does the error handling for us
QDBusErrorInternal error;
newConnection->setPeer(connection, error);
+ newConnection->setDispatchEnabled(false);
// this is a queued connection and will resume in the QDBusServer's thread
emit serverConnection->newServerConnection(newConnection);
+
+ // we've disabled dispatching of events, so now we post an event to the
+ // QDBusServer's thread in order to enable it after the
+ // QDBusServer::newConnection() signal has been received by the
+ // application's code
+ newConnection->ref.ref();
+ QReadLocker serverLock(&serverConnection->lock);
+ QDBusConnectionDispatchEnabler *o = new QDBusConnectionDispatchEnabler(newConnection);
+ QTimer::singleShot(0, o, SLOT(execute()));
+ if (serverConnection->serverObject)
+ o->moveToThread(serverConnection->serverObject->thread());
}
void QDBusConnectionPrivate::_q_newConnection(QDBusConnectionPrivate *newConnection)
@@ -1250,6 +1262,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
break;
}
+ checkThread();
QDBusReadLocker locker(RelaySignalAction, this);
QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface,
QLatin1String(memberName));
@@ -2358,12 +2371,9 @@ void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node)
connector->connectAllSignals(node->obj);
}
- // disconnect and reconnect to avoid duplicates
- connector->disconnect(SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
- this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)));
connect(connector, SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
- Qt::DirectConnection);
+ Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));
}
}
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index a242ad984c..a59496bce8 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -103,12 +103,14 @@ QDBusServer::QDBusServer(QObject *parent)
*/
QDBusServer::~QDBusServer()
{
+ QWriteLocker locker(&d->lock);
if (QDBusConnectionManager::instance()) {
QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
for (const QString &name : qAsConst(d->serverConnectionNames))
QDBusConnectionManager::instance()->removeConnection(name);
d->serverConnectionNames.clear();
}
+ d->serverObject = nullptr;
d->ref.store(0);
d->deleteLater();
}
diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
index 9a95ab7ba3..931a374ad9 100644
--- a/src/dbus/qdbusutil_p.h
+++ b/src/dbus/qdbusutil_p.h
@@ -63,7 +63,8 @@
QT_BEGIN_NAMESPACE
-namespace QDBusUtil
+#define Q_DBUS_NO_EXPORT // force findclasslist.pl looking into this namespace
+namespace Q_DBUS_NO_EXPORT QDBusUtil
{
Q_DBUS_EXPORT bool isValidInterfaceName(const QString &ifaceName);
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 2ed7eb2cfb..16add8f627 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2794,10 +2794,10 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva
void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
{
- if (!e->exposed)
+ if (!e->window)
return;
- QWindow *window = e->exposed.data();
+ QWindow *window = e->window.data();
if (!window)
return;
QWindowPrivate *p = qt_window_private(window);
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 4ae4b209ca..bde0d20ea8 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -260,8 +260,7 @@ static bool convert(const QVariant::Private *d, int t,
static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
return static_cast<QColor *>(result)->isValid();
} else if (d->type == QVariant::ByteArray) {
- static_cast<QColor *>(result)->setNamedColor(QString::fromLatin1(
- *v_cast<QByteArray>(d)));
+ static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d)));
return true;
} else if (d->type == QVariant::Brush) {
if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index 76663cdc01..1085b546a7 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -170,11 +170,11 @@ static inline qreal initialGlobalScaleFactor()
The QT_SCALE_FACTOR environment variable can be used to set
a global scale factor for all windows in the processs. This
is useful for testing and debugging (you can simulate any
- devicePixelRatio without needing access to sepcial hardware),
+ devicePixelRatio without needing access to special hardware),
and perhaps also for targeting a specific application to
a specific display type (embedded use cases).
- 2) A per-screen scale factors
+ 2) Per-screen scale factors
Some platform plugins support providing a per-screen scale
factor based on display density information. These platforms
include X11, Windows, and Android.
@@ -187,13 +187,13 @@ static inline qreal initialGlobalScaleFactor()
Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity()
and use the value provided as the scale factor for the screen in
question. Disabling is done on a 'veto' basis where either the
- environment or the application source can disable. The intended use
+ environment or the application can disable the scaling. The intended use
cases are 'My system is not providing correct display density
information' and 'My application needs to work in display pixels',
respectively.
The QT_SCREEN_SCALE_FACTORS environment variable can be used to set the screen
- scale factors manually.Set this to a semicolon-separated
+ scale factors manually. Set this to a semicolon-separated
list of scale factors (matching the order of QGuiApplications::screens()),
or to a list of name=value pairs (where name matches QScreen::name()).
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index c35478da38..4521c2f62c 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -187,9 +187,6 @@ void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
// sometimes relative to the parent, depending on the platform plugin.
// We require local coords here.
d->doFlush(QRect(QPoint(0, 0), size()));
- } else if (!d->dirtyRegion.isEmpty()) {
- // Updates while non-exposed were ignored. Schedule an update now.
- requestUpdate();
}
}
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 18e8bcf99c..23e783fcb4 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2175,11 +2175,14 @@ void QWindowPrivate::deliverUpdateRequest()
Schedules a QEvent::UpdateRequest event to be delivered to this window.
The event is delivered in sync with the display vsync on platforms
- where this is possible. When driving animations, this function should
- be called once after drawing has completed.
-
- Calling this function multiple times will result in a single event
- being delivered to the window.
+ where this is possible. Otherwise, the event is delivered after a
+ delay of 5 ms. The additional time is there to give the event loop
+ a bit of idle time to gather system events, and can be overridden
+ using the QT_QPA_UPDATE_IDLE_TIME environment variable.
+
+ When driving animations, this function should be called once after drawing
+ has completed. Calling this function multiple times will result in a single
+ event being delivered to the window.
Subclasses of QWindow should reimplement event(), intercept the event and
call the application's rendering code, then call the base class
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 7c6bbc26c8..bb778bc5fc 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -361,10 +361,10 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
}
-QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *exposed, const QRegion &region)
+QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
: WindowSystemEvent(Expose)
- , exposed(exposed)
- , isExposed(exposed && exposed->handle() ? exposed->handle()->isExposed() : false)
+ , window(window)
+ , isExposed(window && window->handle() ? window->handle()->isExposed() : false)
, region(region)
{
}
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index bdbf191cbd..f471e1f550 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -330,8 +330,8 @@ public:
class ExposeEvent : public WindowSystemEvent {
public:
- ExposeEvent(QWindow *exposed, const QRegion &region);
- QPointer<QWindow> exposed;
+ ExposeEvent(QWindow *window, const QRegion &region);
+ QPointer<QWindow> window;
bool isExposed;
QRegion region;
};
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index acea5682d1..ebb035a2c1 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -584,7 +584,7 @@ void QBrush::detach(Qt::BrushStyle newStyle)
return;
}
- QScopedPointer<QBrushData> x;
+ QScopedPointer<QBrushData, QBrushDataPointerDeleter> x;
switch(newStyle) {
case Qt::TexturePattern: {
QTexturedBrushData *tbd = new QTexturedBrushData;
@@ -600,28 +600,30 @@ void QBrush::detach(Qt::BrushStyle newStyle)
}
case Qt::LinearGradientPattern:
case Qt::RadialGradientPattern:
- case Qt::ConicalGradientPattern:
- x.reset(new QGradientBrushData);
+ case Qt::ConicalGradientPattern: {
+ QGradientBrushData *gbd = new QGradientBrushData;
switch (d->style) {
case Qt::LinearGradientPattern:
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
- static_cast<QGradientBrushData *>(x.data())->gradient =
+ gbd->gradient =
static_cast<QGradientBrushData *>(d.data())->gradient;
break;
default:
break;
}
+ x.reset(gbd);
break;
+ }
default:
x.reset(new QBrushData);
break;
}
- x->ref.store(1);
+ x->ref.store(1); // must be first lest the QBrushDataPointerDeleter turns into a no-op
x->style = newStyle;
x->color = d->color;
x->transform = d->transform;
- d.reset(x.take());
+ d.swap(x);
}
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 650ba0187e..05790c4504 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -79,12 +79,12 @@ static inline int hex2int(char s)
return h < 0 ? h : (h << 4) | h;
}
-bool qt_get_hex_rgb(const char *name, QRgb *rgb)
+static bool get_hex_rgb(const char *name, int len, QRgb *rgb)
{
if (name[0] != '#')
return false;
name++;
- int len = qstrlen(name);
+ --len;
int a, r, g, b;
a = 255;
if (len == 12) {
@@ -119,15 +119,19 @@ bool qt_get_hex_rgb(const char *name, QRgb *rgb)
return true;
}
-bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
+bool qt_get_hex_rgb(const char *name, QRgb *rgb)
+{
+ return get_hex_rgb(name, qstrlen(name), rgb);
+}
+
+static bool get_hex_rgb(const QChar *str, int len, QRgb *rgb)
{
if (len > 13)
return false;
char tmp[16];
for (int i = 0; i < len; ++i)
tmp[i] = str[i].toLatin1();
- tmp[len] = 0;
- return qt_get_hex_rgb(tmp, rgb);
+ return get_hex_rgb(tmp, len, rgb);
}
#ifndef QT_NO_COLORNAMES
@@ -309,7 +313,7 @@ inline bool operator<(const char *name, const RGBData &data)
inline bool operator<(const RGBData &data, const char *name)
{ return qstrcmp(data.name, name) < 0; }
-static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
+static bool get_named_rgb_no_space(const char *name_no_space, QRgb *rgb)
{
const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
@@ -319,9 +323,8 @@ static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
return false;
}
-bool qt_get_named_rgb(const char *name, QRgb* rgb)
+static bool get_named_rgb(const char *name, int len, QRgb* rgb)
{
- int len = int(strlen(name));
if (len > 255)
return false;
char name_no_space[256];
@@ -332,10 +335,10 @@ bool qt_get_named_rgb(const char *name, QRgb* rgb)
}
name_no_space[pos] = 0;
- return get_named_rgb(name_no_space, rgb);
+ return get_named_rgb_no_space(name_no_space, rgb);
}
-bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
+static bool get_named_rgb(const QChar *name, int len, QRgb *rgb)
{
if (len > 255)
return false;
@@ -346,32 +349,22 @@ bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
name_no_space[pos++] = name[i].toLower().toLatin1();
}
name_no_space[pos] = 0;
- return get_named_rgb(name_no_space, rgb);
+ return get_named_rgb_no_space(name_no_space, rgb);
}
-QStringList qt_get_colornames()
+#endif // QT_NO_COLORNAMES
+
+static QStringList get_colornames()
{
- int i = 0;
QStringList lst;
+#ifndef QT_NO_COLORNAMES
lst.reserve(rgbTblSize);
- for (i = 0; i < rgbTblSize; i++)
+ for (int i = 0; i < rgbTblSize; i++)
lst << QLatin1String(rgbTbl[i].name);
+#endif
return lst;
}
-#else
-
-bool qt_get_named_rgb(const char *, QRgb*)
-{
- return false;
-}
-
-QStringList qt_get_colornames()
-{
- return QStringList();
-}
-#endif // QT_NO_COLORNAMES
-
/*!
\class QColor
\brief The QColor class provides colors based on RGB, HSV or CMYK values.
@@ -801,12 +794,14 @@ QColor::QColor(Spec spec) Q_DECL_NOTHROW
/*!
\fn QColor::QColor(const char *name)
+ \overload
+ \sa setNamedColor(), name(), isValid()
+*/
- Constructs a named color in the same way as setNamedColor() using
- the given \a name.
-
- The color is left invalid if the \a name cannot be parsed.
-
+/*!
+ \fn QColor::QColor(QLatin1String name)
+ \overload
+ \since 5.8
\sa setNamedColor(), name(), isValid()
*/
@@ -887,6 +882,16 @@ void QColor::setNamedColor(const QString &name)
}
/*!
+ \overload
+ \since 5.8
+*/
+
+void QColor::setNamedColor(QLatin1String name)
+{
+ setColorFromString(name);
+}
+
+/*!
\since 4.7
Returns \c true if the \a name is a valid color name and can
@@ -902,16 +907,26 @@ bool QColor::isValidColor(const QString &name)
return !name.isEmpty() && QColor().setColorFromString(name);
}
-bool QColor::setColorFromString(const QString &name)
+/*!
+ \overload
+ \since 5.8
+*/
+bool QColor::isValidColor(QLatin1String name) Q_DECL_NOTHROW
{
- if (name.isEmpty()) {
+ return name.size() && QColor().setColorFromString(name);
+}
+
+template <typename String>
+bool QColor::setColorFromString(const String &name)
+{
+ if (!name.size()) {
invalidate();
return true;
}
- if (name.startsWith(QLatin1Char('#'))) {
+ if (name[0] == QLatin1Char('#')) {
QRgb rgba;
- if (qt_get_hex_rgb(name.constData(), name.length(), &rgba)) {
+ if (get_hex_rgb(name.data(), name.size(), &rgba)) {
setRgba(rgba);
return true;
} else {
@@ -922,7 +937,7 @@ bool QColor::setColorFromString(const QString &name)
#ifndef QT_NO_COLORNAMES
QRgb rgb;
- if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) {
+ if (get_named_rgb(name.data(), name.size(), &rgb)) {
setRgba(rgb);
return true;
} else
@@ -940,11 +955,7 @@ bool QColor::setColorFromString(const QString &name)
*/
QStringList QColor::colorNames()
{
-#ifndef QT_NO_COLORNAMES
- return qt_get_colornames();
-#else
- return QStringList();
-#endif
+ return get_colornames();
}
/*!
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 6cf3a8e262..db6eb92916 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -73,7 +73,8 @@ public:
QColor(QRgb rgb) Q_DECL_NOTHROW;
QColor(QRgba64 rgba64) Q_DECL_NOTHROW;
QColor(const QString& name);
- QColor(const char *name);
+ QColor(const char *aname) : QColor(QLatin1String(aname)) {}
+ QColor(QLatin1String name);
QColor(Spec spec) Q_DECL_NOTHROW;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
@@ -93,7 +94,9 @@ public:
// ### Qt 6: merge overloads
QString name() const;
QString name(NameFormat format) const;
+
void setNamedColor(const QString& name);
+ void setNamedColor(QLatin1String name);
static QStringList colorNames();
@@ -219,11 +222,13 @@ public:
operator QVariant() const;
static bool isValidColor(const QString &name);
+ static bool isValidColor(QLatin1String) Q_DECL_NOTHROW;
private:
void invalidate() Q_DECL_NOTHROW;
- bool setColorFromString(const QString &name);
+ template <typename String>
+ bool setColorFromString(const String &name);
Spec cspec;
union {
@@ -272,8 +277,8 @@ inline QColor::QColor() Q_DECL_NOTHROW
inline QColor::QColor(int r, int g, int b, int a)
{ setRgb(r, g, b, a); }
-inline QColor::QColor(const char *aname)
-{ setNamedColor(QLatin1String(aname)); }
+inline QColor::QColor(QLatin1String aname)
+{ setNamedColor(aname); }
inline QColor::QColor(const QString& aname)
{ setNamedColor(aname); }
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index b5e92e2ea2..b44f2b163a 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -53,15 +53,10 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qrgb.h"
-#include "QtCore/qstringlist.h"
QT_BEGIN_NAMESPACE
-bool qt_get_named_rgb(const char *, QRgb*);
-bool qt_get_named_rgb(const QChar *, int len, QRgb*);
bool qt_get_hex_rgb(const char *, QRgb *);
-bool qt_get_hex_rgb(const QChar *, int len, QRgb *);
-QStringList qt_get_colornames();
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index c1a49b7d9a..7685f7f4ca 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -836,7 +836,10 @@ static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const
}
template <QPixelLayout::BPP bpp> static
-uint QT_FASTCALL fetchPixel(const uchar *src, int index);
+uint QT_FASTCALL fetchPixel(const uchar *, int)
+{
+ Q_UNREACHABLE();
+}
template <>
inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
@@ -1554,92 +1557,11 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op
}
}
-// blendType is either BlendTransformed or BlendTransformedTiled
-template<TextureBlendType blendType>
-static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data,
- int y, int x, int length)
-{
- int image_width = data->texture.width;
- int image_height = data->texture.height;
-
- const qreal cx = x + qreal(0.5);
- const qreal cy = y + qreal(0.5);
-
- const uint *end = buffer + length;
- uint *b = buffer;
- if (data->fast_matrix) {
- // The increment pr x in the scanline
- int fdx = (int)(data->m11 * fixed_scale);
- int fdy = (int)(data->m12 * fixed_scale);
-
- int fx = int((data->m21 * cy
- + data->m11 * cx + data->dx) * fixed_scale);
- int fy = int((data->m22 * cy
- + data->m12 * cx + data->dy) * fixed_scale);
-
- while (b < end) {
- int px = fx >> 16;
- int py = fy >> 16;
-
- if (blendType == BlendTransformedTiled) {
- px %= image_width;
- py %= image_height;
- if (px < 0) px += image_width;
- if (py < 0) py += image_height;
- } else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
- }
- *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
-
- fx += fdx;
- fy += fdy;
- ++b;
- }
- } else {
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
- qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
- qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
-
- while (b < end) {
- const qreal iw = fw == 0 ? 1 : 1 / fw;
- const qreal tx = fx * iw;
- const qreal ty = fy * iw;
- int px = int(tx) - (tx < 0);
- int py = int(ty) - (ty < 0);
-
- if (blendType == BlendTransformedTiled) {
- px %= image_width;
- py %= image_height;
- if (px < 0) px += image_width;
- if (py < 0) py += image_height;
- } else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
- }
- *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
-
- fx += fdx;
- fy += fdy;
- fw += fdw;
- //force increment to avoid /0
- if (!fw) {
- fw += fdw;
- }
- ++b;
- }
- }
- return buffer;
-}
-
-template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
+template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
+ Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -1647,9 +1569,12 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
const qreal cy = y + qreal(0.5);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
+ if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
+ Q_ASSERT(layout->bpp == bpp);
+ // When templated 'fetch' should be inlined at compile time:
+ const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
- const uint *end = buffer + length;
+ uint *const end = buffer + length;
uint *b = buffer;
if (data->fast_matrix) {
// The increment pr x in the scanline
@@ -2585,12 +2510,17 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
// blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled
-template<TextureBlendType blendType>
+template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QVector<QRgb> *clut = data->texture.colorTable;
+ if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
+ Q_ASSERT(layout->bpp == bpp);
+ // When templated 'fetch' should be inlined at compile time:
+ const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : fetchPixels<bpp>;
+ const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2628,7 +2558,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
// The idea is first to do the interpolation between the row s1 and the row s2
// into an intermediate buffer, then we interpolate between two pixel of this buffer.
- FetchPixelsFunc fetch = qFetchPixels[layout->bpp];
// +1 for the last pixel to interpolate with, and +1 for rounding errors.
uint buf1[buffer_size + 2];
uint buf2[buffer_size + 2];
@@ -2717,7 +2646,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
}
} else {
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2728,19 +2656,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int x1 = (fx >> 16);
int x2;
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
-
- if (layout->bpp == QPixelLayout::BPP32) {
- buf1[i * 2 + 0] = ((const uint*)s1)[x1];
- buf1[i * 2 + 1] = ((const uint*)s1)[x2];
- buf2[i * 2 + 0] = ((const uint*)s2)[x1];
- buf2[i * 2 + 1] = ((const uint*)s2)[x2];
- } else {
- buf1[i * 2 + 0] = fetch(s1, x1);
- buf1[i * 2 + 1] = fetch(s1, x2);
- buf2[i * 2 + 0] = fetch(s2, x1);
- buf2[i * 2 + 1] = fetch(s2, x2);
- }
-
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
}
layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
@@ -2770,7 +2689,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
}
}
} else { //rotation
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2789,19 +2707,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
-
- if (layout->bpp == QPixelLayout::BPP32) {
- buf1[i * 2 + 0] = ((const uint*)s1)[x1];
- buf1[i * 2 + 1] = ((const uint*)s1)[x2];
- buf2[i * 2 + 0] = ((const uint*)s2)[x1];
- buf2[i * 2 + 1] = ((const uint*)s2)[x2];
- } else {
- buf1[i * 2 + 0] = fetch(s1, x1);
- buf1[i * 2 + 1] = fetch(s1, x2);
- buf2[i * 2 + 0] = fetch(s2, x1);
- buf2[i * 2 + 1] = fetch(s2, x2);
- }
-
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
fy += fdy;
}
@@ -2848,7 +2757,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2876,18 +2784,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
-
- if (layout->bpp == QPixelLayout::BPP32) {
- buf1[i * 2 + 0] = ((const uint*)s1)[x1];
- buf1[i * 2 + 1] = ((const uint*)s1)[x2];
- buf2[i * 2 + 0] = ((const uint*)s2)[x1];
- buf2[i * 2 + 1] = ((const uint*)s2)[x2];
- } else {
- buf1[i * 2 + 0] = fetch(s1, x1);
- buf1[i * 2 + 1] = fetch(s1, x2);
- buf2[i * 2 + 0] = fetch(s2, x1);
- buf2[i * 2 + 1] = fetch(s2, x2);
- }
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
fy += fdy;
@@ -3293,23 +3193,32 @@ static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
};
static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
- fetchUntransformed, // Untransformed
- fetchUntransformed, // Tiled
- fetchTransformed<BlendTransformed>, // Transformed
- fetchTransformed<BlendTransformedTiled>, // TransformedTiled
- fetchTransformedBilinear<BlendTransformedBilinear>, // Bilinear
- fetchTransformedBilinear<BlendTransformedBilinearTiled> // BilinearTiled
+ fetchUntransformed, // Untransformed
+ fetchUntransformed, // Tiled
+ fetchTransformed<BlendTransformed, QPixelLayout::BPPNone>, // Transformed
+ fetchTransformed<BlendTransformedTiled, QPixelLayout::BPPNone>, // TransformedTiled
+ fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPPNone>, // TransformedBilinear
+ fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPPNone> // TransformedBilinearTiled
};
static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
fetchUntransformedARGB32PM, // Untransformed
fetchUntransformedARGB32PM, // Tiled
- fetchTransformedARGB32PM<BlendTransformed>, // Transformed
- fetchTransformedARGB32PM<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
+ fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // Bilinear
fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled> // BilinearTiled
};
+static SourceFetchProc sourceFetchAny32[NBlendTypes] = {
+ fetchUntransformed, // Untransformed
+ fetchUntransformed, // Tiled
+ fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
+ fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
+ fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPP32>, // TransformedBilinear
+ fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPP32> // TransformedBilinearTiled
+};
+
static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
fetchUntransformed64, // Untransformed
fetchUntransformed64, // Tiled
@@ -3325,6 +3234,8 @@ static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage:
return sourceFetchARGB32PM[blendType];
if (blendType == BlendUntransformed || blendType == BlendTiled)
return sourceFetchUntransformed[format];
+ if (qPixelLayouts[format].bpp == QPixelLayout::BPP32)
+ return sourceFetchAny32[blendType];
return sourceFetchGeneric[blendType];
}
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 8e6ffa5e94..4d567b26c2 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -261,9 +261,13 @@ void QRawFont::loadFromData(const QByteArray &fontData,
\a glyphIndex in the underlying font, using the \a transform specified.
If the QRawFont is not valid, this function will return an invalid QImage.
- If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be
- in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of
- the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of
+ If the font is a color font, then the resulting image will contain the rendered
+ glyph at the current pixel size. In this case, the \a antialiasingType will be
+ ignored.
+
+ Otherwise, if \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image
+ will be in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities
+ of the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of
QImage::Format_Indexed8 and each pixel will contain the opacity of the pixel in the
rasterization.
@@ -275,6 +279,9 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias
if (!d->isValid())
return QImage();
+ if (d->fontEngine->glyphFormat == QFontEngine::Format_ARGB)
+ return d->fontEngine->bitmapForGlyph(glyphIndex, QFixed(), transform);
+
if (antialiasingType == SubPixelAntialiasing)
return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 8a13455ee0..5dbeccff7f 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -928,7 +928,7 @@ void QTextEngine::shapeLine(const QScriptLine &line)
if (item == -1)
return;
- const int end = findItem(line.from + line.length - 1, item);
+ const int end = findItem(line.from + line.length + line.trailingSpaces - 1, item);
for ( ; item <= end; ++item) {
QScriptItem &si = layoutData->items[item];
if (si.analysis.flags == QScriptAnalysis::Tab) {
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
index 993571eb13..15440a03cd 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
@@ -67,6 +67,8 @@ QDBusPlatformMenuItem::QDBusPlatformMenuItem(quintptr tag)
QDBusPlatformMenuItem::~QDBusPlatformMenuItem()
{
menuItemsByID.remove(m_dbusID);
+ if (m_subMenu)
+ static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(Q_NULLPTR);
}
void QDBusPlatformMenuItem::setTag(quintptr tag)
@@ -176,6 +178,8 @@ QDBusPlatformMenu::QDBusPlatformMenu(quintptr tag)
QDBusPlatformMenu::~QDBusPlatformMenu()
{
+ if (m_containingMenuItem)
+ m_containingMenuItem->setMenu(Q_NULLPTR);
}
void QDBusPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp
index 883d0e345c..0369eaf144 100644
--- a/src/platformsupport/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/dbustray/qdbustrayicon.cpp
@@ -125,6 +125,8 @@ void QDBusTrayIcon::cleanup()
dBusConnection()->unregisterTrayIcon(this);
delete m_dbusConnection;
m_dbusConnection = Q_NULLPTR;
+ delete m_notifier;
+ m_notifier = Q_NULLPTR;
m_registered = false;
}
@@ -162,9 +164,10 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
}
if (!necessary)
return Q_NULLPTR;
+ qreal dpr = qGuiApp->devicePixelRatio();
QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this);
ret->open();
- icon.pixmap(QSize(22, 22)).save(ret);
+ icon.pixmap(QSize(22 * dpr, 22 * dpr)).save(ret);
ret->close();
return ret;
}
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index c7f6dd2740..0eb6fc0847 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -59,8 +59,15 @@ Q_LOGGING_CATEGORY(qLcEvdevKeyMap, "qt.qpa.input.keymap")
// simple builtin US keymap
#include "qevdevkeyboard_defaultmap_p.h"
-QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile)
- : m_device(device), m_fd(fd), m_notify(Q_NULLPTR),
+void QFdContainer::reset() Q_DECL_NOTHROW
+{
+ if (m_fd >= 0)
+ qt_safe_close(m_fd);
+ m_fd = -1;
+}
+
+QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile)
+ : m_device(device), m_fd(fd.release()), m_notify(Q_NULLPTR),
m_modifiers(0), m_composing(0), m_dead_unicode(0xffff),
m_no_zap(disableZap), m_do_compose(enableCompose),
m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0)
@@ -75,16 +82,13 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool
unloadKeymap();
// socket notifier for events on the keyboard device
- m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ m_notify = new QSocketNotifier(m_fd.get(), QSocketNotifier::Read, this);
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readKeycode()));
}
QEvdevKeyboardHandler::~QEvdevKeyboardHandler()
{
unloadKeymap();
-
- if (m_fd >= 0)
- qt_safe_close(m_fd);
}
QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
@@ -118,13 +122,12 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
qCDebug(qLcEvdevKey) << "Opening keyboard at" << device;
- int fd;
- fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
- if (fd >= 0) {
- ::ioctl(fd, EVIOCGRAB, grab);
+ QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0));
+ if (fd.get() >= 0) {
+ ::ioctl(fd.get(), EVIOCGRAB, grab);
if (repeatDelay > 0 && repeatRate > 0) {
int kbdrep[2] = { repeatDelay, repeatRate };
- ::ioctl(fd, EVIOCSREP, kbdrep);
+ ::ioctl(fd.get(), EVIOCSREP, kbdrep);
}
return new QEvdevKeyboardHandler(device, fd, disableZap, enableCompose, keymapFile);
@@ -144,7 +147,7 @@ void QEvdevKeyboardHandler::switchLed(int led, bool state)
led_ie.code = led;
led_ie.value = state;
- qt_safe_write(m_fd, &led_ie, sizeof(led_ie));
+ qt_safe_write(m_fd.get(), &led_ie, sizeof(led_ie));
}
void QEvdevKeyboardHandler::readKeycode()
@@ -153,7 +156,7 @@ void QEvdevKeyboardHandler::readKeycode()
int n = 0;
forever {
- int result = qt_safe_read(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+ int result = qt_safe_read(m_fd.get(), reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
if (result == 0) {
qWarning("evdevkeyboard: Got EOF from the input device");
@@ -166,8 +169,7 @@ void QEvdevKeyboardHandler::readKeycode()
if (errno == ENODEV) {
delete m_notify;
m_notify = Q_NULLPTR;
- qt_safe_close(m_fd);
- m_fd = -1;
+ m_fd.reset();
}
return;
}
@@ -478,7 +480,7 @@ void QEvdevKeyboardHandler::unloadKeymap()
//Set locks according to keyboard leds
quint16 ledbits[1];
memset(ledbits, 0, sizeof(ledbits));
- if (::ioctl(m_fd, EVIOCGLED(sizeof(ledbits)), ledbits) < 0) {
+ if (::ioctl(m_fd.get(), EVIOCGLED(sizeof(ledbits)), ledbits) < 0) {
qWarning("evdevkeyboard: Failed to query led states");
switchLed(LED_NUML,false);
switchLed(LED_CAPSL, false);
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index b94323fcbb..1ec4915855 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -129,12 +129,25 @@ inline QDataStream &operator<<(QDataStream &ds, const QEvdevKeyboardMap::Composi
return ds << c.first << c.second << c.result;
}
+class QFdContainer
+{
+ int m_fd;
+ Q_DISABLE_COPY(QFdContainer);
+public:
+ explicit QFdContainer(int fd = -1) Q_DECL_NOTHROW : m_fd(fd) {}
+ ~QFdContainer() { reset(); }
+
+ int get() const Q_DECL_NOTHROW { return m_fd; }
+
+ int release() Q_DECL_NOTHROW { int result = m_fd; m_fd = -1; return result; }
+ void reset() Q_DECL_NOTHROW;
+};
class QEvdevKeyboardHandler : public QObject
{
Q_OBJECT
public:
- QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile);
+ QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile);
~QEvdevKeyboardHandler();
enum KeycodeAction {
@@ -187,7 +200,7 @@ private:
void switchLed(int, bool);
QString m_device;
- int m_fd;
+ QFdContainer m_fd;
QSocketNotifier *m_notify;
// keymap handling
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 32ec9d5452..d53a317fc5 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -131,7 +131,8 @@ public:
bool m_typeB;
QTransform m_rotate;
bool m_singleTouch;
- int m_screenIndex;
+ QString m_screenName;
+ QPointer<QScreen> m_screen;
};
QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args)
@@ -141,8 +142,7 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co
hw_range_x_min(0), hw_range_x_max(0),
hw_range_y_min(0), hw_range_y_max(0),
hw_pressure_min(0), hw_pressure_max(0),
- m_typeB(false), m_singleTouch(false),
- m_screenIndex(-1)
+ m_typeB(false), m_singleTouch(false)
{
m_forceToActiveWindow = args.contains(QLatin1String("force_window"));
}
@@ -301,10 +301,10 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
QTouchOutputMapping mapping;
if (mapping.load()) {
- d->m_screenIndex = mapping.screenIndexForDeviceNode(d->deviceNode);
- if (d->m_screenIndex >= 0)
- qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen index %d",
- qPrintable(d->deviceNode), d->m_screenIndex);
+ d->m_screenName = mapping.screenNameForDeviceNode(d->deviceNode);
+ if (!d->m_screenName.isEmpty())
+ qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen %s",
+ qPrintable(d->deviceNode), qPrintable(d->m_screenName));
}
registerTouchDevice();
@@ -673,10 +673,18 @@ void QEvdevTouchScreenData::reportPoints()
// geometry in the full virtual desktop space, there is nothing else
// left to do since qguiapp will handle the rest.
QScreen *screen = QGuiApplication::primaryScreen();
- if (m_screenIndex >= 0) {
- const QList<QScreen *> screens = QGuiApplication::screens();
- if (m_screenIndex < screens.count())
- screen = screens.at(m_screenIndex);
+ if (!m_screenName.isEmpty()) {
+ if (!m_screen) {
+ const QList<QScreen *> screens = QGuiApplication::screens();
+ for (QScreen *s : screens) {
+ if (s->name() == m_screenName) {
+ m_screen = s;
+ break;
+ }
+ }
+ }
+ if (m_screen)
+ screen = m_screen;
}
winRect = QHighDpi::toNativePixels(screen->geometry(), screen);
}
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping.cpp b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
index 55c1dc34f4..0a1afd4739 100644
--- a/src/platformsupport/input/shared/qtouchoutputmapping.cpp
+++ b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
@@ -71,21 +71,21 @@ bool QTouchOutputMapping::load()
const QVariantMap output = outputs.at(i).toObject().toVariantMap();
if (!output.contains(QStringLiteral("touchDevice")))
continue;
- if (!output.contains(QStringLiteral("virtualIndex"))) {
- qWarning("evdevtouch: Output %d specifies touchDevice but not virtualIndex, this is wrong", i);
+ if (!output.contains(QStringLiteral("name"))) {
+ qWarning("evdevtouch: Output %d specifies touchDevice but not name, this is wrong", i);
continue;
}
const QString &deviceNode = output.value(QStringLiteral("touchDevice")).toString();
- const int screenIndex = output.value(QStringLiteral("virtualIndex")).toInt();
- m_screenIndexTable.insert(deviceNode, screenIndex);
+ const QString &screenName = output.value(QStringLiteral("name")).toString();
+ m_screenTable.insert(deviceNode, screenName);
}
return true;
}
-int QTouchOutputMapping::screenIndexForDeviceNode(const QString &deviceNode)
+QString QTouchOutputMapping::screenNameForDeviceNode(const QString &deviceNode)
{
- return m_screenIndexTable.value(deviceNode, -1);
+ return m_screenTable.value(deviceNode);
}
QT_END_NAMESPACE
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping_p.h b/src/platformsupport/input/shared/qtouchoutputmapping_p.h
index 74999d93ce..94d4dbc3b1 100644
--- a/src/platformsupport/input/shared/qtouchoutputmapping_p.h
+++ b/src/platformsupport/input/shared/qtouchoutputmapping_p.h
@@ -60,10 +60,10 @@ class QTouchOutputMapping
{
public:
bool load();
- int screenIndexForDeviceNode(const QString &deviceNode);
+ QString screenNameForDeviceNode(const QString &deviceNode);
private:
- QHash<QString, int> m_screenIndexTable;
+ QHash<QString, QString> m_screenTable;
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index bc89f540fc..55eec57270 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -252,6 +252,8 @@ QStringList QConnmanManagerInterface::getServices()
bool QConnmanManagerInterface::requestScan(const QString &type)
{
bool scanned = false;
+ if (technologiesMap.isEmpty())
+ getTechnologies();
Q_FOREACH (QConnmanTechnologyInterface *tech, technologiesMap) {
if (tech->type() == type) {
tech->scan();
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index d507751d5e..f8fe671a2b 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -112,15 +112,15 @@ static QByteArray localHostName()
*/
static QComposeCacheFileHeader readFileMetadata(const QString &path)
{
- QComposeCacheFileHeader info;
- info.reserved = 0;
- info.fileSize = 0;
+ quint64 fileSize = 0;
+ qint64 lastModified = 0;
const QByteArray pathBytes = QFile::encodeName(path);
QT_STATBUF st;
- if (QT_STAT(pathBytes.data(), &st) != 0)
- return info;
- info.lastModified = st.st_mtime;
- info.fileSize = st.st_size;
+ if (QT_STAT(pathBytes.data(), &st) == 0) {
+ lastModified = st.st_mtime;
+ fileSize = st.st_size;
+ }
+ QComposeCacheFileHeader info = { 0, 0, fileSize, lastModified };
return info;
}
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
index d17abbb65a..857f437661 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
@@ -168,11 +168,19 @@ bool QComposeInputContext::checkComposeTable()
TableGenerator reader;
m_tableState = reader.tableState();
- if ((m_tableState & TableGenerator::NoErrors) == TableGenerator::NoErrors)
- m_composeTable = reader.composeTable();
-
m_compositionTableInitialized = true;
+ if ((m_tableState & TableGenerator::NoErrors) == TableGenerator::NoErrors) {
+ m_composeTable = reader.composeTable();
+ } else {
+#ifdef DEBUG_COMPOSING
+ qDebug( "### FAILED_PARSING ###" );
+#endif
+ // if we have errors, don' try to look things up anyways.
+ reset();
+ return false;
+ }
}
+ Q_ASSERT(!m_composeTable.isEmpty());
QVector<QComposeTableElement>::const_iterator it =
std::lower_bound(m_composeTable.constBegin(), m_composeTable.constEnd(), m_composeBuffer, Compare());
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 677a2e2626..c79198d7fe 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -672,11 +672,6 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state
QAndroidEventDispatcherStopper::instance()->goingToStop(true);
QCoreApplication::processEvents();
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state));
- {
- AndroidDeadlockProtector protector;
- if (protector.acquire())
- QWindowSystemInterface::flushWindowSystemEvents();
- }
if (state == Qt::ApplicationSuspended)
QAndroidEventDispatcherStopper::instance()->stopAll();
} else {
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index fa768e64d3..97a1f30a35 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -155,7 +155,7 @@ void QAndroidPlatformWindow::updateStatusBarVisibility()
if (!isNonRegularWindow) {
if (m_windowState & Qt::WindowFullScreen)
QtAndroid::hideStatusBar();
- else if (m_windowState & Qt::WindowMaximized)
+ else
QtAndroid::showStatusBar();
}
}
diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
index e935d89c9f..9c25076c9c 100644
--- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
+++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
@@ -63,7 +63,7 @@ QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList)
QBsdFbIntegration::~QBsdFbIntegration()
{
- destroyScreen(m_primaryScreen.data());
+ destroyScreen(m_primaryScreen.take());
}
void QBsdFbIntegration::initialize()
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 628357eb39..ccb11f80f1 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -330,6 +330,11 @@ void QCocoaGLContext::updateSurfaceFormat()
[pixelFormat release];
+ GLint swapInterval = -1;
+ [m_context getValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
+ if (swapInterval >= 0)
+ m_format.setSwapInterval(swapInterval);
+
// Restore the original context
CGLSetCurrentContext(oldContext);
}
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 02ae64a58e..963b29ebbb 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -101,6 +101,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)setMaskRegion:(const QRegion *)region;
- (void)invalidateWindowShadowIfNeeded;
- (void)drawRect:(NSRect)dirtyRect;
+- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)notifyWindowStateChanged:(Qt::WindowState)newState;
- (void)windowNotification : (NSNotification *) windowNotification;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 4aa5bbef03..6f4375b251 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -569,6 +569,18 @@ static bool _q_dontOverrideCtrlLMB = false;
if (m_platformWindow->m_drawContentBorderGradient)
NSDrawWindowBackground(dirtyRect);
+ if (m_backingStore)
+ [self drawBackingStoreUsingCoreGraphics:dirtyRect];
+
+ [self invalidateWindowShadowIfNeeded];
+}
+
+// Draws the backing store content to the QNSView using Core Graphics.
+// This function assumes that the QNSView is in a configuration that
+// supports Core Graphics, such as "classic" mode or layer mode with
+// the default layer.
+- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect
+{
if (!m_backingStore)
return;
@@ -623,8 +635,6 @@ static bool _q_dontOverrideCtrlLMB = false;
CGImageRelease(cleanImg);
CGImageRelease(subMask);
CGImageRelease(bsCGImage);
-
- [self invalidateWindowShadowIfNeeded];
}
- (BOOL) isFlipped
diff --git a/src/plugins/platforms/eglfs/api/api.pri b/src/plugins/platforms/eglfs/api/api.pri
index 957dee554c..0ea65bd1ff 100644
--- a/src/plugins/platforms/eglfs/api/api.pri
+++ b/src/plugins/platforms/eglfs/api/api.pri
@@ -3,13 +3,19 @@ SOURCES += $$PWD/qeglfswindow.cpp \
$$PWD/qeglfsscreen.cpp \
$$PWD/qeglfscursor.cpp \
$$PWD/qeglfshooks.cpp \
- $$PWD/qeglfsdeviceintegration.cpp
+ $$PWD/qeglfsdeviceintegration.cpp \
+ $$PWD/qeglfsintegration.cpp \
+ $$PWD/qeglfscontext.cpp \
+ $$PWD/qeglfsoffscreenwindow.cpp
HEADERS += $$PWD/qeglfswindow_p.h \
$$PWD/qeglfsscreen_p.h \
$$PWD/qeglfscursor_p.h \
$$PWD/qeglfshooks_p.h \
$$PWD/qeglfsdeviceintegration_p.h \
- $$PWD/qeglfsglobal.h
+ $$PWD/qeglfsintegration_p.h \
+ $$PWD/qeglfscontext_p.h \
+ $$PWD/qeglfsoffscreenwindow_p.h \
+ $$PWD/qeglfsglobal_p.h
INCLUDEPATH += $$PWD
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp
index 8d479873cf..1a33215295 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp
@@ -37,12 +37,12 @@
**
****************************************************************************/
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <QtGui/QSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
-#include "qeglfscontext.h"
+#include "qeglfscontext_p.h"
#include "qeglfswindow_p.h"
#include "qeglfshooks_p.h"
#include "qeglfscursor_p.h"
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
index 91c5a7910b..65af3a7cee 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
@@ -40,7 +40,18 @@
#ifndef QEGLFSCONTEXT_H
#define QEGLFSCONTEXT_H
-#include "qeglfsglobal.h"
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qeglfsglobal_p.h"
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtCore/QVariant>
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index 0040ecd59d..1b3446c4ac 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qeglfscursor_p.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include "qeglfsscreen_p.h"
#include <qpa/qwindowsysteminterface.h>
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
index 8ccbe4493c..bf6dbc8a21 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <qpa/qplatformcursor.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/QMatrix4x4>
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 6f65929913..9f05767366 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qeglfsdeviceintegration_p.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include "qeglfscursor_p.h"
#include "qeglfswindow_p.h"
#include "qeglfsscreen_p.h"
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
index 819e4818ab..4335554912 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h>
#include <QtCore/QString>
diff --git a/src/plugins/platforms/eglfs/api/qeglfsglobal.h b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h
index 655ab7eaef..bad5095d21 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsglobal.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h
@@ -40,6 +40,17 @@
#ifndef QEGLFSGLOBAL_H
#define QEGLFSGLOBAL_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qglobal.h>
#include <QtPlatformSupport/private/qt_egl_p.h>
diff --git a/src/plugins/platforms/eglfs/api/qeglfshooks_p.h b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
index e379f7a76d..4c3149c7c9 100644
--- a/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include "qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
index 418ff6119b..4974499e0a 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
@@ -51,11 +51,11 @@
#include <qpa/qplatforminputcontextfactory_p.h>
#include <private/qgenericunixthemes_p.h>
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include "qeglfswindow_p.h"
#include "qeglfshooks_p.h"
-#include "qeglfscontext.h"
-#include "qeglfsoffscreenwindow.h"
+#include "qeglfscontext_p.h"
+#include "qeglfsoffscreenwindow_p.h"
#include "qeglfscursor_p.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
index 9c5439a22f..1a3a44d441 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
@@ -40,7 +40,18 @@
#ifndef QEGLFSINTEGRATION_H
#define QEGLFSINTEGRATION_H
-#include "qeglfsglobal.h"
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qeglfsglobal_p.h"
#include <QtCore/QVariant>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp
index 0334ac9785..7de5379ae3 100644
--- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qeglfsoffscreenwindow.h"
+#include "qeglfsoffscreenwindow_p.h"
#include "qeglfshooks_p.h"
#include <QtGui/QOffscreenSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h
index 673fa0d729..ec483c64e2 100644
--- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h
@@ -40,7 +40,18 @@
#ifndef QEGLFSOFFSCREENWINDOW_H
#define QEGLFSOFFSCREENWINDOW_H
-#include "qeglfsglobal.h"
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qeglfsglobal_p.h"
#include <qpa/qplatformoffscreensurface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
index daba9fc591..131e619e06 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <QtCore/QPointer>
#include <qpa/qplatformscreen.h>
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index aea4ed4806..6e752b8f79 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
@@ -51,8 +51,8 @@
// We mean it.
//
-#include "qeglfsglobal.h"
-#include "qeglfsintegration.h"
+#include "qeglfsglobal_p.h"
+#include "qeglfsintegration_p.h"
#include "qeglfsscreen_p.h"
#include <qpa/qplatformwindow.h>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
index d65e136a96..7f1e7b9f59 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
@@ -2,7 +2,7 @@ TARGET = qeglfs-brcm-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
LIBS += -lbcm_host
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
index 70ff054172..10571dc978 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
@@ -6,7 +6,7 @@ load(qt_plugin)
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private
-INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
+INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
index 99f6cfb0ca..3a220ec942 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
@@ -42,7 +42,7 @@
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmscreen.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index dde386fc57..75ff3ac749 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -42,7 +42,7 @@
#include "qeglfskmsgbmscreen.h"
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmcursor.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
index 5f47b98369..582982df76 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
@@ -2,7 +2,7 @@ TARGET = qeglfs-kms-egldevice-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private
-INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
+INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
index 464c64539f..f88a7c847e 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
@@ -4,7 +4,7 @@ load(qt_module)
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
index 5944e8d51f..bf96a7d683 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -42,7 +42,7 @@
#include "qeglfskmsdevice.h"
#include "qeglfskmsscreen.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
@@ -159,7 +159,9 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode)
return true;
}
-QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex)
+QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources,
+ drmModeConnectorPtr connector,
+ VirtualDesktopInfo *vinfo)
{
const QByteArray connectorName = nameForConnector(connector);
@@ -192,8 +194,16 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc
qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData());
configuration = OutputConfigPreferred;
}
- if (virtualIndex)
- *virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
+ if (vinfo) {
+ *vinfo = VirtualDesktopInfo();
+ vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
+ if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
+ const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
+ const QByteArrayList vposComp = vpos.split(',');
+ if (vposComp.count() == 2)
+ vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
+ }
+ }
const uint32_t crtc_id = resources->crtcs[crtc];
@@ -357,22 +367,24 @@ QEglFSKmsDevice::~QEglFSKmsDevice()
struct OrderedScreen
{
- OrderedScreen() : screen(nullptr), index(-1) { }
- OrderedScreen(QEglFSKmsScreen *screen, int index) : screen(screen), index(index) { }
+ OrderedScreen() : screen(nullptr) { }
+ OrderedScreen(QEglFSKmsScreen *screen, const QEglFSKmsDevice::VirtualDesktopInfo &vinfo)
+ : screen(screen), vinfo(vinfo) { }
QEglFSKmsScreen *screen;
- int index;
+ QEglFSKmsDevice::VirtualDesktopInfo vinfo;
};
QDebug operator<<(QDebug dbg, const OrderedScreen &s)
{
QDebugStateSaver saver(dbg);
- dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.index << ")";
+ dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.vinfo.virtualIndex
+ << " / " << s.vinfo.virtualPos << ")";
return dbg;
}
static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b)
{
- return a.index < b.index;
+ return a.vinfo.virtualIndex < b.vinfo.virtualIndex;
}
void QEglFSKmsDevice::createScreens()
@@ -390,10 +402,10 @@ void QEglFSKmsDevice::createScreens()
if (!connector)
continue;
- int virtualIndex;
- QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &virtualIndex);
+ VirtualDesktopInfo vinfo;
+ QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &vinfo);
if (screen)
- screens.append(OrderedScreen(screen, virtualIndex));
+ screens.append(OrderedScreen(screen, vinfo));
drmModeFreeConnector(connector);
}
@@ -411,11 +423,15 @@ void QEglFSKmsDevice::createScreens()
for (const OrderedScreen &orderedScreen : screens) {
QEglFSKmsScreen *s = orderedScreen.screen;
// set up a horizontal or vertical virtual desktop
- s->setVirtualPosition(pos);
- if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical)
- pos.ry() += s->geometry().height();
- else
- pos.rx() += s->geometry().width();
+ if (orderedScreen.vinfo.virtualPos.isNull()) {
+ s->setVirtualPosition(pos);
+ if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical)
+ pos.ry() += s->geometry().height();
+ else
+ pos.rx() += s->geometry().width();
+ } else {
+ s->setVirtualPosition(orderedScreen.vinfo.virtualPos);
+ }
qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry();
// The order in qguiapp's screens list will match the order set by
// virtualIndex. This is not only handy but also required since for instance
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
index 4aad2e0143..3e7ac7e3f0 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
@@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE
class Q_EGLFS_EXPORT QEglFSKmsDevice
{
public:
+ struct VirtualDesktopInfo {
+ VirtualDesktopInfo() : virtualIndex(0) { }
+ int virtualIndex;
+ QPoint virtualPos;
+ };
+
QEglFSKmsDevice(QEglFSKmsIntegration *integration, const QString &path);
virtual ~QEglFSKmsDevice();
@@ -79,7 +85,9 @@ protected:
quint32 m_connector_allocator;
int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector);
- QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex);
+ QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources,
+ drmModeConnectorPtr connector,
+ VirtualDesktopInfo *vinfo);
drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name);
static void pageFlipHandler(int fd,
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
index f690cd668e..e4b6c67f28 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -41,7 +41,7 @@
#include "qeglfskmsscreen.h"
#include "qeglfskmsdevice.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
index 6e32ca26d0..e72f5bdd14 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
@@ -5,7 +5,7 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
index 16880535e3..364812ec60 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
@@ -2,7 +2,7 @@ TARGET = qeglfs-viv-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
index 374c5bba6b..ccdf20b417 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
@@ -2,7 +2,7 @@ TARGET = qeglfs-viv-wl-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
index 10af57e487..51a026e2cf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
@@ -5,7 +5,7 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
QMAKE_USE += xcb_xlib
diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro
index 90b8a9fb32..d8adc13226 100644
--- a/src/plugins/platforms/eglfs/eglfs-plugin.pro
+++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro
@@ -6,6 +6,8 @@ SOURCES += $$PWD/qeglfsmain.cpp
OTHER_FILES += $$PWD/eglfs.json
+INCLUDEPATH += $$PWD/api
+
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
index eb0ce73118..15a825a7b0 100644
--- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
+++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
@@ -1,7 +1,8 @@
# The device integration plugin base class has to live in a shared library,
# placing it into a static lib like platformsupport is not sufficient since we
# have to keep the QObject magic like qobject_cast working.
-# Hence this header-less, private-only module.
+# Hence this private-only module.
+# By having _p headers, it also enables developing out-of-tree integration plugins.
TARGET = QtEglFSDeviceIntegration
CONFIG += internal_module
@@ -15,20 +16,10 @@ DEFINES += QT_EGL_NO_X11
DEFINES += QT_BUILD_EGL_DEVICE_LIB
-SOURCES += $$PWD/qeglfsintegration.cpp \
- $$PWD/qeglfscontext.cpp \
- $$PWD/qeglfsoffscreenwindow.cpp \
-
-HEADERS += $$PWD/qeglfsintegration.h \
- $$PWD/qeglfscontext.h \
- $$PWD/qeglfsoffscreenwindow.h \
-
include($$PWD/api/api.pri)
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
-INCLUDEPATH += $$PWD
-
!isEmpty(EGLFS_PLATFORM_HOOKS_SOURCES) {
HEADERS += $$EGLFS_PLATFORM_HOOKS_HEADERS
SOURCES += $$EGLFS_PLATFORM_HOOKS_SOURCES
diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp
index 50279ad110..2885d397c6 100644
--- a/src/plugins/platforms/eglfs/qeglfsmain.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include <qpa/qplatformintegrationplugin.h>
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 6165e480dc..02deab59b5 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -321,7 +321,7 @@ QIOSMenu::QIOSMenu()
: QPlatformMenu()
, m_tag(0)
, m_enabled(true)
- , m_visible(true)
+ , m_visible(false)
, m_text(QString())
, m_menuType(DefaultMenu)
, m_effectiveMenuType(DefaultMenu)
@@ -414,7 +414,7 @@ void QIOSMenu::handleItemSelected(QIOSMenuItem *menuItem)
void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item)
{
- if (m_currentMenu == this || !m_visible || !m_enabled || !parentWindow)
+ if (m_currentMenu == this || !parentWindow)
return;
emit aboutToShow();
@@ -441,6 +441,8 @@ void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, c
toggleShowUsingUIPickerView(true);
break;
}
+
+ m_visible = true;
}
void QIOSMenu::dismiss()
@@ -462,6 +464,7 @@ void QIOSMenu::dismiss()
}
m_currentMenu = 0;
+ m_visible = false;
}
void QIOSMenu::toggleShowUsingUIMenuController(bool show)
diff --git a/src/plugins/platforms/ios/qiosmessagedialog.mm b/src/plugins/platforms/ios/qiosmessagedialog.mm
index 1d078be0b9..4f0c667861 100644
--- a/src/plugins/platforms/ios/qiosmessagedialog.mm
+++ b/src/plugins/platforms/ios/qiosmessagedialog.mm
@@ -109,7 +109,7 @@ bool QIOSMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality win
Q_UNUSED(windowFlags);
if (m_alertController // Ensure that the dialog is not showing already
|| !options() // Some message dialogs don't have options (QErrorMessage)
- || windowModality != Qt::ApplicationModal // We can only do app modal dialogs
+ || windowModality == Qt::NonModal // We can only do modal dialogs
|| QOperatingSystemVersion::current() < QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) // API limitation
return false;
diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm
index 5e21011da7..462da0a978 100644
--- a/src/plugins/platforms/ios/qiostextinputoverlay.mm
+++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm
@@ -299,7 +299,11 @@ static void executeBlockWithoutAnimation(Block block)
// -------------------------------------------------------------------------
+#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0)
+@interface QIOSHandleLayer : CALayer <CAAnimationDelegate> {
+#else
@interface QIOSHandleLayer : CALayer {
+#endif
CALayer *_handleCursorLayer;
CALayer *_handleKnobLayer;
Qt::Edge _selectionEdge;
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index 72eb5e27a0..0478c5b8c8 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -229,6 +229,10 @@
@implementation QIOSViewController
+@synthesize prefersStatusBarHidden;
+@synthesize preferredStatusBarUpdateAnimation;
+@synthesize preferredStatusBarStyle;
+
- (id)initWithQIOSScreen:(QT_PREPEND_NAMESPACE(QIOSScreen) *)screen
{
if (self = [self init]) {
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index ae14d87a30..8ff0dfbd5f 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -93,7 +93,7 @@ QIOSWindow::~QIOSWindow()
// practice this doesn't seem to happen when removing the view from its superview. To ensure that
// Qt's internal state for touch and mouse handling is kept consistent, we therefor have to force
// cancellation of all touch events.
- [m_view touchesCancelled:0 withEvent:0];
+ [m_view touchesCancelled:[NSSet set] withEvent:0];
clearAccessibleCache();
m_view->m_qioswindow = 0;
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index 133269a0de..25bfa2ad90 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -430,7 +430,8 @@
// We do this by assuming that there are no cases where a
// sub-set of the active touch events are intentionally cancelled.
- if (touches && (static_cast<NSInteger>([touches count]) != m_activeTouches.count()))
+ NSInteger count = static_cast<NSInteger>([touches count]);
+ if (count != 0 && count != m_activeTouches.count())
qWarning("Subset of active touches cancelled by UIKit");
m_activeTouches.clear();
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index 9d38742d6f..7229d7d2a8 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -112,7 +112,7 @@ static inline QQnxIntegration::Options parseOptions(const QStringList &paramList
options |= QQnxIntegration::FullScreenApplication;
}
- if (!paramList.contains(QLatin1String("flush-screen-context"))) {
+ if (paramList.contains(QLatin1String("flush-screen-context"))) {
options |= QQnxIntegration::AlwaysFlushScreenContext;
}
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index 3fa511e6df..b7264d0973 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -49,6 +49,17 @@
#include <screen/screen.h>
+// For pre-7.0 SDPs, map some screen property names to the old
+// names.
+#include <sys/neutrino.h>
+#if _NTO_VERSION < 700
+const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS;
+const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS;
+const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS;
+const int SCREEN_PROPERTY_SCAN = SCREEN_PROPERTY_KEY_SCAN;
+const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM;
+#endif
+
QT_BEGIN_NAMESPACE
class QQnxWindow;
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 42651732c2..beda6e1a49 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -239,20 +239,20 @@ void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event)
{
// get flags of key event
int flags;
- Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags),
+ Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &flags),
"Failed to query event flags");
// get key code
int sym;
- Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym),
+ Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &sym),
"Failed to query event sym");
int modifiers;
- Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers),
+ Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_MODIFIERS, &modifiers),
"Failed to query event modifieres");
int scan;
- Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan),
+ Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_SCAN, &scan),
"Failed to query event scan");
int cap;
@@ -594,7 +594,7 @@ void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event)
qFatal("QQnx: failed to query window property, errno=%d", errno);
switch (property) {
- case SCREEN_PROPERTY_KEYBOARD_FOCUS:
+ case SCREEN_PROPERTY_FOCUS:
handleKeyboardFocusPropertyEvent(window);
break;
default:
@@ -607,7 +607,7 @@ void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t wi
{
errno = 0;
int focus = 0;
- if (Q_UNLIKELY(window && screen_get_window_property_iv(window, SCREEN_PROPERTY_KEYBOARD_FOCUS, &focus) != 0))
+ if (Q_UNLIKELY(window && screen_get_window_property_iv(window, SCREEN_PROPERTY_FOCUS, &focus) != 0))
qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno);
QWindow *focusWindow = QQnxIntegration::window(window);
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index f4e6ca9804..7b3a5ec70c 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -581,7 +581,7 @@ void QQnxWindow::setFocus(screen_window_t newFocusWindow)
screen_get_window_property_pv(nativeHandle(), SCREEN_PROPERTY_GROUP,
reinterpret_cast<void**>(&screenGroup));
if (screenGroup) {
- screen_set_group_property_pv(screenGroup, SCREEN_PROPERTY_KEYBOARD_FOCUS,
+ screen_set_group_property_pv(screenGroup, SCREEN_PROPERTY_FOCUS,
reinterpret_cast<void**>(&newFocusWindow));
}
}
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 9f2d0c8a33..d667036e8a 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -908,7 +908,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes)
} // namespace
-QString getEnglishName(const QString &familyName)
+QString getEnglishName(const QString &familyName, bool includeStyle = false)
{
QString i18n_name;
QString faceName = familyName;
@@ -946,7 +946,12 @@ QString getEnglishName(const QString &familyName)
if ( bytes == GDI_ERROR )
goto error;
- i18n_name = getCanonicalFontNames(table, bytes).name;
+ {
+ const FontNames names = getCanonicalFontNames(table, bytes);
+ i18n_name = names.name;
+ if (includeStyle)
+ i18n_name += QLatin1Char(' ') + names.style;
+ }
error:
delete [] table;
SelectObject( hdc, oldobj );
@@ -1252,6 +1257,7 @@ QT_WARNING_POP
request.pixelSize = pixelSize;
request.styleStrategy = QFont::PreferMatch;
request.hintingPreference = hintingPreference;
+ request.stretch = QFont::Unstretched;
fontEngine = QWindowsFontDatabase::createEngine(request,
QWindowsContext::instance()->defaultDPI(),
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index 4d8966f934..f7c8dbdf23 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -102,7 +102,7 @@ static FontFile * createFontFile(const QString &fileName, int index)
}
extern bool localizedName(const QString &name);
-extern QString getEnglishName(const QString &familyName);
+extern QString getEnglishName(const QString &familyName, bool includeStyle = false);
namespace {
struct FontKey
@@ -235,9 +235,19 @@ static bool addFontToDatabase(const QString &faceName,
}
int index = 0;
- const FontKey *key = findFontKey(faceName, &index);
+ const FontKey *key = findFontKey(fullName, &index);
if (!key) {
- key = findFontKey(fullName, &index);
+ // On non-English locales, the styles of the font may be localized in enumeration, but
+ // not in the registry.
+ QLocale systemLocale = QLocale::system();
+ if (systemLocale.language() != QLocale::C
+ && systemLocale.language() != QLocale::English
+ && styleName != QLatin1String("Italic")
+ && styleName != QLatin1String("Bold")) {
+ key = findFontKey(getEnglishName(fullName, true), &index);
+ }
+ if (!key)
+ key = findFontKey(faceName, &index);
if (!key && !registerAlias && englishName.isEmpty() && localizedName(faceName))
englishName = getEnglishName(faceName);
if (!key && !englishName.isEmpty())
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index 9236de58a1..e8e869c04f 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -828,7 +828,7 @@ void QWinRTScreen::addWindow(QWindow *window)
}
handleExpose();
- QWindowSystemInterface::flushWindowSystemEvents();
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
#if _MSC_VER >= 1900 && !defined(QT_NO_DRAGANDDROP)
QWinRTDrag::instance()->setDropTarget(window);
@@ -848,7 +848,7 @@ void QWinRTScreen::removeWindow(QWindow *window)
if (wasTopWindow && type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool)
QWindowSystemInterface::handleWindowActivated(Q_NULLPTR, Qt::OtherFocusReason);
handleExpose();
- QWindowSystemInterface::flushWindowSystemEvents();
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
#if _MSC_VER >= 1900 && !defined(QT_NO_DRAGANDDROP)
if (wasTopWindow)
QWinRTDrag::instance()->setDropTarget(topWindow());
@@ -1157,6 +1157,12 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
properties->get_IsLeftButtonPressed(&isPressed); // IsInContact not reliable on phone
#endif
+ // Devices like the Hololens set a static pressure of 0.5 independent
+ // of the pressed state. In those cases we need to synthesize the
+ // pressure value. To our knowledge this does not apply to pens
+ if (pointerDeviceType == PointerDeviceType_Touch && pressure == 0.5f)
+ pressure = isPressed ? 1. : 0.;
+
const QRectF areaRect(area.X * d->scaleFactor, area.Y * d->scaleFactor,
area.Width * d->scaleFactor, area.Height * d->scaleFactor);
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index fbf3acc54b..4915bb1b11 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -992,6 +992,9 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
} else {
dropData = platformDropData();
supported_drop_actions = accepted_drop_action;
+
+ // Drop coming from another app? Update keyboard modifiers.
+ QGuiApplicationPrivate::modifier_buttons = QGuiApplication::queryKeyboardModifiers();
}
if (!dropData)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 07932ceeb8..a5aff7f11f 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -748,8 +748,7 @@ void QXcbKeyboard::updateKeymap()
// update xkb state object
xkb_state_unref(xkb_state);
xkb_state = new_state;
- if (!connection()->hasXKB())
- updateXKBMods();
+ updateXKBMods();
checkForLatinLayout();
}
@@ -774,32 +773,37 @@ void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)
}
#endif
+void QXcbKeyboard::updateXKBStateFromState(struct xkb_state *kb_state, quint16 state)
+{
+ const quint32 modsDepressed = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_DEPRESSED);
+ const quint32 modsLatched = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LATCHED);
+ const quint32 modsLocked = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LOCKED);
+ const quint32 xkbMask = xkbModMask(state);
+
+ const quint32 latched = modsLatched & xkbMask;
+ const quint32 locked = modsLocked & xkbMask;
+ quint32 depressed = modsDepressed & xkbMask;
+ // set modifiers in depressed if they don't appear in any of the final masks
+ depressed |= ~(depressed | latched | locked) & xkbMask;
+
+ const xkb_state_component newState
+ = xkb_state_update_mask(kb_state,
+ depressed,
+ latched,
+ locked,
+ 0,
+ 0,
+ (state >> 13) & 3); // bits 13 and 14 report the state keyboard group
+
+ if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
+ //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");
+ }
+}
+
void QXcbKeyboard::updateXKBStateFromCore(quint16 state)
{
if (m_config && !connection()->hasXKB()) {
- const quint32 modsDepressed = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);
- const quint32 modsLatched = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
- const quint32 modsLocked = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
- const quint32 xkbMask = xkbModMask(state);
-
- const quint32 latched = modsLatched & xkbMask;
- const quint32 locked = modsLocked & xkbMask;
- quint32 depressed = modsDepressed & xkbMask;
- // set modifiers in depressed if they don't appear in any of the final masks
- depressed |= ~(depressed | latched | locked) & xkbMask;
-
- const xkb_state_component newState
- = xkb_state_update_mask(xkb_state,
- depressed,
- latched,
- locked,
- 0,
- 0,
- (state >> 13) & 3); // bits 13 and 14 report the state keyboard group
-
- if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
- //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");
- }
+ updateXKBStateFromState(xkb_state, state);
}
}
@@ -1393,10 +1397,11 @@ void QXcbKeyboard::resolveMaskConflicts()
class KeyChecker
{
public:
- KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time)
+ KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time, quint16 state)
: m_window(window)
, m_code(code)
, m_time(time)
+ , m_state(state)
, m_error(false)
, m_release(true)
{
@@ -1413,7 +1418,7 @@ public:
xcb_key_press_event_t *event = (xcb_key_press_event_t *)ev;
- if (event->event != m_window || event->detail != m_code) {
+ if (event->event != m_window || event->detail != m_code || event->state != m_state) {
m_error = true;
return false;
}
@@ -1441,6 +1446,7 @@ private:
xcb_window_t m_window;
xcb_keycode_t m_code;
xcb_timestamp_t m_time;
+ quint16 m_state;
bool m_error;
bool m_release;
@@ -1461,7 +1467,16 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
if (type == QEvent::KeyPress)
targetWindow->updateNetWmUserTime(time);
- xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code);
+ // Have a temporary keyboard state filled in from state
+ // this way we allow for synthetic events to have different state
+ // from the current state i.e. you can have Alt+Ctrl pressed
+ // and receive a synthetic key event that has neither Alt nor Ctrl pressed
+ struct xkb_state *kb_state = xkb_state_new(xkb_keymap);
+ if (!kb_state)
+ return;
+ updateXKBStateFromState(kb_state, state);
+
+ xcb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code);
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
QMetaMethod method;
@@ -1480,11 +1495,13 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
Q_ARG(uint, code),
Q_ARG(uint, state),
Q_ARG(bool, type == QEvent::KeyPress));
- if (retval)
+ if (retval) {
+ xkb_state_unref(kb_state);
return;
+ }
}
- QString string = lookupString(xkb_state, code);
+ QString string = lookupString(kb_state, code);
// Ιf control modifier is set we should prefer latin character, this is
// used for standard shortcuts in checks like "key == QKeySequence::Copy",
@@ -1505,7 +1522,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
}
} else {
// look ahead for auto-repeat
- KeyChecker checker(source->xcb_window(), code, time);
+ KeyChecker checker(source->xcb_window(), code, time, state);
xcb_generic_event_t *event = connection()->checkEvent(checker);
if (event) {
isAutoRepeat = true;
@@ -1555,6 +1572,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers,
code, sym, state, string, isAutoRepeat);
}
+ xkb_state_unref(kb_state);
}
QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 817b57ff5b..dfd2926435 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -104,6 +104,8 @@ protected:
void checkForLatinLayout();
private:
+ void updateXKBStateFromState(struct xkb_state *kb_state, quint16 state);
+
bool m_config;
xcb_keycode_t m_autorepeat_code;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 51390bfdae..c81858c408 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2541,8 +2541,13 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::WM_STATE)) {
const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
- if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
- newState = Qt::WindowMinimized;
+ if (reply->length != 0) {
+ if (data[0] == XCB_WM_STATE_ICONIC
+ || (data[0] == XCB_WM_STATE_WITHDRAWN
+ && m_lastWindowStateEvent == Qt::WindowMinimized)) {
+ newState = Qt::WindowMinimized;
+ }
+ }
}
free(reply);
} else { // _NET_WM_STATE can't change minimized state
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 30a0a04f44..eb2bddd0bd 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -640,8 +640,15 @@ QVariant QMYSQLResult::data(int field)
if (f.nullIndicator)
return QVariant(f.type);
- if (qIsInteger(f.type))
- return QVariant(f.type, f.outField);
+ if (qIsInteger(f.type)) {
+ QVariant variant(f.type, f.outField);
+ // we never want to return char variants here, see QTBUG-53397
+ if (static_cast<int>(f.type) == QMetaType::UChar)
+ return variant.toUInt();
+ else if (static_cast<int>(f.type) == QMetaType::Char)
+ return variant.toInt();
+ return variant;
+ }
if (f.type != QVariant::ByteArray)
val = toUnicode(d->drv_d_func()->tc, f.outField, f.bufLength);
@@ -1371,7 +1378,7 @@ bool QMYSQLDriver::open(const QString& db,
: sslCipher.toLocal8Bit().constData());
}
-#if MYSQL_VERSION_ID >= 50000
+#if MYSQL_VERSION_ID >= 50100
if (connectTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_CONNECT_TIMEOUT, &connectTimeout);
if (readTimeout != 0)
@@ -1400,7 +1407,7 @@ bool QMYSQLDriver::open(const QString& db,
setOpenError(true);
return false;
}
-#if MYSQL_VERSION_ID >= 50000
+#if MYSQL_VERSION_ID >= 50100
if (reconnect)
mysql_options(d->mysql, MYSQL_OPT_RECONNECT, &reconnect);
#endif
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro
index bcdf7d36f3..1066bf7f51 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -1,12 +1,14 @@
TARGET = qsqlite
+QT_FOR_CONFIG += sql-private
+
HEADERS += $$PWD/qsql_sqlite_p.h
SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp
-!system-sqlite {
- include($$PWD/../../../3rdparty/sqlite.pri)
-} else {
+qtConfig(system-sqlite) {
QMAKE_USE += sqlite
+} else {
+ include($$PWD/../../../3rdparty/sqlite.pri)
}
OTHER_FILES += sqlite.json
diff --git a/src/sql/configure.json b/src/sql/configure.json
index d1dc198656..5476d419ed 100644
--- a/src/sql/configure.json
+++ b/src/sql/configure.json
@@ -170,7 +170,7 @@
"label": " Using system provided SQLite",
"autoDetect": false,
"condition": "features.sql-sqlite && libs.sqlite3",
- "output": [ "publicQtConfig" ]
+ "output": [ "privateFeature" ]
},
"sql-tds": {
"label": "TDS (Sybase)",
diff --git a/src/testlib/3rdparty/CALLGRIND_LICENSE.txt b/src/testlib/3rdparty/CALLGRIND_LICENSE.txt
new file mode 100644
index 0000000000..0a6a793422
--- /dev/null
+++ b/src/testlib/3rdparty/CALLGRIND_LICENSE.txt
@@ -0,0 +1,35 @@
+ This file is part of callgrind, a valgrind tool for cache simulation
+ and call tree tracing.
+
+ Copyright (C) 2003-2007 Josef Weidendorfer. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. The origin of this software must not be misrepresented; you must
+ not claim that you wrote the original software. If you use this
+ software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 3. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+ 4. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/testlib/3rdparty/CYCLE_LICENSE.txt b/src/testlib/3rdparty/CYCLE_LICENSE.txt
new file mode 100644
index 0000000000..c9b44cb8aa
--- /dev/null
+++ b/src/testlib/3rdparty/CYCLE_LICENSE.txt
@@ -0,0 +1,18 @@
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/testlib/3rdparty/LINUX_LICENSE.txt b/src/testlib/3rdparty/LINUX_LICENSE.txt
new file mode 100644
index 0000000000..c0ff68a2b2
--- /dev/null
+++ b/src/testlib/3rdparty/LINUX_LICENSE.txt
@@ -0,0 +1,351 @@
+
+ NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Linus Torvalds
+
+----------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/testlib/3rdparty/qt_attribution.json b/src/testlib/3rdparty/qt_attribution.json
new file mode 100644
index 0000000000..23d230cb5c
--- /dev/null
+++ b/src/testlib/3rdparty/qt_attribution.json
@@ -0,0 +1,42 @@
+[
+ {
+ "Id": "callgrind",
+ "Name": "Callgrind",
+ "QDocModule": "qttestlib",
+ "QtUsage": "Used on Linux ond MacOS in the Qt Test module.",
+
+ "Description": "callgrind_p.h is part of Valgrind: an instrumentation framework for building dynamic analysis tools.",
+ "Homepage": "http://valgrind.org/",
+ "License": "BSD 4-clause \"Original\" or \"Old\" License",
+ "LicenseId": "BSD-4-Clause",
+ "LicenseFile": "CALLGRIND_LICENSE.txt",
+ "Copyright": "Copyright (C) 2003-2007 Josef Weidendorfer. All rights reserved."
+ },
+ {
+ "Id": "cycle",
+ "Name": "Cycle",
+ "QDocModule": "qttestlib",
+ "QtUsage": "Used in the Qt Test module.",
+
+ "Description": "cycle_p.h allows to access the CPU's cycle counters.",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "CYCLE_LICENSE.txt",
+ "Copyright": "Copyright (c) 2003, 2006 Matteo Frigo
+Copyright (c) 2003, 2006 Massachusetts Institute of Technology"
+ },
+ {
+ "Id": "linuxperf",
+ "Name": "Linux Performance Events",
+ "QDocModule": "qttestlib",
+ "QtUsage": "Used on Linux and Android in the Qt Test module.",
+
+ "Description": "linux_perf_event_p.h allows access to the LInux kernel's performance events.",
+ "License": "GNU General Public License v2.0 only",
+ "LicenseId": "GPL-2.0",
+ "LicenseFile": "LINUX_LICENSE.txt",
+ "Copyright": "Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
+Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
+Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra"
+ }
+]
diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc
index b16ab7944a..36ebfee463 100644
--- a/src/testlib/doc/src/qttest-index.qdoc
+++ b/src/testlib/doc/src/qttest-index.qdoc
@@ -50,6 +50,19 @@
\li \l{Qt Test Tutorial}
\endlist
+ \section1 Licenses and Attributions
+
+ Qt Test is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt Test potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qttestlib}
+
\section1 Reference
These are links to the API reference materials.
diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp
index 81975a0f2a..0ccf4c1588 100644
--- a/src/tools/qlalr/lalr.cpp
+++ b/src/tools/qlalr/lalr.cpp
@@ -187,7 +187,7 @@ Grammar::Grammar ():
tk_end = intern ("$end");
terminals.insert (tk_end);
- spells.insert (tk_end, "end of file");
+ spells.insert (tk_end, QLatin1String("end of file"));
/*tk_error= terminals.insert (intern ("error"))*/;
}
diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h
index 28c889e63f..b303b897d4 100644
--- a/src/tools/qlalr/lalr.h
+++ b/src/tools/qlalr/lalr.h
@@ -337,6 +337,7 @@ public:
Grammar ();
Name intern (const QString &id);
+ Name intern (const char *id) { return intern(QString::fromUtf8(id)); }
inline bool isTerminal (Name name) const
{ return terminals.find (name) != terminals.end (); }
diff --git a/src/tools/qlalr/main.cpp b/src/tools/qlalr/main.cpp
index e16d5f1e8d..c16bdcdf17 100644
--- a/src/tools/qlalr/main.cpp
+++ b/src/tools/qlalr/main.cpp
@@ -65,7 +65,7 @@ int main (int argc, char *argv[])
bool no_lines = false;
bool debug_info = true;
bool qt_copyright = false;
- QString file_name = 0;
+ QString file_name;
const QStringList args = app.arguments().mid(1);
for (const QString &arg : args) {
diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp
index ca2551707e..69dad1a6c1 100644
--- a/src/tools/qlalr/recognizer.cpp
+++ b/src/tools/qlalr/recognizer.cpp
@@ -178,7 +178,8 @@ int Recognizer::nextToken()
text.clear ();
if (! _M_no_lines)
- text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n";
+ text += QLatin1String("\n#line ") + QString::number (_M_action_line)
+ + QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':'
forever
@@ -215,7 +216,8 @@ int Recognizer::nextToken()
text.clear ();
if (! _M_no_lines)
- text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n";
+ text += QLatin1String ("\n#line ") + QString::number (_M_action_line) +
+ QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':'
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index bfadd69db5..28f4cd34ce 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -283,6 +283,8 @@ QWidgetPrivate::QWidgetPrivate(int version)
, renderToTextureReallyDirty(1)
, renderToTextureComposeActive(0)
#endif
+ , childrenHiddenByWState(0)
+ , childrenShownByExpose(0)
#if defined(Q_OS_WIN)
, noPaintOnScreen(0)
#endif
@@ -9026,13 +9028,23 @@ bool QWidget::event(QEvent *event)
case QEvent::WindowStateChange: {
const bool wasMinimized = static_cast<const QWindowStateChangeEvent *>(event)->oldState() & Qt::WindowMinimized;
if (wasMinimized != isMinimized()) {
+ QWidget *widget = const_cast<QWidget *>(this);
if (wasMinimized) {
- QShowEvent showEvent;
- QCoreApplication::sendEvent(const_cast<QWidget *>(this), &showEvent);
+ // Always send the spontaneous events here, otherwise it can break the application!
+ if (!d->childrenShownByExpose) {
+ // Show widgets only when they are not yet shown by the expose event
+ d->showChildren(true);
+ QShowEvent showEvent;
+ QCoreApplication::sendSpontaneousEvent(widget, &showEvent);
+ }
+ d->childrenHiddenByWState = false; // Set it always to "false" when window is restored
} else {
QHideEvent hideEvent;
- QCoreApplication::sendEvent(const_cast<QWidget *>(this), &hideEvent);
+ QCoreApplication::sendSpontaneousEvent(widget, &hideEvent);
+ d->hideChildren(true);
+ d->childrenHiddenByWState = true;
}
+ d->childrenShownByExpose = false; // Set it always to "false" when window state changes
}
changeEvent(event);
}
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 0a810df102..a2579df48f 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -753,6 +753,8 @@ public:
uint renderToTextureReallyDirty : 1;
uint renderToTextureComposeActive : 1;
#endif
+ uint childrenHiddenByWState : 1;
+ uint childrenShownByExpose : 1;
// *************************** Platform specific ************************************
#if defined(Q_OS_WIN)
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 2a4f31babf..f3fbe13763 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -387,7 +387,14 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
QWidget *child = m_widget->childAt(ee->pos());
QWidget *receiver = child ? child : m_widget.data();
- QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos());
+ QWidget *leave = Q_NULLPTR;
+ if (QApplicationPrivate::inPopupMode() && receiver == m_widget
+ && qt_last_mouse_receiver != m_widget) {
+ // This allows to deliver the leave event to the native widget
+ // action on first-level menu.
+ leave = qt_last_mouse_receiver;
+ }
+ QApplicationPrivate::dispatchEnterLeave(receiver, leave, ee->screenPos());
qt_last_mouse_receiver = receiver;
}
}
@@ -477,34 +484,31 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
receiver = popupChild;
if (receiver != activePopupWidget)
widgetPos = receiver->mapFromGlobal(event->globalPos());
- QWidget *alien = receiver;
#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups
const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);
const bool underMouse = activePopupWidget->underMouse();
- if (activePopupWidget != m_widget || (!underMouse && qt_button_down)) {
- // If active popup menu is not the first-level popup menu then we must emulate enter/leave events,
- // because first-level popup menu grabs the mouse and enter/leave events are delivered only to it
- // by QPA. Make an exception for first-level popup menu when the mouse button is pressed on widget.
- if (underMouse != reallyUnderMouse) {
- if (reallyUnderMouse) {
+ if (underMouse != reallyUnderMouse) {
+ if (reallyUnderMouse) {
+ const QPoint receiverMapped = receiver->mapFromGlobal(event->screenPos().toPoint());
+ // Prevent negative mouse position on enter event - this event
+ // should be properly handled in "handleEnterLeaveEvent()".
+ if (receiverMapped.x() >= 0 && receiverMapped.y() >= 0) {
QApplicationPrivate::dispatchEnterLeave(receiver, Q_NULLPTR, event->screenPos());
qt_last_mouse_receiver = receiver;
- } else {
- QApplicationPrivate::dispatchEnterLeave(Q_NULLPTR, qt_last_mouse_receiver, event->screenPos());
- qt_last_mouse_receiver = receiver;
- receiver = activePopupWidget;
}
+ } else {
+ QApplicationPrivate::dispatchEnterLeave(Q_NULLPTR, qt_last_mouse_receiver, event->screenPos());
+ qt_last_mouse_receiver = receiver;
+ receiver = activePopupWidget;
}
- } else if (!reallyUnderMouse) {
- alien = Q_NULLPTR;
}
#endif
QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(),
event->button(), event->buttons(), event->modifiers(), event->source());
e.setTimestamp(event->timestamp());
- QApplicationPrivate::sendMouseEvent(receiver, &e, alien, receiver->window(), &qt_button_down, qt_last_mouse_receiver);
+ QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver);
qt_last_mouse_receiver = receiver;
} else {
// close disabled popups when a mouse button is pressed or released
@@ -881,10 +885,40 @@ void QWidgetWindow::handleDropEvent(QDropEvent *event)
void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
- if (isExposed()) {
+ QWidgetPrivate *wPriv = m_widget->d_func();
+ const bool exposed = isExposed();
+
+ if (wPriv->childrenHiddenByWState) {
+ // If widgets has been previously hidden by window state change event
+ // and they aren't yet shown...
+ if (exposed) {
+ // If the window becomes exposed...
+ if (!wPriv->childrenShownByExpose) {
+ // ... and they haven't been shown by this function yet - show it.
+ wPriv->showChildren(true);
+ QShowEvent showEvent;
+ QCoreApplication::sendSpontaneousEvent(m_widget, &showEvent);
+ wPriv->childrenShownByExpose = true;
+ }
+ } else {
+ // If the window becomes not exposed...
+ if (wPriv->childrenShownByExpose) {
+ // ... and child widgets was previously shown by the expose event - hide widgets again.
+ // This is a workaround, because sometimes when window is minimized programatically,
+ // the QPA can notify that the window is exposed after changing window state to minimized
+ // and then, the QPA can send next expose event with null exposed region (not exposed).
+ wPriv->hideChildren(true);
+ QHideEvent hideEvent;
+ QCoreApplication::sendSpontaneousEvent(m_widget, &hideEvent);
+ wPriv->childrenShownByExpose = false;
+ }
+ }
+ }
+
+ if (exposed) {
m_widget->setAttribute(Qt::WA_Mapped);
if (!event->region().isNull())
- m_widget->d_func()->syncBackingStore(event->region());
+ wPriv->syncBackingStore(event->region());
} else {
m_widget->setAttribute(Qt::WA_Mapped, false);
}
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 896024f73a..9679411402 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -671,7 +671,7 @@ T qstyleoption_cast(const QStyleOption *opt)
|| (int(Opt::Type) == QStyleOption::SO_Complex
&& opt->type > QStyleOption::SO_Complex)))
return static_cast<T>(opt);
- return 0;
+ return Q_NULLPTR;
}
template <typename T>
@@ -683,7 +683,7 @@ T qstyleoption_cast(QStyleOption *opt)
|| (int(Opt::Type) == QStyleOption::SO_Complex
&& opt->type > QStyleOption::SO_Complex)))
return static_cast<T>(opt);
- return 0;
+ return Q_NULLPTR;
}
// -------------------------- QStyleHintReturn -------------------------------
@@ -732,7 +732,7 @@ T qstyleoption_cast(const QStyleHintReturn *hint)
if (hint && hint->version <= Opt::Version &&
(hint->type == Opt::Type || int(Opt::Type) == QStyleHintReturn::SH_Default))
return static_cast<T>(hint);
- return 0;
+ return Q_NULLPTR;
}
template <typename T>
@@ -742,7 +742,7 @@ T qstyleoption_cast(QStyleHintReturn *hint)
if (hint && hint->version <= Opt::Version &&
(hint->type == Opt::Type || int(Opt::Type) == QStyleHintReturn::SH_Default))
return static_cast<T>(hint);
- return 0;
+ return Q_NULLPTR;
}
#if !defined(QT_NO_DEBUG_STREAM)
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ed67446261..d957dda162 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -76,22 +76,6 @@
QT_BEGIN_NAMESPACE
QMenu *QMenuPrivate::mouseDown = 0;
-QPointer<QMenu> QMenuPrivate::previousMouseMenu(Q_NULLPTR);
-static void handleEnterLeaveEvents(QPointer<QMenu> *previous_ptr, QMenu *next)
-{
- QWidget *previous = previous_ptr->data();
- if (previous != next) {
- if (previous) {
- QEvent leaveEvent(QEvent::Leave);
- QApplication::sendEvent(previous, &leaveEvent);
- }
- if (next) {
- QEvent enterEvent(QEvent::Enter);
- QApplication::sendEvent(next, &enterEvent);
- }
- }
- *previous_ptr = next;
-}
/* QMenu code */
// internal class used for the torn off popup
@@ -510,8 +494,6 @@ void QMenuPrivate::hideMenu(QMenu *menu)
menu->d_func()->causedPopup.action = 0;
menu->close();
menu->d_func()->causedPopup.widget = 0;
- if (previousMouseMenu.data() == menu)
- handleEnterLeaveEvents(&previousMouseMenu, Q_NULLPTR);
}
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)
@@ -677,10 +659,26 @@ void QMenuSloppyState::enter()
m_parent->childEnter();
}
+void QMenuSloppyState::childEnter()
+{
+ stopTimer();
+ if (m_parent)
+ m_parent->childEnter();
+}
+
+void QMenuSloppyState::leave()
+{
+ if (!m_dont_start_time_on_leave) {
+ if (m_parent)
+ m_parent->childLeave();
+ startTimerIfNotRunning();
+ }
+}
+
void QMenuSloppyState::childLeave()
{
if (m_enabled && !QMenuPrivate::get(m_menu)->hasReceievedEnter) {
- startTimer();
+ startTimerIfNotRunning();
if (m_parent)
m_parent->childLeave();
}
@@ -726,8 +724,17 @@ public:
void QMenuSloppyState::timeout()
{
QMenuPrivate *menu_priv = QMenuPrivate::get(m_menu);
+
+ bool reallyHasMouse = menu_priv->hasReceievedEnter;
+ if (!reallyHasMouse) {
+ // Check whether the menu really has a mouse, because only active popup
+ // menu gets the enter/leave events. Currently Cocoa is an exception.
+ const QPoint lastCursorPos = QGuiApplicationPrivate::lastCursorPosition.toPoint();
+ reallyHasMouse = m_menu->frameGeometry().contains(lastCursorPos);
+ }
+
if (menu_priv->currentAction == m_reset_action
- && menu_priv->hasReceievedEnter
+ && reallyHasMouse
&& (menu_priv->currentAction
&& menu_priv->currentAction->menu() == menu_priv->activeMenu)) {
return;
@@ -735,13 +742,13 @@ void QMenuSloppyState::timeout()
ResetOnDestroy resetState(this, &m_init_guard);
- if (hasParentActiveDelayTimer() || !m_menu || !m_menu->isVisible())
+ if (hasParentActiveDelayTimer() || !m_menu->isVisible())
return;
if (m_sub_menu)
menu_priv->hideMenu(m_sub_menu);
- if (menu_priv->hasReceievedEnter)
+ if (reallyHasMouse)
menu_priv->setCurrentAction(m_reset_action,0);
else
menu_priv->setCurrentAction(Q_NULLPTR, 0);
@@ -1095,10 +1102,8 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
tearoffHighlighted = 0;
}
- if (q->frameGeometry().contains(e->globalPos())) { //otherwise if the event is in our rect we want it..
- handleEnterLeaveEvents(&previousMouseMenu, q);
- return false;
- }
+ if (q->frameGeometry().contains(e->globalPos()))
+ return false; //otherwise if the event is in our rect we want it..
for(QWidget *caused = causedPopup.widget; caused;) {
bool passOnEvent = false;
@@ -1114,17 +1119,16 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
next_widget = m->d_func()->causedPopup.widget;
}
if (passOnEvent) {
- handleEnterLeaveEvents(&previousMouseMenu,qobject_cast<QMenu *>(caused));
- if(e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
- QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),
- e->button(), e->buttons(), e->modifiers(), e->source());
- QApplication::sendEvent(caused, &new_e);
- return true;
+ if (e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
+ QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),
+ e->button(), e->buttons(), e->modifiers(), e->source());
+ QApplication::sendEvent(caused, &new_e);
+ return true;
}
}
caused = next_widget;
if (!caused)
- handleEnterLeaveEvents(&previousMouseMenu, Q_NULLPTR);
+ sloppyState.leave(); // Start timers
}
return false;
}
@@ -3218,7 +3222,6 @@ void QMenu::enterEvent(QEvent *)
Q_D(QMenu);
d->hasReceievedEnter = true;
d->sloppyState.enter();
- d->sloppyState.startTimer();
d->motions = -1; // force us to ignore the generate mouse move in mouseMoveEvent()
}
@@ -3229,7 +3232,6 @@ void QMenu::leaveEvent(QEvent *)
{
Q_D(QMenu);
d->hasReceievedEnter = false;
- d->sloppyState.leave();
if (!d->activeMenu && d->currentAction)
setActiveAction(0);
}
@@ -3393,10 +3395,18 @@ void QMenu::internalDelayedPopup()
const QRect actionRect(d->actionRect(d->currentAction));
const QPoint rightPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
- QPoint pos(rightPos);
-
- d->activeMenu->popup(pos);
+ d->activeMenu->popup(rightPos);
d->sloppyState.setSubMenuPopup(actionRect, d->currentAction, d->activeMenu);
+
+#if !defined(Q_OS_DARWIN)
+ // Send the leave event to the current menu - only active popup menu gets
+ // mouse enter/leave events. Currently Cocoa is an exception, so disable
+ // it there to avoid event duplication.
+ if (underMouse()) {
+ QEvent leaveEvent(QEvent::Leave);
+ QCoreApplication::sendEvent(this, &leaveEvent);
+ }
+#endif
}
/*!
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index dbc0958f03..2b0dc482da 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -120,8 +120,6 @@ public:
void reset();
bool enabled() const { return m_enabled; }
- void setResetAction(QAction *action) { m_reset_action = action; }
-
enum MouseEventResult {
EventIsProcessed,
EventShouldBePropagated,
@@ -146,22 +144,9 @@ public:
}
void enter();
+ void childEnter();
- void childEnter()
- {
- stopTimer();
- if (m_parent)
- m_parent->childEnter();
- }
-
- void leave()
- {
- if (m_dont_start_time_on_leave)
- return;
- if (m_parent)
- m_parent->childLeave();
- startTimer();
- }
+ void leave();
void childLeave();
static float slope(const QPointF &p1, const QPointF &p2)
@@ -187,8 +172,7 @@ public:
if (!m_enabled)
return EventShouldBePropagated;
- if (!m_time.isActive())
- startTimer();
+ startTimerIfNotRunning();
if (!m_sub_menu) {
reset();
@@ -460,7 +444,6 @@ public:
QPointer<QAction> actionAboutToTrigger;
QPointer<QWidget> noReplayFor;
- static QPointer<QMenu> previousMouseMenu;
};
#endif // QT_NO_MENU
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 99fddee53d..a77c0f9753 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -612,9 +612,10 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
for items in the menu bar are only shown when the \uicontrol{Alt} key is
pressed.
- \section1 QMenuBar on \macos
+ \section1 QMenuBar as a Global Menu Bar
- QMenuBar on \macos is a wrapper for using the system-wide menu bar.
+ On \macos and on certain Linux desktop environments such as
+ Ubuntu Unity, QMenuBar is a wrapper for using the system-wide menu bar.
If you have multiple menu bars in one dialog the outermost menu bar
(normally inside a widget with widget flag Qt::Window) will
be used for the system-wide menu bar.
@@ -657,11 +658,16 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
as its parent. That menu bar would only be displayed for the
parent QMainWindow.
- \b{Note:} The text used for the application name in the menu
+ \b{Note:} The text used for the application name in the \macos menu
bar is obtained from the value set in the \c{Info.plist} file in
the application's bundle. See \l{Qt for macOS - Deployment}
for more information.
+ \b{Note:} On Linux, if the com.canonical.AppMenu.Registrar
+ service is available on the D-Bus session bus, then Qt will
+ communicate with it to install the application's menus into the
+ global menu bar, as described.
+
\section1 Examples
The \l{mainwindows/menus}{Menus} example shows how to use QMenuBar
@@ -985,13 +991,11 @@ void QMenuBar::paintEvent(QPaintEvent *e)
*/
void QMenuBar::setVisible(bool visible)
{
-#if defined(Q_OS_DARWIN)
if (isNativeMenuBar()) {
if (!visible)
QWidget::setVisible(false);
return;
}
-#endif
QWidget::setVisible(visible);
}
@@ -1534,11 +1538,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const
QSize QMenuBar::minimumSizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_DARWIN)
const bool as_gui_menubar = !isNativeMenuBar();
-#else
- const bool as_gui_menubar = true;
-#endif
ensurePolished();
QSize ret(0, 0);
@@ -1590,12 +1590,7 @@ QSize QMenuBar::minimumSizeHint() const
QSize QMenuBar::sizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_DARWIN)
const bool as_gui_menubar = !isNativeMenuBar();
-#else
- const bool as_gui_menubar = true;
-#endif
-
ensurePolished();
QSize ret(0, 0);
@@ -1648,11 +1643,7 @@ QSize QMenuBar::sizeHint() const
int QMenuBar::heightForWidth(int) const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_DARWIN)
const bool as_gui_menubar = !isNativeMenuBar();
-#else
- const bool as_gui_menubar = true;
-#endif
const_cast<QMenuBarPrivate*>(d)->updateGeometries();
int height = 0;
@@ -1783,23 +1774,23 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
\brief Whether or not a menubar will be used as a native menubar on platforms that support it
\since 4.6
- This property specifies whether or not the menubar should be used as a native menubar on \macos.
+ This property specifies whether or not the menubar should be used as a native menubar on
+ platforms that support it. The currently supported platforms are \macos, and
+ Linux desktops which use the com.canonical.dbusmenu D-Bus interface (such as Ubuntu Unity).
If this property is \c true, the menubar is used in the native menubar and is not in the window of
- its parent, if \c false the menubar remains in the window. On other platforms the value of this
- attribute has no effect.
+ its parent; if \c false the menubar remains in the window. On other platforms,
+ setting this attribute has no effect, and reading this attribute will always return \c false.
The default is to follow whether the Qt::AA_DontUseNativeMenuBar attribute
- is set for the application. Explicitly settings this property overrides
- the presence (or abscence) of the attribute.
+ is set for the application. Explicitly setting this property overrides
+ the presence (or absence) of the attribute.
*/
void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
{
Q_D(QMenuBar);
- if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) {
- d->nativeMenuBar = nativeMenuBar;
-
- if (!d->nativeMenuBar) {
+ if (nativeMenuBar != bool(d->platformMenuBar)) {
+ if (!nativeMenuBar) {
delete d->platformMenuBar;
d->platformMenuBar = 0;
} else {
@@ -1808,7 +1799,7 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
}
updateGeometry();
- if (!d->nativeMenuBar && parentWidget())
+ if (!nativeMenuBar && parentWidget())
setVisible(true);
}
}
@@ -1816,10 +1807,7 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
bool QMenuBar::isNativeMenuBar() const
{
Q_D(const QMenuBar);
- if (d->nativeMenuBar == -1) {
- return !QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar);
- }
- return d->nativeMenuBar;
+ return bool(d->platformMenuBar);
}
/*!
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index 153df35297..f5409b9762 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -66,7 +66,7 @@ class QMenuBarPrivate : public QWidgetPrivate
public:
QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
- nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0)
+ doChildEffects(false), platformMenuBar(0)
{ }
~QMenuBarPrivate()
@@ -103,8 +103,6 @@ public:
uint keyboardState : 1, altPressed : 1;
QPointer<QWidget> keyboardFocusWidget;
-
- int nativeMenuBar : 3; // Only has values -1, 0, and 1
//firing of events
void activateAction(QAction *, QAction::ActionEvent);
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index d56c6b39d1..b6a3ef7eb8 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1958,9 +1958,8 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
}
}
- int offset = (event->pos() - d->dragStartPosition).manhattanLength();
if (event->buttons() == Qt::LeftButton
- && offset > QApplication::startDragDistance()
+ && d->dragInProgress
&& d->validIndex(d->pressedIndex)) {
bool vertical = verticalTabs(d->shape);
int dragDistance;
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 8b40325a24..80a061e6d5 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -196,7 +196,6 @@ QToolButton::QToolButton(QWidget * parent)
void QToolButtonPrivate::init()
{
Q_Q(QToolButton);
- delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, q);
defaultAction = 0;
#ifndef QT_NO_TOOLBAR
if (qobject_cast<QToolBar*>(parent))
@@ -222,7 +221,7 @@ void QToolButtonPrivate::init()
#endif
setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem);
-
+ delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, q);
}
/*!
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index 83a7dc800c..e49817ada4 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -198,6 +198,14 @@ public:
private:
HRESULT activatedLaunch(IInspectable *activateArgs) {
+ // Check if an application instance is already running
+ // This is mostly needed for Windows Phone and file pickers
+ QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher();
+ if (dispatcher) {
+ QCoreApplication::postEvent(dispatcher, new QActivationEvent(activateArgs));
+ return S_OK;
+ }
+
QCoreApplication *app = QCoreApplication::instance();
// Check whether the app already runs
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 4af664d2dd..ee60823003 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -116,7 +116,16 @@ class Q_XML_EXPORT QXmlAttributes
{
public:
QXmlAttributes();
- virtual ~QXmlAttributes();
+#ifdef Q_COMPILER_DEFAULT_MEMBERS
+ QXmlAttributes(const QXmlAttributes &) = default;
+ QXmlAttributes(QXmlAttributes &&) Q_DECL_NOTHROW = default;
+ QXmlAttributes &operator=(const QXmlAttributes &) = default;
+ QXmlAttributes &operator=(QXmlAttributes &&) Q_DECL_NOTHROW = default;
+#endif // default members
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ virtual // ### Qt 6: this value class don't need no virtual dtor
+#endif
+ ~QXmlAttributes();
int index(const QString& qName) const;
int index(QLatin1String qName) const;
diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
index 3c22770fba..06e2e1cc45 100644
--- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
+++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
@@ -30,6 +30,15 @@
#include <QString>
+// Preserve QLatin1String-ness (QVariant(QLatin1String) creates a QVariant::String):
+struct QLatin1StringContainer {
+ QLatin1String l1;
+};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(QLatin1StringContainer, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QLatin1StringContainer)
+
class tst_QLatin1String : public QObject
{
Q_OBJECT
@@ -39,6 +48,8 @@ private Q_SLOTS:
void midLeftRight();
void nullString();
void emptyString();
+ void relationalOperators_data();
+ void relationalOperators();
};
@@ -144,7 +155,53 @@ void tst_QLatin1String::emptyString()
}
}
+void tst_QLatin1String::relationalOperators_data()
+{
+ QTest::addColumn<QLatin1StringContainer>("lhs");
+ QTest::addColumn<int>("lhsOrderNumber");
+ QTest::addColumn<QLatin1StringContainer>("rhs");
+ QTest::addColumn<int>("rhsOrderNumber");
+ struct Data {
+ QLatin1String l1;
+ int order;
+ } data[] = {
+ { QLatin1String(), 0 },
+ { QLatin1String(""), 0 },
+ { QLatin1String("a"), 1 },
+ { QLatin1String("aa"), 2 },
+ { QLatin1String("b"), 3 },
+ };
+
+ for (Data *lhs = data; lhs != data + sizeof data / sizeof *data; ++lhs) {
+ for (Data *rhs = data; rhs != data + sizeof data / sizeof *data; ++rhs) {
+ QLatin1StringContainer l = { lhs->l1 }, r = { rhs->l1 };
+ QTest::newRow(qPrintable(QString::asprintf("\"%s\" <> \"%s\"",
+ lhs->l1.data() ? lhs->l1.data() : "nullptr",
+ rhs->l1.data() ? rhs->l1.data() : "nullptr")))
+ << l << lhs->order << r << rhs->order;
+ }
+ }
+}
+
+void tst_QLatin1String::relationalOperators()
+{
+ QFETCH(QLatin1StringContainer, lhs);
+ QFETCH(int, lhsOrderNumber);
+ QFETCH(QLatin1StringContainer, rhs);
+ QFETCH(int, rhsOrderNumber);
+
+#define CHECK(op) \
+ QCOMPARE(lhs.l1 op rhs.l1, lhsOrderNumber op rhsOrderNumber) \
+ /*end*/
+ CHECK(==);
+ CHECK(!=);
+ CHECK(< );
+ CHECK(> );
+ CHECK(<=);
+ CHECK(>=);
+#undef CHECK
+}
QTEST_APPLESS_MAIN(tst_QLatin1String)
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index bfa15744c2..b1ec94403a 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -73,8 +73,10 @@ void tst_QClipboard::cleanupTestCase()
void tst_QClipboard::init()
{
+#ifndef QT_NO_PROCESS
const QString testdataDir = QFileInfo(QFINDTESTDATA("copier")).absolutePath();
QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir));
+#endif
}
Q_DECLARE_METATYPE(QClipboard::Mode)
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 00e7436c0f..ab893385e3 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -52,6 +52,7 @@ private slots:
void name();
void namehex_data();
void namehex();
+ void setNamedColor_data();
void setNamedColor();
void constructNamedColorWithSpace();
@@ -525,26 +526,49 @@ static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
#undef rgb
-void tst_QColor::setNamedColor()
+void tst_QColor::setNamedColor_data()
{
- for (int i = 0; i < rgbTblSize; ++i) {
- QColor expected;
- expected.setRgba(rgbTbl[i].value);
-
- QColor color;
- color.setNamedColor(QLatin1String(rgbTbl[i].name));
- QCOMPARE(color, expected);
+ QTest::addColumn<QColor>("byCtor");
+ QTest::addColumn<QColor>("bySetNamedColor");
+ QTest::addColumn<QColor>("expected");
+ for (const auto e : rgbTbl) {
+ QColor expected;
+ expected.setRgba(e.value);
+
+#define ROW(expr) \
+ do { \
+ QColor bySetNamedColor; \
+ bySetNamedColor.setNamedColor(expr); \
+ auto byCtor = QColor(expr); \
+ QTest::newRow(e.name + QByteArrayLiteral(#expr)) \
+ << byCtor << bySetNamedColor << expected; \
+ } while (0) \
+ /*end*/
+
+ ROW(QLatin1String(e.name));
+ ROW(QString(QLatin1String(e.name)));
// name should be case insensitive
- color.setNamedColor(QString(rgbTbl[i].name).toUpper());
- QCOMPARE(color, expected);
-
+ ROW(QLatin1String(QByteArray(e.name).toUpper()));
+ ROW(QString(e.name).toUpper());
// spaces should be ignored
- color.setNamedColor(QString(rgbTbl[i].name).insert(1, ' '));
- QCOMPARE(color, expected);
+ ROW(QLatin1String(QByteArray(e.name).insert(1, ' ')));
+ ROW(QString(e.name).insert(1, ' '));
+#undef ROW
}
}
+void tst_QColor::setNamedColor()
+{
+ QFETCH(QColor, byCtor);
+ QFETCH(QColor, bySetNamedColor);
+ QFETCH(QColor, expected);
+
+ QCOMPARE(byCtor, expected);
+ QCOMPARE(bySetNamedColor, expected);
+}
+
+
void tst_QColor::constructNamedColorWithSpace()
{
QColor whiteSmoke("white smoke");
@@ -556,7 +580,7 @@ void tst_QColor::colorNames()
QStringList all = QColor::colorNames();
QCOMPARE(all.size(), rgbTblSize);
for (int i = 0; i < all.size(); ++i)
- QCOMPARE(all.at(i), QString::fromLatin1(rgbTbl[i].name));
+ QCOMPARE(all.at(i), QLatin1String(rgbTbl[i].name));
}
void tst_QColor::spec()
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 3b47f4b17b..de5b2a8676 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -459,6 +459,24 @@ void tst_QTextDocument::findMultiple()
cursor = doc->find(expr, cursor);
QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+
+ QRegularExpression regularExpression("bar");
+
+ cursor.movePosition(QTextCursor::End);
+ cursor = doc->find(regularExpression, cursor, QTextDocument::FindBackward);
+ QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+ cursor = doc->find(regularExpression, cursor, QTextDocument::FindBackward);
+ QCOMPARE(cursor.selectionStart(), text.indexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor = doc->find(regularExpression, cursor);
+ QCOMPARE(cursor.selectionStart(), text.indexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+ cursor = doc->find(regularExpression, cursor);
+ QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
}
void tst_QTextDocument::basicIsModifiedChecks()
diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
index f57ed12ed3..add23d46cf 100644
--- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
@@ -46,7 +46,7 @@ void tst_qdesktopservices::openUrl()
{
// At the bare minimum check that they return false for invalid url's
QCOMPARE(QDesktopServices::openUrl(QUrl()), false);
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// this test is only valid on windows on other systems it might mean open a new document in the application handling .file
const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\.");
QVERIFY(messagePattern.isValid());
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 078a629df5..84e9643e77 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -4002,12 +4002,14 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const
QVERIFY_SQL(q, exec("DROP TABLE IF EXISTS " + tableName));
QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ')'));
- const int steps = 20;
- const T increment = max / steps - min / steps;
+ const int steps = (max == min + 1) ? 2 : 20;
+ const T increment = (max == min + 1) ? 1 : (max / steps - min / steps);
// insert some values
QVector<T> values;
+ QVector<QVariant> variantValues;
values.resize(steps);
+ variantValues.resize(steps);
T v = min;
if (withPreparedStatement) {
QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)"));
@@ -4020,17 +4022,30 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const
QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + QLatin1Char(')')));
}
values[i] = v;
+ variantValues[i] = QVariant::fromValue(v);
v += increment;
}
// ensure we can read them back properly
- QVERIFY_SQL(q, exec("SELECT id FROM " + tableName));
+ if (withPreparedStatement) {
+ QVERIFY_SQL(q, prepare("SELECT id FROM " + tableName));
+ QVERIFY_SQL(q, exec());
+ } else {
+ QVERIFY_SQL(q, exec("SELECT id FROM " + tableName));
+ }
QVector<T> actualValues;
+ QVector<QVariant> actualVariantValues;
actualValues.reserve(values.size());
while (q.next()) {
- actualValues << q.value(0).value<T>();
+ QVariant value = q.value(0);
+ actualVariantValues << value;
+ actualValues << value.value<T>();
+ QVERIFY(actualVariantValues.last().userType() != qMetaTypeId<char>());
+ QVERIFY(actualVariantValues.last().userType() != qMetaTypeId<signed char>());
+ QVERIFY(actualVariantValues.last().userType() != qMetaTypeId<unsigned char>());
}
QCOMPARE(actualValues, values);
+ QCOMPARE(actualVariantValues, variantValues);
}
void tst_QSqlQuery::integralTypesMysql()
@@ -4041,16 +4056,18 @@ void tst_QSqlQuery::integralTypesMysql()
for (int i = 0; i < 2; ++i) {
const bool withPreparedStatement = (i == 1);
- runIntegralTypesMysqlTest<char>(db, "tinyIntTest", "TINYINT", withPreparedStatement);
- runIntegralTypesMysqlTest<unsigned char>(db, "unsignedTinyIntTest", "TINYINT UNSIGNED", withPreparedStatement);
- runIntegralTypesMysqlTest<char>(db, "smallIntTest", "SMALLINT", withPreparedStatement);
- runIntegralTypesMysqlTest<unsigned char>(db, "unsignedSmallIntTest", "SMALLINT UNSIGNED", withPreparedStatement);
- runIntegralTypesMysqlTest<int>(db, "mediumIntTest", "MEDIUMINT", withPreparedStatement, -(1 << 23), (1 << 23) - 1);
- runIntegralTypesMysqlTest<unsigned int>(db, "unsignedMediumIntTest", "MEDIUMINT UNSIGNED", withPreparedStatement, 0, (1 << 24) - 1);
- runIntegralTypesMysqlTest<int>(db, "intTest", "INT", withPreparedStatement);
- runIntegralTypesMysqlTest<unsigned int>(db, "unsignedIntTest", "INT UNSIGNED", withPreparedStatement);
- runIntegralTypesMysqlTest<long long>(db, "bigIntTest", "BIGINT", withPreparedStatement);
- runIntegralTypesMysqlTest<unsigned long long>(db, "unsignedBigIntTest", "BIGINT UNSIGNED", withPreparedStatement);
+ runIntegralTypesMysqlTest<bool>(db, "tinyInt1Test", "TINYINT(1)", withPreparedStatement);
+ runIntegralTypesMysqlTest<bool>(db, "unsignedTinyInt1Test", "TINYINT(1) UNSIGNED", withPreparedStatement);
+ runIntegralTypesMysqlTest<qint8>(db, "tinyIntTest", "TINYINT", withPreparedStatement);
+ runIntegralTypesMysqlTest<quint8>(db, "unsignedTinyIntTest", "TINYINT UNSIGNED", withPreparedStatement);
+ runIntegralTypesMysqlTest<qint16>(db, "smallIntTest", "SMALLINT", withPreparedStatement);
+ runIntegralTypesMysqlTest<quint16>(db, "unsignedSmallIntTest", "SMALLINT UNSIGNED", withPreparedStatement);
+ runIntegralTypesMysqlTest<qint32>(db, "mediumIntTest", "MEDIUMINT", withPreparedStatement, -(1 << 23), (1 << 23) - 1);
+ runIntegralTypesMysqlTest<quint32>(db, "unsignedMediumIntTest", "MEDIUMINT UNSIGNED", withPreparedStatement, 0, (1 << 24) - 1);
+ runIntegralTypesMysqlTest<qint32>(db, "intTest", "INT", withPreparedStatement);
+ runIntegralTypesMysqlTest<quint32>(db, "unsignedIntTest", "INT UNSIGNED", withPreparedStatement);
+ runIntegralTypesMysqlTest<qint64>(db, "bigIntTest", "BIGINT", withPreparedStatement);
+ runIntegralTypesMysqlTest<quint64>(db, "unsignedBigIntTest", "BIGINT UNSIGNED", withPreparedStatement);
}
}
diff --git a/tests/auto/testlib/selftests/test/BLACKLIST b/tests/auto/testlib/selftests/test/BLACKLIST
new file mode 100644
index 0000000000..2d4adf1feb
--- /dev/null
+++ b/tests/auto/testlib/selftests/test/BLACKLIST
@@ -0,0 +1,3 @@
+#QTBUG-55155
+[runSubTest:maxwarnings all loggers]
+osx-10.11
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index e19e9e5bf1..eaa4c8a636 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -246,6 +246,7 @@ private slots:
void showHideEvent_data();
void showHideEvent();
void showHideEventWhileMinimize();
+ void showHideChildrenWhileMinimize_QTBUG50589();
void lostUpdatesOnHide();
@@ -3940,19 +3941,30 @@ class ShowHideEventWidget : public QWidget
{
public:
int numberOfShowEvents, numberOfHideEvents;
+ int numberOfSpontaneousShowEvents, numberOfSpontaneousHideEvents;
ShowHideEventWidget(QWidget *parent = 0)
- : QWidget(parent), numberOfShowEvents(0), numberOfHideEvents(0)
+ : QWidget(parent)
+ , numberOfShowEvents(0), numberOfHideEvents(0)
+ , numberOfSpontaneousShowEvents(0), numberOfSpontaneousHideEvents(0)
{ }
void create()
{ QWidget::create(); }
- void showEvent(QShowEvent *)
- { ++numberOfShowEvents; }
+ void showEvent(QShowEvent *e)
+ {
+ ++numberOfShowEvents;
+ if (e->spontaneous())
+ ++numberOfSpontaneousShowEvents;
+ }
- void hideEvent(QHideEvent *)
- { ++numberOfHideEvents; }
+ void hideEvent(QHideEvent *e)
+ {
+ ++numberOfHideEvents;
+ if (e->spontaneous())
+ ++numberOfSpontaneousHideEvents;
+ }
};
void tst_QWidget::showHideEvent_data()
@@ -4044,6 +4056,32 @@ void tst_QWidget::showHideEventWhileMinimize()
QTRY_COMPARE(widget.numberOfShowEvents, showEventsBeforeMinimize + 1);
}
+void tst_QWidget::showHideChildrenWhileMinimize_QTBUG50589()
+{
+ const QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
+ if (!pi->hasCapability(QPlatformIntegration::MultipleWindows)
+ || !pi->hasCapability(QPlatformIntegration::NonFullScreenWindows)
+ || !pi->hasCapability(QPlatformIntegration::WindowManagement)) {
+ QSKIP("This test requires window management capabilities");
+ }
+
+ QWidget parent;
+ ShowHideEventWidget child(&parent);
+
+ parent.setWindowTitle(QTest::currentTestFunction());
+ parent.resize(m_testWidgetSize);
+ centerOnScreen(&parent);
+ parent.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&parent));
+
+ const int showEventsBeforeMinimize = child.numberOfSpontaneousShowEvents;
+ const int hideEventsBeforeMinimize = child.numberOfSpontaneousHideEvents;
+ parent.showMinimized();
+ QTRY_COMPARE(child.numberOfSpontaneousHideEvents, hideEventsBeforeMinimize + 1);
+ parent.showNormal();
+ QTRY_COMPARE(child.numberOfSpontaneousShowEvents, showEventsBeforeMinimize + 1);
+}
+
void tst_QWidget::update()
{
#ifdef Q_OS_OSX
@@ -10135,8 +10173,11 @@ void tst_QWidget::underMouse()
QCOMPARE(childWidget2.leaves, 0);
// Mouse leaves popup and enters topLevelWidget, should cause leave for popup
- // but no enter to topLevelWidget. Again, artificial leave event needed.
+ // but no enter to topLevelWidget.
+#ifdef Q_OS_DARWIN
+ // Artificial leave event needed for Cocoa.
QWindowSystemInterface::handleLeaveEvent(popupWindow);
+#endif
QTest::mouseMove(popupWindow, popupWindow->mapFromGlobal(window->mapToGlobal(inWindowPoint)));
QApplication::processEvents();
QVERIFY(!topLevelWidget.underMouse());
diff --git a/tests/manual/qopenglwindow/multiwindow/main.cpp b/tests/manual/qopenglwindow/multiwindow/main.cpp
index 0788408b47..1f84758bc9 100644
--- a/tests/manual/qopenglwindow/multiwindow/main.cpp
+++ b/tests/manual/qopenglwindow/multiwindow/main.cpp
@@ -26,14 +26,7 @@
**
****************************************************************************/
-#include <QGuiApplication>
-#include <QOpenGLWindow>
-#include <QOpenGLContext>
-#include <QOpenGLFunctions>
-#include <QPainter>
-#include <QElapsedTimer>
-#include <QCommandLineParser>
-#include <QScreen>
+#include <QtGui>
const char applicationDescription[] = "\n\
This application opens multiple windows and continuously schedules updates for\n\
@@ -62,67 +55,95 @@ class Window : public QOpenGLWindow
{
Q_OBJECT
public:
- Window(int n) : idx(n) {
- r = g = b = fps = 0;
- y = 0;
+ Window(int index) : windowNumber(index + 1), x(0), framesSwapped(0) {
+
+ color = QColor::fromHsl((index * 30) % 360, 255, 127).toRgb();
+
resize(200, 200);
+ setObjectName(QString("Window %1").arg(windowNumber));
+
connect(this, SIGNAL(frameSwapped()), SLOT(frameSwapped()));
- fpsTimer.start();
}
void paintGL() {
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
- f->glClearColor(r, g, b, 1);
+ f->glClearColor(color.redF(), color.greenF(), color.blueF(), 1);
f->glClear(GL_COLOR_BUFFER_BIT);
- switch (idx % 3) {
- case 0:
- r += 0.005f;
- break;
- case 1:
- g += 0.005f;
- break;
- case 2:
- b += 0.005f;
- break;
- }
- if (r > 1)
- r = 0;
- if (g > 1)
- g = 0;
- if (b > 1)
- b = 0;
-
- QPainter p(this);
- p.setPen(Qt::white);
- p.drawText(QPoint(20, y), QString(QLatin1String("Window %1 (%2 FPS)")).arg(idx).arg(fps));
- y += 1;
- if (y > height() - 20)
- y = 20;
- update();
+ QPainter painter(this);
+ painter.drawLine(x, 0, x, height());
+ x = ++x % width();
}
public slots:
void frameSwapped() {
++framesSwapped;
- if (fpsTimer.elapsed() > 1000) {
- fps = qRound(framesSwapped * (1000.0 / fpsTimer.elapsed()));
- framesSwapped = 0;
- fpsTimer.restart();
- }
+ update();
+ }
+
+protected:
+ void exposeEvent(QExposeEvent *event) {
+ if (!isExposed())
+ return;
+
+ QSurfaceFormat format = context()->format();
+ qDebug() << this << format.swapBehavior() << "with Vsync =" << (format.swapInterval() ? "ON" : "OFF");
+ if (format.swapInterval() != requestedFormat().swapInterval())
+ qWarning() << "WARNING: Did not get requested swap interval of" << requestedFormat().swapInterval() << "for" << this;
+
+ QOpenGLWindow::exposeEvent(event);
+ }
+
+ void mousePressEvent(QMouseEvent *event) {
+ qDebug() << this << event;
+ color.setHsl((color.hue() + 90) % 360, color.saturation(), color.lightness());
+ color = color.toRgb();
}
private:
- int idx;
- GLfloat r, g, b;
- int y;
+ int windowNumber;
+ QColor color;
+ int x;
int framesSwapped;
- QElapsedTimer fpsTimer;
- int fps;
+ friend void printFps();
};
+static const qreal kFpsInterval = 500;
+
+void printFps()
+{
+ static QElapsedTimer timer;
+ if (!timer.isValid()) {
+ timer.start();
+ return;
+ }
+
+ const qreal frameFactor = (kFpsInterval / timer.elapsed()) * (1000.0 / kFpsInterval);
+
+ QDebug output = qDebug().nospace();
+
+ qreal averageFps = 0;
+ const QWindowList windows = QGuiApplication::topLevelWindows();
+ for (int i = 0; i < windows.size(); ++i) {
+ Window *w = qobject_cast<Window*>(windows.at(i));
+ Q_ASSERT(w);
+
+ int fps = qRound(w->framesSwapped * frameFactor);
+ output << (i + 1) << "=" << fps << ", ";
+
+ averageFps += fps;
+ w->framesSwapped = 0;
+ }
+ averageFps = qRound(averageFps / windows.size());
+ qreal msPerFrame = 1000.0 / averageFps;
+
+ output << "avg=" << averageFps << ", ms=" << msPerFrame;
+
+ timer.restart();
+}
+
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
@@ -144,30 +165,24 @@ int main(int argc, char **argv)
parser.process(app);
- QSurfaceFormat fmt;
- if (parser.isSet(noVsyncOption)) {
- qDebug("swap interval 0 (no throttling)");
- fmt.setSwapInterval(0);
- } else {
- qDebug("swap interval 1 (sync to vblank)");
- }
- QSurfaceFormat::setDefaultFormat(fmt);
+ QSurfaceFormat defaultSurfaceFormat;
+ defaultSurfaceFormat.setSwapInterval(parser.isSet(noVsyncOption) ? 0 : 1);
+ QSurfaceFormat::setDefaultFormat(defaultSurfaceFormat);
QRect availableGeometry = app.primaryScreen()->availableGeometry();
int numberOfWindows = qMax(parser.value(numWindowsOption).toInt(), 1);
QList<QWindow *> windows;
for (int i = 0; i < numberOfWindows; ++i) {
- Window *w = new Window(i + 1);
+ Window *w = new Window(i);
windows << w;
if (i == 0 && parser.isSet(vsyncOneOption)) {
- qDebug("swap interval 1 for first window only");
- QSurfaceFormat vsyncedSurfaceFormat = fmt;
+ QSurfaceFormat vsyncedSurfaceFormat = defaultSurfaceFormat;
vsyncedSurfaceFormat.setSwapInterval(1);
w->setFormat(vsyncedSurfaceFormat);
- fmt.setSwapInterval(0);
- QSurfaceFormat::setDefaultFormat(fmt);
+ defaultSurfaceFormat.setSwapInterval(0);
+ QSurfaceFormat::setDefaultFormat(defaultSurfaceFormat);
}
static int windowWidth = w->width() + 20;
@@ -182,9 +197,15 @@ int main(int argc, char **argv)
QPoint position = availableGeometry.topLeft();
position += QPoint(col * windowWidth, row * windowHeight);
w->setFramePosition(position);
- w->show();
+ w->showNormal();
}
+ QTimer fpsTimer;
+ fpsTimer.setInterval(kFpsInterval);
+ fpsTimer.setTimerType(Qt::PreciseTimer);
+ QObject::connect(&fpsTimer, &QTimer::timeout, &printFps);
+ fpsTimer.start();
+
int r = app.exec();
qDeleteAll(windows);
return r;