summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--config_help.txt3
-rwxr-xr-xconfigure1
-rw-r--r--configure.json1
-rw-r--r--configure.pri3
-rw-r--r--dependencies.yaml1
-rw-r--r--examples/widgets/widgets/scribble/mainwindow.cpp1
-rw-r--r--mkspecs/features/java.prf2
-rw-r--r--qmake/generators/makefiledeps.cpp11
-rw-r--r--qmake/generators/makefiledeps.h8
-rw-r--r--qmake/property.cpp1
-rw-r--r--src/corelib/configure.json6
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h1
-rw-r--r--src/corelib/global/qglobal.cpp16
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/global/qlibraryinfo.cpp2
-rw-r--r--src/corelib/global/qlibraryinfo.h1
-rw-r--r--src/corelib/global/qlogging.cpp2
-rw-r--r--src/corelib/io/qfileselector.cpp7
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp2
-rw-r--r--src/corelib/io/qresource.cpp10
-rw-r--r--src/corelib/io/qsettings.cpp5
-rw-r--r--src/corelib/io/qstandardpaths.cpp2
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp4
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h1
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.h6
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp6
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp15
-rw-r--r--src/corelib/kernel/qmetaobject.h3
-rw-r--r--src/corelib/kernel/qmetatype.h11
-rw-r--r--src/corelib/kernel/qobject.cpp68
-rw-r--r--src/corelib/kernel/qobject.h24
-rw-r--r--src/corelib/kernel/qobject_p.h12
-rw-r--r--src/corelib/kernel/qobjectdefs.h4
-rw-r--r--src/corelib/kernel/qtranslator.cpp8
-rw-r--r--src/corelib/kernel/qvariant.cpp19
-rw-r--r--src/corelib/kernel/qvariant.h2
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp4
-rw-r--r--src/corelib/mimetypes/qmimedatabase_p.h1
-rw-r--r--src/corelib/plugin/qlibrary.cpp4
-rw-r--r--src/corelib/serialization/qdatastream.h7
-rw-r--r--src/corelib/serialization/qjsonarray.h1
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h7
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp92
-rw-r--r--src/corelib/text/qbytearray.h2
-rw-r--r--src/corelib/thread/qfutureinterface.cpp7
-rw-r--r--src/corelib/thread/qfutureinterface.h13
-rw-r--r--src/corelib/thread/qthread.cpp2
-rw-r--r--src/corelib/thread/qthread.h33
-rw-r--r--src/corelib/thread/qthread_unix.cpp28
-rw-r--r--src/corelib/thread/qthread_win.cpp2
-rw-r--r--src/corelib/time/qdatetimeparser_p.h4
-rw-r--r--src/corelib/tools/qeasingcurve.cpp5
-rw-r--r--src/corelib/tools/qeasingcurve.h7
-rw-r--r--src/corelib/tools/qset.h30
-rw-r--r--src/dbus/doc/snippets/code/doc_src_qdbusadaptors.cpp1
-rw-r--r--src/dbus/doc/src/dbus-adaptors.qdoc3
-rw-r--r--src/dbus/qdbusabstractadaptor.cpp118
-rw-r--r--src/dbus/qdbusabstractadaptor_p.h9
-rw-r--r--src/gui/configure.json6
-rw-r--r--src/gui/doc/snippets/picture/picture.cpp79
-rw-r--r--src/gui/image/image.pri5
-rw-r--r--src/gui/image/qimage.h10
-rw-r--r--src/gui/image/qimage_compat.cpp66
-rw-r--r--src/gui/image/qimage_p.h2
-rw-r--r--src/gui/image/qpicture.cpp832
-rw-r--r--src/gui/image/qpicture.h78
-rw-r--r--src/gui/image/qpictureformatplugin.cpp135
-rw-r--r--src/gui/image/qpictureformatplugin.h76
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h9
-rw-r--r--src/gui/kernel/kernel.pri15
-rw-r--r--src/gui/kernel/qevent.cpp27
-rw-r--r--src/gui/kernel/qevent.h16
-rw-r--r--src/gui/kernel/qguiapplication.cpp8
-rw-r--r--src/gui/kernel/qguiapplication_p.h7
-rw-r--r--src/gui/kernel/qguivariant.cpp10
-rw-r--r--src/gui/kernel/qkeymapper_p.h1
-rw-r--r--src/gui/kernel/qkeysequence.cpp5
-rw-r--r--src/gui/kernel/qkeysequence.h16
-rw-r--r--src/gui/kernel/qkeysequence_p.h4
-rw-r--r--src/gui/kernel/qplatformmenu.h6
-rw-r--r--src/gui/kernel/qplatformtheme.cpp8
-rw-r--r--src/gui/kernel/qplatformtheme.h8
-rw-r--r--src/gui/kernel/qplatformtheme_p.h6
-rw-r--r--src/gui/kernel/qshortcutmap.cpp4
-rw-r--r--src/gui/kernel/qshortcutmap_p.h6
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp4
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/opengl/qopengltexture.h2
-rw-r--r--src/gui/text/qfontdatabase.h1
-rw-r--r--src/gui/text/qtextoption.h2
-rw-r--r--src/network/access/access.pri7
-rw-r--r--src/network/access/qabstractnetworkcache.h1
-rw-r--r--src/network/access/qhsts_p.h1
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp12
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp54
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp76
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h7
-rw-r--r--src/network/access/qhttpnetworkreply.cpp14
-rw-r--r--src/network/access/qhttpnetworkreply_p.h12
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp14
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h4
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp19
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h2
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp6
-rw-r--r--src/network/access/qnetworkaccessmanager.h1
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp20
-rw-r--r--src/network/access/qnetworkrequest.cpp18
-rw-r--r--src/network/access/qnetworkrequest.h8
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp1304
-rw-r--r--src/network/access/qspdyprotocolhandler_p.h232
-rw-r--r--src/network/bearer/bearer.pri3
-rw-r--r--src/network/bearer/qbearerengine_impl_p.h (renamed from src/plugins/bearer/qbearerengine_impl.h)6
-rw-r--r--src/network/bearer/qnetworksession_impl.cpp (renamed from src/plugins/bearer/qnetworksession_impl.cpp)8
-rw-r--r--src/network/bearer/qnetworksession_impl_p.h (renamed from src/plugins/bearer/qnetworksession_impl.h)8
-rw-r--r--src/network/kernel/qnetworkinterface.h1
-rw-r--r--src/network/ssl/qsslconfiguration.cpp11
-rw-r--r--src/network/ssl/qsslconfiguration.h2
-rw-r--r--src/network/ssl/qsslsocket_winrt.cpp6
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp77
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h19
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp2
-rw-r--r--src/platformsupport/linuxofono/linuxofono.pro15
-rw-r--r--src/platformsupport/linuxofono/qofonoservice_linux.cpp (renamed from src/plugins/bearer/linux_common/qofonoservice_linux.cpp)2
-rw-r--r--src/platformsupport/linuxofono/qofonoservice_linux_p.h (renamed from src/plugins/bearer/linux_common/qofonoservice_linux_p.h)0
-rw-r--r--src/platformsupport/platformsupport.pro4
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp4
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h4
-rw-r--r--src/plugins/bearer/android/src/qandroidbearerengine.cpp2
-rw-r--r--src/plugins/bearer/android/src/qandroidbearerengine.h2
-rw-r--r--src/plugins/bearer/android/src/src.pro7
-rw-r--r--src/plugins/bearer/connman/connman.pro11
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h4
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro7
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm2
-rw-r--r--src/plugins/bearer/generic/generic.pro3
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h2
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.pro7
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp2
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h2
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.pro11
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp3
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h4
-rw-r--r--src/plugins/bearer/nla/nla.pro7
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp2
-rw-r--r--src/plugins/bearer/nla/qnlaengine.h2
-rw-r--r--src/plugins/platforms/android/android.pro1
-rw-r--r--src/plugins/platforms/android/androidplatformplugin.cpp64
-rw-r--r--src/plugins/platforms/android/main.cpp1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm13
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm17
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp4
-rw-r--r--src/plugins/styles/android/qandroidstyle.cpp2
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm2
-rw-r--r--src/sql/kernel/qsqlquery.cpp6
-rw-r--r--src/sql/kernel/qsqlquery.h4
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp6
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.h2
-rw-r--r--src/sql/models/qsqltablemodel.cpp4
-rw-r--r--src/sql/models/qsqltablemodel.h4
-rw-r--r--src/testlib/qtestblacklist.cpp10
-rw-r--r--src/testlib/qtestkeyboard.h4
-rw-r--r--src/tools/androiddeployqt/main.cpp25
-rw-r--r--src/tools/moc/generator.cpp28
-rw-r--r--src/tools/moc/moc.cpp5
-rw-r--r--src/tools/moc/moc.h1
-rw-r--r--src/tools/tracegen/etw.cpp2
-rw-r--r--src/tools/uic/main.cpp7
-rw-r--r--src/tools/uic/qclass_lib_map.h3
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp8
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp4
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/styles.qdoc2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp9
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h1
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex_p.h1
-rw-r--r--src/widgets/kernel/kernel.pri9
-rw-r--r--src/widgets/kernel/qaction.cpp4
-rw-r--r--src/widgets/kernel/qaction.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp4
-rw-r--r--src/widgets/kernel/qapplication.h1
-rw-r--r--src/widgets/kernel/qshortcut.cpp2
-rw-r--r--src/widgets/kernel/qshortcut.h7
-rw-r--r--src/widgets/kernel/qwidget.cpp9
-rw-r--r--src/widgets/kernel/qwidget.h4
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.cpp1
-rw-r--r--src/widgets/styles/qstyle.h6
-rw-r--r--src/widgets/widgets/qabstractbutton.h4
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp27
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h1
-rw-r--r--src/widgets/widgets/qlineedit.cpp2
-rw-r--r--src/widgets/widgets/qmenu.cpp26
-rw-r--r--src/widgets/widgets/qmenu.h54
-rw-r--r--src/widgets/widgets/qsplitter.h1
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp2
-rw-r--r--src/xml/dom/qdom.cpp14
-rw-r--r--src/xml/dom/qdom.h14
-rw-r--r--sync.profile1
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test50
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+osx/test40
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test (renamed from tests/auto/corelib/io/qfileselector/platforms/+mac/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test (renamed from tests/auto/corelib/io/qfileselector/platforms/+osx/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.qrc114
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp8
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp6
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp51
-rw-r--r--tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp2
-rw-r--r--tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp11
-rw-r--r--tests/auto/gui/image/qpicture/tst_qpicture.cpp31
-rw-r--r--tests/auto/gui/kernel/kernel.pro5
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp4
-rw-r--r--tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp6
-rw-r--r--tests/auto/network/access/access.pro1
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp7
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp4
-rw-r--r--tests/auto/network/access/spdy/BLACKLIST7
-rw-r--r--tests/auto/network/access/spdy/spdy.pro7
-rw-r--r--tests/auto/network/access/spdy/tst_spdy.cpp693
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp18
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp6
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp7
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp6
-rw-r--r--tests/auto/widgets/kernel/kernel.pro3
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp18
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp20
-rw-r--r--tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp22
-rw-r--r--tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp8
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp6
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp16
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp30
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp9
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp12
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp14
-rw-r--r--tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp5
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp11
-rw-r--r--tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp4
-rw-r--r--tests/auto/widgets/widgets/widgets.pro3
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp8
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/main.cpp35
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/benchmarks/corelib/kernel/qobject/main.cpp47
-rw-r--r--tests/benchmarks/corelib/tools/qvector/outofline.cpp2
-rw-r--r--tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp6
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp34
-rw-r--r--tests/manual/dialogs/messageboxpanel.cpp4
-rw-r--r--tests/manual/qnetworkreply/main.cpp204
268 files changed, 1118 insertions, 5051 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 8cc650fc21..de7af300dc 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -6,4 +6,4 @@ DEFINES += QT_NO_JAVA_STYLE_ITERATORS
QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD)
-MODULE_VERSION = 5.15.0
+MODULE_VERSION = 6.0.0
diff --git a/config_help.txt b/config_help.txt
index 2c46592c31..6ed291b621 100644
--- a/config_help.txt
+++ b/config_help.txt
@@ -38,8 +38,7 @@ except -sysconfdir should be located under -prefix/-hostprefix:
-plugindir <dir> ...... Plugins [ARCHDATADIR/plugins]
-libexecdir <dir> ..... Helper programs [ARCHDATADIR/bin on Windows,
ARCHDATADIR/libexec otherwise]
- -importdir <dir> ...... QML1 imports [ARCHDATADIR/imports]
- -qmldir <dir> ......... QML2 imports [ARCHDATADIR/qml]
+ -qmldir <dir> ......... QML imports [ARCHDATADIR/qml]
-datadir <dir> ........ Arch-independent data [PREFIX]
-docdir <dir> ......... Documentation [DATADIR/doc]
-translationdir <dir> . Translations [DATADIR/translations]
diff --git a/configure b/configure
index 19016d5c12..d350ca5c7f 100755
--- a/configure
+++ b/configure
@@ -417,7 +417,6 @@ while [ "$#" -gt 0 ]; do
-docdir| \
-headerdir| \
-plugindir| \
- -importdir| \
-qmldir| \
-archdatadir| \
-datadir| \
diff --git a/configure.json b/configure.json
index ce71e67993..e3ff6caf54 100644
--- a/configure.json
+++ b/configure.json
@@ -40,7 +40,6 @@
"hostbindir": "string",
"hostdatadir": "string",
"hostlibdir": "string",
- "importdir": "string",
"libdir": "string",
"libexecdir": "string",
"plugindir": "string",
diff --git a/configure.pri b/configure.pri
index 5f82efbf07..35cc08d694 100644
--- a/configure.pri
+++ b/configure.pri
@@ -699,7 +699,6 @@ defineReplace(printInstallPaths) {
$$printInstallPath(LibraryExecutables, libexecdir, $$DEFAULT_LIBEXEC) \
$$printInstallPath(Binaries, bindir, bin) \
$$printInstallPath(Plugins, plugindir, plugins) \
- $$printInstallPath(Imports, importdir, imports) \
$$printInstallPath(Qml2Imports, qmldir, qml) \
$$printInstallPath(ArchData, archdatadir, .) \
$$printInstallPath(Data, datadir, .) \
@@ -794,7 +793,6 @@ defineTest(qtConfOutput_preparePaths) {
archdata_pfx = $$config.rel_input.archdatadir/
processQtPath("", libexecdir, $${archdata_pfx}$$DEFAULT_LIBEXEC)
processQtPath("", plugindir, $${archdata_pfx}plugins)
- processQtPath("", importdir, $${archdata_pfx}imports)
processQtPath("", qmldir, $${archdata_pfx}qml)
processQtPath("", sysconfdir, $$DEFAULT_SYSCONFDIR)
$$have_hostprefix {
@@ -838,7 +836,6 @@ defineTest(qtConfOutput_preparePaths) {
addConfStr($$config.rel_input.libexecdir)
addConfStr($$config.rel_input.bindir)
addConfStr($$config.rel_input.plugindir)
- addConfStr($$config.rel_input.importdir)
addConfStr($$config.rel_input.qmldir)
addConfStr($$config.rel_input.archdatadir)
addConfStr($$config.rel_input.datadir)
diff --git a/dependencies.yaml b/dependencies.yaml
new file mode 100644
index 0000000000..c093387ce0
--- /dev/null
+++ b/dependencies.yaml
@@ -0,0 +1 @@
+dependencies: {}
diff --git a/examples/widgets/widgets/scribble/mainwindow.cpp b/examples/widgets/widgets/scribble/mainwindow.cpp
index db4f8d3637..c9a34796ac 100644
--- a/examples/widgets/widgets/scribble/mainwindow.cpp
+++ b/examples/widgets/widgets/scribble/mainwindow.cpp
@@ -58,6 +58,7 @@
#include <QInputDialog>
#include <QMenuBar>
#include <QMessageBox>
+#include <QCloseEvent>
//! [0]
MainWindow::MainWindow(QWidget *parent)
diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf
index f1f5e4c10c..1d52f05e52 100644
--- a/mkspecs/features/java.prf
+++ b/mkspecs/features/java.prf
@@ -20,7 +20,7 @@ CONFIG += plugin no_plugin_name_prefix
javac.input = JAVASOURCES
javac.output = $$CLASS_DIR
javac.CONFIG += combine
-javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEPARATOR))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
+javac.commands = javac -source 7 -target 7 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEPARATOR))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
# Force rebuild every time, because we don't know the paths of the destination files
# as they depend on the code.
javac.depends = FORCE
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index d68539814e..7c4be64aa8 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -60,19 +60,14 @@ QT_BEGIN_NAMESPACE
inline bool qmake_endOfLine(const char &c) { return (c == '\r' || c == '\n'); }
#endif
-QMakeLocalFileName::QMakeLocalFileName(const QString &name) : is_null(name.isNull())
+QMakeLocalFileName::QMakeLocalFileName(const QString &name)
+ : real_name(name)
{
- if(!name.isEmpty()) {
- if(name.at(0) == QLatin1Char('"') && name.at(name.length()-2) == QLatin1Char('"'))
- real_name = name.mid(1, name.length()-2);
- else
- real_name = name;
- }
}
const QString
&QMakeLocalFileName::local() const
{
- if(!is_null && local_name.isNull())
+ if (!isNull() && local_name.isNull())
local_name = Option::normalizePath(real_name);
return local_name;
}
diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h
index 66b87bf470..7e39396754 100644
--- a/qmake/generators/makefiledeps.h
+++ b/qmake/generators/makefiledeps.h
@@ -41,14 +41,14 @@ struct SourceFile;
struct SourceDependChildren;
class SourceFiles;
-class QMakeLocalFileName {
- bool is_null;
+class QMakeLocalFileName
+{
QString real_name;
mutable QString local_name;
public:
- QMakeLocalFileName() : is_null(true) {}
+ QMakeLocalFileName() = default;
QMakeLocalFileName(const QString &);
- bool isNull() const { return is_null; }
+ bool isNull() const { return real_name.isNull(); }
inline const QString &real() const { return real_name; }
const QString &local() const;
diff --git a/qmake/property.cpp b/qmake/property.cpp
index 432ff55664..31d6cdc9d6 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -54,7 +54,6 @@ static const struct {
{ "QT_INSTALL_BINS", QLibraryInfo::BinariesPath, false, false },
{ "QT_INSTALL_TESTS", QLibraryInfo::TestsPath, false, false },
{ "QT_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, false, false },
- { "QT_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, false, false },
{ "QT_INSTALL_QML", QLibraryInfo::Qml2ImportsPath, false, false },
{ "QT_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, false, false },
{ "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false, false },
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 04643aec33..5ee7888d4f 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -826,6 +826,12 @@
],
"output": [ "publicFeature", "feature" ]
},
+ "shortcut": {
+ "label": "QShortcut",
+ "purpose": "Provides keyboard accelerators and shortcuts.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
"systemsemaphore": {
"label": "QSystemSemaphore",
"purpose": "Provides a general counting system semaphore.",
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 81bf6f95ce..c58dc56c42 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -111,6 +111,7 @@
# define QT_FEATURE_renameat2 -1
#endif
#define QT_FEATURE_sharedmemory -1
+#define QT_FEATURE_shortcut -1
#define QT_FEATURE_signaling_nan -1
#define QT_FEATURE_slog2 -1
#ifdef __GLIBC_PREREQ
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 4ab5bd2edb..799d953c8d 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1203,11 +1203,14 @@ bool qSharedBuild() noexcept
the application is compiled (32 or 64).
*/
+#if QT_DEPRECATED_SINCE(5, 9)
/*!
\deprecated
\variable QSysInfo::WindowsVersion
\brief the version of the Windows operating system on which the
application is run.
+
+ Use QOperatingSystemVersion::current() instead.
*/
/*!
@@ -1215,6 +1218,8 @@ bool qSharedBuild() noexcept
\fn QSysInfo::WindowsVersion QSysInfo::windowsVersion()
\since 4.4
+ Use QOperatingSystemVersion::current() instead.
+
Returns the version of the Windows operating system on which the
application is run, or WV_None if the operating system is not
Windows.
@@ -1225,16 +1230,21 @@ bool qSharedBuild() noexcept
\variable QSysInfo::MacintoshVersion
\brief the version of the Macintosh operating system on which
the application is run.
+
+ Use QOperatingSystemVersion::current() instead.
*/
/*!
\deprecated
\fn QSysInfo::MacVersion QSysInfo::macVersion()
+ Use QOperatingSystemVersion::current() instead.
+
Returns the version of Darwin (\macos or iOS) on which the
application is run, or MV_None if the operating system
is not a version of Darwin.
*/
+#endif
/*!
\enum QSysInfo::Endian
@@ -1245,10 +1255,13 @@ bool qSharedBuild() noexcept
the platform's byte order.
*/
+#if QT_DEPRECATED_SINCE(5, 9)
/*!
\deprecated
\enum QSysInfo::WinVersion
+ Use the versions defined in QOperatingSystemVersion instead.
+
This enum provides symbolic names for the various versions of the
Windows operating system. On Windows, the
QSysInfo::WindowsVersion variable gives the version of the system
@@ -1306,6 +1319,8 @@ bool qSharedBuild() noexcept
\deprecated
\enum QSysInfo::MacVersion
+ Use the versions defined in QOperatingSystemVersion instead.
+
This enum provides symbolic names for the various versions of the
Darwin operating system, covering both \macos and iOS. The
QSysInfo::MacintoshVersion variable gives the version of the
@@ -1376,6 +1391,7 @@ bool qSharedBuild() noexcept
\sa WinVersion
*/
+#endif
/*!
\macro Q_OS_DARWIN
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 1e26e9453a..7db7dba9b5 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -87,7 +87,8 @@
#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
-# define QT_NO_UNSHARABLE_CONTAINERS
+// ### Qt6: FIXME and get rid of unsharable containers
+//# define QT_NO_UNSHARABLE_CONTAINERS
# define QT6_VIRTUAL virtual
# define QT6_NOT_VIRTUAL
#else
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index aa83cf2bcc..2da5861ccf 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -419,7 +419,6 @@ static const struct {
#endif
{ "Binaries", "bin" },
{ "Plugins", "plugins" }, // should be ${ArchData}/plugins
- { "Imports", "imports" }, // should be ${ArchData}/imports
{ "Qml2Imports", "qml" }, // should be ${ArchData}/qml
{ "ArchData", "." },
{ "Data", "." },
@@ -856,7 +855,6 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
\value LibraryExecutablesPath The location of installed executables required by libraries at runtime.
\value BinariesPath The location of installed Qt binaries (tools and applications).
\value PluginsPath The location of installed Qt plugins.
- \value ImportsPath The location of installed QML extensions to import (QML 1.x).
\value Qml2ImportsPath The location of installed QML extensions to import (QML 2.x).
\value ArchDataPath The location of general architecture-dependent Qt data.
\value DataPath The location of general architecture-independent Qt data.
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index ed60b170a5..031dfe37e2 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -79,7 +79,6 @@ public:
LibraryExecutablesPath,
BinariesPath,
PluginsPath,
- ImportsPath,
Qml2ImportsPath,
ArchDataPath,
DataPath,
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 17f2246082..3a9ff1651b 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1307,7 +1307,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount)
QString function = m.captured(2);
// skip the trace from QtCore that are because of the qDebug itself
- if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
+ if (!numberPrinted && library.contains(QLatin1String("Qt6Core"))
&& (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
|| function.contains(QLatin1String("QDebug")))) {
continue;
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 31c490de66..7adaafea18 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -342,7 +342,6 @@ void QFileSelectorPrivate::updateSelectors()
QStringList QFileSelectorPrivate::platformSelectors()
{
// similar, but not identical to QSysInfo::osType
- // ### Qt6: remove macOS fallbacks to "mac" and the future compatibility
QStringList ret;
#if defined(Q_OS_WIN)
ret << QStringLiteral("windows");
@@ -355,16 +354,10 @@ QStringList QFileSelectorPrivate::platformSelectors()
# if !defined(Q_OS_ANDROID) && !defined(Q_OS_QNX)
// we don't want "linux" for Android or two instances of "qnx" for QNX
ret << QSysInfo::kernelType();
-# ifdef Q_OS_MAC
- ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
-# endif
# endif
QString productName = QSysInfo::productType();
if (productName != QLatin1String("unknown"))
ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
-# if defined(Q_OS_MACOS)
- ret << QStringLiteral("macos"); // future compatibility
-# endif
#endif
return ret;
}
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 74b7e820d9..ad6dbaba11 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -86,6 +86,8 @@ static bool checkNameDecodable(const char *d_name, qsizetype len)
return cs.invalidChars == 0 && cs.remainingChars == 0;
#else
// if we have no text codecs, then QString::fromLocal8Bit is fromLatin1
+ Q_UNUSED(d_name)
+ Q_UNUSED(len)
return true;
#endif
}
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index 5f91ce5e3d..1d42dbfc70 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -81,7 +81,7 @@ static Qt::HANDLE createChangeNotification(const QString &path, uint flags)
nativePath.append(QLatin1Char('\\'));
const HANDLE result = FindFirstChangeNotification(reinterpret_cast<const wchar_t *>(nativePath.utf16()),
FALSE, flags);
- DEBUG() << __FUNCTION__ << nativePath << Qt::hex <<showbase << flags << "returns" << result;
+ DEBUG() << __FUNCTION__ << nativePath << Qt::hex << Qt::showbase << flags << "returns" << result;
return result;
}
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 22c22ce711..86d361b06a 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -1109,14 +1109,8 @@ bool QDynamicFileResourceRoot::registerSelf(const QString &f)
uchar *data = nullptr;
qsizetype data_len = 0;
-#ifdef QT_USE_MMAP
- int fd = QT_OPEN(QFile::encodeName(f), O_RDONLY,
-#if defined(Q_OS_WIN)
- _S_IREAD | _S_IWRITE
-#else
- 0666
-#endif
- );
+#if defined(QT_USE_MMAP)
+ int fd = QT_OPEN(QFile::encodeName(f), O_RDONLY, 0666);
if (fd >= 0) {
QT_STATBUF st;
if (!QT_FSTAT(fd, &st) && st.st_size <= std::numeric_limits<qsizetype>::max()) {
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index fc7122d904..e485310e86 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -420,7 +420,10 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
case QVariant::UInt:
case QVariant::Bool:
case QVariant::Double:
- case QVariant::KeySequence: {
+#if QT_CONFIG(shortcut)
+ case QVariant::KeySequence:
+#endif
+ {
result = v.toString();
if (result.contains(QChar::Null))
result = QLatin1String("@String(") + result + QLatin1Char(')');
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 3b5f2f97da..7874b854e4 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -345,6 +345,8 @@ QT_BEGIN_NAMESPACE
\note On Android, applications with open files on the external storage (<USER> locations),
will be killed if the external storage is unmounted.
+ \note On Android, reading/writing to GenericDataLocation needs the READ_EXTERNAL_STORAGE/WRITE_EXTERNAL_STORAGE permission granted.
+
\note On iOS, if you do pass \c {QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last()}
as argument to \l{QFileDialog::setDirectory()},
a native image picker dialog will be used for accessing the user's photo album.
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 878e007fb0..a7650390f9 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -979,7 +979,7 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro
// validate it:
int needsLowercasing = -1;
- const ushort *p = reinterpret_cast<const ushort *>(value.constData());
+ const ushort *p = value.utf16();
for (int i = 0; i < len; ++i) {
if (p[i] >= 'a' && p[i] <= 'z')
continue;
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 88555f9572..fc69e362c7 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3294,7 +3294,11 @@ void QAbstractItemModel::endResetModel()
{
Q_D(QAbstractItemModel);
d->invalidatePersistentIndexes();
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ resetInternalData();
+#else
QMetaObject::invokeMethod(this, "resetInternalData");
+#endif
emit modelReset(QPrivateSignal());
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 43649cf79b..2cc1bd8ce6 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -156,7 +156,6 @@ inline uint qHash(const QPersistentModelIndex &index, uint seed) noexcept
Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
#endif
-template<typename T> class QList;
typedef QList<QModelIndex> QModelIndexList;
class QMimeData;
diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h
index c9a73b6a31..f6f6e45c1a 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.h
+++ b/src/corelib/itemmodels/qabstractproxymodel.h
@@ -103,7 +103,11 @@ Q_SIGNALS:
void sourceModelChanged(QPrivateSignal);
protected Q_SLOTS:
- void resetInternalData();
+ void resetInternalData()
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ override
+#endif
+ ;
protected:
QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index e25049f821..6531cd8e0c 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -156,10 +156,10 @@ private:
extern QString qAppFileName();
#endif
-#if QT_VERSION >= 0x060000
-# error "Bump QCoreApplicatoinPrivate::app_compile_version to 0x060000"
+#if QT_VERSION >= 0x070000
+# error "Bump QCoreApplicatoinPrivate::app_compile_version to 0x070000"
#endif
-int QCoreApplicationPrivate::app_compile_version = 0x050000; //we don't know exactly, but it's at least 5.0.0
+int QCoreApplicationPrivate::app_compile_version = 0x060000; //we don't know exactly, but it's at least 6.0.0
bool QCoreApplicationPrivate::setuidAllowed = false;
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 961b96710e..37c43dee4f 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -772,7 +772,7 @@ QString decodeMSG(const MSG& msg)
auto rect = reinterpret_cast<const RECT *>(lParam);
QTextStream(&parameters) << "DPI: " << HIWORD(wParam) << ','
<< LOWORD(wParam) << ' ' << (rect->right - rect->left) << 'x'
- << (rect->bottom - rect->top) << forcesign << rect->left << rect->top;
+ << (rect->bottom - rect->top) << Qt::forcesign << rect->left << rect->top;
}
break;
case WM_IME_NOTIFY:
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 5cb30a74ac..a8e8866339 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -3655,6 +3655,21 @@ const char* QMetaClassInfo::value() const
}
/*!
+ \class QMethodRawArguments
+ \internal
+
+ A wrapper class for the void ** arguments array used by the meta
+ object system. If a slot uses a single argument of this type,
+ the meta object system will pass the raw arguments array directly
+ to the slot and set the arguments count in the slot description to
+ zero, so that any signal can connect to it.
+
+ This is used internally to implement signal relay functionality in
+ our state machine and dbus.
+*/
+
+
+/*!
\macro QGenericArgument Q_ARG(Type, const Type &value)
\relates QMetaObject
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index fcd92afd89..31fecd0b07 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -46,9 +46,6 @@
QT_BEGIN_NAMESPACE
-
-template <typename T> class QList;
-
#define Q_METAMETHOD_INVOKE_MAX_ARGS 10
class Q_CORE_EXPORT QMetaMethod
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index d41f7ee80e..d04f327223 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -151,6 +151,13 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QVariantHash, 28, QVariantHash) \
F(QByteArrayList, 49, QByteArrayList) \
+#if QT_CONFIG(shortcut)
+#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F)\
+ F(QKeySequence, 75, QKeySequence)
+#else
+#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F)
+#endif
+
#define QT_FOR_EACH_STATIC_GUI_CLASS(F)\
F(QFont, 64, QFont) \
F(QPixmap, 65, QPixmap) \
@@ -163,7 +170,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QRegion, 72, QRegion) \
F(QBitmap, 73, QBitmap) \
F(QCursor, 74, QCursor) \
- F(QKeySequence, 75, QKeySequence) \
+ QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) \
F(QPen, 76, QPen) \
F(QTextLength, 77, QTextLength) \
F(QTextFormat, 78, QTextFormat) \
@@ -500,7 +507,7 @@ public:
typedef void (*Deleter)(void *);
typedef void *(*Creator)(const void *);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if 1 || QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt6: fix this
typedef void (*Destructor)(void *);
typedef void *(*Constructor)(void *, const void *); // TODO Qt6: remove me
#endif
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index bb1b48b0a6..d713555bb6 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -161,7 +161,6 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)
#endif
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0;
-void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0;
void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0;
void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0;
int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0;
@@ -233,10 +232,6 @@ QObjectPrivate::~QObjectPrivate()
if (metaObject) metaObject->objectDestroyed(q_ptr);
-#ifndef QT_NO_USERDATA
- if (extraData)
- qDeleteAll(extraData->userData);
-#endif
delete extraData;
}
@@ -995,15 +990,8 @@ QObject::~QObject()
emit destroyed(this);
}
- if (d->declarativeData) {
- if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) {
- if (QAbstractDeclarativeData::destroyed_qml1)
- QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
- } else {
- if (QAbstractDeclarativeData::destroyed)
- QAbstractDeclarativeData::destroyed(d->declarativeData, this);
- }
- }
+ if (d->declarativeData && QAbstractDeclarativeData::destroyed)
+ QAbstractDeclarativeData::destroyed(d->declarativeData, this);
QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed();
if (cd) {
@@ -4241,58 +4229,6 @@ void QObject::dumpObjectInfo() const
}
}
-#ifndef QT_NO_USERDATA
-static QBasicAtomicInteger<uint> user_data_registration = Q_BASIC_ATOMIC_INITIALIZER(0);
-
-/*!
- \internal
- */
-uint QObject::registerUserData()
-{
- return user_data_registration.fetchAndAddRelaxed(1);
-}
-
-/*!
- \fn QObjectUserData::QObjectUserData()
- \internal
- */
-
-/*!
- \internal
- */
-QObjectUserData::~QObjectUserData()
-{
-}
-
-/*!
- \internal
- */
-void QObject::setUserData(uint id, QObjectUserData* data)
-{
- Q_D(QObject);
- if (!d->extraData)
- d->extraData = new QObjectPrivate::ExtraData;
-
- if (d->extraData->userData.size() <= (int) id)
- d->extraData->userData.resize((int) id + 1);
- d->extraData->userData[id] = data;
-}
-
-/*!
- \internal
- */
-QObjectUserData* QObject::userData(uint id) const
-{
- Q_D(const QObject);
- if (!d->extraData)
- return 0;
- if ((int)id < d->extraData->userData.size())
- return d->extraData->userData.at(id);
- return 0;
-}
-
-#endif // QT_NO_USERDATA
-
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QObject *o)
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 540b8b32c1..296552c2f2 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -78,12 +78,6 @@ class QRegExp;
#if QT_CONFIG(regularexpression)
class QRegularExpression;
#endif
-#if !QT_DEPRECATED_SINCE(5, 14) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
-# define QT_NO_USERDATA
-#endif
-#ifndef QT_NO_USERDATA
-class QObjectUserData;
-#endif
struct QDynamicMetaObjectData;
typedef QList<QObject*> QObjectList;
@@ -408,15 +402,6 @@ public:
QList<QByteArray> dynamicPropertyNames() const;
#endif // QT_NO_PROPERTIES
-#ifndef QT_NO_USERDATA
- QT_DEPRECATED_VERSION_5_14
- static uint registerUserData();
- QT_DEPRECATED_VERSION_X_5_14("Use setProperty()")
- void setUserData(uint id, QObjectUserData* data);
- QT_DEPRECATED_VERSION_X_5_14("Use property()")
- QObjectUserData* userData(uint id) const;
-#endif // QT_NO_USERDATA
-
Q_SIGNALS:
void destroyed(QObject * = nullptr);
void objectNameChanged(const QString &objectName, QPrivateSignal);
@@ -485,15 +470,6 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch
inline const QMetaObject *qt_getQtMetaObject() noexcept
{ return &QObject::staticQtMetaObject; }
-#ifndef QT_NO_USERDATA
-class Q_CORE_EXPORT QObjectUserData {
- Q_DISABLE_COPY(QObjectUserData)
-public:
- QObjectUserData() = default;
- virtual ~QObjectUserData();
-};
-#endif
-
#if QT_DEPRECATED_SINCE(5, 0)
template<typename T>
inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString())
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index feafcaf323..11ebba7787 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -89,7 +89,6 @@ class Q_CORE_EXPORT QAbstractDeclarativeData
{
public:
static void (*destroyed)(QAbstractDeclarativeData *, QObject *);
- static void (*destroyed_qml1)(QAbstractDeclarativeData *, QObject *);
static void (*parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *);
static void (*signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **);
static int (*receivers)(QAbstractDeclarativeData *, const QObject *, int);
@@ -97,14 +96,6 @@ public:
static void (*setWidgetParent)(QObject *, QObject *); // Used by the QML engine to specify parents for widgets. Set by QtWidgets.
};
-// This is an implementation of QAbstractDeclarativeData that is identical with
-// the implementation in QtDeclarative and QtQml for the first bit
-struct QAbstractDeclarativeDataImpl : public QAbstractDeclarativeData
-{
- quint32 ownedByQml1:1;
- quint32 unused: 31;
-};
-
class Q_CORE_EXPORT QObjectPrivate : public QObjectData
{
Q_DECLARE_PUBLIC(QObject)
@@ -113,9 +104,6 @@ public:
struct ExtraData
{
ExtraData() {}
- #ifndef QT_NO_USERDATA
- QVector<QObjectUserData *> userData;
- #endif
QList<QByteArray> propertyNames;
QVector<QVariant> propertyValues;
QVector<int> runningTimers;
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index dc2d832fe5..9f654b0318 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -285,6 +285,10 @@ class QMetaEnum;
class QMetaProperty;
class QMetaClassInfo;
+struct QMethodRawArguments
+{
+ void **arguments;
+};
class Q_CORE_EXPORT QGenericArgument
{
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index ddb96ecad6..31c1277b03 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -58,11 +58,11 @@
#include "qendian.h"
#include "qresource.h"
-#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
-#define QT_USE_MMAP
-#include "private/qcore_unix_p.h"
+#if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY)
+# define QT_USE_MMAP
+# include "private/qcore_unix_p.h"
// for mmap
-#include <sys/mman.h>
+# include <sys/mman.h>
#endif
#include <stdlib.h>
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 705cae6cf4..449adf0bab 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -2469,7 +2469,9 @@ static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount] =
QVariant::DateTime,
QVariant::ByteArray,
QVariant::BitArray,
+#if QT_CONFIG(shortcut)
QVariant::KeySequence,
+#endif
QVariant::Pen,
QVariant::LongLong,
QVariant::ULongLong,
@@ -2574,7 +2576,11 @@ void QVariant::save(QDataStream &s) const
typeId += 97;
} else if (typeId == QMetaType::QSizePolicy) {
typeId = 75;
+#if QT_CONFIG(shortcut)
} else if (typeId >= QMetaType::QKeySequence && typeId <= QMetaType::QQuaternion) {
+#else
+ } else if (typeId >= QMetaType::QPen && typeId <= QMetaType::QQuaternion) {
+#endif
// and as a result these types received lower ids too
typeId +=1;
} else if (typeId == QMetaType::QPolygonF) {
@@ -3647,9 +3653,11 @@ bool QVariant::canConvert(int targetTypeId) const
if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) {
switch (uint(targetTypeId)) {
case QVariant::Int:
+#if QT_CONFIG(shortcut)
if (currentType == QVariant::KeySequence)
return true;
Q_FALLTHROUGH();
+#endif
case QVariant::UInt:
case QVariant::LongLong:
case QVariant::ULongLong:
@@ -3672,11 +3680,16 @@ bool QVariant::canConvert(int targetTypeId) const
return currentType == QVariant::Color || currentType == QMetaType::Nullptr
|| ((QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration) && QMetaType::metaObjectForType(currentType));
case QVariant::String:
- return currentType == QVariant::KeySequence || currentType == QVariant::Font
- || currentType == QVariant::Color || currentType == QMetaType::Nullptr
- || ((QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration) && QMetaType::metaObjectForType(currentType));
+ return currentType == QVariant::Font
+ || currentType == QVariant::Color || currentType == QMetaType::Nullptr
+#if QT_CONFIG(shortcut)
+ || currentType == QVariant::KeySequence
+#endif
+ || ((QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration) && QMetaType::metaObjectForType(currentType));
+#if QT_CONFIG(shortcut)
case QVariant::KeySequence:
return currentType == QVariant::String || currentType == QVariant::Int;
+#endif
case QVariant::Font:
return currentType == QVariant::String;
case QVariant::Color:
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 86c7414704..331adea4e7 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -184,7 +184,9 @@ class Q_CORE_EXPORT QVariant
Region = QMetaType::QRegion,
Bitmap = QMetaType::QBitmap,
Cursor = QMetaType::QCursor,
+#if QT_CONFIG(shortcut)
KeySequence = QMetaType::QKeySequence,
+#endif
Pen = QMetaType::QPen,
TextLength = QMetaType::QTextLength,
TextFormat = QMetaType::QTextFormat,
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index 24a7a35ea5..ce84a15831 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -91,8 +91,8 @@ bool QMimeDatabasePrivate::shouldCheck()
return true;
}
-#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
-#define QT_USE_MMAP
+#if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY)
+# define QT_USE_MMAP
#endif
void QMimeDatabasePrivate::loadProviders()
diff --git a/src/corelib/mimetypes/qmimedatabase_p.h b/src/corelib/mimetypes/qmimedatabase_p.h
index d9cf446d44..831390de1f 100644
--- a/src/corelib/mimetypes/qmimedatabase_p.h
+++ b/src/corelib/mimetypes/qmimedatabase_p.h
@@ -63,6 +63,7 @@ QT_REQUIRE_CONFIG(mimetype);
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
+#include <vector>
#include <memory>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index eeaa3c18ec..39a170db3f 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -692,7 +692,7 @@ static bool qt_get_metadata(QLibraryPrivate *priv, QString *errMsg)
};
#else
auto getMetaData = [](QFunctionPointer fptr) {
- auto f = reinterpret_cast<QPair<const char *, size_t> (*)()>(fptr);
+ auto f = reinterpret_cast<QPluginMetaData (*)()>(fptr);
return f();
};
#endif
@@ -702,7 +702,7 @@ static bool qt_get_metadata(QLibraryPrivate *priv, QString *errMsg)
return false;
auto metaData = getMetaData(pfn);
- QJsonDocument doc = qJsonFromRawLibraryMetaData(metaData.first, metaData.second, errMsg);
+ QJsonDocument doc = qJsonFromRawLibraryMetaData(reinterpret_cast<const char *>(metaData.data), metaData.size, errMsg);
if (doc.isNull())
return false;
priv->metaData = doc.object();
diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h
index cfcd89333b..bcfcd47ccf 100644
--- a/src/corelib/serialization/qdatastream.h
+++ b/src/corelib/serialization/qdatastream.h
@@ -43,6 +43,7 @@
#include <QtCore/qscopedpointer.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qpair.h>
+#include <QtCore/qcontainerfwd.h>
#ifdef Status
#error qdatastream.h must be included before any header file that defines Status
@@ -54,12 +55,6 @@ class qfloat16;
class QByteArray;
class QIODevice;
-template <typename T> class QList;
-template <typename T> class QVector;
-template <typename T> class QSet;
-template <class Key, class T> class QHash;
-template <class Key, class T> class QMap;
-
#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
class QDataStreamPrivate;
namespace QtPrivate {
diff --git a/src/corelib/serialization/qjsonarray.h b/src/corelib/serialization/qjsonarray.h
index 22aa996a3e..9b7e10766f 100644
--- a/src/corelib/serialization/qjsonarray.h
+++ b/src/corelib/serialization/qjsonarray.h
@@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE
class QDebug;
class QStringList;
-template <typename T> class QList;
typedef QList<QVariant> QVariantList;
class Q_CORE_EXPORT QJsonArray
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
index 72592b8731..a9d5b96920 100644
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ b/src/corelib/statemachine/qsignaleventgenerator_p.h
@@ -62,13 +62,12 @@ class QStateMachine;
class QSignalEventGenerator : public QObject
{
- Q_OBJECT_FAKE
+ Q_OBJECT
public:
QSignalEventGenerator(QStateMachine *parent);
-private:
-// slots
- void execute(void **_a);
+private Q_SLOTS:
+ void execute(QMethodRawArguments a);
private:
Q_DISABLE_COPY_MOVE(QSignalEventGenerator)
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index a97700e5d0..3c03cf40e4 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -3045,102 +3045,14 @@ void QStateMachine::removeDefaultAnimation(QAbstractAnimation *animation)
#endif // animation
-
-// Begin moc-generated code -- modify carefully (check "HAND EDIT" parts)!
-struct qt_meta_stringdata_QSignalEventGenerator_t {
- QByteArrayData data[3];
- char stringdata[32];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) \
- Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
- offsetof(qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + ofs \
- - idx * sizeof(QByteArrayData) \
- )
-static const qt_meta_stringdata_QSignalEventGenerator_t qt_meta_stringdata_QSignalEventGenerator = {
- {
-QT_MOC_LITERAL(0, 0, 21),
-QT_MOC_LITERAL(1, 22, 7),
-QT_MOC_LITERAL(2, 30, 0)
- },
- "QSignalEventGenerator\0execute\0\0"
-};
-#undef QT_MOC_LITERAL
-
-static const uint qt_meta_data_QSignalEventGenerator[] = {
-
- // content:
- 7, // revision
- 0, // classname
- 0, 0, // classinfo
- 1, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 0, // signalCount
-
- // slots: name, argc, parameters, tag, flags
- 1, 0, 19, 2, 0x0a,
-
- // slots: parameters
- QMetaType::Void,
-
- 0 // eod
-};
-
-void QSignalEventGenerator::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- Q_ASSERT(staticMetaObject.cast(_o));
- QSignalEventGenerator *_t = static_cast<QSignalEventGenerator *>(_o);
- switch (_id) {
- case 0: _t->execute(_a); break; // HAND EDIT: add the _a parameter
- default: ;
- }
- }
- Q_UNUSED(_a);
-}
-
-const QMetaObject QSignalEventGenerator::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data,
- qt_meta_data_QSignalEventGenerator, qt_static_metacall, 0, 0 }
-};
-
-const QMetaObject *QSignalEventGenerator::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *QSignalEventGenerator::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_QSignalEventGenerator.stringdata))
- return static_cast<void*>(const_cast< QSignalEventGenerator*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 1)
- qt_static_metacall(this, _c, _id, _a);
- _id -= 1;
- }
- return _id;
-}
-// End moc-generated code
-
-void QSignalEventGenerator::execute(void **_a)
+void QSignalEventGenerator::execute(QMethodRawArguments a)
{
auto machinePrivate = QStateMachinePrivate::get(qobject_cast<QStateMachine*>(parent()));
if (machinePrivate->state != QStateMachinePrivate::Running)
return;
int signalIndex = senderSignalIndex();
Q_ASSERT(signalIndex != -1);
- machinePrivate->handleTransitionSignal(sender(), signalIndex, _a);
+ machinePrivate->handleTransitionSignal(sender(), signalIndex, a.arguments);
}
QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 7c571706d8..03d842e9bc 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -44,6 +44,7 @@
#include <QtCore/qrefcount.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qarraydata.h>
+#include <QtCore/qcontainerfwd.h>
#include <stdlib.h>
#include <string.h>
@@ -112,7 +113,6 @@ Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len, Qt::ChecksumType standa
class QByteRef;
class QString;
class QDataStream;
-template <typename T> class QList;
typedef QArrayData QByteArrayData;
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index 6430f38a3b..1303be10b1 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -424,12 +424,7 @@ void QFutureInterfaceBase::setProgressValueAndText(int progressValue,
}
}
-QMutex *QFutureInterfaceBase::mutex() const
-{
- return &d->m_mutex;
-}
-
-QMutex &QFutureInterfaceBase::mutex(int) const
+QMutex &QFutureInterfaceBase::mutex() const
{
return d->m_mutex;
}
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index bcdae24833..43dfd6bac4 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -119,8 +119,7 @@ public:
void waitForResult(int resultIndex);
void waitForResume();
- QMutex *mutex() const;
- QMutex &mutex(int) const;
+ QMutex &mutex() const;
QtPrivate::ExceptionStore &exceptionStore();
QtPrivate::ResultStoreBase &resultStoreBase();
const QtPrivate::ResultStoreBase &resultStoreBase() const;
@@ -191,7 +190,7 @@ public:
template <typename T>
inline void QFutureInterface<T>::reportResult(const T *result, int index)
{
- std::lock_guard<QMutex> locker(mutex(0));
+ std::lock_guard<QMutex> locker{mutex()};
if (this->queryState(Canceled) || this->queryState(Finished)) {
return;
}
@@ -217,7 +216,7 @@ inline void QFutureInterface<T>::reportResult(const T &result, int index)
template <typename T>
inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int beginIndex, int count)
{
- std::lock_guard<QMutex> locker(mutex(0));
+ std::lock_guard<QMutex> locker{mutex()};
if (this->queryState(Canceled) || this->queryState(Finished)) {
return;
}
@@ -245,14 +244,14 @@ inline void QFutureInterface<T>::reportFinished(const T *result)
template <typename T>
inline const T &QFutureInterface<T>::resultReference(int index) const
{
- std::lock_guard<QMutex> locker(mutex(0));
+ std::lock_guard<QMutex> locker{mutex()};
return resultStoreBase().resultAt(index).template value<T>();
}
template <typename T>
inline const T *QFutureInterface<T>::resultPointer(int index) const
{
- std::lock_guard<QMutex> locker(mutex(0));
+ std::lock_guard<QMutex> locker{mutex()};
return resultStoreBase().resultAt(index).template pointer<T>();
}
@@ -266,7 +265,7 @@ inline QList<T> QFutureInterface<T>::results()
QFutureInterfaceBase::waitForResult(-1);
QList<T> res;
- std::lock_guard<QMutex> locker(mutex(0));
+ std::lock_guard<QMutex> locker{mutex()};
QtPrivate::ResultIteratorBase it = resultStoreBase().begin();
while (it != resultStoreBase().end()) {
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 9fd1dd059d..eeaec7f24d 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -844,7 +844,7 @@ bool QThread::event(QEvent* event)
return QObject::event(event);
}
-Qt::HANDLE QThread::currentThreadId() noexcept
+Qt::HANDLE QThread::currentThreadIdImpl() noexcept
{
return Qt::HANDLE(currentThread());
}
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index c7a6dc8f1a..8141f945b6 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -161,6 +161,7 @@ private:
#if QT_CONFIG(cxx11_future)
static QThread *createThreadImpl(std::future<void> &&future);
#endif
+ static Qt::HANDLE currentThreadIdImpl() noexcept Q_DECL_PURE_FUNCTION;
friend class QCoreApplication;
friend class QThreadData;
@@ -236,6 +237,38 @@ QThread *QThread::create(Function &&f)
#endif // QT_CONFIG(cxx11_future)
+/*
+ On architectures and platforms we know, interpret the thread control
+ block (TCB) as a unique identifier for a thread within a process. Otherwise,
+ fall back to a slower but safe implementation.
+
+ As per the documentation of currentThreadId, we return an opaque handle
+ as a thread identifier, and application code is not supposed to use that
+ value for anything. In Qt we use the handle to check if threads are identical,
+ for which the TCB is sufficient.
+
+ So we use the fastest possible way, rathern than spend time on returning
+ some pseudo-interoperable value.
+*/
+inline Qt::HANDLE QThread::currentThreadId() noexcept
+{
+ Qt::HANDLE tid; // typedef to void*
+ Q_STATIC_ASSERT(sizeof(tid) == sizeof(void*));
+ // See https://akkadia.org/drepper/tls.pdf for x86 ABI
+#if defined(Q_PROCESSOR_X86_32) && defined(Q_OS_LINUX) // x86 32-bit always uses GS
+ __asm__("movl %%gs:0, %0" : "=r" (tid) : : );
+#elif defined(Q_PROCESSOR_X86_64) && defined(Q_OS_DARWIN64)
+ // 64bit macOS uses GS, see https://github.com/apple/darwin-xnu/blob/master/libsyscall/os/tsd.h
+ __asm__("movq %%gs:0, %0" : "=r" (tid) : : );
+#elif defined(Q_PROCESSOR_X86_64) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD))
+ // x86_64 Linux, BSD uses FS
+ __asm__("movq %%fs:0, %0" : "=r" (tid) : : );
+#else
+ tid = currentThreadIdImpl();
+#endif
+ return tid;
+}
+
QT_END_NAMESPACE
#endif // QTHREAD_H
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index cb3c0d6bb1..21abe372eb 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -415,16 +415,36 @@ void QThreadPrivate::finish(void *arg)
}
-
-
/**************************************************************************
** QThread
*************************************************************************/
-Qt::HANDLE QThread::currentThreadId() noexcept
+/*
+ Since each thread is guaranteed to have its own copy of
+ currenThreadData, the address is guaranteed to be unique for each
+ running thread (but likely to be reused for newly started threads).
+
+ CI tests fails on ARM architectures if we try to use the assembler,
+ or the address of the thread_local (even with a recent gcc version), so
+ stick to the pthread version there. The assembler would be
+
+ // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344k/Babeihid.html
+ asm volatile ("mrc p15, 0, %0, c13, c0, 3" : "=r" (tid));
+
+ and
+
+ // see glibc/sysdeps/aarch64/nptl/tls.h
+ asm volatile ("mrs %0, tpidr_el0" : "=r" (tid));
+
+ for 32 and 64bit versions, respectively.
+*/
+Qt::HANDLE QThread::currentThreadIdImpl() noexcept
{
- // requires a C cast here otherwise we run into trouble on AIX
+#if defined(Q_PROCESSOR_ARM)
return to_HANDLE(pthread_self());
+#else
+ return &currentThreadData;
+#endif
}
#if defined(QT_LINUXBASE) && !defined(_SC_NPROCESSORS_ONLN)
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index a72df2fc40..996bcf0a71 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -449,7 +449,7 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) noexcept
** QThread
*************************************************************************/
-Qt::HANDLE QThread::currentThreadId() noexcept
+Qt::HANDLE QThread::currentThreadIdImpl() noexcept
{
return reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId()));
}
diff --git a/src/corelib/time/qdatetimeparser_p.h b/src/corelib/time/qdatetimeparser_p.h
index e9f1455380..d128e35ddc 100644
--- a/src/corelib/time/qdatetimeparser_p.h
+++ b/src/corelib/time/qdatetimeparser_p.h
@@ -77,7 +77,6 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QDateTimeParser
{
- Q_DECLARE_TR_FUNCTIONS(QDateTimeParser)
public:
enum Context {
FromString,
@@ -267,10 +266,11 @@ protected: // for the benefit of QDateTimeEditPrivate
return skipToNextSection(section, current, QStringRef(&sectionText));
}
QString stateName(State s) const;
+ QString getAmPmText(AmPm ap, Case cs) const;
+
virtual QDateTime getMinimum() const;
virtual QDateTime getMaximum() const;
virtual int cursorPosition() const { return -1; }
- virtual QString getAmPmText(AmPm ap, Case cs) const;
virtual QLocale locale() const { return defaultLocale; }
mutable int currentSectionIndex;
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 52c8d13fe3..d7f69d3e0a 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1382,11 +1382,6 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre
}
/*!
- \fn QList<QPointF> QEasingCurve::cubicBezierSpline() const
- \obsolete Use toCubicSpline() instead.
- */
-
-/*!
\since 5.0
Returns the cubicBezierSpline that defines a custom easing curve.
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index d3a468bb22..81833a758f 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -46,10 +46,6 @@ QT_REQUIRE_CONFIG(easingcurve);
#include <QtCore/qobjectdefs.h>
#include <QtCore/qvector.h>
-#if QT_DEPRECATED_SINCE(5, 0)
-# include <QtCore/qlist.h>
-# include <QtCore/qpoint.h>
-#endif
QT_BEGIN_NAMESPACE
@@ -105,9 +101,6 @@ public:
void addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint);
void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
QVector<QPointF> toCubicSpline() const;
-#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED QList<QPointF> cubicBezierSpline() const { return toCubicSpline().toList(); }
-#endif
Type type() const;
void setType(Type type);
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 879e2176f2..923411c34c 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -260,12 +260,6 @@ public:
{ QSet<T> result = *this; result -= other; return result; }
QList<T> values() const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- Q_DECL_DEPRECATED_X("Use values() instead.")
- QList<T> toList() const { return values(); }
- Q_DECL_DEPRECATED_X("Use QSet<T>(list.begin(), list.end()) instead.")
- static QSet<T> fromList(const QList<T> &list);
-#endif
private:
Hash q_hash;
@@ -397,30 +391,6 @@ Q_OUTOFLINE_TEMPLATE QList<T> QSet<T>::values() const
return result;
}
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-template <typename T>
-Q_OUTOFLINE_TEMPLATE QSet<T> QList<T>::toSet() const
-{
- QSet<T> result;
- result.reserve(size());
- for (int i = 0; i < size(); ++i)
- result.insert(at(i));
- return result;
-}
-
-template <typename T>
-QSet<T> QSet<T>::fromList(const QList<T> &list)
-{
- return list.toSet();
-}
-
-template <typename T>
-QList<T> QList<T>::fromSet(const QSet<T> &set)
-{
- return set.toList();
-}
-#endif
-
Q_DECLARE_SEQUENTIAL_ITERATOR(Set)
#if !defined(QT_NO_JAVA_STYLE_ITERATORS)
diff --git a/src/dbus/doc/snippets/code/doc_src_qdbusadaptors.cpp b/src/dbus/doc/snippets/code/doc_src_qdbusadaptors.cpp
index 0fc7a2b26c..f5d9fe7889 100644
--- a/src/dbus/doc/snippets/code/doc_src_qdbusadaptors.cpp
+++ b/src/dbus/doc/snippets/code/doc_src_qdbusadaptors.cpp
@@ -62,7 +62,6 @@ QString processRequest(const QString &request, const QDBusMessage &message)
data->request = request;
message.setDelayedReply(true);
data->reply = message.createReply();
- QDBusConnection::sessionBus().send(data->reply);
appendRequest(data);
return QString();
diff --git a/src/dbus/doc/src/dbus-adaptors.qdoc b/src/dbus/doc/src/dbus-adaptors.qdoc
index 9ebf0cedf2..3398a45af7 100644
--- a/src/dbus/doc/src/dbus-adaptors.qdoc
+++ b/src/dbus/doc/src/dbus-adaptors.qdoc
@@ -174,9 +174,6 @@
\snippet code/doc_src_qdbusadaptors.cpp 10
- The use of
- \l{QDBusConnection::send()}{QDBusConnection::sessionBus().send(data->reply)}
- is needed to explicitly inform the caller that the response will be delayed.
In this case, the return value is unimportant; we return an arbitrary value
to satisfy the compiler.
diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp
index 993607a643..b7b291551d 100644
--- a/src/dbus/qdbusabstractadaptor.cpp
+++ b/src/dbus/qdbusabstractadaptor.cpp
@@ -276,11 +276,11 @@ void QDBusAdaptorConnector::polish()
std::sort(adaptors.begin(), adaptors.end());
}
-void QDBusAdaptorConnector::relaySlot(void **argv)
+void QDBusAdaptorConnector::relaySlot(QMethodRawArguments argv)
{
QObject *sndr = sender();
if (Q_LIKELY(sndr)) {
- relay(sndr, senderSignalIndex(), argv);
+ relay(sndr, senderSignalIndex(), argv.arguments);
} else {
qWarning("QtDBus: cannot relay signals from parent %s(%p \"%s\") unless they are emitted in the object's thread %s(%p \"%s\"). "
"Current thread is %s(%p \"%s\").",
@@ -333,120 +333,6 @@ void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void **
emit relaySignal(realObject, senderMetaObject, lastSignalIdx, args);
}
-// our Meta Object
-// modify carefully: this has been hand-edited!
-// the relaySlot slot gets called with the void** array
-
-struct qt_meta_stringdata_QDBusAdaptorConnector_t {
- QByteArrayData data[10];
- char stringdata[96];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) \
- Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
- offsetof(qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + ofs \
- - idx * sizeof(QByteArrayData) \
- )
-static const qt_meta_stringdata_QDBusAdaptorConnector_t qt_meta_stringdata_QDBusAdaptorConnector = {
- {
-QT_MOC_LITERAL(0, 0, 21),
-QT_MOC_LITERAL(1, 22, 11),
-QT_MOC_LITERAL(2, 34, 0),
-QT_MOC_LITERAL(3, 35, 3),
-QT_MOC_LITERAL(4, 39, 18),
-QT_MOC_LITERAL(5, 58, 10),
-QT_MOC_LITERAL(6, 69, 3),
-QT_MOC_LITERAL(7, 73, 4),
-QT_MOC_LITERAL(8, 78, 9),
-QT_MOC_LITERAL(9, 88, 6)
- },
- "QDBusAdaptorConnector\0relaySignal\0\0"
- "obj\0const QMetaObject*\0metaObject\0sid\0"
- "args\0relaySlot\0polish\0"
-};
-#undef QT_MOC_LITERAL
-
-static const uint qt_meta_data_QDBusAdaptorConnector[] = {
-
- // content:
- 7, // revision
- 0, // classname
- 0, 0, // classinfo
- 3, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 1, // signalCount
-
- // signals: name, argc, parameters, tag, flags
- 1, 4, 29, 2, 0x05,
-
- // slots: name, argc, parameters, tag, flags
- 8, 0, 38, 2, 0x0a,
- 9, 0, 39, 2, 0x0a,
-
- // signals: parameters
- QMetaType::Void, QMetaType::QObjectStar, 0x80000000 | 4, QMetaType::Int, QMetaType::QVariantList, 3, 5, 6, 7,
-
- // slots: parameters
- QMetaType::Void,
- QMetaType::Void,
-
- 0 // eod
-};
-
-void QDBusAdaptorConnector::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- Q_ASSERT(staticMetaObject.cast(_o));
- QDBusAdaptorConnector *_t = static_cast<QDBusAdaptorConnector *>(_o);
- switch (_id) {
- case 0: _t->relaySignal((*reinterpret_cast< QObject*(*)>(_a[1])),(*reinterpret_cast< const QMetaObject*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QVariantList(*)>(_a[4]))); break;
- case 1: _t->relaySlot(_a); break; // HAND EDIT: add the _a parameter
- case 2: _t->polish(); break;
- default: ;
- }
- }
-}
-
-const QMetaObject QDBusAdaptorConnector::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_QDBusAdaptorConnector.data,
- qt_meta_data_QDBusAdaptorConnector, qt_static_metacall, 0, 0 }
-};
-
-const QMetaObject *QDBusAdaptorConnector::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *QDBusAdaptorConnector::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_QDBusAdaptorConnector.stringdata))
- return static_cast<void*>(const_cast< QDBusAdaptorConnector*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int QDBusAdaptorConnector::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 3)
- qt_static_metacall(this, _c, _id, _a);
- _id -= 3;
- }
- return _id;
-}
-
-// SIGNAL 0
-void QDBusAdaptorConnector::relaySignal(QObject * _t1, const QMetaObject * _t2, int _t3, const QVariantList & _t4)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
-
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusabstractadaptor_p.h b/src/dbus/qdbusabstractadaptor_p.h
index 023b3b1be2..404901381b 100644
--- a/src/dbus/qdbusabstractadaptor_p.h
+++ b/src/dbus/qdbusabstractadaptor_p.h
@@ -92,7 +92,7 @@ public:
class QDBusAdaptorConnector: public QObject
{
- Q_OBJECT_FAKE
+ Q_OBJECT
public: // typedefs
struct AdaptorData
@@ -118,12 +118,11 @@ public: // methods
void disconnectAllSignals(QObject *object);
void relay(QObject *sender, int id, void **);
-//public slots:
- void relaySlot(void **);
+public Q_SLOTS:
+ void relaySlot(QMethodRawArguments a);
void polish();
-protected:
-//signals:
+Q_SIGNALS:
void relaySignal(QObject *obj, const QMetaObject *metaObject, int sid, const QVariantList &args);
public: // member variables
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 39b8d0c2b8..90d0c8c134 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -1637,12 +1637,6 @@
"condition": "features.imageformat_xpm",
"output": [ "publicFeature", "feature" ]
},
- "shortcut": {
- "label": "QShortcut",
- "purpose": "Provides keyboard accelerators and shortcuts.",
- "section": "Kernel",
- "output": [ "publicFeature", "feature" ]
- },
"action": {
"label": "QAction",
"purpose": "Provides widget actions.",
diff --git a/src/gui/doc/snippets/picture/picture.cpp b/src/gui/doc/snippets/picture/picture.cpp
index 863476fdbf..807c263b19 100644
--- a/src/gui/doc/snippets/picture/picture.cpp
+++ b/src/gui/doc/snippets/picture/picture.cpp
@@ -80,82 +80,3 @@ int main()
painter.end(); // painting done
//! [1]
}
-
- QPicture myPicture;
- {
- // FORMATS
-//! [2]
- const QStringList list = QPicture::inputFormatList();
- for (const QString &string : list)
- myProcessing(string);
-//! [2]
- }
-
- {
- // OUTPUT
-//! [3]
- const QStringList list = QPicture::outputFormatList();
- for (const QString &string : list)
- myProcessing(string);
-//! [3]
- }
-
- {
- // PIC READ
-//! [4]
- QPictureIO iio;
- QPixmap pixmap;
- iio.setFileName("vegeburger.pic");
- if (iio.read()) { // OK
- QPicture picture = iio.picture();
- QPainter painter(&pixmap);
- painter.drawPicture(0, 0, picture);
- }
-//! [4]
- }
-
- {
- QPixmap pixmap;
- // PIC WRITE
-//! [5]
- QPictureIO iio;
- QPicture picture;
- QPainter painter(&picture);
- painter.drawPixmap(0, 0, pixmap);
- iio.setPicture(picture);
- iio.setFileName("vegeburger.pic");
- iio.setFormat("PIC");
- if (iio.write())
- return true; // returned true if written successfully
-//! [5]
- }
-
-}
-
-// SVG READ
-//! [6]
-void readSVG(QPictureIO *picture)
-{
- // read the picture using the picture->ioDevice()
-}
-//! [6]
-
-// SVG WRITE
-//! [7]
-void writeSVG(QPictureIO *picture)
-{
- // write the picture using the picture->ioDevice()
-}
-//! [7]
-
-// USE SVG
-void foo() {
-
-//! [8]
- // add the SVG picture handler
- // ...
-//! [8]
- QPictureIO::defineIOHandler("SVG", 0, 0, readSVG, writeSVG);
- // ...
-
-}
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 3b2ced3f58..085ec90c4b 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -14,7 +14,6 @@ HEADERS += \
image/qpaintengine_pic_p.h \
image/qpicture.h \
image/qpicture_p.h \
- image/qpictureformatplugin.h \
image/qpixmap.h \
image/qpixmap_raster_p.h \
image/qpixmap_blitter_p.h \
@@ -38,7 +37,6 @@ SOURCES += \
image/qimagewriter.cpp \
image/qpaintengine_pic.cpp \
image/qpicture.cpp \
- image/qpictureformatplugin.cpp \
image/qpixmap.cpp \
image/qpixmapcache.cpp \
image/qplatformpixmap.cpp \
@@ -59,9 +57,6 @@ win32:!winrt: SOURCES += image/qpixmap_win.cpp
darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
-NO_PCH_SOURCES += image/qimage_compat.cpp
-false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
-
# Built-in image format support
HEADERS += \
image/qbmphandler_p.h \
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 7544ccca05..73c960f13f 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -68,7 +68,6 @@ class QMatrix;
class QStringList;
class QTransform;
class QVariant;
-template <class T> class QList;
template <class T> class QVector;
struct QImageData;
@@ -179,7 +178,6 @@ public:
Format format() const;
-#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QIMAGE_COMPAT_CPP)
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
{ return convertToFormat_helper(f, flags); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
@@ -189,9 +187,6 @@ public:
else
return convertToFormat_helper(f, flags);
}
-#else
- Q_REQUIRED_RESULT QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
-#endif
Q_REQUIRED_RESULT QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
bool reinterpretAsFormat(Format f);
@@ -284,7 +279,6 @@ public:
static QMatrix trueMatrix(const QMatrix &, int w, int h);
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
static QTransform trueMatrix(const QTransform &, int w, int h);
-#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QIMAGE_COMPAT_CPP)
QImage mirrored(bool horizontally = false, bool vertically = true) const &
{ return mirrored_helper(horizontally, vertically); }
QImage &&mirrored(bool horizontally = false, bool vertically = true) &&
@@ -293,10 +287,6 @@ public:
{ return rgbSwapped_helper(); }
QImage &&rgbSwapped() &&
{ rgbSwapped_inplace(); return std::move(*this); }
-#else
- QImage mirrored(bool horizontally = false, bool vertically = true) const;
- QImage rgbSwapped() const;
-#endif
void invertPixels(InvertMode = InvertRgb);
QColorSpace colorSpace() const;
diff --git a/src/gui/image/qimage_compat.cpp b/src/gui/image/qimage_compat.cpp
deleted file mode 100644
index ba31a9ac9b..0000000000
--- a/src/gui/image/qimage_compat.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 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$
-**
-****************************************************************************/
-
-#ifdef QIMAGE_H
-# error "This file cannot be used with precompiled headers"
-#endif
-#define QT_COMPILING_QIMAGE_COMPAT_CPP
-
-#include "qimage.h"
-
-QT_BEGIN_NAMESPACE
-
-// These implementations must be the same as the inline versions in qimage.h
-
-QImage QImage::convertToFormat(Format f, Qt::ImageConversionFlags flags) const
-{
- return convertToFormat_helper(f, flags);
-}
-
-QImage QImage::mirrored(bool horizontally, bool vertically) const
-{
- return mirrored_helper(horizontally, vertically);
-}
-
-QImage QImage::rgbSwapped() const
-{
- return rgbSwapped_helper();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 9e2d9c86bb..2b1720580a 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -140,7 +140,7 @@ QImageData::calculateImageParameters(qsizetype width, qsizetype height, qsizetyp
qsizetype dummy;
if (mul_overflow(height, qsizetype(sizeof(uchar *)), &dummy))
return invalid; // why is this here?
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+#if 1 || QT_VERSION < QT_VERSION_CHECK(6,0,0) // ### can only fix this if QImage dimensions are not int anymore
// Disallow images where width * depth calculations might overflow
if (width > (INT_MAX - 31) / depth)
return invalid;
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 978a07b9f9..e119103462 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -264,14 +264,14 @@ void QPicture::setData(const char* data, uint size)
\sa save()
*/
-bool QPicture::load(const QString &fileName, const char *format)
+bool QPicture::load(const QString &fileName)
{
QFile f(fileName);
if (!f.open(QIODevice::ReadOnly)) {
operator=(QPicture());
return false;
}
- return load(&f, format);
+ return load(&f);
}
/*!
@@ -280,21 +280,8 @@ bool QPicture::load(const QString &fileName, const char *format)
\a dev is the device to use for loading.
*/
-bool QPicture::load(QIODevice *dev, const char *format)
+bool QPicture::load(QIODevice *dev)
{
- if(format) {
-#ifndef QT_NO_PICTUREIO
- QPictureIO io(dev, format);
- if (io.read()) {
- operator=(io.picture());
- return true;
- }
-#endif
- qWarning("QPicture::load: No such picture format: %s", format);
- operator=(QPicture());
- return false;
- }
-
detach();
QByteArray a = dev->readAll();
@@ -312,7 +299,7 @@ bool QPicture::load(QIODevice *dev, const char *format)
\sa load()
*/
-bool QPicture::save(const QString &fileName, const char *format)
+bool QPicture::save(const QString &fileName)
{
if (paintingActive()) {
qWarning("QPicture::save: still being painted on. "
@@ -320,27 +307,10 @@ bool QPicture::save(const QString &fileName, const char *format)
return false;
}
-
- if(format) {
-#ifndef QT_NO_PICTUREIO
- QPictureIO io(fileName, format);
- bool result = io.write();
- if (result) {
- operator=(io.picture());
- } else if (format)
-#else
- bool result = false;
-#endif
- {
- qWarning("QPicture::save: No such picture format: %s", format);
- }
- return result;
- }
-
QFile f(fileName);
if (!f.open(QIODevice::WriteOnly))
return false;
- return save(&f, format);
+ return save(&f);
}
/*!
@@ -349,7 +319,7 @@ bool QPicture::save(const QString &fileName, const char *format)
\a dev is the device to use for saving.
*/
-bool QPicture::save(QIODevice *dev, const char *format)
+bool QPicture::save(QIODevice *dev)
{
if (paintingActive()) {
qWarning("QPicture::save: still being painted on. "
@@ -357,22 +327,6 @@ bool QPicture::save(QIODevice *dev, const char *format)
return false;
}
- if(format) {
-#ifndef QT_NO_PICTUREIO
- QPictureIO io(dev, format);
- bool result = io.write();
- if (result) {
- operator=(io.picture());
- } else if (format)
-#else
- bool result = false;
-#endif
- {
- qWarning("QPicture::save: No such picture format: %s", format);
- }
- return result;
- }
-
dev->write(d_func()->pictb.buffer(), d_func()->pictb.buffer().size());
return true;
}
@@ -1189,780 +1143,6 @@ QDataStream &operator>>(QDataStream &s, QPicture &r)
}
#endif // QT_NO_DATASTREAM
-
-#ifndef QT_NO_PICTUREIO
-
-QT_BEGIN_INCLUDE_NAMESPACE
-#include "qregexp.h"
-#include "qpictureformatplugin.h"
-QT_END_INCLUDE_NAMESPACE
-
-#if QT_DEPRECATED_SINCE(5, 10)
-/*!
- \obsolete
-
- Returns a string that specifies the picture format of the file \a
- fileName, or \nullptr if the file cannot be read or if the format
- is not recognized.
-
- \sa load(), save()
-*/
-
-const char* QPicture::pictureFormat(const QString &fileName)
-{
- const QByteArray format = QPictureIO::pictureFormat(fileName);
- // This function returns a const char * from a QByteArray.
- // Double check that the QByteArray is not detached, otherwise
- // we would return a dangling pointer.
- Q_ASSERT(!format.isDetached());
- return format;
-}
-
-/*!
- \obsolete
-
- Returns a list of picture formats that are supported for picture
- input.
-
- \sa outputFormats(), inputFormatList(), QPictureIO
-*/
-QList<QByteArray> QPicture::inputFormats()
-{
- return QPictureIO::inputFormats();
-}
-
-static QStringList qToStringList(const QList<QByteArray> &arr)
-{
- QStringList list;
- const int count = arr.count();
- list.reserve(count);
- for (int i = 0; i < count; ++i)
- list.append(QString::fromLatin1(arr.at(i)));
- return list;
-}
-
-/*!
- \obsolete
-
- Returns a list of picture formats that are supported for picture
- input.
-
- Note that if you want to iterate over the list, you should iterate
- over a copy, e.g.
- \snippet picture/picture.cpp 2
-
- \sa outputFormatList(), inputFormats(), QPictureIO
-*/
-QStringList QPicture::inputFormatList()
-{
- return qToStringList(QPictureIO::inputFormats());
-}
-
-
-/*!
- \obsolete
-
- Returns a list of picture formats that are supported for picture
- output.
-
- Note that if you want to iterate over the list, you should iterate
- over a copy, e.g.
- \snippet picture/picture.cpp 3
-
- \sa inputFormatList(), outputFormats(), QPictureIO
-*/
-QStringList QPicture::outputFormatList()
-{
- return qToStringList(QPictureIO::outputFormats());
-}
-
-/*!
- \obsolete
-
- Returns a list of picture formats that are supported for picture
- output.
-
- \sa inputFormats(), outputFormatList(), QPictureIO
-*/
-QList<QByteArray> QPicture::outputFormats()
-{
- return QPictureIO::outputFormats();
-}
-#endif // QT_DEPRECATED_SINCE(5, 10)
-
-/*****************************************************************************
- QPictureIO member functions
- *****************************************************************************/
-
-/*!
- \obsolete
-
- \class QPictureIO
-
- \brief The QPictureIO class contains parameters for loading and
- saving pictures.
-
- \ingroup painting
- \ingroup io
- \inmodule QtGui
-
- QPictureIO contains a QIODevice object that is used for picture data
- I/O. The programmer can install new picture file formats in addition
- to those that Qt provides.
-
- You don't normally need to use this class; QPicture::load(),
- QPicture::save().
-
- \sa QPicture, QPixmap, QFile
-*/
-
-struct QPictureIOData
-{
- QPicture pi; // picture
- int iostat; // IO status
- QByteArray frmt; // picture format
- QIODevice *iodev; // IO device
- QString fname; // file name
- QString descr; // picture description
- const char *parameters;
- int quality;
- float gamma;
-};
-
-/*!
- Constructs a QPictureIO object with all parameters set to zero.
-*/
-
-QPictureIO::QPictureIO()
-{
- init();
-}
-
-/*!
- Constructs a QPictureIO object with the I/O device \a ioDevice and a
- \a format tag.
-*/
-
-QPictureIO::QPictureIO(QIODevice *ioDevice, const char *format)
-{
- init();
- d->iodev = ioDevice;
- d->frmt = format;
-}
-
-/*!
- Constructs a QPictureIO object with the file name \a fileName and a
- \a format tag.
-*/
-
-QPictureIO::QPictureIO(const QString &fileName, const char* format)
-{
- init();
- d->frmt = format;
- d->fname = fileName;
-}
-
-/*!
- Contains initialization common to all QPictureIO constructors.
-*/
-
-void QPictureIO::init()
-{
- d = new QPictureIOData();
- d->parameters = 0;
- d->quality = -1; // default quality of the current format
- d->gamma=0.0f;
- d->iostat = 0;
- d->iodev = 0;
-}
-
-/*!
- Destroys the object and all related data.
-*/
-
-QPictureIO::~QPictureIO()
-{
- if (d->parameters)
- delete [] d->parameters;
- delete d;
-}
-
-
-/*****************************************************************************
- QPictureIO picture handler functions
- *****************************************************************************/
-
-class QPictureHandler
-{
-public:
- QPictureHandler(const char *f, const char *h, const QByteArray& fl,
- picture_io_handler r, picture_io_handler w);
- QByteArray format; // picture format
- QRegExp header; // picture header pattern
- enum TMode { Untranslated=0, TranslateIn, TranslateInOut } text_mode;
- picture_io_handler read_picture; // picture read function
- picture_io_handler write_picture; // picture write function
- bool obsolete; // support not "published"
-};
-
-QPictureHandler::QPictureHandler(const char *f, const char *h, const QByteArray& fl,
- picture_io_handler r, picture_io_handler w)
- : format(f), header(QString::fromLatin1(h))
-{
- text_mode = Untranslated;
- if (fl.contains('t'))
- text_mode = TranslateIn;
- else if (fl.contains('T'))
- text_mode = TranslateInOut;
- obsolete = fl.contains('O');
- read_picture = r;
- write_picture = w;
-}
-
-typedef QList<QPictureHandler *> QPHList;
-Q_GLOBAL_STATIC(QPHList, pictureHandlers)
-
-void qt_init_picture_plugins()
-{
- typedef QMultiMap<int, QString> PluginKeyMap;
- typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
-
- static QBasicMutex mutex;
- const auto locker = qt_scoped_lock(mutex);
- static QFactoryLoader loader(QPictureFormatInterface_iid,
- QStringLiteral("/pictureformats"));
-
- const PluginKeyMap keyMap = loader.keyMap();
- const PluginKeyMapConstIterator cend = keyMap.constEnd();
- for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
- if (QPictureFormatPlugin *format = qobject_cast<QPictureFormatPlugin*>(loader.instance(it.key())))
- format->installIOHandler(it.value());
- }
-}
-
-static void cleanup()
-{
- // make sure that picture handlers are delete before plugin manager
- if (QPHList *list = pictureHandlers()) {
- qDeleteAll(*list);
- list->clear();
- }
-}
-
-void qt_init_picture_handlers() // initialize picture handlers
-{
- static QBasicAtomicInt done = Q_BASIC_ATOMIC_INITIALIZER(0);
- if (done.testAndSetRelaxed(0, 1)) {
- qAddPostRoutine(cleanup);
- }
-}
-
-static QPictureHandler *get_picture_handler(const char *format)
-{ // get pointer to handler
- qt_init_picture_handlers();
- qt_init_picture_plugins();
- if (QPHList *list = pictureHandlers()) {
- for (int i = 0; i < list->size(); ++i) {
- if (list->at(i)->format == format)
- return list->at(i);
- }
- }
- return 0; // no such handler
-}
-
-
-/*!
- Defines a picture I/O handler for the picture format called \a
- format, which is recognized using the regular
- expression defined in \a header, read using \a readPicture and
- written using \a writePicture.
-
- \a flags is a string of single-character flags for this format.
- The only flag defined currently is T (upper case), so the only
- legal value for \a flags are "T" and the empty string. The "T"
- flag means that the picture file is a text file, and Qt should treat
- all newline conventions as equivalent. (XPM files and some PPM
- files are text files for example.)
-
- \a format is used to select a handler to write a QPicture; \a header
- is used to select a handler to read an picture file.
-
- If \a readPicture is \nullptr, the QPictureIO will not be able
- to read pictures in \a format. If \a writePicture is \nullptr,
- the QPictureIO will not be able to write pictures in \a format. If
- both are null, the QPictureIO object is valid but useless.
-
- Example:
- \snippet picture/picture.cpp 6
- \codeline
- \snippet picture/picture.cpp 7
- \codeline
- \snippet picture/picture.cpp 8
-
- Before the regular expression test, all the 0 bytes in the file header are
- converted to 1 bytes. This is done because when Qt was ASCII-based, QRegExp
- could not handle 0 bytes in strings.
-
- The regexp is only applied on the first 14 bytes of the file.
-
- (Note that if one handlerIO supports writing a format and another
- supports reading it, Qt supports both reading and writing. If two
- handlers support the same operation, Qt chooses one arbitrarily.)
-*/
-
-void QPictureIO::defineIOHandler(const char *format,
- const char *header,
- const char *flags,
- picture_io_handler readPicture,
- picture_io_handler writePicture)
-{
- qt_init_picture_handlers();
- if (QPHList *list = pictureHandlers()) {
- QPictureHandler *p;
- p = new QPictureHandler(format, header, QByteArray(flags), readPicture, writePicture);
- list->prepend(p);
- }
-}
-
-
-/*****************************************************************************
- QPictureIO normal member functions
- *****************************************************************************/
-
-/*!
- Returns the picture currently set.
-
- \sa setPicture()
-*/
-const QPicture &QPictureIO::picture() const { return d->pi; }
-
-/*!
- Returns the picture's IO status. A non-zero value indicates an
- error, whereas 0 means that the IO operation was successful.
-
- \sa setStatus()
-*/
-int QPictureIO::status() const { return d->iostat; }
-
-/*!
- Returns the picture format string or \nullptr if no format has been
- explicitly set.
-*/
-const char *QPictureIO::format() const { return d->frmt; }
-
-/*!
- Returns the IO device currently set.
-
- \sa setIODevice()
-*/
-QIODevice *QPictureIO::ioDevice() const { return d->iodev; }
-
-/*!
- Returns the file name currently set.
-
- \sa setFileName()
-*/
-QString QPictureIO::fileName() const { return d->fname; }
-
-
-/*!
- Returns the picture description string.
-
- \sa setDescription()
-*/
-QString QPictureIO::description() const { return d->descr; }
-
-/*!
- Sets the picture to \a picture.
-
- \sa picture()
-*/
-void QPictureIO::setPicture(const QPicture &picture)
-{
- d->pi = picture;
-}
-
-/*!
- Sets the picture IO status to \a status. A non-zero value indicates
- an error, whereas 0 means that the IO operation was successful.
-
- \sa status()
-*/
-void QPictureIO::setStatus(int status)
-{
- d->iostat = status;
-}
-
-/*!
- Sets the picture format to \a format for the picture to be read or
- written.
-
- It is necessary to specify a format before writing an picture, but
- it is not necessary to specify a format before reading an picture.
-
- If no format has been set, Qt guesses the picture format before
- reading it. If a format is set the picture will only be read if it
- has that format.
-
- \sa read(), write(), format()
-*/
-void QPictureIO::setFormat(const char *format)
-{
- d->frmt = format;
-}
-
-/*!
- Sets the IO device to be used for reading or writing an picture.
-
- Setting the IO device allows pictures to be read/written to any
- block-oriented QIODevice.
-
- If \a ioDevice is not null, this IO device will override file name
- settings.
-
- \sa setFileName()
-*/
-void QPictureIO::setIODevice(QIODevice *ioDevice)
-{
- d->iodev = ioDevice;
-}
-
-/*!
- Sets the name of the file to read or write an picture from to \a
- fileName.
-
- \sa setIODevice()
-*/
-void QPictureIO::setFileName(const QString &fileName)
-{
- d->fname = fileName;
-}
-
-/*!
- Returns the quality of the written picture, related to the
- compression ratio.
-
- \sa setQuality(), QPicture::save()
-*/
-int QPictureIO::quality() const
-{
- return d->quality;
-}
-
-/*!
- Sets the quality of the written picture to \a q, related to the
- compression ratio.
-
- \a q must be in the range -1..100. Specify 0 to obtain small
- compressed files, 100 for large uncompressed files. (-1 signifies
- the default compression.)
-
- \sa quality(), QPicture::save()
-*/
-
-void QPictureIO::setQuality(int q)
-{
- d->quality = q;
-}
-
-/*!
- Returns the picture's parameters string.
-
- \sa setParameters()
-*/
-
-const char *QPictureIO::parameters() const
-{
- return d->parameters;
-}
-
-/*!
- Sets the picture's parameter string to \a parameters. This is for
- picture handlers that require special parameters.
-
- Although the current picture formats supported by Qt ignore the
- parameters string, it may be used in future extensions or by
- contributions (for example, JPEG).
-
- \sa parameters()
-*/
-
-void QPictureIO::setParameters(const char *parameters)
-{
- if (d->parameters)
- delete [] d->parameters;
- d->parameters = qstrdup(parameters);
-}
-
-/*!
- Sets the gamma value at which the picture will be viewed to \a
- gamma. If the picture format stores a gamma value for which the
- picture is intended to be used, then this setting will be used to
- modify the picture. Setting to 0.0 will disable gamma correction
- (i.e. any specification in the file will be ignored).
-
- The default value is 0.0.
-
- \sa gamma()
-*/
-void QPictureIO::setGamma(float gamma)
-{
- d->gamma=gamma;
-}
-
-/*!
- Returns the gamma value at which the picture will be viewed.
-
- \sa setGamma()
-*/
-float QPictureIO::gamma() const
-{
- return d->gamma;
-}
-
-/*!
- Sets the picture description string for picture handlers that support
- picture descriptions to \a description.
-
- Currently, no picture format supported by Qt uses the description
- string.
-*/
-
-void QPictureIO::setDescription(const QString &description)
-{
- d->descr = description;
-}
-
-
-/*!
- Returns a string that specifies the picture format of the file \a
- fileName, or null if the file cannot be read or if the format is
- not recognized.
-*/
-
-QByteArray QPictureIO::pictureFormat(const QString &fileName)
-{
- QFile file(fileName);
- QByteArray format;
- if (!file.open(QIODevice::ReadOnly))
- return format;
- format = pictureFormat(&file);
- file.close();
- return format;
-}
-
-/*!
- \overload
-
- Returns a string that specifies the picture format of the picture read
- from IO device \a d, or 0 if the device cannot be read or if the
- format is not recognized.
-
- Make sure that \a d is at the right position in the device (for
- example, at the beginning of the file).
-
- \sa QIODevice::pos()
-*/
-
-QByteArray QPictureIO::pictureFormat(QIODevice *d)
-{
- // if you change this change the documentation for defineIOHandler()
- const int buflen = 14;
-
- char buf[buflen];
- char buf2[buflen];
- qt_init_picture_handlers();
- qt_init_picture_plugins();
- int pos = d->pos(); // save position
- int rdlen = d->read(buf, buflen); // read a few bytes
-
- QByteArray format;
- if (rdlen != buflen)
- return format;
-
- memcpy(buf2, buf, buflen);
-
- for (int n = 0; n < rdlen; n++)
- if (buf[n] == '\0')
- buf[n] = '\001';
- if (rdlen > 0) {
- buf[rdlen - 1] = '\0';
- QString bufStr = QString::fromLatin1(buf);
- if (QPHList *list = pictureHandlers()) {
- for (int i = 0; i < list->size(); ++i) {
- if (list->at(i)->header.indexIn(bufStr) != -1) { // try match with headers
- format = list->at(i)->format;
- break;
- }
- }
- }
- }
- d->seek(pos); // restore position
- return format;
-}
-
-/*!
- Returns a sorted list of picture formats that are supported for
- picture input.
-*/
-QList<QByteArray> QPictureIO::inputFormats()
-{
- QList<QByteArray> result;
-
- qt_init_picture_handlers();
- qt_init_picture_plugins();
-
- if (QPHList *list = pictureHandlers()) {
- for (int i = 0; i < list->size(); ++i) {
- QPictureHandler *p = list->at(i);
- if (p->read_picture && !p->obsolete && !result.contains(p->format))
- result.append(p->format);
- }
- }
- std::sort(result.begin(), result.end());
-
- return result;
-}
-
-/*!
- Returns a sorted list of picture formats that are supported for
- picture output.
-*/
-QList<QByteArray> QPictureIO::outputFormats()
-{
- qt_init_picture_handlers();
- qt_init_picture_plugins();
-
- QList<QByteArray> result;
- if (QPHList *list = pictureHandlers()) {
- for (int i = 0; i < list->size(); ++i) {
- QPictureHandler *p = list->at(i);
- if (p->write_picture && !p->obsolete && !result.contains(p->format))
- result.append(p->format);
- }
- }
- return result;
-}
-
-
-
-/*!
- Reads an picture into memory and returns \c true if the picture was
- successfully read; otherwise returns \c false.
-
- Before reading an picture you must set an IO device or a file name.
- If both an IO device and a file name have been set, the IO device
- will be used.
-
- Setting the picture file format string is optional.
-
- Note that this function does \e not set the \l{format()}{format} used to read the picture. If you need that
- information, use the pictureFormat() static functions.
-
- Example:
-
- \snippet picture/picture.cpp 4
-
- \sa setIODevice(), setFileName(), setFormat(), write(), QPixmap::load()
-*/
-bool QPictureIO::read()
-{
- QFile file;
- QByteArray picture_format;
- QPictureHandler *h;
-
- if (d->iodev) { // read from io device
- // ok, already open
- } else if (!d->fname.isEmpty()) { // read from file
- file.setFileName(d->fname);
- if (!file.open(QIODevice::ReadOnly))
- return false; // cannot open file
- d->iodev = &file;
- } else { // no file name or io device
- return false;
- }
- if (d->frmt.isEmpty()) {
- // Try to guess format
- picture_format = pictureFormat(d->iodev); // get picture format
- if (picture_format.isEmpty()) {
- if (file.isOpen()) { // unknown format
- file.close();
- d->iodev = 0;
- }
- return false;
- }
- } else {
- picture_format = d->frmt;
- }
-
- h = get_picture_handler(picture_format);
- if (file.isOpen()) {
-#if !defined(Q_OS_UNIX)
- if (h && h->text_mode) { // reopen in translated mode
- file.close();
- file.open(QIODevice::ReadOnly | QIODevice::Text);
- }
- else
-#endif
- file.seek(0); // position to start
- }
- d->iostat = 1; // assume error
-
- if (h && h->read_picture)
- (*h->read_picture)(this);
-
- if (file.isOpen()) { // picture was read using file
- file.close();
- d->iodev = 0;
- }
- return d->iostat == 0; // picture successfully read?
-}
-
-
-/*!
- Writes an picture to an IO device and returns \c true if the picture was
- successfully written; otherwise returns \c false.
-
- Before writing an picture you must set an IO device or a file name.
- If both an IO device and a file name have been set, the IO device
- will be used.
-
- The picture will be written using the specified picture format.
-
- Example:
- \snippet picture/picture.cpp 5
-
- \sa setIODevice(), setFileName(), setFormat(), read(), QPixmap::save()
-*/
-bool QPictureIO::write()
-{
- if (d->frmt.isEmpty())
- return false;
- QPictureHandler *h = get_picture_handler(d->frmt);
- if (!h || !h->write_picture) {
- qWarning("QPictureIO::write: No such picture format handler: %s",
- format());
- return false;
- }
- QFile file;
- if (!d->iodev && !d->fname.isEmpty()) {
- file.setFileName(d->fname);
- bool translate = h->text_mode==QPictureHandler::TranslateInOut;
- QIODevice::OpenMode fmode = translate ? QIODevice::WriteOnly | QIODevice::Text : QIODevice::OpenMode(QIODevice::WriteOnly);
- if (!file.open(fmode)) // couldn't create file
- return false;
- d->iodev = &file;
- }
- d->iostat = 1;
- (*h->write_picture)(this);
- if (file.isOpen()) { // picture was written using file
- file.close();
- d->iodev = 0;
- }
- return d->iostat == 0; // picture successfully written?
-}
-#endif //QT_NO_PICTUREIO
-
QT_END_NAMESPACE
#endif // QT_NO_PICTURE
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index 189e57b9a3..34860985ed 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -48,7 +48,6 @@
QT_BEGIN_NAMESPACE
-
#ifndef QT_NO_PICTURE
class QPicturePrivate;
@@ -69,10 +68,10 @@ public:
bool play(QPainter *p);
- bool load(QIODevice *dev, const char *format = nullptr);
- bool load(const QString &fileName, const char *format = nullptr);
- bool save(QIODevice *dev, const char *format = nullptr);
- bool save(const QString &fileName, const char *format = nullptr);
+ bool load(QIODevice *dev);
+ bool load(const QString &fileName);
+ bool save(QIODevice *dev);
+ bool save(const QString &fileName);
QRect boundingRect() const;
void setBoundingRect(const QRect &r);
@@ -88,14 +87,6 @@ public:
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p);
-#if QT_DEPRECATED_SINCE(5, 10)
- static QT_DEPRECATED const char* pictureFormat(const QString &fileName);
- static QT_DEPRECATED QList<QByteArray> inputFormats();
- static QT_DEPRECATED QList<QByteArray> outputFormats();
- static QT_DEPRECATED QStringList inputFormatList();
- static QT_DEPRECATED QStringList outputFormatList();
-#endif // QT_DEPRECATED_SINCE(5, 10)
-
QPaintEngine *paintEngine() const override;
protected:
@@ -118,67 +109,6 @@ public:
Q_DECLARE_SHARED(QPicture)
-
-#ifndef QT_NO_PICTUREIO
-class QIODevice;
-class QPictureIO;
-typedef void (*picture_io_handler)(QPictureIO *); // picture IO handler
-
-struct QPictureIOData;
-
-class Q_GUI_EXPORT QPictureIO
-{
-public:
- QPictureIO();
- QPictureIO(QIODevice *ioDevice, const char *format);
- QPictureIO(const QString &fileName, const char *format);
- ~QPictureIO();
-
- const QPicture &picture() const;
- int status() const;
- const char *format() const;
- QIODevice *ioDevice() const;
- QString fileName() const;
- int quality() const;
- QString description() const;
- const char *parameters() const;
- float gamma() const;
-
- void setPicture(const QPicture &);
- void setStatus(int);
- void setFormat(const char *);
- void setIODevice(QIODevice *);
- void setFileName(const QString &);
- void setQuality(int);
- void setDescription(const QString &);
- void setParameters(const char *);
- void setGamma(float);
-
- bool read();
- bool write();
-
- static QByteArray pictureFormat(const QString &fileName);
- static QByteArray pictureFormat(QIODevice *);
- static QList<QByteArray> inputFormats();
- static QList<QByteArray> outputFormats();
-
- static void defineIOHandler(const char *format,
- const char *header,
- const char *flags,
- picture_io_handler read_picture,
- picture_io_handler write_picture);
-
-private:
- Q_DISABLE_COPY(QPictureIO)
-
- void init();
-
- QPictureIOData *d;
-};
-
-#endif //QT_NO_PICTUREIO
-
-
/*****************************************************************************
QPicture stream functions
*****************************************************************************/
diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp
deleted file mode 100644
index ef57ad720f..0000000000
--- a/src/gui/image/qpictureformatplugin.cpp
+++ /dev/null
@@ -1,135 +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 "qpictureformatplugin.h"
-#if !defined(QT_NO_PICTURE)
-#include "qpicture.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \obsolete
-
- \class QPictureFormatPlugin
- \brief The QPictureFormatPlugin class provides an abstract base
- for custom picture format plugins.
-
- \ingroup plugins
- \inmodule QtGui
-
- The picture format plugin is a simple plugin interface that makes
- it easy to create custom picture formats that can be used
- transparently by applications.
-
- Writing an picture format plugin is achieved by subclassing this
- base class, reimplementing the pure virtual functions
- loadPicture(), savePicture(), and installIOHandler(), and
- exporting the class with the Q_PLUGIN_METADATA() macro.
-
- The json file containing the metadata should contain one entry
- with the list of picture formats supported by the plugin:
-
- \code
- { "Keys": [ "mypictureformat" ] }
- \endcode
-
- \sa {How to Create Qt Plugins}
-*/
-
-/*!
- \fn bool QPictureFormatPlugin::installIOHandler(const QString &format)
-
- Installs a QPictureIO picture I/O handler for the picture format \a
- format. Returns \c true on success.
-*/
-
-
-/*!
- Constructs an picture format plugin with the given \a parent.
- This is invoked automatically by the moc generated code that exports the plugin.
-*/
-QPictureFormatPlugin::QPictureFormatPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the picture format plugin.
-
- You never have to call this explicitly. Qt destroys a plugin
- automatically when it is no longer used.
-*/
-QPictureFormatPlugin::~QPictureFormatPlugin()
-{
-}
-
-
-/*!
- Loads the picture stored in the file called \a fileName, with the
- given \a format, into *\a picture. Returns \c true on success;
- otherwise returns \c false.
-
- \sa savePicture()
-*/
-bool QPictureFormatPlugin::loadPicture(const QString &format, const QString &fileName, QPicture *picture)
-{
- Q_UNUSED(format)
- Q_UNUSED(fileName)
- Q_UNUSED(picture)
- return false;
-}
-
-/*!
- Saves the given \a picture into the file called \a fileName,
- using the specified \a format. Returns \c true on success; otherwise
- returns \c false.
-
- \sa loadPicture()
-*/
-bool QPictureFormatPlugin::savePicture(const QString &format, const QString &fileName, const QPicture &picture)
-{
- Q_UNUSED(format)
- Q_UNUSED(fileName)
- Q_UNUSED(picture)
- return false;
-}
-
-#endif // QT_NO_PICTURE
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
deleted file mode 100644
index 3f59c04d79..0000000000
--- a/src/gui/image/qpictureformatplugin.h
+++ /dev/null
@@ -1,76 +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$
-**
-****************************************************************************/
-
-#ifndef QPICTUREFORMATPLUGIN_H
-#define QPICTUREFORMATPLUGIN_H
-
-#include <QtGui/qtguiglobal.h>
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-QT_BEGIN_NAMESPACE
-
-
-#if !defined(QT_NO_PICTURE)
-
-class QPicture;
-class QImage;
-class QString;
-class QStringList;
-
-#define QPictureFormatInterface_iid "org.qt-project.Qt.QPictureFormatInterface"
-
-class Q_GUI_EXPORT QPictureFormatPlugin : public QObject
-{
- Q_OBJECT
-public:
- explicit QPictureFormatPlugin(QObject *parent = nullptr);
- ~QPictureFormatPlugin();
-
- virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic);
- virtual bool savePicture(const QString &format, const QString &filename, const QPicture &pic);
- virtual bool installIOHandler(const QString &format) = 0;
-
-};
-
-#endif // QT_NO_PICTURE
-
-QT_END_NAMESPACE
-
-#endif // QPICTUREFORMATPLUGIN_H
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index a9ee25da75..f1c6e6df5c 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -53,8 +53,6 @@ QT_REQUIRE_CONFIG(standarditemmodel);
QT_BEGIN_NAMESPACE
-template <class T> class QList;
-
class QStandardItemModel;
class QStandardItemPrivate;
@@ -344,8 +342,11 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- // Qt 6: add override keyword
- bool clearItemData(const QModelIndex &index);
+ bool clearItemData(const QModelIndex &index)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ override
+#endif
+ ;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 9c80f1e2cc..237a1c0a3f 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -48,11 +48,8 @@ HEADERS += \
kernel/qinputmethod.h \
kernel/qinputmethod_p.h \
kernel/qinternalmimedata_p.h \
- kernel/qkeysequence.h \
- kernel/qkeysequence_p.h \
kernel/qkeymapper_p.h \
kernel/qpalette.h \
- kernel/qshortcutmap_p.h \
kernel/qsessionmanager.h \
kernel/qsessionmanager_p.h \
kernel/qwindowdefs.h \
@@ -108,12 +105,10 @@ SOURCES += \
kernel/qevent.cpp \
kernel/qinputmethod.cpp \
kernel/qinternalmimedata.cpp \
- kernel/qkeysequence.cpp \
kernel/qkeymapper.cpp \
kernel/qpalette.cpp \
kernel/qguivariant.cpp \
kernel/qscreen.cpp \
- kernel/qshortcutmap.cpp \
kernel/qstylehints.cpp \
kernel/qtouchdevice.cpp \
kernel/qplatformsharedgraphicscache.cpp \
@@ -160,4 +155,14 @@ qtConfig(opengl) {
kernel/qopenglwindow.cpp
}
+qtConfig(shortcut) {
+ HEADERS += \
+ kernel/qshortcutmap_p.h \
+ kernel/qkeysequence.h \
+ kernel/qkeysequence_p.h
+ SOURCES += \
+ kernel/qshortcutmap.cpp \
+ kernel/qkeysequence.cpp
+}
+
win32:HEADERS+=kernel/qwindowdefs_win.h
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 2b28052dd5..54502bc6a3 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1224,7 +1224,7 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
return QInputEvent::modifiers();
}
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
/*!
\fn bool QKeyEvent::matches(QKeySequence::StandardKey key) const
\since 4.2
@@ -1240,7 +1240,7 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey);
return bindings.contains(QKeySequence(searchkey));
}
-#endif // QT_NO_SHORTCUT
+#endif // QT_CONFIG(shortcut)
/*!
@@ -2695,10 +2695,6 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
{ }
#endif
-typedef QHash<const QNativeGestureEvent*, const QTouchDevice*> NativeGestureEventDataHash;
-// ### Qt6: move this to a member in QNativeGestureEvent
-Q_GLOBAL_STATIC(NativeGestureEventDataHash, g_nativeGestureEventDataHash)
-
/*!
Constructs a native gesture event of type \a type originating from \a device.
@@ -2713,27 +2709,20 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouc
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
- mSequenceId(sequenceId), mIntValue(intValue)
+ mSequenceId(sequenceId), mIntValue(intValue), mDevice(device)
{
- g_nativeGestureEventDataHash->insert(this, device);
}
QNativeGestureEvent::~QNativeGestureEvent()
-{
- g_nativeGestureEventDataHash->remove(this);
-}
+ = default;
/*!
+ \fn const QTouchDevice *QNativeGestureEvent::device() const
\since 5.10
Returns the device.
*/
-const QTouchDevice *QNativeGestureEvent::device() const
-{
- return g_nativeGestureEventDataHash->value(this);
-}
-
/*!
\fn QNativeGestureEvent::gestureType() const
\since 5.2
@@ -3592,7 +3581,7 @@ QToolBarChangeEvent::~QToolBarChangeEvent()
#endif // QT_NO_TOOLBAR
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
/*!
Constructs a shortcut event for the given \a key press,
@@ -3613,7 +3602,7 @@ QShortcutEvent::~QShortcutEvent()
{
}
-#endif // QT_NO_SHORTCUT
+#endif // QT_CONFIG(shortcut)
#ifndef QT_NO_DEBUG_STREAM
@@ -3967,7 +3956,7 @@ QT_WARNING_POP
dbg << ')';
}
break;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
case QEvent::Shortcut: {
const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index dc33a83ac0..28aa78a420 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -45,7 +45,9 @@
#include <QtGui/qregion.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstring.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#include <QtCore/qcoreevent.h>
#include <QtCore/qvariant.h>
#include <QtCore/qmap.h> // ### Qt 6: Remove
@@ -350,7 +352,7 @@ public:
const QPointF &windowPos() const { return mWindowPos; }
const QPointF &screenPos() const { return mScreenPos; }
- const QTouchDevice *device() const;
+ const QTouchDevice *device() const { return mDevice; }
protected:
Qt::NativeGestureType mGestureType;
@@ -360,6 +362,7 @@ protected:
qreal mRealValue;
ulong mSequenceId;
quint64 mIntValue;
+ const QTouchDevice *mDevice;
};
#endif // QT_NO_GESTURES
@@ -374,7 +377,7 @@ public:
~QKeyEvent();
int key() const { return k; }
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
bool matches(QKeySequence::StandardKey key) const;
#endif
Qt::KeyboardModifiers modifiers() const;
@@ -791,7 +794,7 @@ private:
};
#endif
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
class Q_GUI_EXPORT QShortcutEvent : public QEvent
{
public:
@@ -826,10 +829,10 @@ private:
Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
#endif
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
-#endif // QT_NO_SHORTCUT
+#endif // QT_CONFIG(shortcut)
class Q_GUI_EXPORT QPointingDeviceUniqueId
{
@@ -853,7 +856,6 @@ private:
qint64 m_numericId;
};
Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE);
-template <> class QList<QPointingDeviceUniqueId> {}; // to prevent instantiation: use QVector instead
Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept;
inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index f09f7e941b..f4a5c0e104 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1184,14 +1184,18 @@ Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
{
- QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'));
+ QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), QString::SkipEmptyParts);
QStringList platformArguments;
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
for (const auto &pluginArgument : plugins) {
// Split into platform name and arguments
- QStringList arguments = pluginArgument.split(QLatin1Char(':'));
+ QStringList arguments = pluginArgument.split(QLatin1Char(':'), QString::SkipEmptyParts);
+ if (arguments.isEmpty())
+ continue;
const QString name = arguments.takeFirst().toLower();
QString argumentsKey = name;
+ if (name.isEmpty())
+ continue;
argumentsKey[0] = argumentsKey.at(0).toUpper();
arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 26f65b2f16..56a3be1122 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -62,7 +62,10 @@
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qwindowsysteminterface_p.h>
-#include "private/qshortcutmap_p.h"
+#if QT_CONFIG(shortcut)
+# include "private/qshortcutmap_p.h"
+#endif
+
#include <qicon.h>
QT_BEGIN_NAMESPACE
@@ -263,7 +266,7 @@ public:
QIcon forcedWindowIcon;
static QList<QObject *> generic_plugin_list;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
QShortcutMap shortcutMap;
#endif
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index edca8d9423..2d6d12cc21 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -44,7 +44,9 @@
#include "qcursor.h"
#include "qfont.h"
#include "qimage.h"
-#include "qkeysequence.h"
+#if QT_CONFIG(shortcut)
+# include "qkeysequence.h"
+#endif
#include "qtransform.h"
#include "qmatrix.h"
#include "qpalette.h"
@@ -188,7 +190,7 @@ static bool convert(const QVariant::Private *d, int t,
case QVariant::String: {
QString *str = static_cast<QString *>(result);
switch (d->type) {
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
case QVariant::KeySequence:
*str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText);
return true;
@@ -238,7 +240,7 @@ static bool convert(const QVariant::Private *d, int t,
return true;
}
break;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
case QVariant::Int:
if (d->type == QVariant::KeySequence) {
const QKeySequence &seq = *v_cast<QKeySequence>(d);
@@ -277,7 +279,7 @@ static bool convert(const QVariant::Private *d, int t,
return true;
}
break;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
case QVariant::KeySequence: {
QKeySequence *seq = static_cast<QKeySequence *>(result);
switch (d->type) {
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 8364557020..fd53747fdd 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -53,7 +53,6 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <qobject.h>
#include <private/qobject_p.h>
-#include <qkeysequence.h>
#include <qlist.h>
#include <qlocale.h>
#include <qevent.h>
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index e1244e1006..d5bdf1f15b 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -42,8 +42,6 @@
#include <qpa/qplatformtheme.h>
#include "private/qguiapplication_p.h"
-#if !defined(QT_NO_SHORTCUT) || defined(Q_CLANG_QDOC)
-
#include "qdebug.h"
#include <QtCore/qhashfunctions.h>
#ifndef QT_NO_DATASTREAM
@@ -1679,9 +1677,6 @@ QDebug operator<<(QDebug dbg, const QKeySequence &p)
}
#endif
-#endif // QT_NO_SHORTCUT
-
-
/*!
\typedef QKeySequence::DataPtr
\internal
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 3dcbbe5941..68f256c37a 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -44,10 +44,9 @@
#include <QtCore/qstring.h>
#include <QtCore/qobjectdefs.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(shortcut);
-#if !defined(QT_NO_SHORTCUT) || defined(Q_CLANG_QDOC)
+QT_BEGIN_NAMESPACE
class QKeySequence;
@@ -227,17 +226,6 @@ Q_DECLARE_SHARED(QKeySequence)
Q_GUI_EXPORT QDebug operator<<(QDebug, const QKeySequence &);
#endif
-#else
-
-class Q_GUI_EXPORT QKeySequence
-{
-public:
- QKeySequence() {}
- QKeySequence(int) {}
-};
-
-#endif // QT_NO_SHORTCUT
-
QT_END_NAMESPACE
#endif // QKEYSEQUENCE_H
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index fbcab5d34e..8c59505561 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -56,9 +56,10 @@
#include <algorithm>
+QT_REQUIRE_CONFIG(shortcut);
+
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_SHORTCUT
struct QKeyBinding
{
QKeySequence::StandardKey standardKey;
@@ -87,7 +88,6 @@ public:
Q_GUI_EXPORT static QString keyName(int key, QKeySequence::SequenceFormat format);
static int decodeString(QString accel, QKeySequence::SequenceFormat format);
};
-#endif // QT_NO_SHORTCUT
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 28c29a704c..8e470aefd3 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -52,7 +52,9 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qpointer.h>
#include <QtGui/QFont>
-#include <QtGui/QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QtGui/QKeySequence>
+#endif
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
@@ -85,7 +87,7 @@ public:
virtual void setRole(MenuRole role) = 0;
virtual void setCheckable(bool checkable) = 0;
virtual void setChecked(bool isChecked) = 0;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
virtual void setShortcut(const QKeySequence& shortcut) = 0;
#endif
virtual void setEnabled(bool enabled) = 0;
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index f906f808d8..ff6f32de10 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE
*/
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
// Table of key bindings. It must be sorted on key sequence:
// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.)
// A priority of 1 indicates that this is the primary key binding when multiple are defined.
@@ -623,7 +623,7 @@ static inline int maybeSwapShortcut(int shortcut)
}
#endif
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey {
typedef bool result_type;
@@ -688,6 +688,7 @@ QString QPlatformTheme::standardButtonText(int button) const
return QPlatformTheme::defaultStandardButtonText(button);
}
+#if QT_CONFIG(shortcut)
/*!
Returns the mnemonic that should be used for a standard \a button.
@@ -700,6 +701,7 @@ QKeySequence QPlatformTheme::standardButtonShortcut(int button) const
Q_UNUSED(button)
return QKeySequence();
}
+#endif // QT_CONFIG(shortcut)
QString QPlatformTheme::defaultStandardButtonText(int button)
{
@@ -784,7 +786,7 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
{
const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt();
unsigned result = 1u << keyboardScheme;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 356c4ea3ea..7b88af954c 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -51,7 +51,9 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/QScopedPointer>
-#include <QtGui/QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QtGui/QKeySequence>
+#endif
QT_BEGIN_NAMESPACE
@@ -312,12 +314,14 @@ public:
QPlatformTheme::IconOptions iconOptions = nullptr) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
#endif
virtual QString standardButtonText(int button) const;
+#if QT_CONFIG(shortcut)
virtual QKeySequence standardButtonShortcut(int button) const;
+#endif
static QVariant defaultThemeHint(ThemeHint hint);
static QString defaultStandardButtonText(int button);
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index 73deb890bb..2c16fec141 100644
--- a/src/gui/kernel/qplatformtheme_p.h
+++ b/src/gui/kernel/qplatformtheme_p.h
@@ -52,7 +52,9 @@
//
#include <QtGui/private/qtguiglobal_p.h>
-#include "private/qkeysequence_p.h"
+#if QT_CONFIG(shortcut)
+# include "private/qkeysequence_p.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -67,7 +69,7 @@ public:
void initializeSystemPalette();
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings;
#endif
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 0395c1db38..b5cd342138 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -48,8 +48,6 @@
#include <algorithm>
-#ifndef QT_NO_SHORTCUT
-
QT_BEGIN_NAMESPACE
// To enable verbose output uncomment below
@@ -714,5 +712,3 @@ void QShortcutMap::dumpMap() const
#endif
QT_END_NAMESPACE
-
-#endif // QT_NO_SHORTCUT
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index 8fc68229fb..aa3dd969f0 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -56,9 +56,9 @@
#include "QtCore/qvector.h"
#include "QtCore/qscopedpointer.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(shortcut);
-#ifndef QT_NO_SHORTCUT
+QT_BEGIN_NAMESPACE
// To enable dump output uncomment below
//#define Dump_QShortcutMap
@@ -106,8 +106,6 @@ private:
QScopedPointer<QShortcutMapPrivate> d_ptr;
};
-#endif // QT_NO_SHORTCUT
-
QT_END_NAMESPACE
#endif // QSHORTCUTMAP_P_H
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index b4f3ed4712..cb0842da8c 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -43,6 +43,7 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qnamespace.h>
+#include <QtCore/qcontainerfwd.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +81,6 @@ class QString;
class QByteArray;
class QApplication;
-template<typename T> class QList;
typedef QList<QWidget *> QWidgetList;
typedef QList<QWindow *> QWindowList;
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 4f1056e906..71780ed609 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -440,7 +440,7 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong t
bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorepeat, ushort count)
{
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
if (!window)
window = QGuiApplication::focusWindow();
@@ -1244,7 +1244,7 @@ Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
{
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
// FIXME: This method should not allow targeting a specific object, but should
// instead forward the event to a window, which then takes care of normal event
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 61a6202017..ed58766dde 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -4612,7 +4612,7 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire
\note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa borderColor()
*/
-void QOpenGLTexture::setBorderColor(QColor color)
+void QOpenGLTexture::setBorderColor(const QColor &color)
{
setBorderColor(static_cast<float>(color.redF()), static_cast<float>(color.greenF()),
static_cast<float>(color.blueF()), static_cast<float>(color.alphaF()));
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index 7d984babc8..539b6aa7b2 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -621,7 +621,7 @@ public:
void setWrapMode(CoordinateDirection direction, WrapMode mode);
WrapMode wrapMode(CoordinateDirection direction) const;
- void setBorderColor(QColor color);
+ void setBorderColor(const QColor &color);
void setBorderColor(float r, float g, float b, float a);
void setBorderColor(int r, int g, int b, int a);
void setBorderColor(uint r, uint g, uint b, uint a);
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 80b092f177..63e6b48e4f 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE
class QStringList;
-template <class T> class QList;
struct QFontDef;
class QFontEngine;
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index 8b57278633..a90d73dc43 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -48,8 +48,6 @@
QT_BEGIN_NAMESPACE
-
-template <typename T> class QList;
struct QTextOptionPrivate;
class Q_GUI_EXPORT QTextOption
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index cfb20dcd71..083fbbf5fd 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -114,11 +114,4 @@ qtConfig(http) {
access/qhttpthreaddelegate_p.h \
access/qnetworkreplyhttpimpl_p.h \
access/qhttp2configuration.h
-
- qtConfig(ssl) {
- SOURCES += \
- access/qspdyprotocolhandler.cpp
- HEADERS += \
- access/qspdyprotocolhandler_p.h
- }
}
diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h
index e357dfe58f..a4048c5b8f 100644
--- a/src/network/access/qabstractnetworkcache.h
+++ b/src/network/access/qabstractnetworkcache.h
@@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
class QIODevice;
class QDateTime;
class QUrl;
-template<class T> class QList;
class QNetworkCacheMetaDataPrivate;
class Q_NETWORK_EXPORT QNetworkCacheMetaData
diff --git a/src/network/access/qhsts_p.h b/src/network/access/qhsts_p.h
index c219d9eab5..b5be4ff455 100644
--- a/src/network/access/qhsts_p.h
+++ b/src/network/access/qhsts_p.h
@@ -66,7 +66,6 @@
QT_BEGIN_NAMESPACE
-template<typename T> class QList;
template <typename T> class QVector;
class Q_AUTOTEST_EXPORT QHstsCache
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index dce51d4fd5..efbeb17d39 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -332,13 +332,13 @@ bool QHttp2ProtocolHandler::sendRequest()
// so we cannot create new streams.
m_channel->emitFinishedWithError(QNetworkReply::ProtocolUnknownError,
"GOAWAY received, cannot start a request");
- m_channel->spdyRequestsToSend.clear();
+ m_channel->h2RequestsToSend.clear();
return false;
}
// Process 'fake' (created by QNetworkAccessManager::connectToHostEncrypted())
// requests first:
- auto &requests = m_channel->spdyRequestsToSend;
+ auto &requests = m_channel->h2RequestsToSend;
for (auto it = requests.begin(), endIt = requests.end(); it != endIt;) {
const auto &pair = *it;
const QString scheme(pair.first.url().scheme());
@@ -862,7 +862,7 @@ void QHttp2ProtocolHandler::handleGOAWAY()
m_channel->emitFinishedWithError(QNetworkReply::ProtocolUnknownError,
"GOAWAY received, cannot start a request");
// Also, prevent further calls to sendRequest:
- m_channel->spdyRequestsToSend.clear();
+ m_channel->h2RequestsToSend.clear();
QNetworkReply::NetworkError error = QNetworkReply::NoError;
QString message;
@@ -1281,7 +1281,7 @@ quint32 QHttp2ProtocolHandler::createNewStream(const HttpMessagePair &message, b
const auto replyPrivate = reply->d_func();
replyPrivate->connection = m_connection;
replyPrivate->connectionChannel = m_channel;
- reply->setSpdyWasUsed(true);
+ reply->setHttp2WasUsed(true);
streamIDs.insert(reply, newStreamID);
connect(reply, SIGNAL(destroyed(QObject*)),
this, SLOT(_q_replyDestroyed(QObject*)));
@@ -1387,7 +1387,7 @@ void QHttp2ProtocolHandler::deleteActiveStream(quint32 streamID)
}
removeFromSuspended(streamID);
- if (m_channel->spdyRequestsToSend.size())
+ if (m_channel->h2RequestsToSend.size())
QMetaObject::invokeMethod(this, "sendRequest", Qt::QueuedConnection);
}
@@ -1506,7 +1506,7 @@ void QHttp2ProtocolHandler::initReplyFromPushPromise(const HttpMessagePair &mess
Q_ASSERT(promisedData.contains(cacheKey));
auto promise = promisedData.take(cacheKey);
Q_ASSERT(message.second);
- message.second->setSpdyWasUsed(true);
+ message.second->setHttp2WasUsed(true);
qCDebug(QT_HTTP2) << "found cached/promised response on stream" << promise.reservedID;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 21c6359807..795efc91d7 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -82,9 +82,6 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true)
, activeChannelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2
|| type == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
-#ifndef QT_NO_SSL
- || type == QHttpNetworkConnection::ConnectionTypeSPDY
-#endif
? 1 : defaultHttpChannelCount)
, channelCount(defaultHttpChannelCount)
#ifndef QT_NO_NETWORKPROXY
@@ -93,9 +90,9 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
, preConnectRequests(0)
, connectionType(type)
{
- // We allocate all 6 channels even if it's SPDY or HTTP/2 enabled
- // connection: in case the protocol negotiation via NPN/ALPN fails,
- // we will have normally working HTTP/1.1.
+ // We allocate all 6 channels even if it's HTTP/2 enabled connection:
+ // in case the protocol negotiation via NPN/ALPN fails, we will have
+ // normally working HTTP/1.1.
Q_ASSERT(channelCount >= activeChannelCount);
channels = new QHttpNetworkConnectionChannel[channelCount];
}
@@ -641,10 +638,10 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
break;
}
}
- else { // SPDY, HTTP/2 ('h2' mode)
+ else { // HTTP/2 ('h2' mode)
if (!pair.second->d_func()->requestIsPrepared)
prepareRequest(pair);
- channels[0].spdyRequestsToSend.insert(request.priority(), pair);
+ channels[0].h2RequestsToSend.insert(request.priority(), pair);
}
#ifndef Q_OS_WINRT
@@ -680,7 +677,7 @@ void QHttpNetworkConnectionPrivate::fillHttp2Queue()
for (auto &pair : highPriorityQueue) {
if (!pair.second->d_func()->requestIsPrepared)
prepareRequest(pair);
- channels[0].spdyRequestsToSend.insert(QHttpNetworkRequest::HighPriority, pair);
+ channels[0].h2RequestsToSend.insert(QHttpNetworkRequest::HighPriority, pair);
}
highPriorityQueue.clear();
@@ -688,7 +685,7 @@ void QHttpNetworkConnectionPrivate::fillHttp2Queue()
for (auto &pair : lowPriorityQueue) {
if (!pair.second->d_func()->requestIsPrepared)
prepareRequest(pair);
- channels[0].spdyRequestsToSend.insert(pair.first.priority(), pair);
+ channels[0].h2RequestsToSend.insert(pair.first.priority(), pair);
}
lowPriorityQueue.clear();
@@ -984,12 +981,12 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply)
}
}
#ifndef QT_NO_SSL
- // is the reply inside the SPDY pipeline of this channel already?
- QMultiMap<int, HttpMessagePair>::iterator it = channels[i].spdyRequestsToSend.begin();
- QMultiMap<int, HttpMessagePair>::iterator end = channels[i].spdyRequestsToSend.end();
+ // is the reply inside the H2 pipeline of this channel already?
+ QMultiMap<int, HttpMessagePair>::iterator it = channels[i].h2RequestsToSend.begin();
+ QMultiMap<int, HttpMessagePair>::iterator end = channels[i].h2RequestsToSend.end();
for (; it != end; ++it) {
if (it.value().second == reply) {
- channels[i].spdyRequestsToSend.remove(it.key());
+ channels[i].h2RequestsToSend.remove(it.key());
QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
return;
@@ -1068,9 +1065,8 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
break;
}
case QHttpNetworkConnection::ConnectionTypeHTTP2Direct:
- case QHttpNetworkConnection::ConnectionTypeHTTP2:
- case QHttpNetworkConnection::ConnectionTypeSPDY: {
- if (channels[0].spdyRequestsToSend.isEmpty() && channels[0].switchedToHttp2)
+ case QHttpNetworkConnection::ConnectionTypeHTTP2: {
+ if (channels[0].h2RequestsToSend.isEmpty() && channels[0].switchedToHttp2)
return;
if (networkLayerState == IPv4)
@@ -1079,7 +1075,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
channels[0].ensureConnection();
if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
- && !channels[0].pendingEncrypt && channels[0].spdyRequestsToSend.size())
+ && !channels[0].pendingEncrypt && channels[0].h2RequestsToSend.size())
channels[0].sendRequest();
break;
}
@@ -1234,19 +1230,18 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(const QHostInfo &info)
if (dequeueRequest(channels[0].socket)) {
emitReplyError(channels[0].socket, channels[0].reply, QNetworkReply::HostNotFoundError);
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
- } else if (connectionType == QHttpNetworkConnection::ConnectionTypeSPDY
- || connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
+ } else if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
|| connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
- for (const HttpMessagePair &spdyPair : qAsConst(channels[0].spdyRequestsToSend)) {
+ for (const HttpMessagePair &h2Pair : qAsConst(channels[0].h2RequestsToSend)) {
// emit error for all replies
- QHttpNetworkReply *currentReply = spdyPair.second;
+ QHttpNetworkReply *currentReply = h2Pair.second;
Q_ASSERT(currentReply);
emitReplyError(channels[0].socket, currentReply, QNetworkReply::HostNotFoundError);
}
} else {
// Should not happen: we start a host lookup before sending a request,
- // so it's natural to have requests either in SPDY/HTTP/2 queue,
- // or in low/high priority queues.
+ // so it's natural to have requests either in HTTP/2 queue, or in low/high
+ // priority queues.
qWarning("QHttpNetworkConnectionPrivate::_q_hostLookupFinished"
" could not de-queue request, failed to report HostNotFoundError");
networkLayerState = QHttpNetworkConnectionPrivate::Unknown;
@@ -1576,17 +1571,12 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
pauseConnection();
QHttpNetworkReply *reply;
if (connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2
- || connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
-#if QT_CONFIG(ssl)
- || connectionType == QHttpNetworkConnection::ConnectionTypeSPDY
-#endif
- ) {
-
+ || connectionType == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
// we choose the reply to emit the proxyAuth signal from somewhat arbitrarily,
// but that does not matter because the signal will ultimately be emitted
// by the QNetworkAccessManager.
- Q_ASSERT(chan->spdyRequestsToSend.count() > 0);
- reply = chan->spdyRequestsToSend.cbegin().value().second;
+ Q_ASSERT(chan->h2RequestsToSend.count() > 0);
+ reply = chan->h2RequestsToSend.cbegin().value().second;
} else { // HTTP
reply = chan->reply;
}
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 6808a0c0ac..fee84bb6c0 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -96,7 +96,6 @@ public:
enum ConnectionType {
ConnectionTypeHTTP,
- ConnectionTypeSPDY,
ConnectionTypeHTTP2,
ConnectionTypeHTTP2Direct
};
@@ -172,7 +171,6 @@ private:
friend class QHttpNetworkConnectionChannel;
friend class QHttp2ProtocolHandler;
friend class QHttpProtocolHandler;
- friend class QSpdyProtocolHandler;
Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
Q_PRIVATE_SLOT(d_func(), void _q_hostLookupFinished(QHostInfo))
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 39f392a79b..c6470622ab 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -48,7 +48,6 @@
#include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h>
-#include <private/qspdyprotocolhandler_p.h>
#include <private/http2protocol_p.h>
#ifndef QT_NO_SSL
@@ -931,7 +930,7 @@ void QHttpNetworkConnectionChannel::_q_connected()
} else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
state = QHttpNetworkConnectionChannel::IdleState;
protocolHandler.reset(new QHttp2ProtocolHandler(this));
- if (spdyRequestsToSend.count() > 0) {
+ if (h2RequestsToSend.count() > 0) {
// In case our peer has sent us its settings (window size, max concurrent streams etc.)
// let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
@@ -1108,15 +1107,11 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
|| !connection->d_func()->lowPriorityQueue.isEmpty());
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
- || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
-#ifndef QT_NO_SSL
- || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY
-#endif
- ) {
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
+ QList<HttpMessagePair> h2Pairs = h2RequestsToSend.values();
+ for (int a = 0; a < h2Pairs.count(); ++a) {
// emit error for all replies
- QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ QHttpNetworkReply *currentReply = h2Pairs.at(a).second;
Q_ASSERT(currentReply);
emit currentReply->finishedWithError(errorCode, errorString);
}
@@ -1143,12 +1138,8 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth)
{
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
- || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
-#ifndef QT_NO_SSL
- || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY
-#endif
- ) {
- if (spdyRequestsToSend.count() > 0)
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
+ if (h2RequestsToSend.count() > 0)
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
} else { // HTTP
// Need to dequeue the request before we can emit the error.
@@ -1171,9 +1162,9 @@ void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::Network
{
if (reply)
emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
- QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ QList<HttpMessagePair> h2Pairs = h2RequestsToSend.values();
+ for (int a = 0; a < h2Pairs.count(); ++a) {
+ QHttpNetworkReply *currentReply = h2Pairs.at(a).second;
Q_ASSERT(currentReply);
emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
}
@@ -1195,12 +1186,6 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol();
if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) {
// fall through to create a QHttpProtocolHandler
- } else if (nextProtocol == QSslConfiguration::NextProtocolSpdy3_0) {
- protocolHandler.reset(new QSpdyProtocolHandler(this));
- connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeSPDY);
- // no need to re-queue requests, if SPDY was enabled on the request it
- // has gone to the SPDY queue already
- break;
} else if (nextProtocol == QSslConfiguration::ALPNProtocolHTTP2) {
switchedToHttp2 = true;
protocolHandler.reset(new QHttp2ProtocolHandler(this));
@@ -1229,8 +1214,6 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
// it again on other channels that our connection can create/open.
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2)
protocols.removeAll(QSslConfiguration::ALPNProtocolHTTP2);
- else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY)
- protocols.removeAll(QSslConfiguration::NextProtocolSpdy3_0);
if (nProtocols > protocols.size()) {
sslConfiguration->setAllowedNextProtocols(protocols);
@@ -1240,13 +1223,13 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
}
connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP);
- // We use only one channel for SPDY or HTTP/2, but normally six for
+ // We use only one channel for HTTP/2, but normally six for
// HTTP/1.1 - let's restore this number to the reserved number of
// channels:
if (connection->d_func()->activeChannelCount < connection->d_func()->channelCount) {
connection->d_func()->activeChannelCount = connection->d_func()->channelCount;
- // re-queue requests from SPDY queue to HTTP queue, if any
- requeueSpdyRequests();
+ // re-queue requests from HTTP/2 queue to HTTP queue, if any
+ requeueHttp2Requests();
}
break;
}
@@ -1266,11 +1249,9 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
state = QHttpNetworkConnectionChannel::IdleState;
pendingEncrypt = false;
- if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY ||
- connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 ||
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 ||
connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
- // we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent
- if (spdyRequestsToSend.count() > 0) {
+ if (h2RequestsToSend.count() > 0) {
// In case our peer has sent us its settings (window size, max concurrent streams etc.)
// let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
@@ -1279,7 +1260,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
if (!reply)
connection->d_func()->dequeueRequest(socket);
if (reply) {
- reply->setSpdyWasUsed(false);
+ reply->setHttp2WasUsed(false);
Q_ASSERT(reply->d_func()->connectionChannel == this);
emit reply->encrypted();
}
@@ -1288,13 +1269,12 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
}
}
-void QHttpNetworkConnectionChannel::requeueSpdyRequests()
+void QHttpNetworkConnectionChannel::requeueHttp2Requests()
{
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
- connection->d_func()->requeueRequest(spdyPairs.at(a));
- }
- spdyRequestsToSend.clear();
+ QList<HttpMessagePair> h2Pairs = h2RequestsToSend.values();
+ for (int a = 0; a < h2Pairs.count(); ++a)
+ connection->d_func()->requeueRequest(h2Pairs.at(a));
+ h2RequestsToSend.clear();
}
void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
@@ -1312,11 +1292,11 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
emit reply->sslErrors(errors);
}
#ifndef QT_NO_SSL
- else { // SPDY
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
+ else { // HTTP/2
+ QList<HttpMessagePair> h2Pairs = h2RequestsToSend.values();
+ for (int a = 0; a < h2Pairs.count(); ++a) {
// emit SSL errors for all replies
- QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ QHttpNetworkReply *currentReply = h2Pairs.at(a).second;
Q_ASSERT(currentReply);
emit currentReply->sslErrors(errors);
}
@@ -1336,10 +1316,10 @@ void QHttpNetworkConnectionChannel::_q_preSharedKeyAuthenticationRequired(QSslPr
if (reply)
emit reply->preSharedKeyAuthenticationRequired(authenticator);
} else {
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
+ QList<HttpMessagePair> h2Pairs = h2RequestsToSend.values();
+ for (int a = 0; a < h2Pairs.count(); ++a) {
// emit SSL errors for all replies
- QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ QHttpNetworkReply *currentReply = h2Pairs.at(a).second;
Q_ASSERT(currentReply);
emit currentReply->preSharedKeyAuthenticationRequired(authenticator);
}
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 270b3eb9ba..44ad2d7959 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -123,10 +123,7 @@ public:
bool authenticationCredentialsSent;
bool proxyCredentialsSent;
QScopedPointer<QAbstractProtocolHandler> protocolHandler;
- // SPDY or HTTP/2 requests; SPDY is TLS-only, but
- // HTTP/2 can be cleartext also, that's why it's
- // outside of QT_NO_SSL section. Sorted by priority:
- QMultiMap<int, HttpMessagePair> spdyRequestsToSend;
+ QMultiMap<int, HttpMessagePair> h2RequestsToSend;
bool switchedToHttp2 = false;
#ifndef QT_NO_SSL
bool ignoreAllSslErrors;
@@ -135,7 +132,7 @@ public:
void ignoreSslErrors();
void ignoreSslErrors(const QList<QSslError> &errors);
void setSslConfiguration(const QSslConfiguration &config);
- void requeueSpdyRequests(); // when we wanted SPDY but got HTTP
+ void requeueHttp2Requests(); // when we wanted HTTP/2 but got HTTP/1.1
#endif
// to emit the signal for all in-flight replies:
void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message);
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index a8b635c45a..8982b7c745 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -287,14 +287,14 @@ bool QHttpNetworkReply::isPipeliningUsed() const
return d_func()->pipeliningUsed;
}
-bool QHttpNetworkReply::isSpdyUsed() const
+bool QHttpNetworkReply::isHttp2Used() const
{
- return d_func()->spdyUsed;
+ return d_func()->h2Used;
}
-void QHttpNetworkReply::setSpdyWasUsed(bool spdy)
+void QHttpNetworkReply::setHttp2WasUsed(bool h2)
{
- d_func()->spdyUsed = spdy;
+ d_func()->h2Used = h2;
}
qint64 QHttpNetworkReply::removedContentLength() const
@@ -324,15 +324,11 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)
forceConnectionCloseEnabled(false),
lastChunkRead(false),
currentChunkSize(0), currentChunkRead(0), readBufferMaxSize(0),
- windowSizeDownload(65536), // 64K initial window size according to SPDY standard
- windowSizeUpload(65536), // 64K initial window size according to SPDY standard
- currentlyReceivedDataInWindow(0),
- currentlyUploadedDataInWindow(0),
totallyUploadedData(0),
removedContentLength(-1),
connection(0),
autoDecompress(false), responseData(), requestIsPrepared(false)
- ,pipeliningUsed(false), spdyUsed(false), downstreamLimited(false)
+ ,pipeliningUsed(false), h2Used(false), downstreamLimited(false)
,userProvidedDownloadBuffer(0)
#ifndef QT_NO_COMPRESS
,inflateStrm(0)
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 12cfe359aa..82128f656e 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -137,8 +137,8 @@ public:
bool isFinished() const;
bool isPipeliningUsed() const;
- bool isSpdyUsed() const;
- void setSpdyWasUsed(bool spdy);
+ bool isHttp2Used() const;
+ void setHttp2WasUsed(bool h2Used);
qint64 removedContentLength() const;
bool isRedirecting() const;
@@ -251,11 +251,7 @@ public:
qint64 currentChunkSize;
qint64 currentChunkRead;
qint64 readBufferMaxSize;
- qint32 windowSizeDownload; // only for SPDY
- qint32 windowSizeUpload; // only for SPDY
- qint32 currentlyReceivedDataInWindow; // only for SPDY
- qint32 currentlyUploadedDataInWindow; // only for SPDY
- qint64 totallyUploadedData; // only for SPDY
+ qint64 totallyUploadedData; // HTTP/2
qint64 removedContentLength;
QPointer<QHttpNetworkConnection> connection;
QPointer<QHttpNetworkConnectionChannel> connectionChannel;
@@ -267,7 +263,7 @@ public:
bool requestIsPrepared;
bool pipeliningUsed;
- bool spdyUsed;
+ bool h2Used;
bool downstreamLimited;
char* userProvidedDownloadBuffer;
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index a3f71b8d2f..f81924d5d3 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
- autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false), http2Allowed(false),
+ autoDecompress(false), pipeliningAllowed(false), http2Allowed(false),
http2Direct(false), withCredentials(true), preConnect(false), redirectCount(0),
redirectPolicy(QNetworkRequest::ManualRedirectPolicy)
{
@@ -59,7 +59,6 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
uploadByteDevice(other.uploadByteDevice),
autoDecompress(other.autoDecompress),
pipeliningAllowed(other.pipeliningAllowed),
- spdyAllowed(other.spdyAllowed),
http2Allowed(other.http2Allowed),
http2Direct(other.http2Direct),
withCredentials(other.withCredentials),
@@ -83,7 +82,6 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot
&& (uploadByteDevice == other.uploadByteDevice)
&& (autoDecompress == other.autoDecompress)
&& (pipeliningAllowed == other.pipeliningAllowed)
- && (spdyAllowed == other.spdyAllowed)
&& (http2Allowed == other.http2Allowed)
&& (http2Direct == other.http2Direct)
// we do not clear the customVerb in setOperation
@@ -339,16 +337,6 @@ void QHttpNetworkRequest::setPipeliningAllowed(bool b)
d->pipeliningAllowed = b;
}
-bool QHttpNetworkRequest::isSPDYAllowed() const
-{
- return d->spdyAllowed;
-}
-
-void QHttpNetworkRequest::setSPDYAllowed(bool b)
-{
- d->spdyAllowed = b;
-}
-
bool QHttpNetworkRequest::isHTTP2Allowed() const
{
return d->http2Allowed;
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index fb4896195b..f263e348ef 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -116,9 +116,6 @@ public:
bool isPipeliningAllowed() const;
void setPipeliningAllowed(bool b);
- bool isSPDYAllowed() const;
- void setSPDYAllowed(bool b);
-
bool isHTTP2Allowed() const;
void setHTTP2Allowed(bool b);
@@ -176,7 +173,6 @@ public:
mutable QNonContiguousByteDevice* uploadByteDevice;
bool autoDecompress;
bool pipeliningAllowed;
- bool spdyAllowed;
bool http2Allowed;
bool http2Direct;
bool withCredentials;
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 63a3c4f204..2933d75d2c 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -236,7 +236,7 @@ QHttpThreadDelegate::QHttpThreadDelegate(QObject *parent) :
, synchronous(false)
, incomingStatusCode(0)
, isPipeliningUsed(false)
- , isSpdyUsed(false)
+ , isHttp2Used(false)
, incomingContentLength(-1)
, removedContentLength(-1)
, incomingErrorCode(QNetworkReply::NoError)
@@ -320,17 +320,6 @@ void QHttpThreadDelegate::startRequest()
}
}
-#ifndef QT_NO_SSL
- if (!isH2 && httpRequest.isSPDYAllowed() && ssl) {
- connectionType = QHttpNetworkConnection::ConnectionTypeSPDY;
- urlCopy.setScheme(QStringLiteral("spdy")); // to differentiate SPDY requests from HTTPS requests
- QList<QByteArray> nextProtocols;
- nextProtocols << QSslConfiguration::NextProtocolSpdy3_0
- << QSslConfiguration::NextProtocolHttp1_1;
- incomingSslConfiguration->setAllowedNextProtocols(nextProtocols);
- }
-#endif // QT_NO_SSL
-
#ifndef QT_NO_NETWORKPROXY
if (transparentProxy.type() != QNetworkProxy::NoProxy)
cacheKey = makeCacheKey(urlCopy, &transparentProxy, httpRequest.peerVerifyName());
@@ -652,7 +641,7 @@ void QHttpThreadDelegate::headerChangedSlot()
isPipeliningUsed = httpReply->isPipeliningUsed();
incomingContentLength = httpReply->contentLength();
removedContentLength = httpReply->removedContentLength();
- isSpdyUsed = httpReply->isSpdyUsed();
+ isHttp2Used = httpReply->isHttp2Used();
emit downloadMetaData(incomingHeaders,
incomingStatusCode,
@@ -661,7 +650,7 @@ void QHttpThreadDelegate::headerChangedSlot()
downloadBuffer,
incomingContentLength,
removedContentLength,
- isSpdyUsed);
+ isHttp2Used);
}
void QHttpThreadDelegate::synchronousHeaderChangedSlot()
@@ -677,7 +666,7 @@ void QHttpThreadDelegate::synchronousHeaderChangedSlot()
incomingStatusCode = httpReply->statusCode();
incomingReasonPhrase = httpReply->reasonPhrase();
isPipeliningUsed = httpReply->isPipeliningUsed();
- isSpdyUsed = httpReply->isSpdyUsed();
+ isHttp2Used = httpReply->isHttp2Used();
incomingContentLength = httpReply->contentLength();
}
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index 355d1afc30..208b2cb149 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -112,7 +112,7 @@ public:
int incomingStatusCode;
QString incomingReasonPhrase;
bool isPipeliningUsed;
- bool isSpdyUsed;
+ bool isHttp2Used;
qint64 incomingContentLength;
qint64 removedContentLength;
QNetworkReply::NetworkError incomingErrorCode;
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 98c82c81ae..125427493d 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1237,12 +1237,10 @@ void QNetworkAccessManager::connectToHostEncrypted(const QString &hostName, quin
if (sslConfiguration != QSslConfiguration::defaultConfiguration())
request.setSslConfiguration(sslConfiguration);
- // There is no way to enable SPDY/HTTP2 via a request, so we need to check
- // the ssl configuration whether SPDY/HTTP2 is allowed here.
+ // There is no way to enable HTTP2 via a request, so we need to check
+ // the ssl configuration whether HTTP2 is allowed here.
if (sslConfiguration.allowedNextProtocols().contains(QSslConfiguration::ALPNProtocolHTTP2))
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true);
- else if (sslConfiguration.allowedNextProtocols().contains(QSslConfiguration::NextProtocolSpdy3_0))
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
request.setPeerVerifyName(peerName);
get(request);
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index 98498d07d2..a74ece6d5b 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -56,7 +56,6 @@ class QIODevice;
class QAbstractNetworkCache;
class QAuthenticator;
class QByteArray;
-template<typename T> class QList;
class QNetworkCookie;
class QNetworkCookieJar;
class QNetworkReply;
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 44c1d3e422..0bd7825186 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -774,9 +774,6 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool())
httpRequest.setPipeliningAllowed(true);
- if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool())
- httpRequest.setSPDYAllowed(true);
-
if (request.attribute(QNetworkRequest::Http2AllowedAttribute).toBool())
httpRequest.setHTTP2Allowed(true);
@@ -968,7 +965,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
QSharedPointer<char>(),
delegate->incomingContentLength,
delegate->removedContentLength,
- delegate->isSpdyUsed);
+ delegate->isHttp2Used);
replyDownloadData(delegate->synchronousDownloadData);
httpError(delegate->incomingErrorCode, delegate->incomingErrorDetail);
} else {
@@ -980,7 +977,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
QSharedPointer<char>(),
delegate->incomingContentLength,
delegate->removedContentLength,
- delegate->isSpdyUsed);
+ delegate->isHttp2Used);
replyDownloadData(delegate->synchronousDownloadData);
}
@@ -1254,7 +1251,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
QSharedPointer<char> db,
qint64 contentLength,
qint64 removedContentLength,
- bool spdyWasUsed)
+ bool h2Used)
{
Q_Q(QNetworkReplyHttpImpl);
Q_UNUSED(contentLength);
@@ -1280,16 +1277,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
}
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
- const QVariant http2Allowed = request.attribute(QNetworkRequest::Http2AllowedAttribute);
- const QVariant http2Direct = request.attribute(QNetworkRequest::Http2DirectAttribute);
- if ((http2Allowed.isValid() && http2Allowed.toBool())
- || (http2Direct.isValid() && http2Direct.toBool())) {
- q->setAttribute(QNetworkRequest::Http2WasUsedAttribute, spdyWasUsed);
- q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, false);
- } else {
- q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);
- q->setAttribute(QNetworkRequest::Http2WasUsedAttribute, false);
- }
+ q->setAttribute(QNetworkRequest::Http2WasUsedAttribute, h2Used);
// reconstruct the HTTP header
QList<QPair<QByteArray, QByteArray> > headerMap = hm;
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 7899bce32b..1deaa03f71 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -272,18 +272,6 @@ QT_BEGIN_NAMESPACE
The QNetworkSession ConnectInBackground property will be set according to
this attribute.
- \value SpdyAllowedAttribute
- Requests only, type: QMetaType::Bool (default: false)
- Indicates whether the QNetworkAccessManager code is
- allowed to use SPDY with this request. This applies only
- to SSL requests, and depends on the server supporting SPDY.
- Obsolete, use Http2 instead of Spdy.
-
- \value SpdyWasUsedAttribute
- Replies only, type: QMetaType::Bool
- Indicates whether SPDY was used for receiving
- this reply. Obsolete, use Http2 instead of Spdy.
-
\value Http2AllowedAttribute
Requests only, type: QMetaType::Bool (default: false)
Indicates whether the QNetworkAccessManager code is
@@ -295,12 +283,6 @@ QT_BEGIN_NAMESPACE
Indicates whether HTTP/2 was used for receiving this reply.
(This value was introduced in 5.9.)
- \value HTTP2AllowedAttribute
- Obsolete alias for Http2AllowedAttribute.
-
- \value HTTP2WasUsedAttribute
- Obsolete alias for Http2WasUsedAttribute.
-
\value EmitAllUploadProgressSignalsAttribute
Requests only, type: QMetaType::Bool (default: false)
Indicates whether all upload signals should be emitted.
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index 72a6555d91..95b5dc89b5 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -89,18 +89,10 @@ public:
DownloadBufferAttribute, // internal
SynchronousRequestAttribute, // internal
BackgroundRequestAttribute,
-#if QT_DEPRECATED_SINCE(5, 15)
- SpdyAllowedAttribute,
- SpdyWasUsedAttribute,
-#endif // QT_DEPRECATED_SINCE(5, 15)
EmitAllUploadProgressSignalsAttribute = BackgroundRequestAttribute + 3,
FollowRedirectsAttribute,
Http2AllowedAttribute,
Http2WasUsedAttribute,
-#if QT_DEPRECATED_SINCE(5, 15)
- HTTP2AllowedAttribute Q_DECL_ENUMERATOR_DEPRECATED_X("Use Http2AllowedAttribute") = Http2AllowedAttribute,
- HTTP2WasUsedAttribute Q_DECL_ENUMERATOR_DEPRECATED_X("Use Http2WasUsedAttribute"),
-#endif // QT_DEPRECATED_SINCE(5, 15)
OriginalContentLengthAttribute,
RedirectPolicyAttribute,
Http2DirectAttribute,
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
deleted file mode 100644
index f845235bf7..0000000000
--- a/src/network/access/qspdyprotocolhandler.cpp
+++ /dev/null
@@ -1,1304 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork 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 <private/qspdyprotocolhandler_p.h>
-#include <private/qnoncontiguousbytedevice_p.h>
-#include <private/qhttpnetworkconnectionchannel_p.h>
-#include <QtCore/QtEndian>
-
-#if !defined(QT_NO_SSL)
-
-QT_BEGIN_NAMESPACE
-
-static const char spdyDictionary[] = {
- 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // ....opti
- 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // ons....h
- 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // ead....p
- 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // ost....p
- 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // ut....de
- 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // lete....
- 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // trace...
- 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // .accept.
- 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep
- 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // t-charse
- 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, // t....acc
- 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ept-enco
- 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, // ding....
- 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, // accept-l
- 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, // anguage.
- 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep
- 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, // t-ranges
- 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, // ....age.
- 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, // ...allow
- 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, // ....auth
- 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, // orizatio
- 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, // n....cac
- 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, // he-contr
- 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, // ol....co
- 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // nnection
- 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, // ....cont
- 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, // ent-base
- 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, // ....cont
- 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ent-enco
- 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, // ding....
- 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, // content-
- 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, // language
- 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, // ....cont
- 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, // ent-leng
- 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, // th....co
- 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, // ntent-lo
- 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // cation..
- 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten
- 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, // t-md5...
- 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, // .content
- 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, // -range..
- 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten
- 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // t-type..
- 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, // ..date..
- 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, // ..etag..
- 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, // ..expect
- 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, // ....expi
- 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, // res....f
- 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, // rom....h
- 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, // ost....i
- 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, // f-match.
- 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, // ...if-mo
- 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, // dified-s
- 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, // ince....
- 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, // if-none-
- 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, // match...
- 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, // .if-rang
- 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, // e....if-
- 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, // unmodifi
- 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, // ed-since
- 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, // ....last
- 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, // -modifie
- 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, // d....loc
- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, // ation...
- 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, // .max-for
- 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, // wards...
- 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, // .pragma.
- 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, // ...proxy
- 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, // -authent
- 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, // icate...
- 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, // .proxy-a
- 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, // uthoriza
- 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, // tion....
- 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, // range...
- 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, // .referer
- 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, // ....retr
- 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, // y-after.
- 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, // ...serve
- 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, // r....te.
- 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, // ...trail
- 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, // er....tr
- 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, // ansfer-e
- 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, // ncoding.
- 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, // ...upgra
- 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, // de....us
- 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, // er-agent
- 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, // ....vary
- 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, // ....via.
- 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, // ...warni
- 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, // ng....ww
- 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, // w-authen
- 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, // ticate..
- 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, // ..method
- 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, // ....get.
- 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, // ...statu
- 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, // s....200
- 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, // .OK....v
- 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ersion..
- 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, // ..HTTP.1
- 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, // .1....ur
- 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, // l....pub
- 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, // lic....s
- 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, // et-cooki
- 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, // e....kee
- 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, // p-alive.
- 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, // ...origi
- 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, // n1001012
- 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, // 01202205
- 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, // 20630030
- 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, // 23033043
- 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, // 05306307
- 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, // 40240540
- 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, // 64074084
- 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, // 09410411
- 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, // 41241341
- 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, // 44154164
- 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, // 17502504
- 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, // 505203.N
- 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, // on-Autho
- 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, // ritative
- 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, // .Informa
- 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, // tion204.
- 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, // No.Conte
- 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, // nt301.Mo
- 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, // ved.Perm
- 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, // anently4
- 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, // 00.Bad.R
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, // equest40
- 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, // 1.Unauth
- 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, // orized40
- 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, // 3.Forbid
- 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, // den404.N
- 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, // ot.Found
- 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, // 500.Inte
- 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, // rnal.Ser
- 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, // ver.Erro
- 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, // r501.Not
- 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, // .Impleme
- 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, // nted503.
- 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, // Service.
- 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, // Unavaila
- 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, // bleJan.F
- 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, // eb.Mar.A
- 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, // pr.May.J
- 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, // un.Jul.A
- 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, // ug.Sept.
- 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, // Oct.Nov.
- 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, // Dec.00.0
- 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, // 0.00.Mon
- 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, // ..Tue..W
- 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, // ed..Thu.
- 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, // .Fri..Sa
- 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, // t..Sun..
- 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, // GMTchunk
- 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, // ed.text.
- 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, // html.ima
- 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, // ge.png.i
- 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, // mage.jpg
- 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, // .image.g
- 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // if.appli
- 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x
- 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // ml.appli
- 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x
- 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, // html.xml
- 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, // .text.pl
- 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, // ain.text
- 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, // .javascr
- 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, // ipt.publ
- 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, // icprivat
- 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, // emax-age
- 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, // .gzip.de
- 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, // flate.sd
- 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // chcharse
- 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, // t.utf-8c
- 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, // harset.i
- 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, // so-8859-
- 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, // 1.utf-..
- 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e // .enq.0.
-};
-
-// uncomment to debug
-//static void printHex(const QByteArray &ba)
-//{
-// QByteArray hex;
-// QByteArray clearText;
-// for (int a = 0; a < ba.count(); ++a) {
-// QByteArray currentHexChar = QByteArray(1, ba.at(a)).toHex().rightJustified(2, ' ');
-// QByteArray currentChar;
-// if (ba.at(a) >= 32 && ba.at(a) < 126) { // if ASCII, print the letter
-// currentChar = QByteArray(1, ba.at(a));
-// } else {
-// currentChar = " ";
-// }
-// clearText.append(currentChar.rightJustified(2, ' '));
-// hex.append(currentHexChar);
-// hex.append(' ');
-// clearText.append(' ');
-// }
-// int chunkSize = 102; // 12 == 4 bytes per line
-// for (int a = 0; a < hex.count(); a += chunkSize) {
-// qDebug() << hex.mid(a, chunkSize);
-// qDebug() << clearText.mid(a, chunkSize);
-// }
-//}
-
-QSpdyProtocolHandler::QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channel)
- : QObject(0), QAbstractProtocolHandler(channel),
- m_nextStreamID(-1),
- m_maxConcurrentStreams(100), // 100 is recommended in the SPDY RFC
- m_initialWindowSize(0),
- m_waitingForCompleteStream(false)
-{
- m_inflateStream.zalloc = Z_NULL;
- m_inflateStream.zfree = Z_NULL;
- m_inflateStream.opaque = Z_NULL;
- int zlibRet = inflateInit(&m_inflateStream);
- Q_ASSERT(zlibRet == Z_OK);
-
- m_deflateStream.zalloc = Z_NULL;
- m_deflateStream.zfree = Z_NULL;
- m_deflateStream.opaque = Z_NULL;
-
- // Do actually not compress (i.e. compression level = 0)
- // when sending the headers because of the CRIME attack
- zlibRet = deflateInit(&m_deflateStream, /* compression level = */ 0);
- Q_ASSERT(zlibRet == Z_OK);
- Q_UNUSED(zlibRet); // silence -Wunused-variable
-}
-
-QSpdyProtocolHandler::~QSpdyProtocolHandler()
-{
- deflateEnd(&m_deflateStream);
- deflateEnd(&m_inflateStream);
-}
-
-bool QSpdyProtocolHandler::sendRequest()
-{
- Q_ASSERT(!m_reply);
-
- int maxPossibleRequests = m_maxConcurrentStreams - m_inFlightStreams.count();
- Q_ASSERT(maxPossibleRequests >= 0);
- if (maxPossibleRequests == 0)
- return true; // return early if max concurrent requests are exceeded
-
- m_channel->state = QHttpNetworkConnectionChannel::WritingState;
-
- int requestsToSend = qMin(m_channel->spdyRequestsToSend.size(), maxPossibleRequests);
-
- QMultiMap<int, HttpMessagePair>::iterator it = m_channel->spdyRequestsToSend.begin();
- // requests will be ordered by priority (see QMultiMap doc)
- for (int a = 0; a < requestsToSend; ++a) {
- HttpMessagePair currentPair = *it;
- QHttpNetworkRequest currentRequest = currentPair.first;
- QHttpNetworkReply *currentReply = currentPair.second;
-
- currentReply->setSpdyWasUsed(true);
- qint32 streamID = generateNextStreamID();
- m_streamIDs.insert(currentReply, streamID);
-
- currentReply->setRequest(currentRequest);
- currentReply->d_func()->connection = m_connection;
- currentReply->d_func()->connectionChannel = m_channel;
- m_inFlightStreams.insert(streamID, currentPair);
- connect(currentReply, SIGNAL(destroyed(QObject*)), this, SLOT(_q_replyDestroyed(QObject*)));
-
- sendSYN_STREAM(currentPair, streamID, /* associatedToStreamID = */ 0);
- m_channel->spdyRequestsToSend.erase(it++);
- }
- m_channel->state = QHttpNetworkConnectionChannel::IdleState;
- return true;
-}
-
-void QSpdyProtocolHandler::_q_replyDestroyed(QObject* reply)
-{
- qint32 streamID = m_streamIDs.take(reply);
- if (m_inFlightStreams.remove(streamID))
- sendRST_STREAM(streamID, RST_STREAM_CANCEL);
-}
-
-void QSpdyProtocolHandler::_q_receiveReply()
-{
- Q_ASSERT(m_socket);
-
- // only run when the QHttpNetworkConnection is not currently being destructed, e.g.
- // this function is called from _q_disconnected which is called because
- // of ~QHttpNetworkConnectionPrivate
- if (!qobject_cast<QHttpNetworkConnection*>(m_connection)) {
- return;
- }
-
- if (bytesAvailable() < 8)
- return; // cannot read frame headers, wait for more data
-
- char frameHeadersRaw[8];
- if (!readNextChunk(8, frameHeadersRaw))
- return; // this should not happen, we just checked
-
- const QByteArray frameHeaders(frameHeadersRaw, 8); // ### try without memcpy
- if (frameHeadersRaw[0] & 0x80) {
- handleControlFrame(frameHeaders);
- } else {
- handleDataFrame(frameHeaders);
- }
-
- // after handling the current frame, check whether there is more data waiting
- if (m_socket->bytesAvailable() > 0)
- QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);
-}
-
-void QSpdyProtocolHandler::_q_readyRead()
-{
- _q_receiveReply();
-}
-
-static qint16 twoBytesToInt(const char *bytes)
-{
- return qFromBigEndian<qint16>(bytes);
-}
-
-static qint32 threeBytesToInt(const char *bytes)
-{
- return qFromBigEndian<qint32>(bytes) >> 8;
-}
-
-static qint32 fourBytesToInt(const char *bytes)
-{
- return qFromBigEndian<qint32>(bytes);
-}
-
-static void appendIntToThreeBytes(char *output, qint32 number)
-{
- qToBigEndian<qint16>(number, output + 1);
- qToBigEndian<qint8>(number >> 16, output);
-}
-
-static void appendIntToFourBytes(char *output, qint32 number)
-{
- qToBigEndian<qint32>(number, output);
-}
-
-static QByteArray intToFourBytes(qint32 number) // ### try to use appendIntToFourBytes where possible
-{
- char data[4];
- qToBigEndian<qint32>(number, data);
- QByteArray ret(data, 4);
- return ret;
-}
-
-static QByteArray intToThreeBytes(qint32 number)
-{
- char data[4];
- qToBigEndian<qint32>(number << 8, data);
- QByteArray ret(data, 3);
- return ret;
-}
-
-static qint32 getStreamID(const char *bytes)
-{
- // eliminate most significant bit; it might be 0 or 1 depending on whether
- // we are dealing with a control or data frame
- return fourBytesToInt(bytes) & 0x3fffffff;
-}
-
-static QByteArray headerField(const QByteArray &name, const QByteArray &value)
-{
- QByteArray ret;
- ret.reserve(name.count() + value.count() + 8); // 4 byte for length each
- ret.append(intToFourBytes(name.count()));
- ret.append(name);
- ret.append(intToFourBytes(value.count()));
- ret.append(value);
- return ret;
-}
-
-bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray *output)
-{
- const size_t chunkSize = 1024;
- char outputRaw[chunkSize];
- // input bytes will not be changed by zlib, so it is safe to const_cast here
- m_inflateStream.next_in = const_cast<Bytef *>(reinterpret_cast<const Bytef *>(input.constData()));
- m_inflateStream.avail_in = input.count();
- m_inflateStream.total_in = input.count();
- int zlibRet;
-
- do {
- m_inflateStream.next_out = reinterpret_cast<Bytef *>(outputRaw);
- m_inflateStream.avail_out = chunkSize;
- zlibRet = inflate(&m_inflateStream, Z_SYNC_FLUSH);
- if (zlibRet == Z_NEED_DICT) {
- zlibRet = inflateSetDictionary(&m_inflateStream,
- reinterpret_cast<const Bytef*>(spdyDictionary),
- /* dictionaryLength = */ 1423);
- Q_ASSERT(zlibRet == Z_OK);
- continue;
- }
- switch (zlibRet) {
- case Z_BUF_ERROR: {
- if (m_inflateStream.avail_in == 0) {
- int outputSize = chunkSize - m_inflateStream.avail_out;
- output->append(outputRaw, outputSize);
- m_inflateStream.avail_out = chunkSize;
- }
- break;
- }
- case Z_OK: {
- int outputSize = chunkSize - m_inflateStream.avail_out;
- output->append(outputRaw, outputSize);
- break;
- }
- default: {
- qWarning("got unexpected zlib return value: %d", zlibRet);
- return false;
- }
- }
- } while (m_inflateStream.avail_in > 0 && zlibRet != Z_STREAM_END);
-
- Q_ASSERT(m_inflateStream.avail_in == 0);
- return true;
-}
-
-QByteArray QSpdyProtocolHandler::composeHeader(const QHttpNetworkRequest &request)
-{
- QByteArray uncompressedHeader;
- uncompressedHeader.reserve(300); // rough estimate
-
- // calculate additional headers first, because we need to know the size
- // ### do not partially copy the list, but restrict the set header fields
- // in QHttpNetworkConnection
- QVector<QPair<QByteArray, QByteArray> > additionalHeaders;
- for (int a = 0; a < request.header().count(); ++a) {
- QByteArray key = request.header().at(a).first;
- if (key == "Connection" || key == "Host" || key == "Keep-Alive"
- || key == "Proxy-Connection" || key == "Transfer-Encoding")
- continue; // those headers are not valid (section 3.2.1)
- additionalHeaders.append(request.header().at(a));
- }
-
- qint32 numberOfHeaderPairs = 5 + additionalHeaders.count(); // 5 mandatory below + the additional ones
- uncompressedHeader.append(intToFourBytes(numberOfHeaderPairs));
-
- // mandatory header fields:
-
- uncompressedHeader.append(headerField(":method", request.methodName()));
-#ifndef QT_NO_NETWORKPROXY
- bool useProxy = m_connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy;
- uncompressedHeader.append(headerField(":path", request.uri(useProxy)));
-#else
- uncompressedHeader.append(headerField(":path", request.uri(false)));
-#endif
- uncompressedHeader.append(headerField(":version", "HTTP/1.1"));
-
- uncompressedHeader.append(headerField(":host", request.url().authority(QUrl::FullyEncoded | QUrl::RemoveUserInfo).toLatin1()));
-
- uncompressedHeader.append(headerField(":scheme", request.url().scheme().toLatin1()));
-
- // end of mandatory header fields
-
- // now add the additional headers
- for (int a = 0; a < additionalHeaders.count(); ++a) {
- uncompressedHeader.append(headerField(additionalHeaders.at(a).first.toLower(),
- additionalHeaders.at(a).second));
- }
-
- m_deflateStream.total_in = uncompressedHeader.count();
- m_deflateStream.avail_in = uncompressedHeader.count();
- m_deflateStream.next_in = reinterpret_cast<unsigned char *>(uncompressedHeader.data());
- int outputBytes = uncompressedHeader.count() + 30; // 30 bytes of compression header overhead
- m_deflateStream.avail_out = outputBytes;
- unsigned char *out = new unsigned char[outputBytes];
- m_deflateStream.next_out = out;
- int availOutBefore = m_deflateStream.avail_out;
- int zlibRet = deflate(&m_deflateStream, Z_SYNC_FLUSH); // do everything in one go since we use no compression
- int compressedHeaderSize = availOutBefore - m_deflateStream.avail_out;
- Q_ASSERT(zlibRet == Z_OK); // otherwise, we need to allocate more outputBytes
- Q_UNUSED(zlibRet); // silence -Wunused-variable
- Q_ASSERT(m_deflateStream.avail_in == 0);
- QByteArray compressedHeader(reinterpret_cast<char *>(out), compressedHeaderSize);
- delete[] out;
-
- return compressedHeader;
-}
-
-quint64 QSpdyProtocolHandler::bytesAvailable() const
-{
- Q_ASSERT(m_socket);
- return m_spdyBuffer.byteAmount() + m_socket->bytesAvailable();
-}
-
-bool QSpdyProtocolHandler::readNextChunk(qint64 length, char *sink)
-{
- qint64 expectedReadBytes = length;
- qint64 requiredBytesFromBuffer = 0;
-
- if (m_waitingForCompleteStream) {
- requiredBytesFromBuffer = qMin(length, m_spdyBuffer.byteAmount());
- // ### if next chunk from buffer bigger than what we want to read,
- // we have to call read() (which memcpy's). Otherwise, we can just
- // read the next chunk without memcpy'ing.
- qint64 bytesReadFromBuffer = m_spdyBuffer.read(sink, requiredBytesFromBuffer);
- Q_ASSERT(bytesReadFromBuffer == requiredBytesFromBuffer);
- if (length <= bytesReadFromBuffer) {
- return true; // buffer > required size -> no need to read from socket
- }
- expectedReadBytes -= requiredBytesFromBuffer;
- }
- qint64 readBytes = m_socket->read(sink + requiredBytesFromBuffer, expectedReadBytes);
-
- if (readBytes < expectedReadBytes) {
- m_waitingForCompleteStream = true;
- // ### this is inefficient, we should not put back so much data into the buffer
- QByteArray temp(sink, requiredBytesFromBuffer + readBytes);
- m_spdyBuffer.append(temp);
- return false;
- } else {
- return true; // buffer must be cleared by calling function
- }
-}
-
-void QSpdyProtocolHandler::sendControlFrame(FrameType type,
- ControlFrameFlags flags,
- const char *data,
- quint32 length)
-{
- // frame type and stream ID
- char header[8];
- header[0] = 0x80u; // leftmost bit == 1 -> is a control frame
- header[1] = 0x03; // 3 bit == version 3
- header[2] = 0;
- switch (type) {
- case FrameType_CREDENTIAL: {
- qWarning("sending SPDY CREDENTIAL frame is not yet implemented"); // QTBUG-36188
- return;
- }
- default:
- header[3] = type;
- }
-
- // flags
- header[4] = 0;
- if (flags & ControlFrame_FLAG_FIN || length == 0) {
- Q_ASSERT(type == FrameType_SYN_STREAM || type == FrameType_SYN_REPLY
- || type == FrameType_HEADERS || length == 0);
- header[4] |= ControlFrame_FLAG_FIN;
- }
- if (flags & ControlFrame_FLAG_UNIDIRECTIONAL) {
- Q_ASSERT(type == FrameType_SYN_STREAM);
- header[4] |= ControlFrame_FLAG_UNIDIRECTIONAL;
- }
-
- // length
- appendIntToThreeBytes(header + 5, length);
-
- qint64 written = m_socket->write(header, 8);
- Q_ASSERT(written == 8);
- written = m_socket->write(data, length);
- Q_ASSERT(written == length);
- Q_UNUSED(written); // silence -Wunused-variable
-}
-
-void QSpdyProtocolHandler::sendSYN_STREAM(const HttpMessagePair &messagePair,
- qint32 streamID, qint32 associatedToStreamID)
-{
- QHttpNetworkRequest request = messagePair.first;
- QHttpNetworkReply *reply = messagePair.second;
-
- ControlFrameFlags flags = 0;
-
- if (!request.uploadByteDevice()) {
- // no upload -> this is the last frame, send the FIN flag
- flags |= ControlFrame_FLAG_FIN;
- reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;
- } else {
- reply->d_func()->state = QHttpNetworkReplyPrivate::SPDYUploading;
-
- // hack: set the stream ID on the device directly, so when we get
- // the signal for uploading we know which stream we are sending on
- m_streamIDs.insert(request.uploadByteDevice(), streamID);
-
- QObject::connect(request.uploadByteDevice(), SIGNAL(readyRead()), this,
- SLOT(_q_uploadDataReadyRead()), Qt::QueuedConnection);
- QObject::connect(request.uploadByteDevice(), SIGNAL(destroyed(QObject*)), this,
- SLOT(_q_uploadDataDestroyed(QObject *)));
- }
-
- QByteArray namesAndValues = composeHeader(request);
- quint32 length = namesAndValues.count() + 10; // 10 == 4 for Stream-ID + 4 for Associated-To-Stream-ID
- // + 2 for Priority, Unused and Slot
-
- QByteArray wireData;
- wireData.reserve(length);
- wireData.append(intToFourBytes(streamID));
- wireData.append(intToFourBytes(associatedToStreamID));
-
- // priority (3 bits) / unused (5 bits) / slot (8 bits)
- char prioAndSlot[2];
- switch (request.priority()) {
- case QHttpNetworkRequest::HighPriority:
- prioAndSlot[0] = 0x00; // == prio 0 (highest)
- break;
- case QHttpNetworkRequest::NormalPriority:
- prioAndSlot[0] = 0x80u; // == prio 4
- break;
- case QHttpNetworkRequest::LowPriority:
- prioAndSlot[0] = 0xe0u; // == prio 7 (lowest)
- break;
- }
- prioAndSlot[1] = 0x00; // slot in client certificates (not supported currently)
- wireData.append(prioAndSlot, 2);
-
- wireData.append(namesAndValues);
-
- sendControlFrame(FrameType_SYN_STREAM, flags, wireData.constData(), length);
-
- if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYUploading)
- uploadData(streamID);
-}
-
-void QSpdyProtocolHandler::_q_uploadDataDestroyed(QObject *uploadData)
-{
- m_streamIDs.remove(uploadData);
-}
-
-void QSpdyProtocolHandler::sendRST_STREAM(qint32 streamID, RST_STREAM_STATUS_CODE statusCode)
-{
- char wireData[8];
- appendIntToFourBytes(wireData, streamID);
- appendIntToFourBytes(wireData + 4, statusCode);
- sendControlFrame(FrameType_RST_STREAM, /* flags = */ 0, wireData, /* length = */ 8);
-}
-
-void QSpdyProtocolHandler::sendPING(quint32 pingID)
-{
- char rawData[4];
- appendIntToFourBytes(rawData, pingID);
- sendControlFrame(FrameType_PING, /* flags = */ 0, rawData, /* length = */ 4);
-}
-
-bool QSpdyProtocolHandler::uploadData(qint32 streamID)
-{
- // we only rely on SPDY flow control here and don't care about TCP buffers
- if (!m_inFlightStreams.contains(streamID)) {
- sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);
- return false;
- }
-
- HttpMessagePair messagePair = m_inFlightStreams.value(streamID);
- QHttpNetworkRequest request = messagePair.first;
- QHttpNetworkReply *reply = messagePair.second;
- Q_ASSERT(reply);
- QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();
- Q_ASSERT(replyPrivate);
-
- if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) {
- qWarning("Trying to upload to closed stream");
- return false;
- }
-
- qint32 dataLeftInWindow = replyPrivate->windowSizeUpload
- - replyPrivate->currentlyUploadedDataInWindow;
-
- while (dataLeftInWindow > 0 && !request.uploadByteDevice()->atEnd()) {
-
- // get pointer to upload data
- qint64 currentReadSize = 0;
- const char *readPointer = request.uploadByteDevice()->readPointer(dataLeftInWindow,
- currentReadSize);
-
- if (currentReadSize == -1) {
- // premature eof happened
- m_connection->d_func()->emitReplyError(m_socket, reply,
- QNetworkReply::UnknownNetworkError);
- return false;
- } else if (readPointer == 0 || currentReadSize == 0) {
- // nothing to read currently, break the loop
- break;
- } else {
- DataFrameFlags flags = 0;
- // we will send the FIN flag later if appropriate
- qint64 currentWriteSize = sendDataFrame(streamID, flags, currentReadSize, readPointer);
- if (currentWriteSize == -1 || currentWriteSize != currentReadSize) {
- // socket broke down
- m_connection->d_func()->emitReplyError(m_socket, reply,
- QNetworkReply::UnknownNetworkError);
- return false;
- } else {
- replyPrivate->currentlyUploadedDataInWindow += currentWriteSize;
- replyPrivate->totallyUploadedData += currentWriteSize;
- dataLeftInWindow = replyPrivate->windowSizeUpload
- - replyPrivate->currentlyUploadedDataInWindow;
- request.uploadByteDevice()->advanceReadPointer(currentWriteSize);
-
- emit reply->dataSendProgress(replyPrivate->totallyUploadedData,
- request.contentLength());
- }
- }
- }
- if (replyPrivate->totallyUploadedData == request.contentLength()) {
- DataFrameFlags finFlag = DataFrame_FLAG_FIN;
- qint64 writeSize = sendDataFrame(streamID, finFlag, 0, 0);
- Q_ASSERT(writeSize == 0);
- Q_UNUSED(writeSize); // silence -Wunused-variable
- replyPrivate->state = QHttpNetworkReplyPrivate::SPDYHalfClosed;
- if (reply->request().uploadByteDevice())
- reply->request().uploadByteDevice()->disconnect(this);
- // ### this will not work if the content length is not known, but
- // then again many servers will fail in this case anyhow according
- // to the SPDY RFC
- }
- return true;
-}
-
-void QSpdyProtocolHandler::_q_uploadDataReadyRead()
-{
- QNonContiguousByteDevice *device = qobject_cast<QNonContiguousByteDevice *>(sender());
- Q_ASSERT(device);
- qint32 streamID = m_streamIDs.value(device);
- Q_ASSERT(streamID > 0);
- uploadData(streamID);
-}
-
-void QSpdyProtocolHandler::sendWINDOW_UPDATE(qint32 streamID, quint32 deltaWindowSize)
-{
- char windowUpdateData[8];
- appendIntToFourBytes(windowUpdateData, streamID);
- appendIntToFourBytes(windowUpdateData + 4, deltaWindowSize);
-
- sendControlFrame(FrameType_WINDOW_UPDATE, /* flags = */ 0, windowUpdateData, /* length = */ 8);
-}
-
-qint64 QSpdyProtocolHandler::sendDataFrame(qint32 streamID, DataFrameFlags flags,
- quint32 length, const char *data)
-{
- QByteArray wireData;
- wireData.reserve(8);
-
- wireData.append(intToFourBytes(streamID));
- wireData.append(flags);
- wireData.append(intToThreeBytes(length));
-
- Q_ASSERT(m_socket);
- m_socket->write(wireData);
-
- if (data) {
- qint64 ret = m_socket->write(data, length);
- return ret;
- } else {
- return 0; // nothing to write, e.g. FIN flag
- }
-}
-
-void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders) // ### make it char *
-{
- Q_ASSERT(frameHeaders.count() >= 8);
- qint16 version = twoBytesToInt(frameHeaders.constData());
- version &= 0x3fff; // eliminate most significant bit to determine version
- Q_ASSERT(version == 3);
-
- qint16 type = twoBytesToInt(frameHeaders.constData() + 2);
-
- char flags = frameHeaders.at(4);
- qint32 length = threeBytesToInt(frameHeaders.constData() + 5);
- Q_ASSERT(length > 0);
-
- QByteArray frameData;
- frameData.resize(length);
- if (!readNextChunk(length, frameData.data())) {
- // put back the frame headers to the buffer
- m_spdyBuffer.prepend(frameHeaders);
- return; // we couldn't read the whole frame and need to wait
- } else {
- m_spdyBuffer.clear();
- m_waitingForCompleteStream = false;
- }
-
- switch (type) {
- case FrameType_SYN_STREAM: {
- handleSYN_STREAM(flags, length, frameData);
- break;
- }
- case FrameType_SYN_REPLY: {
- handleSYN_REPLY(flags, length, frameData);
- break;
- }
- case FrameType_RST_STREAM: {
- handleRST_STREAM(flags, length, frameData);
- break;
- }
- case FrameType_SETTINGS: {
- handleSETTINGS(flags, length, frameData);
- break;
- }
- case FrameType_PING: {
- handlePING(flags, length, frameData);
- break;
- }
- case FrameType_GOAWAY: {
- handleGOAWAY(flags, length, frameData);
- break;
- }
- case FrameType_HEADERS: {
- handleHEADERS(flags, length, frameData);
- break;
- }
- case FrameType_WINDOW_UPDATE: {
- handleWINDOW_UPDATE(flags, length, frameData);
- break;
- }
- default:
- qWarning("cannot handle frame of type %d", int(type));
- }
-}
-
-void QSpdyProtocolHandler::handleSYN_STREAM(char /*flags*/, quint32 /*length*/,
- const QByteArray &frameData)
-{
- // not implemented; will be implemented when servers start using it
- // we just tell the server that we do not accept that
-
- qint32 streamID = getStreamID(frameData.constData());
-
- sendRST_STREAM(streamID, RST_STREAM_REFUSED_STREAM);
-}
-
-void QSpdyProtocolHandler::handleSYN_REPLY(char flags, quint32 /*length*/, const QByteArray &frameData)
-{
- parseHttpHeaders(flags, frameData);
-}
-
-void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameData)
-{
- qint32 streamID = getStreamID(frameData.constData());
- const auto it = m_inFlightStreams.constFind(streamID);
- if (it == m_inFlightStreams.cend()) {
- sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);
- return;
- }
-
- flags &= 0x3f;
- bool flag_fin = flags & 0x01;
-
- QByteArray headerValuePairs = frameData.mid(4);
-
- HttpMessagePair pair = it.value();
- QHttpNetworkReply *httpReply = pair.second;
- Q_ASSERT(httpReply != 0);
-
- if (httpReply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) {
- sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED);
- return;
- }
-
- QByteArray uncompressedHeader;
- if (!uncompressHeader(headerValuePairs, &uncompressedHeader)) {
- qWarning("error reading header from SYN_REPLY message");
- return;
- }
-
- qint32 headerCount = fourBytesToInt(uncompressedHeader.constData());
- if (headerCount * 8 > uncompressedHeader.size()) {
- qWarning("error parsing header from SYN_REPLY message");
- sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
- return;
- }
- qint32 readPointer = 4;
- for (qint32 a = 0; a < headerCount; ++a) {
- qint32 count = fourBytesToInt(uncompressedHeader.constData() + readPointer);
- readPointer += 4;
- QByteArray name = uncompressedHeader.mid(readPointer, count);
- readPointer += count;
- if (readPointer > uncompressedHeader.size()) {
- qWarning("error parsing header from SYN_REPLY message");
- sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
- return;
- }
- count = fourBytesToInt(uncompressedHeader.constData() + readPointer);
- readPointer += 4;
- QByteArray value = uncompressedHeader.mid(readPointer, count);
- readPointer += count;
- if (readPointer > uncompressedHeader.size()) {
- qWarning("error parsing header from SYN_REPLY message");
- sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
- return;
- }
- if (name == ":status") {
- httpReply->setStatusCode(value.left(3).toInt());
- httpReply->d_func()->reasonPhrase = QString::fromLatin1(value.mid(4));
- } else if (name == ":version") {
- int majorVersion = value.at(5) - 48;
- int minorVersion = value.at(7) - 48;
- httpReply->d_func()->majorVersion = majorVersion;
- httpReply->d_func()->minorVersion = minorVersion;
- } else if (name == "content-length") {
- httpReply->setContentLength(value.toLongLong());
- } else {
- value.replace('\0', name == "set-cookie" ? "\n" : ", ");
- httpReply->setHeaderField(name, value);
- }
- }
- emit httpReply->headerChanged();
-
- if (flag_fin) {
- if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed)
- sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0);
- replyFinished(httpReply, streamID);
- }
-}
-
-void QSpdyProtocolHandler::handleRST_STREAM(char /*flags*/, quint32 length,
- const QByteArray &frameData)
-{
- // flags are ignored
-
- Q_ASSERT(length == 8);
- Q_UNUSED(length); // silence -Wunused-parameter
- qint32 streamID = getStreamID(frameData.constData());
- QHttpNetworkReply *httpReply = m_inFlightStreams.value(streamID).second;
-
- qint32 statusCodeInt = fourBytesToInt(frameData.constData() + 4);
- RST_STREAM_STATUS_CODE statusCode = static_cast<RST_STREAM_STATUS_CODE>(statusCodeInt);
- QNetworkReply::NetworkError errorCode;
- QByteArray errorMessage;
-
- switch (statusCode) {
- case RST_STREAM_PROTOCOL_ERROR:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "SPDY protocol error";
- break;
- case RST_STREAM_INVALID_STREAM:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "SPDY stream is not active";
- break;
- case RST_STREAM_REFUSED_STREAM:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "SPDY stream was refused";
- break;
- case RST_STREAM_UNSUPPORTED_VERSION:
- errorCode = QNetworkReply::ProtocolUnknownError;
- errorMessage = "SPDY version is unknown to the server";
- break;
- case RST_STREAM_CANCEL:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "SPDY stream is no longer needed";
- break;
- case RST_STREAM_INTERNAL_ERROR:
- errorCode = QNetworkReply::InternalServerError;
- errorMessage = "Internal server error";
- break;
- case RST_STREAM_FLOW_CONTROL_ERROR:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "peer violated the flow control protocol";
- break;
- case RST_STREAM_STREAM_IN_USE:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "server received a SYN_REPLY for an already open stream";
- break;
- case RST_STREAM_STREAM_ALREADY_CLOSED:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "server received data or a SYN_REPLY for an already half-closed stream";
- break;
- case RST_STREAM_INVALID_CREDENTIALS:
- errorCode = QNetworkReply::ContentAccessDenied;
- errorMessage = "server received invalid credentials";
- break;
- case RST_STREAM_FRAME_TOO_LARGE:
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "server cannot process the frame because it is too large";
- break;
- default:
- qWarning("could not understand servers RST_STREAM status code");
- errorCode = QNetworkReply::ProtocolFailure;
- errorMessage = "got SPDY RST_STREAM message with unknown error code";
- }
- if (httpReply)
- replyFinishedWithError(httpReply, streamID, errorCode, errorMessage.constData());
-}
-
-void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const QByteArray &frameData)
-{
- Q_ASSERT(frameData.count() > 0);
-
- SETTINGS_Flags settingsFlags = static_cast<SETTINGS_Flags>(flags);
- if (settingsFlags & FLAG_SETTINGS_CLEAR_SETTINGS) {
- // ### clear all persistent settings; since we do not persist settings
- // as of now, we don't need to clear anything either
- }
-
- qint32 numberOfEntries = fourBytesToInt(frameData.constData());
- Q_ASSERT(numberOfEntries > 0);
- for (int a = 0, frameDataIndex = 4; a < numberOfEntries; ++a, frameDataIndex += 8) {
- SETTINGS_ID_Flag idFlag = static_cast<SETTINGS_ID_Flag>(frameData[frameDataIndex]);
- if (idFlag & FLAG_SETTINGS_PERSIST_VALUE) {
- // ### we SHOULD persist the settings here according to the RFC, but we don't have to,
- // so implement that later
- } // the other value is only sent by us, but not received
-
- quint32 uniqueID = static_cast<SETTINGS_ID>(
- threeBytesToInt(frameData.constData() + frameDataIndex + 1));
- quint32 value = fourBytesToInt(frameData.constData() + frameDataIndex + 4);
- switch (uniqueID) {
- case SETTINGS_UPLOAD_BANDWIDTH: {
- // ignored for now, just an estimated informative value
- break;
- }
- case SETTINGS_DOWNLOAD_BANDWIDTH: {
- // ignored for now, just an estimated informative value
- break;
- }
- case SETTINGS_ROUND_TRIP_TIME: {
- // ignored for now, just an estimated informative value
- break;
- }
- case SETTINGS_MAX_CONCURRENT_STREAMS: {
- m_maxConcurrentStreams = value;
- break;
- }
- case SETTINGS_CURRENT_CWND: {
- // ignored for now, just an informative value
- break;
- }
- case SETTINGS_DOWNLOAD_RETRANS_RATE: {
- // ignored for now, just an estimated informative value
- break;
- }
- case SETTINGS_INITIAL_WINDOW_SIZE: {
- m_initialWindowSize = value;
- break;
- }
- case SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE: {
- // client certificates are not supported
- break;
- }
- default:
- qWarning("found unknown settings value %u", uint(value));
- }
- }
-}
-
-void QSpdyProtocolHandler::handlePING(char /*flags*/, quint32 length, const QByteArray &frameData)
-{
- // flags are ignored
-
- Q_ASSERT(length == 4);
- Q_UNUSED(length); // silence -Wunused-parameter
- quint32 pingID = fourBytesToInt(frameData.constData());
-
- // odd numbered IDs must be ignored
- if ((pingID & 1) == 0) // is even?
- sendPING(pingID);
-}
-
-void QSpdyProtocolHandler::handleGOAWAY(char /*flags*/, quint32 /*length*/,
- const QByteArray &frameData)
-{
- // flags are ignored
-
- qint32 statusCode = static_cast<GOAWAY_STATUS>(fourBytesToInt(frameData.constData() + 4));
- QNetworkReply::NetworkError errorCode;
- switch (statusCode) {
- case GOAWAY_OK: {
- errorCode = QNetworkReply::NoError;
- break;
- }
- case GOAWAY_PROTOCOL_ERROR: {
- errorCode = QNetworkReply::ProtocolFailure;
- break;
- }
- case GOAWAY_INTERNAL_ERROR: {
- errorCode = QNetworkReply::InternalServerError;
- break;
- }
- default:
- qWarning("unexpected status code %d", int(statusCode));
- errorCode = QNetworkReply::ProtocolUnknownError;
- }
-
- qint32 lastGoodStreamID = getStreamID(frameData.constData());
-
- // emit errors for all replies after the last good stream ID
- Q_ASSERT(m_connection);
- for (qint32 currentStreamID = lastGoodStreamID + 2; currentStreamID <= m_nextStreamID;
- ++currentStreamID) {
- QHttpNetworkReply *reply = m_inFlightStreams.value(currentStreamID).second;
- Q_ASSERT(reply);
- m_connection->d_func()->emitReplyError(m_socket, reply, errorCode);
- }
- // ### we could make sure a new session is initiated anyhow
-}
-
-void QSpdyProtocolHandler::handleHEADERS(char flags, quint32 /*length*/,
- const QByteArray &frameData)
-{
- parseHttpHeaders(flags, frameData);
-}
-
-void QSpdyProtocolHandler::handleWINDOW_UPDATE(char /*flags*/, quint32 /*length*/,
- const QByteArray &frameData)
-{
- qint32 streamID = getStreamID(frameData.constData());
- qint32 deltaWindowSize = fourBytesToInt(frameData.constData() + 4);
-
- const auto it = m_inFlightStreams.constFind(streamID);
- if (it == m_inFlightStreams.cend()) {
- sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);
- return;
- }
-
- QHttpNetworkReply *reply = it.value().second;
- Q_ASSERT(reply);
- QHttpNetworkReplyPrivate *replyPrivate = reply->d_func();
- Q_ASSERT(replyPrivate);
-
- // Ignore WINDOW_UPDATE if we are already done.
- if (replyPrivate->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || replyPrivate->state == QHttpNetworkReplyPrivate::SPDYClosed)
- return;
-
- replyPrivate->currentlyUploadedDataInWindow = replyPrivate->windowSizeUpload - deltaWindowSize;
- uploadData(streamID); // we hopefully can continue to upload
-}
-
-
-void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders)
-{
- Q_ASSERT(frameHeaders.count() >= 8);
-
- qint32 streamID = getStreamID(frameHeaders.constData());
- const auto it = m_inFlightStreams.constFind(streamID);
- if (it == m_inFlightStreams.cend()) {
- sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM);
- return;
- }
-
- unsigned char flags = static_cast<unsigned char>(frameHeaders.at(4));
- flags &= 0x3f;
- bool flag_fin = flags & 0x01;
- bool flag_compress = flags & 0x02;
- qint32 length = threeBytesToInt(frameHeaders.constData() + 5);
-
- QByteArray data;
- data.resize(length);
- if (!readNextChunk(length, data.data())) {
- // put back the frame headers to the buffer
- m_spdyBuffer.prepend(frameHeaders);
- return; // we couldn't read the whole frame and need to wait
- } else {
- m_spdyBuffer.clear();
- m_waitingForCompleteStream = false;
- }
-
- HttpMessagePair pair = it.value();
- QHttpNetworkRequest httpRequest = pair.first;
- QHttpNetworkReply *httpReply = pair.second;
- Q_ASSERT(httpReply != 0);
-
- QHttpNetworkReplyPrivate *replyPrivate = httpReply->d_func();
-
- if (replyPrivate->state == QHttpNetworkReplyPrivate::SPDYClosed) {
- sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED);
- return;
- }
-
- // check whether we need to send WINDOW_UPDATE (i.e. tell the sender it can send more)
- replyPrivate->currentlyReceivedDataInWindow += length;
- qint32 dataLeftInWindow = replyPrivate->windowSizeDownload - replyPrivate->currentlyReceivedDataInWindow;
-
- if (replyPrivate->currentlyReceivedDataInWindow > 0
- && dataLeftInWindow < replyPrivate->windowSizeDownload / 2) {
-
- // socket read buffer size is 64K actually, hard coded in the channel
- // We can read way more than 64K per socket, because the window size
- // here is per stream.
- if (replyPrivate->windowSizeDownload >= m_socket->readBufferSize()) {
- replyPrivate->windowSizeDownload = m_socket->readBufferSize();
- } else {
- replyPrivate->windowSizeDownload *= 1.5;
- }
- QMetaObject::invokeMethod(this, "sendWINDOW_UPDATE", Qt::QueuedConnection,
- Q_ARG(qint32, streamID),
- Q_ARG(quint32, replyPrivate->windowSizeDownload));
- // setting the current data count to 0 is a race condition,
- // because we call sendWINDOW_UPDATE through the event loop.
- // But then again, the whole situation is a race condition because
- // we don't know when the packet will arrive at the server; so
- // this is most likely good enough here.
- replyPrivate->currentlyReceivedDataInWindow = 0;
- }
-
- httpReply->d_func()->compressedData.append(data);
-
-
- replyPrivate->totalProgress += length;
-
- if (httpRequest.d->autoDecompress && httpReply->d_func()->isCompressed()) {
- QByteDataBuffer inDataBuffer; // ### should we introduce one in the http reply?
- inDataBuffer.append(data);
- qint64 compressedCount = httpReply->d_func()->uncompressBodyData(&inDataBuffer,
- &replyPrivate->responseData);
- Q_ASSERT(compressedCount >= 0);
- Q_UNUSED(compressedCount); // silence -Wunused-variable
- } else {
- replyPrivate->responseData.append(data);
- }
-
- if (replyPrivate->shouldEmitSignals()) {
- emit httpReply->readyRead();
- emit httpReply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength);
- }
-
- if (flag_compress) {
- qWarning("SPDY level compression is not supported");
- }
-
- if (flag_fin) {
- if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed)
- sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0);
- replyFinished(httpReply, streamID);
- }
-}
-
-void QSpdyProtocolHandler::replyFinished(QHttpNetworkReply *httpReply, qint32 streamID)
-{
- httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;
- httpReply->disconnect(this);
- if (httpReply->request().uploadByteDevice())
- httpReply->request().uploadByteDevice()->disconnect(this);
- int streamsRemoved = m_inFlightStreams.remove(streamID);
- Q_ASSERT(streamsRemoved == 1);
- Q_UNUSED(streamsRemoved); // silence -Wunused-variable
- emit httpReply->finished();
-}
-
-void QSpdyProtocolHandler::replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID,
- QNetworkReply::NetworkError errorCode, const char *errorMessage)
-{
- Q_ASSERT(httpReply);
- httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed;
- httpReply->disconnect(this);
- if (httpReply->request().uploadByteDevice())
- httpReply->request().uploadByteDevice()->disconnect(this);
- int streamsRemoved = m_inFlightStreams.remove(streamID);
- Q_ASSERT(streamsRemoved == 1);
- Q_UNUSED(streamsRemoved); // silence -Wunused-variable
- emit httpReply->finishedWithError(errorCode, QSpdyProtocolHandler::tr(errorMessage));
-}
-
-qint32 QSpdyProtocolHandler::generateNextStreamID()
-{
- // stream IDs initiated by the client must be odd
- m_nextStreamID += 2;
- return m_nextStreamID;
-}
-
-QT_END_NAMESPACE
-
-#endif // !defined(QT_NO_SSL)
diff --git a/src/network/access/qspdyprotocolhandler_p.h b/src/network/access/qspdyprotocolhandler_p.h
deleted file mode 100644
index 14e2ff388a..0000000000
--- a/src/network/access/qspdyprotocolhandler_p.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork 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$
-**
-****************************************************************************/
-
-#ifndef QSPDYPROTOCOLHANDLER_H
-#define QSPDYPROTOCOLHANDLER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the Network Access API. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include <private/qabstractprotocolhandler_p.h>
-#include <QtNetwork/qnetworkreply.h>
-#include <private/qbytedata_p.h>
-
-#include <zlib.h>
-
-QT_REQUIRE_CONFIG(http);
-
-#if !defined(QT_NO_SSL)
-
-QT_BEGIN_NAMESPACE
-
-class QHttpNetworkRequest;
-
-#ifndef HttpMessagePair
-typedef QPair<QHttpNetworkRequest, QHttpNetworkReply*> HttpMessagePair;
-#endif
-
-class QSpdyProtocolHandler : public QObject, public QAbstractProtocolHandler {
- Q_OBJECT
-public:
- QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channel);
- ~QSpdyProtocolHandler();
-
- enum DataFrameFlag {
- DataFrame_FLAG_FIN = 0x01,
- DataFrame_FLAG_COMPRESS = 0x02
- };
-
- Q_DECLARE_FLAGS(DataFrameFlags, DataFrameFlag)
-
- enum ControlFrameFlag {
- ControlFrame_FLAG_FIN = 0x01,
- ControlFrame_FLAG_UNIDIRECTIONAL = 0x02
- };
-
- Q_DECLARE_FLAGS(ControlFrameFlags, ControlFrameFlag)
-
- enum SETTINGS_Flag {
- FLAG_SETTINGS_CLEAR_SETTINGS = 0x01
- };
-
- Q_DECLARE_FLAGS(SETTINGS_Flags, SETTINGS_Flag)
-
- enum SETTINGS_ID_Flag {
- FLAG_SETTINGS_PERSIST_VALUE = 0x01,
- FLAG_SETTINGS_PERSISTED = 0x02
- };
-
- Q_DECLARE_FLAGS(SETTINGS_ID_Flags, SETTINGS_ID_Flag)
-
- virtual void _q_receiveReply() override;
- virtual void _q_readyRead() override;
- virtual bool sendRequest() override;
-
-private slots:
- void _q_uploadDataReadyRead();
- void _q_replyDestroyed(QObject*);
- void _q_uploadDataDestroyed(QObject *);
-
-private:
-
- enum FrameType {
- FrameType_SYN_STREAM = 1,
- FrameType_SYN_REPLY = 2,
- FrameType_RST_STREAM = 3,
- FrameType_SETTINGS = 4,
- FrameType_PING = 6,
- FrameType_GOAWAY = 7,
- FrameType_HEADERS = 8,
- FrameType_WINDOW_UPDATE = 9,
- FrameType_CREDENTIAL // has a special type
- };
-
- enum StatusCode {
- StatusCode_PROTOCOL_ERROR = 1,
- StatusCode_INVALID_STREAM = 2,
- StatusCode_REFUSED_STREAM = 3,
- StatusCode_UNSUPPORTED_VERSION = 4,
- StatusCode_CANCEL = 5,
- StatusCode_INTERNAL_ERROR = 6,
- StatusCode_FLOW_CONTROL_ERROR = 7,
- StatusCode_STREAM_IN_USE = 8,
- StatusCode_STREAM_ALREADY_CLOSED = 9,
- StatusCode_INVALID_CREDENTIALS = 10,
- StatusCode_FRAME_TOO_LARGE = 11
- };
-
- enum SETTINGS_ID {
- SETTINGS_UPLOAD_BANDWIDTH = 1,
- SETTINGS_DOWNLOAD_BANDWIDTH = 2,
- SETTINGS_ROUND_TRIP_TIME = 3,
- SETTINGS_MAX_CONCURRENT_STREAMS = 4,
- SETTINGS_CURRENT_CWND = 5,
- SETTINGS_DOWNLOAD_RETRANS_RATE = 6,
- SETTINGS_INITIAL_WINDOW_SIZE = 7,
- SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE = 8
- };
-
- enum GOAWAY_STATUS {
- GOAWAY_OK = 0,
- GOAWAY_PROTOCOL_ERROR = 1,
- GOAWAY_INTERNAL_ERROR = 11
- };
-
- enum RST_STREAM_STATUS_CODE {
- RST_STREAM_PROTOCOL_ERROR = 1,
- RST_STREAM_INVALID_STREAM = 2,
- RST_STREAM_REFUSED_STREAM = 3,
- RST_STREAM_UNSUPPORTED_VERSION = 4,
- RST_STREAM_CANCEL = 5,
- RST_STREAM_INTERNAL_ERROR = 6,
- RST_STREAM_FLOW_CONTROL_ERROR = 7,
- RST_STREAM_STREAM_IN_USE = 8,
- RST_STREAM_STREAM_ALREADY_CLOSED = 9,
- RST_STREAM_INVALID_CREDENTIALS = 10,
- RST_STREAM_FRAME_TOO_LARGE = 11
- };
-
- quint64 bytesAvailable() const;
- bool readNextChunk(qint64 length, char *sink);
-
- void sendControlFrame(FrameType type, ControlFrameFlags flags, const char *data, quint32 length);
-
- void sendSYN_STREAM(const HttpMessagePair &pair, qint32 streamID,
- qint32 associatedToStreamID);
- void sendRST_STREAM(qint32 streamID, RST_STREAM_STATUS_CODE statusCode);
- void sendPING(quint32 pingID);
-
- bool uploadData(qint32 streamID);
- Q_INVOKABLE void sendWINDOW_UPDATE(qint32 streamID, quint32 deltaWindowSize);
-
- qint64 sendDataFrame(qint32 streamID, DataFrameFlags flags, quint32 length,
- const char *data);
-
- QByteArray composeHeader(const QHttpNetworkRequest &request);
- bool uncompressHeader(const QByteArray &input, QByteArray *output);
-
- void handleControlFrame(const QByteArray &frameHeaders);
- void handleDataFrame(const QByteArray &frameHeaders);
-
- void handleSYN_STREAM(char, quint32, const QByteArray &frameData);
- void handleSYN_REPLY(char flags, quint32, const QByteArray &frameData);
- void handleRST_STREAM(char flags, quint32 length, const QByteArray &frameData);
- void handleSETTINGS(char flags, quint32 length, const QByteArray &frameData);
- void handlePING(char, quint32 length, const QByteArray &frameData);
- void handleGOAWAY(char flags, quint32, const QByteArray &frameData);
- void handleHEADERS(char flags, quint32, const QByteArray &frameData);
- void handleWINDOW_UPDATE(char, quint32, const QByteArray &frameData);
-
- qint32 generateNextStreamID();
- void parseHttpHeaders(char flags, const QByteArray &frameData);
-
- void replyFinished(QHttpNetworkReply *httpReply, qint32 streamID);
- void replyFinishedWithError(QHttpNetworkReply *httpReply, qint32 streamID,
- QNetworkReply::NetworkError errorCode, const char *errorMessage);
-
- qint32 m_nextStreamID;
- QHash<quint32, HttpMessagePair> m_inFlightStreams;
- qint32 m_maxConcurrentStreams;
- quint32 m_initialWindowSize;
- QByteDataBuffer m_spdyBuffer;
- bool m_waitingForCompleteStream;
- z_stream m_deflateStream;
- z_stream m_inflateStream;
- QHash<QObject *, qint32> m_streamIDs;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::DataFrameFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::ControlFrameFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_Flags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_ID_Flags)
-
-QT_END_NAMESPACE
-
-#endif // !defined(QT_NO_SSL)
-
-#endif // QSPDYPROTOCOLHANDLER_H
diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri
index d58d5ec168..bcb7a5971e 100644
--- a/src/network/bearer/bearer.pri
+++ b/src/network/bearer/bearer.pri
@@ -6,11 +6,14 @@ HEADERS += bearer/qnetworkconfiguration.h \
bearer/qnetworkconfigmanager_p.h \
bearer/qnetworkconfiguration_p.h \
bearer/qnetworksession_p.h \
+ bearer/qnetworksession_impl_p.h \
bearer/qbearerengine_p.h \
+ bearer/qbearerengine_impl_p.h \
bearer/qbearerplugin_p.h \
bearer/qsharednetworksession_p.h
SOURCES += bearer/qnetworksession.cpp \
+ bearer/qnetworksession_impl.cpp \
bearer/qnetworkconfigmanager.cpp \
bearer/qnetworkconfiguration.cpp \
bearer/qnetworkconfigmanager_p.cpp \
diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/network/bearer/qbearerengine_impl_p.h
index 5c003aaaf6..4221b73276 100644
--- a/src/plugins/bearer/qbearerengine_impl.h
+++ b/src/network/bearer/qbearerengine_impl_p.h
@@ -42,9 +42,11 @@
#include <QtNetwork/private/qbearerengine_p.h>
+#ifndef QT_NO_BEARERMANAGEMENT
+
QT_BEGIN_NAMESPACE
-class QBearerEngineImpl : public QBearerEngine
+class Q_NETWORK_EXPORT QBearerEngineImpl : public QBearerEngine
{
Q_OBJECT
@@ -78,4 +80,6 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QBearerEngineImpl::ConnectionError)
+#endif // QT_NO_BEARERMANAGEMENT
+
#endif // QBEARERENGINE_IMPL_H
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/network/bearer/qnetworksession_impl.cpp
index c6b678ab20..4b8631d4db 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/network/bearer/qnetworksession_impl.cpp
@@ -40,8 +40,8 @@
// see comment in ../platformdefs_win.h.
#define WIN32_LEAN_AND_MEAN 1
-#include "qnetworksession_impl.h"
-#include "qbearerengine_impl.h"
+#include "qnetworksession_impl_p.h"
+#include "qbearerengine_impl_p.h"
#include <QtNetwork/qnetworksession.h>
#include <QtNetwork/private/qnetworkconfigmanager_p.h>
@@ -51,6 +51,8 @@
#include <QtCore/qmutex.h>
#include <QtCore/qstringlist.h>
+#ifndef QT_NO_BEARERMANAGEMENT
+
QT_BEGIN_NAMESPACE
static QBearerEngineImpl *getEngineFromId(const QString &id)
@@ -433,3 +435,5 @@ void QNetworkSessionPrivateImpl::decrementTimeout()
QT_END_NAMESPACE
#include "qnetworksession_impl.moc"
+
+#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/network/bearer/qnetworksession_impl_p.h
index 0f8e014900..b174760152 100644
--- a/src/plugins/bearer/qnetworksession_impl.h
+++ b/src/network/bearer/qnetworksession_impl_p.h
@@ -51,16 +51,18 @@
// We mean it.
//
-#include "qbearerengine_impl.h"
+#include "qbearerengine_impl_p.h"
#include <QtNetwork/private/qnetworkconfigmanager_p.h>
#include <QtNetwork/private/qnetworksession_p.h>
+#ifndef QT_NO_BEARERMANAGEMENT
+
QT_BEGIN_NAMESPACE
class QBearerEngineImpl;
-class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
+class Q_NETWORK_EXPORT QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
{
Q_OBJECT
@@ -127,4 +129,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_BEARERMANAGEMENT
+
#endif // QNETWORKSESSION_IMPL_H
diff --git a/src/network/kernel/qnetworkinterface.h b/src/network/kernel/qnetworkinterface.h
index 4caedaa38f..c65ea58860 100644
--- a/src/network/kernel/qnetworkinterface.h
+++ b/src/network/kernel/qnetworkinterface.h
@@ -50,7 +50,6 @@
QT_BEGIN_NAMESPACE
class QDeadlineTimer;
-template<typename T> class QList;
class QNetworkAddressEntryPrivate;
class Q_NETWORK_EXPORT QNetworkAddressEntry
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index a2e694ec92..738c8d4ac5 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -54,7 +54,6 @@ const QSsl::SslOptions QSslConfigurationPrivate::defaultSslOptions = QSsl::SslOp
|QSsl::SslOptionDisableSessionPersistence;
const char QSslConfiguration::ALPNProtocolHTTP2[] = "h2";
-const char QSslConfiguration::NextProtocolSpdy3_0[] = "spdy/3";
const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1";
/*!
@@ -134,12 +133,6 @@ const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1";
*/
/*!
- \variable QSslConfiguration::NextProtocolSpdy3_0
- \brief The value used for negotiating SPDY 3.0 during the Next
- Protocol Negotiation.
-*/
-
-/*!
\variable QSslConfiguration::NextProtocolHttp1_1
\brief The value used for negotiating HTTP 1.1 during the Next
Protocol Negotiation.
@@ -1033,7 +1026,7 @@ QByteArray QSslConfiguration::nextNegotiatedProtocol() const
Whether or not the negotiation succeeded can be queried through
nextProtocolNegotiationStatus().
- \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), allowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1
+ \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), allowedNextProtocols(), QSslConfiguration::NextProtocolHttp1_1
*/
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QSslConfiguration::setAllowedNextProtocols(const QList<QByteArray> &protocols)
@@ -1051,7 +1044,7 @@ void QSslConfiguration::setAllowedNextProtocols(QList<QByteArray> protocols)
server through the Next Protocol Negotiation (NPN) or Application-Layer
Protocol Negotiation (ALPN) TLS extension, as set by setAllowedNextProtocols().
- \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), setAllowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1
+ \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), setAllowedNextProtocols(), QSslConfiguration::NextProtocolHttp1_1
*/
QList<QByteArray> QSslConfiguration::allowedNextProtocols() const
{
diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h
index 247f3aecc9..ad6e23638f 100644
--- a/src/network/ssl/qsslconfiguration.h
+++ b/src/network/ssl/qsslconfiguration.h
@@ -66,7 +66,6 @@
QT_BEGIN_NAMESPACE
-template<typename T> class QList;
class QSslCertificate;
class QSslCipher;
class QSslKey;
@@ -193,7 +192,6 @@ public:
NextProtocolNegotiationStatus nextProtocolNegotiationStatus() const;
static const char ALPNProtocolHTTP2[];
- static const char NextProtocolSpdy3_0[];
static const char NextProtocolHttp1_1[];
private:
diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp
index 39c1ce55e3..cb0e86fa1f 100644
--- a/src/network/ssl/qsslsocket_winrt.cpp
+++ b/src/network/ssl/qsslsocket_winrt.cpp
@@ -275,7 +275,7 @@ void QSslSocketBackendPrivate::startClientEncryption()
}
// Sync custom certificates
- const QSet<QSslCertificate> caCertificates = configuration.caCertificates.toSet();
+ const QSet<QSslCertificate> caCertificates(configuration.caCertificates.constBegin(), configuration.caCertificates.constEnd());
const QSet<QSslCertificate> newCertificates = caCertificates - previousCaCertificates;
const QSet<QSslCertificate> oldCertificates = previousCaCertificates - caCertificates;
g->syncCaCertificates(newCertificates, oldCertificates);
@@ -398,7 +398,7 @@ void QSslSocketBackendPrivate::continueHandshake()
hr = control2->get_IgnorableServerCertificateErrors(&ignoreList);
Q_ASSERT_SUCCEEDED(hr);
- QSet<QSslError> ignoreErrors = ignoreErrorsList.toSet();
+ QSet<QSslError> ignoreErrors(ignoreErrorsList.constBegin(), ignoreErrorsList.constEnd());
for (int i = ChainValidationResult_Untrusted; i < ChainValidationResult_OtherErrors + 1; ++i) {
// Populate the native ignore list - break to add, continue to skip
switch (i) {
@@ -601,7 +601,7 @@ HRESULT QSslSocketBackendPrivate::onSslUpgrade(IAsyncAction *action, AsyncStatus
}
}
- sslErrors = errors.toList();
+ sslErrors = QList<QSslError>(errors.constBegin(), errors.constEnd());
// Peer validation
if (!configuration.peerCertificate.isNull()) {
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
index 8c6cc8fbc1..10f17f0258 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
@@ -1354,50 +1354,65 @@ static inline FT_Matrix QTransformToFTMatrix(const QTransform &matrix)
return m;
}
-QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix)
+QFontEngineFT::QGlyphSet *QFontEngineFT::TransformedGlyphSets::findSet(const QTransform &matrix, const QFontDef &fontDef)
{
- if (matrix.type() > QTransform::TxShear || !cacheEnabled)
- return 0;
-
- // FT_Set_Transform only supports scalable fonts
- if (!FT_IS_SCALABLE(freetype->face))
- return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : nullptr;
-
FT_Matrix m = QTransformToFTMatrix(matrix);
- QGlyphSet *gs = 0;
-
- for (int i = 0; i < transformedGlyphSets.count(); ++i) {
- const QGlyphSet &g = transformedGlyphSets.at(i);
- if (g.transformationMatrix.xx == m.xx
- && g.transformationMatrix.xy == m.xy
- && g.transformationMatrix.yx == m.yx
- && g.transformationMatrix.yy == m.yy) {
+ int i = 0;
+ for (; i < nSets; ++i) {
+ QGlyphSet *g = sets[i];
+ if (!g)
+ break;
+ if (g->transformationMatrix.xx == m.xx
+ && g->transformationMatrix.xy == m.xy
+ && g->transformationMatrix.yx == m.yx
+ && g->transformationMatrix.yy == m.yy) {
// found a match, move it to the front
- transformedGlyphSets.move(i, 0);
- gs = &transformedGlyphSets[0];
- break;
+ moveToFront(i);
+ return g;
}
}
- if (!gs) {
- // don't cache more than 10 transformations
- if (transformedGlyphSets.count() >= 10) {
- transformedGlyphSets.move(transformedGlyphSets.size() - 1, 0);
- } else {
- transformedGlyphSets.prepend(QGlyphSet());
- }
- gs = &transformedGlyphSets[0];
- gs->clear();
- gs->transformationMatrix = m;
- gs->outline_drawing = fontDef.pixelSize * fontDef.pixelSize * qAbs(matrix.determinant()) > QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
- }
+ // don't cache more than nSets transformations
+ if (i == nSets)
+ // reuse the last set
+ --i;
+ moveToFront(nSets - 1);
+ if (!sets[0])
+ sets[0] = new QGlyphSet;
+ QGlyphSet *gs = sets[0];
+ gs->clear();
+ gs->transformationMatrix = m;
+ gs->outline_drawing = fontDef.pixelSize * fontDef.pixelSize * qAbs(matrix.determinant()) > QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
Q_ASSERT(gs != 0);
return gs;
}
+void QFontEngineFT::TransformedGlyphSets::moveToFront(int i)
+{
+ QGlyphSet *g = sets[i];
+ while (i > 0) {
+ sets[i] = sets[i - 1];
+ --i;
+ }
+ sets[0] = g;
+}
+
+
+QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix)
+{
+ if (matrix.type() > QTransform::TxShear || !cacheEnabled)
+ return 0;
+
+ // FT_Set_Transform only supports scalable fonts
+ if (!FT_IS_SCALABLE(freetype->face))
+ return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : nullptr;
+
+ return transformedGlyphSets.findSet(matrix, fontDef);
+}
+
void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
{
FT_Face face = lockFace(Unscaled);
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
index 2e3aef6979..8019588bf5 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
@@ -63,6 +63,8 @@
#include <qmutex.h>
+#include <string.h>
+
QT_BEGIN_NAMESPACE
class QFontEngineFTRawFont;
@@ -170,6 +172,7 @@ public:
inline bool isGlyphMissing(glyph_t index) const { return missing_glyphs.contains(index); }
inline void setGlyphMissing(glyph_t index) const { missing_glyphs.insert(index); }
private:
+ Q_DISABLE_COPY(QGlyphSet);
mutable QHash<GlyphAndSubPixelPosition, Glyph *> glyph_data; // maps from glyph index to glyph data
mutable QSet<glyph_t> missing_glyphs;
mutable Glyph *fast_glyph_data[256]; // for fast lookup of glyphs < 256
@@ -310,7 +313,18 @@ private:
GlyphFormat defaultFormat;
FT_Matrix matrix;
- QList<QGlyphSet> transformedGlyphSets;
+ struct TransformedGlyphSets {
+ enum { nSets = 10 };
+ QGlyphSet *sets[nSets];
+
+ QGlyphSet *findSet(const QTransform &matrix, const QFontDef &fontDef);
+ TransformedGlyphSets() { std::fill(&sets[0], &sets[nSets], nullptr); }
+ ~TransformedGlyphSets() { qDeleteAll(&sets[0], &sets[nSets]); }
+ private:
+ void moveToFront(int i);
+ Q_DISABLE_COPY(TransformedGlyphSets);
+ };
+ TransformedGlyphSets transformedGlyphSets;
mutable QGlyphSet defaultGlyphSet;
QFontEngine::FaceId face_id;
@@ -326,6 +340,9 @@ private:
QFixed scalableBitmapScaleFactor;
};
+Q_DECLARE_TYPEINFO(QFontEngineFT::QGlyphSet, Q_MOVABLE_TYPE);
+
+
inline uint qHash(const QFontEngineFT::GlyphAndSubPixelPosition &g)
{
return (g.glyph << 8) | (g.subPixelPosition * 10).round().toInt();
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 6121faf362..06d1251a65 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -387,7 +387,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
drmFormat = DRM_FORMAT_XRGB8888;
drmFormatExplicit = false;
}
- qCDebug(qLcKmsDebug) << "Format is" << hex << drmFormat << dec << "requested_by_user =" << drmFormatExplicit
+ qCDebug(qLcKmsDebug) << "Format is" << Qt::hex << drmFormat << Qt::dec << "requested_by_user =" << drmFormatExplicit
<< "for output" << connectorName;
const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString();
diff --git a/src/platformsupport/linuxofono/linuxofono.pro b/src/platformsupport/linuxofono/linuxofono.pro
new file mode 100644
index 0000000000..1bc5b10225
--- /dev/null
+++ b/src/platformsupport/linuxofono/linuxofono.pro
@@ -0,0 +1,15 @@
+TARGET = QtLinuxOfonoSupport
+MODULE = linuxofono_support
+
+QT = core dbus
+CONFIG += static internal_module
+
+DEFINES += QT_NO_CAST_FROM_ASCII
+
+HEADERS += \
+ qofonoservice_linux_p.h
+
+SOURCES += \
+ qofonoservice_linux.cpp
+
+load(qt_module)
diff --git a/src/plugins/bearer/linux_common/qofonoservice_linux.cpp b/src/platformsupport/linuxofono/qofonoservice_linux.cpp
index 05f9b3ca17..792c703966 100644
--- a/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
+++ b/src/platformsupport/linuxofono/qofonoservice_linux.cpp
@@ -148,7 +148,7 @@ QOfonoModemInterface::QOfonoModemInterface(const QString &dbusPathName, QObject
{
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
path(),
- OFONO_MODEM_INTERFACE,
+ QLatin1String(OFONO_MODEM_INTERFACE),
QLatin1String("PropertyChanged"),
this,SLOT(propertyChanged(QString,QDBusVariant)));
}
diff --git a/src/plugins/bearer/linux_common/qofonoservice_linux_p.h b/src/platformsupport/linuxofono/qofonoservice_linux_p.h
index 62df5d4fa7..62df5d4fa7 100644
--- a/src/plugins/bearer/linux_common/qofonoservice_linux_p.h
+++ b/src/platformsupport/linuxofono/qofonoservice_linux_p.h
diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro
index 6d4f1b93bd..0b2dd8974b 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -45,3 +45,7 @@ darwin {
qtConfig(vulkan): \
SUBDIRS += vkconvenience
+
+!android:linux*:qtHaveModule(dbus) \
+ SUBDIRS += linuxofono
+
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp
index 82a13d2fa0..a3c9746869 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp
@@ -48,7 +48,9 @@
#include <QDebug>
#include <QtEndian>
#include <QBuffer>
-#include <private/qkeysequence_p.h>
+#if QT_CONFIG(shortcut)
+# include <private/qkeysequence_p.h>
+#endif
#include <qpa/qplatformmenu.h>
#include "qdbusplatformmenu_p.h"
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
index 8a31f82fb0..aa0f303416 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
@@ -96,7 +96,7 @@ public:
void setChecked(bool isChecked) override;
bool hasExclusiveGroup() const { return m_hasExclusiveGroup; }
void setHasExclusiveGroup(bool hasExclusiveGroup) override;
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
QKeySequence shortcut() const { return m_shortcut; }
void setShortcut(const QKeySequence& shortcut) override;
#endif
@@ -123,7 +123,9 @@ private:
bool m_hasExclusiveGroup : 1;
short /*unused*/ : 6;
short m_dbusID : 16;
+#if QT_CONFIG(shortcut)
QKeySequence m_shortcut;
+#endif
};
class QDBusPlatformMenu : public QPlatformMenu
diff --git a/src/plugins/bearer/android/src/qandroidbearerengine.cpp b/src/plugins/bearer/android/src/qandroidbearerengine.cpp
index a43ed69570..ad9895e0cf 100644
--- a/src/plugins/bearer/android/src/qandroidbearerengine.cpp
+++ b/src/plugins/bearer/android/src/qandroidbearerengine.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qandroidbearerengine.h"
-#include "../../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include "wrappers/androidconnectivitymanager.h"
#ifndef QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/android/src/qandroidbearerengine.h b/src/plugins/bearer/android/src/qandroidbearerengine.h
index 837b02232d..867d04d886 100644
--- a/src/plugins/bearer/android/src/qandroidbearerengine.h
+++ b/src/plugins/bearer/android/src/qandroidbearerengine.h
@@ -40,7 +40,7 @@
#ifndef QANDROIDBEARERENGINE_H
#define QANDROIDBEARERENGINE_H
-#include "../../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include <QAbstractEventDispatcher>
#include <QAbstractNativeEventFilter>
diff --git a/src/plugins/bearer/android/src/src.pro b/src/plugins/bearer/android/src/src.pro
index eb0738386c..fcd599dffe 100644
--- a/src/plugins/bearer/android/src/src.pro
+++ b/src/plugins/bearer/android/src/src.pro
@@ -2,13 +2,10 @@ TARGET = qandroidbearer
QT = core-private network-private
-HEADERS += qandroidbearerengine.h \
- ../../qnetworksession_impl.h \
- ../../qbearerengine_impl.h
+HEADERS += qandroidbearerengine.h
SOURCES += main.cpp \
- qandroidbearerengine.cpp \
- ../../qnetworksession_impl.cpp
+ qandroidbearerengine.cpp
include(wrappers/wrappers.pri)
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 065ed11dad..03e94cfe6a 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -1,18 +1,13 @@
TARGET = qconnmanbearer
-QT = core network-private dbus
+QT = core network-private dbus linuxofono_support_private
HEADERS += qconnmanservice_linux_p.h \
- ../linux_common/qofonoservice_linux_p.h \
- qconnmanengine.h \
- ../qnetworksession_impl.h \
- ../qbearerengine_impl.h
+ qconnmanengine.h
SOURCES += main.cpp \
qconnmanservice_linux.cpp \
- ../linux_common/qofonoservice_linux.cpp \
- qconnmanengine.cpp \
- ../qnetworksession_impl.cpp
+ qconnmanengine.cpp
OTHER_FILES += connman.json
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 8b2076bd18..a673834825 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -39,7 +39,7 @@
#include "qconnmanengine.h"
#include "qconnmanservice_linux_p.h"
-#include "../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include <QtNetwork/private/qnetworkconfiguration_p.h>
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index ef80d38fa2..969eed45b1 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -51,10 +51,10 @@
// We mean it.
//
-#include "../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include "qconnmanservice_linux_p.h"
-#include "../linux_common/qofonoservice_linux_p.h"
+#include <private/qofonoservice_linux_p.h>
#include <QMap>
#include <QVariant>
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index 1dc09ebdd6..4f08eaba71 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -7,12 +7,9 @@ qtConfig(corewlan) {
LIBS += -framework CoreWLAN -framework Security
}
-HEADERS += qcorewlanengine.h \
- ../qnetworksession_impl.h \
- ../qbearerengine_impl.h
+HEADERS += qcorewlanengine.h
-SOURCES += main.cpp \
- ../qnetworksession_impl.cpp
+SOURCES += main.cpp
OBJECTIVE_SOURCES += qcorewlanengine.mm
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 6dddee66a4..8775474c09 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -40,7 +40,7 @@
#ifndef QCOREWLANENGINE_H
#define QCOREWLANENGINE_H
-#include "../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include <QMap>
#include <QTimer>
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 66f2ed017b..01c6df74d5 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qcorewlanengine.h"
-#include "../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include <QtNetwork/private/qnetworkconfiguration_p.h>
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index f30bdc4951..14b858b301 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -3,11 +3,8 @@ TARGET = qgenericbearer
QT = core-private network-private
HEADERS += qgenericengine.h \
- ../qnetworksession_impl.h \
- ../qbearerengine_impl.h \
../platformdefs_win.h
SOURCES += qgenericengine.cpp \
- ../qnetworksession_impl.cpp \
main.cpp
OTHER_FILES += generic.json
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index b1f28849a7..a5fba15789 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -41,7 +41,7 @@
#define WIN32_LEAN_AND_MEAN 1
#include "qgenericengine.h"
-#include "../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include <QtNetwork/private/qnetworkconfiguration_p.h>
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index 79c71ca7a3..6b8fb4cd0f 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -40,7 +40,7 @@
#ifndef QGENERICENGINE_H
#define QGENERICENGINE_H
-#include "../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include <QMap>
#include <QTimer>
diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro
index da7f2da353..41bde99341 100644
--- a/src/plugins/bearer/nativewifi/nativewifi.pro
+++ b/src/plugins/bearer/nativewifi/nativewifi.pro
@@ -3,13 +3,10 @@ TARGET = qnativewifibearer
QT = core-private network-private
HEADERS += qnativewifiengine.h \
- platformdefs.h \
- ../qnetworksession_impl.h \
- ../qbearerengine_impl.h
+ platformdefs.h
SOURCES += main.cpp \
- qnativewifiengine.cpp \
- ../qnetworksession_impl.cpp
+ qnativewifiengine.cpp
OTHER_FILES += nativewifi.json
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index 777b4eea59..ca8700e63b 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -39,7 +39,7 @@
#include "qnativewifiengine.h"
#include "platformdefs.h"
-#include "../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include <QtNetwork/private/qnetworkconfiguration_p.h>
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index ab8d949c9a..24e97bf6df 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include <QtCore/qtimer.h>
diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro
index e71c93f66f..3ca217f974 100644
--- a/src/plugins/bearer/networkmanager/networkmanager.pro
+++ b/src/plugins/bearer/networkmanager/networkmanager.pro
@@ -1,18 +1,13 @@
TARGET = qnmbearer
-QT = core network-private dbus
+QT = core network-private dbus linuxofono_support_private
HEADERS += qnetworkmanagerservice.h \
- qnetworkmanagerengine.h \
- ../linux_common/qofonoservice_linux_p.h \
- ../qnetworksession_impl.h \
- ../qbearerengine_impl.h
+ qnetworkmanagerengine.h
SOURCES += main.cpp \
qnetworkmanagerservice.cpp \
- qnetworkmanagerengine.cpp \
- ../linux_common/qofonoservice_linux.cpp \
- ../qnetworksession_impl.cpp
+ qnetworkmanagerengine.cpp
OTHER_FILES += networkmanager.json
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index e74b1cf744..2fb5b2efbc 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -39,7 +39,7 @@
#include "qnetworkmanagerengine.h"
#include "qnetworkmanagerservice.h"
-#include "../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include <QtNetwork/private/qnetworkconfiguration_p.h>
@@ -53,7 +53,6 @@
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusReply>
-#include "../linux_common/qofonoservice_linux_p.h"
#ifndef QT_NO_DBUS
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index a95c68abdf..c624d6087d 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -51,11 +51,11 @@
// We mean it.
//
-#include "../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include "qnetworkmanagerservice.h"
-#include "../linux_common/qofonoservice_linux_p.h"
+#include <private/qofonoservice_linux_p.h>
#include <QMap>
#include <QVariant>
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
index 76f3279d25..2582dc7cd4 100644
--- a/src/plugins/bearer/nla/nla.pro
+++ b/src/plugins/bearer/nla/nla.pro
@@ -5,13 +5,10 @@ QT = core core-private network network-private
QMAKE_USE_PRIVATE += ws2_32
HEADERS += qnlaengine.h \
- ../platformdefs_win.h \
- ../qnetworksession_impl.h \
- ../qbearerengine_impl.h
+ ../platformdefs_win.h
SOURCES += main.cpp \
- qnlaengine.cpp \
- ../qnetworksession_impl.cpp
+ qnlaengine.cpp
OTHER_FILES += nla.json
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index e1e60389f1..ab3c0d0e3a 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qnlaengine.h"
-#include "../qnetworksession_impl.h"
+#include <private/qnetworksession_impl_p.h>
#include <QtNetwork/private/qnetworkconfiguration_p.h>
diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h
index ab014ff776..90efa50201 100644
--- a/src/plugins/bearer/nla/qnlaengine.h
+++ b/src/plugins/bearer/nla/qnlaengine.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "../qbearerengine_impl.h"
+#include <private/qbearerengine_impl_p.h>
#include <QtNetwork/private/qnativesocketengine_p.h>
diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro
index 730247cd7f..61cac51633 100644
--- a/src/plugins/platforms/android/android.pro
+++ b/src/plugins/platforms/android/android.pro
@@ -16,7 +16,6 @@ INCLUDEPATH += \
$$QT_SOURCE_TREE/src/3rdparty/android
SOURCES += $$PWD/main.cpp \
- $$PWD/androidplatformplugin.cpp \
$$PWD/androidcontentfileengine.cpp \
$$PWD/androiddeadlockprotector.cpp \
$$PWD/androidjnimain.cpp \
diff --git a/src/plugins/platforms/android/androidplatformplugin.cpp b/src/plugins/platforms/android/androidplatformplugin.cpp
deleted file mode 100644
index 297e167f47..0000000000
--- a/src/plugins/platforms/android/androidplatformplugin.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** 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/qplatformintegrationplugin.h>
-#include "qandroidplatformintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidPlatformIntegrationPlugin: public QPlatformIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "android.json")
-public:
- QPlatformIntegration *create(const QString &key, const QStringList &paramList) override;
-};
-
-
-QPlatformIntegration *QAndroidPlatformIntegrationPlugin::create(const QString &key, const QStringList &paramList)
-{
- Q_UNUSED(paramList);
- if (!key.compare(QLatin1String("android"), Qt::CaseInsensitive))
- return new QAndroidPlatformIntegration(paramList);
- return 0;
-}
-
-QT_END_NAMESPACE
-#include "androidplatformplugin.moc"
-
diff --git a/src/plugins/platforms/android/main.cpp b/src/plugins/platforms/android/main.cpp
index c304fc8d69..4841d0425c 100644
--- a/src/plugins/platforms/android/main.cpp
+++ b/src/plugins/platforms/android/main.cpp
@@ -61,3 +61,4 @@ QPlatformIntegration *QAndroidIntegrationPlugin::create(const QString& system, c
}
QT_END_NAMESPACE
+#include "main.moc"
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index bfc3bfe9de..0e2656e046 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -124,6 +124,8 @@ public:
void beep() const override;
+ void closePopups(QWindow *forWindow = nullptr);
+
private Q_SLOTS:
void focusWindowChanged(QWindow *);
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 9a2f19c2f2..67ad0b3492 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -487,6 +487,19 @@ void QCocoaIntegration::beep() const
NSBeep();
}
+void QCocoaIntegration::closePopups(QWindow *forWindow)
+{
+ for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) {
+ auto *popup = *it;
+ if (!forWindow || popup->window()->transientParent() == forWindow) {
+ it = m_popupWindowStack.erase(it);
+ QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(popup->window());
+ } else {
+ ++it;
+ }
+ }
+}
+
void QCocoaIntegration::focusWindowChanged(QWindow *focusWindow)
{
// Don't revert icon just because we lost focus
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index fef72bc496..1e46cd2dde 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -151,6 +151,7 @@ public:
Q_NOTIFICATION_HANDLER(NSWindowDidEndLiveResizeNotification) void windowDidEndLiveResize();
Q_NOTIFICATION_HANDLER(NSWindowDidBecomeKeyNotification) void windowDidBecomeKey();
Q_NOTIFICATION_HANDLER(NSWindowDidResignKeyNotification) void windowDidResignKey();
+ Q_NOTIFICATION_HANDLER(NSWindowWillMiniaturizeNotification) void windowWillMiniaturize();
Q_NOTIFICATION_HANDLER(NSWindowDidMiniaturizeNotification) void windowDidMiniaturize();
Q_NOTIFICATION_HANDLER(NSWindowDidDeminiaturizeNotification) void windowDidDeminiaturize();
Q_NOTIFICATION_HANDLER(NSWindowWillEnterFullScreenNotification) void windowWillEnterFullScreen();
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index a744a86695..f212b3e3f0 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -71,14 +71,6 @@ enum {
defaultWindowHeight = 160
};
-static void qt_closePopups()
-{
- while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) {
- QWindowSystemInterface::handleCloseEvent(popup->window());
- QWindowSystemInterface::flushWindowSystemEvents();
- }
-}
-
Q_LOGGING_CATEGORY(lcCocoaNotifications, "qt.qpa.cocoa.notifications");
static void qRegisterNotificationCallbacks()
@@ -800,6 +792,11 @@ void QCocoaWindow::windowDidExitFullScreen()
}
}
+void QCocoaWindow::windowWillMiniaturize()
+{
+ QCocoaIntegration::instance()->closePopups(window());
+}
+
void QCocoaWindow::windowDidMiniaturize()
{
if (!isContentView())
@@ -1138,7 +1135,7 @@ void QCocoaWindow::viewDidChangeGlobalFrame()
void QCocoaWindow::windowWillMove()
{
// Close any open popups on window move
- qt_closePopups();
+ QCocoaIntegration::instance()->closePopups();
}
void QCocoaWindow::windowDidMove()
@@ -1267,7 +1264,7 @@ void QCocoaWindow::windowWillClose()
{
// Close any open popups on window closing.
if (window() && !windowIsPopupType(window()->type()))
- qt_closePopups();
+ QCocoaIntegration::instance()->closePopups();
}
// ----------------------- NSWindowDelegate callbacks -----------------------
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index f2d31d5783..d9521e7e08 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -329,7 +329,7 @@ static inline bool
static void describeFormats(HDC hdc)
{
const int pfiMax = QOpenGLStaticContext::opengl32.describePixelFormat(hdc, 0, 0, nullptr);
- for (int i = 0; i < pfiMax; i++) {
+ for (int i = 1; i <= pfiMax; i++) {
PIXELFORMATDESCRIPTOR pfd;
initPixelFormatDescriptor(&pfd);
QOpenGLStaticContext::opengl32.describePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a4f4099aa6..5c13bd9650 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -269,7 +269,7 @@ QDebug operator<<(QDebug d, const GUID &guid)
static void formatBriefRectangle(QDebug &d, const QRect &r)
{
- d << r.width() << 'x' << r.height() << forcesign << r.x() << r.y() << noforcesign;
+ d << r.width() << 'x' << r.height() << Qt::forcesign << r.x() << r.y() << Qt::noforcesign;
}
static void formatBriefMargins(QDebug &d, const QMargins &m)
@@ -913,7 +913,7 @@ QMargins QWindowsGeometryHint::frameOnPrimaryScreen(DWORD style, DWORD exStyle)
const QMargins result(qAbs(rect.left), qAbs(rect.top),
qAbs(rect.right), qAbs(rect.bottom));
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style="
- << showbase << hex << style << " exStyle=" << exStyle << dec << noshowbase
+ << Qt::showbase << Qt::hex << style << " exStyle=" << exStyle << Qt::dec << Qt::noshowbase
<< ' ' << rect << ' ' << result;
return result;
}
diff --git a/src/plugins/styles/android/qandroidstyle.cpp b/src/plugins/styles/android/qandroidstyle.cpp
index 086df92322..1d0838daec 100644
--- a/src/plugins/styles/android/qandroidstyle.cpp
+++ b/src/plugins/styles/android/qandroidstyle.cpp
@@ -248,7 +248,7 @@ QAndroidStyle::ItemType QAndroidStyle::qtControl(QStyle::PrimitiveElement primit
case QStyle::PE_FrameLineEdit:
return QC_EditText;
- case QStyle::PE_IndicatorViewItemCheck:
+ case QStyle::PE_IndicatorItemViewItemCheck:
case QStyle::PE_IndicatorCheckBox:
return QC_Checkbox;
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 63dc49fd18..7fa330beab 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -3225,7 +3225,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
CGContextRestoreGState(cg);
break; }
- case PE_IndicatorViewItemCheck:
+ case PE_IndicatorItemViewItemCheck:
case PE_IndicatorRadioButton:
case PE_IndicatorCheckBox: {
const bool isEnabled = opt->state & State_Enabled;
diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp
index e7c444f5b9..8947ed1084 100644
--- a/src/sql/kernel/qsqlquery.cpp
+++ b/src/sql/kernel/qsqlquery.cpp
@@ -258,7 +258,7 @@ QSqlQuery::QSqlQuery(const QSqlQuery& other)
/*!
\internal
*/
-static void qInit(QSqlQuery *q, const QString& query, QSqlDatabase db)
+static void qInit(QSqlQuery *q, const QString& query, const QSqlDatabase &db)
{
QSqlDatabase database = db;
if (!database.isValid())
@@ -278,7 +278,7 @@ static void qInit(QSqlQuery *q, const QString& query, QSqlDatabase db)
\sa QSqlDatabase
*/
-QSqlQuery::QSqlQuery(const QString& query, QSqlDatabase db)
+QSqlQuery::QSqlQuery(const QString& query, const QSqlDatabase &db)
{
d = QSqlQueryPrivate::shared_null();
qInit(this, query, db);
@@ -291,7 +291,7 @@ QSqlQuery::QSqlQuery(const QString& query, QSqlDatabase db)
\sa QSqlDatabase
*/
-QSqlQuery::QSqlQuery(QSqlDatabase db)
+QSqlQuery::QSqlQuery(const QSqlDatabase &db)
{
d = QSqlQueryPrivate::shared_null();
qInit(this, QString(), db);
diff --git a/src/sql/kernel/qsqlquery.h b/src/sql/kernel/qsqlquery.h
index cbbc25c4ec..3be04c492c 100644
--- a/src/sql/kernel/qsqlquery.h
+++ b/src/sql/kernel/qsqlquery.h
@@ -59,8 +59,8 @@ class Q_SQL_EXPORT QSqlQuery
{
public:
explicit QSqlQuery(QSqlResult *r);
- explicit QSqlQuery(const QString& query = QString(), QSqlDatabase db = QSqlDatabase());
- explicit QSqlQuery(QSqlDatabase db);
+ explicit QSqlQuery(const QString& query = QString(), const QSqlDatabase &db = QSqlDatabase());
+ explicit QSqlQuery(const QSqlDatabase &db);
QSqlQuery(const QSqlQuery& other);
QSqlQuery& operator=(const QSqlQuery& other);
~QSqlQuery();
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index 34be010474..b0e26d7378 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -161,7 +161,7 @@ struct QRelation
class QRelatedTableModel : public QSqlTableModel
{
public:
- QRelatedTableModel(QRelation *rel, QObject *parent = 0, QSqlDatabase db = QSqlDatabase());
+ QRelatedTableModel(QRelation *rel, QObject *parent = 0, const QSqlDatabase &db = QSqlDatabase());
bool select() override;
private:
bool firstSelect;
@@ -245,7 +245,7 @@ bool QRelation::isValid()
-QRelatedTableModel::QRelatedTableModel(QRelation *rel, QObject *parent, QSqlDatabase db) :
+QRelatedTableModel::QRelatedTableModel(QRelation *rel, QObject *parent, const QSqlDatabase &db) :
QSqlTableModel(parent, db), firstSelect(true), relation(rel)
{
}
@@ -410,7 +410,7 @@ void QSqlRelationalTableModelPrivate::clearCache()
and the database connection to \a db. If \a db is not valid, the
default database connection will be used.
*/
-QSqlRelationalTableModel::QSqlRelationalTableModel(QObject *parent, QSqlDatabase db)
+QSqlRelationalTableModel::QSqlRelationalTableModel(QObject *parent, const QSqlDatabase &db)
: QSqlTableModel(*new QSqlRelationalTableModelPrivate, parent, db)
{
}
diff --git a/src/sql/models/qsqlrelationaltablemodel.h b/src/sql/models/qsqlrelationaltablemodel.h
index 1929bd320a..2ebadaabd1 100644
--- a/src/sql/models/qsqlrelationaltablemodel.h
+++ b/src/sql/models/qsqlrelationaltablemodel.h
@@ -91,7 +91,7 @@ public:
};
explicit QSqlRelationalTableModel(QObject *parent = nullptr,
- QSqlDatabase db = QSqlDatabase());
+ const QSqlDatabase &db = QSqlDatabase());
virtual ~QSqlRelationalTableModel();
QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const override;
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index ba8a6dea36..d6810cc6af 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -291,7 +291,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
The default edit strategy is \l OnRowChange.
*/
-QSqlTableModel::QSqlTableModel(QObject *parent, QSqlDatabase db)
+QSqlTableModel::QSqlTableModel(QObject *parent, const QSqlDatabase &db)
: QSqlQueryModel(*new QSqlTableModelPrivate, parent)
{
Q_D(QSqlTableModel);
@@ -300,7 +300,7 @@ QSqlTableModel::QSqlTableModel(QObject *parent, QSqlDatabase db)
/*! \internal
*/
-QSqlTableModel::QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent, QSqlDatabase db)
+QSqlTableModel::QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent, const QSqlDatabase &db)
: QSqlQueryModel(dd, parent)
{
Q_D(QSqlTableModel);
diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h
index eba27e60ec..1ac8bd9b04 100644
--- a/src/sql/models/qsqltablemodel.h
+++ b/src/sql/models/qsqltablemodel.h
@@ -62,7 +62,7 @@ class Q_SQL_EXPORT QSqlTableModel: public QSqlQueryModel
public:
enum EditStrategy {OnFieldChange, OnRowChange, OnManualSubmit};
- explicit QSqlTableModel(QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase());
+ explicit QSqlTableModel(QObject *parent = nullptr, const QSqlDatabase &db = QSqlDatabase());
virtual ~QSqlTableModel();
virtual void setTable(const QString &tableName);
@@ -127,7 +127,7 @@ Q_SIGNALS:
void beforeDelete(int row);
protected:
- QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase());
+ QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent = nullptr, const QSqlDatabase &db = QSqlDatabase());
virtual bool updateRowInTable(int row, const QSqlRecord &values);
virtual bool insertRowIntoTable(const QSqlRecord &values);
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp
index 9b7c2495d4..91258e9ec4 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -190,10 +190,20 @@ static QSet<QByteArray> activeConditions()
if (!distributionName.isEmpty()) {
if (result.find(distributionName) == result.end())
result.insert(distributionName);
+ // backwards compatibility with Qt 5
+ if (distributionName == "macos") {
+ if (result.find(distributionName) == result.end())
+ result.insert("osx");
+ }
if (!distributionRelease.isEmpty()) {
QByteArray versioned = distributionName + "-" + distributionRelease;
if (result.find(versioned) == result.end())
result.insert(versioned);
+ if (distributionName == "macos") {
+ QByteArray versioned = "osx-" + distributionRelease;
+ if (result.find(versioned) == result.end())
+ result.insert(versioned);
+ }
}
}
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index e8a7e0d5f5..1882c858c1 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -54,7 +54,9 @@
#include <QtGui/qguiapplication.h>
#include <QtGui/qwindow.h>
#include <QtGui/qevent.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qwidget.h>
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index 7101a2bf3c..5ede55ecf2 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -128,6 +128,7 @@ struct Options
, jarSigner(false)
, installApk(false)
, uninstallApk(false)
+ , qmlImportScannerBinaryPath()
{}
enum DeploymentMechanism
@@ -230,6 +231,9 @@ struct Options
QStringList initClasses;
QStringList permissions;
QStringList features;
+
+ // Override qml import scanner path
+ QString qmlImportScannerBinaryPath;
};
static const QHash<QByteArray, QByteArray> elfArchitecures = {
@@ -521,6 +525,8 @@ Options parseOptions()
options.jarSigner = true;
} else if (argument.compare(QLatin1String("--aux-mode"), Qt::CaseInsensitive) == 0) {
options.auxMode = true;
+ } else if (argument.compare(QLatin1String("--qml-importscanner-binary"), Qt::CaseInsensitive) == 0) {
+ options.qmlImportScannerBinaryPath = arguments.at(++i).trimmed();
}
}
@@ -604,6 +610,10 @@ void printHelp()
" dependencies into the build directory and update the XML templates.\n"
" The project will not be built or installed.\n"
" --apk <path/where/to/copy/the/apk>: Path where to copy the built apk.\n"
+ " --qml-importscanner-binary <path/to/qmlimportscanner>: Override the\n"
+ " default qmlimportscanner binary path. By default the\n"
+ " qmlimportscanner binary is located using the Qt directory\n"
+ " specified in the input file.\n"
" --help: Displays this information.\n\n",
qPrintable(QCoreApplication::arguments().at(0))
);
@@ -925,6 +935,12 @@ bool readInputFile(Options *options)
}
{
+ const QJsonValue qmlImportScannerBinaryPath = jsonObject.value(QLatin1String("qml-importscanner-binary"));
+ if (!qmlImportScannerBinaryPath.isUndefined())
+ options->qmlImportScannerBinaryPath = qmlImportScannerBinaryPath.toString();
+ }
+
+ {
const QJsonValue applicationBinary = jsonObject.value(QLatin1String("application-binary"));
if (applicationBinary.isUndefined()) {
fprintf(stderr, "No application binary defined in json file.\n");
@@ -1698,10 +1714,15 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
if (options->verbose)
fprintf(stdout, "Scanning for QML imports.\n");
- QString qmlImportScanner = options->qtInstallDirectory + QLatin1String("/bin/qmlimportscanner");
+ QString qmlImportScanner;
+ if (!options->qmlImportScannerBinaryPath.isEmpty()) {
+ qmlImportScanner = options->qmlImportScannerBinaryPath;
+ } else {
+ options->qtInstallDirectory + QLatin1String("/bin/qmlimportscanner");
#if defined(Q_OS_WIN32)
- qmlImportScanner += QLatin1String(".exe");
+ qmlImportScanner += QLatin1String(".exe");
#endif
+ }
if (!QFile::exists(qmlImportScanner)) {
fprintf(stderr, "qmlimportscanner not found: %s\n", qPrintable(qmlImportScanner));
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 6a74e739e6..ace3a4c9f3 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1217,18 +1217,22 @@ void Generator::generateStaticMetacall()
fprintf(out, "%s(", f.name.constData());
int offset = 1;
- int argsCount = f.arguments.count();
- for (int j = 0; j < argsCount; ++j) {
- const ArgumentDef &a = f.arguments.at(j);
- if (j)
- fprintf(out, ",");
- fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))",a.typeNameForCast.constData(), offset++);
- isUsed_a = true;
- }
- if (f.isPrivateSignal) {
- if (argsCount > 0)
- fprintf(out, ", ");
- fprintf(out, "%s", "QPrivateSignal()");
+ if (f.isRawSlot) {
+ fprintf(out, "QMethodRawArguments{ _a }");
+ } else {
+ int argsCount = f.arguments.count();
+ for (int j = 0; j < argsCount; ++j) {
+ const ArgumentDef &a = f.arguments.at(j);
+ if (j)
+ fprintf(out, ",");
+ fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))",a.typeNameForCast.constData(), offset++);
+ isUsed_a = true;
+ }
+ if (f.isPrivateSignal) {
+ if (argsCount > 0)
+ fprintf(out, ", ");
+ fprintf(out, "%s", "QPrivateSignal()");
+ }
}
fprintf(out, ");");
if (f.normalizedType != "void") {
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 8cc605fd8a..b98198d1d5 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -328,6 +328,11 @@ void Moc::parseFunctionArguments(FunctionDef *def)
def->arguments.removeLast();
def->isPrivateSignal = true;
}
+ if (def->arguments.size() == 1
+ && def->arguments.constLast().normalizedType == "QMethodRawArguments") {
+ def->arguments.removeLast();
+ def->isRawSlot = true;
+ }
}
bool Moc::testFunctionAttribute(FunctionDef *def)
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 687ea2552f..6785b7f9e8 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -115,6 +115,7 @@ struct FunctionDef
bool isConstructor = false;
bool isDestructor = false;
bool isAbstract = false;
+ bool isRawSlot = false;
QJsonObject toJson() const;
static void accessToJson(QJsonObject *obj, Access acs);
diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp
index acd81bd5c1..eac518dbab 100644
--- a/src/tools/tracegen/etw.cpp
+++ b/src/tools/tracegen/etw.cpp
@@ -90,7 +90,7 @@ static QString createGuid(const QUuid &uuid)
QTextStream stream(&guid);
- hex(stream);
+ Qt::hex(stream);
stream << "("
<< "0x" << uuid.data1 << ", "
diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp
index 9cf22d502d..853538479f 100644
--- a/src/tools/uic/main.cpp
+++ b/src/tools/uic/main.cpp
@@ -80,10 +80,6 @@ int runUic(int argc, char *argv[])
noImplicitIncludesOption.setDescription(QStringLiteral("Disable generation of #include-directives."));
parser.addOption(noImplicitIncludesOption);
- QCommandLineOption noStringLiteralOption(QStringList() << QStringLiteral("s") << QStringLiteral("no-stringliteral"));
- noStringLiteralOption.setDescription(QStringLiteral("Deprecated. The use of this option won't take any effect."));
- parser.addOption(noStringLiteralOption);
-
QCommandLineOption postfixOption(QStringLiteral("postfix"));
postfixOption.setDescription(QStringLiteral("Postfix to add to all generated classnames."));
postfixOption.setValueName(QStringLiteral("postfix"));
@@ -129,9 +125,6 @@ int runUic(int argc, char *argv[])
}
language::setLanguage(language);
- if (parser.isSet(noStringLiteralOption))
- fprintf(stderr, "The -s, --no-stringliteral option is deprecated and it won't take any effect.\n");
-
QString inputFile;
if (!parser.positionalArguments().isEmpty())
inputFile = parser.positionalArguments().at(0);
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 8cebe65a00..bf3882edd1 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -644,9 +644,6 @@ QT_CLASS_LIB(QImageReader, QtGui, qimagereader.h)
QT_CLASS_LIB(QImageWriter, QtGui, qimagewriter.h)
QT_CLASS_LIB(QMovie, QtGui, qmovie.h)
QT_CLASS_LIB(QPicture, QtGui, qpicture.h)
-QT_CLASS_LIB(QPictureIO, QtGui, qpicture.h)
-QT_CLASS_LIB(QPictureFormatInterface, QtGui, qpictureformatplugin.h)
-QT_CLASS_LIB(QPictureFormatPlugin, QtGui, qpictureformatplugin.h)
QT_CLASS_LIB(QPixmap, QtGui, qpixmap.h)
QT_CLASS_LIB(QPixmapCache, QtGui, qpixmapcache.h)
QT_CLASS_LIB(QAbstractItemDelegate, QtWidgets, qabstractitemdelegate.h)
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index a1b9003c1c..65434c96f9 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -49,7 +49,9 @@
#include <qfontmetrics.h>
#include <qaction.h>
#include <qheaderview.h>
-#include <qshortcut.h>
+#if QT_CONFIG(shortcut)
+# include <qshortcut.h>
+#endif
#include <qgridlayout.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
@@ -344,7 +346,9 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir)
QT_BEGIN_INCLUDE_NAMESPACE
#include <QMetaEnum>
-#include <qshortcut.h>
+#if QT_CONFIG(shortcut)
+# include <qshortcut.h>
+#endif
QT_END_INCLUDE_NAMESPACE
/*!
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index e1a6bce5b1..20f89e132a 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -39,7 +39,9 @@
#include "qprogressdialog.h"
-#include "qshortcut.h"
+#if QT_CONFIG(shortcut)
+# include "qshortcut.h"
+#endif
#include "qpainter.h"
#include "qdrawutil.h"
#include "qlabel.h"
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
index 8657d5ed29..de3143f753 100644
--- a/src/widgets/doc/snippets/javastyle.cpp
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -2130,7 +2130,7 @@ void JavaStyle::drawPrimitive(PrimitiveElement element,
painter->restore();
break;
}
- case PE_IndicatorViewItemCheck: {
+ case PE_IndicatorItemViewItemCheck: {
break;
}
case PE_FrameWindow: {
diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
index 645da5bca2..faaf4e5479 100644
--- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
@@ -1837,7 +1837,7 @@
item views keep the dimensions on individual sections. Also
note that the delegates may use the style to paint decorations
and frames around items. QItemDelegate, for instance, draws
- \c PE_FrameFocusRect and \c PE_IndicatorViewItemCheck.
+ \c PE_FrameFocusRect and \c PE_IndicatorItemViewItemCheck.
\image javastyle/header.png
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index bb00db4c01..88baf8015a 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1580,13 +1580,8 @@ QGraphicsItem::~QGraphicsItem()
p->wasDeleted = true;
if (p->declarativeData) {
p->wasDeleted = true; // needed, so that destroying the declarative data does the right thing
- if (static_cast<QAbstractDeclarativeDataImpl*>(p->declarativeData)->ownedByQml1) {
- if (QAbstractDeclarativeData::destroyed_qml1)
- QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o);
- } else {
- if (QAbstractDeclarativeData::destroyed)
- QAbstractDeclarativeData::destroyed(p->declarativeData, o);
- }
+ if (QAbstractDeclarativeData::destroyed)
+ QAbstractDeclarativeData::destroyed(p->declarativeData, o);
p->declarativeData = 0;
p->wasDeleted = false;
}
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index d36a871533..e72ed99a7b 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -54,7 +54,6 @@ QT_REQUIRE_CONFIG(graphicsview);
QT_BEGIN_NAMESPACE
-template<typename T> class QList;
class QFocusEvent;
class QFont;
class QFontMetrics;
diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h
index b494c52671..e13c2a3cd3 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex_p.h
+++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h
@@ -67,7 +67,6 @@ QT_BEGIN_NAMESPACE
class QGraphicsSceneIndexPrivate;
class QPointF;
class QRectF;
-template<typename T> class QList;
typedef bool (*QGraphicsSceneIndexIntersector)(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
const QTransform &deviceTransform, const void *data);
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 693af7eb80..8115741b6e 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -20,8 +20,7 @@ HEADERS += \
kernel/qlayout_p.h \
kernel/qlayoutengine_p.h \
kernel/qlayoutitem.h \
- kernel/qshortcut.h \
- kernel/qsizepolicy.h \
+ kernel/qsizepolicy.h \
kernel/qstackedlayout.h \
kernel/qwidget.h \
kernel/qwidget_p.h \
@@ -47,7 +46,6 @@ SOURCES += \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \
- kernel/qshortcut.cpp \
kernel/qsizepolicy.cpp \
kernel/qstackedlayout.cpp \
kernel/qwidget.cpp \
@@ -77,6 +75,11 @@ qtConfig(formlayout) {
SOURCES += kernel/qformlayout.cpp
}
+qtConfig(shortcut) {
+ HEADERS += kernel/qshortcut.h
+ SOURCES += kernel/qshortcut.cpp
+}
+
qtConfig(tooltip) {
HEADERS += kernel/qtooltip.h
SOURCES += kernel/qtooltip.cpp
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 19ad65692b..e69474cc47 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -46,7 +46,9 @@
#include "qevent.h"
#include "qlist.h"
#include "qstylehints.h"
-#include <private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <private/qshortcutmap_p.h>
+#endif
#include <private/qguiapplication_p.h>
#if QT_CONFIG(menu)
#include <private/qmenu_p.h>
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index f7693f4dde..d232b8d205 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -41,7 +41,9 @@
#define QACTION_H
#include <QtWidgets/qtwidgetsglobal.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#include <QtCore/qstring.h>
#include <QtWidgets/qwidget.h>
#include <QtCore/qvariant.h>
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index dfa1bc23b1..2d4f114638 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1395,7 +1395,9 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
else
*QApplicationPrivate::set_pal = palette;
QCoreApplication::setAttribute(Qt::AA_SetPalette);
- emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
+
+ if (qGuiApp && QGuiApplicationPrivate::app_pal)
+ emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
}
}
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 27e743a28d..d7cc4489c4 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -58,7 +58,6 @@ class QDesktopWidget;
class QStyle;
class QEventLoop;
class QIcon;
-template <typename T> class QList;
class QLocale;
class QPlatformNativeInterface;
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index eec65c8625..49440ad383 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -40,7 +40,6 @@
#include "qshortcut.h"
#include "private/qwidget_p.h"
-#ifndef QT_NO_SHORTCUT
#include <qevent.h>
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
@@ -676,7 +675,6 @@ bool QShortcut::event(QEvent *e)
}
return QObject::event(e);
}
-#endif // QT_NO_SHORTCUT
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 6dcf4971b2..6334788bce 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -44,10 +44,9 @@
#include <QtWidgets/qwidget.h>
#include <QtGui/qkeysequence.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(shortcut);
-#ifndef QT_NO_SHORTCUT
+QT_BEGIN_NAMESPACE
class QShortcutPrivate;
class Q_WIDGETS_EXPORT QShortcut : public QObject
@@ -94,8 +93,6 @@ protected:
bool event(QEvent *e) override;
};
-#endif // QT_NO_SHORTCUT
-
QT_END_NAMESPACE
#endif // QSHORTCUT_H
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 74aebd1223..0f2e2545cd 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1513,13 +1513,8 @@ QWidget::~QWidget()
if (d->declarativeData) {
d->wasDeleted = true; // needed, so that destroying the declarative data does the right thing
- if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) {
- if (QAbstractDeclarativeData::destroyed_qml1)
- QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
- } else {
- if (QAbstractDeclarativeData::destroyed)
- QAbstractDeclarativeData::destroyed(d->declarativeData, this);
- }
+ if (QAbstractDeclarativeData::destroyed)
+ QAbstractDeclarativeData::destroyed(d->declarativeData, this);
d->declarativeData = 0; // don't activate again in ~QObject
d->wasDeleted = false;
}
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 83a6e6d4b3..86f937c4c6 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -53,7 +53,9 @@
#include <QtGui/qregion.h>
#include <QtGui/qbrush.h>
#include <QtGui/qcursor.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#ifdef QT_INCLUDE_COMPAT
#include <QtGui/qevent.h>
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index b58dc1660a..54bf1d0691 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3238,7 +3238,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
break;
case CT_MenuItem:
if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int w = newSize.width();
+ int w = size.width(); // Don't rely of QCommonStyle's width calculation here
int maxpmw = menuItem->maxIconWidth;
int tabSpacing = 20;
if (menuItem->text.contains(QLatin1Char('\t')))
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 6cbed34c3a..ca81be1b2b 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -638,7 +638,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
indicator or button bevel.
\omitvalue PE_IndicatorViewItemCheck
- \value PE_FrameStatusBar Obsolete. Use PE_FrameStatusBarItem instead.
\value PE_PanelButtonCommand Button used to initiate an action, for
example, a QPushButton.
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index ee234457f5..b51bcbe8d6 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -142,9 +142,6 @@ public:
PE_FrameLineEdit,
PE_FrameMenu,
PE_FrameStatusBarItem,
-#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
- PE_FrameStatusBar Q_DECL_ENUMERATOR_DEPRECATED = PE_FrameStatusBarItem,
-#endif
PE_FrameTabWidget,
PE_FrameWindow,
PE_FrameButtonBevel,
@@ -165,9 +162,6 @@ public:
PE_IndicatorBranch,
PE_IndicatorButtonDropDown,
PE_IndicatorItemViewItemCheck,
-#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
- PE_IndicatorViewItemCheck Q_DECL_ENUMERATOR_DEPRECATED = PE_IndicatorItemViewItemCheck,
-#endif
PE_IndicatorCheckBox,
PE_IndicatorDockWidgetResizeHandle,
PE_IndicatorHeaderArrow,
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index e8dee142f2..c6f6e4c546 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -42,7 +42,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qicon.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#include <QtWidgets/qwidget.h>
QT_REQUIRE_CONFIG(abstractbutton);
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index e26993fb23..f348bbed0e 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2308,33 +2308,6 @@ void QDateTimeEdit::paintEvent(QPaintEvent *event)
style()->drawComplexControl(QStyle::CC_ComboBox, &optCombo, &p, this);
}
-/*
- Returns the string for AM and PM markers.
-
- If a translation for "AM" and "PM" is installed, then use that.
- Otherwise, use the default implementation, which uses the locale.
-*/
-QString QDateTimeEditPrivate::getAmPmText(AmPm ap, Case cs) const
-{
- QString original;
- QString translated;
- if (ap == AmText) {
- original = QLatin1String(cs == UpperCase ? "AM" : "am");
- translated = (cs == UpperCase ? QDateTimeParser::tr("AM") : QDateTimeParser::tr("am"));
- } else {
- original = QLatin1String(cs == UpperCase ? "PM" : "pm");
- translated = (cs == UpperCase ? QDateTimeParser::tr("PM") : QDateTimeParser::tr("pm"));
- }
-
- // This logic fails if a translation exists but doesn't change the string,
- // which we can accept as a corner-case for which a locale-derived answer
- // will be acceptable.
- if (original != translated)
- return translated;
-
- return QDateTimeParser::getAmPmText(ap, cs);
-}
-
int QDateTimeEditPrivate::absoluteIndex(QDateTimeEdit::Section s, int index) const
{
for (int i=0; i<sectionNodes.size(); ++i) {
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index dcf8863c8b..392bb0c778 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -97,7 +97,6 @@ public:
QDateTime getMinimum() const override { return minimum.toDateTime(); }
QDateTime getMaximum() const override { return maximum.toDateTime(); }
QLocale locale() const override { return q_func()->locale(); }
- QString getAmPmText(AmPm ap, Case cs) const override;
int cursorPosition() const override { return edit ? edit->cursorPosition() : -1; }
int absoluteIndex(QDateTimeEdit::Section s, int index) const;
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index fb67936768..a5499c8ce8 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -78,7 +78,7 @@
#endif
#include "private/qstylesheetstyle_p.h"
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include "qkeysequence.h"
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 51b458f03a..8f03889db6 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -403,7 +403,9 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
//calculate size
QFontMetrics qfm = q->fontMetrics();
bool previousWasSeparator = true; // this is true to allow removing the leading separators
+#if QT_CONFIG(shortcut)
const bool contextMenu = isContextMenu();
+#endif
for(int i = 0; i <= lastVisibleAction; i++) {
QAction *action = actions.at(i);
const bool isSection = action->isSeparator() && (!action->text().isEmpty() || !action->icon().isNull());
@@ -434,12 +436,12 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
if (t != -1) {
tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(s.mid(t+1)));
s = s.left(t);
- #ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
} else if (action->isShortcutVisibleInContextMenu() || !contextMenu) {
QKeySequence seq = action->shortcut();
if (!seq.isEmpty())
tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(seq.toString(QKeySequence::NativeText)));
- #endif
+#endif
}
sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
sz.setHeight(qMax(fm.height(), qfm.height()));
@@ -1767,12 +1769,14 @@ QAction *QMenu::addAction(const QIcon &icon, const QString &text)
\sa QWidget::addAction()
*/
-QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut)
+QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut
+#endif
+ )
{
QAction *action = new QAction(text, this);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut);
-#else
+#if QT_CONFIG(shortcut)
action->setShortcut(shortcut);
#endif
QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
@@ -1860,12 +1864,14 @@ QAction *QMenu::addAction(const QString &text, const QObject *receiver, const ch
\sa QWidget::addAction()
*/
QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver,
- const char* member, const QKeySequence &shortcut)
+ const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut
+#endif
+ )
{
QAction *action = new QAction(icon, text, this);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut);
-#else
+#if QT_CONFIG(shortcut)
action->setShortcut(shortcut);
#endif
QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 84ab9e027a..35d5a865ff 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -78,8 +78,17 @@ public:
using QWidget::addAction;
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
- QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
- QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
+
+ QAction *addAction(const QString &text, const QObject *receiver, const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ );
+ QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ );
#ifdef Q_CLANG_QDOC
template<typename Functor>
@@ -95,12 +104,14 @@ public:
template<class Obj, typename Func1>
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
- addAction(const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0)
+ addAction(const QString &text, const Obj *object, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
{
QAction *result = addAction(text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, object, std::move(slot));
@@ -108,12 +119,14 @@ public:
}
// addAction(QString): Connect to a functor or function pointer (without context)
template <typename Func1>
- inline QAction *addAction(const QString &text, Func1 slot, const QKeySequence &shortcut = 0)
+ inline QAction *addAction(const QString &text, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
{
QAction *result = addAction(text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, std::move(slot));
@@ -123,12 +136,15 @@ public:
template<class Obj, typename Func1>
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
- addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0)
+ addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
+
{
QAction *result = addAction(actionIcon, text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, object, std::move(slot));
@@ -136,12 +152,14 @@ public:
}
// addAction(QIcon, QString): Connect to a functor or function pointer (without context)
template <typename Func1>
- inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot, const QKeySequence &shortcut = 0)
+ inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
{
QAction *result = addAction(actionIcon, text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, std::move(slot));
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index ec980d9ee3..658914ae39 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
class QSplitterPrivate;
class QTextStream;
-template <typename T> class QList;
class QSplitterHandle;
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index dce18f9100..be4abf1ae2 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -92,7 +92,7 @@
#include <QtGui/qaccessible.h>
#include <QtCore/qmetaobject.h>
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include <qkeysequence.h>
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 8d232237bf..3e8b18d449 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -4984,7 +4984,7 @@ bool QDomElement::hasAttribute(const QString& name) const
\sa setAttributeNS(), attributeNodeNS(), setAttributeNodeNS(), attribute()
*/
-QString QDomElement::attributeNS(const QString nsURI, const QString& localName, const QString& defValue) const
+QString QDomElement::attributeNS(const QString& nsURI, const QString& localName, const QString& defValue) const
{
if (!impl)
return defValue;
@@ -5003,7 +5003,7 @@ QString QDomElement::attributeNS(const QString nsURI, const QString& localName,
\sa attributeNS(), setAttributeNodeNS(), setAttribute()
*/
-void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, const QString& value)
+void QDomElement::setAttributeNS(const QString& nsURI, const QString& qName, const QString& value)
{
if (!impl)
return;
@@ -5011,13 +5011,13 @@ void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, cons
}
/*!
- \fn void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, int value)
+ \fn void QDomElement::setAttributeNS(const QString& nsURI, const QString& qName, int value)
\overload
*/
/*!
- \fn void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, uint value)
+ \fn void QDomElement::setAttributeNS(const QString& nsURI, const QString& qName, uint value)
\overload
*/
@@ -5025,7 +5025,7 @@ void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, cons
/*!
\overload
*/
-void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qlonglong value)
+void QDomElement::setAttributeNS(const QString& nsURI, const QString& qName, qlonglong value)
{
if (!impl)
return;
@@ -5037,7 +5037,7 @@ void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qlon
/*!
\overload
*/
-void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qulonglong value)
+void QDomElement::setAttributeNS(const QString& nsURI, const QString& qName, qulonglong value)
{
if (!impl)
return;
@@ -5049,7 +5049,7 @@ void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qulo
/*!
\overload
*/
-void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, double value)
+void QDomElement::setAttributeNS(const QString& nsURI, const QString& qName, double value)
{
if (!impl)
return;
diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h
index 0a7db7dcd7..2d07e34f3b 100644
--- a/src/xml/dom/qdom.h
+++ b/src/xml/dom/qdom.h
@@ -493,15 +493,15 @@ public:
QDomNodeList elementsByTagName(const QString& tagname) const;
bool hasAttribute(const QString& name) const;
- QString attributeNS(const QString nsURI, const QString& localName, const QString& defValue = QString()) const;
- void setAttributeNS(const QString nsURI, const QString& qName, const QString& value);
- inline void setAttributeNS(const QString nsURI, const QString& qName, int value)
+ QString attributeNS(const QString& nsURI, const QString& localName, const QString& defValue = QString()) const;
+ void setAttributeNS(const QString& nsURI, const QString& qName, const QString& value);
+ inline void setAttributeNS(const QString& nsURI, const QString& qName, int value)
{ setAttributeNS(nsURI, qName, qlonglong(value)); }
- inline void setAttributeNS(const QString nsURI, const QString& qName, uint value)
+ inline void setAttributeNS(const QString& nsURI, const QString& qName, uint value)
{ setAttributeNS(nsURI, qName, qulonglong(value)); }
- void setAttributeNS(const QString nsURI, const QString& qName, qlonglong value);
- void setAttributeNS(const QString nsURI, const QString& qName, qulonglong value);
- void setAttributeNS(const QString nsURI, const QString& qName, double value);
+ void setAttributeNS(const QString& nsURI, const QString& qName, qlonglong value);
+ void setAttributeNS(const QString& nsURI, const QString& qName, qulonglong value);
+ void setAttributeNS(const QString& nsURI, const QString& qName, double value);
void removeAttributeNS(const QString& nsURI, const QString& localName);
QDomAttr attributeNodeNS(const QString& nsURI, const QString& localName);
QDomAttr setAttributeNodeNS(const QDomAttr& newAttr);
diff --git a/sync.profile b/sync.profile
index fd44197a00..b1c7e0f328 100644
--- a/sync.profile
+++ b/sync.profile
@@ -29,6 +29,7 @@
"QtKmsSupport" => "$basedir/src/platformsupport/kmsconvenience",
"QtEdidSupport" => "$basedir/src/platformsupport/edid",
"QtVulkanSupport" => "$basedir/src/platformsupport/vkconvenience",
+ "QtLinuxOfonoSupport" => "$basedir/src/platformsupport/linuxofono",
"QtPlatformHeaders" => "$basedir/src/platformheaders",
"QtANGLE/KHR" => "!$basedir/src/3rdparty/angle/include/KHR",
"QtANGLE/GLES2" => "!$basedir/src/3rdparty/angle/include/GLES2",
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 9eb741edac..c9d1da8649 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,5 +1,9 @@
TEMPLATE = subdirs
+# Tests with developer-build started failing on qemu-armv7/armv8 after commit
+# b88acae7a8e773c307e44f84da037d01d19e60f7 in qt5.
+boot2qt:qtConfig(private_tests): return()
+
SUBDIRS += \
corelib \
dbus \
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 0597a7d521..744e047c45 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -116,7 +116,7 @@ static DWORD createSymbolicLink(const QString &symLinkName, const QString &targe
reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) {
result = GetLastError();
QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", "
- << nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result
+ << nativeTarget << ", 0x" << Qt::hex << flags << Qt::dec << ") failed with error " << result
<< ": " << qt_error_string(int(result));
}
return result;
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
index 54b2e0a0e2..f3b3ede575 100644
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
@@ -1,65 +1,51 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
- <file>extras/test</file>
- <file>extras/test2</file>
- <file>extras/+custom1/test</file>
- <file>extras/+custom1/test3</file>
- <file>extras/+custom2/test</file>
- <file>extras/+custom3/test</file>
- <file>extras/+custom3/+custom2/test</file>
- <file>extras/+custom3/+custom4/test</file>
- <file>extras/+custom3/+custom5/test</file>
- <file>extras/+custom5/+custom3/test</file>
-
- <!-- platforms/test: deepest possible selection -->
- <file>platforms/test</file>
- <file>platforms/+unix/+android/test</file>
- <file>platforms/+unix/+darwin/+mac/+ios/test</file>
- <file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file>
- <file>platforms/+unix/+darwin/+mac/+osx/test</file>
- <file>platforms/+unix/+darwin/+mac/test</file>
- <file>platforms/+unix/+darwin/test</file>
- <file>platforms/+unix/+haiku/test</file>
- <file>platforms/+unix/+linux/test</file>
- <file>platforms/+unix/+qnx/test</file>
- <file>platforms/+unix/test</file>
- <file>platforms/+windows/+wince/test</file>
- <file>platforms/+windows/+winnt/test</file>
- <file>platforms/+windows/+winrt/test</file>
- <file>platforms/+windows/test</file>
- <file>platforms/+android/test</file>
- <file>platforms/+ios/test</file>
- <file>platforms/+macos/test</file>
- <file>platforms/+osx/test</file>
- <file>platforms/+darwin/test</file>
- <file>platforms/+mac/test</file>
- <file>platforms/+haiku/test</file>
- <file>platforms/+linux/test</file>
- <file>platforms/+qnx/test</file>
- <file>platforms/+wince/test</file>
- <file>platforms/+winrt/test</file>
-
- <!-- platforms/test2: shallow selection for the deepest selector -->
- <file>platforms/test2</file>
- <file>platforms/+android/test2</file>
- <file>platforms/+ios/test2</file>
- <file>platforms/+macos/test2</file>
- <file>platforms/+haiku/test2</file>
- <file>platforms/+linux/test2</file>
- <file>platforms/+qnx/test2</file>
- <file>platforms/+wince/test2</file>
- <file>platforms/+winnt/test2</file>
- <file>platforms/+winrt/test2</file>
-
- <!-- platforms/test3: selection for the family only -->
- <file>platforms/test3</file>
- <file>platforms/+windows/test3</file>
- <file>platforms/+unix/test3</file>
-
- <!-- platforms/test4 and 5: special cases for macOS -->
- <file>platforms/test4</file>
- <file>platforms/+osx/test4</file>
- <file>platforms/test5</file>
- <file>platforms/+mac/test5</file>
-</qresource>
+<RCC>
+ <qresource prefix="/">
+ <file>extras/test</file>
+ <file>extras/test2</file>
+ <file>extras/+custom1/test</file>
+ <file>extras/+custom1/test3</file>
+ <file>extras/+custom2/test</file>
+ <file>extras/+custom3/test</file>
+ <file>extras/+custom3/+custom2/test</file>
+ <file>extras/+custom3/+custom4/test</file>
+ <file>extras/+custom3/+custom5/test</file>
+ <file>extras/+custom5/+custom3/test</file>
+ <file>platforms/test</file>
+ <file>platforms/+unix/+android/test</file>
+ <file>platforms/+unix/+darwin/test</file>
+ <file>platforms/+unix/+haiku/test</file>
+ <file>platforms/+unix/+linux/test</file>
+ <file>platforms/+unix/+qnx/test</file>
+ <file>platforms/+unix/test</file>
+ <file>platforms/+windows/+wince/test</file>
+ <file>platforms/+windows/+winnt/test</file>
+ <file>platforms/+windows/+winrt/test</file>
+ <file>platforms/+windows/test</file>
+ <file>platforms/+android/test</file>
+ <file>platforms/+ios/test</file>
+ <file>platforms/+macos/test</file>
+ <file>platforms/+darwin/test</file>
+ <file>platforms/+haiku/test</file>
+ <file>platforms/+linux/test</file>
+ <file>platforms/+qnx/test</file>
+ <file>platforms/+wince/test</file>
+ <file>platforms/+winrt/test</file>
+ <file>platforms/test2</file>
+ <file>platforms/+android/test2</file>
+ <file>platforms/+ios/test2</file>
+ <file>platforms/+macos/test2</file>
+ <file>platforms/+haiku/test2</file>
+ <file>platforms/+linux/test2</file>
+ <file>platforms/+qnx/test2</file>
+ <file>platforms/+wince/test2</file>
+ <file>platforms/+winnt/test2</file>
+ <file>platforms/+winrt/test2</file>
+ <file>platforms/test3</file>
+ <file>platforms/+windows/test3</file>
+ <file>platforms/+unix/test3</file>
+ <file>platforms/test4</file>
+ <file>platforms/test5</file>
+ <file>platforms/+unix/+darwin/+macos/test</file>
+ <file>platforms/+unix/+darwin/+ios/test</file>
+ </qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index 11b1fdaeeb..bac7a69e0f 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -126,14 +126,6 @@ void tst_QFileSelector::basicTest_data()
QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList()
<< expectedPlatform3File;
-#ifdef Q_OS_MACOS
- // special case for compatibility code
- QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList()
- << ":/platforms/+osx/test4";
- QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList()
- << ":/platforms/+mac/test5";
-#endif
-
QString resourceTestPath(":/extras/test");
QString custom1("custom1");
QTest::newRow("custom1-noselector") << resourceTestPath << QStringList()
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 0f07ba4bb2..c969e72c18 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -39,7 +39,9 @@
#include <QtCore/QDir>
#include <QtCore/QThread>
#include <QtCore/QSysInfo>
-#include <QtGui/QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QtGui/QKeySequence>
+#endif
#include <QtCore>
#include <QtGui>
@@ -1364,6 +1366,7 @@ void tst_QSettings::testVariantTypes()
dt.setOffsetFromUtc(3600);
testVal("key14", dt, QDateTime, DateTime);
+#if QT_CONFIG(shortcut)
// We store key sequences as strings instead of binary variant blob, for improved
// readability in the resulting format.
if (format >= QSettings::InvalidFormat) {
@@ -1373,6 +1376,7 @@ void tst_QSettings::testVariantTypes()
QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText),
QString, String);
}
+#endif // QT_CONFIG(shortcut)
#undef testVal
}
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index a805bfb747..5b576fe154 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -81,9 +81,6 @@ private slots:
void senderTest();
void declareInterface();
void qpointerResetBeforeDestroyedSignal();
-#ifndef QT_NO_USERDATA
- void testUserData();
-#endif
void childDeletesItsSibling();
void dynamicProperties();
void floatProperty();
@@ -2341,51 +2338,6 @@ void tst_QObject::declareInterface()
}
-#ifndef QT_NO_USERDATA
-class CustomData : public QObjectUserData
-{
-public:
- int id;
-};
-
-void tst_QObject::testUserData()
-{
- const int USER_DATA_COUNT = 100;
- int user_data_ids[USER_DATA_COUNT];
-
- // Register a few
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- user_data_ids[i] = QObject::registerUserData();
- }
-
- // Randomize the table a bit
- for (int i=0; i<100; ++i) {
- int p1 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
- int p2 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
-
- int tmp = user_data_ids[p1];
- user_data_ids[p1] = user_data_ids[p2];
- user_data_ids[p2] = tmp;
- }
-
- // insert the user data into an object
- QObject my_test_object;
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- CustomData *data = new CustomData;
- data->id = user_data_ids[i];
- my_test_object.setUserData(data->id, data);
- }
-
- // verify that all ids and positions are matching
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- int id = user_data_ids[i];
- CustomData *data = static_cast<CustomData *>(my_test_object.userData(id));
- QVERIFY(data != nullptr);
- QCOMPARE(data->id, id);
- }
-}
-#endif // QT_NO_USERDATA
-
class DestroyedListener : public QObject
{
Q_OBJECT
@@ -6974,8 +6926,7 @@ void tst_QObject::noDeclarativeParentChangedOnDestruction()
QObject *parent = new QObject;
QObject *child = new QObject;
- QAbstractDeclarativeDataImpl dummy;
- dummy.ownedByQml1 = false;
+ QAbstractDeclarativeData dummy;
QObjectPrivate::get(child)->declarativeData = &dummy;
parentChangeCalled = false;
diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
index 8197c386c5..d402e3f63b 100644
--- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
@@ -2327,6 +2327,7 @@ void tst_QDataStream::setVersion()
QDataStream latest;
QFETCH(int, vers);
+#if QT_CONFIG(shortcut)
/*
Test QKeySequence.
*/
@@ -2351,6 +2352,7 @@ void tst_QDataStream::setVersion()
}
QCOMPARE(deadbeef, 0xDEADBEEF);
}
+#endif // QT_CONFIG(shortcut)
/*
Test QPalette.
diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
index 05480c6dd2..5453d9de61 100644
--- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
@@ -31,6 +31,7 @@
#include <qcoreapplication.h>
#include <qmetatype.h>
#include <QtTest/QtTest>
+#include <QtCore/qregularexpression.h>
#include <QtCore/qvariant.h>
#include <QtDBus/QtDBus>
#include <QtDBus/private/qdbus_symbols_p.h>
@@ -451,14 +452,16 @@ void tst_QDBusInterface::introspectVirtualObject()
QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, "org.freedesktop.DBus.Introspectable", "Introspect");
QDBusMessage reply = con.call(message, QDBus::Block, 5000);
QVERIFY(reply.arguments().at(0).toString().contains(
- QRegExp("<node>.*zitroneneis.*<interface name=") ));
+ QRegularExpression("<node>.*zitroneneis.*<interface name=",
+ QRegularExpression::DotMatchesEverythingOption)));
QDBusMessage message2 = QDBusMessage::createMethodCall(con.baseService(), path + "/foo", "org.freedesktop.DBus.Introspectable", "Introspect");
QDBusMessage reply2 = con.call(message2, QDBus::Block, 5000);
QVERIFY(reply2.arguments().at(0).toString().contains(
- QRegExp("<node>.*<interface name=\"org.qtproject.QtDBus.VirtualObject\">"
- ".*<method name=\"klingeling\" />\n"
- ".*</interface>.*<interface name=") ));
+ QRegularExpression("<node>.*<interface name=\"org.qtproject.QtDBus.VirtualObject\">"
+ ".*<method name=\"klingeling\" />\n"
+ ".*</interface>.*<interface name=",
+ QRegularExpression::DotMatchesEverythingOption)));
}
void tst_QDBusInterface::callMethod()
diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
index ec6bb8dcee..6287960457 100644
--- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp
+++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
@@ -37,6 +37,8 @@
#include <qscreen.h>
#include <limits.h>
+#ifndef QT_NO_PICTURE
+
class tst_QPicture : public QObject
{
Q_OBJECT
@@ -45,7 +47,6 @@ public:
tst_QPicture();
private slots:
- void getSetCheck();
void devType();
void paintingActive();
void boundingRect();
@@ -56,31 +57,6 @@ private slots:
void boundaryValues();
};
-// Testing get/set functions
-void tst_QPicture::getSetCheck()
-{
- QPictureIO obj1;
- // const QPicture & QPictureIO::picture()
- // void QPictureIO::setPicture(const QPicture &)
- // const char * QPictureIO::format()
- // void QPictureIO::setFormat(const char *)
- const char var2[] = "PNG";
- obj1.setFormat(var2);
- QCOMPARE(var2, obj1.format());
- obj1.setFormat((char *)0);
- // The format is stored internally in a QString, so return is always a valid char *
- QVERIFY(QString(obj1.format()).isEmpty());
-
- // const char * QPictureIO::parameters()
- // void QPictureIO::setParameters(const char *)
- const char var3[] = "Bogus data";
- obj1.setParameters(var3);
- QCOMPARE(var3, obj1.parameters());
- obj1.setParameters((char *)0);
- // The format is stored internally in a QString, so return is always a valid char *
- QVERIFY(QString(obj1.parameters()).isEmpty());
-}
-
tst_QPicture::tst_QPicture()
{
}
@@ -316,6 +292,7 @@ void tst_QPicture::boundaryValues()
painter.end();
}
-
QTEST_MAIN(tst_QPicture)
#include "tst_qpicture.moc"
+
+#endif // QT_NO_PICTURE
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 42135dae24..4d86b0f8f5 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -29,6 +29,11 @@ SUBDIRS=\
win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
+!qtConfig(shortcut): SUBDIRS -= \
+ qkeysequence \
+ qguimetatype \
+ qguivariant
+
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
qtouchevent
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 3ce65a6785..1d0484a05d 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -181,9 +181,13 @@ template<> struct TestValueFactory<QMetaType::QCursor> {
static QCursor *create() { return new QCursor(Qt::WaitCursor); }
};
#endif
+
+#if QT_CONFIG(shortcut)
template<> struct TestValueFactory<QMetaType::QKeySequence> {
static QKeySequence *create() { return new QKeySequence(QKeySequence::Close); }
};
+#endif
+
template<> struct TestValueFactory<QMetaType::QPen> {
static QPen *create() { return new QPen(Qt::DashDotDotLine); }
};
diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
index 87a47bd93b..6a928cac7a 100644
--- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
@@ -64,8 +64,10 @@ public:
private slots:
void basicEventDelivery();
+#if QT_CONFIG(shortcut)
void modifiers_data();
void modifiers();
+#endif
};
tst_QKeyEvent::tst_QKeyEvent()
@@ -128,6 +130,8 @@ static QByteArray modifiersTestRowName(const QString &keySequence)
return result;
}
+#if QT_CONFIG(shortcut)
+
void tst_QKeyEvent::modifiers_data()
{
struct Modifier
@@ -198,5 +202,7 @@ void tst_QKeyEvent::modifiers()
}
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QKeyEvent)
#include "tst_qkeyevent.moc"
diff --git a/tests/auto/network/access/access.pro b/tests/auto/network/access/access.pro
index b140b5e9f2..d2b4d97b21 100644
--- a/tests/auto/network/access/access.pro
+++ b/tests/auto/network/access/access.pro
@@ -7,7 +7,6 @@ SUBDIRS=\
qnetworkrequest \
qhttpnetworkconnection \
qnetworkreply \
- spdy \
qnetworkcachemetadata \
qftp \
qhttpnetworkreply \
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index 6f94692cb1..904cfd52b0 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -939,13 +939,6 @@ void tst_Http2::replyFinished()
QVERIFY(http2Used.isValid());
QVERIFY(http2Used.toBool());
- const QVariant spdyUsed(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute));
- if (!spdyUsed.isValid() || spdyUsed.toBool())
- stopEventLoop();
-
- QVERIFY(spdyUsed.isValid());
- QVERIFY(!spdyUsed.toBool());
-
const QVariant code(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute));
if (!code.isValid() || !code.canConvert<int>() || code.value<int>() != 200)
stopEventLoop();
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
index 2a0651f96f..18450f1853 100644
--- a/tests/auto/network/access/qnetworkreply/BLACKLIST
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -15,8 +15,6 @@ linux
# QTBUG-71953
[getFromHttp]
* !android !winrt
-[getFromHttp:success-external]
-*
[getFromHttpIntoBuffer]
osx
[getFromHttpIntoBuffer2]
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 418e1caf68..04bda567ed 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1910,10 +1910,6 @@ void tst_QNetworkReply::getFromHttp_data()
<< testDataDir + "/rfc3252.txt"
<< "http://" + QtNetworkSettings::httpServerName() + "/qtest/rfc3252.txt";
- QTest::newRow("success-external")
- << testDataDir + "/rfc3252.txt"
- << "http://www.ietf.org/rfc/rfc3252.txt";
-
QTest::newRow("bigfile-internal")
<< testDataDir + "/bigfile"
<< "http://" + QtNetworkSettings::httpServerName() + "/qtest/bigfile";
diff --git a/tests/auto/network/access/spdy/BLACKLIST b/tests/auto/network/access/spdy/BLACKLIST
deleted file mode 100644
index 5cf79327be..0000000000
--- a/tests/auto/network/access/spdy/BLACKLIST
+++ /dev/null
@@ -1,7 +0,0 @@
-[download]
-opensuse-leap
-[upload]
-opensuse-leap
-ubuntu-18.04
-b2qt
-
diff --git a/tests/auto/network/access/spdy/spdy.pro b/tests/auto/network/access/spdy/spdy.pro
deleted file mode 100644
index cdbe60a19b..0000000000
--- a/tests/auto/network/access/spdy/spdy.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_spdy
-SOURCES += tst_spdy.cpp
-
-QT = core core-private network network-private testlib
-
-win32:CONFIG += insignificant_test # QTBUG-47128
diff --git a/tests/auto/network/access/spdy/tst_spdy.cpp b/tests/auto/network/access/spdy/tst_spdy.cpp
deleted file mode 100644
index f4a5976558..0000000000
--- a/tests/auto/network/access/spdy/tst_spdy.cpp
+++ /dev/null
@@ -1,693 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkReply>
-#include <QtNetwork/QHttpPart>
-#include <QtNetwork/QHttpMultiPart>
-#include <QtNetwork/QNetworkProxy>
-#include <QtNetwork/QAuthenticator>
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_OPENSSL)
-#include <QtNetwork/private/qsslsocket_openssl_p.h>
-#endif // QT_BUILD_INTERNAL && !QT_NO_OPENSSL
-
-#include "../../../network-settings.h"
-
-Q_DECLARE_METATYPE(QAuthenticator*)
-
-class tst_Spdy: public QObject
-{
- Q_OBJECT
-
-public:
- tst_Spdy();
- ~tst_Spdy();
-
-private Q_SLOTS:
- void initTestCase();
- void settingsAndNegotiation_data();
- void settingsAndNegotiation();
-#ifndef QT_NO_NETWORKPROXY
- void download_data();
- void download();
-#endif // !QT_NO_NETWORKPROXY
- void headerFields();
-#ifndef QT_NO_NETWORKPROXY
- void upload_data();
- void upload();
- void errors_data();
- void errors();
-#endif // !QT_NO_NETWORKPROXY
- void multipleRequests_data();
- void multipleRequests();
-
-private:
- QNetworkAccessManager m_manager;
- int m_multipleRequestsCount;
- int m_multipleRepliesFinishedCount;
- const QString m_rfc3252FilePath;
-
-protected Q_SLOTS:
- void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *authenticator);
- void multipleRequestsFinishedSlot();
-};
-
-tst_Spdy::tst_Spdy()
- : m_rfc3252FilePath(QFINDTESTDATA("../qnetworkreply/rfc3252.txt"))
-{
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) && OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
- qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy
- qRegisterMetaType<QAuthenticator *>();
-
- connect(&m_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- this, SLOT(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)));
-#else
- QSKIP("Qt built withouth OpenSSL, or the OpenSSL version is too old");
-#endif // defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) ...
-}
-
-tst_Spdy::~tst_Spdy()
-{
-}
-
-void tst_Spdy::initTestCase()
-{
- QVERIFY(!m_rfc3252FilePath.isEmpty());
- QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
-}
-
-void tst_Spdy::settingsAndNegotiation_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<bool>("setAttribute");
- QTest::addColumn<bool>("enabled");
- QTest::addColumn<QByteArray>("expectedProtocol");
- QTest::addColumn<QByteArray>("expectedContent");
-
- QTest::newRow("default-settings") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << false << false << QByteArray()
- << QByteArray("1");
-
- QTest::newRow("http-url") << QUrl("http://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << true << true << QByteArray()
- << QByteArray("1");
-
- QTest::newRow("spdy-disabled") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << true << false << QByteArray()
- << QByteArray("1");
-
-#ifndef QT_NO_OPENSSL
- QTest::newRow("spdy-enabled") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << true << true << QByteArray(QSslConfiguration::NextProtocolSpdy3_0)
- << QByteArray("1");
-#endif // QT_NO_OPENSSL
-}
-
-void tst_Spdy::settingsAndNegotiation()
-{
- QFETCH(QUrl, url);
- QFETCH(bool, setAttribute);
- QFETCH(bool, enabled);
-
- QNetworkRequest request(url);
-
- if (setAttribute) {
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, QVariant(enabled));
- }
-
- QNetworkReply *reply = m_manager.get(request);
- reply->ignoreSslErrors();
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QFETCH(QByteArray, expectedProtocol);
-
-#ifndef QT_NO_OPENSSL
- bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), expectedSpdyUsed);
-#endif // QT_NO_OPENSSL
-
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
-
- int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- QCOMPARE(statusCode, 200);
-
- QByteArray content = reply->readAll();
-
- QFETCH(QByteArray, expectedContent);
- QCOMPARE(expectedContent, content);
-
-#ifndef QT_NO_OPENSSL
- QSslConfiguration::NextProtocolNegotiationStatus expectedStatus =
- (expectedProtocol.isEmpty())
- ? QSslConfiguration::NextProtocolNegotiationNone
- : QSslConfiguration::NextProtocolNegotiationNegotiated;
- QCOMPARE(reply->sslConfiguration().nextProtocolNegotiationStatus(),
- expectedStatus);
-
- QCOMPARE(reply->sslConfiguration().nextNegotiatedProtocol(), expectedProtocol);
-#endif // QT_NO_OPENSSL
-}
-
-void tst_Spdy::proxyAuthenticationRequired(const QNetworkProxy &/*proxy*/,
- QAuthenticator *authenticator)
-{
- authenticator->setUser("qsockstest");
- authenticator->setPassword("password");
-}
-
-#ifndef QT_NO_NETWORKPROXY
-void tst_Spdy::download_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QString>("fileName");
- QTest::addColumn<QNetworkProxy>("proxy");
-
- QTest::newRow("mediumfile") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy();
-
- QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName());
- QString proxyserver = hostInfo.addresses().first().toString();
-
- QTest::newRow("mediumfile-http-proxy") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3128);
-
- QTest::newRow("mediumfile-http-proxy-auth") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::HttpProxy,
- proxyserver, 3129);
-
- QTest::newRow("mediumfile-socks-proxy") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080);
-
- QTest::newRow("mediumfile-socks-proxy-auth") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::Socks5Proxy,
- proxyserver, 1081);
-
- QTest::newRow("bigfile") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/bigfile")
- << QFINDTESTDATA("../qnetworkreply/bigfile")
- << QNetworkProxy();
-}
-
-void tst_Spdy::download()
-{
- QFETCH(QUrl, url);
- QFETCH(QString, fileName);
- QFETCH(QNetworkProxy, proxy);
-
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- if (proxy.type() != QNetworkProxy::DefaultProxy) {
- m_manager.setProxy(proxy);
- }
- QNetworkReply *reply = m_manager.get(request);
- reply->ignoreSslErrors();
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy downloadProgressSpy(reply, SIGNAL(downloadProgress(qint64, qint64)));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
- QSignalSpy proxyAuthRequiredSpy(&m_manager, SIGNAL(
- proxyAuthenticationRequired(const QNetworkProxy &,
- QAuthenticator *)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), 1);
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
- QVERIFY(downloadProgressSpy.count() > 0);
- QVERIFY(readyReadSpy.count() > 0);
-
- QVERIFY(proxyAuthRequiredSpy.count() <= 1);
-
- QCOMPARE(reply->error(), QNetworkReply::NoError);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- QFile file(fileName);
- QVERIFY(file.open(QIODevice::ReadOnly));
-
- qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong();
- qint64 expectedContentLength = file.bytesAvailable();
- QCOMPARE(contentLength, expectedContentLength);
-
- QByteArray expectedContent = file.readAll();
- QByteArray content = reply->readAll();
- QCOMPARE(content, expectedContent);
-
- reply->deleteLater();
- m_manager.setProxy(QNetworkProxy()); // reset
-}
-#endif // !QT_NO_NETWORKPROXY
-
-void tst_Spdy::headerFields()
-{
- QUrl url(QUrl("https://" + QtNetworkSettings::serverName()));
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- QNetworkReply *reply = m_manager.get(request);
- reply->ignoreSslErrors();
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(reply->rawHeader("Content-Type"), QByteArray("text/html"));
- QVERIFY(reply->rawHeader("Content-Length").toInt() > 0);
- QVERIFY(reply->rawHeader("server").contains("Apache"));
-
- QCOMPARE(reply->header(QNetworkRequest::ContentTypeHeader).toByteArray(), QByteArray("text/html"));
- QVERIFY(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong() > 0);
- QVERIFY(reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().isValid());
- QVERIFY(reply->header(QNetworkRequest::ServerHeader).toByteArray().contains("Apache"));
-}
-
-static inline QByteArray md5sum(const QByteArray &data)
-{
- return QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex().append('\n');
-}
-
-#ifndef QT_NO_NETWORKPROXY
-void tst_Spdy::upload_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QByteArray>("data");
- QTest::addColumn<QByteArray>("uploadMethod");
- QTest::addColumn<QObject *>("uploadObject");
- QTest::addColumn<QByteArray>("md5sum");
- QTest::addColumn<QNetworkProxy>("proxy");
-
-
- // 1. test uploading of byte arrays
-
- QUrl md5Url("https://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi");
-
- QByteArray data;
- data = "";
- QObject *dummyObject = 0;
- QTest::newRow("empty") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = "This is a normal message.";
- QTest::newRow("generic") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = "This is a message to show that Qt rocks!\r\n\n";
- QTest::newRow("small") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray("abcd\0\1\2\abcd",12);
- QTest::newRow("with-nul") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray(4097, '\4');
- QTest::newRow("4k+1") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)<< QNetworkProxy();
-
- QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName());
- QString proxyserver = hostInfo.addresses().first().toString();
-
- QTest::newRow("4k+1-with-http-proxy") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3128);
-
- QTest::newRow("4k+1-with-http-proxy-auth") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::HttpProxy,
- proxyserver, 3129);
-
- QTest::newRow("4k+1-with-socks-proxy") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080);
-
- QTest::newRow("4k+1-with-socks-proxy-auth") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::Socks5Proxy,
- proxyserver, 1081);
-
- data = QByteArray(128*1024+1, '\177');
- QTest::newRow("128k+1") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray(128*1024+1, '\177');
- QTest::newRow("128k+1-put") << md5Url << data << QByteArray("PUT") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray(2*1024*1024+1, '\177');
- QTest::newRow("2MB+1") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
-
- // 2. test uploading of files
-
- QFile *file = new QFile(m_rfc3252FilePath);
- file->open(QIODevice::ReadOnly);
- QTest::newRow("file-26K") << md5Url << QByteArray() << QByteArray("POST")
- << static_cast<QObject *>(file)
- << QByteArray("b3e32ac459b99d3f59318f3ac31e4bee\n") << QNetworkProxy();
-
- QFile *file2 = new QFile(QFINDTESTDATA("../qnetworkreply/image1.jpg"));
- file2->open(QIODevice::ReadOnly);
- QTest::newRow("file-1MB") << md5Url << QByteArray() << QByteArray("POST")
- << static_cast<QObject *>(file2)
- << QByteArray("87ef3bb319b004ba9e5e9c9fa713776e\n") << QNetworkProxy();
-
-
- // 3. test uploading of multipart
-
- QUrl multiPartUrl("https://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/multipart.cgi");
-
- QHttpPart imagePart31;
- imagePart31.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
- imagePart31.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"testImage1\""));
- imagePart31.setRawHeader("Content-Location", "http://my.test.location.tld");
- imagePart31.setRawHeader("Content-ID", "my@id.tld");
- QFile *file31 = new QFile(QFINDTESTDATA("../qnetworkreply/image1.jpg"));
- file31->open(QIODevice::ReadOnly);
- imagePart31.setBodyDevice(file31);
- QHttpMultiPart *imageMultiPart3 = new QHttpMultiPart(QHttpMultiPart::FormDataType);
- imageMultiPart3->append(imagePart31);
- file31->setParent(imageMultiPart3);
- QHttpPart imagePart32;
- imagePart32.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
- imagePart32.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"testImage2\""));
- QFile *file32 = new QFile(QFINDTESTDATA("../qnetworkreply/image2.jpg"));
- file32->open(QIODevice::ReadOnly);
- imagePart32.setBodyDevice(file31); // check that resetting works
- imagePart32.setBodyDevice(file32);
- imageMultiPart3->append(imagePart32);
- file32->setParent(imageMultiPart3);
- QHttpPart imagePart33;
- imagePart33.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
- imagePart33.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"testImage3\""));
- QFile *file33 = new QFile(QFINDTESTDATA("../qnetworkreply/image3.jpg"));
- file33->open(QIODevice::ReadOnly);
- imagePart33.setBodyDevice(file33);
- imageMultiPart3->append(imagePart33);
- file33->setParent(imageMultiPart3);
- QByteArray expectedData = "content type: multipart/form-data; boundary=\""
- + imageMultiPart3->boundary();
- expectedData.append("\"\nkey: testImage1, value: 87ef3bb319b004ba9e5e9c9fa713776e\n"
- "key: testImage2, value: 483761b893f7fb1bd2414344cd1f3dfb\n"
- "key: testImage3, value: ab0eb6fd4fcf8b4436254870b4513033\n");
-
- QTest::newRow("multipart-3images") << multiPartUrl << QByteArray() << QByteArray("POST")
- << static_cast<QObject *>(imageMultiPart3) << expectedData
- << QNetworkProxy();
-}
-
-void tst_Spdy::upload()
-{
- QFETCH(QUrl, url);
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- QFETCH(QByteArray, data);
- QFETCH(QByteArray, uploadMethod);
- QFETCH(QObject *, uploadObject);
- QFETCH(QNetworkProxy, proxy);
-
- if (proxy.type() != QNetworkProxy::DefaultProxy) {
- m_manager.setProxy(proxy);
- }
-
- QNetworkReply *reply;
- QHttpMultiPart *multiPart = 0;
-
- if (uploadObject) {
- // upload via device
- if (QIODevice *device = qobject_cast<QIODevice *>(uploadObject)) {
- reply = m_manager.post(request, device);
- } else if ((multiPart = qobject_cast<QHttpMultiPart *>(uploadObject))) {
- reply = m_manager.post(request, multiPart);
- } else {
- QFAIL("got unknown upload device");
- }
- } else {
- // upload via byte array
- if (uploadMethod == "PUT") {
- reply = m_manager.put(request, data);
- } else {
- reply = m_manager.post(request, data);
- }
- }
-
- reply->ignoreSslErrors();
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy uploadProgressSpy(reply, SIGNAL(uploadProgress(qint64, qint64)));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(20);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), 1);
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
- QVERIFY(uploadProgressSpy.count() > 0);
- QVERIFY(readyReadSpy.count() > 0);
-
- QCOMPARE(reply->error(), QNetworkReply::NoError);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong();
- if (!multiPart) // script to test multiparts does not return a content length
- QCOMPARE(contentLength, 33); // 33 bytes for md5 sums (including new line)
-
- QFETCH(QByteArray, md5sum);
- QByteArray content = reply->readAll();
- QCOMPARE(content, md5sum);
-
- reply->deleteLater();
- if (uploadObject)
- uploadObject->deleteLater();
-
- m_manager.setProxy(QNetworkProxy()); // reset
-}
-
-void tst_Spdy::errors_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QNetworkProxy>("proxy");
- QTest::addColumn<bool>("ignoreSslErrors");
- QTest::addColumn<int>("expectedReplyError");
-
- QTest::newRow("http-404") << QUrl("https://" + QtNetworkSettings::serverName() + "/non-existent-url")
- << QNetworkProxy() << true << int(QNetworkReply::ContentNotFoundError);
-
- QTest::newRow("ssl-errors") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy() << false << int(QNetworkReply::SslHandshakeFailedError);
-
- QTest::newRow("host-not-found") << QUrl("https://this-host-does-not.exist")
- << QNetworkProxy()
- << true << int(QNetworkReply::HostNotFoundError);
-
- QTest::newRow("proxy-not-found") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy(QNetworkProxy::HttpProxy,
- "https://this-host-does-not.exist", 3128)
- << true << int(QNetworkReply::HostNotFoundError);
-
- QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName());
- QString proxyserver = hostInfo.addresses().first().toString();
-
- QTest::newRow("proxy-unavailable") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 10)
- << true << int(QNetworkReply::UnknownNetworkError);
-
- QTest::newRow("no-proxy-credentials") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3129)
- << true << int(QNetworkReply::ProxyAuthenticationRequiredError);
-}
-
-void tst_Spdy::errors()
-{
- QFETCH(QUrl, url);
- QFETCH(QNetworkProxy, proxy);
- QFETCH(bool, ignoreSslErrors);
- QFETCH(int, expectedReplyError);
-
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- disconnect(&m_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- 0, 0);
- if (proxy.type() != QNetworkProxy::DefaultProxy) {
- m_manager.setProxy(proxy);
- }
- QNetworkReply *reply = m_manager.get(request);
- if (ignoreSslErrors)
- reply->ignoreSslErrors();
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
- QSignalSpy errorSpy(reply, SIGNAL(error(QNetworkReply::NetworkError)));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedSpy.count(), 1);
- QCOMPARE(errorSpy.count(), 1);
-
- QCOMPARE(reply->error(), static_cast<QNetworkReply::NetworkError>(expectedReplyError));
-
- m_manager.setProxy(QNetworkProxy()); // reset
- m_manager.clearAccessCache(); // e.g. to get an SSL error we need a new connection
- connect(&m_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- this, SLOT(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- Qt::UniqueConnection); // reset
-}
-#endif // !QT_NO_NETWORKPROXY
-
-void tst_Spdy::multipleRequests_data()
-{
- QTest::addColumn<QList<QUrl> >("urls");
-
- QString baseUrl = "https://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi?";
- QList<QUrl> urls;
- for (int a = 1; a <= 50; ++a)
- urls.append(QUrl(baseUrl + QLatin1String(QByteArray::number(a))));
-
- QTest::newRow("one-request") << urls.mid(0, 1);
- QTest::newRow("two-requests") << urls.mid(0, 2);
- QTest::newRow("ten-requests") << urls.mid(0, 10);
- QTest::newRow("twenty-requests") << urls.mid(0, 20);
- QTest::newRow("fifty-requests") << urls;
-}
-
-void tst_Spdy::multipleRequestsFinishedSlot()
-{
- m_multipleRepliesFinishedCount++;
- if (m_multipleRepliesFinishedCount == m_multipleRequestsCount)
- QTestEventLoop::instance().exitLoop();
-}
-
-void tst_Spdy::multipleRequests()
-{
- QFETCH(QList<QUrl>, urls);
- m_multipleRequestsCount = urls.count();
- m_multipleRepliesFinishedCount = 0;
-
- QList<QNetworkReply *> replies;
- QList<QSignalSpy *> metaDataChangedSpies;
- QList<QSignalSpy *> readyReadSpies;
- QList<QSignalSpy *> finishedSpies;
-
- foreach (const QUrl &url, urls) {
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
- QNetworkReply *reply = m_manager.get(request);
- replies.append(reply);
- reply->ignoreSslErrors();
- QObject::connect(reply, SIGNAL(finished()), this, SLOT(multipleRequestsFinishedSlot()));
- QSignalSpy *metaDataChangedSpy = new QSignalSpy(reply, SIGNAL(metaDataChanged()));
- metaDataChangedSpies << metaDataChangedSpy;
- QSignalSpy *readyReadSpy = new QSignalSpy(reply, SIGNAL(readyRead()));
- readyReadSpies << readyReadSpy;
- QSignalSpy *finishedSpy = new QSignalSpy(reply, SIGNAL(finished()));
- finishedSpies << finishedSpy;
- }
-
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), m_multipleRequestsCount);
-
- for (int a = 0; a < replies.count(); ++a) {
-
-#ifndef QT_NO_OPENSSL
- QCOMPARE(replies.at(a)->sslConfiguration().nextProtocolNegotiationStatus(),
- QSslConfiguration::NextProtocolNegotiationNegotiated);
- QCOMPARE(replies.at(a)->sslConfiguration().nextNegotiatedProtocol(),
- QByteArray(QSslConfiguration::NextProtocolSpdy3_0));
-#endif // QT_NO_OPENSSL
-
- QCOMPARE(replies.at(a)->error(), QNetworkReply::NoError);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- // using the echo script, a request to "echo.cgi?1" will return a body of "1"
- QByteArray expectedContent = replies.at(a)->url().query().toUtf8();
- QByteArray content = replies.at(a)->readAll();
- QCOMPARE(expectedContent, content);
-
- QCOMPARE(metaDataChangedSpies.at(a)->count(), 1);
- metaDataChangedSpies.at(a)->deleteLater();
-
- QCOMPARE(finishedSpies.at(a)->count(), 1);
- finishedSpies.at(a)->deleteLater();
-
- QVERIFY(readyReadSpies.at(a)->count() > 0);
- readyReadSpies.at(a)->deleteLater();
-
- replies.at(a)->deleteLater();
- }
-}
-
-QTEST_MAIN(tst_Spdy)
-
-#include "tst_spdy.moc"
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 7d7fa6403b..82dc826db2 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -203,11 +203,15 @@ private slots:
void applicationTest();
void mainWindowTest();
void subWindowTest();
+#if QT_CONFIG(shortcut)
void buttonTest();
+#endif
void scrollBarTest();
void tabTest();
void tabWidgetTest();
+#if QT_CONFIG(shortcut)
void menuTest();
+#endif
void spinBoxTest();
void doubleSpinBoxTest();
void textEditTest();
@@ -234,8 +238,10 @@ private slots:
void dockWidgetTest();
void comboBoxTest();
void accessibleName();
+#if QT_CONFIG(shortcut)
void labelTest();
void accelerators();
+#endif
void bridgeTest();
protected slots:
@@ -1026,6 +1032,8 @@ public Q_SLOTS:
}
};
+#if QT_CONFIG(shortcut)
+
void tst_QAccessibility::buttonTest()
{
QWidget window;
@@ -1198,6 +1206,8 @@ void tst_QAccessibility::buttonTest()
// test->release();
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAccessibility::scrollBarTest()
{
QScrollBar *scrollBar = new QScrollBar(Qt::Horizontal);
@@ -1407,6 +1417,8 @@ void tst_QAccessibility::tabWidgetTest()
QTestAccessibility::clearEvents();
}
+#if QT_CONFIG(shortcut)
+
void tst_QAccessibility::menuTest()
{
{
@@ -1617,6 +1629,8 @@ void tst_QAccessibility::menuTest()
QTestAccessibility::clearEvents();
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAccessibility::spinBoxTest()
{
QSpinBox * const spinBox = new QSpinBox();
@@ -3629,6 +3643,8 @@ void tst_QAccessibility::comboBoxTest()
QTestAccessibility::clearEvents();
}
+#if QT_CONFIG(shortcut)
+
void tst_QAccessibility::labelTest()
{
QWidget *window = new QWidget;
@@ -3729,6 +3745,8 @@ void tst_QAccessibility::accelerators()
QTestAccessibility::clearEvents();
}
+#endif // QT_CONFIG(shortcut)
+
#ifdef QT_SUPPORTS_IACCESSIBLE2
static IUnknown *queryIA2(IAccessible *acc, const IID &iid)
{
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 260ba12a97..9285d5b5da 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -91,7 +91,9 @@ private slots:
void checkReason_BackTab();
void checkReason_Popup();
void checkReason_focusWidget();
+#if QT_CONFIG(shortcut)
void checkReason_Shortcut();
+#endif
void checkReason_ActiveWindow();
private:
@@ -250,6 +252,8 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
#endif
+#if QT_CONFIG(shortcut)
+
void tst_QFocusEvent::checkReason_Shortcut()
{
initWidget();
@@ -288,6 +292,8 @@ void tst_QFocusEvent::checkReason_Shortcut()
#endif
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QFocusEvent::checkReason_focusWidget()
{
// This test checks that a widget doesn't loose
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 6091975acb..7fda59a29b 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -96,8 +96,9 @@ private slots:
void task248107_backButton();
void task255350_fieldObjectDestroyed();
void taskQTBUG_25691_fieldObjectDestroyed2();
+#if QT_CONFIG(shortcut)
void taskQTBUG_46894_nextButtonShortcut();
-
+#endif
/*
Things that could be added:
@@ -2703,6 +2704,8 @@ void tst_QWizard::taskQTBUG_25691_fieldObjectDestroyed2()
::taskQTBUG_25691_fieldObjectDestroyed2();
}
+#if QT_CONFIG(shortcut)
+
void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
{
for (int i = 0; i < QWizard::NStyles; ++i) {
@@ -2717,5 +2720,7 @@ void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
}
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QWizard)
#include "tst_qwizard.moc"
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 6d415952c9..0fb95b9f34 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -450,7 +450,9 @@ private slots:
void modality_keyEvents();
void itemIsInFront();
void scenePosChange();
+#if QT_CONFIG(shortcut)
void textItem_shortcuts();
+#endif
void scroll();
void focusHandling_data();
void focusHandling();
@@ -10813,6 +10815,8 @@ void tst_QGraphicsItem::scenePosChange()
QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
}
+#if QT_CONFIG(shortcut)
+
void tst_QGraphicsItem::textItem_shortcuts()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
@@ -10852,6 +10856,8 @@ void tst_QGraphicsItem::textItem_shortcuts()
QTRY_COMPARE(item->textCursor().selectedText(), item->toPlainText());
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QGraphicsItem::scroll()
{
// Create two overlapping rectangles in the scene:
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index d5813d64ff..bb098f32c2 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -1744,7 +1744,7 @@ void tst_QHeaderView::restoreQt4State()
QCOMPARE(h2.length(), old_length);
QCOMPARE(h2.saveState(), old_state);
#else
- QSKIP("Qt4 compatibility no longer needed in Qt6")
+ QSKIP("Qt4 compatibility no longer needed in Qt6");
#endif
}
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 12b24798f4..1d0153213b 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -331,8 +331,10 @@ private slots:
void selectColumn_data();
void selectColumn();
+#if QT_CONFIG(shortcut)
void selectall_data();
void selectall();
+#endif
void visualRect_data();
void visualRect();
@@ -1843,6 +1845,8 @@ void tst_QTableView::selectColumn()
QCOMPARE(view.selectionModel()->selectedIndexes().at(i).column(), column);
}
+#if QT_CONFIG(shortcut)
+
void tst_QTableView::selectall_data()
{
QTest::addColumn<int>("rowCount");
@@ -1999,6 +2003,8 @@ void tst_QTableView::selectall()
QCOMPARE(view.selectedIndexes().count(), 0);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QTableView::visualRect_data()
{
QTest::addColumn<int>("rowCount");
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index af85a2bd13..5c5868e607 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -22,3 +22,6 @@ SUBDIRS=\
darwin:SUBDIRS -= \ # Uses native recognizers
qgesturerecognizer \
+
+!qtConfig(shortcut): SUBDIRS -= \
+ qshortcut
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 1247f48dd0..66a82d512d 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -57,18 +57,24 @@ private slots:
void setIconText();
void setUnknownFont();
void actionEvent();
+#if QT_CONFIG(shortcut)
void setStandardKeys();
void alternateShortcuts();
void enabledVisibleInteraction();
void task200823_tooltip();
+#endif
void task229128TriggeredSignalWithoutActiongroup();
void task229128TriggeredSignalWhenInActiongroup();
+#if QT_CONFIG(shortcut)
void repeat();
+#endif
void setData();
+#if QT_CONFIG(shortcut)
void keysequence(); // QTBUG-53381
void disableShortcutsWithBlockedWidgets_data();
void disableShortcutsWithBlockedWidgets();
void shortcutFromKeyEvent(); // QTBUG-48325
+#endif
private:
QEvent::Type m_lastEventType;
@@ -221,6 +227,8 @@ void tst_QAction::actionEvent()
QCOMPARE(m_lastAction, &a);
}
+#if QT_CONFIG(shortcut)
+
//basic testing of standard keys
void tst_QAction::setStandardKeys()
{
@@ -367,6 +375,8 @@ void tst_QAction::task200823_tooltip()
QCOMPARE(action->toolTip(), ref);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
{
// test without a group
@@ -408,6 +418,8 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
QCOMPARE(actionSpy.count(), 1);
}
+#if QT_CONFIG(shortcut)
+
void tst_QAction::repeat()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -452,6 +464,8 @@ void tst_QAction::repeat()
QCOMPARE(spy.count(), 2);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAction::setData() // QTBUG-62006
{
QAction act(nullptr);
@@ -467,6 +481,8 @@ void tst_QAction::setData() // QTBUG-62006
QCOMPARE(spy.count(), 1);
}
+#if QT_CONFIG(shortcut)
+
void tst_QAction::disableShortcutsWithBlockedWidgets_data()
{
QTest::addColumn<Qt::ShortcutContext>("shortcutContext");
@@ -556,5 +572,7 @@ void tst_QAction::shortcutFromKeyEvent()
QCOMPARE(testWidget.shortcutOverrideCount, 1);
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QAction)
#include "tst_qaction.moc"
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index c6760000f4..45a35fe4f1 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -99,7 +99,9 @@ class tst_QFormLayout : public QObject
private slots:
void cleanup();
void rowCount();
+#if QT_CONFIG(shortcut)
void buddies();
+#endif
void getItemPosition();
void wrapping();
void spacing();
@@ -190,6 +192,8 @@ void tst_QFormLayout::rowCount()
//TODO: remove items
}
+#if QT_CONFIG(shortcut)
+
void tst_QFormLayout::buddies()
{
QWidget w;
@@ -218,6 +222,8 @@ void tst_QFormLayout::buddies()
//TODO: empty label?
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QFormLayout::getItemPosition()
{
QWidget w;
@@ -687,17 +693,21 @@ void tst_QFormLayout::insertRow_QString_QWidget()
layout->insertRow(-5, "&Name:", fld1);
QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label1 != 0);
+#if QT_CONFIG(shortcut)
QCOMPARE(label1->buddy(), fld1);
-
+#endif
layout->insertRow(0, "&Email:", fld2);
QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label2 != 0);
+#if QT_CONFIG(shortcut)
QCOMPARE(label2->buddy(), fld2);
-
+#endif
layout->insertRow(5, "&Age:", fld3);
QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget());
QVERIFY(label3 != 0);
+#if QT_CONFIG(shortcut)
QCOMPARE(label3->buddy(), fld3);
+#endif
}
void tst_QFormLayout::insertRow_QString_QLayout()
@@ -711,21 +721,27 @@ void tst_QFormLayout::insertRow_QString_QLayout()
layout->insertRow(-5, "&Name:", fld1);
QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label1 != 0);
+#if QT_CONFIG(shortcut)
QVERIFY(!label1->buddy());
+#endif
QCOMPARE(layout->rowCount(), 1);
layout->insertRow(0, "&Email:", fld2);
QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label2 != 0);
+#if QT_CONFIG(shortcut)
QVERIFY(!label2->buddy());
+#endif
QCOMPARE(layout->rowCount(), 2);
layout->insertRow(5, "&Age:", fld3);
QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget());
QVERIFY(label3 != 0);
+#if QT_CONFIG(shortcut)
QVERIFY(!label3->buddy());
+#endif
QCOMPARE(layout->rowCount(), 3);
}
diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
index eb108a40de..e5a891912f 100644
--- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
+++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
@@ -34,7 +34,9 @@
#include <qapplication.h>
#include <qpainter.h>
#include <qstyleoption.h>
-#include <qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <qkeysequence.h>
+#endif
#include <qevent.h>
#include <qgridlayout.h>
#include <qabstractbutton.h>
@@ -59,7 +61,9 @@ private slots:
void setText();
void setIcon();
+#if QT_CONFIG(shortcut)
void setShortcut();
+#endif
void animateClick();
@@ -68,7 +72,9 @@ private slots:
void isChecked();
void toggled();
void setEnabled();
+#if QT_CONFIG(shortcut)
void shortcutEvents();
+#endif
void stopRepeatTimer();
void mouseReleased(); // QTBUG-53244
@@ -164,8 +170,10 @@ void tst_QAbstractButton::init()
testWidget->setEnabled( true );
testWidget->setDown( false );
testWidget->setAutoRepeat( false );
+#if QT_CONFIG(shortcut)
QKeySequence seq;
testWidget->setShortcut( seq );
+#endif
toggle_count = 0;
press_count = 0;
@@ -336,17 +344,17 @@ void tst_QAbstractButton::setText()
QCOMPARE( testWidget->text(), QString("simple") );
testWidget->setText("&ampersand");
QCOMPARE( testWidget->text(), QString("&ampersand") );
-#ifndef Q_OS_MAC // no mneonics on Mac.
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac.
QCOMPARE( testWidget->shortcut(), QKeySequence("ALT+A"));
#endif
testWidget->setText("te&st");
QCOMPARE( testWidget->text(), QString("te&st") );
-#ifndef Q_OS_MAC // no mneonics on Mac.
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac.
QCOMPARE( testWidget->shortcut(), QKeySequence("ALT+S"));
#endif
testWidget->setText("foo");
QCOMPARE( testWidget->text(), QString("foo") );
-#ifndef Q_OS_MAC // no mneonics on Mac.
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac.
QCOMPARE( testWidget->shortcut(), QKeySequence());
#endif
}
@@ -471,6 +479,7 @@ void tst_QAbstractButton::toggled()
testWidget->setCheckable(false);
}
+#if QT_CONFIG(shortcut)
void tst_QAbstractButton::setShortcut()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
@@ -502,6 +511,7 @@ void tst_QAbstractButton::setShortcut()
// qDebug() << click_count;
}
+#endif // QT_CONFIG(shortcut)
void tst_QAbstractButton::animateClick()
{
@@ -512,6 +522,8 @@ void tst_QAbstractButton::animateClick()
QTRY_VERIFY( !testWidget->isDown() );
}
+#if QT_CONFIG(shortcut)
+
void tst_QAbstractButton::shortcutEvents()
{
MyButton button;
@@ -535,6 +547,8 @@ void tst_QAbstractButton::shortcutEvents()
QCOMPARE(clickedSpy.count(), 3);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAbstractButton::stopRepeatTimer()
{
MyButton button;
diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
index 0044d33c66..45a23984e0 100644
--- a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
+++ b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
@@ -51,7 +51,9 @@ private slots:
void getSetCheck();
void pressed();
+#if QT_CONFIG(shortcut)
void setAccel();
+#endif
void isCheckable();
void setDown();
void popupCrash();
@@ -133,8 +135,10 @@ void tst_QCommandLinkButton::init()
testWidget->setText("Test");
testWidget->setDescription("Description text.");
testWidget->setEnabled( true );
+#if QT_CONFIG(shortcut)
QKeySequence seq;
testWidget->setShortcut( seq );
+#endif
resetCounters();
}
@@ -327,6 +331,8 @@ void tst_QCommandLinkButton::toggled()
QVERIFY( click_count == 1 );
}
+#if QT_CONFIG(shortcut)
+
/*
If we press an accelerator key we ONLY get a pressed signal and
NOT a released or clicked signal.
@@ -355,6 +361,8 @@ void tst_QCommandLinkButton::setAccel()
QTest::qWait(200);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QCommandLinkButton::animateClick()
{
QVERIFY( !testWidget->isDown() );
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
index c293a4bdd2..c6de750482 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -166,7 +166,9 @@ private slots:
void doubleDot();
+#if QT_CONFIG(shortcut)
void undoRedo();
+#endif
void valueFromTextAndValidate_data();
void valueFromTextAndValidate();
@@ -1025,6 +1027,8 @@ void tst_QDoubleSpinBox::doubleDot()
QCOMPARE(spin.lineEdit()->cursorPosition(), 2);
}
+#if QT_CONFIG(shortcut)
+
void tst_QDoubleSpinBox::undoRedo()
{
//test undo/redo feature (in conjunction with the "undoRedoEnabled" property)
@@ -1073,6 +1077,8 @@ void tst_QDoubleSpinBox::undoRedo()
QVERIFY(!spin.lineEdit()->isRedoAvailable());
}
+#endif // QT_CONFIG(shortcut)
+
struct task199226_DoubleSpinBox : public QDoubleSpinBox
{
task199226_DoubleSpinBox(QWidget *parent = 0) : QDoubleSpinBox(parent) {}
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index f599ac73c6..7760e12cca 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -68,7 +68,7 @@ private Q_SLOTS:
void setText_data();
void setText();
void setTextFormat();
-#ifndef Q_OS_MAC
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN)
void setBuddy();
#endif
void setNum();
@@ -88,8 +88,10 @@ private Q_SLOTS:
void unicodeText_data();
void unicodeText();
+#if QT_CONFIG(shortcut)
void mnemonic_data();
void mnemonic();
+#endif
void selection();
#ifndef QT_NO_CONTEXTMENU
@@ -116,6 +118,7 @@ void tst_QLabel::getSetCheck()
obj1.setWordWrap(true);
QCOMPARE(true, obj1.wordWrap());
+#if QT_CONFIG(shortcut)
// QWidget * QLabel::buddy()
// void QLabel::setBuddy(QWidget *)
QWidget *var2 = new QWidget();
@@ -124,6 +127,7 @@ void tst_QLabel::getSetCheck()
obj1.setBuddy((QWidget *)0);
QCOMPARE((QWidget *)0, obj1.buddy());
delete var2;
+#endif // QT_CONFIG(shortcut)
// QMovie * QLabel::movie()
// void QLabel::setMovie(QMovie *)
@@ -153,7 +157,9 @@ void tst_QLabel::cleanupTestCase()
void tst_QLabel::init()
{
testWidget->setTextFormat( Qt::AutoText );
+# if QT_CONFIG(shortcut)
testWidget->setBuddy( 0 );
+#endif
testWidget->setIndent( 0 );
testWidget->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
testWidget->setScaledContents( false );
@@ -169,7 +175,7 @@ void tst_QLabel::cleanup()
}
// Set buddy doesn't make much sense on OS X
-#ifndef Q_OS_MAC
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN)
void tst_QLabel::setBuddy()
{
testWidget->hide();
@@ -204,7 +210,7 @@ void tst_QLabel::setBuddy()
delete test_box;
}
-#endif
+#endif // QT_CONFIG(shortcut) && !Q_OS_DARWIN
void tst_QLabel::setText_data()
{
@@ -469,6 +475,8 @@ void tst_QLabel::unicodeText()
testWidget->show();
}
+#if QT_CONFIG(shortcut)
+
void tst_QLabel::mnemonic_data()
{
QTest::addColumn<QString>("text");
@@ -513,6 +521,8 @@ void tst_QLabel::mnemonic()
QCOMPARE(d->shortcutCursor.selectedText(), expectedShortcutCursor);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLabel::selection()
{
QLabel label;
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 5988987d0d..a8b68c18ca 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -56,7 +56,9 @@
#include <qsortfilterproxymodel.h>
#include <qdebug.h>
#include <qscreen.h>
-#include <qshortcut.h>
+#if QT_CONFIG(shortcut)
+# include <qshortcut.h>
+#endif
#include "qcommonstyle.h"
#include "qstyleoption.h"
@@ -135,9 +137,11 @@ private slots:
void clearInputMask();
+#if QT_CONFIG(shortcut)
void keypress_inputMask_data();
void keypress_inputMask();
void keypress_inputMethod_inputMask();
+#endif
void inputMaskAndValidator_data();
void inputMaskAndValidator();
@@ -219,7 +223,7 @@ private slots:
void setSelection_data();
void setSelection();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard) && QT_CONFIG(shortcut)
void cut();
void cutWithoutSelection();
#endif
@@ -299,8 +303,10 @@ private slots:
void shouldShowPlaceholderText();
void QTBUG1266_setInputMaskEmittingTextEdited();
+#if QT_CONFIG(shortcut)
void shortcutOverrideOnReadonlyLineEdit_data();
void shortcutOverrideOnReadonlyLineEdit();
+#endif
void QTBUG59957_clearButtonLeftmostAction();
void QTBUG_60319_setInputMaskCheckImSurroundingText();
void testQuickSelectionWithMouse();
@@ -319,7 +325,9 @@ private:
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
bool unselectingWithLeftOrRightChangesCursorPosition();
+#if QT_CONFIG(shortcut)
void addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey);
+#endif
QLineEdit *ensureTestWidget();
bool validInput;
@@ -715,6 +723,8 @@ void tst_QLineEdit::clearInputMask()
QCOMPARE(testWidget->inputMask(), QString());
}
+#if QT_CONFIG(shortcut)
+
void tst_QLineEdit::keypress_inputMask_data()
{
QTest::addColumn<QString>("mask");
@@ -832,6 +842,8 @@ void tst_QLineEdit::keypress_inputMethod_inputMask()
QCOMPARE(testWidget->text(), QStringLiteral("EE.EE.EE"));
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLineEdit::hasAcceptableInputMask_data()
{
QTest::addColumn<QString>("optionalMask");
@@ -1986,6 +1998,8 @@ void tst_QLineEdit::psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardMo
keys.addKeyClick(key, pressState);
}
+#if QT_CONFIG(shortcut)
+
void tst_QLineEdit::addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey key)
{
QKeySequence keyseq = QKeySequence(key);
@@ -1993,6 +2007,8 @@ void tst_QLineEdit::addKeySequenceStandardKey(QTestEventList &keys, QKeySequence
keys.addKeyClick( Qt::Key( keyseq[i] & ~Qt::KeyboardModifierMask), Qt::KeyboardModifier(keyseq[i] & Qt::KeyboardModifierMask) );
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLineEdit::cursorPosition()
{
QLineEdit *testWidget = ensureTestWidget();
@@ -3023,7 +3039,7 @@ void tst_QLineEdit::setSelection()
QCOMPARE(testWidget->cursorPosition(), expectedCursor);
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard) && QT_CONFIG(shortcut)
void tst_QLineEdit::cut()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -3124,7 +3140,7 @@ void tst_QLineEdit::cutWithoutSelection()
QCOMPARE(clipboard->text(), origText.left(selectionLength));
}
-#endif // !QT_NO_CLIPBOARD
+#endif // QT_CONFIG(clipboard) && QT_CONFIG(shortcut)
class InputMaskValidator : public QValidator
{
@@ -3969,7 +3985,9 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
le.setReadOnly(true);
QAction action(QString::fromLatin1("hello"), &le);
+#if QT_CONFIG(shortcut)
action.setShortcut(QString::fromLatin1("p"));
+#endif
QSignalSpy spy(&action, SIGNAL(triggered()));
le.addAction(&action);
@@ -4704,6 +4722,8 @@ void tst_QLineEdit::QTBUG1266_setInputMaskEmittingTextEdited()
QCOMPARE(spy.count(), 0);
}
+#if QT_CONFIG(shortcut)
+
void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit_data()
{
QTest::addColumn<QKeySequence>("keySequence");
@@ -4763,6 +4783,8 @@ void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit()
QCOMPARE(spy.count(), activationCount);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLineEdit::QTBUG59957_clearButtonLeftmostAction()
{
#ifndef QT_BUILD_INTERNAL
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 9c40c0bd57..823084ee43 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -481,7 +481,7 @@ void tst_QMenu::overrideMenuAction()
// On Mac and Windows CE, we need to create native key events to test menu
// action activation, so skip this part of the test.
-#if !defined(Q_OS_DARWIN)
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN)
QAction *aQuit = new QAction("Quit", &w);
aQuit->setShortcut(QKeySequence("Ctrl+X"));
m->addAction(aQuit);
@@ -499,7 +499,7 @@ void tst_QMenu::overrideMenuAction()
//test if the menu still pops out
QTest::keyClick(&w, Qt::Key_F, Qt::AltModifier);
QTRY_VERIFY(m->isVisible());
-#endif
+#endif // QT_CONFIG(shortcut) && !Q_OS_DARWIN
delete aFileMenu;
@@ -1706,10 +1706,13 @@ void tst_QMenu::QTBUG_61039_menu_shortcuts()
QSKIP("Window activation is not supported");
QAction *actionKamen = new QAction("Action Kamen");
+#if QT_CONFIG(shortcut)
actionKamen->setShortcut(QKeySequence(QLatin1String("K")));
-
+#endif
QAction *actionJoe = new QAction("Action Joe");
+#if QT_CONFIG(shortcut)
actionJoe->setShortcut(QKeySequence(QLatin1String("Ctrl+J")));
+#endif
QMenu menu;
menu.addAction(actionKamen);
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index f2d4379453..8b372a78cf 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -232,19 +232,25 @@ TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb, bool forceNonNative) {
connect(mb, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*)));
QMenu *menu = mb->addMenu(QStringLiteral("&accel"));
QAction *action = menu->addAction(QStringLiteral("menu1") );
+#if QT_CONFIG(shortcut)
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
+#endif
connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*)));
result.menus << menu;
result.actions << action;
menu = mb->addMenu(QStringLiteral("accel1"));
action = menu->addAction(QStringLiteral("&Open...") );
+#if QT_CONFIG(shortcut)
action->setShortcut(Qt::Key_O);
+#endif
result.actions << action;
action = menu->addAction(QStringLiteral("action"));
+#if QT_CONFIG(shortcut)
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Z));
+#endif
result.actions << action;
result.menus << menu;
@@ -283,7 +289,9 @@ QAction *tst_QMenuBar::createCharacterAction(QMenu *menu, char lowerAscii)
QAction *action = menu->addAction(text);
action->setObjectName(text);
action->setData(QVariant(int(lowerAscii)));
+#if QT_CONFIG(shortcut)
action->setShortcut(Qt::CTRL + (lowerAscii - 'a' + Qt::Key_A));
+#endif
connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered()));
return action;
}
@@ -318,7 +326,9 @@ TestMenu tst_QMenuBar::initComplexMenuBar(QMenuBar *mb)
QAction *action = mb->addAction(QStringLiteral("M&enu 3"));
action->setData(QVariant(3));
+#if QT_CONFIG(shortcut)
action->setShortcut(Qt::ALT + Qt::Key_J);
+#endif
connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered()));
result.actions << action;
@@ -1422,7 +1432,9 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
menubar.setNativeMenuBar(false);
QMenu menu("menu1");
QAction *first = menubar.addMenu(&menu);
+#if QT_CONFIG(shortcut)
menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC"));
+#endif
centerOnScreen(&menubar);
menubar.show();
QApplication::setActiveWindow(&menubar);
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 6f4838be7a..d0ed68c0c8 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -53,7 +53,9 @@ private slots:
void getSetCheck();
void autoRepeat();
void pressed();
+#if QT_CONFIG(shortcut)
void setAccel();
+#endif
void isCheckable();
void setDown();
void popupCrash();
@@ -65,7 +67,9 @@ private slots:
void defaultAndAutoDefault();
void sizeHint_data();
void sizeHint();
+#if QT_CONFIG(shortcut)
void taskQTBUG_20191_shortcutWithKeypadModifer();
+#endif
void emitReleasedAfterChange();
protected slots:
@@ -125,8 +129,10 @@ void tst_QPushButton::init()
testWidget->setDown( false );
testWidget->setText("Test");
testWidget->setEnabled( true );
+#if QT_CONFIG(shortcut)
QKeySequence seq;
testWidget->setShortcut( seq );
+#endif
resetCounters();
}
@@ -318,6 +324,8 @@ void tst_QPushButton::toggled()
QVERIFY( click_count == 1 );
}
+#if QT_CONFIG(shortcut)
+
/*
If we press an accelerator key we ONLY get a pressed signal and
NOT a released or clicked signal.
@@ -349,6 +357,8 @@ void tst_QPushButton::setAccel()
QTRY_VERIFY( !testWidget->isDown() );
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QPushButton::animateClick()
{
QVERIFY( !testWidget->isDown() );
@@ -571,6 +581,8 @@ void tst_QPushButton::sizeHint()
}
}
+#if QT_CONFIG(shortcut)
+
void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
{
// setup a dialog with two buttons
@@ -617,6 +629,8 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
QCOMPARE(spy2.count(), 1);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QPushButton::emitReleasedAfterChange()
{
QPushButton *button1 = new QPushButton("A");
diff --git a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
index 7123acfdc3..5c7d3bf1e9 100644
--- a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
+++ b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
@@ -44,12 +44,16 @@ public:
virtual ~tst_QRadioButton(){};
private slots:
+#if QT_CONFIG(shortcut)
void task190739_focus();
+#endif
void minimumSizeHint();
private:
};
+#if QT_CONFIG(shortcut)
+
void tst_QRadioButton::task190739_focus()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -84,6 +88,7 @@ void tst_QRadioButton::task190739_focus()
QVERIFY(!radio1.hasFocus());
}
+#endif // QT_CONFIG(shortcut)
void tst_QRadioButton::minimumSizeHint()
{
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 30c57c73e5..b5d2e68118 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -47,7 +47,9 @@
#include <QLocale>
#include <QDoubleSpinBox>
#include <QVBoxLayout>
-#include <QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QKeySequence>
+#endif
#include <QStackedWidget>
#include <QDebug>
#include <QStyleOptionSpinBox>
@@ -173,7 +175,10 @@ private slots:
void removeAll();
void startWithDash();
+
+#if QT_CONFIG(shortcut)
void undoRedo();
+#endif
void specialValue();
void textFromValue();
@@ -1024,6 +1029,8 @@ void tst_QSpinBox::startWithDash()
QCOMPARE(spin.text(), QString("0"));
}
+#if QT_CONFIG(shortcut)
+
void tst_QSpinBox::undoRedo()
{
//test undo/redo feature (in conjunction with the "undoRedoEnabled" property)
@@ -1076,6 +1083,8 @@ void tst_QSpinBox::undoRedo()
QVERIFY(!spin.lineEdit()->isRedoAvailable());
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QSpinBox::specialValue()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
diff --git a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
index 4afb1c9751..1e71f92361 100644
--- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
+++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
@@ -40,7 +40,9 @@
#include <qwidgetaction.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
-#include <qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <qkeysequence.h>
+#endif
#include <qmenu.h>
#include <qlabel.h>
#include <private/qtoolbarextension_p.h>
diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro
index c6325aac15..66950fa85a 100644
--- a/tests/auto/widgets/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets/widgets.pro
@@ -47,6 +47,9 @@ SUBDIRS=\
qtoolbox \
qtoolbutton \
+!qtConfig(shortcut): SUBDIRS -= \
+ qkeysequenceedit
+
# The following tests depend on private API:
!qtConfig(private_tests): SUBDIRS -= \
qabstractspinbox \
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index b09a3447e3..901cadc34a 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -33,7 +33,7 @@
#include <QDebug>
#include <QFile>
#include <QList>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QTextStream>
#include <QtTest/QtTest>
#include <QtXml>
@@ -437,10 +437,10 @@ void tst_QDom::save_data()
QTest::addColumn<int>("indent");
QTest::addColumn<QString>("res");
- QTest::newRow( "01" ) << doc01 << 0 << QString(doc01).replace( QRegExp(" "), "" );
+ QTest::newRow( "01" ) << doc01 << 0 << QString(doc01).replace( QRegularExpression(" "), "" );
QTest::newRow( "02" ) << doc01 << 1 << doc01;
- QTest::newRow( "03" ) << doc01 << 2 << QString(doc01).replace( QRegExp(" "), " " );
- QTest::newRow( "04" ) << doc01 << 10 << QString(doc01).replace( QRegExp(" "), " " );
+ QTest::newRow( "03" ) << doc01 << 2 << QString(doc01).replace( QRegularExpression(" "), " " );
+ QTest::newRow( "04" ) << doc01 << 10 << QString(doc01).replace( QRegularExpression(" "), " " );
}
void tst_QDom::save()
diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
index eae752d99a..60c75ead4d 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
@@ -44,9 +44,19 @@
#include "qfilesystemiterator.h"
+#if QT_HAS_INCLUDE(<filesystem>) && defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L
+#define HAS_STD_FILESYSTEM
+#endif
+
+#ifdef HAS_STD_FILESYSTEM
+#include <filesystem>
+#endif
+
class tst_qdiriterator : public QObject
{
Q_OBJECT
+
+ void data();
private slots:
void posix();
void posix_data() { data(); }
@@ -54,7 +64,8 @@ private slots:
void diriterator_data() { data(); }
void fsiterator();
void fsiterator_data() { data(); }
- void data();
+ void stdRecursiveDirectoryIterator();
+ void stdRecursiveDirectoryIterator_data() { data(); }
};
@@ -235,6 +246,28 @@ void tst_qdiriterator::fsiterator()
qDebug() << count;
}
+void tst_qdiriterator::stdRecursiveDirectoryIterator()
+{
+#ifdef HAS_STD_FILESYSTEM
+ QFETCH(QByteArray, dirpath);
+
+ int count = 0;
+
+ QBENCHMARK {
+ int c = 0;
+ for (auto obj : std::filesystem::recursive_directory_iterator(dirpath.data())) {
+ if (obj.is_directory())
+ continue;
+ c++;
+ }
+ count = c;
+ }
+ qDebug() << count;
+#else
+ QSKIP("Not supported.");
+#endif
+}
+
QTEST_MAIN(tst_qdiriterator)
#include "main.moc"
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
index 061b22a5d1..4b28946f18 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
@@ -3,6 +3,8 @@ TARGET = tst_bench_qdiriterator
QT = core testlib
CONFIG += release
+# Enable c++17 support for std::filesystem
+qtConfig(c++1z): CONFIG += c++17
SOURCES += main.cpp qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
diff --git a/tests/benchmarks/corelib/kernel/qobject/main.cpp b/tests/benchmarks/corelib/kernel/qobject/main.cpp
index 04ca69ad3b..918227f74e 100644
--- a/tests/benchmarks/corelib/kernel/qobject/main.cpp
+++ b/tests/benchmarks/corelib/kernel/qobject/main.cpp
@@ -51,8 +51,55 @@ private slots:
void connect_disconnect_benchmark_data();
void connect_disconnect_benchmark();
void receiver_destroyed_benchmark();
+
+ void stdAllocator();
};
+class QObjectUsingStandardAllocator : public QObject
+{
+ Q_OBJECT
+public:
+ QObjectUsingStandardAllocator()
+ {
+ }
+};
+
+template<class T>
+inline void allocator()
+{
+ // We need to allocate certain amount of objects otherwise the new implementation
+ // may re-use the previous allocation, hiding the somehow high cost of allocation. It
+ // also helps us to reduce the noise ratio, which is high for memory allocation.
+ //
+ // The check depends on memory allocation performance, which is quite non-deterministic.
+ // When a new memory is requested, the new operator, depending on implementation, is trying
+ // to re-use existing, already allocated for the process memory. If there is not enough, it
+ // asks OS to give more. Of course the first case is faster then the second. In the same
+ // time, from an application perspective the first is also more likely.
+ //
+ // As a result, depending on which use-case one wants to test, it may be recommended to run this
+ // test in separation from others, to "force" expensive code path in the memory allocation.
+ //
+ // The time based results are heavily affected by background noise. One really needs to
+ // prepare OS (no other tasks, CPU and RAM reservations) to run this test, or use
+ // instruction counting which seems to be less fragile.
+
+ const int count = 256 * 1024;
+
+ QScopedPointer<T> objects[count];
+ QBENCHMARK_ONCE {
+ for (int i = 0; i < count; ++i)
+ objects[i].reset(new T);
+ for (int i = 0; i < count; ++i)
+ objects[i].reset();
+ }
+}
+
+void QObjectBenchmark::stdAllocator()
+{
+ allocator<QObjectUsingStandardAllocator>();
+}
+
struct Functor {
void operator()(){}
};
diff --git a/tests/benchmarks/corelib/tools/qvector/outofline.cpp b/tests/benchmarks/corelib/tools/qvector/outofline.cpp
index 76a4edaa10..7182a43008 100644
--- a/tests/benchmarks/corelib/tools/qvector/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qvector/outofline.cpp
@@ -54,7 +54,7 @@ QVector<double> mixedvector_fill_and_return_helper()
std::vector<double> v(N);
for (int i = 0; i != N; ++i)
v[i] = i;
- return QVector<double>::fromStdVector(v);
+ return QVector<double>(v.begin(), v.end());
}
diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
index 46bb1791b4..1f3f38eaaf 100644
--- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
+++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
@@ -105,7 +105,7 @@ void qfile_vs_qnetworkaccessmanager::qnamFileRead()
}
qint64 elapsed = t.elapsed();
- qDebug() << endl << "Finished!";
+ qDebug() << Qt::endl << "Finished!";
qDebug() << "Bytes:" << size;
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
}
@@ -138,7 +138,7 @@ void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead()
}
qint64 elapsed = t.elapsed();
- qDebug() << endl << "Finished!";
+ qDebug() << Qt::endl << "Finished!";
qDebug() << "Bytes:" << size;
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
}
@@ -167,7 +167,7 @@ void qfile_vs_qnetworkaccessmanager::qfileFileRead()
}
qint64 elapsed = t.elapsed();
- qDebug() << endl << "Finished!";
+ qDebug() << Qt::endl << "Finished!";
qDebug() << "Bytes:" << size;
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
}
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index c182ef7ebf..6dd7eaee6b 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -544,15 +544,10 @@ void tst_qnetworkreply::echoPerformance()
void tst_qnetworkreply::preConnectEncrypted()
{
QFETCH(int, sleepTime);
- QFETCH(QSslConfiguration, sslConfiguration);
- bool spdyEnabled = !sslConfiguration.isNull();
-
QString hostName = QLatin1String("www.google.com");
QNetworkAccessManager manager;
QNetworkRequest request(QUrl("https://" + hostName));
- if (spdyEnabled)
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
// make sure we have a full request including
// DNS lookup, TCP and SSL handshakes
@@ -578,12 +573,7 @@ void tst_qnetworkreply::preConnectEncrypted()
manager.clearAccessCache();
// now try to make the connection beforehand
- if (spdyEnabled) {
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
- manager.connectToHostEncrypted(hostName, 443, sslConfiguration);
- } else {
- manager.connectToHostEncrypted(hostName);
- }
+ manager.connectToHostEncrypted(hostName);
QTestEventLoop::instance().enterLoopMSecs(sleepTime);
// now make another request and hopefully use the existing connection
@@ -591,8 +581,6 @@ void tst_qnetworkreply::preConnectEncrypted()
QNetworkReply *preConnectReply = normalResult.first;
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(preConnectReply->error() == QNetworkReply::NoError);
- bool spdyWasUsed = preConnectReply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool();
- QCOMPARE(spdyEnabled, spdyWasUsed);
qint64 preConnectElapsed = preConnectResult.second;
qDebug() << request.url().toString() << "full request:" << normalElapsed
<< "ms, pre-connect request:" << preConnectElapsed << "ms, difference:"
@@ -605,27 +593,11 @@ void tst_qnetworkreply::preConnectEncrypted_data()
{
#ifndef QT_NO_OPENSSL
QTest::addColumn<int>("sleepTime");
- QTest::addColumn<QSslConfiguration>("sslConfiguration");
-
// start a new normal request after preconnecting is done
- QTest::newRow("HTTPS-2secs") << 2000 << QSslConfiguration();
+ QTest::newRow("HTTPS-2secs") << 2000;
// start a new normal request while preconnecting is in-flight
- QTest::newRow("HTTPS-100ms") << 100 << QSslConfiguration();
-
- QSslConfiguration spdySslConf = QSslConfiguration::defaultConfiguration();
- QList<QByteArray> nextProtocols = QList<QByteArray>()
- << QSslConfiguration::NextProtocolSpdy3_0
- << QSslConfiguration::NextProtocolHttp1_1;
- spdySslConf.setAllowedNextProtocols(nextProtocols);
-
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) && OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
- // start a new SPDY request while preconnecting is done
- QTest::newRow("SPDY-2secs") << 2000 << spdySslConf;
-
- // start a new SPDY request while preconnecting is in-flight
- QTest::newRow("SPDY-100ms") << 100 << spdySslConf;
-#endif // defined (QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) ...
+ QTest::newRow("HTTPS-100ms") << 100;
#endif // QT_NO_OPENSSL
}
diff --git a/tests/manual/dialogs/messageboxpanel.cpp b/tests/manual/dialogs/messageboxpanel.cpp
index ef6731cd74..3c6a042e19 100644
--- a/tests/manual/dialogs/messageboxpanel.cpp
+++ b/tests/manual/dialogs/messageboxpanel.cpp
@@ -39,6 +39,8 @@
#include <QLineEdit>
#include <QLabel>
#include <QCheckBox>
+#include <QRegularExpressionValidator>
+#include <QRegularExpression>
MessageBoxPanel::MessageBoxPanel(QWidget *parent) : QWidget(parent)
,m_iconComboBox(new QComboBox)
@@ -80,7 +82,7 @@ MessageBoxPanel::MessageBoxPanel(QWidget *parent) : QWidget(parent)
// buttons mask
optionsLayout->addWidget(new QLabel(QString::fromLatin1("Message box button mask (in hex)")));
- m_validator = new QRegExpValidator(QRegExp("0[xX]?[0-9a-fA-F]+"), this);
+ m_validator = new QRegularExpressionValidator(QRegularExpression("0[xX]?[0-9a-fA-F]+"), this);
m_buttonsMask->setMaxLength(10);
m_buttonsMask->setValidator(m_validator);
m_buttonsMask->setText(QString::fromLatin1("0x00300400"));
diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp
index afac7a7095..01bd30a854 100644
--- a/tests/manual/qnetworkreply/main.cpp
+++ b/tests/manual/qnetworkreply/main.cpp
@@ -58,9 +58,6 @@ private slots:
void setSslConfiguration_data();
void setSslConfiguration();
void uploadToFacebook();
- void spdy_data();
- void spdy();
- void spdyMultipleRequestsPerHost();
void proxyAuthentication_data();
void proxyAuthentication();
void authentication();
@@ -290,126 +287,6 @@ void tst_qnetworkreply::uploadToFacebook()
}
}
-void tst_qnetworkreply::spdy_data()
-{
- QTest::addColumn<QString>("host");
- QTest::addColumn<bool>("setAttribute");
- QTest::addColumn<bool>("enabled");
- QTest::addColumn<QByteArray>("expectedProtocol");
-
- QList<QString> hosts = QList<QString>()
- << QStringLiteral("www.google.com") // sends SPDY and 30x redirect
- << QStringLiteral("www.google.de") // sends SPDY and 200 OK
- << QStringLiteral("mail.google.com") // sends SPDY and 200 OK
- << QStringLiteral("www.youtube.com") // sends SPDY and 200 OK
- << QStringLiteral("www.dropbox.com") // no SPDY, but NPN which selects HTTP
- << QStringLiteral("www.facebook.com") // sends SPDY and 200 OK
- << QStringLiteral("graph.facebook.com") // sends SPDY and 200 OK
- << QStringLiteral("www.twitter.com") // sends SPDY and 30x redirect
- << QStringLiteral("twitter.com") // sends SPDY and 200 OK
- << QStringLiteral("api.twitter.com"); // sends SPDY and 200 OK
-
- foreach (const QString &host, hosts) {
- QByteArray tag = host.toLocal8Bit();
- tag.append("-not-used");
- QTest::newRow(tag)
- << QStringLiteral("https://") + host
- << false
- << false
- << QByteArray();
-
- tag = host.toLocal8Bit();
- tag.append("-disabled");
- QTest::newRow(tag)
- << QStringLiteral("https://") + host
- << true
- << false
- << QByteArray();
-
- if (host != QStringLiteral("api.twitter.com")) { // they don't offer an API over HTTP
- tag = host.toLocal8Bit();
- tag.append("-no-https-url");
- QTest::newRow(tag)
- << QStringLiteral("http://") + host
- << true
- << true
- << QByteArray();
- }
-
-#ifndef QT_NO_OPENSSL
- tag = host.toLocal8Bit();
- tag.append("-enabled");
- QTest::newRow(tag)
- << QStringLiteral("https://") + host
- << true
- << true
- << (host == QStringLiteral("www.dropbox.com")
- ? QByteArray(QSslConfiguration::NextProtocolHttp1_1)
- : QByteArray(QSslConfiguration::NextProtocolSpdy3_0));
-#endif // QT_NO_OPENSSL
- }
-}
-
-void tst_qnetworkreply::spdy()
-{
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) && OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
-
- m_manager.clearAccessCache();
-
- QFETCH(QString, host);
- QUrl url(host);
- QNetworkRequest request(url);
-
- QFETCH(bool, setAttribute);
- QFETCH(bool, enabled);
- if (setAttribute) {
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, QVariant(enabled));
- }
-
- QNetworkReply *reply = m_manager.get(request);
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QFETCH(QByteArray, expectedProtocol);
-
- bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), expectedSpdyUsed);
-
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
- QCOMPARE(finishedManagerSpy.count(), 1);
-
- QUrl redirectUrl = reply->header(QNetworkRequest::LocationHeader).toUrl();
- QByteArray content = reply->readAll();
-
- int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- QVERIFY(statusCode >= 200 && statusCode < 500);
- if (statusCode == 200 || statusCode >= 400) {
- QVERIFY(readyReadSpy.count() > 0);
- QVERIFY(!content.isEmpty());
- } else if (statusCode >= 300 && statusCode < 400) {
- QVERIFY(!redirectUrl.isEmpty());
- }
-
- QSslConfiguration::NextProtocolNegotiationStatus expectedStatus =
- expectedProtocol.isNull() ? QSslConfiguration::NextProtocolNegotiationNone
- : QSslConfiguration::NextProtocolNegotiationNegotiated;
- QCOMPARE(reply->sslConfiguration().nextProtocolNegotiationStatus(),
- expectedStatus);
-
- QCOMPARE(reply->sslConfiguration().nextNegotiatedProtocol(), expectedProtocol);
-#else
- QSKIP("Qt built withouth OpenSSL, or the OpenSSL version is too old");
-#endif // defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) ...
-}
-
void tst_qnetworkreply::spdyReplyFinished()
{
static int finishedCount = 0;
@@ -419,85 +296,6 @@ void tst_qnetworkreply::spdyReplyFinished()
QTestEventLoop::instance().exitLoop();
}
-void tst_qnetworkreply::spdyMultipleRequestsPerHost()
-{
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) && OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
-
- QList<QNetworkRequest> requests;
- requests
- << QNetworkRequest(QUrl("https://www.facebook.com"))
- << QNetworkRequest(QUrl("https://www.facebook.com/images/fb_icon_325x325.png"))
-
- << QNetworkRequest(QUrl("https://www.google.de"))
- << QNetworkRequest(QUrl("https://www.google.de/preferences?hl=de"))
- << QNetworkRequest(QUrl("https://www.google.de/intl/de/policies/?fg=1"))
- << QNetworkRequest(QUrl("https://www.google.de/intl/de/about.html?fg=1"))
- << QNetworkRequest(QUrl("https://www.google.de/services/?fg=1"))
- << QNetworkRequest(QUrl("https://www.google.de/intl/de/ads/?fg=1"))
-
- << QNetworkRequest(QUrl("https://i1.ytimg.com/li/tnHdj3df7iM/default.jpg"))
- << QNetworkRequest(QUrl("https://i1.ytimg.com/li/7Dr1BKwqctY/default.jpg"))
- << QNetworkRequest(QUrl("https://i1.ytimg.com/li/hfZhJdhTqX8/default.jpg"))
- << QNetworkRequest(QUrl("https://i1.ytimg.com/vi/14Nprh8163I/hqdefault.jpg"))
- ;
- QList<QNetworkReply *> replies;
- QList<QSignalSpy *> metaDataChangedSpies;
- QList<QSignalSpy *> readyReadSpies;
- QList<QSignalSpy *> finishedSpies;
-
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- foreach (QNetworkRequest request, requests) {
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
- QNetworkReply *reply = m_manager.get(request);
- QObject::connect(reply, SIGNAL(finished()), this, SLOT(spdyReplyFinished()));
- replies << reply;
- QSignalSpy *metaDataChangedSpy = new QSignalSpy(reply, SIGNAL(metaDataChanged()));
- metaDataChangedSpies << metaDataChangedSpy;
- QSignalSpy *readyReadSpy = new QSignalSpy(reply, SIGNAL(readyRead()));
- readyReadSpies << readyReadSpy;
- QSignalSpy *finishedSpy = new QSignalSpy(reply, SIGNAL(finished()));
- finishedSpies << finishedSpy;
- }
-
- QCOMPARE(requests.count(), replies.count());
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), requests.count());
-
- for (int a = 0; a < replies.count(); ++a) {
-
- QCOMPARE(replies.at(a)->sslConfiguration().nextProtocolNegotiationStatus(),
- QSslConfiguration::NextProtocolNegotiationNegotiated);
- QCOMPARE(replies.at(a)->sslConfiguration().nextNegotiatedProtocol(),
- QByteArray(QSslConfiguration::NextProtocolSpdy3_0));
-
- QCOMPARE(replies.at(a)->error(), QNetworkReply::NoError);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- QByteArray content = replies.at(a)->readAll();
- QVERIFY(content.count() > 0);
-
- QCOMPARE(metaDataChangedSpies.at(a)->count(), 1);
- metaDataChangedSpies.at(a)->deleteLater();
-
- QCOMPARE(finishedSpies.at(a)->count(), 1);
- finishedSpies.at(a)->deleteLater();
-
- QVERIFY(readyReadSpies.at(a)->count() > 0);
- readyReadSpies.at(a)->deleteLater();
-
- replies.at(a)->deleteLater();
- }
-#else
- QSKIP("Qt built withouth OpenSSL, or the OpenSSL version is too old");
-#endif // defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) ...
-}
-
void tst_qnetworkreply::proxyAuthentication_data()
{
QTest::addColumn<QUrl>("url");
@@ -586,7 +384,7 @@ void tst_qnetworkreply::npnWithEmptyList() // QTBUG-40714
QUrl url(QStringLiteral("https://www.ossifrage.net/"));
QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, QVariant(true));
+ request.setAttribute(QNetworkRequest::Http2AllowedAttribute, QVariant(true));
QNetworkReply *reply = m_manager.get(request);
QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));