summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/generic/bsdmouse/qbsdmouse.cpp1
-rw-r--r--src/plugins/generic/tuiotouch/qoscbundle.cpp4
-rw-r--r--src/plugins/generic/tuiotouch/qoscmessage.cpp4
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp17
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp7
-rw-r--r--src/plugins/imageformats/jpeg/.prev_CMakeLists.txt9
-rw-r--r--src/plugins/imageformats/jpeg/CMakeLists.txt9
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp14
-rw-r--r--src/plugins/platforminputcontexts/ibus/CMakeLists.txt2
-rw-r--r--src/plugins/platforminputcontexts/ibus/ibus.pro1
-rw-r--r--src/plugins/platforms/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/android/.prev_CMakeLists.txt6
-rw-r--r--src/plugins/platforms/android/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.cpp85
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.h15
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp6
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp7
-rw-r--r--src/plugins/platforms/android/androidjnimain.h4
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp6
-rw-r--r--src/plugins/platforms/android/extract-dummy.cpp6
-rw-r--r--src/plugins/platforms/android/extract.cpp10
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.h2
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp4
-rw-r--r--src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp21
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h14
-rw-r--r--src/plugins/platforms/android/qandroidplatformmenu.h1
-rw-r--r--src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp29
-rw-r--r--src/plugins/platforms/android/qandroidplatformoffscreensurface.h15
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp4
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbscreen.cpp1
-rw-r--r--src/plugins/platforms/cocoa/.prev_CMakeLists.txt10
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h18
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm303
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm30
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm21
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm12
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm58
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm11
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm18
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.mm44
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm57
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.h2
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm6
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm62
-rw-r--r--src/plugins/platforms/cocoa/qnsview_keys.mm39
-rw-r--r--src/plugins/platforms/direct2d/CMakeLists.txt283
-rw-r--r--src/plugins/platforms/directfb/.prev_CMakeLists.txt6
-rw-r--r--src/plugins/platforms/directfb/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/directfb/main.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfb_egl.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.cpp8
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.h4
-rw-r--r--src/plugins/platforms/eglfs/.prev_CMakeLists.txt14
-rw-r--r--src/plugins/platforms/eglfs/CMakeLists.txt31
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen_p.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp16
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt32
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt7
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt28
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt9
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp14
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h1
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt27
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt29
-rw-r--r--src/plugins/platforms/integrity/qintegrityhidmanager.h2
-rw-r--r--src/plugins/platforms/ios/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/platforms/ios/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt8
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm2
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm6
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.mm4
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h6
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm5
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm2
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h10
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm4
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm12
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm12
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm2
-rw-r--r--src/plugins/platforms/ios/quiview.mm2
-rw-r--r--src/plugins/platforms/linuxfb/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/platforms/linuxfb/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h2
-rw-r--r--src/plugins/platforms/minimal/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimal/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/offscreen/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/platforms/offscreen/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/offscreen/offscreen.pro1
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp17
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp6
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration_x11.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractnavigator.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuffer.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuffer.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxclipboard.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxglcontext.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp22
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp73
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.h1
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp6
-rw-r--r--src/plugins/platforms/vnc/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vnc/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp7
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp6
-rw-r--r--src/plugins/platforms/wasm/qwasmeventdispatcher.cpp4
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp23
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.h1
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp14
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp65
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.h3
-rw-r--r--src/plugins/platforms/wasm/qwasmtheme.cpp2
-rw-r--r--src/plugins/platforms/wasm/wasm_shell.html9
-rw-r--r--src/plugins/platforms/windows/.prev_CMakeLists.txt26
-rw-r--r--src/plugins/platforms/windows/CMakeLists.txt32
-rw-r--r--src/plugins/platforms/windows/main.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsapplication.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsapplication.h6
-rw-r--r--src/plugins/platforms/windows/qwindowscombase.h7
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp24
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp27
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.h10
-rw-r--r--src/plugins/platforms/windows/qwindowsdropdataobject.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h5
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.h2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp58
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowsole.h30
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp30
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h9
-rw-r--r--src/plugins/platforms/xcb/.prev_CMakeLists.txt25
-rw-r--r--src/plugins/platforms/xcb/CMakeLists.txt28
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h2
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp6
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp16
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp10
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qt_x11_p.h2
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qtessellator.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp13
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_basic.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_basic.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_screens.cpp17
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp124
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp27
-rw-r--r--src/plugins/platforms/xcb/qxcbeventdispatcher.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbeventdispatcher.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp50
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h9
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp41
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h3
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro2
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp3
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.cpp4
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp65
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog_p.h2
-rw-r--r--src/plugins/printsupport/.prev_CMakeLists.txt3
-rw-r--r--src/plugins/printsupport/CMakeLists.txt3
-rw-r--r--src/plugins/printsupport/cups/qppdprintdevice.cpp6
-rw-r--r--src/plugins/printsupport/printsupport.pro1
-rw-r--r--src/plugins/printsupport/windows/main.cpp66
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.cpp571
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.h153
-rw-r--r--src/plugins/printsupport/windows/qwindowsprinterinfo.cpp120
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintersupport.cpp84
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintersupport.h64
-rw-r--r--src/plugins/printsupport/windows/windows.json3
-rw-r--r--src/plugins/printsupport/windows/windows.pro26
-rw-r--r--src/plugins/sqldrivers/db2/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp18
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2_p.h4
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp67
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase_p.h6
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp28
-rw-r--r--src/plugins/sqldrivers/oci/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp15
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci_p.h4
-rw-r--r--src/plugins/sqldrivers/odbc/.prev_CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/odbc/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp70
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp27
-rw-r--r--src/plugins/sqldrivers/qt_cmdline.cmake18
-rw-r--r--src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt18
-rw-r--r--src/plugins/sqldrivers/sqlite/CMakeLists.txt21
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp55
-rw-r--r--src/plugins/styles/CMakeLists.txt2
-rw-r--r--src/plugins/styles/android/CMakeLists.txt20
-rw-r--r--src/plugins/styles/android/qandroidstyle.cpp23
-rw-r--r--src/plugins/styles/android/qandroidstyle_p.h36
-rw-r--r--src/plugins/styles/mac/macstyle.json2
-rw-r--r--src/plugins/styles/mac/main.mm2
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm95
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p.h30
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle.cpp39
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle_p.h3
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h2
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp478
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle_p.h7
253 files changed, 1972 insertions, 3206 deletions
diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.cpp b/src/plugins/generic/bsdmouse/qbsdmouse.cpp
index 55905199b8..b1ad8516f1 100644
--- a/src/plugins/generic/bsdmouse/qbsdmouse.cpp
+++ b/src/plugins/generic/bsdmouse/qbsdmouse.cpp
@@ -39,6 +39,7 @@
#include "qbsdmouse.h"
+#include <QFile>
#include <QSocketNotifier>
#include <QStringList>
#include <QPoint>
diff --git a/src/plugins/generic/tuiotouch/qoscbundle.cpp b/src/plugins/generic/tuiotouch/qoscbundle.cpp
index e9166922a1..355747db6a 100644
--- a/src/plugins/generic/tuiotouch/qoscbundle.cpp
+++ b/src/plugins/generic/tuiotouch/qoscbundle.cpp
@@ -80,7 +80,7 @@ QOscBundle::QOscBundle(const QByteArray &data)
// "followed by an OSC Time
// Tag, followed by zero or more OSC Bundle Elements. The OSC-timetag is a
// 64-bit fixed point time tag whose semantics are described below."
- if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint64))
+ if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < qsizetype(sizeof(quint64)))
return;
// "Time tags are represented by a 64 bit fixed point number. The first 32
@@ -113,7 +113,7 @@ QOscBundle::QOscBundle(const QByteArray &data)
//
// in practice, a bundle can contain multiple bundles or messages,
// though, and each is prefixed by a size.
- if (data.size() - parsedBytes < sizeof(quint32))
+ if (data.size() - parsedBytes < qsizetype(sizeof(quint32)))
return;
quint32 size = qFromBigEndian<quint32>((const uchar*)data.constData() + parsedBytes);
diff --git a/src/plugins/generic/tuiotouch/qoscmessage.cpp b/src/plugins/generic/tuiotouch/qoscmessage.cpp
index dba0decf51..ef2f8a6ae9 100644
--- a/src/plugins/generic/tuiotouch/qoscmessage.cpp
+++ b/src/plugins/generic/tuiotouch/qoscmessage.cpp
@@ -92,7 +92,7 @@ QOscMessage::QOscMessage(const QByteArray &data)
return;
arguments.append(aString);
} else if (typeTag == 'i') { // int32
- if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint32))
+ if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < qsizetype(sizeof(quint32)))
return;
quint32 anInt = qFromBigEndian<quint32>(data.constData() + parsedBytes);
@@ -101,7 +101,7 @@ QOscMessage::QOscMessage(const QByteArray &data)
// TODO: is int32 in OSC signed, or unsigned?
arguments.append((int)anInt);
} else if (typeTag == 'f') { // float32
- if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < sizeof(quint32))
+ if (parsedBytes > (quint32)data.size() || data.size() - parsedBytes < qsizetype(sizeof(quint32)))
return;
static_assert(sizeof(float) == sizeof(quint32));
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 23a768e3d3..2103f5f6fe 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -46,10 +46,13 @@
#include <qimage.h>
#include <qiodevice.h>
+#include <qloggingcategory.h>
#include <qvariant.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcGif, "qt.gui.imageio.gif")
+
#define Q_TRANSPARENT 0x00ffffff
// avoid going through QImage::scanLine() which calls detach
@@ -492,12 +495,14 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
break;
case ImageDataBlock:
count++;
- if (bitcount < 0 || bitcount > 31) {
- state = Error;
- return -1;
+ if (bitcount != -32768) {
+ if (bitcount < 0 || bitcount > 31) {
+ state = Error;
+ return -1;
+ }
+ accum |= (ch << bitcount);
+ bitcount += 8;
}
- accum|=(ch<<bitcount);
- bitcount+=8;
while (bitcount>=code_size && state==ImageDataBlock) {
int code=accum&((1<<code_size)-1);
bitcount-=code_size;
@@ -1119,7 +1124,7 @@ bool QGifHandler::canRead() const
bool QGifHandler::canRead(QIODevice *device)
{
if (!device) {
- qWarning("QGifHandler::canRead() called with no device");
+ qCWarning(lcGif, "QGifHandler::canRead() called with no device");
return false;
}
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 52e231e5a7..1b084e2eea 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -50,12 +50,15 @@
#include <QtCore/qendian.h>
#include <private/qendian_p.h>
#include <QtGui/QImage>
-#include <QtCore/QFile>
#include <QtCore/QBuffer>
+#include <QtCore/QFile>
+#include <QtCore/QLoggingCategory>
#include <qvariant.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcIco, "qt.gui.imageio.ico")
+
// These next two structs represent how the icon information is stored
// in an ICO file.
typedef struct
@@ -771,7 +774,7 @@ bool QtIcoHandler::canRead() const
if (bCanRead)
setFormat("ico");
} else {
- qWarning("QtIcoHandler::canRead() called with no device");
+ qCWarning(lcIco, "QtIcoHandler::canRead() called with no device");
}
return bCanRead;
}
diff --git a/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt b/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt
index b7e0c7cab7..bab14249d6 100644
--- a/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt
+++ b/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt
@@ -23,12 +23,12 @@ qt_internal_add_plugin(QJpegPlugin
## Scopes:
#####################################################################
-qt_extend_target(QJpegPlugin CONDITION QT_FEATURE_system_jpeg
+qt_internal_extend_target(QJpegPlugin CONDITION QT_FEATURE_system_jpeg
PUBLIC_LIBRARIES
JPEG::JPEG
)
-qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
+qt_internal_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
SOURCES
../../../3rdparty/libjpeg/src/jaricom.c
../../../3rdparty/libjpeg/src/jcapimin.c
@@ -87,3 +87,8 @@ qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
#### Keys ignored in scope 5:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC:
# QMAKE_CFLAGS_WARN_ON = "-Wno-unused-parameter" "-Wno-main"
+
+qt_internal_extend_target(QJpegPlugin CONDITION MSVC AND NOT QT_FEATURE_system_jpeg
+ DEFINES
+ _CRT_SECURE_NO_WARNINGS
+)
diff --git a/src/plugins/imageformats/jpeg/CMakeLists.txt b/src/plugins/imageformats/jpeg/CMakeLists.txt
index 16584bdb7d..7e69e1aba6 100644
--- a/src/plugins/imageformats/jpeg/CMakeLists.txt
+++ b/src/plugins/imageformats/jpeg/CMakeLists.txt
@@ -25,12 +25,12 @@ qt_internal_add_plugin(QJpegPlugin
## Scopes:
#####################################################################
-qt_extend_target(QJpegPlugin CONDITION QT_FEATURE_system_jpeg
+qt_internal_extend_target(QJpegPlugin CONDITION QT_FEATURE_system_jpeg
PUBLIC_LIBRARIES
JPEG::JPEG
)
-qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
+qt_internal_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
SOURCES
../../../3rdparty/libjpeg/src/jaricom.c
../../../3rdparty/libjpeg/src/jcapimin.c
@@ -97,3 +97,8 @@ endif()
#### Keys ignored in scope 5:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC:
# QMAKE_CFLAGS_WARN_ON = "-Wno-unused-parameter" "-Wno-main"
+
+qt_internal_extend_target(QJpegPlugin CONDITION MSVC AND NOT QT_FEATURE_system_jpeg
+ DEFINES
+ _CRT_SECURE_NO_WARNINGS
+)
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 7574d1ca00..29bf5ab589 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -45,6 +45,7 @@
#include <qdebug.h>
#include <qimage.h>
#include <qlist.h>
+#include <qloggingcategory.h>
#include <qmath.h>
#include <qvariant.h>
#include <private/qicc_p.h>
@@ -75,6 +76,9 @@ extern "C" {
}
QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcJpeg, "qt.gui.imageio.jpeg")
+
QT_WARNING_DISABLE_GCC("-Wclobbered")
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
@@ -91,7 +95,7 @@ static void my_error_exit (j_common_ptr cinfo)
my_error_mgr* myerr = (my_error_mgr*) cinfo->err;
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, buffer);
- qWarning("%s", buffer);
+ qCWarning(lcJpeg, "%s", buffer);
longjmp(myerr->setjmp_buffer, 1);
}
@@ -99,7 +103,7 @@ static void my_output_message(j_common_ptr cinfo)
{
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, buffer);
- qWarning("%s", buffer);
+ qCWarning(lcJpeg,"%s", buffer);
}
}
@@ -516,7 +520,7 @@ static inline void write_icc_profile(const QImage &image, j_compress_ptr cinfo)
const int markers = (iccProfile.size() + (maxIccMarkerSize - 1)) / maxIccMarkerSize;
Q_ASSERT(markers < 256);
for (int marker = 1; marker <= markers; ++marker) {
- const int len = std::min(iccProfile.size() - index, maxIccMarkerSize);
+ const int len = qMin(iccProfile.size() - index, maxIccMarkerSize);
const QByteArray block = iccSignature
+ QByteArray(1, char(marker)) + QByteArray(1, char(markers))
+ iccProfile.mid(index, len);
@@ -913,7 +917,7 @@ static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
case 8: // rotate 270 CW
return QImageIOHandler::TransformationRotate270;
}
- qWarning("Invalid EXIF orientation");
+ qCWarning(lcJpeg, "Invalid EXIF orientation");
return QImageIOHandler::TransformationNone;
}
@@ -1071,7 +1075,7 @@ bool QJpegHandler::canRead() const
bool QJpegHandler::canRead(QIODevice *device)
{
if (!device) {
- qWarning("QJpegHandler::canRead() called with no device");
+ qCWarning(lcJpeg, "QJpegHandler::canRead() called with no device");
return false;
}
diff --git a/src/plugins/platforminputcontexts/ibus/CMakeLists.txt b/src/plugins/platforminputcontexts/ibus/CMakeLists.txt
index a2f2275795..686f028c6a 100644
--- a/src/plugins/platforminputcontexts/ibus/CMakeLists.txt
+++ b/src/plugins/platforminputcontexts/ibus/CMakeLists.txt
@@ -14,6 +14,8 @@ qt_internal_add_plugin(QIbusPlatformInputContextPlugin
qibusproxy.cpp qibusproxy.h
qibusproxyportal.cpp qibusproxyportal.h
qibustypes.cpp qibustypes.h
+ LIBRARIES
+ XKB::XKB
PUBLIC_LIBRARIES
Qt::Core
Qt::DBus
diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro
index 52836bb8b6..a3220fd547 100644
--- a/src/plugins/platforminputcontexts/ibus/ibus.pro
+++ b/src/plugins/platforminputcontexts/ibus/ibus.pro
@@ -1,6 +1,7 @@
TARGET = ibusplatforminputcontextplugin
QT += dbus gui-private
+QMAKE_USE_PRIVATE += xkbcommon
SOURCES += $$PWD/qibusplatforminputcontext.cpp \
$$PWD/qibusproxy.cpp \
$$PWD/qibusproxyportal.cpp \
diff --git a/src/plugins/platforms/CMakeLists.txt b/src/plugins/platforms/CMakeLists.txt
index 47b8099332..bb246565b9 100644
--- a/src/plugins/platforms/CMakeLists.txt
+++ b/src/plugins/platforms/CMakeLists.txt
@@ -22,7 +22,7 @@ if(WIN32)
add_subdirectory(windows)
endif()
if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite)
- # add_subdirectory(direct2d) # special case TODO
+ add_subdirectory(direct2d)
endif()
if(QNX)
# add_subdirectory(qnx) # special case TODO
diff --git a/src/plugins/platforms/android/.prev_CMakeLists.txt b/src/plugins/platforms/android/.prev_CMakeLists.txt
index 5b2dada653..7345de1f81 100644
--- a/src/plugins/platforms/android/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/android/.prev_CMakeLists.txt
@@ -60,17 +60,17 @@ qt_internal_add_plugin(QAndroidIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
SOURCES
extract.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
SOURCES
extract-dummy.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qandroidplatformvulkaninstance.cpp qandroidplatformvulkaninstance.h
qandroidplatformvulkanwindow.cpp qandroidplatformvulkanwindow.h
diff --git a/src/plugins/platforms/android/CMakeLists.txt b/src/plugins/platforms/android/CMakeLists.txt
index 7fcd42a9bb..2e323325b0 100644
--- a/src/plugins/platforms/android/CMakeLists.txt
+++ b/src/plugins/platforms/android/CMakeLists.txt
@@ -63,17 +63,17 @@ qt_internal_add_plugin(QAndroidIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_android_style_assets
SOURCES
extract.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION NOT QT_FEATURE_android_style_assets
SOURCES
extract-dummy.cpp
)
-qt_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QAndroidIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qandroidplatformvulkaninstance.cpp qandroidplatformvulkaninstance.h
qandroidplatformvulkanwindow.cpp qandroidplatformvulkanwindow.h
diff --git a/src/plugins/platforms/android/androidcontentfileengine.cpp b/src/plugins/platforms/android/androidcontentfileengine.cpp
index 3e3bdc2592..bdbf2186ba 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.cpp
+++ b/src/plugins/platforms/android/androidcontentfileengine.cpp
@@ -65,7 +65,7 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
openModeStr += QLatin1Char('a');
}
- const auto fd = QJNIObjectPrivate::callStaticMethod<jint>("org/qtproject/qt5/android/QtNative",
+ const auto fd = QJNIObjectPrivate::callStaticMethod<jint>("org/qtproject/qt/android/QtNative",
"openFdForContentUrl",
"(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I",
QtAndroidPrivate::context(),
@@ -82,7 +82,7 @@ bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
qint64 AndroidContentFileEngine::size() const
{
const jlong size = QJNIObjectPrivate::callStaticMethod<jlong>(
- "org/qtproject/qt5/android/QtNative", "getSize",
+ "org/qtproject/qt/android/QtNative", "getSize",
"(Landroid/content/Context;Ljava/lang/String;)J", QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
return (qint64)size;
@@ -92,13 +92,21 @@ AndroidContentFileEngine::FileFlags AndroidContentFileEngine::fileFlags(FileFlag
{
FileFlags commonFlags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag);
FileFlags flags;
- const bool exists = QJNIObjectPrivate::callStaticMethod<jboolean>(
- "org/qtproject/qt5/android/QtNative", "checkFileExists",
+ const bool isDir = QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt/android/QtNative", "checkIfDir",
"(Landroid/content/Context;Ljava/lang/String;)Z", QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
- if (!exists)
+ // If it is a directory then we know it exists so there is no reason to explicitly check
+ const bool exists = isDir ? true : QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt/android/QtNative", "checkFileExists",
+ "(Landroid/content/Context;Ljava/lang/String;)Z", QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(fileName(DefaultName)).object());
+ if (!exists && !isDir)
return flags;
- flags = FileType | commonFlags;
+ if (isDir)
+ flags = DirectoryType | commonFlags;
+ else
+ flags = FileType | commonFlags;
return type & flags;
}
@@ -122,6 +130,16 @@ QString AndroidContentFileEngine::fileName(FileName f) const
}
}
+QAbstractFileEngine::Iterator *AndroidContentFileEngine::beginEntryList(QDir::Filters filters, const QStringList &filterNames)
+{
+ return new AndroidContentFileEngineIterator(filters, filterNames);
+}
+
+QAbstractFileEngine::Iterator *AndroidContentFileEngine::endEntryList()
+{
+ return nullptr;
+}
+
AndroidContentFileEngineHandler::AndroidContentFileEngineHandler() = default;
AndroidContentFileEngineHandler::~AndroidContentFileEngineHandler() = default;
@@ -133,3 +151,58 @@ QAbstractFileEngine* AndroidContentFileEngineHandler::create(const QString &file
return new AndroidContentFileEngine(fileName);
}
+
+AndroidContentFileEngineIterator::AndroidContentFileEngineIterator(QDir::Filters filters,
+ const QStringList &filterNames)
+ : QAbstractFileEngineIterator(filters, filterNames)
+{
+}
+
+AndroidContentFileEngineIterator::~AndroidContentFileEngineIterator()
+{
+}
+
+QString AndroidContentFileEngineIterator::next()
+{
+ if (!hasNext())
+ return QString();
+ ++m_index;
+ return currentFilePath();
+}
+
+bool AndroidContentFileEngineIterator::hasNext() const
+{
+ if (m_index == -1) {
+ if (path().isEmpty())
+ return false;
+ const bool isDir = QJNIObjectPrivate::callStaticMethod<jboolean>(
+ "org/qtproject/qt/android/QtNative", "checkIfDir",
+ "(Landroid/content/Context;Ljava/lang/String;)Z",
+ QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(path()).object());
+ if (isDir) {
+ QJNIObjectPrivate objArray = QJNIObjectPrivate::callStaticObjectMethod("org/qtproject/qt/android/QtNative",
+ "listContentsFromTreeUri",
+ "(Landroid/content/Context;Ljava/lang/String;)[Ljava/lang/String;",
+ QtAndroidPrivate::context(),
+ QJNIObjectPrivate::fromString(path()).object());
+ if (objArray.isValid()) {
+ QJNIEnvironmentPrivate env;
+ const jsize length = env->GetArrayLength(static_cast<jarray>(objArray.object()));
+ for (int i = 0; i != length; ++i) {
+ m_entries << QJNIObjectPrivate(env->GetObjectArrayElement(
+ static_cast<jobjectArray>(objArray.object()), i)).toString();
+ }
+ }
+ }
+ m_index = 0;
+ }
+ return m_index < m_entries.size();
+}
+
+QString AndroidContentFileEngineIterator::currentFileName() const
+{
+ if (m_index <= 0 || m_index > m_entries.size())
+ return QString();
+ return m_entries.at(m_index - 1);
+}
diff --git a/src/plugins/platforms/android/androidcontentfileengine.h b/src/plugins/platforms/android/androidcontentfileengine.h
index 09e5d77553..31eaf9b0ab 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.h
+++ b/src/plugins/platforms/android/androidcontentfileengine.h
@@ -50,6 +50,8 @@ public:
qint64 size() const override;
FileFlags fileFlags(FileFlags type = FileInfoAll) const override;
QString fileName(FileName file = DefaultName) const override;
+ QAbstractFileEngine::Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
+ QAbstractFileEngine::Iterator *endEntryList() override;
private:
QString m_file;
@@ -63,4 +65,17 @@ public:
QAbstractFileEngine *create(const QString &fileName) const override;
};
+class AndroidContentFileEngineIterator : public QAbstractFileEngineIterator
+{
+public:
+ AndroidContentFileEngineIterator(QDir::Filters filters, const QStringList &filterNames);
+ ~AndroidContentFileEngineIterator();
+ QString next() override;
+ bool hasNext() const override;
+ QString currentFileName() const override;
+private:
+ mutable QStringList m_entries;
+ mutable int m_index = -1;
+};
+
#endif // ANDROIDCONTENTFILEENGINE_H
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index a27c200362..8d9a968b4f 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -98,7 +98,7 @@ namespace QtAndroidAccessibility
QAccessibleInterface *interfaceFromId(jint objectId)
{
- QAccessibleInterface *iface = 0;
+ QAccessibleInterface *iface = nullptr;
if (objectId == -1) {
QWindow *win = qApp->focusWindow();
if (win)
@@ -164,7 +164,7 @@ namespace QtAndroidAccessibility
QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window());
QAccessibleInterface *child = root->childAt(pos.x(), pos.y());
- QAccessibleInterface *lastChild = 0;
+ QAccessibleInterface *lastChild = nullptr;
while (child && (child != lastChild)) {
lastChild = child;
child = child->childAt(pos.x(), pos.y());
@@ -318,7 +318,7 @@ if (!clazz) { \
bool registerNatives(JNIEnv *env)
{
jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/accessibility/QtNativeAccessibility");
+ FIND_AND_CHECK_CLASS("org/qtproject/qt/android/accessibility/QtNativeAccessibility");
jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 3f41ead818..9e2cb228b3 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -92,8 +92,6 @@ static jmethodID m_createBitmapMethodID = nullptr;
static jobject m_ARGB_8888_BitmapConfigValue = nullptr;
static jobject m_RGB_565_BitmapConfigValue = nullptr;
-static bool m_statusBarShowing = true;
-
static jclass m_bitmapDrawableClass = nullptr;
static jmethodID m_bitmapDrawableConstructorMethodID = nullptr;
@@ -456,7 +454,8 @@ static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring pa
QByteArray string = nativeString;
env->ReleaseStringUTFChars(paramsString, nativeString);
- m_applicationParams=string.split('\t');
+ for (auto str : string.split('\t'))
+ m_applicationParams.append(str.split(' '));
// Go home
QDir::setCurrent(QDir::homePath());
@@ -807,7 +806,7 @@ if (!VAR) { \
static int registerNatives(JNIEnv *env)
{
jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative");
+ FIND_AND_CHECK_CLASS("org/qtproject/qt/android/QtNative");
m_applicationClass = static_cast<jclass>(env->NewGlobalRef(clazz));
if (env->RegisterNatives(m_applicationClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index 63be5910f9..6902f89341 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -96,9 +96,9 @@ namespace QtAndroid
};
void setSystemUiVisibility(SystemUiVisibility uiVisibility);
- jobject createBitmap(QImage img, JNIEnv *env = 0);
+ jobject createBitmap(QImage img, JNIEnv *env = nullptr);
jobject createBitmap(int width, int height, QImage::Format format, JNIEnv *env);
- jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = 0);
+ jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = nullptr);
const char *classErrorMsgFmt();
const char *methodErrorMsgFmt();
diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp
index de2fdaa0e2..fe5de1f882 100644
--- a/src/plugins/platforms/android/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/androidjnimenu.cpp
@@ -59,12 +59,12 @@ using namespace QtAndroid;
namespace QtAndroidMenu
{
static QList<QAndroidPlatformMenu *> pendingContextMenus;
- static QAndroidPlatformMenu *visibleMenu = 0;
+ static QAndroidPlatformMenu *visibleMenu = nullptr;
static QRecursiveMutex visibleMenuMutex;
static QSet<QAndroidPlatformMenuBar *> menuBars;
- static QAndroidPlatformMenuBar *visibleMenuBar = 0;
- static QWindow *activeTopLevelWindow = 0;
+ static QAndroidPlatformMenuBar *visibleMenuBar = nullptr;
+ static QWindow *activeTopLevelWindow = nullptr;
static QRecursiveMutex menuBarMutex;
static jmethodID openContextMenuMethodID = 0;
diff --git a/src/plugins/platforms/android/extract-dummy.cpp b/src/plugins/platforms/android/extract-dummy.cpp
index fdce8ec64c..bfc0dafd04 100644
--- a/src/plugins/platforms/android/extract-dummy.cpp
+++ b/src/plugins/platforms/android/extract-dummy.cpp
@@ -40,12 +40,14 @@
#include <jni.h>
#include <extract.h>
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *, jobject, long)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *, jobject, long)
{
return 0;
}
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo20(JNIEnv *, jobject, jbyteArray)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractChunkInfo20(JNIEnv *, jobject, jbyteArray)
{
return 0;
}
diff --git a/src/plugins/platforms/android/extract.cpp b/src/plugins/platforms/android/extract.cpp
index acffa353f1..c68dae31e9 100644
--- a/src/plugins/platforms/android/extract.cpp
+++ b/src/plugins/platforms/android/extract.cpp
@@ -91,7 +91,8 @@ Res_png_9patch* Res_png_9patch::deserialize(const void* inData)
return (Res_png_9patch*) inData;
}
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv * env, jobject, long addr)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *env, jobject, long addr)
{
Res_png_9patch20* chunk = reinterpret_cast<Res_png_9patch20*>(addr);
Res_png_9patch20::deserialize(chunk);
@@ -123,7 +124,9 @@ extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractSty
return result;
}
-extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo20(JNIEnv * env, jobject obj, jbyteArray chunkObj)
+extern "C" JNIEXPORT jintArray JNICALL
+Java_org_qtproject_qt_android_ExtractStyle_extractChunkInfo20(JNIEnv *env, jobject obj,
+ jbyteArray chunkObj)
{
size_t chunkSize = env->GetArrayLength(chunkObj);
void* storage = alloca(chunkSize);
@@ -131,7 +134,8 @@ extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractSty
reinterpret_cast<jbyte*>(storage));
if (!env->ExceptionCheck())
- return Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(env, obj, long(storage));
+ return Java_org_qtproject_qt_android_ExtractStyle_extractNativeChunkInfo20(env, obj,
+ long(storage));
else
env->ExceptionClear();
return 0;
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.h b/src/plugins/platforms/android/qandroideventdispatcher.h
index 85d4cee6cb..8a29ed7e7e 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.h
+++ b/src/plugins/platforms/android/qandroideventdispatcher.h
@@ -48,7 +48,7 @@ class QAndroidEventDispatcher : public QUnixEventDispatcherQPA
{
Q_OBJECT
public:
- explicit QAndroidEventDispatcher(QObject *parent = 0);
+ explicit QAndroidEventDispatcher(QObject *parent = nullptr);
~QAndroidEventDispatcher();
void start();
void stop();
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 84745f3f28..fc71b391c0 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -91,9 +91,9 @@ private:
} // namespace anonymous
-static QAndroidInputContext *m_androidInputContext = 0;
-static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt5/android/QtNativeInputConnection";
-static char const *const QtExtractedTextClassName = "org/qtproject/qt5/android/QtExtractedText";
+static QAndroidInputContext *m_androidInputContext = nullptr;
+static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt/android/QtNativeInputConnection";
+static char const *const QtExtractedTextClassName = "org/qtproject/qt/android/QtExtractedText";
static jclass m_extractedTextClass = 0;
static jmethodID m_classConstructorMethodID = 0;
static jfieldID m_partialEndOffsetFieldID = 0;
@@ -392,7 +392,7 @@ static JNINativeMethod methods[] = {
{"deleteSurroundingText", "(II)Z", (void *)deleteSurroundingText},
{"finishComposingText", "()Z", (void *)finishComposingText},
{"getCursorCapsMode", "(I)I", (void *)getCursorCapsMode},
- {"getExtractedText", "(III)Lorg/qtproject/qt5/android/QtExtractedText;", (void *)getExtractedText},
+ {"getExtractedText", "(III)Lorg/qtproject/qt/android/QtExtractedText;", (void *)getExtractedText},
{"getSelectedText", "(I)Ljava/lang/String;", (void *)getSelectedText},
{"getTextAfterCursor", "(II)Ljava/lang/String;", (void *)getTextAfterCursor},
{"getTextBeforeCursor", "(II)Ljava/lang/String;", (void *)getTextBeforeCursor},
diff --git a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
index 0297734bc8..9ce63dceec 100644
--- a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
+++ b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
namespace QtAndroidDialogHelpers {
static jclass g_messageDialogHelperClass = 0;
-static const char QtMessageHandlerHelperClassName[] = "org/qtproject/qt5/android/QtMessageDialogHelper";
+static const char QtMessageHandlerHelperClassName[] = "org/qtproject/qt/android/QtMessageDialogHelper";
QAndroidPlatformMessageDialogHelper::QAndroidPlatformMessageDialogHelper()
:m_buttonId(-1)
@@ -190,7 +190,7 @@ bool registerNatives(JNIEnv *env)
return false;
}
g_messageDialogHelperClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNativeDialogHelper");
+ FIND_AND_CHECK_CLASS("org/qtproject/qt/android/QtNativeDialogHelper");
jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
diff --git a/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp b/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp
index 1b48769385..acfa4542a1 100644
--- a/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfiledialoghelper.cpp
@@ -176,7 +176,7 @@ void QAndroidPlatformFileDialogHelper::setMimeTypes()
JniIntentClass, "EXTRA_MIME_TYPES", "Ljava/lang/String;");
QJNIObjectPrivate mimeTypesArray = QJNIObjectPrivate::callStaticObjectMethod(
- "org/qtproject/qt5/android/QtNative",
+ "org/qtproject/qt/android/QtNative",
"getStringArray",
"(Ljava/lang/String;)[Ljava/lang/String;",
QJNIObjectPrivate::fromString(mimeTypes.join(",")).object());
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 372b32746d..8048bd6cff 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -44,6 +44,7 @@
#include <QGuiApplication>
#include <QOpenGLContext>
#include <QOffscreenSurface>
+#include <QtGui/private/qoffscreensurface_p.h>
#include <QThread>
#include <QtGui/private/qeglpbuffer_p.h>
@@ -68,6 +69,8 @@
#include "qandroidsystemlocale.h"
#include "qandroidplatformoffscreensurface.h"
+#include <jni.h>
+
#if QT_CONFIG(vulkan)
#include "qandroidplatformvulkanwindow.h"
#include "qandroidplatformvulkaninstance.h"
@@ -322,16 +325,20 @@ QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenS
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
- if (surface->nativeHandle()) {
- // Adopt existing offscreen Surface
- // The expectation is that nativeHandle is an ANativeWindow* representing
- // an android.view.Surface
- return new QAndroidPlatformOffscreenSurface(m_eglDisplay, format, surface);
- }
-
return new QEGLPbuffer(m_eglDisplay, format, surface);
}
+QOffscreenSurface *QAndroidPlatformIntegration::createOffscreenSurface(ANativeWindow *nativeSurface) const
+{
+ if (!QtAndroid::activity() || !nativeSurface)
+ return nullptr;
+
+ auto *surface = new QOffscreenSurface;
+ auto *surfacePrivate = QOffscreenSurfacePrivate::get(surface);
+ surfacePrivate->platformOffscreenSurface = new QAndroidPlatformOffscreenSurface(nativeSurface, m_eglDisplay, surface);
+ return surface;
+}
+
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
{
if (!QtAndroid::activity())
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h
index 30ab42ab34..d579bc29ae 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/qandroidplatformintegration.h
@@ -40,19 +40,17 @@
#ifndef QANDROIDPLATFORMINTERATION_H
#define QANDROIDPLATFORMINTERATION_H
-#include <QtGui/qtguiglobal.h>
+#include "qandroidinputcontext.h"
+#include "qandroidplatformscreen.h"
+#include <QtGui/qtguiglobal.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformmenu.h>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformopenglcontext.h>
+#include <qpa/qplatformoffscreensurface.h>
#include <EGL/egl.h>
-#include <jni.h>
-#include "qandroidinputcontext.h"
-
-#include "qandroidplatformscreen.h"
-
#include <memory>
QT_BEGIN_NAMESPACE
@@ -74,7 +72,8 @@ protected:
};
class QAndroidPlatformIntegration : public QPlatformIntegration
- , QPlatformInterface::Private::QEGLIntegration
+ , QNativeInterface::Private::QEGLIntegration
+ , QNativeInterface::Private::QAndroidOffScreenIntegration
{
friend class QAndroidPlatformScreen;
@@ -94,6 +93,7 @@ public:
QAbstractEventDispatcher *createEventDispatcher() const override;
QAndroidPlatformScreen *screen() { return m_primaryScreen; }
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
+ QOffscreenSurface *createOffscreenSurface(ANativeWindow *nativeSurface) const override;
void setAvailableGeometry(const QRect &availableGeometry);
void setPhysicalSize(int width, int height);
diff --git a/src/plugins/platforms/android/qandroidplatformmenu.h b/src/plugins/platforms/android/qandroidplatformmenu.h
index b8334ff970..e745360122 100644
--- a/src/plugins/platforms/android/qandroidplatformmenu.h
+++ b/src/plugins/platforms/android/qandroidplatformmenu.h
@@ -40,6 +40,7 @@
#ifndef QANDROIDPLATFORMMENU_H
#define QANDROIDPLATFORMMENU_H
+#include <qhash.h>
#include <qpa/qplatformmenu.h>
#include <qlist.h>
#include <qmutex.h>
diff --git a/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp b/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp
index f9589cea1a..9255ef4446 100644
--- a/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp
+++ b/src/plugins/platforms/android/qandroidplatformoffscreensurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,28 +39,23 @@
#include "qandroidplatformoffscreensurface.h"
-#include <QtGui/QOffscreenSurface>
#include <QtGui/private/qeglconvenience_p.h>
-#include <android/native_window.h>
-
QT_BEGIN_NAMESPACE
-QAndroidPlatformOffscreenSurface::QAndroidPlatformOffscreenSurface(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface)
- : QPlatformOffscreenSurface(offscreenSurface)
- , m_format(format)
- , m_display(display)
- , m_surface(EGL_NO_SURFACE)
+QAndroidPlatformOffscreenSurface::QAndroidPlatformOffscreenSurface(
+ ANativeWindow *nativeSurface, EGLDisplay display, QOffscreenSurface *offscreenSurface)
+ : QPlatformOffscreenSurface(offscreenSurface), m_display(display), m_surface(EGL_NO_SURFACE)
{
- // Get native handle
- ANativeWindow *surfaceTexture = (ANativeWindow*)offscreenSurface->nativeHandle();
+ // FIXME: Read surface format properties from native surface using ANativeWindow_getFormat
+ m_format.setAlphaBufferSize(8);
+ m_format.setRedBufferSize(8);
+ m_format.setGreenBufferSize(8);
+ m_format.setBlueBufferSize(8);
- EGLConfig config = q_configFromGLFormat(m_display, m_format, false);
- if (config) {
- const EGLint attributes[] = {
- EGL_NONE
- };
- m_surface = eglCreateWindowSurface(m_display, config, surfaceTexture, attributes);
+ if (EGLConfig config = q_configFromGLFormat(m_display, m_format, false)) {
+ const EGLint attributes[] = { EGL_NONE };
+ m_surface = eglCreateWindowSurface(m_display, config, nativeSurface, attributes);
}
}
diff --git a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
index 033bc6a03f..e57ab2afad 100644
--- a/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
+++ b/src/plugins/platforms/android/qandroidplatformoffscreensurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -41,21 +41,26 @@
#define QANDROIDPLATFORMOFFSCREENSURFACETEXTURE_H
#include <qpa/qplatformoffscreensurface.h>
-#include <QtGui/private/qeglplatformcontext_p.h>
+#include <QtGui/qoffscreensurface_platform.h>
+
+#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
class QOffscreenSurface;
-class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface
+class QAndroidPlatformOffscreenSurface : public QPlatformOffscreenSurface,
+ public QNativeInterface::QAndroidOffscreenSurface
{
public:
- QAndroidPlatformOffscreenSurface(EGLDisplay display, const QSurfaceFormat &format,
- QOffscreenSurface *offscreenSurface);
+ QAndroidPlatformOffscreenSurface(ANativeWindow *nativeSurface, EGLDisplay display, QOffscreenSurface *offscreenSurface);
~QAndroidPlatformOffscreenSurface();
QSurfaceFormat format() const override { return m_format; }
bool isValid() const override { return m_surface != EGL_NO_SURFACE; }
EGLSurface surface() const { return m_surface; }
+
+ ANativeWindow *nativeSurface() const override { return (ANativeWindow *)surface(); };
+
private:
QSurfaceFormat m_format;
EGLDisplay m_display;
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index 330330a638..c51fbaf1d3 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -76,9 +76,8 @@ EGLSurface QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(QPlatform
if (surface->surface()->surfaceClass() == QSurface::Window) {
return static_cast<QAndroidPlatformOpenGLWindow *>(surface)->eglSurface(eglConfig());
} else {
- auto platformOffscreenSurface = static_cast<QPlatformOffscreenSurface*>(surface);
- if (platformOffscreenSurface->offscreenSurface()->nativeHandle())
- return static_cast<QAndroidPlatformOffscreenSurface *>(surface)->surface();
+ if (auto *platformOffscreenSurface = dynamic_cast<QAndroidPlatformOffscreenSurface *>(surface))
+ return platformOffscreenSurface->surface();
else
return static_cast<QEGLPbuffer *>(surface)->pbuffer();
}
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index d3a8a53241..30a967cc26 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -304,7 +304,7 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
attributeIterator = item.find(QLatin1String("defaultBackgroundColor"));
if (attributeIterator != item.constEnd())
- palette.setColor(QPalette::Background, QRgb(int(attributeIterator.value().toDouble())));
+ palette.setColor(QPalette::Window, QRgb(int(attributeIterator.value().toDouble())));
attributeIterator = item.find(QLatin1String("TextAppearance_textColor"));
if (attributeIterator != item.constEnd())
@@ -464,7 +464,7 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
&& m_androidStyleData) {
return QStringList(QLatin1String("android"));
}
- return QStringList(QLatin1String("fusion"));
+ return QStringList(QLatin1String("Fusion"));
case DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::AndroidLayout);
case MouseDoubleClickDistance:
diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
index d752b539a0..10d45dd0e9 100644
--- a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
+++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
@@ -41,6 +41,7 @@
#include "qbsdfbscreen.h"
#include <QtFbSupport/private/qfbcursor_p.h>
#include <QtFbSupport/private/qfbwindow_p.h>
+#include <QtCore/QFile>
#include <QtCore/QRegularExpression>
#include <QtGui/QPainter>
diff --git a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
index ee40e32033..d42cf811d5 100644
--- a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
@@ -67,7 +67,7 @@ set(qcocoaresources_resource_files
"images/waitcursor.png"
)
-qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
+qt_internal_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
PREFIX
"/qt-project.org/mac/cursors"
FILES
@@ -81,23 +81,23 @@ qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
## Scopes:
#####################################################################
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qcocoaglcontext.h qcocoaglcontext.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qcocoavulkaninstance.h qcocoavulkaninstance.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
qcocoaaccessibility.h qcocoaaccessibility.mm
qcocoaaccessibilityelement.h qcocoaaccessibilityelement.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qcocoasessionmanager.cpp qcocoasessionmanager.h
)
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt
index 51d7038950..d9832c2c6c 100644
--- a/src/plugins/platforms/cocoa/CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/CMakeLists.txt
@@ -77,7 +77,7 @@ set(qcocoaresources_resource_files
"images/waitcursor.png"
)
-qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
+qt_internal_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
PREFIX
"/qt-project.org/mac/cursors"
FILES
@@ -91,23 +91,23 @@ qt_add_resource(QCocoaIntegrationPlugin "qcocoaresources"
## Scopes:
#####################################################################
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qcocoaglcontext.h qcocoaglcontext.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qcocoavulkaninstance.h qcocoavulkaninstance.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
qcocoaaccessibility.h qcocoaaccessibility.mm
qcocoaaccessibilityelement.h qcocoaaccessibilityelement.mm
)
-qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qcocoasessionmanager.cpp qcocoasessionmanager.h
)
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 62f2cc30e0..e6e46cda81 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -92,10 +92,6 @@
#include <qpa/qwindowsysteminterface.h>
#include <qwindowdefs.h>
-QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcQpaApplication, "qt.qpa.application");
-QT_END_NAMESPACE
-
QT_USE_NAMESPACE
@implementation QCocoaApplicationDelegate {
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index c29ab2d8f8..b96bb1e3dc 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -58,21 +58,6 @@ protected:
QCFType<CGColorSpaceRef> colorSpace() const;
};
-class QNSWindowBackingStore : public QCocoaBackingStore
-{
-public:
- QNSWindowBackingStore(QWindow *window);
- ~QNSWindowBackingStore();
-
- void resize(const QSize &size, const QRegion &staticContents) override;
- void flush(QWindow *, const QRegion &, const QPoint &) override;
-
-private:
- bool windowHasUnifiedToolbar() const;
- QImage::Format format() const override;
- void redrawRoundedBottomCorners(CGRect) const;
-};
-
class QCALayerBackingStore : public QObject, public QCocoaBackingStore
{
Q_OBJECT
@@ -96,6 +81,9 @@ public:
QPlatformGraphicsBuffer *graphicsBuffer() const override;
private:
+ void observeBackingPropertiesChanges();
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
QSize m_requestedSize;
QRegion m_paintedRegion;
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 26cab9aa58..01787da1af 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -64,297 +64,43 @@ QCFType<CGColorSpaceRef> QCocoaBackingStore::colorSpace() const
// ----------------------------------------------------------------------------
-QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window)
+QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
: QCocoaBackingStore(window)
{
- // Choose an appropriate window depth based on the requested surface format.
- // On deep color displays the default bit depth is 16-bit, so unless we need
- // that level of precision we opt out of it (and the expensive RGB32 -> RGB64
- // conversions that come with it if our backingstore depth does not match).
-
- NSWindow *nsWindow = static_cast<QCocoaWindow *>(window->handle())->view().window;
- auto colorSpaceName = NSColorSpaceFromDepth(nsWindow.depthLimit);
-
- static const int kDefaultBitDepth = 8;
- auto surfaceFormat = window->requestedFormat();
- auto bitsPerSample = qMax(kDefaultBitDepth, qMax(surfaceFormat.redBufferSize(),
- qMax(surfaceFormat.greenBufferSize(), surfaceFormat.blueBufferSize())));
-
- // NSBestDepth does not seem to guarantee a window depth deep enough for the
- // given bits per sample, even if documented as such. For example, requesting
- // 10 bits per sample will not give us a 16-bit format, even if that's what's
- // available. Work around this by manually bumping the bit depth.
- bitsPerSample = !(bitsPerSample & (bitsPerSample - 1))
- ? bitsPerSample : qNextPowerOfTwo(bitsPerSample);
-
- auto bestDepth = NSBestDepth(colorSpaceName, bitsPerSample, 0, NO, nullptr);
-
- // Disable dynamic depth limit, otherwise our depth limit will be overwritten
- // by AppKit if the window moves to a screen with a different depth. We call
- // this before setting the depth limit, as the call will reset the depth to 0.
- [nsWindow setDynamicDepthLimit:NO];
-
- qCDebug(lcQpaBackingStore) << "Using" << NSBitsPerSampleFromDepth(bestDepth)
- << "bit window depth for" << nsWindow;
+ qCDebug(lcQpaBackingStore) << "Creating QCALayerBackingStore for" << window;
+ m_buffers.resize(1);
- nsWindow.depthLimit = bestDepth;
+ observeBackingPropertiesChanges();
+ window->installEventFilter(this);
}
-QNSWindowBackingStore::~QNSWindowBackingStore()
+QCALayerBackingStore::~QCALayerBackingStore()
{
}
-bool QNSWindowBackingStore::windowHasUnifiedToolbar() const
+void QCALayerBackingStore::observeBackingPropertiesChanges()
{
Q_ASSERT(window()->handle());
- return static_cast<QCocoaWindow *>(window()->handle())->m_drawContentBorderGradient;
-}
-
-QImage::Format QNSWindowBackingStore::format() const
-{
- if (windowHasUnifiedToolbar())
- return QImage::Format_ARGB32_Premultiplied;
-
- return QRasterBackingStore::format();
-}
-
-void QNSWindowBackingStore::resize(const QSize &size, const QRegion &staticContents)
-{
- qCDebug(lcQpaBackingStore) << "Resize requested to" << size;
- QRasterBackingStore::resize(size, staticContents);
-
- // The window shadow rendered by AppKit is based on the shape/content of the
- // NSWindow surface. Technically any flush of the backingstore can result in
- // a potentially new shape of the window, and would need a shadow invalidation,
- // but this is likely too expensive to do at every flush for the few cases where
- // clients change the shape dynamically. One case where we do know that the shadow
- // likely needs invalidation, if the window has partially transparent content,
- // is after a resize, where AppKit's default shadow may be based on the previous
- // window content.
- QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
- if (cocoaWindow->isContentView() && !cocoaWindow->isOpaque())
- cocoaWindow->m_needsInvalidateShadow = true;
-}
-
-/*!
- Flushes the given \a region from the specified \a window onto the
- screen.
-
- The \a window is the top level window represented by this backingstore,
- or a non-transient child of that window.
-
- If the \a window is a child window, the \a region will be in child window
- coordinates, and the \a offset will be the child window's offset in relation
- to the backingstore's top level window.
-*/
-void QNSWindowBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
-{
- if (m_image.isNull())
- return;
-
- // Use local pool so that any stale image references are cleaned up after flushing
- QMacAutoReleasePool pool;
-
- const QWindow *topLevelWindow = this->window();
-
- Q_ASSERT(topLevelWindow->handle() && window->handle());
- Q_ASSERT(!topLevelWindow->handle()->isForeignWindow() && !window->handle()->isForeignWindow());
-
- QNSView *topLevelView = qnsview_cast(static_cast<QCocoaWindow *>(topLevelWindow->handle())->view());
- QNSView *view = qnsview_cast(static_cast<QCocoaWindow *>(window->handle())->view());
-
- if (lcQpaBackingStore().isDebugEnabled()) {
- QString targetViewDescription;
- if (view != topLevelView) {
- QDebug targetDebug(&targetViewDescription);
- targetDebug << "onto" << topLevelView << "at" << offset;
- }
- qCDebug(lcQpaBackingStore) << "Flushing" << region << "of" << view << qPrintable(targetViewDescription);
- }
-
- // Normally a NSView is drawn via drawRect, as part of the display cycle in the
- // main runloop, via setNeedsDisplay and friends. AppKit will lock focus on each
- // individual view, starting with the top level and then traversing any subviews,
- // calling drawRect for each of them. This pull model results in expose events
- // sent to Qt, which result in drawing to the backingstore and flushing it.
- // Qt may also decide to paint and flush the backingstore via e.g. timers,
- // or other events such as mouse events, in which case we're in a push model.
- // If there is no focused view, it means we're in the latter case, and need
- // to manually flush the NSWindow after drawing to its graphic context.
- const bool drawingOutsideOfDisplayCycle = ![NSView focusView];
-
- // We also need to ensure the flushed view has focus, so that the graphics
- // context is set up correctly (coordinate system, clipping, etc). Outside
- // of the normal display cycle there is no focused view, as explained above,
- // so we have to handle it manually. There's also a corner case inside the
- // normal display cycle due to way QWidgetRepaintManager composits native child
- // widgets, where we'll get a flush of a native child during the drawRect of
- // its parent/ancestor, and the parent/ancestor being the one locked by AppKit.
- // In this case we also need to lock and unlock focus manually.
- const bool shouldHandleViewLockManually = [NSView focusView] != view;
- if (shouldHandleViewLockManually && !QT_IGNORE_DEPRECATIONS([view lockFocusIfCanDraw])) {
- qWarning() << "failed to lock focus of" << view;
- return;
- }
-
- const qreal devicePixelRatio = m_image.devicePixelRatio();
-
- // If the flushed window is a content view, and we're filling the drawn area
- // completely, or it doesn't have a window background we need to preserve,
- // we can get away with copying instead of blending the backing store.
- QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
- const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
- && (cocoaWindow->isOpaque() || view.window.backgroundColor == NSColor.clearColor)
- ? NSCompositingOperationCopy : NSCompositingOperationSourceOver;
-
-#ifdef QT_DEBUG
- static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults]
- boolForKey:@"QtCocoaDebugBackingStoreFlush"];
-#endif
-
- // -------------------------------------------------------------------------
-
- // The current contexts is typically a NSWindowGraphicsContext, but can be
- // NSBitmapGraphicsContext e.g. when debugging the view hierarchy in Xcode.
- // If we need to distinguish things here in the future, we can use e.g.
- // [NSGraphicsContext drawingToScreen], or the attributes of the context.
- NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
- Q_ASSERT_X(graphicsContext, "QCocoaBackingStore",
- "Focusing the view should give us a current graphics context");
-
- // Tag backingstore image with color space based on the window.
- // Note: This does not copy the underlying image data.
- QCFType<CGImageRef> cgImage = CGImageCreateCopyWithColorSpace(
- QCFType<CGImageRef>(m_image.toCGImage()), colorSpace());
-
- // Create temporary image to use for blitting, without copying image data
- NSImage *backingStoreImage = [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease];
-
- QRegion clippedRegion = region;
- for (QWindow *w = window; w; w = w->parent()) {
- if (!w->mask().isEmpty()) {
- clippedRegion &= w == window ? w->mask()
- : w->mask().translated(window->mapFromGlobal(w->mapToGlobal(QPoint(0, 0))));
- }
- }
-
- for (const QRect &viewLocalRect : clippedRegion) {
- QPoint backingStoreOffset = viewLocalRect.topLeft() + offset;
- QRect backingStoreRect(backingStoreOffset * devicePixelRatio, viewLocalRect.size() * devicePixelRatio);
- if (graphicsContext.flipped) // Flip backingStoreRect to match graphics context
- backingStoreRect.moveTop(m_image.height() - (backingStoreRect.y() + backingStoreRect.height()));
-
- CGRect viewRect = viewLocalRect.toCGRect();
-
- [backingStoreImage drawInRect:viewRect fromRect:backingStoreRect.toCGRect()
- operation:compositingOperation fraction:1.0 respectFlipped:YES hints:nil];
-
-#ifdef QT_DEBUG
- if (Q_UNLIKELY(debugBackingStoreFlush)) {
- [[NSColor colorWithCalibratedRed:drand48() green:drand48() blue:drand48() alpha:0.3] set];
- [NSBezierPath fillRect:viewRect];
-
- if (drawingOutsideOfDisplayCycle) {
- [[[NSColor magentaColor] colorWithAlphaComponent:0.5] set];
- [NSBezierPath strokeLineFromPoint:viewLocalRect.topLeft().toCGPoint()
- toPoint:viewLocalRect.bottomRight().toCGPoint()];
- }
- }
-#endif
- }
-
- // -------------------------------------------------------------------------
-
- if (shouldHandleViewLockManually)
- QT_IGNORE_DEPRECATIONS([view unlockFocus]);
-
- if (drawingOutsideOfDisplayCycle) {
- redrawRoundedBottomCorners([view convertRect:region.boundingRect().toCGRect() toView:nil]);
- QT_IGNORE_DEPRECATIONS([view.window flushWindow]);
- }
-
- // Done flushing to NSWindow backingstore
-
- QCocoaWindow *topLevelCocoaWindow = static_cast<QCocoaWindow *>(topLevelWindow->handle());
- if (Q_UNLIKELY(topLevelCocoaWindow->m_needsInvalidateShadow)) {
- qCDebug(lcQpaBackingStore) << "Invalidating window shadow for" << topLevelCocoaWindow;
- [topLevelView.window invalidateShadow];
- topLevelCocoaWindow->m_needsInvalidateShadow = false;
- }
-}
-
-/*
- When drawing outside of the display cycle, which Qt Widget does a lot,
- we end up drawing over the NSThemeFrame, losing the rounded corners of
- windows in the process.
-
- To work around this, until we've enabled updates via setNeedsDisplay and/or
- enabled layer-backed views, we ask the NSWindow to redraw the bottom corners
- if they intersect with the flushed region.
-
- This is the same logic used internally by e.g [NSView displayIfNeeded],
- [NSRulerView _scrollToMatchContentView], and [NSClipView _immediateScrollToPoint:],
- as well as the workaround used by WebKit to fix a similar bug:
-
- https://trac.webkit.org/changeset/85376/webkit
-*/
-void QNSWindowBackingStore::redrawRoundedBottomCorners(CGRect windowRect) const
-{
-#if !defined(QT_APPLE_NO_PRIVATE_APIS)
- Q_ASSERT(this->window()->handle());
- NSWindow *window = static_cast<QCocoaWindow *>(this->window()->handle())->nativeWindow();
-
- static SEL intersectBottomCornersWithRect = NSSelectorFromString(
- [NSString stringWithFormat:@"_%s%s:", "intersectBottomCorners", "WithRect"]);
- if (NSMethodSignature *signature = [window methodSignatureForSelector:intersectBottomCornersWithRect]) {
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
- invocation.target = window;
- invocation.selector = intersectBottomCornersWithRect;
- [invocation setArgument:&windowRect atIndex:2];
- [invocation invoke];
-
- NSRect cornerOverlap = NSZeroRect;
- [invocation getReturnValue:&cornerOverlap];
- if (!NSIsEmptyRect(cornerOverlap)) {
- static SEL maskRoundedBottomCorners = NSSelectorFromString(
- [NSString stringWithFormat:@"_%s%s:", "maskRounded", "BottomCorners"]);
- if ((signature = [window methodSignatureForSelector:maskRoundedBottomCorners])) {
- invocation = [NSInvocation invocationWithMethodSignature:signature];
- invocation.target = window;
- invocation.selector = maskRoundedBottomCorners;
- [invocation setArgument:&cornerOverlap atIndex:2];
- [invocation invoke];
- }
- }
- }
-#else
- Q_UNUSED(windowRect);
-#endif
-}
-
-// ----------------------------------------------------------------------------
-
-QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
- : QCocoaBackingStore(window)
-{
- qCDebug(lcQpaBackingStore) << "Creating QCALayerBackingStore for" << window;
- m_buffers.resize(1);
-
- // Ideally this would be plumbed from the platform layer to QtGui, and
- // the QBackingStore would be recreated, but we don't have that code yet,
- // so at least make sure we update our backingstore when the backing
- // properties (color space e.g.) are changed.
- NSView *view = static_cast<QCocoaWindow *>(window->handle())->view();
+ NSView *view = static_cast<QCocoaWindow *>(window()->handle())->view();
m_backingPropertiesObserver = QMacNotificationObserver(view.window,
NSWindowDidChangeBackingPropertiesNotification, [this]() {
- qCDebug(lcQpaBackingStore) << "Backing properties for"
- << this->window() << "did change";
backingPropertiesChanged();
});
}
-QCALayerBackingStore::~QCALayerBackingStore()
+bool QCALayerBackingStore::eventFilter(QObject *watched, QEvent *event)
{
+ Q_ASSERT(watched == window());
+
+ if (event->type() == QEvent::PlatformSurface) {
+ auto *surfaceEvent = static_cast<QPlatformSurfaceEvent*>(event);
+ if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated)
+ observeBackingPropertiesChanges();
+ else
+ m_backingPropertiesObserver = QMacNotificationObserver();
+ }
+
+ return false;
}
void QCALayerBackingStore::resize(const QSize &size, const QRegion &staticContents)
@@ -654,6 +400,15 @@ QImage QCALayerBackingStore::toImage() const
void QCALayerBackingStore::backingPropertiesChanged()
{
+ // Ideally this would be plumbed from the platform layer to QtGui, and
+ // the QBackingStore would be recreated, but we don't have that code yet,
+ // so at least make sure we update our backingstore when the backing
+ // properties (color space e.g.) are changed.
+
+ Q_ASSERT(window()->handle());
+
+ qCDebug(lcQpaBackingStore) << "Backing properties for" << window() << "did change";
+
qCDebug(lcQpaBackingStore) << "Updating color space of existing buffers";
for (auto &buffer : m_buffers) {
if (buffer)
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 49812423eb..8d256ae09e 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -181,8 +181,34 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
- (void)updateQtColor
{
- NSColor *color = [mColorPanel color];
- mQtColor = qt_mac_toQColor(color);
+ // Discard the color space and pass the color components to QColor. This
+ // is a good option as long as QColor is color-unmanaged: we preserve the
+ // exact RGB value from the color picker, which is predictable. Further,
+ // painting with the color will reproduce the same color on-screen, as
+ // long as the the same screen is used for selecting the color.
+ NSColor *componentColor = [[mColorPanel color] colorUsingType:NSColorTypeComponentBased];
+ switch (componentColor.colorSpace.colorSpaceModel)
+ {
+ case NSColorSpaceModelGray: {
+ CGFloat white = 0, alpha = 0;
+ [componentColor getWhite:&white alpha:&alpha];
+ mQtColor.setRgbF(white, white, white, alpha);
+ } break;
+ case NSColorSpaceModelRGB: {
+ CGFloat red = 0, green = 0, blue = 0, alpha = 0;
+ [componentColor getRed:&red green:&green blue:&blue alpha:&alpha];
+ mQtColor.setRgbF(red, green, blue, alpha);
+ } break;
+ case NSColorSpaceModelCMYK: {
+ CGFloat cyan = 0, magenta = 0, yellow = 0, black = 0, alpha = 0;
+ [componentColor getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
+ mQtColor.setCmykF(cyan, magenta, yellow, black, alpha);
+ } break;
+ default:
+ qWarning("QNSColorPanelDelegate: Unsupported color space model");
+ break;
+ }
+
if (mHelper)
emit mHelper->currentColorChanged(mQtColor);
}
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h
index a062b92506..eee2692666 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.h
+++ b/src/plugins/platforms/cocoa/qcocoadrag.h
@@ -95,7 +95,7 @@ public:
protected:
bool hasFormat_sys(const QString &mimeType) const;
QStringList formats_sys() const;
- QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const;
+ QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const;
public:
CFStringRef dropPasteboard;
};
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index eed9d3a42b..f681981d34 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -130,6 +130,10 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
m_drag = o;
m_executed_drop_action = Qt::IgnoreAction;
+ QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
+ m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
+ dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
+
if (maybeDragMultipleItems())
return m_executed_drop_action;
@@ -138,10 +142,6 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSImage *dragImage = [NSImage imageFromQImage:pm.toImage()];
Q_ASSERT(dragImage);
- QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
- m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
- dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
-
NSPoint event_location = [m_lastEvent locationInWindow];
NSWindow *theWindow = [m_lastEvent window];
Q_ASSERT(theWindow);
@@ -186,7 +186,7 @@ bool QCocoaDrag::maybeDragMultipleItems()
const auto &qtUrls = m_drag->mimeData()->urls();
NSPasteboard *dragBoard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag];
- if (int(dragBoard.pasteboardItems.count) == 1 && qtUrls.size() <= 1) {
+ if (qtUrls.size() <= 1) {
// Good old -dragImage: works perfectly for this ...
return false;
}
@@ -216,13 +216,18 @@ bool QCocoaDrag::maybeDragMultipleItems()
// 0. We start from URLs, which can be actually in a list (thus technically
// only ONE item in the pasteboard. The fact it's only one does not help, we are
// still getting an exception because of the number of items/images mismatch ...
+ // We only set the image for the first item and nil for the rest, the image already
+ // contains a combined picture for all urls we drag.
+ auto imageOrNil = dragImage;
for (const auto &qtUrl : qtUrls) {
NSURL *nsUrl = qtUrl.toNSURL();
auto *newItem = [[[NSDraggingItem alloc] initWithPasteboardWriter:nsUrl] autorelease];
const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y,
dragImage.size.width,
dragImage.size.height);
- [newItem setDraggingFrame:itemFrame contents:dragImage];
+
+ [newItem setDraggingFrame:itemFrame contents:imageOrNil];
+ imageOrNil = nil;
[dragItems addObject:newItem];
}
// 1. Repeat for non-url items, if any:
@@ -231,7 +236,7 @@ bool QCocoaDrag::maybeDragMultipleItems()
const NSRect itemFrame = NSMakeRect(itemLocation.x, itemLocation.y,
dragImage.size.width,
dragImage.size.height);
- [newItem setDraggingFrame:itemFrame contents:dragImage];
+ [newItem setDraggingFrame:itemFrame contents:imageOrNil];
[dragItems addObject:newItem];
}
@@ -332,7 +337,7 @@ QStringList QCocoaDropData::formats_sys() const
return formats;
}
-QVariant QCocoaDropData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
+QVariant QCocoaDropData::retrieveData_sys(const QString &mimeType, QMetaType type) const
{
QVariant data;
PasteboardRef board;
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
index b8d2532b8e..823633ffb9 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
@@ -115,12 +115,11 @@ public:
~QCocoaEventDispatcher();
bool processEvents(QEventLoop::ProcessEventsFlags flags);
- bool hasPendingEvents();
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
- void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
+ void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object);
bool unregisterTimer(int timerId);
bool unregisterTimers(QObject *object);
QList<TimerInfo> registeredTimers(QObject *object) const;
@@ -129,7 +128,6 @@ public:
void wakeUp();
void interrupt();
- void flush();
static void clearCurrentThreadCocoaEventDispatcherInterruptFlag();
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 0480ec0482..042abae1ca 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -196,7 +196,7 @@ void QCocoaEventDispatcherPrivate::maybeStopCFRunLoopTimer()
runLoopTimerRef = nullptr;
}
-void QCocoaEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)
+void QCocoaEventDispatcher::registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *obj)
{
#ifndef QT_NO_DEBUG
if (timerId < 1 || interval < 0 || !obj) {
@@ -288,13 +288,6 @@ void QCocoaEventDispatcher::unregisterSocketNotifier(QSocketNotifier *notifier)
d->cfSocketNotifier.unregisterSocketNotifier(notifier);
}
-bool QCocoaEventDispatcher::hasPendingEvents()
-{
- extern uint qGlobalPostedEventsCount();
- extern bool qt_is_gui_used; //qapplication.cpp
- return qGlobalPostedEventsCount() || (qt_is_gui_used && !CFRunLoopIsWaiting(CFRunLoopGetMain()));
-}
-
static bool isUserInputEvent(NSEvent* event)
{
switch ([event type]) {
@@ -969,9 +962,6 @@ void QCocoaEventDispatcher::interrupt()
d->cancelWaitForMoreEvents();
}
-void QCocoaEventDispatcher::flush()
-{ }
-
// QTBUG-56746: The behavior of processEvents() has been changed to not clear
// the interrupt flag. Use this function to clear it.
void QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag()
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index d2037923d0..bdf185d275 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -68,8 +68,6 @@
#include <CoreFoundation/CFNumber.h>
-QT_FORWARD_DECLARE_CLASS(QString)
-QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QFileInfo)
QT_FORWARD_DECLARE_CLASS(QWindow)
QT_USE_NAMESPACE
@@ -435,7 +433,7 @@ static QString strippedText(QString s)
Q_UNUSED(sender);
if (mHelper && [mSavePanel isVisible]) {
QString selection = QString::fromNSString([[mSavePanel URL] path]);
- if (selection != mCurrentSelection) {
+ if (selection != *mCurrentSelection) {
*mCurrentSelection = selection;
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
}
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 0e8f09ab30..e1c9d0a194 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -66,7 +66,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
QString family(QCFString((CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute)));
QString style(QCFString(((CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute))));
- newFont = QFontDatabase().font(family, style, pSize);
+ newFont = QFontDatabase::font(family, style, pSize);
newFont.setUnderline(resolveFont.underline());
newFont.setStrikeOut(resolveFont.strikeOut());
}
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 9dbd1a11bf..633b9256c8 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
class QCocoaWindow;
-class QCocoaGLContext : public QPlatformOpenGLContext, public QPlatformInterface::QCocoaGLContext
+class QCocoaGLContext : public QPlatformOpenGLContext, public QNativeInterface::QCocoaGLContext
{
public:
QCocoaGLContext(QOpenGLContext *context);
@@ -81,7 +81,6 @@ private:
static NSOpenGLPixelFormat *pixelFormatForSurfaceFormat(const QSurfaceFormat &format);
bool setDrawable(QPlatformSurface *surface);
- void prepareDrawable(QCocoaWindow *platformWindow);
void updateSurfaceFormat();
NSOpenGLContext *m_context = nil;
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index c2fcb6cdbc..7b0cc3fac3 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -393,8 +393,6 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
if (view == QT_IGNORE_DEPRECATIONS(m_context.view))
return true;
- prepareDrawable(cocoaWindow);
-
// Setting the drawable may happen on a separate thread as a result of
// a call to makeCurrent, so we need to set up the observers before we
// associate the view with the context. That way we will guarantee that
@@ -410,12 +408,8 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
m_updateObservers.clear();
- if (view.layer) {
- m_updateObservers.append(QMacNotificationObserver(view, NSViewFrameDidChangeNotification, updateCallback));
- m_updateObservers.append(QMacNotificationObserver(view.window, NSWindowDidChangeScreenNotification, updateCallback));
- } else {
- m_updateObservers.append(QMacNotificationObserver(view, QT_IGNORE_DEPRECATIONS(NSViewGlobalFrameDidChangeNotification), updateCallback));
- }
+ m_updateObservers.append(QMacNotificationObserver(view, NSViewFrameDidChangeNotification, updateCallback));
+ m_updateObservers.append(QMacNotificationObserver(view.window, NSWindowDidChangeScreenNotification, updateCallback));
m_updateObservers.append(QMacNotificationObserver([NSApplication sharedApplication],
NSApplicationDidChangeScreenParametersNotification, updateCallback));
@@ -437,30 +431,6 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
return true;
}
-void QCocoaGLContext::prepareDrawable(QCocoaWindow *platformWindow)
-{
- // We generally want high-DPI GL surfaces, unless the user has explicitly disabled them
- bool prefersBestResolutionOpenGLSurface = qt_mac_resolveOption(YES,
- platformWindow->window(), "_q_mac_wantsBestResolutionOpenGLSurface",
- "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
-
- auto *view = platformWindow->view();
-
- // The only case we have to opt out ourselves is when using the Apple software renderer
- // in combination with surface-backed views, as these together do not support high-DPI.
- if (prefersBestResolutionOpenGLSurface) {
- int rendererID = 0;
- [m_context getValues:&rendererID forParameter:NSOpenGLContextParameterCurrentRendererID];
- bool isSoftwareRenderer = (rendererID & kCGLRendererIDMatchingMask) == kCGLRendererGenericFloatID;
- if (isSoftwareRenderer && !view.layer) {
- qCInfo(lcQpaOpenGLContext) << "Disabling high resolution GL surface due to software renderer";
- prefersBestResolutionOpenGLSurface = false;
- }
- }
-
- QT_IGNORE_DEPRECATIONS(view.wantsBestResolutionOpenGLSurface) = prefersBestResolutionOpenGLSurface;
-}
-
// NSOpenGLContext is not re-entrant. Even when using separate contexts per thread,
// view, and window, calls into the API will still deadlock. For more information
// see https://openradar.appspot.com/37064579
@@ -494,19 +464,17 @@ void QCocoaGLContext::swapBuffers(QPlatformSurface *surface)
return;
}
- if (QT_IGNORE_DEPRECATIONS(m_context.view).layer) {
- // Flushing an NSOpenGLContext will hit the screen immediately, ignoring
- // any Core Animation transactions in place. This may result in major
- // visual artifacts if the flush happens out of sync with the size
- // of the layer, view, and window reflected by other parts of the UI,
- // e.g. if the application flushes in the resize event or a timer during
- // window resizing, instead of in the expose event.
- auto *cocoaWindow = static_cast<QCocoaWindow *>(surface);
- if (cocoaWindow->geometry().size() != cocoaWindow->m_exposedRect.size()) {
- qCInfo(lcQpaOpenGLContext) << "Window exposed size does not match geometry (yet)."
- << "Skipping flush to avoid visual artifacts.";
- return;
- }
+ // Flushing an NSOpenGLContext will hit the screen immediately, ignoring
+ // any Core Animation transactions in place. This may result in major
+ // visual artifacts if the flush happens out of sync with the size
+ // of the layer, view, and window reflected by other parts of the UI,
+ // e.g. if the application flushes in the resize event or a timer during
+ // window resizing, instead of in the expose event.
+ auto *cocoaWindow = static_cast<QCocoaWindow *>(surface);
+ if (cocoaWindow->geometry().size() != cocoaWindow->m_exposedRect.size()) {
+ qCInfo(lcQpaOpenGLContext) << "Window exposed size does not match geometry (yet)."
+ << "Skipping flush to avoid visual artifacts.";
+ return;
}
QMutexLocker locker(&s_reentrancyMutex);
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index d85db6d9e1..883c409924 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -55,6 +55,7 @@
#include <QtCore/qloggingcategory.h>
#include <QtGui/qpalette.h>
#include <QtGui/qscreen.h>
+#include <qpa/qplatformdialoghelper.h>
#include <objc/runtime.h>
#include <objc/message.h>
@@ -71,6 +72,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow)
Q_DECLARE_LOGGING_CATEGORY(lcQpaDrawing)
Q_DECLARE_LOGGING_CATEGORY(lcQpaMouse)
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaApplication)
class QPixmap;
class QString;
@@ -211,7 +213,7 @@ QT_END_NAMESPACE
- (instancetype)initWithPanelDelegate:(id<QNSPanelDelegate>)panelDelegate;
- (void)dealloc;
-- (NSButton *)createButtonWithTitle:(const char *)title;
+- (NSButton *)createButtonWithTitle:(QPlatformDialogHelper::StandardButton)type;
- (void)layout;
@end
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 446c23be81..389766fdc7 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -59,6 +59,7 @@ Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
Q_LOGGING_CATEGORY(lcQpaDrawing, "qt.qpa.drawing");
Q_LOGGING_CATEGORY(lcQpaMouse, "qt.qpa.input.mouse", QtCriticalMsg);
Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen", QtCriticalMsg);
+Q_LOGGING_CATEGORY(lcQpaApplication, "qt.qpa.application");
//
// Conversion Functions
@@ -392,11 +393,10 @@ QT_END_NAMESPACE
{
if ((self = [super initWithFrame:NSZeroRect])) {
// create OK and Cancel buttons and add these as subviews
- _okButton = [self createButtonWithTitle:"&OK"];
+ _okButton = [self createButtonWithTitle:QPlatformDialogHelper::Ok];
_okButton.action = @selector(onOkClicked);
_okButton.target = panelDelegate;
-
- _cancelButton = [self createButtonWithTitle:"Cancel"];
+ _cancelButton = [self createButtonWithTitle:QPlatformDialogHelper::Cancel];
_cancelButton.action = @selector(onCancelClicked);
_cancelButton.target = panelDelegate;
@@ -420,12 +420,13 @@ QT_END_NAMESPACE
[super dealloc];
}
-- (NSButton *)createButtonWithTitle:(const char *)title
+- (NSButton *)createButtonWithTitle:(QPlatformDialogHelper::StandardButton)type
{
NSButton *button = [[NSButton alloc] initWithFrame:NSZeroRect];
button.buttonType = NSButtonTypeMomentaryLight;
button.bezelStyle = NSBezelStyleRounded;
- const QString &cleanTitle = QPlatformTheme::removeMnemonics(QCoreApplication::translate("QDialogButtonBox", title));
+ const QString &cleanTitle =
+ QPlatformTheme::removeMnemonics(QGuiApplicationPrivate::platformTheme()->standardButtonText(type));
// FIXME: Not obvious, from Cocoa's documentation, that QString::toNSString() makes a deep copy
button.title = (NSString *)cleanTitle.toCFString();
((NSButtonCell *)button.cell).font =
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index f8b9e9fc12..4f1969dd98 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
class QCocoaIntegration : public QObject, public QPlatformIntegration
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QCocoaGLIntegration
+ , public QNativeInterface::Private::QCocoaGLIntegration
#endif
{
Q_OBJECT
@@ -132,6 +132,7 @@ public:
void setApplicationIcon(const QIcon &icon) const override;
void beep() const override;
+ void quit() const override;
void closePopups(QWindow *forWindow = nullptr);
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 4f4373fbac..872d9bb7f1 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -259,8 +259,8 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
// AppKit expects rendering to happen on the main thread, and we can
// easily end up in situations where rendering on secondary threads
// will result in visual artifacts, bugs, or even deadlocks, when
- // building with SDK 10.14 or higher which enbles view layer-backing.
- return QMacVersion::buildSDK() < QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave);
+ // layer-backed.
+ return false;
case OpenGL:
case BufferQueueingOpenGL:
#endif
@@ -333,13 +333,7 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
return nullptr;
}
- QPlatformBackingStore *backingStore = nullptr;
- if (platformWindow->view().layer)
- backingStore = new QCALayerBackingStore(window);
- else
- backingStore = new QNSWindowBackingStore(window);
-
- return backingStore;
+ return new QCALayerBackingStore(window);
}
QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
@@ -494,6 +488,12 @@ void QCocoaIntegration::beep() const
NSBeep();
}
+void QCocoaIntegration::quit() const
+{
+ qCDebug(lcQpaApplication) << "Terminating application";
+ [NSApp terminate:nil];
+}
+
void QCocoaIntegration::closePopups(QWindow *forWindow)
{
for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) {
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
index d1654e84bb..dca7b576f6 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
@@ -454,6 +454,14 @@ const QCocoaKeyMapper::KeyMap &QCocoaKeyMapper::keyMapForKey(VirtualKeyCode virt
qCDebug(lcQpaKeyMapper, "Updating key map for virtual key = 0x%02x!", (uint)virtualKey);
+ // Key mapping via [NSEvent charactersByApplyingModifiers:] only works for key down
+ // events, but we might (wrongly) get into this code path for other key events such
+ // as NSEventTypeFlagsChanged.
+ const bool canMapCocoaEvent = NSApp.currentEvent.type == NSEventTypeKeyDown;
+
+ if (!canMapCocoaEvent)
+ qCWarning(lcQpaKeyMapper) << "Could not map key to character for event" << NSApp.currentEvent;
+
for (int i = 0; i < kNumModifierCombinations; ++i) {
Q_ASSERT(!i || keyMap[i] == 0);
@@ -473,19 +481,19 @@ const QCocoaKeyMapper::KeyMap &QCocoaKeyMapper::keyMapForKey(VirtualKeyCode virt
unicodeKey = QChar(unicodeString[0]);
if (@available(macOS 10.15, *)) {
- // Until we've verified that the Cocoa API works as expected
- // we first run the event through the Carbon APIs and then
- // compare the results to Cocoa.
- Q_ASSERT(NSApp.currentEvent);
- Q_ASSERT(NSApp.currentEvent.type == NSEventTypeKeyDown);
- auto cocoaModifiers = toCocoaModifiers(qtModifiers);
- auto *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers];
- Q_ASSERT(charactersWithModifiers && charactersWithModifiers.length > 0);
- auto cocoaUnicodeKey = QChar([charactersWithModifiers characterAtIndex:0]);
- if (cocoaUnicodeKey != unicodeKey) {
- qCWarning(lcQpaKeyMapper) << "Mismatch between Cocoa" << cocoaUnicodeKey
- << "and Carbon" << unicodeKey << "for virtual key" << virtualKey
- << "with" << qtModifiers;
+ if (canMapCocoaEvent) {
+ // Until we've verified that the Cocoa API works as expected
+ // we first run the event through the Carbon APIs and then
+ // compare the results to Cocoa.
+ auto cocoaModifiers = toCocoaModifiers(qtModifiers);
+ auto *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers];
+ Q_ASSERT(charactersWithModifiers && charactersWithModifiers.length > 0);
+ auto cocoaUnicodeKey = QChar([charactersWithModifiers characterAtIndex:0]);
+ if (cocoaUnicodeKey != unicodeKey) {
+ qCWarning(lcQpaKeyMapper) << "Mismatch between Cocoa" << cocoaUnicodeKey
+ << "and Carbon" << unicodeKey << "for virtual key" << virtualKey
+ << "with" << qtModifiers;
+ }
}
}
@@ -505,7 +513,11 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
{
QList<int> ret;
- auto keyMap = keyMapForKey(event->nativeVirtualKey(), QChar(event->key()));
+ const auto nativeVirtualKey = event->nativeVirtualKey();
+ if (!nativeVirtualKey)
+ return ret;
+
+ auto keyMap = keyMapForKey(nativeVirtualKey, QChar(event->key()));
auto unmodifiedKey = keyMap[Qt::NoModifier];
Q_ASSERT(unmodifiedKey != Qt::Key_unknown);
@@ -514,7 +526,7 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
// The base key, with the complete set of modifiers,
// is always valid, and the first priority.
- ret << int(unmodifiedKey + eventModifiers);
+ ret << int(unmodifiedKey) + int(eventModifiers);
// FIXME: We only compute the first 8 combinations. Why?
for (int i = 1; i < 8; ++i) {
@@ -526,7 +538,7 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
// perfectly, the current candidate modifiers.
auto candidateModifiers = modifierCombinations[i];
if ((eventModifiers & candidateModifiers) == candidateModifiers)
- ret << int(keyAfterApplyingModifiers + (eventModifiers & ~candidateModifiers));
+ ret << int(keyAfterApplyingModifiers) + int(eventModifiers & ~candidateModifiers);
}
return ret;
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 6bd033bfeb..1bf9cface0 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
class QCocoaMenu : public QPlatformMenu, public QCocoaMenuObject
- , public QPlatformInterface::Private::QCocoaMenu
+ , public QNativeInterface::Private::QCocoaMenu
{
public:
QCocoaMenu();
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 8937765f6b..4c7064a845 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -93,7 +93,7 @@ void QCocoaMenu::setMinimumWidth(int width)
void QCocoaMenu::setFont(const QFont &font)
{
- if (font.resolve()) {
+ if (font.resolveMask()) {
NSFont *customMenuFont = [NSFont fontWithName:font.family().toNSString()
size:font.pointSize()];
m_nativeMenu.font = customMenuFont;
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h
index 94333e3bb1..7186e48829 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.h
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class QCocoaWindow;
class QCocoaMenuBar : public QPlatformMenuBar
- , public QPlatformInterface::Private::QCocoaMenuBar
+ , public QNativeInterface::Private::QCocoaMenuBar
{
Q_OBJECT
public:
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 39a124ea44..511c72988a 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -353,9 +353,8 @@ NSMenuItem *QCocoaMenuItem::sync()
#ifndef QT_NO_SHORTCUT
if (accel.count() == 1) {
- auto shortcut = accel[0];
- auto key = Qt::Key(shortcut & ~Qt::KeyboardModifierMask);
- auto modifiers = Qt::KeyboardModifiers(shortcut & Qt::KeyboardModifierMask);
+ auto key = accel[0].key();
+ auto modifiers = accel[0].keyboardModifiers();
QChar cocoaKey = QCocoaKeyMapper::toCocoaKey(key);
if (cocoaKey.isNull())
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 3b5b5fc6f8..a975f2d76c 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -271,7 +271,7 @@ void QCocoaSystemTrayIcon::statusItemClicked()
activationReason = QPlatformSystemTrayIcon::DoubleClick;
} else {
auto mouseButton = cocoaButton2QtButton(mouseEvent);
- if (mouseButton == Qt::MidButton)
+ if (mouseButton == Qt::MiddleButton)
activationReason = QPlatformSystemTrayIcon::MiddleClick;
else if (mouseButton == Qt::RightButton)
activationReason = QPlatformSystemTrayIcon::Context;
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 674a8da60a..f88569df05 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -477,7 +477,7 @@ public:
return QAbstractFileIconEngine::toSizeList(sizes, sizes + sizeof(sizes) / sizeof(sizes[0]));
}
- QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) const override
+ QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) override
{ return QCocoaFileIconEngine::availableIconSizes(); }
protected:
@@ -501,7 +501,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
case QPlatformTheme::StyleNames:
- return QStringList(QStringLiteral("macintosh"));
+ return QStringList(QStringLiteral("macOS"));
case QPlatformTheme::DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::MacLayout);
case KeyboardScheme:
@@ -575,14 +575,14 @@ QList<QKeySequence> QCocoaTheme::keyBindings(QKeySequence::StandardKey key) cons
auto bindings = QPlatformTheme::keyBindings(key);
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- static auto swapCtrlMeta = [](int keySequence) {
- auto originalKeySequence = keySequence;
- keySequence &= ~(Qt::ControlModifier | Qt::MetaModifier);
- if (originalKeySequence & Qt::ControlModifier)
- keySequence |= Qt::MetaModifier;
- if (originalKeySequence & Qt::MetaModifier)
- keySequence |= Qt::ControlModifier;
- return keySequence;
+ static auto swapCtrlMeta = [](QKeyCombination keyCombination) {
+ const auto originalKeyModifiers = keyCombination.keyboardModifiers();
+ auto newKeyboardModifiers = originalKeyModifiers & ~(Qt::ControlModifier | Qt::MetaModifier);
+ if (originalKeyModifiers & Qt::ControlModifier)
+ newKeyboardModifiers |= Qt::MetaModifier;
+ if (originalKeyModifiers & Qt::MetaModifier)
+ newKeyboardModifiers |= Qt::ControlModifier;
+ return QKeyCombination(newKeyboardModifiers, keyCombination.key());
};
QList<QKeySequence> swappedBindings;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 927c3bd751..9a2fa5f025 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -100,7 +100,7 @@ class QDebug;
class QCocoaMenuBar;
class QCocoaWindow : public QObject, public QPlatformWindow,
- public QPlatformInterface::Private::QCocoaWindow
+ public QNativeInterface::Private::QCocoaWindow
{
Q_OBJECT
public:
@@ -261,8 +261,6 @@ public: // for QNSView
bool m_inSetStyleMask;
QCocoaMenuBar *m_menubar;
- bool m_needsInvalidateShadow;
-
bool m_frameStrutEventsEnabled;
QRect m_exposedRect;
int m_registerTouchCount;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 9a6555ca8c..38aa343d4f 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -80,7 +80,7 @@ static void qRegisterNotificationCallbacks()
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
- const QMetaObject *metaObject = QMetaType::metaObjectForType(qRegisterMetaType<QCocoaWindow*>());
+ const QMetaObject *metaObject = QMetaType(qRegisterMetaType<QCocoaWindow*>()).metaObject();
Q_ASSERT(metaObject);
for (int i = 0; i < metaObject->methodCount(); ++i) {
@@ -145,7 +145,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle)
, m_inSetGeometry(false)
, m_inSetStyleMask(false)
, m_menubar(nullptr)
- , m_needsInvalidateShadow(false)
, m_frameStrutEventsEnabled(false)
, m_registerTouchCount(0)
, m_resizableTransientParent(false)
@@ -307,6 +306,9 @@ bool QCocoaWindow::startSystemMove()
case NSEventTypeRightMouseDown:
case NSEventTypeOtherMouseDown:
case NSEventTypeMouseMoved:
+ case NSEventTypeLeftMouseDragged:
+ case NSEventTypeRightMouseDragged:
+ case NSEventTypeOtherMouseDragged:
// The documentation only describes starting a system move
// based on mouse down events, but move events also work.
[m_view.window performWindowDragWithEvent:NSApp.currentEvent];
@@ -1056,27 +1058,15 @@ void QCocoaWindow::setMask(const QRegion &region)
{
qCDebug(lcQpaWindow) << "QCocoaWindow::setMask" << window() << region;
- if (m_view.layer) {
- if (!region.isEmpty()) {
- QCFType<CGMutablePathRef> maskPath = CGPathCreateMutable();
- for (const QRect &r : region)
- CGPathAddRect(maskPath, nullptr, r.toCGRect());
- CAShapeLayer *maskLayer = [CAShapeLayer layer];
- maskLayer.path = maskPath;
- m_view.layer.mask = maskLayer;
- } else {
- m_view.layer.mask = nil;
- }
+ if (!region.isEmpty()) {
+ QCFType<CGMutablePathRef> maskPath = CGPathCreateMutable();
+ for (const QRect &r : region)
+ CGPathAddRect(maskPath, nullptr, r.toCGRect());
+ CAShapeLayer *maskLayer = [CAShapeLayer layer];
+ maskLayer.path = maskPath;
+ m_view.layer.mask = maskLayer;
} else {
- if (isContentView()) {
- // Setting the mask requires invalidating the NSWindow shadow, but that needs
- // to happen after the backingstore has been redrawn, so that AppKit can pick
- // up the new window shape based on the backingstore content. Doing a display
- // directly here is not an option, as the window might not be exposed at this
- // time, and so would not result in an updated backingstore.
- m_needsInvalidateShadow = true;
- [m_view setNeedsDisplay:YES];
- }
+ m_view.layer.mask = nil;
}
}
@@ -1239,15 +1229,18 @@ void QCocoaWindow::windowDidResignKey()
if (isForeignWindow())
return;
- // Key window will be non-nil if another window became key, so do not
- // set the active window to zero here -- the new key window's
- // NSWindowDidBecomeKeyNotification hander will change the active window.
- NSWindow *keyWindow = [NSApp keyWindow];
- if (!keyWindow || keyWindow == m_view.window) {
- // No new key window, go ahead and set the active window to zero
- if (!windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
- nullptr, Qt::ActiveWindowFocusReason);
+ // The current key window will be non-nil if another window became key. If that
+ // window is a Qt window, we delay the window activation event until the didBecomeKey
+ // notification is delivered to the active window, to ensure an atomic update.
+ NSWindow *newKeyWindow = [NSApp keyWindow];
+ if (newKeyWindow && newKeyWindow != m_view.window
+ && [newKeyWindow conformsToProtocol:@protocol(QNSWindowProtocol)])
+ return;
+
+ // Lost key window, go ahead and set the active window to zero
+ if (!windowIsPopupType()) {
+ QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
+ nullptr, Qt::ActiveWindowFocusReason);
}
}
@@ -1673,7 +1666,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
applyContentBorderThickness(nsWindow);
- if (format().colorSpace() == QSurfaceFormat::sRGBColorSpace)
+ if (format().colorSpace() == QColorSpace::SRgb)
nsWindow.colorSpace = NSColorSpace.sRGBColorSpace;
return nsWindow;
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.h b/src/plugins/platforms/cocoa/qmacclipboard.h
index 0cb6239690..df892a2810 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.h
+++ b/src/plugins/platforms/cocoa/qmacclipboard.h
@@ -92,7 +92,7 @@ public:
QStringList formats() const;
bool hasFormat(const QString &format) const;
- QVariant retrieveData(const QString &format, QVariant::Type) const;
+ QVariant retrieveData(const QString &format, QMetaType) const;
void clear();
bool sync() const;
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index 2afd3f6e13..8df4242e70 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -84,7 +84,7 @@ OSStatus PasteboardGetItemCountSafe(PasteboardRef paste, ItemCount *cnt)
class QMacMimeData : public QMimeData
{
public:
- QVariant variantData(const QString &mime) { return retrieveData(mime, QVariant::Invalid); }
+ QVariant variantData(const QString &mime) { return retrieveData(mime, QMetaType()); }
private:
QMacMimeData();
};
@@ -313,7 +313,7 @@ public:
QMacPasteboardMimeSource(const QMacPasteboard *p) : QMimeData(), paste(p) { }
~QMacPasteboardMimeSource() { }
virtual QStringList formats() const { return paste->formats(); }
- virtual QVariant retrieveData(const QString &format, QVariant::Type type) const { return paste->retrieveData(format, type); }
+ virtual QVariant retrieveData(const QString &format, QMetaType type) const { return paste->retrieveData(format, type); }
};
QMimeData
@@ -476,7 +476,7 @@ QMacPasteboard::hasFormat(const QString &format) const
}
QVariant
-QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
+QMacPasteboard::retrieveData(const QString &format, QMetaType) const
{
if (!paste)
return QVariant();
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index 2b9cffa714..d5e5a14835 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -43,7 +43,13 @@
- (void)initDrawing
{
- [self updateLayerBacking];
+ if (qt_mac_resolveOption(-1, m_platformWindow->window(),
+ "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER") != -1) {
+ qCWarning(lcQpaDrawing) << "Layer-backing is always enabled."
+ << " QT_MAC_WANTS_LAYER/_q_mac_wantsLayer has no effect.";
+ }
+
+ self.wantsLayer = YES;
}
- (BOOL)isOpaque
@@ -60,40 +66,6 @@
// ----------------------- Layer setup -----------------------
-- (void)updateLayerBacking
-{
- self.wantsLayer = [self layerEnabledByMacOS]
- || [self layerExplicitlyRequested]
- || [self shouldUseMetalLayer];
-}
-
-- (BOOL)layerEnabledByMacOS
-{
- // AppKit has its own logic for this, but if we rely on that, our layers are created
- // by AppKit at a point where we've already set up other parts of the platform plugin
- // based on the presence of layers or not. Once we've rewritten these parts to support
- // dynamically picking up layer enablement we can let AppKit do its thing.
- return QMacVersion::buildSDK() >= QOperatingSystemVersion::MacOSMojave
- && QMacVersion::currentRuntime() >= QOperatingSystemVersion::MacOSMojave;
-}
-
-- (BOOL)layerExplicitlyRequested
-{
- static bool wantsLayer = [&]() {
- int wantsLayer = qt_mac_resolveOption(-1, m_platformWindow->window(),
- "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER");
-
- if (wantsLayer != -1 && [self layerEnabledByMacOS]) {
- qCWarning(lcQpaDrawing) << "Layer-backing cannot be explicitly controlled on 10.14 when built against the 10.14 SDK";
- return true;
- }
-
- return wantsLayer == 1;
- }();
-
- return wantsLayer;
-}
-
- (BOOL)shouldUseMetalLayer
{
// MetalSurface needs a layer, and so does VulkanSurface (via MoltenVK)
@@ -146,8 +118,7 @@
{
qCDebug(lcQpaDrawing) << "Making" << self
<< (self.wantsLayer ? "layer-backed" : "layer-hosted")
- << "with" << layer << "due to being" << ([self layerExplicitlyRequested] ? "explicitly requested"
- : [self shouldUseMetalLayer] ? "needed by surface type" : "enabled by macOS");
+ << "with" << layer;
if (layer.delegate && layer.delegate != self) {
qCWarning(lcQpaDrawing) << "Layer already has delegate" << layer.delegate
@@ -242,24 +213,9 @@
*/
- (void)drawRect:(NSRect)dirtyBoundingRect
{
+ Q_UNUSED(dirtyBoundingRect);
Q_ASSERT_X(!self.layer, "QNSView",
"The drawRect code path should not be hit when we are layer backed");
-
- if (!m_platformWindow)
- return;
-
- QRegion exposedRegion;
- const NSRect *dirtyRects;
- NSInteger numDirtyRects;
- [self getRectsBeingDrawn:&dirtyRects count:&numDirtyRects];
- for (int i = 0; i < numDirtyRects; ++i)
- exposedRegion += QRectF::fromCGRect(dirtyRects[i]).toRect();
-
- if (exposedRegion.isEmpty())
- exposedRegion = QRectF::fromCGRect(dirtyBoundingRect).toRect();
-
- qCDebug(lcQpaDrawing) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion;
- m_platformWindow->handleExposeEvent(exposedRegion);
}
/*
diff --git a/src/plugins/platforms/cocoa/qnsview_keys.mm b/src/plugins/platforms/cocoa/qnsview_keys.mm
index 37c46204e1..09d78485f4 100644
--- a/src/plugins/platforms/cocoa/qnsview_keys.mm
+++ b/src/plugins/platforms/cocoa/qnsview_keys.mm
@@ -53,11 +53,12 @@
m_inputSource = [characters retain];
}
- // There is no way to get the scan code from carbon/cocoa. But we cannot
- // use the value 0, since it indicates that the event originates from somewhere
- // else than the keyboard.
- quint32 nativeScanCode = 1;
- quint32 nativeVirtualKey = [nsevent keyCode];
+ // Scan codes are hardware dependent codes for each key. There is no way to get these
+ // from Carbon or Cocoa, so leave it 0, as documented in QKeyEvent::nativeScanCode().
+ const quint32 nativeScanCode = 0;
+
+ // Virtual keys on the other hand are mapped to be the same keys on any system
+ const quint32 nativeVirtualKey = nsevent.keyCode;
QChar ch = QChar::ReplacementCharacter;
int keyCode = Qt::Key_unknown;
@@ -192,14 +193,21 @@
- (void)flagsChanged:(NSEvent *)nsevent
{
ulong timestamp = [nsevent timestamp] * 1000;
- ulong modifiers = [nsevent modifierFlags];
- Qt::KeyboardModifiers qmodifiers = QCocoaKeyMapper::fromCocoaModifiers(modifiers);
+ ulong nativeModifiers = [nsevent modifierFlags];
+ Qt::KeyboardModifiers modifiers = QCocoaKeyMapper::fromCocoaModifiers(nativeModifiers);
+
+ // Scan codes are hardware dependent codes for each key. There is no way to get these
+ // from Carbon or Cocoa, so leave it 0, as documented in QKeyEvent::nativeScanCode().
+ const quint32 nativeScanCode = 0;
+
+ // Virtual keys on the other hand are mapped to be the same keys on any system
+ const quint32 nativeVirtualKey = nsevent.keyCode;
// calculate the delta and remember the current modifiers for next time
static ulong m_lastKnownModifiers;
ulong lastKnownModifiers = m_lastKnownModifiers;
- ulong delta = lastKnownModifiers ^ modifiers;
- m_lastKnownModifiers = modifiers;
+ ulong delta = lastKnownModifiers ^ nativeModifiers;
+ m_lastKnownModifiers = nativeModifiers;
struct qt_mac_enum_mapper
{
@@ -225,11 +233,14 @@
else if (qtCode == Qt::Key_Control)
qtCode = Qt::Key_Meta;
}
- QWindowSystemInterface::handleKeyEvent(m_platformWindow->window(),
- timestamp,
- (lastKnownModifiers & mac_mask) ? QEvent::KeyRelease : QEvent::KeyPress,
- qtCode,
- qmodifiers ^ QCocoaKeyMapper::fromCocoaModifiers(mac_mask));
+ QWindowSystemInterface::handleExtendedKeyEvent(m_platformWindow->window(),
+ timestamp,
+ (lastKnownModifiers & mac_mask) ? QEvent::KeyRelease
+ : QEvent::KeyPress,
+ qtCode,
+ modifiers ^ QCocoaKeyMapper::fromCocoaModifiers(mac_mask),
+ nativeScanCode, nativeVirtualKey,
+ nativeModifiers ^ mac_mask);
}
}
diff --git a/src/plugins/platforms/direct2d/CMakeLists.txt b/src/plugins/platforms/direct2d/CMakeLists.txt
new file mode 100644
index 0000000000..3d507af070
--- /dev/null
+++ b/src/plugins/platforms/direct2d/CMakeLists.txt
@@ -0,0 +1,283 @@
+# Generated from direct2d.pro.
+
+#####################################################################
+## QWindowsDirect2DIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWindowsDirect2DIntegrationPlugin
+ OUTPUT_NAME qdirect2d
+ TYPE platforms
+ SOURCES
+ ../windows/qtwindowsglobal.h
+ ../windows/qwin10helpers.cpp ../windows/qwin10helpers.h
+ ../windows/qwindowsapplication.cpp ../windows/qwindowsapplication.h
+ ../windows/qwindowscombase.h
+ ../windows/qwindowscontext.cpp ../windows/qwindowscontext.h
+ ../windows/qwindowscursor.cpp ../windows/qwindowscursor.h
+ ../windows/qwindowsdialoghelpers.cpp ../windows/qwindowsdialoghelpers.h
+ ../windows/qwindowsdropdataobject.cpp ../windows/qwindowsdropdataobject.h
+ ../windows/qwindowsinputcontext.cpp ../windows/qwindowsinputcontext.h
+ ../windows/qwindowsintegration.cpp ../windows/qwindowsintegration.h
+ ../windows/qwindowsinternalmimedata.cpp ../windows/qwindowsinternalmimedata.h
+ ../windows/qwindowskeymapper.cpp ../windows/qwindowskeymapper.h
+ ../windows/qwindowsmenu.cpp ../windows/qwindowsmenu.h
+ ../windows/qwindowsmime.cpp ../windows/qwindowsmime.h
+ ../windows/qwindowsmousehandler.cpp ../windows/qwindowsmousehandler.h
+ ../windows/qwindowsnativeinterface.cpp ../windows/qwindowsnativeinterface.h
+ ../windows/qwindowsole.cpp ../windows/qwindowsole.h
+ ../windows/qwindowsopengltester.cpp ../windows/qwindowsopengltester.h
+ ../windows/qwindowspointerhandler.cpp ../windows/qwindowspointerhandler.h
+ ../windows/qwindowsscreen.cpp ../windows/qwindowsscreen.h
+ ../windows/qwindowsservices.cpp ../windows/qwindowsservices.h
+ ../windows/qwindowstheme.cpp ../windows/qwindowstheme.h
+ ../windows/qwindowsthreadpoolrunner.h
+ ../windows/qwindowswindow.cpp ../windows/qwindowswindow.h
+ qwindowsdirect2dbackingstore.cpp qwindowsdirect2dbackingstore.h
+ qwindowsdirect2dbitmap.cpp qwindowsdirect2dbitmap.h
+ qwindowsdirect2dcontext.cpp qwindowsdirect2dcontext.h
+ qwindowsdirect2ddevicecontext.cpp qwindowsdirect2ddevicecontext.h
+ qwindowsdirect2dhelpers.h
+ qwindowsdirect2dintegration.cpp qwindowsdirect2dintegration.h
+ qwindowsdirect2dnativeinterface.cpp qwindowsdirect2dnativeinterface.h
+ qwindowsdirect2dpaintdevice.cpp qwindowsdirect2dpaintdevice.h
+ qwindowsdirect2dpaintengine.cpp qwindowsdirect2dpaintengine.h
+ qwindowsdirect2dplatformpixmap.cpp qwindowsdirect2dplatformpixmap.h
+ qwindowsdirect2dplatformplugin.cpp
+ qwindowsdirect2dwindow.cpp qwindowsdirect2dwindow.h
+ DEFINES
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_FOREACH
+ INCLUDE_DIRECTORIES
+ ../windows
+ LIBRARIES
+ advapi32
+ d2d1 # special case
+ dwrite # special case
+ gdi32
+ ole32
+ shell32
+ user32
+ winmm
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ d3d11
+ dwmapi
+ dxgi
+ dxguid
+ imm32
+ oleaut32
+ shlwapi
+ version
+ winspool
+ wtsapi32
+)
+
+# Resources:
+set_source_files_properties("../windows/openglblacklists/default.json"
+ PROPERTIES QT_RESOURCE_ALIAS "default.json"
+)
+set(openglblacklists_resource_files
+ "openglblacklists/default.json"
+)
+
+qt_internal_add_resource(QWindowsDirect2DIntegrationPlugin "openglblacklists"
+ PREFIX
+ "/qt-project.org/windows/openglblacklists"
+ BASE
+ "../windows"
+ FILES
+ ${openglblacklists_resource_files}
+)
+
+#### Keys ignored in scope 1:.:.:direct2d.pro:<TRUE>:
+# OTHER_FILES = "direct2d.json"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:direct2d.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
+# PLUGIN_EXTENDS = "-"
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
+ PUBLIC_LIBRARIES
+ opengl32
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION MINGW
+ PUBLIC_LIBRARIES
+ uuid
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_opengl
+ SOURCES
+ ../windows/qwindowsglcontext.cpp ../windows/qwindowsglcontext.h
+ ../windows/qwindowsopenglcontext.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
+ SOURCES
+ ../windows/qwindowssystemtrayicon.cpp ../windows/qwindowssystemtrayicon.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_vulkan
+ SOURCES
+ ../windows/qwindowsvulkaninstance.cpp ../windows/qwindowsvulkaninstance.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_clipboard
+ SOURCES
+ ../windows/qwindowsclipboard.cpp ../windows/qwindowsclipboard.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
+ SOURCES
+ ../windows/qwindowsdrag.cpp ../windows/qwindowsdrag.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_tabletevent
+ SOURCES
+ ../windows/qwindowstabletsupport.cpp ../windows/qwindowstabletsupport.h
+ INCLUDE_DIRECTORIES
+ ${QT_SOURCE_TREE}/src/3rdparty/wintab
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+ SOURCES
+ ../windows/qwindowssessionmanager.cpp ../windows/qwindowssessionmanager.h
+)
+
+if(QT_FEATURE_imageformat_png)
+ # Resources:
+ set_source_files_properties("../windows/images/closedhandcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedhandcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/closedhandcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedhandcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/closedhandcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedhandcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/dragcopycursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragcopycursor_32.png"
+ )
+ set_source_files_properties("../windows/images/dragcopycursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragcopycursor_48.png"
+ )
+ set_source_files_properties("../windows/images/dragcopycursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragcopycursor_64.png"
+ )
+ set_source_files_properties("../windows/images/draglinkcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/draglinkcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/draglinkcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/draglinkcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/draglinkcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/draglinkcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/dragmovecursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragmovecursor_32.png"
+ )
+ set_source_files_properties("../windows/images/dragmovecursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragmovecursor_48.png"
+ )
+ set_source_files_properties("../windows/images/dragmovecursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dragmovecursor_64.png"
+ )
+ set_source_files_properties("../windows/images/openhandcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/openhandcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/openhandcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/openhandcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/openhandcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/openhandcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/splithcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splithcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/splithcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splithcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/splithcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splithcursor_64.png"
+ )
+ set_source_files_properties("../windows/images/splitvcursor_32.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splitvcursor_32.png"
+ )
+ set_source_files_properties("../windows/images/splitvcursor_48.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splitvcursor_48.png"
+ )
+ set_source_files_properties("../windows/images/splitvcursor_64.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/splitvcursor_64.png"
+ )
+ set(cursors_resource_files
+ "images/closedhandcursor_32.png"
+ "images/closedhandcursor_48.png"
+ "images/closedhandcursor_64.png"
+ "images/dragcopycursor_32.png"
+ "images/dragcopycursor_48.png"
+ "images/dragcopycursor_64.png"
+ "images/draglinkcursor_32.png"
+ "images/draglinkcursor_48.png"
+ "images/draglinkcursor_64.png"
+ "images/dragmovecursor_32.png"
+ "images/dragmovecursor_48.png"
+ "images/dragmovecursor_64.png"
+ "images/openhandcursor_32.png"
+ "images/openhandcursor_48.png"
+ "images/openhandcursor_64.png"
+ "images/splithcursor_32.png"
+ "images/splithcursor_48.png"
+ "images/splithcursor_64.png"
+ "images/splitvcursor_32.png"
+ "images/splitvcursor_48.png"
+ "images/splitvcursor_64.png"
+ )
+
+ qt_internal_add_resource(QWindowsDirect2DIntegrationPlugin "cursors"
+ PREFIX
+ "/qt-project.org/windows/cursors"
+ BASE
+ "../windows"
+ FILES
+ ${cursors_resource_files}
+ )
+endif()
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION QT_FEATURE_accessibility
+ SOURCES
+ ../windows/uiautomation/qwindowsuiaaccessibility.cpp ../windows/uiautomation/qwindowsuiaaccessibility.h
+ ../windows/uiautomation/qwindowsuiabaseprovider.cpp ../windows/uiautomation/qwindowsuiabaseprovider.h
+ ../windows/uiautomation/qwindowsuiaexpandcollapseprovider.cpp ../windows/uiautomation/qwindowsuiaexpandcollapseprovider.h
+ ../windows/uiautomation/qwindowsuiagriditemprovider.cpp ../windows/uiautomation/qwindowsuiagriditemprovider.h
+ ../windows/uiautomation/qwindowsuiagridprovider.cpp ../windows/uiautomation/qwindowsuiagridprovider.h
+ ../windows/uiautomation/qwindowsuiainvokeprovider.cpp ../windows/uiautomation/qwindowsuiainvokeprovider.h
+ ../windows/uiautomation/qwindowsuiamainprovider.cpp ../windows/uiautomation/qwindowsuiamainprovider.h
+ ../windows/uiautomation/qwindowsuiaprovidercache.cpp ../windows/uiautomation/qwindowsuiaprovidercache.h
+ ../windows/uiautomation/qwindowsuiarangevalueprovider.cpp ../windows/uiautomation/qwindowsuiarangevalueprovider.h
+ ../windows/uiautomation/qwindowsuiaselectionitemprovider.cpp ../windows/uiautomation/qwindowsuiaselectionitemprovider.h
+ ../windows/uiautomation/qwindowsuiaselectionprovider.cpp ../windows/uiautomation/qwindowsuiaselectionprovider.h
+ ../windows/uiautomation/qwindowsuiatableitemprovider.cpp ../windows/uiautomation/qwindowsuiatableitemprovider.h
+ ../windows/uiautomation/qwindowsuiatableprovider.cpp ../windows/uiautomation/qwindowsuiatableprovider.h
+ ../windows/uiautomation/qwindowsuiatextprovider.cpp ../windows/uiautomation/qwindowsuiatextprovider.h
+ ../windows/uiautomation/qwindowsuiatextrangeprovider.cpp ../windows/uiautomation/qwindowsuiatextrangeprovider.h
+ ../windows/uiautomation/qwindowsuiatoggleprovider.cpp ../windows/uiautomation/qwindowsuiatoggleprovider.h
+ ../windows/uiautomation/qwindowsuiautils.cpp ../windows/uiautomation/qwindowsuiautils.h
+ ../windows/uiautomation/qwindowsuiavalueprovider.cpp ../windows/uiautomation/qwindowsuiavalueprovider.h
+ ../windows/uiautomation/qwindowsuiawindowprovider.cpp ../windows/uiautomation/qwindowsuiawindowprovider.h
+)
+
+qt_internal_extend_target(QWindowsDirect2DIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
+ PUBLIC_LIBRARIES
+ uuid
+)
+
+# begin special case
+if (MINGW)
+ set_source_files_properties(../windows/qwindowspointerhandler.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+endif()
+# end special case
diff --git a/src/plugins/platforms/directfb/.prev_CMakeLists.txt b/src/plugins/platforms/directfb/.prev_CMakeLists.txt
index c6957d57ec..074c9eff3f 100644
--- a/src/plugins/platforms/directfb/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/directfb/.prev_CMakeLists.txt
@@ -32,14 +32,14 @@ qt_internal_add_plugin(QDirectFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
SOURCES
qdirectfb_egl.cpp qdirectfb_egl.h
DEFINES
DIRECTFB_GL_EGL
)
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
DEFINES
DIRECTFB_PLATFORM_HOOKS
)
@@ -47,7 +47,7 @@ qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOK
#### Keys ignored in scope 3:.:.:directfb.pro:NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY:
# QMAKE_LIBDIR = "$$DIRECTFB_PLATFORM_HOOKS_LIBDIR"
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
SOURCES
qdirectfbeglhooks_stub.cpp
)
diff --git a/src/plugins/platforms/directfb/CMakeLists.txt b/src/plugins/platforms/directfb/CMakeLists.txt
index 5e4a2f2baa..c66d8bd169 100644
--- a/src/plugins/platforms/directfb/CMakeLists.txt
+++ b/src/plugins/platforms/directfb/CMakeLists.txt
@@ -38,14 +38,14 @@ qt_internal_add_plugin(QDirectFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION QT_CONFIG___contains___directfb_egl
SOURCES
qdirectfb_egl.cpp qdirectfb_egl.h
DEFINES
DIRECTFB_GL_EGL
)
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
DEFINES
DIRECTFB_PLATFORM_HOOKS
)
@@ -53,7 +53,7 @@ qt_extend_target(QDirectFbIntegrationPlugin CONDITION NOT DIRECTFB_PLATFORM_HOOK
#### Keys ignored in scope 3:.:.:directfb.pro:NOT DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY:
# QMAKE_LIBDIR = "$$DIRECTFB_PLATFORM_HOOKS_LIBDIR"
-qt_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(QDirectFbIntegrationPlugin CONDITION DIRECTFB_PLATFORM_HOOKS_SOURCES_ISEMPTY
SOURCES
qdirectfbeglhooks_stub.cpp
)
diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp
index de84827777..85e7f08917 100644
--- a/src/plugins/platforms/directfb/main.cpp
+++ b/src/plugins/platforms/directfb/main.cpp
@@ -64,7 +64,7 @@ public:
QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- QDirectFbIntegration *integration = 0;
+ QDirectFbIntegration *integration = nullptr;
if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive))
integration = new QDirectFbIntegration;
diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
index 95e6093fab..f38ad8f306 100644
--- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp
+++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
extern QDirectFBEGLHooks platform_hook;
static QDirectFBEGLHooks *hooks = &platform_hook;
#else
-static QDirectFBEGLHooks *hooks = 0;
+static QDirectFBEGLHooks *hooks = nullptr;
#endif
/**
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
index f3e8282101..460596a18c 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
IDirectFB *QDirectFbConvenience::dfbInterface()
{
- static IDirectFB *dfb = 0;
+ static IDirectFB *dfb = nullptr;
if (!dfb) {
DFBResult result = DirectFBCreate(&dfb);
if (result != DFB_OK) {
@@ -136,7 +136,7 @@ Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier
case DIBI_RIGHT: // value is 0x01
return Qt::RightButton;
case DIBI_MIDDLE: // value is 0x02
- return Qt::MidButton;
+ return Qt::MiddleButton;
case 0x03:
return Qt::BackButton;
case 0x04:
@@ -198,7 +198,7 @@ Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mas
buttons |= Qt::LeftButton;
}
if (mask & DIBM_MIDDLE) {
- buttons |= Qt::MidButton;
+ buttons |= Qt::MiddleButton;
}
if (mask & DIBM_RIGHT) {
buttons |= Qt::RightButton;
@@ -247,7 +247,7 @@ QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type)
return QEvent::None;
}
}
-QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0;
+QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = nullptr;
QDirectFbKeyMap *QDirectFbConvenience::keyMap()
{
if (!dfbKeymap)
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h
index 19fc068307..dd10f6bc85 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.h
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h
@@ -98,13 +98,13 @@ template <typename T>
class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >
{
public:
- QDirectFBPointer(T *t = 0)
+ QDirectFBPointer(T *t = nullptr)
: QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t)
{}
T** outPtr()
{
- this->reset(0);
+ this->reset(nullptr);
return &this->d;
}
};
diff --git a/src/plugins/platforms/eglfs/.prev_CMakeLists.txt b/src/plugins/platforms/eglfs/.prev_CMakeLists.txt
index 2fbaf4d018..cd1acc22e2 100644
--- a/src/plugins/platforms/eglfs/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/.prev_CMakeLists.txt
@@ -4,7 +4,7 @@
## EglFSDeviceIntegration Module:
#####################################################################
-qt_add_module(EglFSDeviceIntegration
+qt_internal_add_module(EglFSDeviceIntegration
INTERNAL_MODULE
SOURCES
api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h
@@ -32,12 +32,12 @@ qt_add_module(EglFSDeviceIntegration
## Scopes:
#####################################################################
-qt_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
SOURCES
api/qeglfscontext.cpp api/qeglfscontext_p.h
api/qeglfscursor.cpp api/qeglfscursor_p.h
@@ -45,12 +45,12 @@ qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
Qt::OpenGLPrivate
)
-qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
DEFINES
EGLFS_PLATFORM_HOOKS
)
-qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
DEFINES
EGLFS_PREFERRED_PLUGIN=
)
@@ -62,7 +62,7 @@ if(QT_FEATURE_cursor)
"cursor.json"
)
- qt_add_resource(EglFSDeviceIntegration "cursor"
+ qt_internal_add_resource(EglFSDeviceIntegration "cursor"
PREFIX
"/"
FILES
@@ -70,7 +70,7 @@ if(QT_FEATURE_cursor)
)
endif()
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
SOURCES
api/vulkan/qeglfsvulkaninstance.cpp api/vulkan/qeglfsvulkaninstance_p.h
api/vulkan/qeglfsvulkanwindow.cpp api/vulkan/qeglfsvulkanwindow_p.h
diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt
index f74a15f9e6..81b53ee234 100644
--- a/src/plugins/platforms/eglfs/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/CMakeLists.txt
@@ -1,11 +1,25 @@
# Generated from eglfs.pro.
-qt_find_package(EGL) # special case
+# special case begin
+qt_find_package(EGL)
+
+if(QT_FEATURE_eglfs_gbm)
+ set(_device_integration "eglfs_kms")
+elseif(QT_FEATURE_eglfs_egldevice)
+ set(_device_integration "eglfs_kms_egldevice")
+elseif(QT_FEATURE_eglfs_viv)
+ set(_device_integration "eglfs_viv")
+elseif(QT_FEATURE_eglfs_brcm)
+ set(_device_integration "eglfs_brcm")
+endif()
+
+set(QT_QPA_DEFAULT_EGLFS_INTEGRATION "${_device_integration}" CACHE STRING "Default EGLFS device integration plugin")
+# special case end
#####################################################################
## EglFSDeviceIntegration Module:
#####################################################################
-qt_add_module(EglFSDeviceIntegration
+qt_internal_add_module(EglFSDeviceIntegration
INTERNAL_MODULE
SOURCES
api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h
@@ -18,6 +32,7 @@ qt_add_module(EglFSDeviceIntegration
DEFINES
QT_BUILD_EGL_DEVICE_LIB
QT_EGL_NO_X11
+ EGLFS_PREFERRED_PLUGIN=${QT_QPA_DEFAULT_EGLFS_INTEGRATION} # special case
INCLUDE_DIRECTORIES
api
PUBLIC_LIBRARIES
@@ -34,12 +49,12 @@ qt_add_module(EglFSDeviceIntegration
## Scopes:
#####################################################################
-qt_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
SOURCES
api/qeglfscontext.cpp api/qeglfscontext_p.h
api/qeglfscursor.cpp api/qeglfscursor_p.h
@@ -49,12 +64,12 @@ qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_opengl
# special case begin
# comment out
-#qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
+#qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_PLATFORM_HOOKS_SOURCES_ISEMPTY
#DEFINES
#EGLFS_PLATFORM_HOOKS
#)
-#qt_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
+#qt_internal_extend_target(EglFSDeviceIntegration CONDITION NOT EGLFS_DEVICE_INTEGRATION_ISEMPTY
#DEFINES
#EGLFS_PREFERRED_PLUGIN=
#)
@@ -67,7 +82,7 @@ if(QT_FEATURE_cursor)
"cursor.json"
)
- qt_add_resource(EglFSDeviceIntegration "cursor"
+ qt_internal_add_resource(EglFSDeviceIntegration "cursor"
PREFIX
"/"
FILES
@@ -75,7 +90,7 @@ if(QT_FEATURE_cursor)
)
endif()
-qt_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(EglFSDeviceIntegration CONDITION QT_FEATURE_vulkan
SOURCES
api/vulkan/qeglfsvulkaninstance.cpp api/vulkan/qeglfsvulkaninstance_p.h
api/vulkan/qeglfsvulkanwindow.cpp api/vulkan/qeglfsvulkanwindow_p.h
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 4b5a3c8c70..3ef30f1fa9 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -224,19 +224,12 @@ QSize QEglFSDeviceIntegration::screenSize() const
QDpi QEglFSDeviceIntegration::logicalDpi() const
{
- const QSizeF ps = physicalScreenSize();
- const QSize s = screenSize();
-
- if (!ps.isEmpty() && !s.isEmpty())
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
- else
- return QDpi(100, 100);
+ return QDpi(100, 100);
}
-qreal QEglFSDeviceIntegration::pixelDensity() const
+QDpi QEglFSDeviceIntegration::logicalBaseDpi() const
{
- return qMax(1, qRound(logicalDpi().first / qreal(100)));
+ return QDpi(100, 100);
}
Qt::ScreenOrientation QEglFSDeviceIntegration::nativeOrientation() const
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
index 08447a40ea..29efb75137 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
@@ -80,7 +80,7 @@ public:
virtual QSizeF physicalScreenSize() const;
virtual QSize screenSize() const;
virtual QDpi logicalDpi() const;
- virtual qreal pixelDensity() const;
+ virtual QDpi logicalBaseDpi() const;
virtual Qt::ScreenOrientation nativeOrientation() const;
virtual Qt::ScreenOrientation orientation() const;
virtual int screenDepth() const;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
index 9bc24f36f9..5ba24b107a 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
@@ -70,10 +70,10 @@ class QEvdevKeyboardManager;
class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
#if QT_CONFIG(evdev)
- , public QPlatformInterface::Private::QEvdevKeyMapper
+ , public QNativeInterface::Private::QEvdevKeyMapper
#endif
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QEGLIntegration
+ , public QNativeInterface::Private::QEGLIntegration
#endif
{
public:
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index 81f2e07f6b..0b133c55a7 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
@@ -115,9 +115,9 @@ QDpi QEglFSScreen::logicalDpi() const
return qt_egl_device_integration()->logicalDpi();
}
-qreal QEglFSScreen::pixelDensity() const
+QDpi QEglFSScreen::logicalBaseDpi() const
{
- return qt_egl_device_integration()->pixelDensity();
+ return qt_egl_device_integration()->logicalBaseDpi();
}
Qt::ScreenOrientation QEglFSScreen::nativeOrientation() const
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
index cf4a7afc33..c749beb388 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
@@ -74,7 +74,7 @@ public:
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
- qreal pixelDensity() const override;
+ QDpi logicalBaseDpi() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt
index 7ddcb8993f..827bb51fd3 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt
@@ -22,13 +22,13 @@ if(QT_FEATURE_eglfs_mali)
# add_subdirectory(eglfs_mali) # special case TODO
endif()
if(QT_FEATURE_eglfs_viv)
- # add_subdirectory(eglfs_viv) # special case TODO
+ add_subdirectory(eglfs_viv)
endif()
if(QT_FEATURE_eglfs_rcar)
# add_subdirectory(eglfs_rcar) # special case TODO
endif()
if(QT_FEATURE_eglfs_viv_wl)
- # add_subdirectory(eglfs_viv_wl) # special case TODO
+ add_subdirectory(eglfs_viv_wl)
endif()
if(QT_FEATURE_eglfs_openwfd)
# add_subdirectory(eglfs_openwfd) # special case TODO
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
index 7654034f85..697d92a5ca 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
@@ -75,19 +75,12 @@ QSizeF QEglFSEmulatorScreen::physicalSize() const
QDpi QEglFSEmulatorScreen::logicalDpi() const
{
- const QSizeF ps = m_physicalSize;
- const QSize s = m_geometry.size();
-
- if (!ps.isEmpty() && !s.isEmpty())
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
- else
- return QDpi(100, 100);
+ return logicalBaseDpi();
}
-qreal QEglFSEmulatorScreen::pixelDensity() const
+QDpi QEglFSEmulatorScreen::logicalBaseDpi() const
{
- return m_pixelDensity;
+ return QDpi(100, 100);
}
qreal QEglFSEmulatorScreen::refreshRate() const
@@ -163,9 +156,6 @@ void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description)
m_physicalSize.setHeight(value.toInt());
}
- value = description.value(QLatin1String("pixelDensity"));
- if (!value.isUndefined() && value.isDouble())
- m_pixelDensity = value.toDouble();
value = description.value(QLatin1String("refreshRate"));
if (!value.isUndefined() && value.isDouble())
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h
index c4994720fa..c1d92bf44d 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h
@@ -58,7 +58,7 @@ public:
QImage::Format format() const override;
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
- qreal pixelDensity() const override;
+ QDpi logicalBaseDpi() const override;
qreal refreshRate() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
@@ -74,7 +74,6 @@ private:
int m_depth;
QImage::Format m_format;
QSizeF m_physicalSize;
- float m_pixelDensity;
float m_refreshRate;
Qt::ScreenOrientation m_nativeOrientation;
Qt::ScreenOrientation m_orientation;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..6f1d5f6751
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/.prev_CMakeLists.txt
@@ -0,0 +1,32 @@
+# Generated from eglfs_kms_egldevice.pro.
+
+#####################################################################
+## QEglFSKmsEglDeviceIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QEglFSKmsEglDeviceIntegrationPlugin
+ OUTPUT_NAME qeglfs-kms-egldevice-integration
+ TYPE egldeviceintegrations
+ SOURCES
+ qeglfskmsegldevice.cpp qeglfskmsegldevice.h
+ qeglfskmsegldeviceintegration.cpp qeglfskmsegldeviceintegration.h
+ qeglfskmsegldevicemain.cpp
+ qeglfskmsegldevicescreen.cpp qeglfskmsegldevicescreen.h
+ DEFINES
+ QT_EGL_NO_X11
+ INCLUDE_DIRECTORIES
+ ../../api
+ ../eglfs_kms_support
+ PUBLIC_LIBRARIES
+ Libdrm::Libdrm
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::EglFsKmsSupportPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::KmsSupportPrivate
+)
+
+#### Keys ignored in scope 1:.:.:eglfs_kms_egldevice.pro:<TRUE>:
+# OTHER_FILES = "$$PWD/eglfs_kms_egldevice.json"
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt
index 6f1d5f6751..61b5470cdf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt
@@ -30,3 +30,10 @@ qt_internal_add_plugin(QEglFSKmsEglDeviceIntegrationPlugin
#### Keys ignored in scope 1:.:.:eglfs_kms_egldevice.pro:<TRUE>:
# OTHER_FILES = "$$PWD/eglfs_kms_egldevice.json"
+
+# begin special case
+qt_internal_extend_target(QEglFSKmsEglDeviceIntegrationPlugin
+ CONDITION QNX
+ COMPILE_OPTIONS -fpermissive
+)
+# end special case
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..3d600c52f1
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/.prev_CMakeLists.txt
@@ -0,0 +1,28 @@
+# Generated from eglfs_kms_support.pro.
+
+#####################################################################
+## EglFsKmsSupport Module:
+#####################################################################
+
+qt_internal_add_module(EglFsKmsSupport
+ INTERNAL_MODULE
+ NO_MODULE_HEADERS
+ SOURCES
+ qeglfskmsdevice.cpp qeglfskmsdevice.h
+ qeglfskmseventreader.cpp qeglfskmseventreader.h
+ qeglfskmshelpers.h
+ qeglfskmsintegration.cpp qeglfskmsintegration.h
+ qeglfskmsscreen.cpp qeglfskmsscreen.h
+ DEFINES
+ QT_EGL_NO_X11
+ INCLUDE_DIRECTORIES
+ ../../api
+ PUBLIC_LIBRARIES
+ Libdrm::Libdrm
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::KmsSupportPrivate
+)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt
index ec11b355af..d71f1407f8 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt
@@ -4,7 +4,7 @@
## EglFsKmsSupport Module:
#####################################################################
-qt_add_module(EglFsKmsSupport
+qt_internal_add_module(EglFsKmsSupport
INTERNAL_MODULE
NO_MODULE_HEADERS
SOURCES
@@ -26,3 +26,10 @@ qt_add_module(EglFsKmsSupport
Qt::GuiPrivate
Qt::KmsSupportPrivate
)
+
+# begin special case
+qt_internal_extend_target(EglFsKmsSupport
+ CONDITION QNX
+ COMPILE_OPTIONS -fpermissive
+)
+# end special case
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 59d7ec104c..ad8479d9ad 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -160,14 +160,12 @@ QSizeF QEglFSKmsScreen::physicalSize() const
QDpi QEglFSKmsScreen::logicalDpi() const
{
- const QSizeF ps = physicalSize();
- const QSize s = geometry().size();
-
- if (!ps.isEmpty() && !s.isEmpty())
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
- else
- return QDpi(100, 100);
+ return logicalBaseDpi();
+}
+
+QDpi QEglFSKmsScreen::logicalBaseDpi() const
+{
+ return QDpi(100, 100);
}
Qt::ScreenOrientation QEglFSKmsScreen::nativeOrientation() const
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
index 103476bc54..9f21a9e54b 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
@@ -69,6 +69,7 @@ public:
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
+ QDpi logicalBaseDpi() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h
index 369d175bcf..b3dfa77e1b 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h
@@ -53,7 +53,7 @@
QT_BEGIN_NAMESPACE
class QEglFSKmsVsp2Screen : public QEglFSKmsScreen
- , public QPlatformInterface::Private::QVsp2Screen
+ , public QNativeInterface::Private::QVsp2Screen
{
public:
QEglFSKmsVsp2Screen(QEglFSKmsDevice *device, const QKmsOutput &output);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt
new file mode 100644
index 0000000000..72952c6c5d
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Generated from eglfs_viv.pro.
+
+#####################################################################
+## QEglFSVivIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QEglFSVivIntegrationPlugin
+ OUTPUT_NAME qeglfs-viv-integration
+ TYPE egldeviceintegrations
+ SOURCES
+ qeglfsvivintegration.cpp qeglfsvivintegration.h
+ qeglfsvivmain.cpp
+ DEFINES
+ EGL_API_FB=1
+ LINUX=1
+ INCLUDE_DIRECTORIES
+ ../../api
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+)
+
+#### Keys ignored in scope 1:.:.:eglfs_viv.pro:<TRUE>:
+# OTHER_FILES = "$$PWD/eglfs_viv.json"
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt
new file mode 100644
index 0000000000..269bdde02c
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from eglfs_viv_wl.pro.
+
+#####################################################################
+## QEglFSVivWaylandIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QEglFSVivWaylandIntegrationPlugin
+ OUTPUT_NAME qeglfs-viv-wl-integration
+ TYPE egldeviceintegrations
+ SOURCES
+ qeglfsvivwlintegration.cpp qeglfsvivwlintegration.h
+ qeglfsvivwlmain.cpp
+ DEFINES
+ EGL_API_FB=1
+ LINUX=1
+ INCLUDE_DIRECTORIES
+ ../../api
+ LIBRARIES
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::EglFSDeviceIntegrationPrivate
+ Qt::Gui
+ Qt::GuiPrivate
+)
+
+#### Keys ignored in scope 1:.:.:eglfs_viv_wl.pro:<TRUE>:
+# OTHER_FILES = "$$PWD/eglfs_viv_wl.json"
diff --git a/src/plugins/platforms/integrity/qintegrityhidmanager.h b/src/plugins/platforms/integrity/qintegrityhidmanager.h
index c8780b2dc2..1e421328c2 100644
--- a/src/plugins/platforms/integrity/qintegrityhidmanager.h
+++ b/src/plugins/platforms/integrity/qintegrityhidmanager.h
@@ -52,7 +52,7 @@ class QIntegrityHIDManager : public QThread
{
Q_OBJECT
public:
- QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = 0);
+ QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = nullptr);
~QIntegrityHIDManager();
void run(void);
diff --git a/src/plugins/platforms/ios/.prev_CMakeLists.txt b/src/plugins/platforms/ios/.prev_CMakeLists.txt
index 138f323878..2e494c7d23 100644
--- a/src/plugins/platforms/ios/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/ios/.prev_CMakeLists.txt
@@ -42,12 +42,12 @@ qt_internal_add_plugin(QIOSIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
SOURCES
qiosclipboard.h qiosclipboard.mm
qiosdocumentpickercontroller.h qiosdocumentpickercontroller.mm
diff --git a/src/plugins/platforms/ios/CMakeLists.txt b/src/plugins/platforms/ios/CMakeLists.txt
index 995dcc0a9d..e238cf70fa 100644
--- a/src/plugins/platforms/ios/CMakeLists.txt
+++ b/src/plugins/platforms/ios/CMakeLists.txt
@@ -45,12 +45,12 @@ qt_disable_apple_app_extension_api_only(QIOSIntegrationPlugin)
## Scopes:
#####################################################################
-qt_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
+qt_internal_extend_target(QIOSIntegrationPlugin CONDITION NOT TVOS
SOURCES
qiosclipboard.h qiosclipboard.mm
qiosdocumentpickercontroller.h qiosdocumentpickercontroller.mm
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt
index 526a053b02..1176e34935 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt
@@ -21,6 +21,14 @@ qt_internal_add_plugin(QIosOptionalPlugin_NSPhotoLibrary
Qt::GuiPrivate
)
+# special case begin
+set_target_properties(QIosOptionalPlugin_NSPhotoLibrary
+ PROPERTIES
+ DISABLE_PRECOMPILE_HEADERS ON
+)
+# special case end
+
+
#### Keys ignored in scope 1:.:.:nsphotolibrarysupport.pro:<TRUE>:
# OTHER_FILES = "plugin.json"
# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm
index 8b372b8749..2a3d8c603e 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm
@@ -52,7 +52,7 @@ class QIosOptionalPlugin_NSPhotoLibrary : public QObject, QIosOptionalPluginInte
Q_INTERFACES(QIosOptionalPluginInterface)
public:
- explicit QIosOptionalPlugin_NSPhotoLibrary(QObject* = 0) {};
+ explicit QIosOptionalPlugin_NSPhotoLibrary(QObject * = nullptr) {};
~QIosOptionalPlugin_NSPhotoLibrary() {}
UIViewController* createImagePickerController(QIOSFileDialog *fileDialog) const override
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
index c5244a51ad..01524a00e8 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
@@ -54,7 +54,7 @@ static QThreadStorage<QString> g_iteratorCurrentUrl;
static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache;
static const int kBufferSize = 10;
-static ALAsset *kNoAsset = 0;
+static ALAsset *kNoAsset = nullptr;
static bool ensureAuthorizationDialogNotBlocked()
{
@@ -366,7 +366,7 @@ bool QIOSFileEngineAssetsLibrary::close()
// Delete later, so that we can reuse the asset if a QFile is
// opened with the same path during the same event loop cycle.
m_data->deleteLater();
- m_data = 0;
+ m_data = nullptr;
}
return true;
}
@@ -410,7 +410,7 @@ qint64 QIOSFileEngineAssetsLibrary::read(char *data, qint64 maxlen)
if (!bytesRead)
return 0;
- NSError *error = 0;
+ NSError *error = nullptr;
[[asset defaultRepresentation] getBytes:(uint8_t *)data fromOffset:m_offset length:bytesRead error:&error];
if (error) {
diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm
index 236ca843d8..dc441c7194 100644
--- a/src/plugins/platforms/ios/qiosclipboard.mm
+++ b/src/plugins/platforms/ios/qiosclipboard.mm
@@ -138,7 +138,7 @@ public:
~QIOSMimeData() { }
QStringList formats() const override;
- QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
+ QVariant retrieveData(const QString &mimeType, QMetaType type) const override;
private:
const QClipboard::Mode m_mode;
@@ -160,7 +160,7 @@ QStringList QIOSMimeData::formats() const
return foundMimeTypes;
}
-QVariant QIOSMimeData::retrieveData(const QString &mimeType, QVariant::Type) const
+QVariant QIOSMimeData::retrieveData(const QString &mimeType, QMetaType) const
{
UIPasteboard *pb = [UIPasteboard pasteboardWithQClipboardMode:m_mode];
NSArray<NSString *> *pasteboardTypes = [pb pasteboardTypes];
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index 1f4c78dc74..cdbaa0931d 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -53,7 +53,7 @@ public:
bool processPostedEvents() override;
protected:
- explicit QIOSEventDispatcher(QObject *parent = 0);
+ explicit QIOSEventDispatcher(QObject *parent = nullptr);
};
class QIOSJumpingEventDispatcher : public QIOSEventDispatcher
@@ -61,7 +61,7 @@ class QIOSJumpingEventDispatcher : public QIOSEventDispatcher
Q_OBJECT
public:
- QIOSJumpingEventDispatcher(QObject *parent = 0);
+ QIOSJumpingEventDispatcher(QObject *parent = nullptr);
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
// Public since we can't friend Objective-C methods
@@ -76,4 +76,4 @@ private:
QT_END_NAMESPACE
-#endif // QIOSEVENTDISPATCHER_H \ No newline at end of file
+#endif // QIOSEVENTDISPATCHER_H
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index c5856051de..23aac6ad46 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -473,7 +473,8 @@ bool QIOSEventDispatcher::processPostedEvents()
return false;
QT_APPLE_SCOPED_LOG_ACTIVITY(lcEventDispatcher().isDebugEnabled(), "sendWindowSystemEvents");
- QEventLoop::ProcessEventsFlags flags = QEventLoop::ProcessEventsFlags(m_processEvents.flags.load());
+ QEventLoop::ProcessEventsFlags flags
+ = QEventLoop::ProcessEventsFlags(m_processEvents.flags.loadRelaxed());
qCDebug(lcEventDispatcher) << "Sending window system events for" << flags;
QWindowSystemInterface::sendWindowSystemEvents(flags);
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index a523d1be45..c0428dacb9 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -185,7 +185,7 @@ FirstResponderCandidate::FirstResponderCandidate(UIResponder *responder)
{
}
-UIResponder *FirstResponderCandidate::s_firstResponderCandidate = 0;
+UIResponder *FirstResponderCandidate::s_firstResponderCandidate = nullptr;
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index debdf7a638..36421a57c3 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -76,10 +76,10 @@ struct KeyboardState
struct ImeState
{
- ImeState() : currentState(0), focusObject(0) {}
+ ImeState() = default;
Qt::InputMethodQueries update(Qt::InputMethodQueries properties);
- QInputMethodQueryEvent currentState;
- QObject *focusObject;
+ QInputMethodQueryEvent currentState = QInputMethodQueryEvent({});
+ QObject *focusObject = nullptr;
};
class QIOSInputContext : public QPlatformInputContext
@@ -111,7 +111,7 @@ public:
void scrollToCursor();
void scroll(int y);
- void updateKeyboardState(NSNotification *notification = 0);
+ void updateKeyboardState(NSNotification *notification = nullptr);
const ImeState &imeState() { return m_imeState; }
const KeyboardState &keyboardState() { return m_keyboardState; }
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index d2229df133..0eb12498b4 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -297,7 +297,7 @@ QT_BEGIN_NAMESPACE
Qt::InputMethodQueries ImeState::update(Qt::InputMethodQueries properties)
{
if (!properties)
- return 0;
+ return {};
QInputMethodQueryEvent newState(properties);
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 74a77de757..737d7798ab 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -54,7 +54,7 @@
// m_currentMenu points to the currently visible menu.
// Only one menu will be visible at a time, and if a second menu
// is shown on top of a first, the first one will be told to hide.
-QIOSMenu *QIOSMenu::m_currentMenu = 0;
+QIOSMenu *QIOSMenu::m_currentMenu = nullptr;
// -------------------------------------------------------------------------
@@ -441,7 +441,7 @@ void QIOSMenu::dismiss()
break;
}
- m_currentMenu = 0;
+ m_currentMenu = nullptr;
m_visible = false;
}
@@ -458,13 +458,13 @@ void QIOSMenu::toggleShowUsingUIMenuController(bool show)
Q_ASSERT(m_menuController);
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES];
[m_menuController release];
- m_menuController = 0;
+ m_menuController = nullptr;
}
}
void QIOSMenu::toggleShowUsingUIPickerView(bool show)
{
- static QObject *focusObjectWithPickerView = 0;
+ static QObject *focusObjectWithPickerView = nullptr;
if (show) {
Q_ASSERT(!m_pickerView);
@@ -477,12 +477,12 @@ void QIOSMenu::toggleShowUsingUIPickerView(bool show)
} else {
Q_ASSERT(focusObjectWithPickerView);
focusObjectWithPickerView->removeEventFilter(this);
- focusObjectWithPickerView = 0;
+ focusObjectWithPickerView = nullptr;
Q_ASSERT(m_pickerView);
[m_pickerView listenForKeyboardWillHideNotification:NO];
[m_pickerView release];
- m_pickerView = 0;
+ m_pickerView = nullptr;
qApp->inputMethod()->update(Qt::ImEnabled | Qt::ImPlatformData);
}
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index 80636ab9c6..c7dbe43124 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -213,10 +213,12 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
{
[super traitCollectionDidChange:previousTraitCollection];
- if (self.screen == UIScreen.mainScreen) {
- if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
- QIOSTheme::initializeSystemPalette();
- QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>(nullptr);
+ if (@available(iOS 12, *)) {
+ if (self.screen == UIScreen.mainScreen) {
+ if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
+ QIOSTheme::initializeSystemPalette();
+ QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>(nullptr);
+ }
}
}
}
@@ -243,7 +245,7 @@ static QString deviceModelIdentifier()
char value[size];
sysctlbyname(key, &value, &size, NULL, 0);
- return QString::fromLatin1(value);
+ return QString::fromLatin1(QByteArrayView(value, qsizetype(size)));
#endif
}
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index 1360af9d76..584dd1c8fc 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -160,7 +160,7 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
case QPlatformTheme::StyleNames:
- return QStringList(QStringLiteral("fusion"));
+ return QStringList(QStringLiteral("Fusion"));
case KeyboardScheme:
return QVariant(int(MacKeyboardScheme));
default:
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index f5dd20bace..4c56e03f42 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -394,7 +394,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
<< "xTilt" << qBound(-60.0, altitudeAngle * azimuth.dx, 60.0) << "yTilt" << qBound(-60.0, altitudeAngle * azimuth.dy, 60.0);
QWindowSystemInterface::handleTabletEvent(self.platformWindow->window(), timeStamp, localViewPosition, globalScreenPosition,
// device, pointerType, buttons
- int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton,
+ int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), state == QEventPoint::State::Released ? Qt::NoButton : Qt::LeftButton,
// pressure, xTilt, yTilt
pressure, qBound(-60.0, altitudeAngle * azimuth.dx, 60.0), qBound(-60.0, altitudeAngle * azimuth.dy, 60.0),
// tangentialPressure, rotation, z, uid, modifiers
diff --git a/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt b/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt
index 258b70603e..920404ec77 100644
--- a/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt
@@ -27,12 +27,12 @@ qt_internal_add_plugin(QLinuxFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
SOURCES
qlinuxfbdrmscreen.cpp qlinuxfbdrmscreen.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/linuxfb/CMakeLists.txt b/src/plugins/platforms/linuxfb/CMakeLists.txt
index ea5642f1c0..d903fdc6a7 100644
--- a/src/plugins/platforms/linuxfb/CMakeLists.txt
+++ b/src/plugins/platforms/linuxfb/CMakeLists.txt
@@ -28,12 +28,12 @@ qt_internal_add_plugin(QLinuxFbIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
-qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
+qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate
SOURCES
qlinuxfbdrmscreen.cpp qlinuxfbdrmscreen.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index 1e671ee7fc..3481abb47d 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -53,7 +53,7 @@ class QEvdevKeyboardManager;
class QLinuxFbIntegration : public QPlatformIntegration, public QPlatformNativeInterface
#if QT_CONFIG(evdev)
- , public QPlatformInterface::Private::QEvdevKeyMapper
+ , public QNativeInterface::Private::QEvdevKeyMapper
#endif
{
public:
diff --git a/src/plugins/platforms/minimal/.prev_CMakeLists.txt b/src/plugins/platforms/minimal/.prev_CMakeLists.txt
index bb670b4dd4..b51b64ef99 100644
--- a/src/plugins/platforms/minimal/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/minimal/.prev_CMakeLists.txt
@@ -26,7 +26,7 @@ qt_internal_add_plugin(QMinimalIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
+qt_internal_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
LIBRARIES
WrapFreetype::WrapFreetype
)
diff --git a/src/plugins/platforms/minimal/CMakeLists.txt b/src/plugins/platforms/minimal/CMakeLists.txt
index bf2e644251..3f6945ed26 100644
--- a/src/plugins/platforms/minimal/CMakeLists.txt
+++ b/src/plugins/platforms/minimal/CMakeLists.txt
@@ -29,7 +29,7 @@ qt_internal_add_plugin(QMinimalIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
+qt_internal_extend_target(QMinimalIntegrationPlugin CONDITION QT_FEATURE_freetype
LIBRARIES
WrapFreetype::WrapFreetype
)
diff --git a/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt b/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt
index 15ce608f04..9483f41762 100644
--- a/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/minimalegl/.prev_CMakeLists.txt
@@ -27,7 +27,7 @@ qt_internal_add_plugin(QMinimalEglIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qminimaleglbackingstore.cpp qminimaleglbackingstore.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/minimalegl/CMakeLists.txt b/src/plugins/platforms/minimalegl/CMakeLists.txt
index beb4d54257..1758eb3af0 100644
--- a/src/plugins/platforms/minimalegl/CMakeLists.txt
+++ b/src/plugins/platforms/minimalegl/CMakeLists.txt
@@ -30,7 +30,7 @@ qt_internal_add_plugin(QMinimalEglIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QMinimalEglIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qminimaleglbackingstore.cpp qminimaleglbackingstore.h
PUBLIC_LIBRARIES
diff --git a/src/plugins/platforms/offscreen/.prev_CMakeLists.txt b/src/plugins/platforms/offscreen/.prev_CMakeLists.txt
index c69719dda7..aa827366d3 100644
--- a/src/plugins/platforms/offscreen/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/offscreen/.prev_CMakeLists.txt
@@ -27,9 +27,11 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
+qt_internal_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
SOURCES
qoffscreenintegration_x11.cpp qoffscreenintegration_x11.h
+ LIBRARIES
+ X11::X11
)
#### Keys ignored in scope 3:.:.:offscreen.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
diff --git a/src/plugins/platforms/offscreen/CMakeLists.txt b/src/plugins/platforms/offscreen/CMakeLists.txt
index ee738851e5..160aa7df93 100644
--- a/src/plugins/platforms/offscreen/CMakeLists.txt
+++ b/src/plugins/platforms/offscreen/CMakeLists.txt
@@ -28,9 +28,11 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
+qt_internal_extend_target(QOffscreenIntegrationPlugin CONDITION QT_FEATURE_opengl AND QT_FEATURE_xlib AND NOT QT_FEATURE_opengles2
SOURCES
qoffscreenintegration_x11.cpp qoffscreenintegration_x11.h
+ LIBRARIES
+ X11::X11
)
#### Keys ignored in scope 3:.:.:offscreen.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro
index 8b11e5ca74..6be725af7e 100644
--- a/src/plugins/platforms/offscreen/offscreen.pro
+++ b/src/plugins/platforms/offscreen/offscreen.pro
@@ -19,6 +19,7 @@ OTHER_FILES += offscreen.json
qtConfig(xlib):qtConfig(opengl):!qtConfig(opengles2) {
SOURCES += qoffscreenintegration_x11.cpp
HEADERS += qoffscreenintegration_x11.h
+ QMAKE_USE_PRIVATE += xlib
}
PLUGIN_TYPE = platforms
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
index ef0eb7e9cf..811e025f62 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
@@ -80,25 +80,12 @@ public:
{
}
- bool processEvents(QEventLoop::ProcessEventsFlags flags)
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override
{
bool didSendEvents = BaseEventDispatcher::processEvents(flags);
return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
}
-
- bool hasPendingEvents()
- {
- return BaseEventDispatcher::hasPendingEvents()
- || QWindowSystemInterface::windowSystemEventsQueued();
- }
-
- void flush()
- {
- if (qApp)
- qApp->sendPostedEvents();
- BaseEventDispatcher::flush();
- }
};
QOffscreenIntegration::QOffscreenIntegration()
@@ -186,7 +173,7 @@ public:
{
switch (h) {
case StyleNames:
- return QVariant(QStringList(QStringLiteral("fusion")));
+ return QVariant(QStringList(QStringLiteral("Fusion")));
default:
break;
}
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp
index c866a55dc0..bb4d8aeaa1 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp
@@ -118,13 +118,15 @@ void *QOffscreenX11Integration::nativeResourceForContext(const QByteArray &resou
if (resource.toLower() == QByteArrayLiteral("glxconfig") ) {
if (context) {
QOffscreenX11GLXContext *glxPlatformContext = static_cast<QOffscreenX11GLXContext *>(context->handle());
- return glxPlatformContext->glxConfig();
+ if (glxPlatformContext)
+ return glxPlatformContext->glxConfig();
}
}
if (resource.toLower() == QByteArrayLiteral("glxcontext") ) {
if (context) {
QOffscreenX11GLXContext *glxPlatformContext = static_cast<QOffscreenX11GLXContext *>(context->handle());
- return glxPlatformContext->glxContext();
+ if (glxPlatformContext)
+ return glxPlatformContext->glxContext();
}
}
return nullptr;
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
index 005ac26151..01a75510fb 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
@@ -90,7 +90,7 @@ private:
class QOffscreenX11GLXContextData;
class QOffscreenX11GLXContext : public QPlatformOpenGLContext
- , public QPlatformInterface::QGLXContext
+ , public QNativeInterface::QGLXContext
{
public:
QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGLContext *context);
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.h b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
index 24e28dae96..abacf80f54 100644
--- a/src/plugins/platforms/qnx/qqnxabstractnavigator.h
+++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
@@ -50,7 +50,7 @@ class QQnxAbstractNavigator : public QObject
{
Q_OBJECT
public:
- explicit QQnxAbstractNavigator(QObject *parent = 0);
+ explicit QQnxAbstractNavigator(QObject *parent = nullptr);
~QQnxAbstractNavigator();
bool invokeUrl(const QUrl &url);
diff --git a/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h b/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h
index 24be03b46c..92f6308487 100644
--- a/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h
+++ b/src/plugins/platforms/qnx/qqnxabstractvirtualkeyboard.h
@@ -64,7 +64,7 @@ public:
enum KeyboardMode { Default, Url, Email, Web, NumPunc, Number, Symbol, Phone, Pin, Password, Alphanumeric };
enum EnterKeyType { DefaultReturn, Connect, Done, Go, Join, Next, Search, Send, Submit };
- explicit QQnxAbstractVirtualKeyboard(QObject *parent = 0);
+ explicit QQnxAbstractVirtualKeyboard(QObject *parent = nullptr);
virtual bool showKeyboard() = 0;
virtual bool hideKeyboard() = 0;
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp
index cd05a679b1..b02a989ea8 100644
--- a/src/plugins/platforms/qnx/qqnxbuffer.cpp
+++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp
@@ -77,7 +77,7 @@ QQnxBuffer::QQnxBuffer(screen_buffer_t buffer)
// Get access to buffer's data
errno = 0;
- uchar *dataPtr = 0;
+ uchar *dataPtr = nullptr;
Q_SCREEN_CRITICALERROR(
screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr),
"Failed to query buffer pointer");
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.h b/src/plugins/platforms/qnx/qqnxbuffer.h
index 9ee0d5d60c..4b8adb20db 100644
--- a/src/plugins/platforms/qnx/qqnxbuffer.h
+++ b/src/plugins/platforms/qnx/qqnxbuffer.h
@@ -55,8 +55,8 @@ public:
virtual ~QQnxBuffer();
screen_buffer_t nativeBuffer() const { return m_buffer; }
- const QImage *image() const { return (m_buffer != 0) ? &m_image : 0; }
- QImage *image() { return (m_buffer != 0) ? &m_image : 0; }
+ const QImage *image() const { return (m_buffer != nullptr) ? &m_image : nullptr; }
+ QImage *image() { return (m_buffer != nullptr) ? &m_image : nullptr; }
QRect rect() const { return m_image.rect(); }
diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h
index aa2c118b3a..7cc67f2459 100644
--- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h
+++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.h
@@ -64,7 +64,7 @@ public:
ButtonDown
};
- explicit QQnxButtonEventNotifier(QObject *parent = 0);
+ explicit QQnxButtonEventNotifier(QObject *parent = nullptr);
~QQnxButtonEventNotifier();
public Q_SLOTS:
diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp
index 78174549b1..437417a2d1 100644
--- a/src/plugins/platforms/qnx/qqnxclipboard.cpp
+++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp
@@ -141,9 +141,9 @@ public:
}
protected:
- QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const override
+ QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const override
{
- qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType;
+ qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType.name();
if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0)
return QMimeData::retrieveData(mimetype, preferredType);
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp
index 69391c4fec..783ae2d20e 100644
--- a/src/plugins/platforms/qnx/qqnxglcontext.cpp
+++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
static QEGLPlatformContext::Flags makeFlags()
{
- QEGLPlatformContext::Flags result = 0;
+ QEGLPlatformContext::Flags result = {};
if (!QQnxIntegration::instance()->options().testFlag(QQnxIntegration::SurfacelessEGLContext))
result |= QEGLPlatformContext::NoSurfaceless;
@@ -69,7 +69,7 @@ static QEGLPlatformContext::Flags makeFlags()
}
QQnxGLContext::QQnxGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share)
- : QEGLPlatformContext(format, share, QQnxIntegration::instance()->eglDisplay(), 0, QVariant(),
+ : QEGLPlatformContext(format, share, QQnxIntegration::instance()->eglDisplay(), nullptr,
makeFlags())
{
}
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index ce3a445d7c..79f6273e9f 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -76,8 +76,8 @@
static QQnxInputContext *sInputContextInstance;
static QColor sSelectedColor(0,0xb8,0,85);
-static const input_session_t *sSpellCheckSession = 0;
-static const input_session_t *sInputSession = 0;
+static const input_session_t *sSpellCheckSession = nullptr;
+static const input_session_t *sInputSession = nullptr;
static bool isSessionOkay(input_session_t *ic)
{
return ic !=0 && sInputSession != 0 && ic->component_id == sInputSession->component_id;
@@ -515,13 +515,13 @@ static spannable_string_t *toSpannableString(const QString &text)
}
-static const input_session_t *(*p_ictrl_open_session)(connection_interface_t *) = 0;
-static void (*p_ictrl_close_session)(input_session_t *) = 0;
-static int32_t (*p_ictrl_dispatch_event)(event_t*) = 0;
-static int32_t (*p_imf_client_init)() = 0;
-static void (*p_imf_client_disconnect)() = 0;
-static int32_t (*p_vkb_init_selection_service)() = 0;
-static int32_t (*p_ictrl_get_num_active_sessions)() = 0;
+static const input_session_t *(*p_ictrl_open_session)(connection_interface_t *) = nullptr;
+static void (*p_ictrl_close_session)(input_session_t *) = nullptr;
+static int32_t (*p_ictrl_dispatch_event)(event_t*) = nullptr;
+static int32_t (*p_imf_client_init)() = nullptr;
+static void (*p_imf_client_disconnect)() = nullptr;
+static int32_t (*p_vkb_init_selection_service)() = nullptr;
+static int32_t (*p_ictrl_get_num_active_sessions)() = nullptr;
static bool s_imfInitFailed = false;
static bool imfAvailable()
@@ -602,7 +602,7 @@ QQnxInputContext::~QQnxInputContext()
qInputContextDebug();
Q_ASSERT(sInputContextInstance == this);
- sInputContextInstance = 0;
+ sInputContextInstance = nullptr;
if (!imfAvailable())
return;
@@ -735,7 +735,7 @@ void QQnxInputContext::closeSession()
if (sInputSession) {
p_ictrl_close_session((input_session_t *)sInputSession);
- sInputSession = 0;
+ sInputSession = nullptr;
}
// These are likely already in the right state but this depends on the text control
// having called reset or commit. So, just in case, set them to proper values.
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
index 3e10052459..6bedfaf963 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h
@@ -48,7 +48,7 @@ class QQnxNavigatorEventHandler : public QObject
{
Q_OBJECT
public:
- explicit QQnxNavigatorEventHandler(QObject *parent = 0);
+ explicit QQnxNavigatorEventHandler(QObject *parent = nullptr);
bool handleOrientationCheck(int angle);
void handleOrientationChange(int angle);
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h
index 17c31c096c..a761faea1c 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.h
@@ -51,7 +51,7 @@ class QQnxNavigatorEventNotifier : public QObject
{
Q_OBJECT
public:
- explicit QQnxNavigatorEventNotifier(QQnxNavigatorEventHandler *eventHandler, QObject *parent = 0);
+ explicit QQnxNavigatorEventNotifier(QQnxNavigatorEventHandler *eventHandler, QObject *parent = nullptr);
~QQnxNavigatorEventNotifier();
public Q_SLOTS:
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.h b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
index 3c818f51a6..c58903b6b6 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatorpps.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
@@ -50,7 +50,7 @@ class QQnxNavigatorPps : public QQnxAbstractNavigator
{
Q_OBJECT
public:
- explicit QQnxNavigatorPps(QObject *parent = 0);
+ explicit QQnxNavigatorPps(QObject *parent = nullptr);
~QQnxNavigatorPps();
protected:
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index e70092b97e..fe68927fda 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -89,7 +89,7 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
if (!m_needsPosting)
return;
- QQnxWindow *targetWindow = 0;
+ QQnxWindow *targetWindow = nullptr;
if (window)
targetWindow = static_cast<QQnxWindow *>(window->handle());
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 5653c9ee57..7e971b2d66 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -141,15 +141,25 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
, m_lastButtonState(Qt::NoButton)
, m_lastMouseWindow(0)
, m_touchDevice(0)
+ , m_mouseDevice(0)
, m_eventThread(0)
, m_focusLostTimer(-1)
{
// Create a touch device
- m_touchDevice = new QPointingDevice;
- m_touchDevice->setType(QInputDevice::DeviceType::TouchScreen);
- m_touchDevice->setCapabilities(QPointingDevice::Capability::Position | QPointingDevice::Capability::Area | QPointingDevice::Capability::Pressure | QPointingDevice::Capability::NormalizedPosition);
+ m_touchDevice = new QPointingDevice(
+ QLatin1String("touchscreen"), 1, QInputDevice::DeviceType::TouchScreen,
+ QPointingDevice::PointerType::Finger,
+ QPointingDevice::Capability::Position | QPointingDevice::Capability::Area
+ | QPointingDevice::Capability::Pressure
+ | QPointingDevice::Capability::NormalizedPosition,
+ MaximumTouchPoints, 8);
QWindowSystemInterface::registerInputDevice(m_touchDevice);
+ m_mouseDevice = new QPointingDevice(QLatin1String("mouse"), 2, QInputDevice::DeviceType::Mouse,
+ QPointingDevice::PointerType::Generic,
+ QPointingDevice::Capability::Position, 1, 8);
+ QWindowSystemInterface::registerInputDevice(m_mouseDevice);
+
// initialize array of touch points
for (int i = 0; i < MaximumTouchPoints; i++) {
@@ -377,6 +387,10 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)
screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta),
"Failed to query event wheel delta");
+ long long timestamp;
+ Q_SCREEN_CHECKERROR(screen_get_event_property_llv(event, SCREEN_PROPERTY_TIMESTAMP, &timestamp),
+ "Failed to get timestamp");
+
// Map window handle to top-level QWindow
QWindow *w = QQnxIntegration::instance()->window(qnxWindow);
@@ -414,7 +428,7 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)
if (buttonState & 0x01)
buttons |= Qt::LeftButton;
if (buttonState & 0x02)
- buttons |= Qt::MidButton;
+ buttons |= Qt::MiddleButton;
if (buttonState & 0x04)
buttons |= Qt::RightButton;
if (buttonState & 0x08)
@@ -430,20 +444,55 @@ void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)
if (w) {
// Inject mouse event into Qt only if something has changed.
- if (m_lastGlobalMousePoint != globalPoint ||
- m_lastLocalMousePoint != localPoint ||
- m_lastButtonState != buttons) {
- if (m_lastButtonState != 0 && buttons == 0)
+ if (m_lastGlobalMousePoint != globalPoint || m_lastLocalMousePoint != localPoint) {
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice, localPoint,
+ globalPoint, buttons, Qt::NoButton,
+ QEvent::MouseMove);
+ qScreenEventDebug() << "Qt mouse move, w=" << w << ", (" << localPoint.x() << ","
+ << localPoint.y() << "), b=" << static_cast<int>(buttons);
+ }
+
+ if (m_lastButtonState != buttons) {
+ static const auto supportedButtons = { Qt::LeftButton, Qt::MiddleButton,
+ Qt::RightButton, Qt::ExtraButton1,
+ Qt::ExtraButton2, Qt::ExtraButton3,
+ Qt::ExtraButton4, Qt::ExtraButton5 };
+
+ int releasedButtons = (m_lastButtonState ^ buttons) & ~buttons;
+ for (auto button : supportedButtons) {
+ if (releasedButtons & button) {
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice,
+ localPoint, globalPoint, buttons,
+ button, QEvent::MouseButtonRelease);
+ qScreenEventDebug() << "Qt mouse release, w=" << w << ", (" << localPoint.x()
+ << "," << localPoint.y() << "), b=" << button;
+ }
+ }
+
+ if (m_lastButtonState != 0 && buttons == 0) {
(static_cast<QQnxWindow *>(w->handle()))->handleActivationEvent();
- QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
- qScreenEventDebug() << "Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons);
+ }
+
+ int pressedButtons = (m_lastButtonState ^ buttons) & buttons;
+ for (auto button : supportedButtons) {
+ if (pressedButtons & button) {
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, m_mouseDevice,
+ localPoint, globalPoint, buttons,
+ button, QEvent::MouseButtonPress);
+ qScreenEventDebug() << "Qt mouse press, w=" << w << ", (" << localPoint.x()
+ << "," << localPoint.y() << "), b=" << button;
+ }
+ }
}
if (wheelDelta) {
// Screen only supports a single wheel, so we will assume Vertical orientation for
// now since that is pretty much standard.
- QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical);
- qScreenEventDebug() << "Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
+ QPoint angleDelta(0, wheelDelta);
+ QWindowSystemInterface::handleWheelEvent(w, timestamp, m_mouseDevice, localPoint,
+ globalPoint, QPoint(), angleDelta);
+ qScreenEventDebug() << "Qt wheel, w=" << w << ", (" << localPoint.x() << ","
+ << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
}
}
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
index c20905fe0d..e7ee5e8118 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
@@ -98,6 +98,7 @@ private:
Qt::MouseButtons m_lastButtonState;
screen_window_t m_lastMouseWindow;
QPointingDevice *m_touchDevice;
+ QPointingDevice *m_mouseDevice;
QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints];
QList<QQnxScreenEventFilter*> m_eventFilters;
QQnxScreenEventThread *m_eventThread;
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 22a00d3d40..9d3b921c44 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -566,7 +566,7 @@ void QQnxWindow::removeFromParent()
if (Q_UNLIKELY(!m_parentWindow->m_childWindows.removeAll(this)))
qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
else
- m_parentWindow = 0;
+ m_parentWindow = nullptr;
} else if (m_screen) {
m_screen->removeWindow(this);
}
@@ -634,7 +634,7 @@ void QQnxWindow::lower()
void QQnxWindow::requestActivateWindow()
{
- QQnxWindow *focusWindow = 0;
+ QQnxWindow *focusWindow = nullptr;
if (QGuiApplication::focusWindow())
focusWindow = static_cast<QQnxWindow*>(QGuiApplication::focusWindow()->handle());
@@ -664,7 +664,7 @@ void QQnxWindow::requestActivateWindow()
platformScreen->rootWindow()->m_windowGroupName == currentWindow->m_parentGroupName) {
currentWindow = platformScreen->rootWindow();
} else {
- currentWindow = 0;
+ currentWindow = nullptr;
}
}
diff --git a/src/plugins/platforms/vnc/.prev_CMakeLists.txt b/src/plugins/platforms/vnc/.prev_CMakeLists.txt
index ab11e57f0d..48e172ed70 100644
--- a/src/plugins/platforms/vnc/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/vnc/.prev_CMakeLists.txt
@@ -30,7 +30,7 @@ qt_internal_add_plugin(QVncIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
diff --git a/src/plugins/platforms/vnc/CMakeLists.txt b/src/plugins/platforms/vnc/CMakeLists.txt
index 5024459cf4..f3782b5434 100644
--- a/src/plugins/platforms/vnc/CMakeLists.txt
+++ b/src/plugins/platforms/vnc/CMakeLists.txt
@@ -31,7 +31,7 @@ qt_internal_add_plugin(QVncIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
+qt_internal_extend_target(QVncIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate
PUBLIC_LIBRARIES
Qt::InputSupportPrivate
)
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index aea8d26983..d1dc6634af 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -425,7 +425,7 @@ bool QRfbPointerEvent::read(QTcpSocket *s)
if (buttonMask & 1)
buttons |= Qt::LeftButton;
if (buttonMask & 2)
- buttons |= Qt::MidButton;
+ buttons |= Qt::MiddleButton;
if (buttonMask & 4)
buttons |= Qt::RightButton;
@@ -606,8 +606,11 @@ void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window)
void QVncClientCursor::addClient(QVncClient *client)
{
- if (!clients.contains(client))
+ if (!clients.contains(client)) {
clients.append(client);
+ // Force a cursor update when the client connects.
+ client->setDirtyCursor();
+ }
}
uint QVncClientCursor::removeClient(QVncClient *client)
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index 4ea69a3e78..9a16ae7719 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -454,9 +454,9 @@ void QWasmCompositor::drawFrameWindow(QWasmFrameOptions options, QPainter *paint
const QColor &c2 = options.palette.shadow().color();
const QColor &c3 = options.palette.midlight().color();
const QColor &c4 = options.palette.dark().color();
- const QBrush *fill = 0;
+ const QBrush *fill = nullptr;
- const qreal devicePixelRatio = painter->device()->devicePixelRatioF();
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
const qreal inverseScale = qreal(1) / devicePixelRatio;
painter->scale(inverseScale, inverseScale);
@@ -599,7 +599,7 @@ void QWasmCompositor::drawShadePanel(QWasmTitleBarOptions options, QPainter *pai
int w = options.rect.width();
int h = options.rect.height();
- const qreal devicePixelRatio = painter->device()->devicePixelRatioF();
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
const qreal inverseScale = qreal(1) / devicePixelRatio;
painter->scale(inverseScale, inverseScale);
diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
index 2e1b083557..1902f8a4a7 100644
--- a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp
@@ -30,6 +30,7 @@
#include "qwasmeventdispatcher.h"
#include <QtCore/qcoreapplication.h>
+#include <QtGui/qpa/qwindowsysteminterface.h>
#include <emscripten.h>
@@ -144,7 +145,8 @@ void QWasmEventDispatcher::doMaintainTimers()
// native timer.
// Schedule a zero-timer to continue processing any pending events.
- if (!m_hasZeroTimer && hasPendingEvents()) {
+ extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
+ if (!m_hasZeroTimer && (qGlobalPostedEventsCount() || QWindowSystemInterface::windowSystemEventsQueued())) {
auto callback = [](void *eventDispatcher) {
QWasmEventDispatcher *that = static_cast<QWasmEventDispatcher *>(eventDispatcher);
that->m_hasZeroTimer = false;
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
index 2387f3cdea..82dd00bb65 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
@@ -337,6 +337,27 @@ QWasmEventTranslator::QWasmEventTranslator(QWasmScreen *screen)
initEventHandlers();
}
+QWasmEventTranslator::~QWasmEventTranslator()
+{
+ // deregister event handlers
+ QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8();
+ emscripten_set_keydown_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_keyup_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_mousedown_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_mouseup_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_mousemove_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_focus_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_wheel_callback(canvasSelector.constData(), 0, 0, NULL);
+
+ emscripten_set_touchstart_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_touchend_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_touchmove_callback(canvasSelector.constData(), 0, 0, NULL);
+ emscripten_set_touchcancel_callback(canvasSelector.constData(), 0, 0, NULL);
+}
+
void QWasmEventTranslator::initEventHandlers()
{
QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8();
@@ -353,7 +374,7 @@ void QWasmEventTranslator::initEventHandlers()
if (platform == MacOSPlatform) {
g_useNaturalScrolling = false; // make this !default on macOS
- if (emscripten::val::global("window")["safari"].isUndefined()) {
+ if (!emscripten::val::global("window")["safari"].isUndefined()) {
val canvas = screen()->canvas();
canvas.call<void>("addEventListener",
val("wheel"),
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.h b/src/plugins/platforms/wasm/qwasmeventtranslator.h
index f6c95770e9..b02685bedd 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.h
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.h
@@ -49,6 +49,7 @@ class QWasmEventTranslator : public QObject
public:
explicit QWasmEventTranslator(QWasmScreen *screen);
+ ~QWasmEventTranslator();
static int keyboard_cb(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData);
static int mouse_cb(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData);
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 0d196ec099..15d396f479 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -87,6 +87,12 @@ static void qtUpdateDpi()
QWasmIntegration::get()->updateDpi();
}
+static void resizeAllScreens(emscripten::val event)
+{
+ Q_UNUSED(event);
+ QWasmIntegration::get()->resizeAllScreens();
+}
+
EMSCRIPTEN_BINDINGS(qtQWasmIntegraton)
{
function("qtBrowserBeforeUnload", &browserBeforeUnload);
@@ -94,6 +100,7 @@ EMSCRIPTEN_BINDINGS(qtQWasmIntegraton)
function("qtRemoveCanvasElement", &removeCanvasElement);
function("qtResizeCanvasElement", &resizeCanvasElement);
function("qtUpdateDpi", &qtUpdateDpi);
+ function("qtResizeAllScreens", &resizeAllScreens);
}
QWasmIntegration *QWasmIntegration::s_instance;
@@ -136,6 +143,13 @@ QWasmIntegration::QWasmIntegration()
return 0;
};
emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, 1, onWindowResize);
+
+ // install visualViewport resize handler which picks up size and scale change on mobile.
+ emscripten::val visualViewport = emscripten::val::global("window")["visualViewport"];
+ if (!visualViewport.isUndefined()) {
+ visualViewport.call<void>("addEventListener", val("resize"),
+ val::module_property("qtResizeAllScreens"));
+ }
}
QWasmIntegration::~QWasmIntegration()
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index 0f1fd886d0..7b1fc0d42e 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -50,17 +50,21 @@ using namespace emscripten;
QT_BEGIN_NAMESPACE
+const char * QWasmScreen::m_canvasResizeObserverCallbackContextPropertyName = "data-qtCanvasResizeObserverCallbackContext";
+
QWasmScreen::QWasmScreen(const emscripten::val &canvas)
: m_canvas(canvas)
{
m_compositor = new QWasmCompositor(this);
m_eventTranslator = new QWasmEventTranslator(this);
+ installCanvasResizeObserver();
updateQScreenAndCanvasRenderSize();
m_canvas.call<void>("focus");
}
QWasmScreen::~QWasmScreen()
{
+ m_canvas.set(m_canvasResizeObserverCallbackContextPropertyName, emscripten::val(intptr_t(0)));
destroy();
}
@@ -127,12 +131,23 @@ QDpi QWasmScreen::logicalDpi() const
qreal QWasmScreen::devicePixelRatio() const
{
- // FIXME: The effective device pixel ratio may be different from the
- // HTML window dpr if the OpenGL driver/GPU allocates a less than
- // full resolution surface. Use emscripten_webgl_get_drawing_buffer_size()
- // and compute the dpr instead.
- double htmlWindowDpr = emscripten::val::global("window")["devicePixelRatio"].as<double>();
- return qreal(htmlWindowDpr);
+ // window.devicePixelRatio gives us the scale factor between CSS and device pixels.
+ // This property reflects hardware configuration, and also browser zoom on desktop.
+ //
+ // window.visualViewport.scale gives us the zoom factor on mobile. If the html page is
+ // configured with "<meta name="viewport" content="width=device-width">" then this scale
+ // factor will be 1. Omitting the viewport configuration typically results on a zoomed-out
+ // viewport, with a scale factor <1. User pinch-zoom will change the scale factor; an event
+ // handler is installed in the QWasmIntegration constructor. Changing zoom level on desktop
+ // does not appear to change visualViewport.scale.
+ //
+ // The effective devicePixelRatio is the product of these two scale factors, upper-bounded
+ // by window.devicePixelRatio in order to avoid e.g. allocating a 10x widget backing store.
+ double dpr = emscripten::val::global("window")["devicePixelRatio"].as<double>();
+ emscripten::val visualViewport = emscripten::val::global("window")["visualViewport"];
+ double scale = visualViewport.isUndefined() ? 1.0 : visualViewport["scale"].as<double>();
+ double effectiveDevicePixelRatio = std::min(dpr * scale, dpr);
+ return qreal(effectiveDevicePixelRatio);
}
QString QWasmScreen::name() const
@@ -205,4 +220,42 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
m_compositor->redrawWindowContent();
}
+void QWasmScreen::canvasResizeObserverCallback(emscripten::val entries, emscripten::val)
+{
+ int count = entries["length"].as<int>();
+ if (count == 0)
+ return;
+ emscripten::val entry = entries[0];
+ QWasmScreen *screen =
+ reinterpret_cast<QWasmScreen *>(entry["target"][m_canvasResizeObserverCallbackContextPropertyName].as<intptr_t>());
+ if (!screen) {
+ qWarning() << "QWasmScreen::canvasResizeObserverCallback: missing screen pointer";
+ return;
+ }
+
+ // We could access contentBoxSize|contentRect|devicePixelContentBoxSize on the entry here, but
+ // these are not universally supported across all browsers. Get the sizes from the canvas instead.
+ screen->updateQScreenAndCanvasRenderSize();
+}
+
+EMSCRIPTEN_BINDINGS(qtCanvasResizeObserverCallback) {
+ emscripten::function("qtCanvasResizeObserverCallback", &QWasmScreen::canvasResizeObserverCallback);
+}
+
+void QWasmScreen::installCanvasResizeObserver()
+{
+ emscripten::val ResizeObserver = emscripten::val::global("ResizeObserver");
+ if (ResizeObserver == emscripten::val::undefined())
+ return; // ResizeObserver API is not available
+ emscripten::val resizeObserver = ResizeObserver.new_(emscripten::val::module_property("qtCanvasResizeObserverCallback"));
+ if (resizeObserver == emscripten::val::undefined())
+ return; // Something went horribly wrong
+
+ // We need to get back to this instance from the (static) resize callback;
+ // set a "data-" property on the canvas element.
+ m_canvas.set(m_canvasResizeObserverCallbackContextPropertyName, emscripten::val(intptr_t(this)));
+
+ resizeObserver.call<void>("observe", m_canvas);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmscreen.h b/src/plugins/platforms/wasm/qwasmscreen.h
index ea7ffc4193..14d5a2f7d1 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.h
+++ b/src/plugins/platforms/wasm/qwasmscreen.h
@@ -78,6 +78,8 @@ public:
void invalidateSize();
void updateQScreenAndCanvasRenderSize();
+ void installCanvasResizeObserver();
+ static void canvasResizeObserverCallback(emscripten::val entries, emscripten::val);
public slots:
void setGeometry(const QRect &rect);
@@ -90,6 +92,7 @@ private:
int m_depth = 32;
QImage::Format m_format = QImage::Format_RGB32;
QWasmCursor m_cursor;
+ static const char * m_canvasResizeObserverCallbackContextPropertyName;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmtheme.cpp b/src/plugins/platforms/wasm/qwasmtheme.cpp
index 978d60d686..4b99f90591 100644
--- a/src/plugins/platforms/wasm/qwasmtheme.cpp
+++ b/src/plugins/platforms/wasm/qwasmtheme.cpp
@@ -50,7 +50,7 @@ QWasmTheme::~QWasmTheme()
QVariant QWasmTheme::themeHint(ThemeHint hint) const
{
if (hint == QPlatformTheme::StyleNames)
- return QVariant(QStringList() << QLatin1String("fusion"));
+ return QVariant(QStringList() << QLatin1String("Fusion"));
return QPlatformTheme::themeHint(hint);
}
diff --git a/src/plugins/platforms/wasm/wasm_shell.html b/src/plugins/platforms/wasm/wasm_shell.html
index d4bf632830..f5712d0418 100644
--- a/src/plugins/platforms/wasm/wasm_shell.html
+++ b/src/plugins/platforms/wasm/wasm_shell.html
@@ -3,9 +3,16 @@
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+
+ <!--Set visual viewport size for mobile devices to the device size,
+ witch results in a scale of 1 and a 1:1 mapping between CSS pixels
+ and Qt device independent pixels. -->
+ <meta name="viewport" content="width=device-width, height=device-height, user-scalable=0"/>
+
<title>@APPNAME@</title>
<style>
- html, body { padding: 0; margin : 0; overflow:hidden; height: 100% }
+ /* Make the html body cover the entire (visual) viewport with no scroll bars. */
+ html, body { padding: 0; margin: 0; overflow:hidden; height: 100vh }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas { border: 0px none; background-color: white; height:100%; width:100%; }
/* The contenteditable property is set to true for the canvas in order to support
diff --git a/src/plugins/platforms/windows/.prev_CMakeLists.txt b/src/plugins/platforms/windows/.prev_CMakeLists.txt
index d3e488ed20..cbb7bbcaa8 100644
--- a/src/plugins/platforms/windows/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/windows/.prev_CMakeLists.txt
@@ -69,7 +69,7 @@ set(openglblacklists_resource_files
"openglblacklists/default.json"
)
-qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
+qt_internal_add_resource(QWindowsIntegrationPlugin "openglblacklists"
PREFIX
"/qt-project.org/windows/openglblacklists"
FILES
@@ -83,7 +83,7 @@ qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
## Scopes:
#####################################################################
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qwindowsglcontext.cpp qwindowsglcontext.h
qwindowsopenglcontext.h
@@ -94,44 +94,44 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
#### Keys ignored in scope 3:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
# PLUGIN_EXTENDS = "-"
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
PUBLIC_LIBRARIES
opengl32
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
PUBLIC_LIBRARIES
uuid
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
SOURCES
qwindowssystemtrayicon.cpp qwindowssystemtrayicon.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qwindowsvulkaninstance.cpp qwindowsvulkaninstance.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
SOURCES
qwindowsclipboard.cpp qwindowsclipboard.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
SOURCES
qwindowsdrag.cpp qwindowsdrag.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
SOURCES
qwindowstabletsupport.cpp qwindowstabletsupport.h
INCLUDE_DIRECTORIES
${QT_SOURCE_TREE}/src/3rdparty/wintab
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qwindowssessionmanager.cpp qwindowssessionmanager.h
)
@@ -162,7 +162,7 @@ if(QT_FEATURE_imageformat_png)
"images/splitvcursor_64.png"
)
- qt_add_resource(QWindowsIntegrationPlugin "cursors"
+ qt_internal_add_resource(QWindowsIntegrationPlugin "cursors"
PREFIX
"/qt-project.org/windows/cursors"
FILES
@@ -170,7 +170,7 @@ if(QT_FEATURE_imageformat_png)
)
endif()
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
uiautomation/qwindowsuiaaccessibility.cpp uiautomation/qwindowsuiaaccessibility.h
uiautomation/qwindowsuiabaseprovider.cpp uiautomation/qwindowsuiabaseprovider.h
@@ -193,7 +193,7 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
uiautomation/qwindowsuiawindowprovider.cpp uiautomation/qwindowsuiawindowprovider.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
PUBLIC_LIBRARIES
uuid
)
diff --git a/src/plugins/platforms/windows/CMakeLists.txt b/src/plugins/platforms/windows/CMakeLists.txt
index fe12102811..77d2f2a714 100644
--- a/src/plugins/platforms/windows/CMakeLists.txt
+++ b/src/plugins/platforms/windows/CMakeLists.txt
@@ -70,7 +70,7 @@ set(openglblacklists_resource_files
"openglblacklists/default.json"
)
-qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
+qt_internal_add_resource(QWindowsIntegrationPlugin "openglblacklists"
PREFIX
"/qt-project.org/windows/openglblacklists"
FILES
@@ -84,7 +84,7 @@ qt_add_resource(QWindowsIntegrationPlugin "openglblacklists"
## Scopes:
#####################################################################
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qwindowsglcontext.cpp qwindowsglcontext.h
qwindowsopenglcontext.h
@@ -95,44 +95,44 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
#### Keys ignored in scope 3:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
# PLUGIN_EXTENDS = "-"
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl
PUBLIC_LIBRARIES
opengl32
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW
PUBLIC_LIBRARIES
uuid
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_systemtrayicon
SOURCES
qwindowssystemtrayicon.cpp qwindowssystemtrayicon.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_vulkan
SOURCES
qwindowsvulkaninstance.cpp qwindowsvulkaninstance.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard
SOURCES
qwindowsclipboard.cpp qwindowsclipboard.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_clipboard AND QT_FEATURE_draganddrop
SOURCES
qwindowsdrag.cpp qwindowsdrag.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_tabletevent
SOURCES
qwindowstabletsupport.cpp qwindowstabletsupport.h
INCLUDE_DIRECTORIES
${QT_SOURCE_TREE}/src/3rdparty/wintab
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
SOURCES
qwindowssessionmanager.cpp qwindowssessionmanager.h
)
@@ -163,7 +163,7 @@ if(QT_FEATURE_imageformat_png)
"images/splitvcursor_64.png"
)
- qt_add_resource(QWindowsIntegrationPlugin "cursors"
+ qt_internal_add_resource(QWindowsIntegrationPlugin "cursors"
PREFIX
"/qt-project.org/windows/cursors"
FILES
@@ -171,7 +171,7 @@ if(QT_FEATURE_imageformat_png)
)
endif()
-qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
SOURCES
uiautomation/qwindowsuiaaccessibility.cpp uiautomation/qwindowsuiaaccessibility.h
uiautomation/qwindowsuiabaseprovider.cpp uiautomation/qwindowsuiabaseprovider.h
@@ -194,7 +194,13 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessibility
uiautomation/qwindowsuiawindowprovider.cpp uiautomation/qwindowsuiawindowprovider.h
)
-qt_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
+qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility
PUBLIC_LIBRARIES
uuid
)
+
+# begin special case
+if (MINGW)
+ set_source_files_properties(qwindowspointerhandler.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+endif()
+# end special case
diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp
index 94d8470ab1..a3f81ec9fc 100644
--- a/src/plugins/platforms/windows/main.cpp
+++ b/src/plugins/platforms/windows/main.cpp
@@ -101,7 +101,7 @@ class QWindowsIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "windows.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&, int &, char **);
+ QPlatformIntegration *create(const QString &, const QStringList &, int &, char **) override;
};
QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList, int &, char **)
diff --git a/src/plugins/platforms/windows/qwindowsapplication.cpp b/src/plugins/platforms/windows/qwindowsapplication.cpp
index fc495d999f..9997e0a903 100644
--- a/src/plugins/platforms/windows/qwindowsapplication.cpp
+++ b/src/plugins/platforms/windows/qwindowsapplication.cpp
@@ -112,13 +112,13 @@ void QWindowsApplication::setDarkModeHandling(QWindowsApplication::DarkModeHandl
m_darkModeHandling = handling;
}
-void QWindowsApplication::registerMime(QPlatformInterface::Private::QWindowsMime *mime)
+void QWindowsApplication::registerMime(QNativeInterface::Private::QWindowsMime *mime)
{
if (auto ctx = QWindowsContext::instance())
ctx->mimeConverter().registerMime(mime);
}
-void QWindowsApplication::unregisterMime(QPlatformInterface::Private::QWindowsMime *mime)
+void QWindowsApplication::unregisterMime(QNativeInterface::Private::QWindowsMime *mime)
{
if (auto ctx = QWindowsContext::instance())
ctx->mimeConverter().unregisterMime(mime);
diff --git a/src/plugins/platforms/windows/qwindowsapplication.h b/src/plugins/platforms/windows/qwindowsapplication.h
index 25a0cc7437..d57ce263c9 100644
--- a/src/plugins/platforms/windows/qwindowsapplication.h
+++ b/src/plugins/platforms/windows/qwindowsapplication.h
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
-class QWindowsApplication : public QPlatformInterface::Private::QWindowsApplication
+class QWindowsApplication : public QNativeInterface::Private::QWindowsApplication
{
public:
void setTouchWindowTouchType(TouchWindowTouchTypes type) override;
@@ -62,8 +62,8 @@ public:
DarkModeHandling darkModeHandling() const override;
void setDarkModeHandling(DarkModeHandling handling) override;
- void registerMime(QPlatformInterface::Private::QWindowsMime *mime) override;
- void unregisterMime(QPlatformInterface::Private::QWindowsMime *mime) override;
+ void registerMime(QNativeInterface::Private::QWindowsMime *mime) override;
+ void unregisterMime(QNativeInterface::Private::QWindowsMime *mime) override;
int registerMimeType(const QString &mime) override;
diff --git a/src/plugins/platforms/windows/qwindowscombase.h b/src/plugins/platforms/windows/qwindowscombase.h
index bb4b295395..749ad50234 100644
--- a/src/plugins/platforms/windows/qwindowscombase.h
+++ b/src/plugins/platforms/windows/qwindowscombase.h
@@ -85,16 +85,16 @@ public:
explicit QWindowsComBase(ULONG initialRefCount = 1) : m_ref(initialRefCount) {}
virtual ~QWindowsComBase() = default;
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface)
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface) override
{
*iface = nullptr;
return qWindowsComQueryInterface<IUnknown>(this, id, iface) || qWindowsComQueryInterface<ComInterface>(this, id, iface)
? S_OK : E_NOINTERFACE;
}
- ULONG STDMETHODCALLTYPE AddRef() { return ++m_ref; }
+ ULONG STDMETHODCALLTYPE AddRef() override { return ++m_ref; }
- ULONG STDMETHODCALLTYPE Release()
+ ULONG STDMETHODCALLTYPE Release() override
{
if (!--m_ref) {
delete this;
@@ -109,6 +109,7 @@ private:
// Clang does not consider __declspec(nothrow) as nothrow
QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
+QT_WARNING_DISABLE_CLANG("-Wmissing-exception-spec")
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 70827cc57d..fe8b6f7085 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -102,7 +102,7 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c)
HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor)
{
HCURSOR cur = nullptr;
- const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF();
+ const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatio();
if (!qFuzzyCompare(pixmapScaleFactor, 1)) {
pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
@@ -170,7 +170,7 @@ static HCURSOR createBitmapCursor(const QCursor &cursor, qreal scaleFactor = 1)
Q_ASSERT(cursor.shape() == Qt::BitmapCursor && !cursor.bitmap(Qt::ReturnByValue).isNull());
QImage bbits = cursor.bitmap(Qt::ReturnByValue).toImage();
QImage mbits = cursor.mask(Qt::ReturnByValue).toImage();
- scaleFactor /= bbits.devicePixelRatioF();
+ scaleFactor /= bbits.devicePixelRatio();
if (!qFuzzyCompare(scaleFactor, 1)) {
const QSize scaledSize = (QSizeF(bbits.size()) * scaleFactor).toSize();
bbits = bbits.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 16a9110918..0312bde563 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -273,7 +273,7 @@ public:
explicit QWindowsDialogThread(const QWindowsNativeDialogBasePtr &d, HWND owner)
: m_dialog(d), m_owner(owner) {}
- void run();
+ void run() override;
private:
const QWindowsNativeDialogBasePtr m_dialog;
@@ -508,14 +508,20 @@ public:
static IFileDialogEvents *create(QWindowsNativeFileDialogBase *nativeFileDialog);
// IFileDialogEvents methods
- IFACEMETHODIMP OnFileOk(IFileDialog *);
- IFACEMETHODIMP OnFolderChange(IFileDialog *) { return S_OK; }
- IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *);
- IFACEMETHODIMP OnHelp(IFileDialog *) { return S_OK; }
- IFACEMETHODIMP OnSelectionChange(IFileDialog *);
- IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *, FDE_SHAREVIOLATION_RESPONSE *) { return S_OK; }
- IFACEMETHODIMP OnTypeChange(IFileDialog *);
- IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; }
+ IFACEMETHODIMP OnFileOk(IFileDialog *) override;
+ IFACEMETHODIMP OnFolderChange(IFileDialog *) override { return S_OK; }
+ IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *) override;
+ IFACEMETHODIMP OnSelectionChange(IFileDialog *) override;
+ IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *,
+ FDE_SHAREVIOLATION_RESPONSE *) override
+ {
+ return S_OK;
+ }
+ IFACEMETHODIMP OnTypeChange(IFileDialog *) override;
+ IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) override
+ {
+ return S_OK;
+ }
QWindowsNativeFileDialogEventHandler(QWindowsNativeFileDialogBase *nativeFileDialog) :
m_nativeFileDialog(nativeFileDialog) {}
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
index 8686749011..55167ad36d 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
@@ -80,7 +80,7 @@ public:
protected:
QWindowsDialogHelperBase() = default;
QWindowsNativeDialogBase *nativeDialog() const;
- inline bool hasNativeDialog() const { return m_nativeDialog; }
+ inline bool hasNativeDialog() const { return !m_nativeDialog.isNull(); }
void timerEvent(QTimerEvent *) override;
private:
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index bb1e1345dc..f46adf9132 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -190,20 +190,6 @@ static inline Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState)
return modifiers;
}
-static inline Qt::MouseButtons toQtMouseButtons(DWORD keyState)
-{
- Qt::MouseButtons buttons = Qt::NoButton;
-
- if (keyState & MK_LBUTTON)
- buttons |= Qt::LeftButton;
- if (keyState & MK_RBUTTON)
- buttons |= Qt::RightButton;
- if (keyState & MK_MBUTTON)
- buttons |= Qt::MidButton;
-
- return buttons;
-}
-
static Qt::KeyboardModifiers lastModifiers = Qt::NoModifier;
static Qt::MouseButtons lastButtons = Qt::NoButton;
@@ -231,8 +217,8 @@ public:
void createCursors();
// IDropSource methods
- STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState);
- STDMETHOD(GiveFeedback)(DWORD dwEffect);
+ STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState) override;
+ STDMETHOD(GiveFeedback)(DWORD dwEffect) override;
private:
struct CursorEntry {
@@ -386,7 +372,10 @@ void QWindowsOleDropSource::createCursors()
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
{
- Qt::MouseButtons buttons = toQtMouseButtons(grfKeyState);
+ // In some rare cases, when a mouse button is released but the mouse is static,
+ // grfKeyState will not be updated with these released buttons until the mouse
+ // is moved. So we use the async key state given by queryMouseButtons() instead.
+ Qt::MouseButtons buttons = QWindowsMouseHandler::queryMouseButtons();
SCODE result = S_OK;
if (fEscapePressed || QWindowsDrag::isCanceled()) {
@@ -505,7 +494,7 @@ void QWindowsOleDropTarget::handleDrag(QWindow *window, DWORD grfKeyState,
const Qt::DropActions actions = translateToQDragDropActions(*pdwEffect);
lastModifiers = toQtKeyboardModifiers(grfKeyState);
- lastButtons = toQtMouseButtons(grfKeyState);
+ lastButtons = QWindowsMouseHandler::queryMouseButtons();
const QPlatformDragQtResponse response =
QWindowSystemInterface::handleDrag(window, windowsDrag->dropData(),
@@ -603,7 +592,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QWindowsDrag *windowsDrag = QWindowsDrag::instance();
lastModifiers = toQtKeyboardModifiers(grfKeyState);
- lastButtons = toQtMouseButtons(grfKeyState);
+ lastButtons = QWindowsMouseHandler::queryMouseButtons();
const QPlatformDropQtResponse response =
QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(),
diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h
index 5f30c59882..33b583b479 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.h
+++ b/src/plugins/platforms/windows/qwindowsdrag.h
@@ -66,10 +66,12 @@ public:
~QWindowsOleDropTarget() override;
// IDropTarget methods
- STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
- STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
- STDMETHOD(DragLeave)();
- STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
+ STDMETHOD(DragEnter)
+ (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
+ STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
+ STDMETHOD(DragLeave)() override;
+ STDMETHOD(Drop)
+ (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
private:
void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect);
diff --git a/src/plugins/platforms/windows/qwindowsdropdataobject.h b/src/plugins/platforms/windows/qwindowsdropdataobject.h
index 16ba7b036a..407c809243 100644
--- a/src/plugins/platforms/windows/qwindowsdropdataobject.h
+++ b/src/plugins/platforms/windows/qwindowsdropdataobject.h
@@ -51,8 +51,8 @@ public:
~QWindowsDropDataObject() override;
// overridden IDataObject methods
- STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium);
- STDMETHOD(QueryGetData)(LPFORMATETC pformatetc);
+ STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium) override;
+ STDMETHOD(QueryGetData)(LPFORMATETC pformatetc) override;
private:
bool shouldIgnore(LPFORMATETC pformatetc) const;
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index aa93b85289..8c41cc135d 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qsysinfo.h>
+#include <QtGui/qcolorspace.h>
#include <QtGui/qguiapplication.h>
#include <qpa/qplatformnativeinterface.h>
@@ -588,7 +589,7 @@ static int choosePixelFormat(HDC hdc,
iAttributes[i++] = FALSE;
}
// must be the last
- bool srgbRequested = format.colorSpace() == QSurfaceFormat::sRGBColorSpace;
+ bool srgbRequested = format.colorSpace() == QColorSpace::SRgb;
int srgbValuePosition = 0;
if (srgbRequested) {
srgbValuePosition = i;
@@ -710,10 +711,10 @@ static QSurfaceFormat
if (hasSampleBuffers) {
result.setSamples(iValues[13]);
if (hasSrgbSupport && iValues[14])
- result.setColorSpace(QSurfaceFormat::sRGBColorSpace);
+ result.setColorSpace(QColorSpace::SRgb);
} else {
if (hasSrgbSupport && iValues[12])
- result.setColorSpace(QSurfaceFormat::sRGBColorSpace);
+ result.setColorSpace(QColorSpace::SRgb);
}
if (additionalIn) {
if (iValues[7])
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h
index 2970f3d333..0e8383e5c0 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.h
+++ b/src/plugins/platforms/windows/qwindowsglcontext.h
@@ -200,7 +200,7 @@ public:
static QWindowsOpengl32DLL opengl32;
};
-class QWindowsGLContext : public QWindowsOpenGLContext, public QPlatformInterface::QWGLContext
+class QWindowsGLContext : public QWindowsOpenGLContext, public QNativeInterface::QWGLContext
{
public:
explicit QWindowsGLContext(QOpenGLStaticContext *staticContext, QOpenGLContext *context);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 6ec5f6e37f..74e6985980 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -183,8 +183,8 @@ bool parseIntOption(const QString &parameter,const QLatin1String &option,
return true;
}
-using DarkModeHandlingFlag = QPlatformInterface::Private::QWindowsApplication::DarkModeHandlingFlag;
-using DarkModeHandling = QPlatformInterface::Private::QWindowsApplication::DarkModeHandling;
+using DarkModeHandlingFlag = QNativeInterface::Private::QWindowsApplication::DarkModeHandlingFlag;
+using DarkModeHandling = QNativeInterface::Private::QWindowsApplication::DarkModeHandling;
static inline unsigned parseOptions(const QStringList &paramList,
int *tabletAbsoluteRange,
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index eaf62c750d..b5449b4a45 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -58,7 +58,7 @@ class QWindowsStaticOpenGLContext;
class QWindowsIntegration : public QPlatformIntegration
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QWindowsGLIntegration
+ , public QNativeInterface::Private::QWindowsGLIntegration
#endif
, public QWindowsApplication
{
@@ -95,7 +95,8 @@ public:
static QWindowsStaticOpenGLContext *staticOpenGLContext();
HMODULE openGLModuleHandle() const override;
- QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const;
+ QOpenGLContext *createOpenGLContext(HGLRC context, HWND window,
+ QOpenGLContext *shareContext) const override;
#endif
QAbstractEventDispatcher *createEventDispatcher() const override;
void initialize() override;
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
index 21f64f04b6..5f63adba52 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
@@ -90,8 +90,7 @@ QStringList QWindowsInternalMimeData::formats_sys() const
return fmts;
}
-QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
- QVariant::Type type) const
+QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType, QMetaType type) const
{
IDataObject *pDataObj = retrieveDataObject();
if (!pDataObj)
@@ -103,9 +102,9 @@ QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
result = converter->convertToMime(mimeType, pDataObj, type);
releaseDataObject(pDataObj);
if (QWindowsContext::verbose) {
- qCDebug(lcQpaMime) <<__FUNCTION__ << ' ' << mimeType << ' ' << type
- << " returns " << result.type()
- << (result.type() != QVariant::ByteArray ? result.toString() : QStringLiteral("<data>"));
+ qCDebug(lcQpaMime) <<__FUNCTION__ << ' ' << mimeType << ' ' << type.name()
+ << " returns " << result.metaType().name()
+ << (result.userType() != QVariant::ByteArray ? result.toString() : QStringLiteral("<data>"));
}
return result;
}
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
index dbc1ea3922..998b8c871e 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
@@ -54,7 +54,7 @@ class QWindowsInternalMimeData : public QInternalMimeData {
public:
bool hasFormat_sys(const QString &mimetype) const override;
QStringList formats_sys() const override;
- QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const override;
+ QVariant retrieveData_sys(const QString &mimetype, QMetaType preferredType) const override;
protected:
virtual IDataObject *retrieveDataObject() const = 0;
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index bca23cb33e..229e485e22 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -907,7 +907,7 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
// the keys are not passed to the active media player.
# if QT_CONFIG(shortcut)
- const QKeySequence sequence(Qt::Modifier(state) + qtKey);
+ const QKeySequence sequence(Qt::Modifier(state) | Qt::Key(qtKey));
return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
# else
return false;
@@ -1255,7 +1255,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
#ifndef QT_NO_SHORTCUT
// Is Qt interested in the context menu key?
if (modifiers == Qt::SHIFT && code == Qt::Key_F10
- && !QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(QKeySequence(Qt::SHIFT + Qt::Key_F10))) {
+ && !QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(QKeySequence(Qt::SHIFT | Qt::Key_F10))) {
return false;
}
#endif // !QT_NO_SHORTCUT
@@ -1376,17 +1376,17 @@ QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
quint32 baseKey = kbItem.qtKey[0];
Qt::KeyboardModifiers keyMods = e->modifiers();
if (baseKey == Qt::Key_Return && (e->nativeModifiers() & ExtendedKey)) {
- result << int(Qt::Key_Enter + keyMods);
+ result << int(Qt::Key_Enter | keyMods);
return result;
}
- result << int(baseKey + keyMods); // The base key is _always_ valid, of course
+ result << int(baseKey) + int(keyMods); // The base key is _always_ valid, of course
for (size_t i = 1; i < NumMods; ++i) {
Qt::KeyboardModifiers neededMods = ModsTbl[i];
quint32 key = kbItem.qtKey[i];
if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) {
const Qt::KeyboardModifiers missingMods = keyMods & ~neededMods;
- const int matchedKey = int(key) + missingMods;
+ const int matchedKey = int(key) + int(missingMods);
const auto it =
std::find_if(result.begin(), result.end(),
[key] (int k) { return (k & ~Qt::KeyboardModifierMask) == key; });
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 7cd35c7308..49bbe88d34 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -525,7 +525,7 @@ QDebug operator<<(QDebug d, IDataObject *dataObj)
/*!
\fn QVariant QWindowsMime::convertToMime(const QString &mimeType, IDataObject *pDataObj,
- QVariant::Type preferredType) const
+ QMetaType preferredType) const
Returns a QVariant containing the converted data for \a mimeType from \a pDataObj.
If possible the QVariant should be of the \a preferredType to avoid needless conversions.
@@ -544,11 +544,11 @@ QDebug operator<<(QDebug d, IDataObject *dataObj)
All subclasses must reimplement this pure virtual function.
*/
-class QWindowsMimeText : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeText : public QNativeInterface::Private::QWindowsMime
{
public:
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const override;
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const override;
@@ -664,7 +664,7 @@ QList<FORMATETC> QWindowsMimeText::formatsForMime(const QString &mimeType, const
return formatics;
}
-QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QMetaType preferredType) const
{
QVariant ret;
@@ -678,7 +678,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
data = getData(CF_TEXT, pDataObj);
if (!data.isEmpty()) {
const char* d = data.data();
- const unsigned s = qstrlen(d);
+ const unsigned s = unsigned(qstrlen(d));
QByteArray r(data.size()+1, '\0');
char* o = r.data();
int j=0;
@@ -691,7 +691,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
str = QString::fromLocal8Bit(r);
}
}
- if (preferredType == QVariant::String)
+ if (preferredType.id() == QMetaType::QString)
ret = str;
else
ret = std::move(str).toUtf8();
@@ -700,12 +700,12 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
return ret;
}
-class QWindowsMimeURI : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeURI : public QNativeInterface::Private::QWindowsMime
{
public:
QWindowsMimeURI();
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const override;
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const override;
@@ -819,7 +819,7 @@ QList<FORMATETC> QWindowsMimeURI::formatsForMime(const QString &mimeType, const
return formatics;
}
-QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QMetaType preferredType) const
{
if (mimeType == u"text/uri-list") {
if (canGetData(CF_HDROP, pDataObj)) {
@@ -847,7 +847,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
}
}
- if (preferredType == QVariant::Url && urls.size() == 1)
+ if (preferredType.id() == QMetaType::QUrl && urls.size() == 1)
return urls.at(0);
if (!urls.isEmpty())
return urls;
@@ -866,7 +866,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
return QVariant();
}
-class QWindowsMimeHtml : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeHtml : public QNativeInterface::Private::QWindowsMime
{
public:
QWindowsMimeHtml();
@@ -878,7 +878,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
@@ -928,14 +928,14 @@ in bytes). Charset used is mostly utf8, but can be different, ie. we have to loo
...html...
*/
-QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const
{
Q_UNUSED(preferredType);
QVariant result;
if (canConvertToMime(mime, pDataObj)) {
QByteArray html = getData(CF_HTML, pDataObj);
- static Q_RELAXED_CONSTEXPR auto startMatcher = qMakeStaticByteArrayMatcher("StartHTML:");
- static Q_RELAXED_CONSTEXPR auto endMatcher = qMakeStaticByteArrayMatcher("EndHTML:");
+ static constexpr auto startMatcher = qMakeStaticByteArrayMatcher("StartHTML:");
+ static constexpr auto endMatcher = qMakeStaticByteArrayMatcher("EndHTML:");
qCDebug(lcQpaMime) << __FUNCTION__ << "raw:" << html;
int start = startMatcher.indexIn(html);
int end = endMatcher.indexIn(html);
@@ -978,8 +978,8 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
"StartFragment:0000000000\r\n" // 56-81
"EndFragment:0000000000\r\n\r\n"; // 82-107
- static Q_RELAXED_CONSTEXPR auto startFragmentMatcher = qMakeStaticByteArrayMatcher("<!--StartFragment-->");
- static Q_RELAXED_CONSTEXPR auto endFragmentMatcher = qMakeStaticByteArrayMatcher("<!--EndFragment-->");
+ static constexpr auto startFragmentMatcher = qMakeStaticByteArrayMatcher("<!--StartFragment-->");
+ static constexpr auto endFragmentMatcher = qMakeStaticByteArrayMatcher("<!--EndFragment-->");
if (startFragmentMatcher.indexIn(data) == -1)
result += "<!--StartFragment-->";
@@ -1004,7 +1004,7 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
#ifndef QT_NO_IMAGEFORMAT_BMP
-class QWindowsMimeImage : public QPlatformInterface::Private::QWindowsMime
+class QWindowsMimeImage : public QNativeInterface::Private::QWindowsMime
{
public:
QWindowsMimeImage();
@@ -1015,7 +1015,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
bool hasOriginalDIBV5(IDataObject *pDataObj) const;
@@ -1122,7 +1122,7 @@ bool QWindowsMimeImage::hasOriginalDIBV5(IDataObject *pDataObj) const
return !isSynthesized;
}
-QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const
{
Q_UNUSED(preferredType);
QVariant result;
@@ -1158,7 +1158,7 @@ QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *
}
#endif
-class QBuiltInMimes : public QPlatformInterface::Private::QWindowsMime
+class QBuiltInMimes : public QNativeInterface::Private::QWindowsMime
{
public:
QBuiltInMimes();
@@ -1170,7 +1170,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
@@ -1255,14 +1255,14 @@ bool QBuiltInMimes::canConvertToMime(const QString &mimeType, IDataObject *pData
return mit != inFormats.cend() && canGetData(mit.key(), pDataObj);
}
-QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const
{
QVariant val;
if (canConvertToMime(mimeType, pDataObj)) {
QByteArray data = getData(inFormats.key(mimeType), pDataObj);
if (!data.isEmpty()) {
qCDebug(lcQpaMime) << __FUNCTION__;
- if (mimeType == u"text/html" && preferredType == QVariant::String) {
+ if (mimeType == u"text/html" && preferredType == QMetaType(QMetaType::QString)) {
// text/html is in wide chars on windows (compatible with Mozilla)
val = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData()));
} else {
@@ -1279,7 +1279,7 @@ QString QBuiltInMimes::mimeForFormat(const FORMATETC &formatetc) const
}
-class QLastResortMimes : public QPlatformInterface::Private::QWindowsMime
+class QLastResortMimes : public QNativeInterface::Private::QWindowsMime
{
public:
@@ -1291,7 +1291,7 @@ public:
// for converting to Qt
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const override;
- QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const override;
+ QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QMetaType preferredType) const override;
QString mimeForFormat(const FORMATETC &formatetc) const override;
private:
@@ -1411,7 +1411,7 @@ bool QLastResortMimes::canConvertToMime(const QString &mimeType, IDataObject *pD
return canGetData(cf, pDataObj);
}
-QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const
+QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QMetaType preferredType) const
{
Q_UNUSED(preferredType);
QVariant val;
@@ -1572,7 +1572,7 @@ QString QWindowsMimeConverter::clipboardFormatName(int cf)
QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes,
IDataObject *pDataObj,
- QVariant::Type preferredType,
+ QMetaType preferredType,
QString *formatIn /* = 0 */) const
{
for (const QString &format : mimeTypes) {
@@ -1589,7 +1589,7 @@ QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes,
}
}
}
- qCDebug(lcQpaMime) << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType;
+ qCDebug(lcQpaMime) << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType.id();
return QVariant();
}
diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h
index ee71bee2ba..e131dba848 100644
--- a/src/plugins/platforms/windows/qwindowsmime.h
+++ b/src/plugins/platforms/windows/qwindowsmime.h
@@ -56,7 +56,7 @@ class QWindowsMimeConverter
{
Q_DISABLE_COPY_MOVE(QWindowsMimeConverter)
public:
- using QWindowsMime = QPlatformInterface::Private::QWindowsMime;
+ using QWindowsMime = QNativeInterface::Private::QWindowsMime;
QWindowsMimeConverter();
~QWindowsMimeConverter();
@@ -67,7 +67,7 @@ public:
QList<FORMATETC> allFormatsForMime(const QMimeData *mimeData) const;
// Convenience.
- QVariant convertToMime(const QStringList &mimeTypes, IDataObject *pDataObj, QVariant::Type preferredType,
+ QVariant convertToMime(const QStringList &mimeTypes, IDataObject *pDataObj, QMetaType preferredType,
QString *format = nullptr) const;
void registerMime(QWindowsMime *mime);
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 5e2710bc28..02c59d4d27 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -143,7 +143,7 @@ Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
if (GetAsyncKeyState(VK_RBUTTON) < 0)
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
if (GetAsyncKeyState(VK_MBUTTON) < 0)
- result |= Qt::MidButton;
+ result |= Qt::MiddleButton;
if (GetAsyncKeyState(VK_XBUTTON1) < 0)
result |= Qt::XButton1;
if (GetAsyncKeyState(VK_XBUTTON2) < 0)
@@ -187,11 +187,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_LBUTTONDBLCLK: // Qt QPA does not handle double clicks, send as press
return {QEvent::MouseButtonPress, Qt::LeftButton};
case WM_MBUTTONDOWN:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_MBUTTONUP:
- return {QEvent::MouseButtonRelease, Qt::MidButton};
+ return {QEvent::MouseButtonRelease, Qt::MiddleButton};
case WM_MBUTTONDBLCLK:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_RBUTTONDOWN:
return {QEvent::MouseButtonPress, Qt::RightButton};
case WM_RBUTTONUP:
@@ -213,11 +213,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_NCLBUTTONDBLCLK:
return {QEvent::NonClientAreaMouseButtonPress, Qt::LeftButton};
case WM_NCMBUTTONDOWN:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCMBUTTONUP:
- return {QEvent::NonClientAreaMouseButtonRelease, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonRelease, Qt::MiddleButton};
case WM_NCMBUTTONDBLCLK:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCRBUTTONDOWN:
return {QEvent::NonClientAreaMouseButtonPress, Qt::RightButton};
case WM_NCRBUTTONUP:
diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h
index 759779c6c3..c556a3fb9c 100644
--- a/src/plugins/platforms/windows/qwindowsole.h
+++ b/src/plugins/platforms/windows/qwindowsole.h
@@ -65,17 +65,17 @@ public:
DWORD reportedPerformedEffect() const;
// IDataObject methods
- STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium);
- STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium);
- STDMETHOD(QueryGetData)(LPFORMATETC pformatetc);
- STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut);
- STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
- BOOL fRelease);
- STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc);
- STDMETHOD(DAdvise)(FORMATETC FAR* pFormatetc, DWORD advf,
- LPADVISESINK pAdvSink, DWORD FAR* pdwConnection);
- STDMETHOD(DUnadvise)(DWORD dwConnection);
- STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise);
+ STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium) override;
+ STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium) override;
+ STDMETHOD(QueryGetData)(LPFORMATETC pformatetc) override;
+ STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut) override;
+ STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease) override;
+ STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc) override;
+ STDMETHOD(DAdvise)
+ (FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink,
+ DWORD FAR *pdwConnection) override;
+ STDMETHOD(DUnadvise)(DWORD dwConnection) override;
+ STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR *ppenumAdvise) override;
private:
QPointer<QMimeData> data;
@@ -93,10 +93,10 @@ public:
bool isNull() const;
// IEnumFORMATETC methods
- STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched);
- STDMETHOD(Skip)(ULONG celt);
- STDMETHOD(Reset)(void);
- STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum);
+ STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR *pceltFetched) override;
+ STDMETHOD(Skip)(ULONG celt) override;
+ STDMETHOD(Reset)(void) override;
+ STDMETHOD(Clone)(LPENUMFORMATETC FAR *newEnum) override;
private:
bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const;
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 00ac7fa2b7..0b1af47a65 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -263,7 +263,7 @@ static inline QString resolveBugListFile(const QString &fileName)
return fileName;
// Try QLibraryInfo::SettingsPath which is typically empty unless specified in qt.conf,
// then resolve via QStandardPaths::ConfigLocation.
- const QString settingsPath = QLibraryInfo::location(QLibraryInfo::SettingsPath);
+ const QString settingsPath = QLibraryInfo::path(QLibraryInfo::SettingsPath);
if (!settingsPath.isEmpty()) { // SettingsPath is empty unless specified in qt.conf.
const QFileInfo fi(settingsPath + u'/' + fileName);
if (fi.isFile())
@@ -283,7 +283,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
#if defined(QT_NO_OPENGL)
Q_UNUSED(gpu);
Q_UNUSED(requested);
- return 0;
+ return {};
#else
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description);
SupportedRenderersCache *srCache = supportedRenderersCache();
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index d5c3aeacff..095aea2b95 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -197,11 +197,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_LBUTTONDBLCLK: // Qt QPA does not handle double clicks, send as press
return {QEvent::MouseButtonPress, Qt::LeftButton};
case WM_MBUTTONDOWN:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_MBUTTONUP:
- return {QEvent::MouseButtonRelease, Qt::MidButton};
+ return {QEvent::MouseButtonRelease, Qt::MiddleButton};
case WM_MBUTTONDBLCLK:
- return {QEvent::MouseButtonPress, Qt::MidButton};
+ return {QEvent::MouseButtonPress, Qt::MiddleButton};
case WM_RBUTTONDOWN:
return {QEvent::MouseButtonPress, Qt::RightButton};
case WM_RBUTTONUP:
@@ -223,11 +223,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
case WM_NCLBUTTONDBLCLK:
return {QEvent::NonClientAreaMouseButtonPress, Qt::LeftButton};
case WM_NCMBUTTONDOWN:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCMBUTTONUP:
- return {QEvent::NonClientAreaMouseButtonRelease, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonRelease, Qt::MiddleButton};
case WM_NCMBUTTONDBLCLK:
- return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
+ return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
case WM_NCRBUTTONDOWN:
return {QEvent::NonClientAreaMouseButtonPress, Qt::RightButton};
case WM_NCRBUTTONUP:
@@ -265,7 +265,7 @@ static Qt::MouseButtons queryMouseButtons()
if (GetAsyncKeyState(VK_RBUTTON) < 0)
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
if (GetAsyncKeyState(VK_MBUTTON) < 0)
- result |= Qt::MidButton;
+ result |= Qt::MiddleButton;
if (GetAsyncKeyState(VK_XBUTTON1) < 0)
result |= Qt::XButton1;
if (GetAsyncKeyState(VK_XBUTTON2) < 0)
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp
index 8a95cc53a8..fe2d8a36c0 100644
--- a/src/plugins/platforms/windows/qwindowsservices.cpp
+++ b/src/plugins/platforms/windows/qwindowsservices.cpp
@@ -56,15 +56,25 @@ QT_BEGIN_NAMESPACE
enum { debug = 0 };
-static quintptr runShellExecute(const wchar_t *path)
+class QWindowsShellExecuteThread : public QThread
{
- HINSTANCE result = nullptr;
- if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) {
- result = ShellExecute(nullptr, nullptr, path, nullptr, nullptr, SW_SHOWNORMAL);
- CoUninitialize();
+public:
+ explicit QWindowsShellExecuteThread(const wchar_t *path) : m_path(path) { }
+
+ void run() override
+ {
+ if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) {
+ m_result = ShellExecute(nullptr, nullptr, m_path, nullptr, nullptr, SW_SHOWNORMAL);
+ CoUninitialize();
+ }
}
- return reinterpret_cast<quintptr>(result);
-}
+
+ HINSTANCE result() const { return m_result; }
+
+private:
+ HINSTANCE m_result = nullptr;
+ const wchar_t *m_path;
+};
static inline bool shellExecute(const QUrl &url)
{
@@ -75,13 +85,11 @@ static inline bool shellExecute(const QUrl &url)
// Run ShellExecute() in a thread since it may spin the event loop.
// Prevent it from interfering with processing of posted events (QTBUG-85676).
- quintptr result = 0;
- quintptr *resultPtr = &result;
- const auto path = reinterpret_cast<const wchar_t *>(nativeFilePath.utf16());
- QScopedPointer<QThread> thread(QThread::create([path, resultPtr]
- () { *resultPtr = runShellExecute(path); }));
- thread->start();
- thread->wait();
+ QWindowsShellExecuteThread thread(reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()));
+ thread.start();
+ thread.wait();
+
+ const auto result = reinterpret_cast<quintptr>(thread.result());
// ShellExecute returns a value greater than 32 if successful
if (result <= 32) {
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index f86dbb0c5f..f16015b96a 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -435,6 +435,11 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
if (m_currentDevice < 0) {
m_currentDevice = m_devices.size();
m_devices.push_back(tabletInit(uniqueId, cursorType));
+ } else {
+ // The user can switch pressure sensitivity level in the driver,which
+ // will make our saved values invalid (this option is provided by Wacom
+ // drivers for compatibility reasons, and it can be adjusted on the fly)
+ m_devices[m_currentDevice] = tabletInit(uniqueId, cursorType);
}
/**
@@ -524,7 +529,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
return false;
const auto currentDevice = m_devices.at(m_currentDevice).currentDevice;
- const auto currentPointer = m_devices.at(m_currentDevice).currentPointerType;
const qint64 uniqueId = m_devices.at(m_currentDevice).uniqueId;
// The tablet can be used in 2 different modes (reflected in enum Mode),
@@ -556,6 +560,27 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
const int z = m_devices.at(m_currentDevice).zCapability ? int(packet.pkZ) : 0;
+ const auto currentPointer = m_devices.at(m_currentDevice).currentPointerType;
+ const auto packetPointerType = pointerType(packet.pkCursor);
+
+ const Qt::MouseButtons buttons =
+ convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
+
+ if (buttons == Qt::NoButton && packetPointerType != currentPointer) {
+
+ QWindowSystemInterface::handleTabletLeaveProximityEvent(packet.pkTime,
+ int(currentDevice),
+ int(currentPointer),
+ uniqueId);
+
+ m_devices[m_currentDevice].currentPointerType = packetPointerType;
+
+ QWindowSystemInterface::handleTabletEnterProximityEvent(packet.pkTime,
+ int(currentDevice),
+ int(packetPointerType),
+ uniqueId);
+ }
+
QPointF globalPosF =
m_devices.at(m_currentDevice).scaleCoordinates(packet.pkX, packet.pkY, virtualDesktopArea);
@@ -622,9 +647,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
<< tiltY << "tanP:" << tangentialPressure << "rotation:" << rotation;
}
- Qt::MouseButtons buttons =
- convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
-
QWindowSystemInterface::handleTabletEvent(target, packet.pkTime, QPointF(localPos), globalPosF,
int(currentDevice), int(currentPointer),
buttons,
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index ea74d8e372..0c778ecd24 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -888,7 +888,7 @@ public:
explicit QWindowsFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts) :
QAbstractFileIconEngine(info, opts) {}
- QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) const override
+ QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) override
{ return QWindowsTheme::instance()->availableFileIconSizes(); }
protected:
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a7cc36951a..5987324ac1 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1356,8 +1356,7 @@ bool QWindowsWindow::m_borderInFullScreenDefault = false;
QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) :
QWindowsBaseWindow(aWindow),
m_data(data),
- m_cursor(new CursorHandle),
- m_format(aWindow->requestedFormat())
+ m_cursor(new CursorHandle)
#if QT_CONFIG(vulkan)
, m_vkSurface(VK_NULL_HANDLE)
#endif
@@ -1431,6 +1430,11 @@ void QWindowsWindow::initialize()
}
}
+QSurfaceFormat QWindowsWindow::format() const
+{
+ return window()->requestedFormat();
+}
+
void QWindowsWindow::fireExpose(const QRegion &region, bool force)
{
if (region.isEmpty() && !force)
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index beed3e17df..1f1af82da2 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -125,12 +125,12 @@ struct QWindowsWindowData
};
class QWindowsBaseWindow : public QPlatformWindow,
- public QPlatformInterface::Private::QWindowsWindow
+ public QNativeInterface::Private::QWindowsWindow
{
Q_DISABLE_COPY_MOVE(QWindowsBaseWindow)
public:
- using TouchWindowTouchType = QPlatformInterface::Private::QWindowsApplication::TouchWindowTouchType;
- using TouchWindowTouchTypes = QPlatformInterface::Private::QWindowsApplication::TouchWindowTouchTypes;
+ using TouchWindowTouchType = QNativeInterface::Private::QWindowsApplication::TouchWindowTouchType;
+ using TouchWindowTouchTypes = QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes;
explicit QWindowsBaseWindow(QWindow *window) : QPlatformWindow(window) {}
@@ -249,7 +249,7 @@ public:
using QPlatformWindow::screenForGeometry;
- QSurfaceFormat format() const override { return m_format; }
+ QSurfaceFormat format() const override;
void setGeometry(const QRect &rect) override;
QRect geometry() const override { return m_data.geometry; }
QRect normalGeometry() const override;
@@ -402,7 +402,6 @@ private:
QWindowsOleDropTarget *m_dropTarget = nullptr;
unsigned m_savedStyle = 0;
QRect m_savedFrameGeometry;
- const QSurfaceFormat m_format;
HICON m_iconSmall = nullptr;
HICON m_iconBig = nullptr;
void *m_surface = nullptr;
diff --git a/src/plugins/platforms/xcb/.prev_CMakeLists.txt b/src/plugins/platforms/xcb/.prev_CMakeLists.txt
index 0cf401037e..58f635c081 100644
--- a/src/plugins/platforms/xcb/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/xcb/.prev_CMakeLists.txt
@@ -4,7 +4,7 @@
## XcbQpa Module:
#####################################################################
-qt_add_module(XcbQpa
+qt_internal_add_module(XcbQpa
INTERNAL_MODULE
NO_MODULE_HEADERS
SOURCES
@@ -53,7 +53,6 @@ qt_add_module(XcbQpa
XCB::SYNC
XCB::XCB
XCB::XFIXES
- XCB::XINERAMA
XCB::XINPUT
XCB::XKB
XKB::XKB
@@ -62,50 +61,50 @@ qt_add_module(XcbQpa
## Scopes:
#####################################################################
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_glib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_glib
LIBRARIES
GLIB2::GLIB2
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
SOURCES
qxcbdrag.cpp qxcbdrag.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
PUBLIC_LIBRARIES
X11::XCB
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
SOURCES
qxcbsessionmanager.cpp qxcbsessionmanager.h
PUBLIC_LIBRARIES
${X11_SM_LIB} ${X11_ICE_LIB}
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
SOURCES
qxcbvulkaninstance.cpp qxcbvulkaninstance.h
qxcbvulkanwindow.cpp qxcbvulkanwindow.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
-qt_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
+qt_internal_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
COMPILE_OPTIONS
-ftemplate-depth=1024
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
SOURCES
nativepainting/qbackingstore_x11.cpp nativepainting/qbackingstore_x11_p.h
nativepainting/qcolormap_x11.cpp nativepainting/qcolormap_x11_p.h
@@ -118,12 +117,12 @@ qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
nativepainting
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
PUBLIC_LIBRARIES
PkgConfig::XRender
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
LIBRARIES
WrapFreetype::WrapFreetype
)
diff --git a/src/plugins/platforms/xcb/CMakeLists.txt b/src/plugins/platforms/xcb/CMakeLists.txt
index 22a955fec6..7e78e9502f 100644
--- a/src/plugins/platforms/xcb/CMakeLists.txt
+++ b/src/plugins/platforms/xcb/CMakeLists.txt
@@ -4,7 +4,7 @@
## XcbQpa Module:
#####################################################################
-qt_add_module(XcbQpa
+qt_internal_add_module(XcbQpa
INTERNAL_MODULE
NO_MODULE_HEADERS
SOURCES
@@ -53,7 +53,7 @@ qt_add_module(XcbQpa
XCB::SYNC
XCB::XCB
XCB::XFIXES
- XCB::XINERAMA
+ # XCB::XINPUT # special case remove handled below
XCB::XKB
XKB::XKB
)
@@ -65,22 +65,22 @@ qt_disable_apple_app_extension_api_only(XcbQpa)
## Scopes:
#####################################################################
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_opengl
PUBLIC_LIBRARIES
Qt::OpenGLPrivate
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_glib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_glib
LIBRARIES
GLIB2::GLIB2
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_draganddrop
SOURCES
qxcbdrag.cpp qxcbdrag.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
PUBLIC_LIBRARIES
X11::XCB
# special case begin
@@ -91,30 +91,30 @@ qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_xlib
# special case end
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_sm
SOURCES
qxcbsessionmanager.cpp qxcbsessionmanager.h
PUBLIC_LIBRARIES
${X11_SM_LIB} ${X11_ICE_LIB}
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_vulkan
SOURCES
qxcbvulkaninstance.cpp qxcbvulkaninstance.h
qxcbvulkanwindow.cpp qxcbvulkanwindow.h
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_dlopen
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
-qt_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
+qt_internal_extend_target(XcbQpa CONDITION CLANG AND NOT ICC
COMPILE_OPTIONS
-ftemplate-depth=1024
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
SOURCES
nativepainting/qbackingstore_x11.cpp nativepainting/qbackingstore_x11_p.h
nativepainting/qcolormap_x11.cpp nativepainting/qcolormap_x11_p.h
@@ -127,19 +127,19 @@ qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting
nativepainting
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
PUBLIC_LIBRARIES
PkgConfig::XRender
)
-qt_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
+qt_internal_extend_target(XcbQpa CONDITION QT_FEATURE_fontconfig AND QT_FEATURE_xcb_native_painting
LIBRARIES
WrapFreetype::WrapFreetype
)
# special case begin
if(TARGET XCB::XINPUT)
- qt_extend_target(XcbQpa LIBRARIES XCB::XINPUT)
+ qt_internal_extend_target(XcbQpa LIBRARIES XCB::XINPUT)
else()
set(xinput_source "${PROJECT_SOURCE_DIR}/src/3rdparty/xcb/libxcb/xinput.c")
set_source_files_properties(
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
index ddb4488105..be5c75aedc 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
class QXcbEglNativeInterfaceHandler;
class QXcbEglIntegration : public QXcbGlIntegration
- , public QPlatformInterface::Private::QEGLIntegration
+ , public QNativeInterface::Private::QEGLIntegration
{
public:
QXcbEglIntegration();
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt
index 94d9b60310..24cdf8f636 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt
@@ -29,12 +29,12 @@ qt_internal_add_plugin(QXcbGlxIntegrationPlugin
## Scopes:
#####################################################################
-qt_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_xcb_glx
+qt_internal_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_xcb_glx
PUBLIC_LIBRARIES
XCB::GLX
)
-qt_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_dlopen AND NOT static
+qt_internal_extend_target(QXcbGlxIntegrationPlugin CONDITION QT_FEATURE_dlopen AND NOT static
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
index a7468c8fac..62a9247fd9 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
@@ -54,7 +54,7 @@
QT_BEGIN_NAMESPACE
class QGLXContext : public QPlatformOpenGLContext,
- public QPlatformInterface::QGLXContext
+ public QNativeInterface::QGLXContext
{
public:
QGLXContext(Display *display, QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
index 18c1be9489..6b0c6dfee2 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
class QXcbNativeInterfaceHandler;
class QXcbGlxIntegration : public QXcbGlIntegration,
- public QPlatformInterface::Private::QGLXIntegration
+ public QNativeInterface::Private::QGLXIntegration
{
public:
QXcbGlxIntegration();
diff --git a/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp
index b4a9d64eb8..0eb522e1ed 100644
--- a/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qcolormap_x11.cpp
@@ -320,7 +320,7 @@ static void init_direct(QXcbColormapPrivate *d, bool ownColormap)
XStoreColors(X11->display, d->colormap, colorTable.data(), colorTable.count());
}
-static QXcbColormap **cmaps = 0;
+static QXcbColormap **cmaps = nullptr;
void QXcbColormap::initialize()
{
@@ -343,7 +343,7 @@ void QXcbColormap::initialize()
d->visual = DefaultVisual(display, i);
d->defaultVisual = true;
- Visual *argbVisual = 0;
+ Visual *argbVisual = nullptr;
if (X11->visual && i == DefaultScreen(display)) {
// only use the outside colormap on the default screen
@@ -356,7 +356,7 @@ void QXcbColormap::initialize()
d->visual = find_visual(display, i, X11->visual_class, X11->visual_id,
&d->depth, &d->defaultVisual);
} else if (!X11->custom_cmap) {
- XStandardColormap *stdcmap = 0;
+ XStandardColormap *stdcmap = nullptr;
int ncmaps = 0;
#if QT_CONFIG(xrender)
diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
index ab0f537926..82900d4054 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
@@ -2303,21 +2303,6 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co
#if QT_CONFIG(xrender)
if (X11->use_xrender && d->picture && qt_x11PictureHandle(pixmap)) {
-#if 0
- // ### Qt 5: enable this
- XRenderPictureAttributes attrs;
- attrs.repeat = true;
- XRenderChangePicture(d->dpy, pixmap.x11PictureHandle(), CPRepeat, &attrs);
-
- if (mono_src) {
- qt_render_bitmap(d->dpy, d->scrn, pixmap.x11PictureHandle(), d->picture,
- sx, sy, x, y, w, h, d->cpen);
- } else {
- XRenderComposite(d->dpy, d->composition_mode,
- pixmap.x11PictureHandle(), XNone, d->picture,
- sx, sy, 0, 0, x, y, w, h);
- }
-#else
const int numTiles = (w / pixmap.width()) * (h / pixmap.height());
if (numTiles < 100) {
// this is essentially qt_draw_tile(), inlined for
@@ -2400,7 +2385,6 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co
pmPicture, XNone, d->picture,
sx, sy, 0, 0, x, y, w, h);
}
-#endif
} else
#endif // QT_CONFIG(xrender)
if (pixmap.depth() > 1 && !static_cast<QX11PlatformPixmap*>(pixmap.handle())->x11_mask) {
diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp
index d55a49768c..bf45b409c5 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp
@@ -282,9 +282,9 @@ static uint n_bits(uint v)
return i;
}
-static uint *red_scale_table = 0;
-static uint *green_scale_table = 0;
-static uint *blue_scale_table = 0;
+static uint *red_scale_table = nullptr;
+static uint *green_scale_table = nullptr;
+static uint *blue_scale_table = nullptr;
static void cleanup_scale_tables()
{
@@ -546,10 +546,10 @@ void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags f
Display *dpy = xinfo.display();
Visual *visual = (Visual *)xinfo.visual();
- XImage *xi = 0;
+ XImage *xi = nullptr;
bool trucol = (visual->c_class >= TrueColor);
size_t nbytes = image.sizeInBytes();
- uchar *newbits= 0;
+ uchar *newbits= nullptr;
#if QT_CONFIG(xrender)
if (alphaCheck.hasXRenderAndAlpha()) {
diff --git a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
index 1f7e7cf49b..117d5948cc 100644
--- a/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
+++ b/src/plugins/platforms/xcb/nativepainting/qt_x11_p.h
@@ -190,7 +190,7 @@ struct QX11InfoData {
};
template <class T>
-Q_DECL_RELAXED_CONSTEXPR inline int lowest_bit(T v) noexcept
+constexpr inline int lowest_bit(T v) noexcept
{
int result = qCountTrailingZeroBits(v);
return ((result >> 3) == sizeof(T)) ? -1 : result;
diff --git a/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp b/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp
index 1afa00cfc9..388f5aba76 100644
--- a/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qtessellator.cpp
@@ -725,7 +725,7 @@ void QTessellatorPrivate::cancelCoincidingEdges()
{
Vertex **vv = vertices.sorted;
- QCoincidingEdge *tl = 0;
+ QCoincidingEdge *tl = nullptr;
int tlSize = 0;
for (int i = 0; i < vertices.nPoints - 1; ++i) {
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 7330c3c9a3..bfcd1b2320 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -710,9 +710,10 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
Q_ASSERT(!m_clientSideScroll);
ensureGC(dst);
- setClip(region);
if (hasShm()) {
+ setClip(region); // Clip in window local coordinates
+
// Copy scrolled area on server-side from pixmap to window
const QRegion scrolledRegion = m_scrolledRegion.translated(-offset);
for (const QRect &rect : scrolledRegion) {
@@ -733,7 +734,15 @@ void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const
const QRect bounds = region.boundingRect();
const QPoint target = bounds.topLeft();
const QRect source = bounds.translated(offset);
- flushPixmap(region);
+
+ // First clip in backingstore-local coordinates, and upload
+ // the changed parts of the backingstore to the server.
+ setClip(source);
+ flushPixmap(source);
+
+ // Then clip in window local coordinates, and copy the updated
+ // parts of the backingstore image server-side to the window.
+ setClip(region);
xcb_copy_area(xcb_connection(),
m_xcb_pixmap,
dst,
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 6d023035f2..56fe1a5b45 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -123,9 +123,9 @@ protected:
return list.contains(format);
}
- QVariant retrieveData_sys(const QString &fmt, QVariant::Type type) const override
+ QVariant retrieveData_sys(const QString &fmt, QMetaType type) const override
{
- auto requestedType = QMetaType::Type(type);
+ auto requestedType = type;
if (fmt.isEmpty() || isEmpty())
return QByteArray();
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 1478e58ccc..7435e124dc 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -459,7 +459,7 @@ static Qt::MouseButtons translateMouseButtons(int s)
if (s & XCB_BUTTON_MASK_1)
ret |= Qt::LeftButton;
if (s & XCB_BUTTON_MASK_2)
- ret |= Qt::MidButton;
+ ret |= Qt::MiddleButton;
if (s & XCB_BUTTON_MASK_3)
ret |= Qt::RightButton;
return ret;
@@ -475,7 +475,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s)
{
switch (s) {
case 1: return Qt::LeftButton;
- case 2: return Qt::MidButton;
+ case 2: return Qt::MiddleButton;
case 3: return Qt::RightButton;
// Button values 4-7 were already handled as Wheel events, and won't occur here.
case 8: return Qt::BackButton; // Also known as Qt::ExtraButton1
@@ -597,12 +597,16 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent);
}
case XCB_ENTER_NOTIFY:
- if (hasXInput2() && !xi2MouseEventsDisabled())
+ if (hasXInput2()) {
+ // Prefer XI2 enter (XCB_INPUT_ENTER) events over core events.
break;
+ }
HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent);
case XCB_LEAVE_NOTIFY:
- if (hasXInput2() && !xi2MouseEventsDisabled())
+ if (hasXInput2()) {
+ // Prefer XI2 leave (XCB_INPUT_LEAVE) events over core events.
break;
+ }
m_keyboard->updateXKBStateFromCore(reinterpret_cast<xcb_leave_notify_event_t *>(event)->state);
HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent);
case XCB_FOCUS_IN:
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index a097604643..77a9c9d934 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -225,9 +225,8 @@ public:
void xi2SelectStateEvents();
void xi2SelectDeviceEvents(xcb_window_t window);
- void xi2SelectDeviceEventsCompatibility(xcb_window_t window);
bool xi2SetMouseGrabEnabled(xcb_window_t w, bool grab);
- bool xi2MouseEventsDisabled() const;
+
Qt::MouseButton xiToQtMouseButton(uint32_t b);
void xi2UpdateScrollingDevices();
bool startSystemMoveResizeForTouch(xcb_window_t window, int edges);
diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp
index 18dee89adb..020412fc87 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_basic.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_basic.cpp
@@ -43,7 +43,6 @@
#include <xcb/shm.h>
#include <xcb/sync.h>
#include <xcb/xfixes.h>
-#include <xcb/xinerama.h>
#include <xcb/render.h>
#include <xcb/xinput.h>
#define explicit dont_use_cxx_explicit
@@ -145,8 +144,6 @@ QXcbBasicConnection::QXcbBasicConnection(const char *displayName)
initializeShm();
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XRANDR"))
initializeXRandr();
- if (!m_hasXRandr)
- initializeXinerama();
initializeXFixes();
initializeXRender();
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2"))
@@ -307,17 +304,6 @@ void QXcbBasicConnection::initializeXRender()
m_xrenderVersion.second = xrenderQuery->minor_version;
}
-void QXcbBasicConnection::initializeXinerama()
-{
- const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_xinerama_id);
- if (!reply || !reply->present)
- return;
-
- auto xineramaActive = Q_XCB_REPLY(xcb_xinerama_is_active, m_xcbConnection);
- if (xineramaActive && xineramaActive->state)
- m_hasXinerama = true;
-}
-
void QXcbBasicConnection::initializeXFixes()
{
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_xcbConnection, &xcb_xfixes_id);
diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.h b/src/plugins/platforms/xcb/qxcbconnection_basic.h
index 109186f966..bda02ce9c2 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_basic.h
+++ b/src/plugins/platforms/xcb/qxcbconnection_basic.h
@@ -96,7 +96,6 @@ public:
bool hasShm() const { return m_hasShm; }
bool hasShmFd() const { return m_hasShmFd; }
bool hasXSync() const { return m_hasXSync; }
- bool hasXinerama() const { return m_hasXinerama; }
bool hasBigRequest() const;
bool isAtLeastXI21() const { return m_xi2Enabled && m_xi2Minor >= 1; }
@@ -113,7 +112,6 @@ protected:
void initializeXFixes();
void initializeXRender();
void initializeXRandr();
- void initializeXinerama();
void initializeXShape();
void initializeXKB();
void initializeXSync();
@@ -130,7 +128,6 @@ private:
QXcbAtom m_xcbAtom;
bool m_hasXFixes = false;
- bool m_hasXinerama = false;
bool m_hasXhape = false;
bool m_hasInputShape;
bool m_hasXRandr = false;
diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
index 9ba71ada37..82b0f65774 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
@@ -46,8 +46,6 @@
#include <qpa/qwindowsysteminterface.h>
-#include <xcb/xinerama.h>
-
void QXcbConnection::xrandrSelectEvents()
{
xcb_screen_iterator_t rootIter = xcb_setup_roots_iterator(setup());
@@ -358,21 +356,6 @@ void QXcbConnection::initializeScreens()
}
}
}
- } else if (hasXinerama()) {
- // Xinerama is available
- auto screens = Q_XCB_REPLY(xcb_xinerama_query_screens, xcb_connection());
- if (screens) {
- xcb_xinerama_screen_info_iterator_t it = xcb_xinerama_query_screens_screen_info_iterator(screens.get());
- while (it.rem) {
- xcb_xinerama_screen_info_t *screen_info = it.data;
- QXcbScreen *screen = new QXcbScreen(this, virtualDesktop,
- XCB_NONE, nullptr,
- screen_info, it.index);
- siblings << screen;
- m_screens << screen;
- xcb_xinerama_screen_info_next(&it);
- }
- }
}
if (siblings.isEmpty()) {
// If there are no XRandR outputs or XRandR extension is missing,
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index dc8a533388..b754476d61 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -500,108 +500,6 @@ void QXcbConnection::xi2SetupDevices()
qCDebug(lcQpaXInputDevices) << "multi-pointer X detected";
}
-/*! \internal
-
- Notes on QT_XCB_NO_XI2_MOUSE Handling:
-
- Here we don't select pointer button press/release and motion events on master devices, instead
- we select these events directly on slave devices. This means that a master device will fallback
- to sending core events for every XI_* event that is sent directly by a slave device. For more
- details see "Event processing for attached slave devices" in XInput2 specification. To prevent
- handling of the same event twice, we have checks for xi2MouseEventsDisabled() in XI2 event
- handlers (but this is somewhat inconsistent in some situations). If the purpose for
- QT_XCB_NO_XI2_MOUSE was so that an application using QAbstractNativeEventFilter would see core
- mouse events before they are handled by Qt then QT_XCB_NO_XI2_MOUSE won't always work as
- expected (e.g. we handle scroll event directly from a slave device event, before an application
- has seen the fallback core event from a master device).
-
- The commit introducing QT_XCB_NO_XI2_MOUSE also states that setting this envvar "restores the
- old behavior with broken grabbing". It did not elaborate why grabbing was not fixed for this
- code path. The issue that this envvar tries to solve seem to be less important than broken
- grabbing (broken apparently only for touch events). Thus, if you really want core mouse events
- in your application and do not care about broken touch, then use QT_XCB_NO_XI2 (more on this
- below) to disable the extension all together. The reason why grabbing might have not been fixed
- is that calling XIGrabDevice with this code path for some reason always returns AlreadyGrabbed
- (by debugging X server's code it appears that when we call XIGrabDevice, an X server first grabs
- pointer via core pointer and then fails to do XI2 grab with AlreadyGrabbed; disclaimer - I did
- not debug this in great detail). When we try supporting odd setups like QT_XCB_NO_XI2_MOUSE, we
- are asking for trouble anyways.
-
- In conclusion, introduction of QT_XCB_NO_XI2_MOUSE causes more issues than solves - the above
- mentioned inconsistencies, maintenance of this code path and that QT_XCB_NO_XI2_MOUSE replaces
- less important issue with somewhat more important issue. It also makes us to use less optimal
- code paths in certain situations (see xi2HandleHierarchyEvent). Using of QT_XCB_NO_XI2 has its
- drawbacks too - no tablet and touch events. So the only real fix in this case is at an
- application side (teach the application about xcb_ge_event_t events). Based on this,
- QT_XCB_NO_XI2_MOUSE will be removed in ### Qt 6. It should not have existed in the first place,
- native events seen by QAbstractNativeEventFilter is not really a public API, applications should
- expect changes at this level and do ifdefs if something changes between Qt version.
-*/
-void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
-{
- if (window == rootWindow())
- return;
-
- uint32_t mask = 0;
-
- if (isAtLeastXI22()) {
- mask |= XCB_INPUT_XI_EVENT_MASK_TOUCH_BEGIN;
- mask |= XCB_INPUT_XI_EVENT_MASK_TOUCH_UPDATE;
- mask |= XCB_INPUT_XI_EVENT_MASK_TOUCH_END;
-
- qt_xcb_input_event_mask_t xiMask;
- xiMask.header.deviceid = XCB_INPUT_DEVICE_ALL_MASTER;
- xiMask.header.mask_len = 1;
- xiMask.mask = mask;
-
- xcb_void_cookie_t cookie =
- xcb_input_xi_select_events_checked(xcb_connection(), window, 1, &xiMask.header);
- xcb_generic_error_t *error = xcb_request_check(xcb_connection(), cookie);
- if (error) {
- qCDebug(lcQpaXInput, "failed to select events, window %x, error code %d", window, error->error_code);
- free(error);
- } else {
- QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
- }
- }
-
- mask = XCB_INPUT_XI_EVENT_MASK_BUTTON_PRESS;
- mask |= XCB_INPUT_XI_EVENT_MASK_BUTTON_RELEASE;
- mask |= XCB_INPUT_XI_EVENT_MASK_MOTION;
-
-#if QT_CONFIG(tabletevent)
- QSet<int> tabletDevices;
- if (!m_tabletData.isEmpty()) {
- const int nrTablets = m_tabletData.count();
- QList<qt_xcb_input_event_mask_t> xiEventMask(nrTablets);
- for (int i = 0; i < nrTablets; ++i) {
- int deviceId = m_tabletData.at(i).deviceId;
- tabletDevices.insert(deviceId);
- xiEventMask[i].header.deviceid = deviceId;
- xiEventMask[i].header.mask_len = 1;
- xiEventMask[i].mask = mask;
- }
- xcb_input_xi_select_events(xcb_connection(), window, nrTablets, &(xiEventMask.data()->header));
- }
-#endif
-
- if (!m_scrollingDevices.isEmpty()) {
- QList<qt_xcb_input_event_mask_t> xiEventMask(m_scrollingDevices.size());
- int i = 0;
- for (const ScrollingDevice& scrollingDevice : qAsConst(m_scrollingDevices)) {
-#if QT_CONFIG(tabletevent)
- if (tabletDevices.contains(scrollingDevice.deviceId))
- continue; // All necessary events are already captured.
-#endif
- xiEventMask[i].header.deviceid = scrollingDevice.deviceId;
- xiEventMask[i].header.mask_len = 1;
- xiEventMask[i].mask = mask;
- i++;
- }
- xcb_input_xi_select_events(xcb_connection(), window, i, &(xiEventMask.data()->header));
- }
-}
-
QXcbConnection::TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
{
TouchDeviceData *dev = nullptr;
@@ -769,8 +667,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
case XCB_INPUT_BUTTON_PRESS:
case XCB_INPUT_BUTTON_RELEASE:
case XCB_INPUT_MOTION:
- if (!xi2MouseEventsDisabled() && eventListener &&
- !(xiDeviceEvent->flags & XCB_INPUT_POINTER_EVENT_FLAGS_POINTER_EMULATED))
+ if (eventListener && !(xiDeviceEvent->flags & XCB_INPUT_POINTER_EVENT_FLAGS_POINTER_EMULATED))
eventListener->handleXIMouseEvent(event);
break;
@@ -786,7 +683,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
xi2ProcessTouch(xiDeviceEvent, platformWindow);
break;
}
- } else if (xiEnterEvent && !xi2MouseEventsDisabled() && eventListener) {
+ } else if (xiEnterEvent && eventListener) {
switch (xiEnterEvent->event_type) {
case XCB_INPUT_ENTER:
case XCB_INPUT_LEAVE:
@@ -796,14 +693,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
}
}
-bool QXcbConnection::xi2MouseEventsDisabled() const
-{
- static bool xi2MouseDisabled = qEnvironmentVariableIsSet("QT_XCB_NO_XI2_MOUSE");
- // FIXME: Don't use XInput2 mouse events when Xinerama extension
- // is enabled, because it causes problems with multi-monitor setup.
- return xi2MouseDisabled || hasXinerama();
-}
-
bool QXcbConnection::isTouchScreen(int id)
{
auto device = touchDeviceForId(id);
@@ -1064,15 +953,6 @@ void QXcbConnection::xi2HandleHierarchyEvent(void *event)
return;
xi2SetupDevices();
-
- if (xi2MouseEventsDisabled()) {
- // In compatibility mode (a.k.a xi2MouseEventsDisabled() mode) we select events for
- // each device separately. When a new device appears, we have to select events from
- // this device on all event-listening windows. This is not needed when events are
- // selected via XIAllDevices/XIAllMasterDevices (as in xi2SelectDeviceEvents()).
- for (auto it = m_mapper.cbegin(), end = m_mapper.cend(); it != end; ++it)
- xi2SelectDeviceEventsCompatibility(it.key());
- }
}
void QXcbConnection::xi2HandleDeviceChangedEvent(void *event)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 3e24027e51..d2143ce953 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -95,9 +95,9 @@ static xcb_window_t xdndProxy(QXcbConnection *c, xcb_window_t w)
if (reply && reply->type == XCB_ATOM_WINDOW) {
xcb_window_t p = *((xcb_window_t *)xcb_get_property_value(reply.get()));
if (proxy != p)
- proxy = 0;
+ proxy = XCB_NONE;
} else {
- proxy = 0;
+ proxy = XCB_NONE;
}
return proxy;
@@ -112,9 +112,9 @@ public:
protected:
bool hasFormat_sys(const QString &mimeType) const override;
QStringList formats_sys() const override;
- QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override;
+ QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const override;
- QVariant xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const;
+ QVariant xdndObtainData(const QByteArray &format, QMetaType requestedType) const;
QXcbDrag *drag;
};
@@ -419,11 +419,12 @@ void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardMod
auto reply = Q_XCB_REPLY(xcb_get_property, xcb_connection(),
false, proxy_target,
atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 1);
- if (!reply || reply->type == XCB_NONE)
+ if (!reply || reply->type == XCB_NONE) {
target = 0;
-
- target_version = *(uint32_t *)xcb_get_property_value(reply.get());
- target_version = qMin(xdnd_version, target_version ? target_version : 1);
+ } else {
+ target_version = *(uint32_t *)xcb_get_property_value(reply.get());
+ target_version = qMin(xdnd_version, target_version ? target_version : 1);
+ }
}
if (target != current_target) {
@@ -689,7 +690,7 @@ int QXcbDrag::findTransactionByTime(xcb_timestamp_t timestamp)
#if 0
// for embedding only
-static QWidget* current_embedding_widget = 0;
+static QWidget* current_embedding_widget = nullptr;
static xcb_client_message_event_t last_enter_event;
@@ -1065,7 +1066,7 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
setExecutedDropAction(response.acceptedAction());
- xcb_client_message_event_t finished;
+ xcb_client_message_event_t finished = {};
finished.response_type = XCB_CLIENT_MESSAGE;
finished.sequence = 0;
finished.window = xdnd_dragsource;
@@ -1341,14 +1342,14 @@ QXcbDropData::~QXcbDropData()
{
}
-QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const
+QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QMetaType requestedType) const
{
QByteArray mime = mimetype.toLatin1();
- QVariant data = xdndObtainData(mime, QMetaType::Type(requestedType));
+ QVariant data = xdndObtainData(mime, requestedType);
return data;
}
-QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const
+QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType requestedType) const
{
QByteArray result;
diff --git a/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp b/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
index 0545bdd5f1..5055057db9 100644
--- a/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
+++ b/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
@@ -63,18 +63,6 @@ bool QXcbUnixEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags
return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
}
-bool QXcbUnixEventDispatcher::hasPendingEvents()
-{
- extern uint qGlobalPostedEventsCount();
- return qGlobalPostedEventsCount() || QWindowSystemInterface::windowSystemEventsQueued();
-}
-
-void QXcbUnixEventDispatcher::flush()
-{
- if (qApp)
- qApp->sendPostedEvents();
-}
-
#if QT_CONFIG(glib)
struct XcbEventSource
{
diff --git a/src/plugins/platforms/xcb/qxcbeventdispatcher.h b/src/plugins/platforms/xcb/qxcbeventdispatcher.h
index ddf448cf87..8dffeef031 100644
--- a/src/plugins/platforms/xcb/qxcbeventdispatcher.h
+++ b/src/plugins/platforms/xcb/qxcbeventdispatcher.h
@@ -60,12 +60,6 @@ public:
~QXcbUnixEventDispatcher();
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
- // Maybe some user code depends on deprecated QUnixEventDispatcherQPA::
- // hasPendingEvents() / flush() implementation, so keep it around until
- // Qt 6. These methods are deprecated in QAbstractEventDispatcher.
- bool hasPendingEvents() override; // ### Qt 6 remove
- void flush() override; // ### Qt 6 remove
-
private:
QXcbConnection *m_connection;
};
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index c7b8fb86db..89395cb21d 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -142,8 +142,6 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
m_instance = this;
qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
- QWindowSystemInterface::setPlatformFiltersEvents(true);
-
qRegisterMetaType<QXcbWindow*>();
#if QT_CONFIG(xcb_xlib)
XInitThreads();
@@ -278,7 +276,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
QOpenGLContext *QXcbIntegration::createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const
{
- using namespace QPlatformInterface::Private;
+ using namespace QNativeInterface::Private;
if (auto *glxIntegration = dynamic_cast<QGLXIntegration*>(m_connection->glIntegration()))
return glxIntegration->createOpenGLContext(context, visualInfo, shareContext);
else
@@ -288,7 +286,7 @@ QOpenGLContext *QXcbIntegration::createOpenGLContext(GLXContext context, void *v
#if QT_CONFIG(egl)
QOpenGLContext *QXcbIntegration::createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const
{
- using namespace QPlatformInterface::Private;
+ using namespace QNativeInterface::Private;
if (auto *eglIntegration = dynamic_cast<QEGLIntegration*>(m_connection->glIntegration()))
return eglIntegration->createOpenGLContext(context, display, shareContext);
else
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 043dc13711..eb58433967 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -57,9 +57,9 @@ class QXcbNativeInterface;
class Q_XCB_EXPORT QXcbIntegration : public QPlatformIntegration
#ifndef QT_NO_OPENGL
- , public QPlatformInterface::Private::QGLXIntegration
+ , public QNativeInterface::Private::QGLXIntegration
# if QT_CONFIG(egl)
- , public QPlatformInterface::Private::QEGLIntegration
+ , public QNativeInterface::Private::QEGLIntegration
# endif
#endif
{
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index bb168b9b00..738d0e3b91 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -158,14 +158,14 @@ QList<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const
}
QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &d, const QString &format,
- QMetaType::Type requestedType, bool hasUtf8)
+ QMetaType requestedType, bool hasUtf8)
{
QByteArray data = d;
QString atomName = mimeAtomToString(connection, a);
// qDebug() << "mimeConvertDataToFormat" << format << atomName << data;
if (hasUtf8 && atomName == format + QLatin1String(";charset=utf-8")) {
- if (requestedType == QMetaType::QString)
+ if (requestedType.id() == QMetaType::QString)
return QString::fromUtf8(data);
return data;
}
@@ -255,7 +255,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
return QVariant();
}
-xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType,
+xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType requestedType,
const QList<xcb_atom_t> &atoms, bool *hasUtf8)
{
*hasUtf8 = false;
@@ -288,7 +288,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
// for string/text requests try to use a format with a well-defined charset
// first to avoid encoding problems
- if (requestedType == QMetaType::QString
+ if (requestedType.id() == QMetaType::QString
&& format.startsWith(QLatin1String("text/"))
&& !format.contains(QLatin1String("charset="))) {
diff --git a/src/plugins/platforms/xcb/qxcbmime.h b/src/plugins/platforms/xcb/qxcbmime.h
index d348bae77e..fe9b2249c9 100644
--- a/src/plugins/platforms/xcb/qxcbmime.h
+++ b/src/plugins/platforms/xcb/qxcbmime.h
@@ -60,8 +60,8 @@ public:
static bool mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data,
xcb_atom_t *atomFormat, int *dataFormat);
static QVariant mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format,
- QMetaType::Type requestedType, bool hasUtf8);
- static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType,
+ QMetaType requestedType, bool hasUtf8);
+ static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType requestedType,
const QList<xcb_atom_t> &atoms, bool *hasUtf8);
};
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 9dc7c97eab..e65418b077 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -112,11 +112,28 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
xcb_depth_next(&depth_iterator);
}
+
+ auto dpiChangedCallback = [](QXcbVirtualDesktop *desktop, const QByteArray &, const QVariant &property, void *) {
+ bool ok;
+ int dpiTimes1k = property.toInt(&ok);
+ if (!ok)
+ return;
+ int dpi = dpiTimes1k / 1024;
+ if (desktop->m_forcedDpi == dpi)
+ return;
+ desktop->m_forcedDpi = dpi;
+ for (QXcbScreen *screen : desktop->connection()->screens())
+ QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen->QPlatformScreen::screen(), dpi, dpi);
+ };
+ xSettings()->registerCallbackForProperty("Xft/DPI", dpiChangedCallback, nullptr);
}
QXcbVirtualDesktop::~QXcbVirtualDesktop()
{
delete m_xSettings;
+
+ for (auto cmap : qAsConst(m_visualColormaps))
+ xcb_free_colormap(xcb_connection(), cmap);
}
QDpi QXcbVirtualDesktop::dpi() const
@@ -479,9 +496,24 @@ quint8 QXcbVirtualDesktop::depthOfVisual(xcb_visualid_t visualid) const
return *it;
}
+xcb_colormap_t QXcbVirtualDesktop::colormapForVisual(xcb_visualid_t visualid) const
+{
+ auto it = m_visualColormaps.constFind(visualid);
+ if (it != m_visualColormaps.constEnd())
+ return *it;
+
+ auto cmap = xcb_generate_id(xcb_connection());
+ xcb_create_colormap(xcb_connection(),
+ XCB_COLORMAP_ALLOC_NONE,
+ cmap,
+ screen()->root,
+ visualid);
+ m_visualColormaps.insert(visualid, cmap);
+ return cmap;
+}
+
QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop,
- xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output,
- const xcb_xinerama_screen_info_t *xineramaScreenInfo, int xineramaScreenIdx)
+ xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output)
: QXcbObject(connection)
, m_virtualDesktop(virtualDesktop)
, m_output(outputId)
@@ -497,13 +529,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation);
updateRefreshRate(crtc->mode);
}
- } else if (xineramaScreenInfo) {
- m_geometry = QRect(xineramaScreenInfo->x_org, xineramaScreenInfo->y_org,
- xineramaScreenInfo->width, xineramaScreenInfo->height);
- m_availableGeometry = m_geometry & m_virtualDesktop->workArea();
- m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), m_virtualDesktop->dpi());
- if (xineramaScreenIdx > -1)
- m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx);
}
if (m_geometry.isEmpty())
@@ -684,7 +709,12 @@ QDpi QXcbScreen::logicalDpi() const
if (forcedDpi > 0)
return QDpi(forcedDpi, forcedDpi);
- return m_virtualDesktop->dpi();
+ // Fall back to 96 DPI in case no logical DPI is set. We don't want to
+ // return physical DPI here, since that is a differnt type of DPI: Logical
+ // DPI typically accounts for user preference and viewing distance, and is
+ // quantized into DPI classes (96, 144, 192, etc); pysical DPI is an exact
+ // physical measure.
+ return QDpi(96, 96);
}
QPlatformCursor *QXcbScreen::cursor() const
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 60ef82bae3..267c8b8911 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -47,7 +47,6 @@
#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <xcb/xfixes.h>
-#include <xcb/xinerama.h>
#include "qxcbobject.h"
@@ -108,6 +107,7 @@ public:
const xcb_visualtype_t *visualForFormat(const QSurfaceFormat &format) const;
const xcb_visualtype_t *visualForId(xcb_visualid_t) const;
quint8 depthOfVisual(xcb_visualid_t) const;
+ xcb_colormap_t colormapForVisual(xcb_visualid_t) const;
private:
QRect getWorkArea() const;
@@ -134,16 +134,16 @@ private:
QString m_windowManagerName;
QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals;
QMap<xcb_visualid_t, quint8> m_visualDepths;
+ mutable QMap<xcb_visualid_t, xcb_colormap_t> m_visualColormaps;
uint16_t m_rotation = 0;
};
class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen
- , public QPlatformInterface::Private::QXcbScreen
+ , public QNativeInterface::Private::QXcbScreen
{
public:
QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop,
- xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo,
- const xcb_xinerama_screen_info_t *xineramaScreenInfo = nullptr, int xineramaScreenIdx = -1);
+ xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo);
~QXcbScreen();
QString getOutputName(xcb_randr_get_output_info_reply_t *outputInfo);
@@ -192,6 +192,7 @@ public:
const xcb_visualtype_t *visualForFormat(const QSurfaceFormat &format) const { return m_virtualDesktop->visualForFormat(format); }
const xcb_visualtype_t *visualForId(xcb_visualid_t visualid) const;
+ xcb_colormap_t colormapForVisual(xcb_visualid_t visualid) const { return m_virtualDesktop->colormapForVisual(visualid); }
quint8 depthOfVisual(xcb_visualid_t visualid) const { return m_virtualDesktop->depthOfVisual(visualid); }
QString name() const override { return m_outputName; }
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 224f0bd4cb..359ee14488 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -356,23 +356,8 @@ void QXcbWindow::create()
| XCB_CW_BIT_GRAVITY
| XCB_CW_OVERRIDE_REDIRECT
| XCB_CW_SAVE_UNDER
- | XCB_CW_EVENT_MASK;
-
- static auto haveOpenGL = []() {
- static const bool result = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL);
- return result;
- };
-
- if ((window()->supportsOpenGL() && haveOpenGL()) || m_format.hasAlpha()) {
- m_cmap = xcb_generate_id(xcb_connection());
- xcb_create_colormap(xcb_connection(),
- XCB_COLORMAP_ALLOC_NONE,
- m_cmap,
- xcb_parent_id,
- m_visualId);
-
- mask |= XCB_CW_COLORMAP;
- }
+ | XCB_CW_EVENT_MASK
+ | XCB_CW_COLORMAP;
quint32 values[] = {
XCB_BACK_PIXMAP_NONE,
@@ -381,7 +366,7 @@ void QXcbWindow::create()
type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint),
type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer,
defaultEventMask,
- m_cmap
+ platformScreen->colormapForVisual(m_visualId)
};
m_window = xcb_generate_id(xcb_connection());
@@ -480,12 +465,8 @@ void QXcbWindow::create()
atom(QXcbAtom::_XEMBED_INFO),
32, 2, (void *)data);
- if (connection()->hasXInput2()) {
- if (connection()->xi2MouseEventsDisabled())
- connection()->xi2SelectDeviceEventsCompatibility(m_window);
- else
- connection()->xi2SelectDeviceEvents(m_window);
- }
+ if (connection()->hasXInput2())
+ connection()->xi2SelectDeviceEvents(m_window);
setWindowState(window()->windowStates());
setWindowFlags(window()->flags());
@@ -556,9 +537,7 @@ void QXcbWindow::destroy()
xcb_destroy_window(xcb_connection(), m_window);
m_window = 0;
}
- if (m_cmap) {
- xcb_free_colormap(xcb_connection(), m_cmap);
- }
+
m_mapped = false;
if (m_pendingSyncRequest)
@@ -1392,7 +1371,7 @@ void QXcbWindow::propagateSizeHints()
xcb_icccm_set_wm_normal_hints(xcb_connection(), m_window, &hints);
- m_sizeHintsScaleFactor = QHighDpiScaling::scaleAndOrigin(screen()).factor;
+ m_sizeHintsScaleFactor = QHighDpiScaling::factor(screen());
}
void QXcbWindow::requestActivateWindow()
@@ -1756,7 +1735,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
// will make the comparison later.
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
- if (!qFuzzyCompare(QHighDpiScaling::scaleAndOrigin(newScreen).factor, m_sizeHintsScaleFactor))
+ if (!qFuzzyCompare(QHighDpiScaling::factor(newScreen), m_sizeHintsScaleFactor))
propagateSizeHints();
// Send the synthetic expose event on resize only when the window is shrinked,
@@ -1915,7 +1894,7 @@ static inline bool doCheckUnGrabAncestor(QXcbConnection *conn)
*/
if (conn) {
const bool mouseButtonsPressed = (conn->buttonState() != Qt::NoButton);
- return mouseButtonsPressed || (conn->hasXInput2() && !conn->xi2MouseEventsDisabled());
+ return mouseButtonsPressed || conn->hasXInput2();
}
return true;
}
@@ -2266,7 +2245,7 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
if (grab && !connection()->canGrab())
return false;
- if (connection()->hasXInput2() && !connection()->xi2MouseEventsDisabled()) {
+ if (connection()->hasXInput2()) {
bool result = connection()->xi2SetMouseGrabEnabled(m_window, grab);
if (grab && result)
connection()->setMouseGrabber(this);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index b8e5159c7f..5e5aa96629 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -57,7 +57,7 @@ class QXcbSyncWindowRequest;
class QIcon;
class Q_XCB_EXPORT QXcbWindow : public QXcbObject, public QXcbWindowEventListener, public QPlatformWindow
- , public QPlatformInterface::Private::QXcbWindow
+ , public QNativeInterface::Private::QXcbWindow
{
public:
enum NetWmState {
@@ -233,7 +233,6 @@ protected:
quint8 mode, quint8 detail, xcb_timestamp_t timestamp);
xcb_window_t m_window = 0;
- xcb_colormap_t m_cmap = 0;
uint m_depth = 0;
QImage::Format m_imageFormat = QImage::Format_ARGB32_Premultiplied;
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index f44388cc6d..bb57e16ab5 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -85,7 +85,7 @@ qtConfig(vulkan) {
QMAKE_USE += \
xcb xcb_icccm xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil \
- xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xkbcommon xkbcommon_x11
+ xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xkb xkbcommon xkbcommon_x11
qtConfig(system-xcb-xinput) {
QMAKE_USE += xcb_xinput
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index 65564b59a1..258c4305ff 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -575,8 +575,7 @@ static QFont qt_fontFromString(const QString &name)
if (!family.isEmpty())
font.setFamily(family);
- const int weight = pango_font_description_get_weight(desc);
- font.setWeight(QPlatformFontDatabase::weightFromInteger(weight));
+ font.setWeight(QFont::Weight(pango_font_description_get_weight(desc)));
PangoStyle style = pango_font_description_get_style(desc);
if (style == PANGO_STYLE_ITALIC)
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
index d9d117faeb..3e00d9610f 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
@@ -56,7 +56,7 @@ static guint qt_gdkKey(const QKeySequence &shortcut)
// TODO: proper mapping
Qt::KeyboardModifiers mods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier;
- return (shortcut[0] ^ mods) & shortcut[0];
+ return (shortcut[0].toCombined() ^ mods) & shortcut[0].toCombined();
}
static GdkModifierType qt_gdkModifiers(const QKeySequence &shortcut)
@@ -65,7 +65,7 @@ static GdkModifierType qt_gdkModifiers(const QKeySequence &shortcut)
return GdkModifierType(0);
guint mods = 0;
- int m = shortcut[0];
+ Qt::KeyboardModifiers m = shortcut[0].keyboardModifiers();
if (m & Qt::ShiftModifier)
mods |= GDK_SHIFT_MASK;
if (m & Qt::ControlModifier)
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
index 4b37367ad0..c4dc2da623 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
@@ -116,6 +116,10 @@ public:
QString title;
QStringList nameFilters;
QStringList mimeTypesFilters;
+ // maps user-visible name for portal to full name filter
+ QMap<QString, QString> userVisibleToNameFilter;
+ QString selectedMimeTypeFilter;
+ QString selectedNameFilter;
QStringList selectedFiles;
QPlatformFileDialogHelper *nativeFileDialog = nullptr;
};
@@ -164,12 +168,18 @@ void QXdgDesktopPortalFileDialog::initializeDialog()
if (!options()->mimeTypeFilters().isEmpty())
d->mimeTypesFilters = options()->mimeTypeFilters();
+ if (!options()->initiallySelectedMimeTypeFilter().isEmpty())
+ d->selectedMimeTypeFilter = options()->initiallySelectedMimeTypeFilter();
+
+ if (!options()->initiallySelectedNameFilter().isEmpty())
+ d->selectedNameFilter = options()->initiallySelectedNameFilter();
+
setDirectory(options()->initialDirectory());
}
void QXdgDesktopPortalFileDialog::openPortal()
{
- Q_D(const QXdgDesktopPortalFileDialog);
+ Q_D(QXdgDesktopPortalFileDialog);
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
QLatin1String("/org/freedesktop/portal/desktop"),
@@ -200,6 +210,9 @@ void QXdgDesktopPortalFileDialog::openPortal()
qDBusRegisterMetaType<FilterList>();
FilterList filterList;
+ auto selectedFilterIndex = filterList.size() - 1;
+
+ d->userVisibleToNameFilter.clear();
if (!d->mimeTypesFilters.isEmpty()) {
for (const QString &mimeTypefilter : d->mimeTypesFilters) {
@@ -221,17 +234,25 @@ void QXdgDesktopPortalFileDialog::openPortal()
filter.filterConditions = filterConditions;
filterList << filter;
+
+ if (!d->selectedMimeTypeFilter.isEmpty() && d->selectedMimeTypeFilter == mimeTypefilter)
+ selectedFilterIndex = filterList.size() - 1;
}
} else if (!d->nameFilters.isEmpty()) {
- for (const QString &filter : d->nameFilters) {
+ for (const QString &nameFilter : d->nameFilters) {
// Do parsing:
// Supported format is ("Images (*.png *.jpg)")
QRegularExpression regexp(QPlatformFileDialogHelper::filterRegExp);
- QRegularExpressionMatch match = regexp.match(filter);
+ QRegularExpressionMatch match = regexp.match(nameFilter);
if (match.hasMatch()) {
QString userVisibleName = match.captured(1);
QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), Qt::SkipEmptyParts);
+ if (filterStrings.isEmpty()) {
+ qWarning() << "Filter " << userVisibleName << " is empty and will be ignored.";
+ continue;
+ }
+
FilterConditionList filterConditions;
for (const QString &filterString : filterStrings) {
FilterCondition filterCondition;
@@ -245,6 +266,11 @@ void QXdgDesktopPortalFileDialog::openPortal()
filter.filterConditions = filterConditions;
filterList << filter;
+
+ d->userVisibleToNameFilter.insert(userVisibleName, nameFilter);
+
+ if (!d->selectedNameFilter.isEmpty() && d->selectedNameFilter == nameFilter)
+ selectedFilterIndex = filterList.size() - 1;
}
}
}
@@ -252,6 +278,9 @@ void QXdgDesktopPortalFileDialog::openPortal()
if (!filterList.isEmpty())
options.insert(QLatin1String("filters"), QVariant::fromValue(filterList));
+ if (selectedFilterIndex != -1)
+ options.insert(QLatin1String("current_filter"), QVariant::fromValue(filterList[selectedFilterIndex]));
+
options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));
// TODO choices a(ssa(ss)s)
@@ -339,6 +368,21 @@ void QXdgDesktopPortalFileDialog::setFilter()
}
}
+void QXdgDesktopPortalFileDialog::selectMimeTypeFilter(const QString &filter)
+{
+ Q_D(QXdgDesktopPortalFileDialog);
+ if (d->nativeFileDialog) {
+ d->nativeFileDialog->setOptions(options());
+ d->nativeFileDialog->selectMimeTypeFilter(filter);
+ }
+}
+
+QString QXdgDesktopPortalFileDialog::selectedMimeTypeFilter() const
+{
+ Q_D(const QXdgDesktopPortalFileDialog);
+ return d->selectedMimeTypeFilter;
+}
+
void QXdgDesktopPortalFileDialog::selectNameFilter(const QString &filter)
{
Q_D(QXdgDesktopPortalFileDialog);
@@ -351,8 +395,8 @@ void QXdgDesktopPortalFileDialog::selectNameFilter(const QString &filter)
QString QXdgDesktopPortalFileDialog::selectedNameFilter() const
{
- // TODO
- return QString();
+ Q_D(const QXdgDesktopPortalFileDialog);
+ return d->selectedNameFilter;
}
void QXdgDesktopPortalFileDialog::exec()
@@ -404,6 +448,17 @@ void QXdgDesktopPortalFileDialog::gotResponse(uint response, const QVariantMap &
if (results.contains(QLatin1String("uris")))
d->selectedFiles = results.value(QLatin1String("uris")).toStringList();
+ if (results.contains(QLatin1String("current_filter"))) {
+ const Filter selectedFilter = qdbus_cast<Filter>(results.value(QStringLiteral("current_filter")));
+ if (!selectedFilter.filterConditions.empty() && selectedFilter.filterConditions[0].type == MimeType) {
+ // s.a. QXdgDesktopPortalFileDialog::openPortal which basically does the inverse
+ d->selectedMimeTypeFilter = selectedFilter.filterConditions[0].pattern;
+ d->selectedNameFilter.clear();
+ } else {
+ d->selectedNameFilter = d->userVisibleToNameFilter.value(selectedFilter.name);
+ d->selectedMimeTypeFilter.clear();
+ }
+ }
Q_EMIT accept();
} else {
Q_EMIT reject();
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog_p.h b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog_p.h
index b21a9f7d84..ce1a0720bb 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog_p.h
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog_p.h
@@ -80,6 +80,8 @@ public:
void setFilter() override;
void selectNameFilter(const QString &filter) override;
QString selectedNameFilter() const override;
+ void selectMimeTypeFilter(const QString &filter) override;
+ QString selectedMimeTypeFilter() const override;
void exec() override;
bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
diff --git a/src/plugins/printsupport/.prev_CMakeLists.txt b/src/plugins/printsupport/.prev_CMakeLists.txt
index 14b36b4b7f..6d265f9285 100644
--- a/src/plugins/printsupport/.prev_CMakeLists.txt
+++ b/src/plugins/printsupport/.prev_CMakeLists.txt
@@ -1,8 +1,5 @@
# Generated from printsupport.pro.
-if(WIN32)
- add_subdirectory(windows)
-endif()
if(QT_FEATURE_cups AND UNIX AND NOT APPLE)
add_subdirectory(cups)
endif()
diff --git a/src/plugins/printsupport/CMakeLists.txt b/src/plugins/printsupport/CMakeLists.txt
index 811e33c93f..6d265f9285 100644
--- a/src/plugins/printsupport/CMakeLists.txt
+++ b/src/plugins/printsupport/CMakeLists.txt
@@ -1,8 +1,5 @@
# Generated from printsupport.pro.
-if(WIN32)
- # add_subdirectory(windows) # special case TODO
-endif()
if(QT_FEATURE_cups AND UNIX AND NOT APPLE)
add_subdirectory(cups)
endif()
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp
index 7503e70a4c..6a5e7504e5 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp
+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp
@@ -52,6 +52,10 @@
QT_BEGIN_NAMESPACE
+// avoid all the warnings about using deprecated API from CUPS (as there is no real replacement)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
QPpdPrintDevice::QPpdPrintDevice(const QString &id)
: QPlatformPrintDevice(id),
m_cupsDest(0),
@@ -508,4 +512,6 @@ cups_ptype_e QPpdPrintDevice::printerTypeFlags() const
return static_cast<cups_ptype_e>(printerOption("printer-type").toUInt());
}
+QT_WARNING_POP
+
QT_END_NAMESPACE
diff --git a/src/plugins/printsupport/printsupport.pro b/src/plugins/printsupport/printsupport.pro
index c7110ec338..a7397a7390 100644
--- a/src/plugins/printsupport/printsupport.pro
+++ b/src/plugins/printsupport/printsupport.pro
@@ -1,5 +1,4 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += printsupport-private
-win32: SUBDIRS += windows
unix:!darwin:qtConfig(cups): SUBDIRS += cups
diff --git a/src/plugins/printsupport/windows/main.cpp b/src/plugins/printsupport/windows/main.cpp
deleted file mode 100644
index 7575006569..0000000000
--- a/src/plugins/printsupport/windows/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <qpa/qplatformprintplugin.h>
-#include <QtCore/QStringList>
-
-#include "qwindowsprintersupport.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWindowsPrinterSupportPlugin : public QPlatformPrinterSupportPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QPlatformPrinterSupportFactoryInterface_iid FILE "windows.json")
-
-public:
- QPlatformPrinterSupport *create(const QString &);
-};
-
-QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key)
-{
- if (key.compare(key, QLatin1String("windowsprintsupport"), Qt::CaseInsensitive) == 0)
- return new QWindowsPrinterSupport;
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
deleted file mode 100644
index bfd7a9a946..0000000000
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
+++ /dev/null
@@ -1,571 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsprintdevice.h"
-
-#include <qdebug.h>
-
-#ifndef DC_COLLATE
-# define DC_COLLATE 22
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QT_WARNING_DISABLE_GCC("-Wsign-compare")
-typedef QList<QWindowsPrinterInfo> WindowsPrinterLookup;
-Q_GLOBAL_STATIC(WindowsPrinterLookup, windowsDeviceLookup);
-
-extern qreal qt_pointMultiplier(QPageLayout::Unit unit);
-
-static inline uint qwcsnlen(const wchar_t *str, uint maxlen)
-{
- uint length = 0;
- if (str) {
- while (length < maxlen && *str++)
- length++;
- }
- return length;
-}
-
-static QPrint::InputSlot paperBinToInputSlot(int windowsId, const QString &name)
-{
- QPrint::InputSlot slot;
- slot.name = name;
- int i;
- for (i = 0; inputSlotMap[i].id != QPrint::CustomInputSlot; ++i) {
- if (inputSlotMap[i].windowsId == windowsId) {
- slot.key = inputSlotMap[i].key;
- slot.id = inputSlotMap[i].id;
- slot.windowsId = inputSlotMap[i].windowsId;
- return slot;
- }
- }
- slot.key = inputSlotMap[i].key;
- slot.id = inputSlotMap[i].id;
- slot.windowsId = windowsId;
- return slot;
-}
-
-static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId)
-{
- LPWSTR printerIdUtf16 = const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(printerId.utf16()));
- // Allocate the required DEVMODE buffer
- LONG dmSize = DocumentProperties(NULL, hPrinter, printerIdUtf16, NULL, NULL, 0);
- if (dmSize <= 0)
- return nullptr;
- LPDEVMODE pDevMode = reinterpret_cast<LPDEVMODE>(malloc(dmSize));
- // Get the default DevMode
- LONG result = DocumentProperties(NULL, hPrinter, printerIdUtf16, pDevMode, NULL, DM_OUT_BUFFER);
- if (result != IDOK) {
- free(pDevMode);
- pDevMode = nullptr;
- }
- return pDevMode;
-}
-
-QWindowsPrintDevice::QWindowsPrintDevice()
- : QPlatformPrintDevice(),
- m_hPrinter(0)
-{
-}
-
-QWindowsPrintDevice::QWindowsPrintDevice(const QString &id)
- : QPlatformPrintDevice(id),
- m_hPrinter(0)
-{
- // First do a fast lookup to see if printer exists, if it does then open it
- if (!id.isEmpty() && QWindowsPrintDevice::availablePrintDeviceIds().contains(id)) {
- if (OpenPrinter(const_cast<LPWSTR>(wcharId()), &m_hPrinter, nullptr)) {
- DWORD needed = 0;
- GetPrinter(m_hPrinter, 2, 0, 0, &needed);
- QScopedArrayPointer<BYTE> buffer(new BYTE[needed]);
- if (GetPrinter(m_hPrinter, 2, buffer.data(), needed, &needed)) {
- PPRINTER_INFO_2 info = reinterpret_cast<PPRINTER_INFO_2>(buffer.data());
- m_name = QString::fromWCharArray(info->pPrinterName);
- m_location = QString::fromWCharArray(info->pLocation);
- m_makeAndModel = QString::fromWCharArray(info->pDriverName); // TODO Check is not available elsewhere
- m_isRemote = info->Attributes & PRINTER_ATTRIBUTE_NETWORK;
- }
- QWindowsPrinterInfo m_info;
- m_info.m_id = m_id;
- m_info.m_name = m_name;
- m_info.m_location = m_location;
- m_info.m_makeAndModel = m_makeAndModel;
- m_info.m_isRemote = m_isRemote;
- m_infoIndex = windowsDeviceLookup()->indexOf(m_info);
- if (m_infoIndex != -1) {
- m_info = windowsDeviceLookup()->at(m_infoIndex);
- m_havePageSizes = m_info.m_havePageSizes;
- m_pageSizes = m_info.m_pageSizes;
- m_haveResolutions = m_info.m_haveResolutions;
- m_resolutions = m_info.m_resolutions;
- m_haveCopies = m_info.m_haveCopies;
- m_supportsMultipleCopies = m_info.m_supportsMultipleCopies;
- m_supportsCollateCopies = m_info.m_supportsCollateCopies;
- m_haveMinMaxPageSizes = m_info.m_haveMinMaxPageSizes;
- m_minimumPhysicalPageSize = m_info.m_minimumPhysicalPageSize;
- m_maximumPhysicalPageSize = m_info.m_maximumPhysicalPageSize;
- m_supportsCustomPageSizes = m_info.m_supportsCustomPageSizes;
- m_haveInputSlots = m_info.m_haveInputSlots;
- m_inputSlots = m_info.m_inputSlots;
- m_haveOutputBins = m_info.m_haveOutputBins;
- m_outputBins = m_info.m_outputBins;
- m_haveDuplexModes = m_info.m_haveDuplexModes;
- m_duplexModes = m_info.m_duplexModes;
- m_haveColorModes = m_info.m_haveColorModes;
- m_colorModes = m_info.m_colorModes;
- m_infoIndex = windowsDeviceLookup()->indexOf(m_info);
- } else {
- windowsDeviceLookup()->append(m_info);
- m_infoIndex = windowsDeviceLookup()->count() - 1;
- }
- }
- }
-}
-
-QWindowsPrintDevice::~QWindowsPrintDevice()
-{
- ClosePrinter(m_hPrinter);
-}
-
-bool QWindowsPrintDevice::isValid() const
-{
- return m_hPrinter;
-}
-
-bool QWindowsPrintDevice::isDefault() const
-{
- return m_id == defaultPrintDeviceId();
-}
-
-QPrint::DeviceState QWindowsPrintDevice::state() const
-{
- DWORD needed = 0;
- GetPrinter(m_hPrinter, 6, 0, 0, &needed);
- QScopedArrayPointer<BYTE> buffer(new BYTE[needed]);
-
- if (GetPrinter(m_hPrinter, 6, buffer.data(), needed, &needed)) {
- PPRINTER_INFO_6 info = reinterpret_cast<PPRINTER_INFO_6>(buffer.data());
- // TODO Check mapping
- if (info->dwStatus == 0
- || (info->dwStatus & PRINTER_STATUS_WAITING) == PRINTER_STATUS_WAITING
- || (info->dwStatus & PRINTER_STATUS_POWER_SAVE) == PRINTER_STATUS_POWER_SAVE) {
- return QPrint::Idle;
- } else if ((info->dwStatus & PRINTER_STATUS_PRINTING) == PRINTER_STATUS_PRINTING
- || (info->dwStatus & PRINTER_STATUS_BUSY) == PRINTER_STATUS_BUSY
- || (info->dwStatus & PRINTER_STATUS_INITIALIZING) == PRINTER_STATUS_INITIALIZING
- || (info->dwStatus & PRINTER_STATUS_IO_ACTIVE) == PRINTER_STATUS_IO_ACTIVE
- || (info->dwStatus & PRINTER_STATUS_PROCESSING) == PRINTER_STATUS_PROCESSING
- || (info->dwStatus & PRINTER_STATUS_WARMING_UP) == PRINTER_STATUS_WARMING_UP) {
- return QPrint::Active;
- }
- }
-
- return QPrint::Error;
-}
-
-void QWindowsPrintDevice::loadPageSizes() const
-{
- // Get the number of paper sizes and check all 3 attributes have same count
- DWORD paperCount = DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_PAPERNAMES, NULL, NULL);
- if (int(paperCount) > 0
- && DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_PAPERSIZE, NULL, NULL) == paperCount
- && DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_PAPERS, NULL, NULL) == paperCount) {
-
- QScopedArrayPointer<wchar_t> paperNames(new wchar_t[paperCount*64]);
- QScopedArrayPointer<POINT> winSizes(new POINT[paperCount]);
- QScopedArrayPointer<wchar_t> papers(new wchar_t[paperCount]);
-
- // Get the details and match the default paper size
- if (DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_PAPERNAMES, paperNames.data(), NULL) == paperCount
- && DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_PAPERSIZE, (wchar_t *)winSizes.data(), NULL) == paperCount
- && DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_PAPERS, papers.data(), NULL) == paperCount) {
-
- // Returned size is in tenths of a millimeter
- const qreal multiplier = qt_pointMultiplier(QPageLayout::Millimeter);
- for (int i = 0; i < int(paperCount); ++i) {
- QSize size = QSize(qRound((winSizes[i].x / 10.0) * multiplier), qRound((winSizes[i].y / 10.0) * multiplier));
- wchar_t *paper = paperNames.data() + (i * 64);
- QString name = QString::fromWCharArray(paper, qwcsnlen(paper, 64));
- m_pageSizes.append(createPageSize(papers[i], size, name));
- }
-
- }
- }
-
- m_havePageSizes = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_havePageSizes = true;
- info[m_infoIndex].m_pageSizes = m_pageSizes;
-}
-
-QPageSize QWindowsPrintDevice::defaultPageSize() const
-{
- if (!m_havePageSizes)
- loadPageSizes();
-
- QPageSize pageSize;
-
- if (LPDEVMODE pDevMode = getDevmode(m_hPrinter, m_id)) {
- // Get the default paper size
- if (pDevMode->dmFields & DM_PAPERSIZE) {
- // Find the supported page size that matches, in theory default should be one of them
- foreach (const QPageSize &ps, m_pageSizes) {
- if (ps.windowsId() == pDevMode->dmPaperSize) {
- pageSize = ps;
- break;
- }
- }
- }
- // Clean-up
- free(pDevMode);
- }
-
- return pageSize;
-}
-
-QMarginsF QWindowsPrintDevice::printableMargins(const QPageSize &pageSize,
- QPageLayout::Orientation orientation,
- int resolution) const
-{
- // TODO This is slow, need to cache values or find better way!
- // Modify the DevMode to get the DC printable margins in device pixels
- QMarginsF margins = QMarginsF(0, 0, 0, 0);
- DWORD needed = 0;
- GetPrinter(m_hPrinter, 2, 0, 0, &needed);
- QScopedArrayPointer<BYTE> buffer(new BYTE[needed]);
- if (GetPrinter(m_hPrinter, 2, buffer.data(), needed, &needed)) {
- PPRINTER_INFO_2 info = reinterpret_cast<PPRINTER_INFO_2>(buffer.data());
- LPDEVMODE devMode = info->pDevMode;
- bool separateDevMode = false;
- if (!devMode) {
- // GetPrinter() didn't include the DEVMODE. Get it a different way.
- devMode = getDevmode(m_hPrinter, m_id);
- if (!devMode)
- return margins;
- separateDevMode = true;
- }
-
- HDC pDC = CreateDC(NULL, (LPWSTR)m_id.utf16(), NULL, devMode);
- if (pageSize.id() == QPageSize::Custom || pageSize.windowsId() <= 0 || pageSize.windowsId() > DMPAPER_LAST) {
- devMode->dmPaperSize = 0;
- devMode->dmPaperWidth = pageSize.size(QPageSize::Millimeter).width() * 10.0;
- devMode->dmPaperLength = pageSize.size(QPageSize::Millimeter).height() * 10.0;
- } else {
- devMode->dmPaperSize = pageSize.windowsId();
- }
- devMode->dmPrintQuality = resolution;
- devMode->dmOrientation = orientation == QPageLayout::Portrait ? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
- ResetDC(pDC, devMode);
- const int dpiWidth = GetDeviceCaps(pDC, LOGPIXELSX);
- const int dpiHeight = GetDeviceCaps(pDC, LOGPIXELSY);
- const qreal wMult = 72.0 / dpiWidth;
- const qreal hMult = 72.0 / dpiHeight;
- const qreal physicalWidth = GetDeviceCaps(pDC, PHYSICALWIDTH) * wMult;
- const qreal physicalHeight = GetDeviceCaps(pDC, PHYSICALHEIGHT) * hMult;
- const qreal printableWidth = GetDeviceCaps(pDC, HORZRES) * wMult;
- const qreal printableHeight = GetDeviceCaps(pDC, VERTRES) * hMult;
- const qreal leftMargin = GetDeviceCaps(pDC, PHYSICALOFFSETX)* wMult;
- const qreal topMargin = GetDeviceCaps(pDC, PHYSICALOFFSETY) * hMult;
- const qreal rightMargin = physicalWidth - leftMargin - printableWidth;
- const qreal bottomMargin = physicalHeight - topMargin - printableHeight;
- margins = QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin);
- if (separateDevMode)
- free(devMode);
- DeleteDC(pDC);
- }
- return margins;
-}
-
-void QWindowsPrintDevice::loadResolutions() const
-{
- DWORD resCount = DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_ENUMRESOLUTIONS, NULL, NULL);
- if (int(resCount) > 0) {
- QScopedArrayPointer<LONG> resolutions(new LONG[resCount*2]);
- // Get the details and match the default paper size
- if (DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_ENUMRESOLUTIONS, (LPWSTR)resolutions.data(), NULL) == resCount) {
- for (int i = 0; i < int(resCount * 2); i += 2)
- m_resolutions.append(resolutions[i+1]);
- }
- }
- m_haveResolutions = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveResolutions = true;
- info[m_infoIndex].m_resolutions = m_resolutions;
-}
-
-int QWindowsPrintDevice::defaultResolution() const
-{
- int resolution = 72; // TODO Set a sensible default?
-
- if (LPDEVMODE pDevMode = getDevmode(m_hPrinter, m_id)) {
- // Get the default resolution
- if (pDevMode->dmFields & DM_YRESOLUTION) {
- if (pDevMode->dmPrintQuality > 0)
- resolution = pDevMode->dmPrintQuality;
- else
- resolution = pDevMode->dmYResolution;
- }
- // Clean-up
- free(pDevMode);
- }
- return resolution;
-}
-
-void QWindowsPrintDevice::loadInputSlots() const
-{
- const auto printerId = wcharId();
- DWORD binCount = DeviceCapabilities(printerId, nullptr, DC_BINS, nullptr, nullptr);
- if (int(binCount) > 0
- && DeviceCapabilities(printerId, nullptr, DC_BINNAMES, nullptr, nullptr) == binCount) {
-
- QScopedArrayPointer<WORD> bins(new WORD[binCount]);
- QScopedArrayPointer<wchar_t> binNames(new wchar_t[binCount*24]);
-
- // Get the details and match the default paper size
- if (DeviceCapabilities(printerId, nullptr, DC_BINS,
- reinterpret_cast<LPWSTR>(bins.data()), nullptr) == binCount
- && DeviceCapabilities(printerId, nullptr, DC_BINNAMES, binNames.data(),
- nullptr) == binCount) {
-
- for (int i = 0; i < int(binCount); ++i) {
- wchar_t *binName = binNames.data() + (i * 24);
- QString name = QString::fromWCharArray(binName, qwcsnlen(binName, 24));
- m_inputSlots.append(paperBinToInputSlot(bins[i], name));
- }
-
- }
- }
-
- m_haveInputSlots = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveInputSlots = true;
- info[m_infoIndex].m_inputSlots = m_inputSlots;
-}
-
-QPrint::InputSlot QWindowsPrintDevice::defaultInputSlot() const
-{
- QPrint::InputSlot inputSlot = QPlatformPrintDevice::defaultInputSlot();;
-
- if (LPDEVMODE pDevMode = getDevmode(m_hPrinter, m_id)) {
- // Get the default input slot
- if (pDevMode->dmFields & DM_DEFAULTSOURCE) {
- QPrint::InputSlot tempSlot = paperBinToInputSlot(pDevMode->dmDefaultSource, QString());
- foreach (const QPrint::InputSlot &slot, supportedInputSlots()) {
- if (slot.key == tempSlot.key) {
- inputSlot = slot;
- break;
- }
- }
- }
- // Clean-up
- free(pDevMode);
- }
- return inputSlot;
-}
-
-void QWindowsPrintDevice::loadOutputBins() const
-{
- m_outputBins.append(QPlatformPrintDevice::defaultOutputBin());
- m_haveOutputBins = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveOutputBins = true;
- info[m_infoIndex].m_outputBins = m_outputBins;
-}
-
-void QWindowsPrintDevice::loadDuplexModes() const
-{
- m_duplexModes.append(QPrint::DuplexNone);
- DWORD duplex = DeviceCapabilities(wcharId(), nullptr, DC_DUPLEX, nullptr, nullptr);
- if (int(duplex) == 1) {
- // TODO Assume if duplex flag supports both modes
- m_duplexModes.append(QPrint::DuplexAuto);
- m_duplexModes.append(QPrint::DuplexLongSide);
- m_duplexModes.append(QPrint::DuplexShortSide);
- }
- m_haveDuplexModes = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveDuplexModes = true;
- info[m_infoIndex].m_duplexModes = m_duplexModes;
-}
-
-QPrint::DuplexMode QWindowsPrintDevice::defaultDuplexMode() const
-{
- QPrint::DuplexMode duplexMode = QPrint::DuplexNone;
-
- if (LPDEVMODE pDevMode = getDevmode(m_hPrinter, m_id)) {
- // Get the default duplex mode
- if (pDevMode->dmFields & DM_DUPLEX) {
- if (pDevMode->dmDuplex == DMDUP_VERTICAL)
- duplexMode = QPrint::DuplexLongSide;
- else if (pDevMode->dmDuplex == DMDUP_HORIZONTAL)
- duplexMode = QPrint::DuplexShortSide;
- }
- // Clean-up
- free(pDevMode);
- }
- return duplexMode;
-}
-
-void QWindowsPrintDevice::loadColorModes() const
-{
- m_colorModes.append(QPrint::GrayScale);
- DWORD color = DeviceCapabilities(wcharId(), nullptr, DC_COLORDEVICE, nullptr, nullptr);
- if (int(color) == 1)
- m_colorModes.append(QPrint::Color);
- m_haveColorModes = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveColorModes = true;
- info[m_infoIndex].m_colorModes = m_colorModes;
-}
-
-QPrint::ColorMode QWindowsPrintDevice::defaultColorMode() const
-{
- if (!m_haveColorModes)
- loadColorModes();
- if (!m_colorModes.contains(QPrint::Color))
- return QPrint::GrayScale;
-
- QPrint::ColorMode colorMode = QPrint::GrayScale;
-
- if (LPDEVMODE pDevMode = getDevmode(m_hPrinter, m_id)) {
- // Get the default color mode
- if (pDevMode->dmFields & DM_COLOR && pDevMode->dmColor == DMCOLOR_COLOR)
- colorMode = QPrint::Color;
- // Clean-up
- free(pDevMode);
- }
- return colorMode;
-}
-
-QStringList QWindowsPrintDevice::availablePrintDeviceIds()
-{
- QStringList list;
- DWORD needed = 0;
- DWORD returned = 0;
- if ((!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, 0, 0, &needed, &returned) && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
- || !needed) {
- return list;
- }
- QScopedArrayPointer<BYTE> buffer(new BYTE[needed]);
- if (!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, buffer.data(), needed, &needed, &returned))
- return list;
- PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer.data());
- for (uint i = 0; i < returned; ++i)
- list.append(QString::fromWCharArray(infoList[i].pPrinterName));
- return list;
-}
-
-QString QWindowsPrintDevice::defaultPrintDeviceId()
-{
- DWORD size = 0;
- if (GetDefaultPrinter(NULL, &size) == ERROR_FILE_NOT_FOUND)
- return QString();
-
- QScopedArrayPointer<wchar_t> name(new wchar_t[size]);
- GetDefaultPrinter(name.data(), &size);
- return QString::fromWCharArray(name.data());
-}
-
-void QWindowsPrintDevice::loadCopiesSupport() const
-{
- auto printerId = wcharId();
- m_supportsMultipleCopies = (DeviceCapabilities(printerId, NULL, DC_COPIES, NULL, NULL) > 1);
- m_supportsCollateCopies = DeviceCapabilities(printerId, NULL, DC_COLLATE, NULL, NULL);
- m_haveCopies = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveCopies = true;
- info[m_infoIndex].m_supportsMultipleCopies = m_supportsMultipleCopies;
- info[m_infoIndex].m_supportsCollateCopies = m_supportsCollateCopies;
-}
-
-bool QWindowsPrintDevice::supportsCollateCopies() const
-{
- if (!m_haveCopies)
- loadCopiesSupport();
- return m_supportsCollateCopies;
-}
-
-bool QWindowsPrintDevice::supportsMultipleCopies() const
-{
- if (!m_haveCopies)
- loadCopiesSupport();
- return m_supportsMultipleCopies;
-}
-
-bool QWindowsPrintDevice::supportsCustomPageSizes() const
-{
- if (!m_haveMinMaxPageSizes)
- loadMinMaxPageSizes();
- return m_supportsCustomPageSizes;
-}
-
-QSize QWindowsPrintDevice::minimumPhysicalPageSize() const
-{
- if (!m_haveMinMaxPageSizes)
- loadMinMaxPageSizes();
- return m_minimumPhysicalPageSize;
-}
-
-QSize QWindowsPrintDevice::maximumPhysicalPageSize() const
-{
- if (!m_haveMinMaxPageSizes)
- loadMinMaxPageSizes();
- return m_maximumPhysicalPageSize;
-}
-
-void QWindowsPrintDevice::loadMinMaxPageSizes() const
-{
- // Min/Max custom size is in tenths of a millimeter
- const qreal multiplier = qt_pointMultiplier(QPageLayout::Millimeter);
- auto printerId = wcharId();
- DWORD min = DeviceCapabilities(printerId, NULL, DC_MINEXTENT, NULL, NULL);
- m_minimumPhysicalPageSize = QSize((LOWORD(min) / 10.0) * multiplier, (HIWORD(min) / 10.0) * multiplier);
- DWORD max = DeviceCapabilities(printerId, NULL, DC_MAXEXTENT, NULL, NULL);
- m_maximumPhysicalPageSize = QSize((LOWORD(max) / 10.0) * multiplier, (HIWORD(max) / 10.0) * multiplier);
- m_supportsCustomPageSizes = (m_maximumPhysicalPageSize.width() > 0 && m_maximumPhysicalPageSize.height() > 0);
- m_haveMinMaxPageSizes = true;
- QWindowsPrinterInfo *info = windowsDeviceLookup()->data();
- info[m_infoIndex].m_haveCopies = true;
- info[m_infoIndex].m_supportsMultipleCopies = m_supportsMultipleCopies;
- info[m_infoIndex].m_supportsCollateCopies = m_supportsCollateCopies;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.h b/src/plugins/printsupport/windows/qwindowsprintdevice.h
deleted file mode 100644
index 8b63998181..0000000000
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 John Layt <jlayt@kde.org>
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSPRINTDEVICE_H
-#define QWINDOWSPRINTDEVICE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of internal files. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qpa/qplatformprintdevice.h>
-
-#include <QtCore/qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindowsPrinterInfo
-{
-public:
- bool operator==(const QWindowsPrinterInfo &other) const
- {
- // We only need to check if these are the same for matching up
- return m_id == other.m_id && m_name == other.m_name &&
- m_location == other.m_location &&
- m_makeAndModel == other.m_makeAndModel &&
- m_isRemote == other.m_isRemote;
- }
- QString m_id;
- QString m_name;
- QString m_location;
- QString m_makeAndModel;
- QList<QPageSize> m_pageSizes;
- QList<int> m_resolutions;
- QList<QPrint::InputSlot> m_inputSlots;
- QList<QPrint::OutputBin> m_outputBins;
- QList<QPrint::DuplexMode> m_duplexModes;
- QList<QPrint::ColorMode> m_colorModes;
- QSize m_minimumPhysicalPageSize;
- QSize m_maximumPhysicalPageSize;
- bool m_isRemote = false;
- bool m_havePageSizes = false;
- bool m_haveResolutions = false;
- bool m_haveCopies = false;
- bool m_supportsMultipleCopies = false;
- bool m_supportsCollateCopies = false;
- bool m_haveMinMaxPageSizes = false;
- bool m_supportsCustomPageSizes = false;
- bool m_haveInputSlots = false;
- bool m_haveOutputBins = false;
- bool m_haveDuplexModes = false;
- bool m_haveColorModes = false;
-};
-
-class QWindowsPrintDevice : public QPlatformPrintDevice
-{
-public:
- QWindowsPrintDevice();
- explicit QWindowsPrintDevice(const QString &id);
- virtual ~QWindowsPrintDevice();
-
- bool isValid() const override;
- bool isDefault() const override;
-
- QPrint::DeviceState state() const override;
-
- QPageSize defaultPageSize() const override;
-
- QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
- int resolution) const override;
-
- int defaultResolution() const override;
-
- QPrint::InputSlot defaultInputSlot() const override;
-
- QPrint::DuplexMode defaultDuplexMode() const override;
-
- QPrint::ColorMode defaultColorMode() const override;
-
- static QStringList availablePrintDeviceIds();
- static QString defaultPrintDeviceId();
-
- bool supportsCollateCopies() const override;
- bool supportsMultipleCopies() const override;
- bool supportsCustomPageSizes() const override;
- QSize minimumPhysicalPageSize() const override;
- QSize maximumPhysicalPageSize() const override;
-
-protected:
- void loadPageSizes() const override;
- void loadResolutions() const override;
- void loadInputSlots() const override;
- void loadOutputBins() const override;
- void loadDuplexModes() const override;
- void loadColorModes() const override;
- void loadCopiesSupport() const;
- void loadMinMaxPageSizes() const;
-
-private:
- LPCWSTR wcharId() const { return reinterpret_cast<LPCWSTR>(m_id.utf16()); }
-
- HANDLE m_hPrinter;
- mutable bool m_haveCopies;
- mutable bool m_haveMinMaxPageSizes;
- int m_infoIndex;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSPRINTDEVICE_H
diff --git a/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp b/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp
deleted file mode 100644
index e416dd7a21..0000000000
--- a/src/plugins/printsupport/windows/qwindowsprinterinfo.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qprinterinfo.h"
-#include "qprinterinfo_p.h"
-
-#include <qstringlist.h>
-
-#include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_PRINTER
-
-extern QPrinter::PaperSize mapDevmodePaperSize(int s);
-
-//QList<QPrinterInfo> QPrinterInfo::availablePrinters()
-//{
-// QList<QPrinterInfo> printers;
-
-// DWORD needed = 0;
-// DWORD returned = 0;
-// if (!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, 0, 0, &needed, &returned)) {
-// LPBYTE buffer = new BYTE[needed];
-// if (EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, buffer, needed, &needed, &returned)) {
-// PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer);
-// QPrinterInfo defPrn = defaultPrinter();
-// for (uint i = 0; i < returned; ++i) {
-// QString printerName(QString::fromWCharArray(infoList[i].pPrinterName));
-
-// QPrinterInfo printerInfo(printerName);
-// if (printerInfo.printerName() == defPrn.printerName())
-// printerInfo.d_ptr->isDefault = true;
-// printers.append(printerInfo);
-// }
-// }
-// delete [] buffer;
-// }
-
-// return printers;
-//}
-
-//QPrinterInfo QPrinterInfo::defaultPrinter()
-//{
-// QString noPrinters(QLatin1String("qt_no_printers"));
-// wchar_t buffer[256];
-// GetProfileString(L"windows", L"device", (wchar_t*)noPrinters.utf16(), buffer, 256);
-// QString output = QString::fromWCharArray(buffer);
-// if (output != noPrinters) {
-// // Filter out the name of the printer, which should be everything before a comma.
-// QString printerName = output.split(QLatin1Char(',')).value(0);
-// QPrinterInfo printerInfo(printerName);
-// printerInfo.d_ptr->isDefault = true;
-// return printerInfo;
-// }
-
-// return QPrinterInfo();
-//}
-
-//QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
-//{
-// const Q_D(QPrinterInfo);
-
-// QList<QPrinter::PaperSize> paperSizes;
-// if (isNull())
-// return paperSizes;
-
-// DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
-// NULL, DC_PAPERS, NULL, NULL);
-// if ((int)size != -1) {
-// wchar_t *papers = new wchar_t[size];
-// size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
-// NULL, DC_PAPERS, papers, NULL);
-// for (int c = 0; c < (int)size; ++c)
-// paperSizes.append(mapDevmodePaperSize(papers[c]));
-// delete [] papers;
-// }
-
-// return paperSizes;
-//}
-
-#endif // QT_NO_PRINTER
-
-QT_END_NAMESPACE
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
deleted file mode 100644
index a52ad55576..0000000000
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsprintersupport.h"
-#include "qwindowsprintdevice.h"
-
-#include <QtCore/QStringList>
-#include <qprintengine_win_p.h>
-#include <private/qprintdevice_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QWindowsPrinterSupport::QWindowsPrinterSupport()
- : QPlatformPrinterSupport()
-{
-}
-
-QWindowsPrinterSupport::~QWindowsPrinterSupport()
-{
-}
-
-QPrintEngine *QWindowsPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId)
-{
- return new QWin32PrintEngine(printerMode, deviceId);
-}
-
-QPaintEngine *QWindowsPrinterSupport::createPaintEngine(QPrintEngine *engine, QPrinter::PrinterMode printerMode)
-{
- Q_UNUSED(printerMode);
- return static_cast<QWin32PrintEngine *>(engine);
-}
-
-QPrintDevice QWindowsPrinterSupport::createPrintDevice(const QString &id)
-{
- return QPlatformPrinterSupport::createPrintDevice(new QWindowsPrintDevice(id));
-}
-
-QStringList QWindowsPrinterSupport::availablePrintDeviceIds() const
-{
- return QWindowsPrintDevice::availablePrintDeviceIds();
-}
-
-QString QWindowsPrinterSupport::defaultPrintDeviceId() const
-{
- return QWindowsPrintDevice::defaultPrintDeviceId();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.h b/src/plugins/printsupport/windows/qwindowsprintersupport.h
deleted file mode 100644
index 400701628e..0000000000
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOWSPRINTERSUPPORT_H
-#define WINDOWSPRINTERSUPPORT_H
-
-#include <qpa/qplatformprintersupport.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindowsPrinterSupport : public QPlatformPrinterSupport
-{
- Q_DISABLE_COPY_MOVE(QWindowsPrinterSupport)
-public:
- QWindowsPrinterSupport();
- ~QWindowsPrinterSupport() override;
-
- QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
- QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) override;
-
- QPrintDevice createPrintDevice(const QString &id) override;
- QStringList availablePrintDeviceIds() const override;
- QString defaultPrintDeviceId() const override;
-};
-
-QT_END_NAMESPACE
-
-#endif // WINDOWSPRINTERSUPPORT_H
diff --git a/src/plugins/printsupport/windows/windows.json b/src/plugins/printsupport/windows/windows.json
deleted file mode 100644
index 803052854e..0000000000
--- a/src/plugins/printsupport/windows/windows.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "windowsprintsupport" ]
-}
diff --git a/src/plugins/printsupport/windows/windows.pro b/src/plugins/printsupport/windows/windows.pro
deleted file mode 100644
index 6ca601b2a4..0000000000
--- a/src/plugins/printsupport/windows/windows.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET = windowsprintersupport
-MODULE = windowsprintersupport
-
-QT *= core-private
-QT *= gui-private
-QT *= printsupport-private
-
-INCLUDEPATH *= $$QT_SOURCE_TREE/src/printsupport/kernel
-
-SOURCES += \
- main.cpp \
- qwindowsprintersupport.cpp \
- qwindowsprintdevice.cpp \
-
-HEADERS += \
- qwindowsprintersupport.h \
- qwindowsprintdevice.h \
-
-OTHER_FILES += windows.json
-
-LIBS += -lwinspool -lcomdlg32
-QMAKE_USE_PRIVATE += user32 gdi32
-
-PLUGIN_TYPE = printsupport
-PLUGIN_CLASS_NAME = QWindowsPrinterSupportPlugin
-load(qt_plugin)
diff --git a/src/plugins/sqldrivers/db2/CMakeLists.txt b/src/plugins/sqldrivers/db2/CMakeLists.txt
index cebd216592..061eeae2fd 100644
--- a/src/plugins/sqldrivers/db2/CMakeLists.txt
+++ b/src/plugins/sqldrivers/db2/CMakeLists.txt
@@ -26,7 +26,7 @@ qt_internal_add_plugin(QDB2DriverPlugin
## Scopes:
#####################################################################
-qt_extend_target(QDB2DriverPlugin CONDITION (TEST_architecture_arch STREQUAL "x86_64")
+qt_internal_extend_target(QDB2DriverPlugin CONDITION (TEST_architecture_arch STREQUAL "x86_64")
DEFINES
ODBC64
)
diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index da5ff95179..e3cfa0ae15 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -591,7 +591,7 @@ static bool qMakeStatement(QDB2ResultPrivate* d, bool forwardOnly, bool setForwa
QVariant QDB2Result::handle() const
{
Q_D(const QDB2Result);
- return QVariant(qRegisterMetaType<SQLHANDLE>("SQLHANDLE"), &d->hStmt);
+ return QVariant(QMetaType::fromType<SQLHANDLE>(), &d->hStmt);
}
/************************************/
@@ -702,7 +702,7 @@ bool QDB2Result::exec()
if (bindValueType(i) & QSql::Out)
values[i].detach();
- switch (values.at(i).type()) {
+ switch (values.at(i).metaType().id()) {
case QVariant::Date: {
QByteArray ba;
ba.resize(sizeof(DATE_STRUCT));
@@ -894,7 +894,7 @@ bool QDB2Result::exec()
return true;
for (i = 0; i < values.count(); ++i) {
- switch (values[i].type()) {
+ switch (values[i].metaType().id()) {
case QVariant::Date: {
DATE_STRUCT ds = *((DATE_STRUCT *)tmpStorage.takeFirst().constData());
values[i] = QVariant(QDate(ds.year, ds.month, ds.day));
@@ -921,7 +921,7 @@ bool QDB2Result::exec()
break; }
}
if (indicators[i] == SQL_NULL_DATA)
- values[i] = QVariant(values[i].type());
+ values[i] = QVariant(values[i].metaType());
}
return true;
}
@@ -1052,8 +1052,8 @@ QVariant QDB2Result::data(int field)
return *d->valueCache[field];
- QVariant* v = 0;
- switch (info.type()) {
+ QVariant *v = nullptr;
+ switch (info.metaType().id()) {
case QVariant::LongLong:
v = new QVariant((qint64) qGetBigIntData(d->hStmt, field, isNull));
break;
@@ -1135,7 +1135,7 @@ QVariant QDB2Result::data(int field)
break;
}
if (isNull)
- *v = QVariant(info.type());
+ *v = QVariant(info.metaType());
d->valueCache[field] = v;
return *v;
}
@@ -1687,7 +1687,7 @@ QString QDB2Driver::formatValue(const QSqlField &field, bool trimStrings) const
if (field.isNull())
return QLatin1String("NULL");
- switch (field.type()) {
+ switch (field.metaType().id()) {
case QVariant::DateTime: {
// Use an escape sequence for the datetime fields
if (field.value().toDateTime().isValid()) {
@@ -1729,7 +1729,7 @@ QString QDB2Driver::formatValue(const QSqlField &field, bool trimStrings) const
QVariant QDB2Driver::handle() const
{
Q_D(const QDB2Driver);
- return QVariant(qRegisterMetaType<SQLHANDLE>("SQLHANDLE"), &d->hDbc);
+ return QVariant(QMetaType::fromType<SQLHANDLE>(), &d->hDbc);
}
QString QDB2Driver::escapeIdentifier(const QString &identifier, IdentifierType) const
diff --git a/src/plugins/sqldrivers/db2/qsql_db2_p.h b/src/plugins/sqldrivers/db2/qsql_db2_p.h
index 79ae54ab2d..abe65c4208 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2_p.h
+++ b/src/plugins/sqldrivers/db2/qsql_db2_p.h
@@ -72,8 +72,8 @@ class Q_EXPORT_SQLDRIVER_DB2 QDB2Driver : public QSqlDriver
friend class QDB2ResultPrivate;
public:
- explicit QDB2Driver(QObject* parent = 0);
- QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent = 0);
+ explicit QDB2Driver(QObject *parent = nullptr);
+ QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject *parent = nullptr);
~QDB2Driver();
bool hasFeature(DriverFeature) const override;
void close() override;
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index eae72fff4f..7be2df6dd9 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -64,6 +64,11 @@ QT_BEGIN_NAMESPACE
#define SQLDA_CURRENT_VERSION SQLDA_VERSION1
#endif
+// Firebird uses blr_bool and not blr_boolean_dtype which is what Interbase uses
+#ifndef blr_boolean_dtype
+#define blr_boolean_dtype blr_bool
+#endif
+
enum { QIBaseChunkSize = SHRT_MAX / 2 };
static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlcode)
@@ -117,6 +122,7 @@ static void initDA(XSQLDA *sqlda)
case SQL_TYPE_DATE:
case SQL_TEXT:
case SQL_BLOB:
+ case SQL_BOOLEAN:
sqlda->sqlvar[i].sqldata = new char[sqlda->sqlvar[i].sqllen];
break;
case SQL_ARRAY:
@@ -179,6 +185,8 @@ static QVariant::Type qIBaseTypeName(int iType, bool hasScale)
case blr_d_float:
case blr_double:
return QVariant::Double;
+ case blr_boolean_dtype:
+ return QVariant::Bool;
}
qWarning("qIBaseTypeName: unknown datatype: %d", iType);
return QVariant::Invalid;
@@ -208,6 +216,8 @@ static QVariant::Type qIBaseTypeName2(int iType, bool hasScale)
return QVariant::List;
case SQL_BLOB:
return QVariant::ByteArray;
+ case SQL_BOOLEAN:
+ return QVariant::Bool;
default:
return QVariant::Invalid;
}
@@ -378,7 +388,6 @@ public:
bool writeBlob(int i, const QByteArray &ba);
QVariant fetchArray(int pos, ISC_QUAD *arr);
bool writeArray(int i, const QList<QVariant> &list);
-
public:
ISC_STATUS status[20];
isc_tr_handle trans;
@@ -478,7 +487,7 @@ QVariant QIBaseResultPrivate::fetchBlob(ISC_QUAD *bId)
}
template<typename T>
-static QList<QVariant> toList(char** buf, int count, T* = 0)
+static QList<QVariant> toList(char** buf, int count, T* = nullptr)
{
QList<QVariant> res;
for (int i = 0; i < count; ++i) {
@@ -487,20 +496,6 @@ static QList<QVariant> toList(char** buf, int count, T* = 0)
}
return res;
}
-/* char** ? seems like bad influence from oracle ... */
-template<>
-QList<QVariant> toList<long>(char** buf, int count, long*)
-{
- QList<QVariant> res;
- for (int i = 0; i < count; ++i) {
- if (sizeof(int) == sizeof(long))
- res.append(int((*(long*)(*buf))));
- else
- res.append((qint64)(*(long*)(*buf)));
- *buf += sizeof(long);
- }
- return res;
-}
static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
short* numElements, ISC_ARRAY_DESC *arrayDesc)
@@ -531,7 +526,7 @@ static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
}
break; }
case blr_long:
- valList = toList<long>(&buffer, numElements[dim], static_cast<long *>(0));
+ valList = toList<int>(&buffer, numElements[dim], static_cast<int *>(0));
break;
case blr_short:
valList = toList<short>(&buffer, numElements[dim]);
@@ -563,6 +558,9 @@ static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
buffer += sizeof(ISC_DATE);
}
break;
+ case blr_boolean_dtype:
+ valList = toList<bool>(&buffer, numElements[dim]);
+ break;
}
}
if (dim > 0)
@@ -581,7 +579,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr)
return list;
QByteArray relname(sqlda->sqlvar[pos].relname, sqlda->sqlvar[pos].relname_length);
- QByteArray sqlname(sqlda->sqlvar[pos].aliasname, sqlda->sqlvar[pos].aliasname_length);
+ QByteArray sqlname(sqlda->sqlvar[pos].sqlname, sqlda->sqlvar[pos].sqlname_length);
isc_array_lookup_bounds(status, &ibase, &trans, relname.data(), sqlname.data(), &desc);
if (isError(QT_TRANSLATE_NOOP("QIBaseResult", "Could not find array"),
@@ -626,7 +624,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr)
}
template<typename T>
-static char* fillList(char *buffer, const QList<QVariant> &list, T* = 0)
+static char* fillList(char *buffer, const QList<QVariant> &list, T* = nullptr)
{
for (int i = 0; i < list.size(); ++i) {
T val;
@@ -753,6 +751,9 @@ static char* createArrayBuffer(char *buffer, const QList<QVariant> &list,
buffer += sizeof(ISC_TIMESTAMP);
}
break;
+ case QVariant::Bool:
+ buffer = fillList<bool>(buffer, list);
+ break;
default:
break;
}
@@ -768,7 +769,7 @@ bool QIBaseResultPrivate::writeArray(int column, const QList<QVariant> &list)
ISC_ARRAY_DESC desc;
QByteArray relname(inda->sqlvar[column].relname, inda->sqlvar[column].relname_length);
- QByteArray sqlname(inda->sqlvar[column].aliasname, inda->sqlvar[column].aliasname_length);
+ QByteArray sqlname(inda->sqlvar[column].sqlname, inda->sqlvar[column].sqlname_length);
isc_array_lookup_bounds(status, &ibase, &trans, relname.data(), sqlname.data(), &desc);
if (isError(QT_TRANSLATE_NOOP("QIBaseResult", "Could not find array"),
@@ -1046,6 +1047,9 @@ bool QIBaseResult::exec()
case SQL_ARRAY:
ok &= d->writeArray(para, val.toList());
break;
+ case SQL_BOOLEAN:
+ *((bool*)d->inda->sqlvar[para].sqldata) = val.toBool();
+ break;
default:
qWarning("QIBaseResult::exec: Unknown datatype %d",
d->inda->sqlvar[para].sqltype & ~1);
@@ -1055,10 +1059,10 @@ bool QIBaseResult::exec()
}
if (ok) {
+ isc_dsql_free_statement(d->status, &d->stmt, DSQL_close);
+ if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement")))
+ return false;
if (colCount() && d->queryType != isc_info_sql_stmt_exec_procedure) {
- isc_dsql_free_statement(d->status, &d->stmt, DSQL_close);
- if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement")))
- return false;
cleanup();
}
if (d->queryType == isc_info_sql_stmt_exec_procedure)
@@ -1198,6 +1202,9 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx)
case SQL_ARRAY:
row[idx] = d->fetchArray(i, (ISC_QUAD*)buf);
break;
+ case SQL_BOOLEAN:
+ row[idx] = QVariant(bool((*(bool*)buf)));
+ break;
default:
// unknown type - don't even try to fetch
row[idx] = QVariant();
@@ -1357,8 +1364,8 @@ QSqlRecord QIBaseResult::record() const
q.exec(QLatin1String("select b.RDB$FIELD_PRECISION, b.RDB$FIELD_SCALE, b.RDB$FIELD_LENGTH, a.RDB$NULL_FLAG "
"FROM RDB$RELATION_FIELDS a, RDB$FIELDS b "
"WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE "
- "AND a.RDB$RELATION_NAME = '") + QString::fromLatin1(v.relname, v.relname_length).toUpper() + QLatin1String("' "
- "AND a.RDB$FIELD_NAME = '") + QString::fromLatin1(v.sqlname, v.sqlname_length).toUpper() + QLatin1String("' "));
+ "AND a.RDB$RELATION_NAME = '") + QString::fromLatin1(v.relname, v.relname_length) + QLatin1String("' "
+ "AND a.RDB$FIELD_NAME = '") + QString::fromLatin1(v.sqlname, v.sqlname_length) + QLatin1String("' "));
if(q.first()) {
if(v.sqlscale < 0) {
f.setLength(q.value(0).toInt());
@@ -1379,7 +1386,7 @@ QSqlRecord QIBaseResult::record() const
QVariant QIBaseResult::handle() const
{
Q_D(const QIBaseResult);
- return QVariant(qRegisterMetaType<isc_stmt_handle>("isc_stmt_handle"), &d->stmt);
+ return QVariant(QMetaType::fromType<isc_stmt_handle>(), &d->stmt);
}
/*********************************/
@@ -1730,7 +1737,7 @@ QString QIBaseDriver::formatValue(const QSqlField &field, bool trimStrings) cons
QVariant QIBaseDriver::handle() const
{
Q_D(const QIBaseDriver);
- return QVariant(qRegisterMetaType<isc_db_handle>("isc_db_handle"), &d->ibase);
+ return QVariant(QMetaType::fromType<isc_db_handle>(), &d->ibase);
}
static ISC_EVENT_CALLBACK qEventCallback(char *result, ISC_USHORT length, const ISC_UCHAR *updated)
@@ -1884,4 +1891,10 @@ QString QIBaseDriver::escapeIdentifier(const QString &identifier, IdentifierType
return res;
}
+int QIBaseDriver::maximumIdentifierLength(IdentifierType type) const
+{
+ Q_UNUSED(type);
+ return 31;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase_p.h b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
index 82a0ab8e4d..9109c2b40f 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
@@ -73,8 +73,8 @@ class Q_EXPORT_SQLDRIVER_IBASE QIBaseDriver : public QSqlDriver
Q_DECLARE_PRIVATE(QIBaseDriver)
Q_OBJECT
public:
- explicit QIBaseDriver(QObject *parent = 0);
- explicit QIBaseDriver(isc_db_handle connection, QObject *parent = 0);
+ explicit QIBaseDriver(QObject *parent = nullptr);
+ explicit QIBaseDriver(isc_db_handle connection, QObject *parent = nullptr);
virtual ~QIBaseDriver();
bool hasFeature(DriverFeature f) const override;
bool open(const QString &db,
@@ -106,7 +106,7 @@ public:
bool subscribeToNotification(const QString &name) override;
bool unsubscribeFromNotification(const QString &name) override;
QStringList subscribedToNotifications() const override;
-
+ int maximumIdentifierLength(IdentifierType type) const override;
private Q_SLOTS:
void qHandleEventNotification(void* updatedResultBuffer);
};
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index d720c843ad..733e949a98 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -173,7 +173,7 @@ public:
{
char *outField = nullptr;
MYSQL_FIELD *myField = nullptr;
- QMetaType::Type type = QMetaType::UnknownType;
+ QMetaType type = QMetaType();
my_bool nullIndicator = false;
ulong bufLength = 0ul;
};
@@ -201,7 +201,7 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
}
-static QMetaType::Type qDecodeMYSQLType(int mysqltype, uint flags)
+static QMetaType qDecodeMYSQLType(int mysqltype, uint flags)
{
QMetaType::Type type;
switch (mysqltype) {
@@ -256,13 +256,13 @@ static QMetaType::Type qDecodeMYSQLType(int mysqltype, uint flags)
type = QMetaType::QString;
break;
}
- return type;
+ return QMetaType(type);
}
static QSqlField qToField(MYSQL_FIELD *field)
{
QSqlField f(QString::fromUtf8(field->name),
- QVariant::Type(qDecodeMYSQLType(int(field->type), field->flags)),
+ qDecodeMYSQLType(int(field->type), field->flags),
QString::fromUtf8(field->table));
f.setRequired(IS_NOT_NULL(field->flags));
f.setLength(field->length);
@@ -344,7 +344,7 @@ bool QMYSQLResultPrivate::bindInValues()
// after mysql_stmt_exec() in QMYSQLResult::exec()
fieldInfo->length = 0;
hasBlobs = true;
- } else if (qIsInteger(f.type)) {
+ } else if (qIsInteger(f.type.id())) {
fieldInfo->length = 8;
} else {
fieldInfo->type = MYSQL_TYPE_STRING;
@@ -541,33 +541,33 @@ QVariant QMYSQLResult::data(int field)
QString val;
if (d->preparedQuery) {
if (f.nullIndicator)
- return QVariant(QVariant::Type(f.type));
+ return QVariant(f.type);
- if (qIsInteger(f.type)) {
+ if (qIsInteger(f.type.id())) {
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)
+ if (f.type.id() == QMetaType::UChar)
return variant.toUInt();
- else if (static_cast<int>(f.type) == QMetaType::Char)
+ else if (f.type.id() == QMetaType::Char)
return variant.toInt();
return variant;
}
- if (f.type != QMetaType::QByteArray)
+ if (f.type.id() != QMetaType::QByteArray)
val = QString::fromUtf8(f.outField, f.bufLength);
} else {
if (d->row[field] == NULL) {
// NULL value
- return QVariant(QVariant::Type(f.type));
+ return QVariant(f.type);
}
fieldLength = mysql_fetch_lengths(d->result)[field];
- if (f.type != QMetaType::QByteArray)
+ if (f.type.id() != QMetaType::QByteArray)
val = QString::fromUtf8(d->row[field], fieldLength);
}
- switch (static_cast<int>(f.type)) {
+ switch (f.type.id()) {
case QMetaType::LongLong:
return QVariant(val.toLongLong());
case QMetaType::ULongLong:
@@ -1447,7 +1447,7 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons
if (field.isNull()) {
r = QStringLiteral("NULL");
} else {
- switch (+field.type()) {
+ switch (field.metaType().id()) {
case QMetaType::Double:
r = QString::number(field.value().toDouble(), 'g', field.precision());
break;
diff --git a/src/plugins/sqldrivers/oci/CMakeLists.txt b/src/plugins/sqldrivers/oci/CMakeLists.txt
index 93af813691..617fce8453 100644
--- a/src/plugins/sqldrivers/oci/CMakeLists.txt
+++ b/src/plugins/sqldrivers/oci/CMakeLists.txt
@@ -26,7 +26,7 @@ qt_internal_add_plugin(QOCIDriverPlugin
## Scopes:
#####################################################################
-qt_extend_target(QOCIDriverPlugin CONDITION APPLE
+qt_internal_extend_target(QOCIDriverPlugin CONDITION APPLE
LINK_OPTIONS
"-Wl,-flat_namespace,-U,_environ"
)
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 48295f58e5..5bf9400180 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -511,7 +511,7 @@ int QOCIResultPrivate::bindValues(QVariantList &values, IndicatorArray &indicato
values[i].detach();
const QVariant &val = values.at(i);
- OCIBind * hbnd = 0; // Oracle handles these automatically
+ OCIBind * hbnd = nullptr; // Oracle handles these automatically
sb2 *indPtr = &indicators[i];
*indPtr = val.isNull() ? -1 : 0;
@@ -561,7 +561,7 @@ void QOCIResultPrivate::outValues(QVariantList &values, IndicatorArray &indicato
qOraOutValue(values[i], tmpStorage, env, err);
- QVariant::Type typ = values.at(i).type();
+ auto typ = values.at(i).metaType();
if (indicators[i] == -1) // NULL
values[i] = QVariant(typ);
else
@@ -897,10 +897,10 @@ QOCICols::QOCICols(int size, QOCIResultPrivate* dp)
: fieldInf(size), d(dp)
{
ub4 dataSize = 0;
- OCIDefine* dfn = 0;
+ OCIDefine *dfn = nullptr;
int r;
- OCIParam* param = 0;
+ OCIParam *param = nullptr;
sb4 parmStatus = 0;
ub4 count = 1;
int idx = 0;
@@ -1184,7 +1184,7 @@ OraFieldInfo QOCICols::qMakeOraField(const QOCIResultPrivate* p, OCIParam* param
{
OraFieldInfo ofi;
ub2 colType(0);
- text *colName = 0;
+ text *colName = nullptr;
ub4 colNameLen(0);
sb1 colScale(0);
ub2 colLength(0);
@@ -1618,8 +1618,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVariantList &boundValues, bool a
if (!d->isOutValue(i))
continue;
- QVariant::Type tp = boundValues.at(i).type();
- if (tp != QVariant::List) {
+ if (auto tp = boundValues.at(i).metaType(); tp.id() != QVariant::List) {
qOraOutValue(boundValues[i], tmpStorage, d->env, d->err);
if (*columns[i].indicators == -1)
boundValues[i] = QVariant(tp);
@@ -2454,7 +2453,7 @@ static QString make_where_clause(const QString &user, Expression e)
"WMSYS",
};
static const char joinC[][4] = { "or" , "and" };
- static Q_CONSTEXPR QLatin1Char bang[] = { QLatin1Char(' '), QLatin1Char('!') };
+ static constexpr QLatin1Char bang[] = { QLatin1Char(' '), QLatin1Char('!') };
const QLatin1String join(joinC[e]);
diff --git a/src/plugins/sqldrivers/oci/qsql_oci_p.h b/src/plugins/sqldrivers/oci/qsql_oci_p.h
index 295c131f1a..a3366abb77 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci_p.h
+++ b/src/plugins/sqldrivers/oci/qsql_oci_p.h
@@ -75,8 +75,8 @@ class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver
friend class QOCIResultPrivate;
public:
- explicit QOCIDriver(QObject* parent = 0);
- QOCIDriver(OCIEnv* env, OCISvcCtx* ctx, QObject* parent = 0);
+ explicit QOCIDriver(QObject *parent = nullptr);
+ QOCIDriver(OCIEnv *env, OCISvcCtx *ctx, QObject *parent = nullptr);
~QOCIDriver();
bool hasFeature(DriverFeature f) const;
bool open(const QString &db,
diff --git a/src/plugins/sqldrivers/odbc/.prev_CMakeLists.txt b/src/plugins/sqldrivers/odbc/.prev_CMakeLists.txt
index 5c71b578c0..0411d271cc 100644
--- a/src/plugins/sqldrivers/odbc/.prev_CMakeLists.txt
+++ b/src/plugins/sqldrivers/odbc/.prev_CMakeLists.txt
@@ -26,7 +26,7 @@ qt_internal_add_plugin(QODBCDriverPlugin
## Scopes:
#####################################################################
-qt_extend_target(QODBCDriverPlugin CONDITION UNIX
+qt_internal_extend_target(QODBCDriverPlugin CONDITION UNIX
DEFINES
UNICODE
)
diff --git a/src/plugins/sqldrivers/odbc/CMakeLists.txt b/src/plugins/sqldrivers/odbc/CMakeLists.txt
index ab8f1eb2b6..1c86a79acf 100644
--- a/src/plugins/sqldrivers/odbc/CMakeLists.txt
+++ b/src/plugins/sqldrivers/odbc/CMakeLists.txt
@@ -28,7 +28,7 @@ qt_internal_add_plugin(QODBCDriverPlugin
## Scopes:
#####################################################################
-qt_extend_target(QODBCDriverPlugin CONDITION UNIX
+qt_internal_extend_target(QODBCDriverPlugin CONDITION UNIX
DEFINES
UNICODE
)
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index 8b3dc57e76..5a00a000f7 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -227,7 +227,7 @@ void QODBCResultPrivate::updateStmtHandleState()
disconnectCount = drv_d_func() ? drv_d_func()->disconnectCount : 0;
}
-static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode = 0)
+static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode = nullptr)
{
SQLINTEGER nativeCode_ = 0;
SQLSMALLINT msgLen = 0;
@@ -275,7 +275,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
}
static QString qODBCWarn(const SQLHANDLE hStmt, const SQLHANDLE envHandle = 0,
- const SQLHANDLE pDbC = 0, int *nativeCode = 0)
+ const SQLHANDLE pDbC = 0, int *nativeCode = nullptr)
{
QString result;
if (envHandle)
@@ -299,12 +299,12 @@ static QString qODBCWarn(const SQLHANDLE hStmt, const SQLHANDLE envHandle = 0,
return result;
}
-static QString qODBCWarn(const QODBCResultPrivate* odbc, int *nativeCode = 0)
+static QString qODBCWarn(const QODBCResultPrivate* odbc, int *nativeCode = nullptr)
{
return qODBCWarn(odbc->hStmt, odbc->dpEnv(), odbc->dpDbc(), nativeCode);
}
-static QString qODBCWarn(const QODBCDriverPrivate* odbc, int *nativeCode = 0)
+static QString qODBCWarn(const QODBCDriverPrivate* odbc, int *nativeCode = nullptr)
{
return qODBCWarn(0, odbc->hEnv, odbc->hDbc, nativeCode);
}
@@ -341,49 +341,49 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
nativeCode != -1 ? QString::number(nativeCode) : QString());
}
-static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, bool isSigned = true)
+static QMetaType qDecodeODBCType(SQLSMALLINT sqltype, bool isSigned = true)
{
- QVariant::Type type = QVariant::Invalid;
+ int type = QMetaType::UnknownType;
switch (sqltype) {
case SQL_DECIMAL:
case SQL_NUMERIC:
case SQL_REAL:
case SQL_FLOAT:
case SQL_DOUBLE:
- type = QVariant::Double;
+ type = QMetaType::Double;
break;
case SQL_SMALLINT:
case SQL_INTEGER:
case SQL_BIT:
- type = isSigned ? QVariant::Int : QVariant::UInt;
+ type = isSigned ? QMetaType::Int : QMetaType::UInt;
break;
case SQL_TINYINT:
- type = QVariant::UInt;
+ type = QMetaType::UInt;
break;
case SQL_BIGINT:
- type = isSigned ? QVariant::LongLong : QVariant::ULongLong;
+ type = isSigned ? QMetaType::LongLong : QMetaType::ULongLong;
break;
case SQL_BINARY:
case SQL_VARBINARY:
case SQL_LONGVARBINARY:
- type = QVariant::ByteArray;
+ type = QMetaType::QByteArray;
break;
case SQL_DATE:
case SQL_TYPE_DATE:
- type = QVariant::Date;
+ type = QMetaType::QDate;
break;
case SQL_TIME:
case SQL_TYPE_TIME:
- type = QVariant::Time;
+ type = QMetaType::QTime;
break;
case SQL_TIMESTAMP:
case SQL_TYPE_TIMESTAMP:
- type = QVariant::DateTime;
+ type = QMetaType::QDateTime;
break;
case SQL_WCHAR:
case SQL_WVARCHAR:
case SQL_WLONGVARCHAR:
- type = QVariant::String;
+ type = QMetaType::QString;
break;
case SQL_CHAR:
case SQL_VARCHAR:
@@ -391,13 +391,13 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, bool isSigned = true)
case SQL_GUID:
#endif
case SQL_LONGVARCHAR:
- type = QVariant::String;
+ type = QMetaType::QString;
break;
default:
- type = QVariant::ByteArray;
+ type = QMetaType::QByteArray;
break;
}
- return type;
+ return QMetaType(type);
}
static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool unicode = false)
@@ -554,7 +554,7 @@ static QVariant qGetBinaryData(SQLHANDLE hStmt, int column)
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO)
break;
if (lengthIndicator == SQL_NULL_DATA)
- return QVariant(QVariant::ByteArray);
+ return QVariant(QMetaType(QVariant::ByteArray));
if (lengthIndicator > SQLLEN(colSize) || lengthIndicator == SQL_NO_TOTAL) {
read += colSize;
colSize = 65536;
@@ -581,9 +581,9 @@ static QVariant qGetIntData(SQLHANDLE hStmt, int column, bool isSigned = true)
sizeof(intbuf),
&lengthIndicator);
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO)
- return QVariant(QVariant::Invalid);
+ return QVariant();
if (lengthIndicator == SQL_NULL_DATA)
- return QVariant(QVariant::Int);
+ return QVariant(QMetaType::fromType<int>());
if (isSigned)
return int(intbuf);
else
@@ -601,10 +601,10 @@ static QVariant qGetDoubleData(SQLHANDLE hStmt, int column)
0,
&lengthIndicator);
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
- return QVariant(QVariant::Invalid);
+ return QVariant();
}
if(lengthIndicator == SQL_NULL_DATA)
- return QVariant(QVariant::Double);
+ return QVariant(QMetaType::fromType<double>());
return (double) dblbuf;
}
@@ -621,9 +621,9 @@ static QVariant qGetBigIntData(SQLHANDLE hStmt, int column, bool isSigned = true
sizeof(lngbuf),
&lengthIndicator);
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO)
- return QVariant(QVariant::Invalid);
+ return QVariant();
if (lengthIndicator == SQL_NULL_DATA)
- return QVariant(QVariant::LongLong);
+ return QVariant(QMetaType::fromType<qlonglong>());
if (isSigned)
return qint64(lngbuf);
@@ -717,7 +717,7 @@ static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt, int i, QString *errorMess
const QString qColName(fromSQLTCHAR(colName, colNameLen));
// nullable can be SQL_NO_NULLS, SQL_NULLABLE or SQL_NULLABLE_UNKNOWN
- QVariant::Type type = qDecodeODBCType(colType, unsignedFlag == SQL_FALSE);
+ QMetaType type = qDecodeODBCType(colType, unsignedFlag == SQL_FALSE);
QSqlField f(qColName, type);
f.setSqlType(colType);
f.setLength(colSize == 0 ? -1 : int(colSize));
@@ -1212,7 +1212,7 @@ QVariant QODBCResult::data(int field)
// some servers do not support fetching column n after we already
// fetched column n+1, so cache all previous columns here
const QSqlField info = d->rInf.field(i);
- switch (info.type()) {
+ switch (info.metaType().id()) {
case QVariant::LongLong:
d->fieldCache[i] = qGetBigIntData(d->hStmt, i);
break;
@@ -1236,7 +1236,7 @@ QVariant QODBCResult::data(int field)
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (lengthIndicator != SQL_NULL_DATA))
d->fieldCache[i] = QVariant(QDate(dbuf.year, dbuf.month, dbuf.day));
else
- d->fieldCache[i] = QVariant(QVariant::Date);
+ d->fieldCache[i] = QVariant(QMetaType::fromType<QDate>());
break;
case QVariant::Time:
TIME_STRUCT tbuf;
@@ -1249,7 +1249,7 @@ QVariant QODBCResult::data(int field)
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (lengthIndicator != SQL_NULL_DATA))
d->fieldCache[i] = QVariant(QTime(tbuf.hour, tbuf.minute, tbuf.second));
else
- d->fieldCache[i] = QVariant(QVariant::Time);
+ d->fieldCache[i] = QVariant(QMetaType::fromType<QTime>());
break;
case QVariant::DateTime:
TIMESTAMP_STRUCT dtbuf;
@@ -1263,7 +1263,7 @@ QVariant QODBCResult::data(int field)
d->fieldCache[i] = QVariant(QDateTime(QDate(dtbuf.year, dtbuf.month, dtbuf.day),
QTime(dtbuf.hour, dtbuf.minute, dtbuf.second, dtbuf.fraction / 1000000)));
else
- d->fieldCache[i] = QVariant(QVariant::DateTime);
+ d->fieldCache[i] = QVariant(QMetaType::fromType<QDateTime>());
break;
case QVariant::ByteArray:
d->fieldCache[i] = qGetBinaryData(d->hStmt, i);
@@ -1730,7 +1730,7 @@ bool QODBCResult::exec()
break; }
}
if (indicators[i] == SQL_NULL_DATA)
- values[i] = QVariant(QVariant::Type(values[i].userType()));
+ values[i] = QVariant(values[i].metaType());
}
return true;
}
@@ -1779,7 +1779,7 @@ QVariant QODBCResult::lastInsertId() const
QVariant QODBCResult::handle() const
{
Q_D(const QODBCResult);
- return QVariant(qRegisterMetaType<SQLHANDLE>("SQLHANDLE"), &d->hStmt);
+ return QVariant(QMetaType::fromType<SQLHANDLE>(), &d->hStmt);
}
bool QODBCResult::nextResult()
@@ -2583,7 +2583,7 @@ QString QODBCDriver::formatValue(const QSqlField &field,
QString r;
if (field.isNull()) {
r = QLatin1String("NULL");
- } else if (field.type() == QVariant::DateTime) {
+ } else if (field.metaType().id() == QVariant::DateTime) {
// Use an escape sequence for the datetime fields
if (field.value().toDateTime().isValid()){
QDate dt = field.value().toDateTime().date();
@@ -2599,7 +2599,7 @@ QString QODBCDriver::formatValue(const QSqlField &field,
QLatin1String("' }");
} else
r = QLatin1String("NULL");
- } else if (field.type() == QVariant::ByteArray) {
+ } else if (field.metaType().id() == QVariant::ByteArray) {
QByteArray ba = field.value().toByteArray();
QString res;
static const char hexchars[] = "0123456789abcdef";
@@ -2618,7 +2618,7 @@ QString QODBCDriver::formatValue(const QSqlField &field,
QVariant QODBCDriver::handle() const
{
Q_D(const QODBCDriver);
- return QVariant(qRegisterMetaType<SQLHANDLE>("SQLHANDLE"), &d->hDbc);
+ return QVariant(QMetaType::fromType<SQLHANDLE>(), &d->hDbc);
}
QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType) const
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index b477f701e2..cdc4ce7c36 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -634,7 +634,7 @@ QVariant QPSQLResult::data(int i)
int ptype = PQftype(d->result, i);
QVariant::Type type = qDecodePSQLType(ptype);
if (PQgetisnull(d->result, currentRow, i))
- return QVariant(type);
+ return QVariant(QMetaType(type), nullptr);
const char *val = PQgetvalue(d->result, currentRow, i);
switch (type) {
case QVariant::Bool:
@@ -805,8 +805,8 @@ QSqlRecord QPSQLResult::record() const
f.setTableName(QString());
}
int ptype = PQftype(d->result, i);
- f.setType(qDecodePSQLType(ptype));
- f.setValue(QVariant(f.type())); // only set in setType() when it's invalid before
+ f.setMetaType(QMetaType(qDecodePSQLType(ptype)));
+ f.setValue(QVariant(f.metaType())); // only set in setType() when it's invalid before
int len = PQfsize(d->result, i);
int precision = PQfmod(d->result, i);
@@ -856,7 +856,7 @@ static QString qCreateParamString(const QList<QVariant> &boundValues, const QSql
QString params;
QSqlField f;
for (const QVariant &val : boundValues) {
- f.setType(val.type());
+ f.setMetaType(val.metaType());
if (val.isNull())
f.clear();
else
@@ -1476,7 +1476,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
if (field.isNull()) {
r = nullStr();
} else {
- switch (int(field.type())) {
+ switch (field.metaType().id()) {
case QVariant::DateTime:
#if QT_CONFIG(datestring)
if (field.value().toDateTime().isValid()) {
@@ -1580,21 +1580,20 @@ bool QPSQLDriver::subscribeToNotification(const QString &name)
return false;
}
- if (d->seid.contains(name)) {
- qWarning("QPSQLDriver::subscribeToNotificationImplementation: already subscribing to '%s'.",
- qPrintable(name));
- return false;
- }
-
+ const bool alreadyContained = d->seid.contains(name);
int socket = PQsocket(d->connection);
if (socket) {
// Add the name to the list of subscriptions here so that QSQLDriverPrivate::exec knows
- // to check for notifications immediately after executing the LISTEN
- d->seid << name;
+ // to check for notifications immediately after executing the LISTEN. If it has already
+ // been subscribed then LISTEN Will do nothing. But we do the call anyway in case the
+ // connection was lost and this is a re-subscription.
+ if (!alreadyContained)
+ d->seid << name;
QString query = QStringLiteral("LISTEN ") + escapeIdentifier(name, QSqlDriver::TableName);
PGresult *result = d->exec(query);
if (PQresultStatus(result) != PGRES_COMMAND_OK) {
- d->seid.removeLast();
+ if (!alreadyContained)
+ d->seid.removeLast();
setLastError(qMakeError(tr("Unable to subscribe"), QSqlError::StatementError, d, result));
PQclear(result);
return false;
diff --git a/src/plugins/sqldrivers/qt_cmdline.cmake b/src/plugins/sqldrivers/qt_cmdline.cmake
new file mode 100644
index 0000000000..91b6f9f767
--- /dev/null
+++ b/src/plugins/sqldrivers/qt_cmdline.cmake
@@ -0,0 +1,18 @@
+qt_commandline_option(mysql_config TYPE string)
+qt_commandline_option(psql_config TYPE string)
+qt_commandline_option(sqlite TYPE enum NAME system-sqlite MAPPING qt no system yes)
+qt_commandline_option(sql-db2 TYPE boolean)
+qt_commandline_option(sql-ibase TYPE boolean)
+qt_commandline_option(sql-mysql TYPE boolean)
+qt_commandline_option(sql-oci TYPE boolean)
+qt_commandline_option(sql-odbc TYPE boolean)
+qt_commandline_option(sql-psql TYPE boolean)
+qt_commandline_option(sql-sqlite TYPE boolean)
+qt_commandline_option(plugin-sql-db2 TYPE void NAME sql-db2)
+qt_commandline_option(plugin-sql-ibase TYPE void NAME sql-ibase)
+qt_commandline_option(plugin-sql-mysql TYPE void NAME sql-mysql)
+qt_commandline_option(plugin-sql-oci TYPE void NAME sql-oci)
+qt_commandline_option(plugin-sql-odbc TYPE void NAME sql-odbc)
+qt_commandline_option(plugin-sql-psql TYPE void NAME sql-psql)
+qt_commandline_option(plugin-sql-sqlite TYPE void NAME sql-sqlite)
+qt_commandline_assignment(MYSQL_PATH mysql.prefix)
diff --git a/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt b/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt
index 25796d9bb5..c34e2119f9 100644
--- a/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt
+++ b/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt
@@ -26,12 +26,12 @@ qt_internal_add_plugin(QSQLiteDriverPlugin
## Scopes:
#####################################################################
-qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite
PUBLIC_LIBRARIES
SQLite::SQLite3
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
SOURCES
../../../3rdparty/sqlite/sqlite3.c
DEFINES
@@ -46,37 +46,37 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
../../../3rdparty/sqlite
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release AND NOT QT_FEATURE_system_sqlite
DEFINES
NDEBUG
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile AND NOT QT_FEATURE_system_sqlite
DEFINES
SQLITE_DISABLE_LFS
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite
DEFINES
HAVE_POSIX_FALLOCATE=1
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite
DEFINES
_QNX_SOURCE
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite
DEFINES
HAVE_USLEEP=1
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
DEFINES
SQLITE_OMIT_LOAD_EXTENSION
)
diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt
index 5cc2791e7d..2da5233525 100644
--- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt
+++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt
@@ -26,20 +26,19 @@ qt_internal_add_plugin(QSQLiteDriverPlugin
## Scopes:
#####################################################################
-qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite
PUBLIC_LIBRARIES
SQLite::SQLite3
)
# special case begin
if (NOT QT_FEATURE_system_sqlite)
- qt_find_package(Threads REQUIRED PROVIDED_TARGETS Threads::Threads)
# On newer compilers compiling sqlite.c produces warnings
qt_disable_warnings(QSQLiteDriverPlugin)
endif()
# special case end
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
SOURCES
../../../3rdparty/sqlite/sqlite3.c
DEFINES
@@ -52,41 +51,39 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
SQLITE_OMIT_COMPLETE
INCLUDE_DIRECTORIES
../../../3rdparty/sqlite
- PUBLIC_LIBRARIES # special case
- Threads::Threads # special case
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release AND NOT QT_FEATURE_system_sqlite
DEFINES
NDEBUG
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile AND NOT QT_FEATURE_system_sqlite
DEFINES
SQLITE_DISABLE_LFS
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite
DEFINES
HAVE_POSIX_FALLOCATE=1
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite
DEFINES
_QNX_SOURCE
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite
DEFINES
HAVE_USLEEP=1
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
PUBLIC_LIBRARIES
${CMAKE_DL_LIBS}
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
+qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
DEFINES
SQLITE_OMIT_LOAD_EXTENSION
)
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index f507e44d32..d6a0f319f9 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -85,24 +85,24 @@ static QString _q_escapeIdentifier(const QString &identifier)
return res;
}
-static QVariant::Type qGetColumnType(const QString &tpName)
+static int qGetColumnType(const QString &tpName)
{
const QString typeName = tpName.toLower();
if (typeName == QLatin1String("integer")
|| typeName == QLatin1String("int"))
- return QVariant::Int;
+ return QMetaType::Int;
if (typeName == QLatin1String("double")
|| typeName == QLatin1String("float")
|| typeName == QLatin1String("real")
|| typeName.startsWith(QLatin1String("numeric")))
- return QVariant::Double;
+ return QMetaType::Double;
if (typeName == QLatin1String("blob"))
- return QVariant::ByteArray;
+ return QMetaType::QByteArray;
if (typeName == QLatin1String("boolean")
|| typeName == QLatin1String("bool"))
- return QVariant::Bool;
- return QVariant::String;
+ return QMetaType::Bool;
+ return QMetaType::QString;
}
static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type,
@@ -214,7 +214,7 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
// sqlite3_column_type is documented to have undefined behavior if the result set is empty
int stp = emptyResultset ? -1 : sqlite3_column_type(stmt, i);
- QVariant::Type fieldType;
+ int fieldType;
if (!typeName.isEmpty()) {
fieldType = qGetColumnType(typeName);
@@ -222,25 +222,25 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
// Get the proper type for the field based on stp value
switch (stp) {
case SQLITE_INTEGER:
- fieldType = QVariant::Int;
+ fieldType = QMetaType::Int;
break;
case SQLITE_FLOAT:
- fieldType = QVariant::Double;
+ fieldType = QMetaType::Double;
break;
case SQLITE_BLOB:
- fieldType = QVariant::ByteArray;
+ fieldType = QMetaType::QByteArray;
break;
case SQLITE_TEXT:
- fieldType = QVariant::String;
+ fieldType = QMetaType::QString;
break;
case SQLITE_NULL:
default:
- fieldType = QVariant::Invalid;
+ fieldType = QMetaType::UnknownType;
break;
}
}
- QSqlField fld(colName, fieldType, tableName);
+ QSqlField fld(colName, QMetaType(fieldType), tableName);
fld.setSqlType(stp);
rInf.append(fld);
}
@@ -309,7 +309,7 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i
};
break;
case SQLITE_NULL:
- values[i + idx] = QVariant(QVariant::String);
+ values[i + idx] = QVariant(QMetaType::fromType<QString>());
break;
default:
values[i + idx] = QString(reinterpret_cast<const QChar *>(
@@ -478,7 +478,12 @@ bool QSQLiteResult::exec()
for (int i = 0, currentIndex = 0; i < values.size(); ++i) {
if (handledIndexes.contains(i))
continue;
- const auto placeHolder = QString::fromUtf8(sqlite3_bind_parameter_name(d->stmt, currentIndex + 1));
+ const char *parameterName = sqlite3_bind_parameter_name(d->stmt, currentIndex + 1);
+ if (!parameterName) {
+ paramCountIsValid = false;
+ continue;
+ }
+ const auto placeHolder = QString::fromUtf8(parameterName);
const auto &indexes = d->indexes.value(placeHolder);
handledIndexes << indexes;
prunedValues << values.at(indexes.first());
@@ -497,37 +502,37 @@ bool QSQLiteResult::exec()
res = sqlite3_bind_null(d->stmt, i + 1);
} else {
switch (value.userType()) {
- case QVariant::ByteArray: {
+ case QMetaType::QByteArray: {
const QByteArray *ba = static_cast<const QByteArray*>(value.constData());
res = sqlite3_bind_blob(d->stmt, i + 1, ba->constData(),
ba->size(), SQLITE_STATIC);
break; }
- case QVariant::Int:
- case QVariant::Bool:
+ case QMetaType::Int:
+ case QMetaType::Bool:
res = sqlite3_bind_int(d->stmt, i + 1, value.toInt());
break;
- case QVariant::Double:
+ case QMetaType::Double:
res = sqlite3_bind_double(d->stmt, i + 1, value.toDouble());
break;
- case QVariant::UInt:
- case QVariant::LongLong:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
res = sqlite3_bind_int64(d->stmt, i + 1, value.toLongLong());
break;
- case QVariant::DateTime: {
+ case QMetaType::QDateTime: {
const QDateTime dateTime = value.toDateTime();
const QString str = dateTime.toString(Qt::ISODateWithMs);
res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(),
str.size() * sizeof(ushort), SQLITE_TRANSIENT);
break;
}
- case QVariant::Time: {
+ case QMetaType::QTime: {
const QTime time = value.toTime();
const QString str = time.toString(u"hh:mm:ss.zzz");
res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(),
str.size() * sizeof(ushort), SQLITE_TRANSIENT);
break;
}
- case QVariant::String: {
+ case QMetaType::QString: {
// lifetime of string == lifetime of its qvariant
const QString *str = static_cast<const QString*>(value.constData());
res = sqlite3_bind_text16(d->stmt, i + 1, str->utf16(),
@@ -920,7 +925,7 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool only
defVal = defVal.mid(1, end - 1);
}
- QSqlField fld(q.value(1).toString(), qGetColumnType(typeName), tableName);
+ QSqlField fld(q.value(1).toString(), QMetaType(qGetColumnType(typeName)), tableName);
if (isPk && (typeName == QLatin1String("integer")))
// INTEGER PRIMARY KEY fields are auto-generated in sqlite
// INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY!
diff --git a/src/plugins/styles/CMakeLists.txt b/src/plugins/styles/CMakeLists.txt
index d24e3daff8..73329915f6 100644
--- a/src/plugins/styles/CMakeLists.txt
+++ b/src/plugins/styles/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from styles.pro.
if(QT_FEATURE_style_android)
- # add_subdirectory(android) # special case TODO
+ add_subdirectory(android)
endif()
if(QT_FEATURE_style_mac)
add_subdirectory(mac)
diff --git a/src/plugins/styles/android/CMakeLists.txt b/src/plugins/styles/android/CMakeLists.txt
new file mode 100644
index 0000000000..a556f7bd40
--- /dev/null
+++ b/src/plugins/styles/android/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Generated from android.pro.
+
+#####################################################################
+## QAndroidStylePlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QAndroidStylePlugin
+ OUTPUT_NAME qandroidstyle
+ TYPE styles
+ SOURCES
+ main.cpp
+ qandroidstyle.cpp qandroidstyle_p.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WidgetsPrivate
+)
+
+#### Keys ignored in scope 1:.:.:android.pro:<TRUE>:
+# DISTFILES = "androidstyle.json"
diff --git a/src/plugins/styles/android/qandroidstyle.cpp b/src/plugins/styles/android/qandroidstyle.cpp
index 0a4e4286e0..1baf568fa9 100644
--- a/src/plugins/styles/android/qandroidstyle.cpp
+++ b/src/plugins/styles/android/qandroidstyle.cpp
@@ -1193,7 +1193,7 @@ QSize QAndroidStyle::AndroidStateDrawable::sizeImage(const QStyleOption *opt) co
const QAndroidStyle::AndroidDrawable * QAndroidStyle::AndroidStateDrawable::bestAndroidStateMatch(const QStyleOption *opt) const
{
- const AndroidDrawable *bestMatch = 0;
+ const AndroidDrawable *bestMatch = nullptr;
if (!opt) {
if (m_states.size())
return m_states[0].second;
@@ -1407,7 +1407,7 @@ void QAndroidStyle::AndroidControl::drawControl(const QStyleOption *opt, QPainte
qDrawShadePanel(p, frame->rect, frame->palette, frame->state & State_Sunken,
frame->lineWidth);
} else {
- qDrawPlainRect(p, frame->rect, frame->palette.foreground().color(), frame->lineWidth);
+ qDrawPlainRect(p, frame->rect, frame->palette.windowText().color(), frame->lineWidth);
}
} else {
if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
@@ -1421,13 +1421,13 @@ void QAndroidStyle::AndroidControl::drawControl(const QStyleOption *opt, QPainte
else
p->setPen(Qt::white);
} else {
- p->setPen(opt->palette.foreground().color());
+ p->setPen(opt->palette.windowText().color());
}
QRect focusRect = opt->rect.adjusted(1, 1, -1, -1);
p->drawRect(focusRect.adjusted(0, 0, -1, -1)); //draw pen inclusive
p->setPen(oldPen);
} else {
- p->fillRect(opt->rect, opt->palette.brush(QPalette::Background));
+ p->fillRect(opt->rect, opt->palette.window());
}
}
}
@@ -1619,10 +1619,11 @@ void QAndroidStyle::AndroidProgressBarControl::drawControl(const QStyleOption *o
if (m_progressDrawable->type() == QAndroidStyle::Layer) {
const double fraction = double(qint64(pb->progress) - pb->minimum) / (qint64(pb->maximum) - pb->minimum);
QAndroidStyle::AndroidDrawable *clipDrawable = static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->layer(m_progressId);
+ const Qt::Orientation orientation = pb->state & QStyle::State_Horizontal ? Qt::Horizontal : Qt::Vertical;
if (clipDrawable->type() == QAndroidStyle::Clip)
- static_cast<AndroidClipDrawable *>(clipDrawable)->setFactor(fraction, pb->orientation);
+ static_cast<AndroidClipDrawable *>(clipDrawable)->setFactor(fraction, orientation);
else
- static_cast<AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, fraction, pb->orientation);
+ static_cast<AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, fraction, orientation);
}
m_progressDrawable->draw(p, option);
}
@@ -1634,7 +1635,7 @@ QRect QAndroidStyle::AndroidProgressBarControl::subElementRect(QStyle::SubElemen
{
if (const QStyleOptionProgressBar *progressBarOption =
qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- const bool horizontal = progressBarOption->orientation == Qt::Vertical;
+ const bool horizontal = progressBarOption->state & QStyle::State_Horizontal;
if (!m_background)
return option->rect;
@@ -1676,12 +1677,12 @@ QSize QAndroidStyle::AndroidProgressBarControl::sizeFromContents(const QStyleOpt
if (const QStyleOptionProgressBar *progressBarOption =
qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
- if (progressBarOption->orientation == Qt::Vertical) {
- if (sz.height() > m_maxSize.height())
- sz.setHeight(m_maxSize.height());
- } else {
+ if (progressBarOption->state & QStyle::State_Horizontal) {
if (sz.width() > m_maxSize.width())
sz.setWidth(m_maxSize.width());
+ } else {
+ if (sz.height() > m_maxSize.height())
+ sz.setHeight(m_maxSize.height());
}
}
return contentsSize;
diff --git a/src/plugins/styles/android/qandroidstyle_p.h b/src/plugins/styles/android/qandroidstyle_p.h
index 5730bdfe2c..ca4b435046 100644
--- a/src/plugins/styles/android/qandroidstyle_p.h
+++ b/src/plugins/styles/android/qandroidstyle_p.h
@@ -257,10 +257,10 @@ public:
virtual void drawControl(const QStyleOption *opt, QPainter *p, const QWidget *w);
virtual QRect subElementRect(SubElement subElement,
const QStyleOption *option,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
virtual QRect subControlRect(const QStyleOptionComplex *option,
SubControl sc,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
virtual QSize sizeFromContents(const QStyleOption *opt,
const QSize &contentsSize,
const QWidget *w) const;
@@ -294,7 +294,7 @@ public:
virtual void drawControl(const QStyleOption *option, QPainter *p, const QWidget *w);
virtual QRect subElementRect(SubElement subElement,
const QStyleOption *option,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
QSize sizeFromContents(const QStyleOption *opt,
const QSize &contentsSize,
@@ -315,7 +315,7 @@ public:
QSize sizeFromContents(const QStyleOption *opt,
const QSize &contentsSize, const QWidget *w) const;
QRect subControlRect(const QStyleOptionComplex *option, SubControl sc,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
private:
AndroidDrawable *m_seekBarThumb;
};
@@ -327,7 +327,7 @@ public:
virtual ~AndroidSpinnerControl(){}
virtual QRect subControlRect(const QStyleOptionComplex *option,
SubControl sc,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
};
typedef QList<AndroidItemStateInfo *> AndroidItemStateInfoList;
@@ -337,34 +337,34 @@ public:
~QAndroidStyle();
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = nullptr) const;
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *widget = 0) const;
+ const QPoint &pt, const QWidget *widget = nullptr) const;
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget = 0) const;
+ SubControl sc, const QWidget *widget = nullptr) const;
- virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const;
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *w = 0) const;
+ const QSize &contentsSize, const QWidget *w = nullptr) const;
- virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0,
- const QWidget *widget = 0) const;
+ virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
+ const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
const QStyleOption *opt) const;
- int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const;
+ int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr,
+ QStyleHintReturn *returnData = nullptr) const;
virtual QPalette standardPalette() const;
void polish(QWidget *widget);
diff --git a/src/plugins/styles/mac/macstyle.json b/src/plugins/styles/mac/macstyle.json
index 5897815eec..5d7a50a339 100644
--- a/src/plugins/styles/mac/macstyle.json
+++ b/src/plugins/styles/mac/macstyle.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "macintosh" ]
+ "Keys": [ "macOS" ]
}
diff --git a/src/plugins/styles/mac/main.mm b/src/plugins/styles/mac/main.mm
index ae31bb95fb..2f11b5cd43 100644
--- a/src/plugins/styles/mac/main.mm
+++ b/src/plugins/styles/mac/main.mm
@@ -53,7 +53,7 @@ public:
QStyle *QMacStylePlugin::create(const QString &key)
{
QMacAutoReleasePool pool;
- if (key.compare(QLatin1String("macintosh"), Qt::CaseInsensitive) == 0)
+ if (key.compare(QLatin1String("macos"), Qt::CaseInsensitive) == 0)
return new QMacStyle();
return 0;
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 6563e95ceb..1e6ea9665c 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -80,11 +80,6 @@
QT_USE_NAMESPACE
-static QWindow *qt_getWindow(const QWidget *widget)
-{
- return widget ? widget->window()->windowHandle() : 0;
-}
-
@interface QT_MANGLE_NAMESPACE(QIndeterminateProgressIndicator) : NSProgressIndicator
@property (readonly, nonatomic) NSInteger animators;
@@ -494,38 +489,11 @@ static bool setupSlider(NSSlider *slider, const QStyleOptionSlider *sl)
slider.numberOfTickMarks = 0;
}
- return true;
-}
+ // Ensure the values set above are reflected when asking
+ // the cell for its metrics and to draw itself.
+ [slider layoutSubtreeIfNeeded];
-static void fixStaleGeometry(NSSlider *slider)
-{
- // If it's later fixed in AppKit, this function is not needed.
- // On macOS Mojave we suddenly have NSSliderCell with a cached
- // (and stale) geometry, thus its -drawKnob, -drawBarInside:flipped:,
- // -drawTickMarks fail to render the slider properly. Setting the number
- // of tickmarks triggers an update in geometry.
-
- Q_ASSERT(slider);
-
- if (QOperatingSystemVersion::current() < QOperatingSystemVersion::MacOSMojave)
- return;
-
- NSSliderCell *cell = slider.cell;
- const NSRect barRect = [cell barRectFlipped:NO];
- const NSSize sliderSize = slider.frame.size;
- CGFloat difference = 0.;
- if (slider.vertical)
- difference = std::abs(sliderSize.height - barRect.size.height);
- else
- difference = std::abs(sliderSize.width - barRect.size.width);
-
- if (difference > 6.) {
- // Stale ...
- const auto nOfTicks = slider.numberOfTickMarks;
- // Non-zero, different from nOfTicks to force update
- slider.numberOfTickMarks = nOfTicks + 10;
- slider.numberOfTickMarks = nOfTicks;
- }
+ return true;
}
static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
@@ -1501,7 +1469,7 @@ QStyleHelper::WidgetSizePolicy QMacStylePrivate::aquaSizeConstrain(const QStyleO
if (guess_size)
ret = qt_aqua_guess_size(widg, large, small, mini);
- QSize *sz = 0;
+ QSize *sz = nullptr;
if (ret == QStyleHelper::SizeSmall)
sz = &small;
else if (ret == QStyleHelper::SizeLarge)
@@ -2572,7 +2540,7 @@ QPalette QMacStyle::standardPalette() const
{
auto platformTheme = QGuiApplicationPrivate::platformTheme();
auto styleNames = platformTheme->themeHint(QPlatformTheme::StyleNames);
- if (styleNames.toStringList().contains("macintosh"))
+ if (styleNames.toStringList().contains("macOS"))
return QPalette(); // Inherit everything from theme
else
return QStyle::standardPalette();
@@ -2611,7 +2579,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = true;
break;
case SH_Slider_AbsoluteSetButtons:
- ret = Qt::LeftButton|Qt::MidButton;
+ ret = Qt::LeftButton|Qt::MiddleButton;
break;
case SH_Slider_PageSetButtons:
ret = 0;
@@ -2828,9 +2796,6 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_MessageBox_TextInteractionFlags:
ret = Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard;
break;
- case SH_SpellCheckUnderlineStyle:
- ret = QTextCharFormat::DashUnderline;
- break;
case SH_MessageBox_CenterButtons:
ret = false;
break;
@@ -2956,7 +2921,8 @@ QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOpt
size = 64;
break;
}
- return icon.pixmap(qt_getWindow(widget), QSize(size, size));
+ qreal dpr = widget ? widget->devicePixelRatio() : qApp->devicePixelRatio();
+ return icon.pixmap(QSize(size, size), dpr);
}
void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
@@ -3547,7 +3513,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (opt->state & State_Enabled)
mode = QIcon::Normal;
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
- QPixmap pixmap = header->icon.pixmap(window, QSize(iconExtent, iconExtent), mode);
+ QPixmap pixmap = header->icon.pixmap(QSize(iconExtent, iconExtent), p->device()->devicePixelRatio(), mode);
QRect pixr = header->rect;
pixr.setY(header->rect.center().y() - (pixmap.height() / pixmap.devicePixelRatio() - 1) / 2);
@@ -3598,8 +3564,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
: QIcon::Disabled;
QIcon::State iconState = (tb->state & State_On) ? QIcon::On
: QIcon::Off;
- QPixmap pixmap = tb->icon.pixmap(window,
- tb->rect.size().boundedTo(tb->iconSize),
+ QPixmap pixmap = tb->icon.pixmap(tb->rect.size().boundedTo(tb->iconSize), p->device()->devicePixelRatio(),
iconMode, iconState);
// Draw the text if it's needed.
@@ -3797,7 +3762,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QIcon::State state = QIcon::Off;
if (btn.state & State_On)
state = QIcon::On;
- QPixmap pixmap = btn.icon.pixmap(window, btn.iconSize, mode, state);
+ QPixmap pixmap = btn.icon.pixmap(btn.iconSize, p->device()->devicePixelRatio(), mode, state);
int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio();
int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio();
contentW += pixmapWidth + QMacStylePrivate::PushButtonContentPadding;
@@ -3875,12 +3840,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// inFrame:withView:], -[drawRect:] or anything in between. Besides,
// there's no public API do draw the pressed state, AFAICS. We'll use
// a push NSButton instead and clip the CGContext.
- // NOTE/TODO: this is not true. On 10.13 NSSegmentedControl works with
- // some (black?) magic/magic dances, on 10.14 it simply works (was
- // it fixed in AppKit?). But, indeed, we cannot make a tab 'pressed'
- // with NSSegmentedControl (only selected), so we stay with buttons
- // (mixing buttons and NSSegmentedControl for such a simple thing
- // is too much work).
const auto cs = d->effectiveAquaSizeConstrain(opt, w);
// Extra hacks to get the proper pressed appreance when not selected or selected and inactive
@@ -3985,7 +3944,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (needsInactiveHack) {
// First, render tab as non-selected tab on a pixamp
- const qreal pixelRatio = p->device()->devicePixelRatioF();
+ const qreal pixelRatio = p->device()->devicePixelRatio();
QImage tabPixmap(opt->rect.size() * pixelRatio, QImage::Format_ARGB32_Premultiplied);
tabPixmap.setDevicePixelRatio(pixelRatio);
tabPixmap.fill(Qt::transparent);
@@ -4261,7 +4220,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
iconSize = comboBox->iconSize();
}
#endif
- QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode);
+ QPixmap pixmap = mi->icon.pixmap(iconSize, p->device()->devicePixelRatio(), mode);
int pixw = pixmap.width() / pixmap.devicePixelRatio();
int pixh = pixmap.height() / pixmap.devicePixelRatio();
QRect cr(xpos, mi->rect.y(), checkcol, mi->rect.height());
@@ -4279,7 +4238,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
yPos += 1;
const bool isSubMenu = mi->menuItemType == QStyleOptionMenuItem::SubMenu;
- const int tabwidth = isSubMenu ? 9 : mi->tabWidth;
+ const int tabwidth = isSubMenu ? 9 : mi->reservedShortcutWidth;
QString rightMarginText;
if (isSubMenu)
@@ -4369,7 +4328,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
drawItemPixmap(p, mi->rect,
Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip
| Qt::TextSingleLine,
- mi->icon.pixmap(window, QSize(iconExtent, iconExtent),
+ mi->icon.pixmap(QSize(iconExtent, iconExtent), p->device()->devicePixelRatio(),
(mi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled));
} else {
drawItemText(p, mi->rect,
@@ -4387,7 +4346,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
case CE_ProgressBarContents:
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
const bool isIndeterminate = (pb->minimum == 0 && pb->maximum == 0);
- const bool vertical = pb->orientation == Qt::Vertical;
+ const bool vertical = !(pb->state & QStyle::State_Horizontal);
const bool inverted = pb->invertedAppearance;
bool reverse = (!vertical && (pb->direction == Qt::RightToLeft));
if (inverted)
@@ -5336,7 +5295,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
CGPoint pressPoint;
if (isPressed) {
- const CGRect knobRect = [slider.cell knobRectFlipped:NO];
+ const CGRect knobRect = [slider.cell knobRectFlipped:slider.isFlipped];
pressPoint.x = CGRectGetMidX(knobRect);
pressPoint.y = CGRectGetMidY(knobRect);
[slider.cell startTrackingAt:pressPoint inView:slider];
@@ -5385,8 +5344,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
} else
#endif
{
- if (!hasDoubleTicks)
- fixStaleGeometry(slider);
NSSliderCell *cell = slider.cell;
const int numberOfTickMarks = slider.numberOfTickMarks;
@@ -5394,7 +5351,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
if (hasDoubleTicks)
slider.numberOfTickMarks = 0;
- const CGRect barRect = [cell barRectFlipped:hasTicks];
+ const CGRect barRect = [cell barRectFlipped:slider.isFlipped];
if (drawBar) {
if (!isHorizontal && !sl->upsideDown && (hasDoubleTicks || !hasTicks)) {
// The logic behind verticalFlip and upsideDown is the twisted one.
@@ -5578,7 +5535,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QPainterPath outerFramePath = d->windowPanelPath(outerFrameRect);
p->fillPath(outerFramePath, opt->palette.dark());
- const auto frameAdjust = 1.0 / p->device()->devicePixelRatioF();
+ const auto frameAdjust = 1.0 / p->device()->devicePixelRatio();
const auto innerFrameRect = outerFrameRect.adjusted(frameAdjust, frameAdjust, -frameAdjust, 0);
QPainterPath innerFramePath = d->windowPanelPath(innerFrameRect);
if (isActive) {
@@ -5624,7 +5581,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
const auto iconPos = tr.x() - titlebar->icon.actualSize(iconSize).width() - qRound(titleBarIconTitleSpacing);
// Only render the icon if it'll be fully visible
if (iconPos < tr.right() - titleBarIconTitleSpacing)
- p->drawPixmap(iconPos, tr.y(), titlebar->icon.pixmap(window, iconSize, QIcon::Normal));
+ p->drawPixmap(iconPos, tr.y(), titlebar->icon.pixmap(iconSize, QIcon::Normal));
}
if (!titlebar->text.isEmpty())
@@ -5781,8 +5738,8 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc,
break;
NSSliderCell *cell = slider.cell;
- const auto barRect = QRectF::fromCGRect([cell barRectFlipped:hasTicks]);
- const auto knobRect = QRectF::fromCGRect([cell knobRectFlipped:NO]);
+ const auto barRect = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]);
+ const auto knobRect = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]);
if (knobRect.contains(pt)) {
sc = SC_SliderHandle;
} else if (barRect.contains(pt)) {
@@ -5886,7 +5843,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
NSSliderCell *cell = slider.cell;
if (sc == SC_SliderHandle) {
- ret = QRectF::fromCGRect([cell knobRectFlipped:NO]).toRect();
+ ret = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]).toRect();
if (isHorizontal) {
ret.setTop(sl->rect.top());
ret.setBottom(sl->rect.bottom());
@@ -5895,7 +5852,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
ret.setRight(sl->rect.right());
}
} else if (sc == SC_SliderGroove) {
- ret = QRectF::fromCGRect([cell barRectFlipped:hasTicks]).toRect();
+ ret = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]).toRect();
} else if (hasTicks && sc == SC_SliderTickmarks) {
const auto tickMarkRect = QRectF::fromCGRect([cell rectOfTickMarkAtIndex:0]);
if (isHorizontal)
@@ -6526,7 +6483,7 @@ bool QMacStyle::event(QEvent *e)
{
Q_D(QMacStyle);
if(e->type() == QEvent::FocusIn) {
- QWidget *f = 0;
+ QWidget *f = nullptr;
QWidget *focusWidget = QApplication::focusWidget();
#if QT_CONFIG(graphicsview)
if (QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusWidget)) {
diff --git a/src/plugins/styles/mac/qmacstyle_mac_p.h b/src/plugins/styles/mac/qmacstyle_mac_p.h
index 88f104cccf..d1d6bc6339 100644
--- a/src/plugins/styles/mac/qmacstyle_mac_p.h
+++ b/src/plugins/styles/mac/qmacstyle_mac_p.h
@@ -77,28 +77,28 @@ public:
void polish(QPalette &pal);
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = nullptr) const;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
+ const QWidget *w = nullptr) const;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = nullptr) const;
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = 0) const;
+ const QWidget *w = nullptr) const;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = 0) const;
+ const QPoint &pt, const QWidget *w = nullptr) const;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
- const QWidget *w = 0) const;
+ const QWidget *w = nullptr) const;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *w = 0) const;
+ const QSize &contentsSize, const QWidget *w = nullptr) const;
- int pixelMetric(PixelMetric pm, const QStyleOption *opt = 0, const QWidget *widget = 0) const;
+ int pixelMetric(PixelMetric pm, const QStyleOption *opt = 0, const QWidget *widget = nullptr) const;
QPalette standardPalette() const;
- virtual int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
- QStyleHintReturn *shret = 0) const;
+ virtual int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = nullptr,
+ QStyleHintReturn *shret = nullptr) const;
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt,
- const QWidget *widget = 0) const;
+ const QWidget *widget = nullptr) const;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
const QStyleOption *opt) const;
@@ -108,11 +108,11 @@ public:
bool event(QEvent *e);
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = 0,
- const QWidget *widget = 0) const;
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = nullptr,
+ const QWidget *widget = nullptr) const;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
- Qt::Orientation orientation, const QStyleOption *option = 0,
- const QWidget *widget = 0) const;
+ Qt::Orientation orientation, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const;
private:
Q_DISABLE_COPY_MOVE(QMacStyle)
diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp
index 30b3786a80..906e654e6d 100644
--- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp
@@ -104,7 +104,8 @@ bool canAnimate(const QStyleOption *option) {
static inline QImage createAnimationBuffer(const QStyleOption *option, const QWidget *widget)
{
- const int devicePixelRatio = widget ? widget->devicePixelRatio() : 1;
+ const qreal devicePixelRatio = widget
+ ? widget->devicePixelRatioF() : qApp->devicePixelRatio();
QImage result(option->rect.size() * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(devicePixelRatio);
result.fill(0);
@@ -1006,7 +1007,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (const QStyleOptionProgressBar *bar
= qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
bool isIndeterminate = (bar->minimum == 0 && bar->maximum == 0);
- const bool vertical = bar->orientation == Qt::Vertical;
+ const bool vertical = !(bar->state & QStyle::State_Horizontal);
const bool inverted = bar->invertedAppearance;
if (isIndeterminate || (bar->progress > 0 && (bar->progress < bar->maximum) && d->transitionsEnabled())) {
@@ -1198,7 +1199,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
int x, y, w, h;
menuitem->rect.getRect(&x, &y, &w, &h);
- int tab = menuitem->tabWidth;
+ int tab = menuitem->reservedShortcutWidth;
bool dis = !(menuitem->state & State_Enabled);
bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable
? menuitem->checked : false;
@@ -2287,22 +2288,6 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti
/*!
\internal
*/
-QPalette QWindowsVistaStyle::standardPalette() const
-{
- return QWindowsXPStyle::standardPalette();
-}
-
-/*!
- \internal
- */
-void QWindowsVistaStyle::polish(QApplication *app)
-{
- QWindowsXPStyle::polish(app);
-}
-
-/*!
- \internal
- */
void QWindowsVistaStyle::polish(QWidget *widget)
{
QWindowsXPStyle::polish(widget);
@@ -2407,15 +2392,6 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
#endif // QT_CONFIG(commandlinkbutton)
}
-
-/*!
- \internal
- */
-void QWindowsVistaStyle::unpolish(QApplication *app)
-{
- QWindowsXPStyle::unpolish(app);
-}
-
/*!
\internal
*/
@@ -2437,11 +2413,6 @@ QPixmap QWindowsVistaStyle::standardPixmap(StandardPixmap standardPixmap, const
return QWindowsXPStyle::standardPixmap(standardPixmap, option, widget);
}
-QWindowsVistaStylePrivate::QWindowsVistaStylePrivate() :
- QWindowsXPStylePrivate()
-{
-}
-
bool QWindowsVistaStylePrivate::transitionsEnabled() const
{
BOOL animEnabled = false;
@@ -2472,7 +2443,7 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
QWindowsXPStylePrivate::ButtonTheme,
BP_COMMANDLINKGLYPH, CMDLGS_NORMAL);
if (theme.isValid()) {
- const QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
+ const QSize size = theme.size().toSize();
QIcon linkGlyph;
QPixmap pm(size);
pm.fill(Qt::transparent);
diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p.h
index 43a2a670f8..dab19a67b8 100644
--- a/src/plugins/styles/windowsvista/qwindowsvistastyle_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p.h
@@ -94,9 +94,6 @@ public:
void polish(QWidget *widget) override;
void unpolish(QWidget *widget) override;
void polish(QPalette &pal) override;
- void polish(QApplication *app) override;
- void unpolish(QApplication *app) override;
- QPalette standardPalette() const override;
private:
Q_DISABLE_COPY_MOVE(QWindowsVistaStyle)
diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
index c1d764a60e..4fd4740ffe 100644
--- a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
@@ -192,8 +192,6 @@ class QWindowsVistaStylePrivate : public QWindowsXPStylePrivate
Q_DECLARE_PUBLIC(QWindowsVistaStyle)
public:
- QWindowsVistaStylePrivate();
-
static int fixedPixelMetric(QStyle::PixelMetric pm);
static inline bool useVista();
bool transitionsEnabled() const;
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
index 601f715245..2c9319f72b 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
@@ -215,8 +215,9 @@ static HRGN qt_hrgn_from_qregion(const QRegion &region)
}
/* \internal
- Checks if the theme engine can/should be used, or if we should
- fall back to Windows style.
+ Checks if the theme engine can/should be used, or if we should fall back
+ to Windows style. For Windows 10, this will still return false for the
+ High Contrast themes.
*/
bool QWindowsXPStylePrivate::useXP(bool update)
{
@@ -278,7 +279,7 @@ void QWindowsXPStylePrivate::cleanup(bool force)
static inline HWND createTreeViewHelperWindow()
{
- using QWindowsApplication = QPlatformInterface::Private::QWindowsApplication;
+ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
HWND result = nullptr;
if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration()))
@@ -370,19 +371,26 @@ bool QWindowsXPStylePrivate::isItemViewDelegateLineEdit(const QWidget *widget)
// Returns whether base color is set for this widget
bool QWindowsXPStylePrivate::isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget)
{
- uint resolveMask = option->palette.resolve();
+ uint resolveMask = option->palette.resolveMask();
if (widget) {
// Since spin box includes a line edit we need to resolve the palette mask also from
// the parent, as while the color is always correct on the palette supplied by panel,
// the mask can still be empty. If either mask specifies custom base color, use that.
#if QT_CONFIG(spinbox)
if (const QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
- resolveMask |= spinbox->palette().resolve();
+ resolveMask |= spinbox->palette().resolveMask();
#endif // QT_CONFIG(spinbox)
}
return (resolveMask & (1 << QPalette::Base)) != 0;
}
+static inline Qt::Orientation progressBarOrientation(const QStyleOption *option = nullptr)
+{
+ if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option))
+ return pb->state & QStyle::State_Horizontal ? Qt::Horizontal : Qt::Vertical;
+ return Qt::Horizontal;
+}
+
/*! \internal
This function will always return a valid window handle, and might
create a limbo widget to do so.
@@ -672,7 +680,7 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData, qreal correc
bool translucentToplevel = false;
const QPaintDevice *paintDevice = painter->device();
- const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatioF() : qreal(1);
+ const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : qreal(1);
if (paintDevice->devType() == QInternal::Widget) {
const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
@@ -1097,10 +1105,11 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
*/
/*!
- Constructs a QWindowsStyle
+ \internal
+
+ Constructs a QWindowsXPStyle object.
*/
-QWindowsXPStyle::QWindowsXPStyle()
- : QWindowsStyle(*new QWindowsXPStylePrivate)
+QWindowsXPStyle::QWindowsXPStyle(QWindowsXPStylePrivate &dd) : QWindowsStyle(dd)
{
}
@@ -1110,20 +1119,6 @@ QWindowsXPStyle::QWindowsXPStyle()
QWindowsXPStyle::~QWindowsXPStyle() = default;
/*! \reimp */
-void QWindowsXPStyle::unpolish(QApplication *app)
-{
- QWindowsStyle::unpolish(app);
-}
-
-/*! \reimp */
-void QWindowsXPStyle::polish(QApplication *app)
-{
- QWindowsStyle::polish(app);
- if (!QWindowsXPStylePrivate::useXP())
- return;
-}
-
-/*! \reimp */
void QWindowsXPStyle::polish(QWidget *widget)
{
QWindowsStyle::polish(widget);
@@ -1155,9 +1150,6 @@ void QWindowsXPStyle::polish(QWidget *widget)
widget->setWindowOpacity(0.6);
}
#endif
- if (qobject_cast<QStackedWidget*>(widget) &&
- qobject_cast<QTabWidget*>(widget->parent()))
- widget->parentWidget()->setAttribute(Qt::WA_ContentsPropagated);
Q_D(QWindowsXPStyle);
if (!d->hasInitColors) {
@@ -1508,79 +1500,6 @@ case PE_Frame:
}
break;
}
- case PE_FrameLineEdit: {
- // we try to check if this lineedit is a delegate on a QAbstractItemView-derived class.
- if (QWindowsXPStylePrivate::isItemViewDelegateLineEdit(widget)) {
- QPen oldPen = p->pen();
- // Inner white border
- p->setPen(QPen(option->palette.base().color(), 1));
- p->drawRect(option->rect.adjusted(1, 1, -2, -2));
- // Outer dark border
- p->setPen(QPen(option->palette.shadow().color(), 1));
- p->drawRect(option->rect.adjusted(0, 0, -1, -1));
- p->setPen(oldPen);
- return;
- }
- if (qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- themeNumber = QWindowsXPStylePrivate::EditTheme;
- partId = EP_EDITTEXT;
- noContent = true;
- if (!(flags & State_Enabled))
- stateId = ETS_DISABLED;
- else
- stateId = ETS_NORMAL;
- }
- break;
- }
-
- case PE_PanelLineEdit:
- if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- themeNumber = QWindowsXPStylePrivate::EditTheme;
- partId = EP_EDITTEXT;
- noBorder = true;
- bool isEnabled = flags & State_Enabled;
-
- stateId = isEnabled ? ETS_NORMAL : ETS_DISABLED;
-
- if (QWindowsXPStylePrivate::isLineEditBaseColorSet(option, widget)) {
- p->fillRect(panel->rect, panel->palette.brush(QPalette::Base));
- } else {
- XPThemeData theme(nullptr, p, themeNumber, partId, stateId, rect);
- if (!theme.isValid()) {
- QWindowsStyle::drawPrimitive(pe, option, p, widget);
- return;
- }
- int bgType;
- GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType);
- if( bgType == BT_IMAGEFILE ) {
- theme.mirrorHorizontally = hMirrored;
- theme.mirrorVertically = vMirrored;
- theme.noBorder = noBorder;
- theme.noContent = noContent;
- theme.rotate = rotate;
- d->drawBackground(theme);
- } else {
- QBrush fillColor = option->palette.brush(QPalette::Base);
-
- if (!isEnabled) {
- PROPERTYORIGIN origin = PO_NOTFOUND;
- GetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin);
- // Use only if the fill property comes from our part
- if ((origin == PO_PART || origin == PO_STATE)) {
- COLORREF bgRef;
- GetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef);
- fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef)));
- }
- }
- p->fillRect(option->rect, fillColor);
- }
- }
-
- if (panel->lineWidth > 0)
- proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
- return;
- }
- break;
case PE_FrameTabWidget:
if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option))
@@ -1737,28 +1656,6 @@ case PE_Frame:
}
break;
- case PE_IndicatorProgressChunk:
- {
- Qt::Orientation orient = Qt::Horizontal;
- bool inverted = false;
- if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- orient = pb->orientation;
- inverted = pb->invertedAppearance;
- }
- if (orient == Qt::Horizontal) {
- partId = PP_CHUNK;
- rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.height() );
- if (inverted && option->direction == Qt::LeftToRight)
- hMirrored = true;
- } else {
- partId = PP_CHUNKVERT;
- rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.height());
- }
- themeNumber = QWindowsXPStylePrivate::ProgressTheme;
- stateId = 1;
- }
- break;
-
case PE_FrameWindow:
if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(option))
{
@@ -1801,41 +1698,6 @@ case PE_Frame:
}
break;
- case PE_IndicatorBranch:
- {
- static const int decoration_size = 9;
- int mid_h = option->rect.x() + option->rect.width() / 2;
- int mid_v = option->rect.y() + option->rect.height() / 2;
- int bef_h = mid_h;
- int bef_v = mid_v;
- int aft_h = mid_h;
- int aft_v = mid_v;
- QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern);
- if (option->state & State_Item) {
- if (option->direction == Qt::RightToLeft)
- p->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush);
- else
- p->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush);
- }
- if (option->state & State_Sibling)
- p->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush);
- if (option->state & (State_Open | State_Children | State_Item | State_Sibling))
- p->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush);
- if (option->state & State_Children) {
- int delta = decoration_size / 2;
- bef_h -= delta;
- bef_v -= delta;
- aft_h += delta;
- aft_v += delta;
- XPThemeData theme(nullptr, p, QWindowsXPStylePrivate::XpTreeViewTheme);
- theme.rect = QRect(bef_h, bef_v, decoration_size, decoration_size);
- theme.partId = TVP_GLYPH;
- theme.stateId = flags & QStyle::State_Open ? GLPS_OPENED : GLPS_CLOSED;
- d->drawBackground(theme);
- }
- }
- return;
-
case PE_IndicatorToolBarSeparator:
if (option->rect.height() < 3) {
// XP style requires a few pixels for the separator
@@ -1943,67 +1805,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
}
break;
- case CE_HeaderSection:
- themeNumber = QWindowsXPStylePrivate::HeaderTheme;
- partId = HP_HEADERITEM;
- if (flags & State_Sunken)
- stateId = HIS_PRESSED;
- else if (flags & State_MouseOver)
- stateId = HIS_HOT;
- else
- stateId = HIS_NORMAL;
- break;
-
case CE_Splitter:
p->eraseRect(option->rect);
return;
- case CE_PushButtonBevel:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option))
- {
- themeNumber = QWindowsXPStylePrivate::ButtonTheme;
- partId = BP_PUSHBUTTON;
- bool justFlat = ((btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken)))
- || ((btn->features & QStyleOptionButton::CommandLinkButton)
- && !(flags & State_MouseOver)
- && !(btn->features & QStyleOptionButton::DefaultButton));
- if (!(flags & State_Enabled) && !(btn->features & QStyleOptionButton::Flat))
- stateId = PBS_DISABLED;
- else if (justFlat)
- ;
- else if (flags & (State_Sunken | State_On))
- stateId = PBS_PRESSED;
- else if (flags & State_MouseOver)
- stateId = PBS_HOT;
- else if (btn->features & QStyleOptionButton::DefaultButton)
- stateId = PBS_DEFAULTED;
- else
- stateId = PBS_NORMAL;
-
- if (!justFlat) {
- XPThemeData theme(widget, p, themeNumber, partId, stateId, rect);
- d->drawBackground(theme);
- }
-
- if (btn->features & QStyleOptionButton::HasMenu) {
- int mbiw = 0, mbih = 0;
- XPThemeData theme(widget, nullptr,
- QWindowsXPStylePrivate::ToolBarTheme,
- TP_SPLITBUTTONDROPDOWN);
- if (theme.isValid()) {
- const QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize();
- mbiw = size.width();
- mbih = size.height();
- }
-
- QRect ir = btn->rect;
- QStyleOptionButton newBtn = *btn;
- newBtn.rect = QRect(ir.right() - mbiw - 1, 1 + (ir.height()/2) - (mbih/2), mbiw, mbih);
- proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
- }
- return;
- }
- break;
case CE_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option))
{
@@ -2120,9 +1925,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
case CE_ProgressBarGroove:
{
- Qt::Orientation orient = Qt::Horizontal;
- if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option))
- orient = pb->orientation;
+ Qt::Orientation orient = progressBarOrientation(option);
partId = (orient == Qt::Horizontal) ? PP_BAR : PP_BARVERT;
themeNumber = QWindowsXPStylePrivate::ProgressTheme;
stateId = 1;
@@ -2133,7 +1936,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
{
- int tab = menuitem->tabWidth;
+ int tab = menuitem->reservedShortcutWidth;
bool dis = !(menuitem->state & State_Enabled);
bool act = menuitem->state & State_Selected;
bool checkable = menuitem->menuHasCheckableItems;
@@ -2493,7 +2296,7 @@ static void populateMdiButtonTheme(const QStyle *proxy, const QWidget *widget,
// small on High DPI screens (QTBUG-75927).
qreal mdiButtonCorrectionFactor(XPThemeData &theme, const QPaintDevice *pd = nullptr)
{
- const auto dpr = pd ? pd->devicePixelRatioF() : qApp->devicePixelRatio();
+ const auto dpr = pd ? pd->devicePixelRatio() : qApp->devicePixelRatio();
const QSizeF nativeSize = QSizeF(theme.size()) / dpr;
const QSizeF requestedSize(theme.rect.size());
const auto rawFactor = qMin(requestedSize.width() / nativeSize.width(),
@@ -2546,221 +2349,6 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
flags |= State_MouseOver;
switch (cc) {
-#if QT_CONFIG(spinbox)
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option))
- {
- XPThemeData theme(widget, p, QWindowsXPStylePrivate::SpinTheme);
-
- if (sb->frame && (sub & SC_SpinBoxFrame)) {
- partId = EP_EDITTEXT;
- if (!(flags & State_Enabled))
- stateId = ETS_DISABLED;
- else if (flags & State_HasFocus)
- stateId = ETS_FOCUSED;
- else
- stateId = ETS_NORMAL;
-
- XPThemeData ftheme(widget, p, QWindowsXPStylePrivate::EditTheme,
- partId, stateId, r);
- ftheme.noContent = true;
- d->drawBackground(ftheme);
- }
- if (sub & SC_SpinBoxUp) {
- theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
- partId = SPNP_UP;
- if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
- stateId = UPS_DISABLED;
- else if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken))
- stateId = UPS_PRESSED;
- else if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_MouseOver))
- stateId = UPS_HOT;
- else
- stateId = UPS_NORMAL;
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- if (sub & SC_SpinBoxDown) {
- theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
- partId = SPNP_DOWN;
- if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
- stateId = DNS_DISABLED;
- else if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken))
- stateId = DNS_PRESSED;
- else if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_MouseOver))
- stateId = DNS_HOT;
- else
- stateId = DNS_NORMAL;
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- }
- break;
-#endif // QT_CONFIG(spinbox)
-#if QT_CONFIG(combobox)
- case CC_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option))
- {
- if (sub & SC_ComboBoxEditField) {
- if (cmb->frame) {
- partId = EP_EDITTEXT;
- if (!(flags & State_Enabled))
- stateId = ETS_DISABLED;
- else if (flags & State_HasFocus)
- stateId = ETS_FOCUSED;
- else
- stateId = ETS_NORMAL;
- XPThemeData theme(widget, p, QWindowsXPStylePrivate::EditTheme, partId, stateId, r);
- d->drawBackground(theme);
- } else {
- QBrush editBrush = cmb->palette.brush(QPalette::Base);
- p->fillRect(option->rect, editBrush);
- }
- if (!cmb->editable) {
- QRect re = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
- if (option->state & State_HasFocus) {
- p->fillRect(re, option->palette.highlight());
- p->setPen(option->palette.highlightedText().color());
- p->setBackground(option->palette.highlight());
- } else {
- p->fillRect(re, option->palette.base());
- p->setPen(option->palette.text().color());
- p->setBackground(option->palette.base());
- }
- }
- }
-
- if (sub & SC_ComboBoxArrow) {
- XPThemeData theme(widget, p, QWindowsXPStylePrivate::ComboboxTheme);
- theme.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
- partId = CP_DROPDOWNBUTTON;
- if (!(flags & State_Enabled))
- stateId = CBXS_DISABLED;
- else if (cmb->activeSubControls == SC_ComboBoxArrow && (cmb->state & State_Sunken))
- stateId = CBXS_PRESSED;
- else if (cmb->activeSubControls == SC_ComboBoxArrow && (cmb->state & State_MouseOver))
- stateId = CBXS_HOT;
- else
- stateId = CBXS_NORMAL;
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- }
- break;
-#endif // QT_CONFIG(combobox)
- case CC_ScrollBar:
- if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option))
- {
- XPThemeData theme(widget, p, QWindowsXPStylePrivate::ScrollBarTheme);
- bool maxedOut = (scrollbar->maximum == scrollbar->minimum);
- if (maxedOut)
- flags &= ~State_Enabled;
-
- bool isHorz = flags & State_Horizontal;
- bool isRTL = option->direction == Qt::RightToLeft;
- if (sub & SC_ScrollBarAddLine) {
- theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
- partId = SBP_ARROWBTN;
- if (!(flags & State_Enabled))
- stateId = (isHorz ? (isRTL ? ABS_LEFTDISABLED : ABS_RIGHTDISABLED) : ABS_DOWNDISABLED);
- else if (scrollbar->activeSubControls & SC_ScrollBarAddLine && (scrollbar->state & State_Sunken))
- stateId = (isHorz ? (isRTL ? ABS_LEFTPRESSED : ABS_RIGHTPRESSED) : ABS_DOWNPRESSED);
- else if (scrollbar->activeSubControls & SC_ScrollBarAddLine && (scrollbar->state & State_MouseOver))
- stateId = (isHorz ? (isRTL ? ABS_LEFTHOT : ABS_RIGHTHOT) : ABS_DOWNHOT);
- else
- stateId = (isHorz ? (isRTL ? ABS_LEFTNORMAL : ABS_RIGHTNORMAL) : ABS_DOWNNORMAL);
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- if (sub & SC_ScrollBarSubLine) {
- theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
- partId = SBP_ARROWBTN;
- if (!(flags & State_Enabled))
- stateId = (isHorz ? (isRTL ? ABS_RIGHTDISABLED : ABS_LEFTDISABLED) : ABS_UPDISABLED);
- else if (scrollbar->activeSubControls & SC_ScrollBarSubLine && (scrollbar->state & State_Sunken))
- stateId = (isHorz ? (isRTL ? ABS_RIGHTPRESSED : ABS_LEFTPRESSED) : ABS_UPPRESSED);
- else if (scrollbar->activeSubControls & SC_ScrollBarSubLine && (scrollbar->state & State_MouseOver))
- stateId = (isHorz ? (isRTL ? ABS_RIGHTHOT : ABS_LEFTHOT) : ABS_UPHOT);
- else
- stateId = (isHorz ? (isRTL ? ABS_RIGHTNORMAL : ABS_LEFTNORMAL) : ABS_UPNORMAL);
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- if (maxedOut) {
- theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
- theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
- theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
- partId = scrollbar->orientation == Qt::Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
- stateId = SCRBS_DISABLED;
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- } else {
- if (sub & SC_ScrollBarSubPage) {
- theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
- partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT;
- if (!(flags & State_Enabled))
- stateId = SCRBS_DISABLED;
- else if (scrollbar->activeSubControls & SC_ScrollBarSubPage && (scrollbar->state & State_Sunken))
- stateId = SCRBS_PRESSED;
- else if (scrollbar->activeSubControls & SC_ScrollBarSubPage && (scrollbar->state & State_MouseOver))
- stateId = SCRBS_HOT;
- else
- stateId = SCRBS_NORMAL;
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- if (sub & SC_ScrollBarAddPage) {
- theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
- partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
- if (!(flags & State_Enabled))
- stateId = SCRBS_DISABLED;
- else if (scrollbar->activeSubControls & SC_ScrollBarAddPage && (scrollbar->state & State_Sunken))
- stateId = SCRBS_PRESSED;
- else if (scrollbar->activeSubControls & SC_ScrollBarAddPage && (scrollbar->state & State_MouseOver))
- stateId = SCRBS_HOT;
- else
- stateId = SCRBS_NORMAL;
- theme.partId = partId;
- theme.stateId = stateId;
- d->drawBackground(theme);
- }
- if (sub & SC_ScrollBarSlider) {
- theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
- if (!(flags & State_Enabled))
- stateId = SCRBS_DISABLED;
- else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_Sunken))
- stateId = SCRBS_PRESSED;
- else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_MouseOver))
- stateId = SCRBS_HOT;
- else
- stateId = SCRBS_NORMAL;
-
- // Draw handle
- theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT;
- theme.stateId = stateId;
- d->drawBackground(theme);
-
- const QRect gripperBounds = QWindowsXPStylePrivate::scrollBarGripperBounds(flags, widget, &theme);
- // Draw gripper if there is enough space
- if (!gripperBounds.isEmpty()) {
- p->save();
- theme.rect = gripperBounds;
- p->setClipRegion(d->region(theme));// Only change inside the region of the gripper
- d->drawBackground(theme); // Transparent gripper ontop of background
- p->restore();
- }
- }
- }
- }
- break;
-
#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option))
@@ -3158,13 +2746,6 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
}
-static inline Qt::Orientation progressBarOrientation(const QStyleOption *option = nullptr)
-{
- if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option))
- return pb->orientation;
- return Qt::Horizontal;
-}
-
int QWindowsXPStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option, const QWidget *widget)
{
switch (pm) {
@@ -3570,14 +3151,6 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
}
}
break;
- case CT_SpinBox:
- {
- //Spinbox adds frame twice
- sz = QWindowsStyle::sizeFromContents(ct, option, contentsSize, widget);
- int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
- sz -= QSize(2*border, 2*border);
- }
- break;
case CT_TabWidget:
sz += QSize(6, 6);
break;
@@ -3867,15 +3440,6 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
return QWindowsStyle::standardIcon(standardIcon, option, widget);
}
-/*!
- \internal
-
- Constructs a QWindowsXPStyle object.
-*/
-QWindowsXPStyle::QWindowsXPStyle(QWindowsXPStylePrivate &dd) : QWindowsStyle(dd)
-{
-}
-
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const XPThemeData &t)
{
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle_p.h b/src/plugins/styles/windowsvista/qwindowsxpstyle_p.h
index 0f70105b0e..bd4946cf03 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle_p.h
@@ -61,12 +61,8 @@ class QWindowsXPStyle : public QWindowsStyle
{
Q_OBJECT
public:
- QWindowsXPStyle();
- QWindowsXPStyle(QWindowsXPStylePrivate &dd);
~QWindowsXPStyle() override;
- void unpolish(QApplication*) override;
- void polish(QApplication*) override;
void polish(QWidget*) override;
void polish(QPalette&) override;
void unpolish(QWidget*) override;
@@ -95,6 +91,9 @@ public:
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
const QWidget *widget = nullptr) const override;
+protected:
+ QWindowsXPStyle(QWindowsXPStylePrivate &dd);
+
private:
Q_DISABLE_COPY_MOVE(QWindowsXPStyle)
Q_DECLARE_PRIVATE(QWindowsXPStyle)