diff options
155 files changed, 2019 insertions, 1973 deletions
diff --git a/config_help.txt b/config_help.txt index 2f6c63ae91..317ba61031 100644 --- a/config_help.txt +++ b/config_help.txt @@ -1,8 +1,10 @@ Usage: configure [options] [assignments] Configure understands variable assignments like VAR=value on the command line. -These override any values possibly obtained from pkg-config. The variables -are mentioned in the descriptions of the options they relate to. +Each uppercased library name (obtainable with -list-libraries) supports the +suffixes _INCDIR, _LIBDIR, _PREFIX (INCDIR=PREFIX/include, LIBDIR=PREFIX/lib), +_LIBS, and - on Windows and Darwin - _LIBS_DEBUG and _LIBS_RELEASE. E.g., +ICU_PREFIX=/opt/icu42 ICU_LIBS="-licui18n -licuuc -licudata". It is also possible to manipulate any QMAKE_* variable, to amend the values from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3. @@ -62,6 +64,13 @@ Configure meta: Use this after installing missing dependencies. -recheck-all ......... Discard all cached configure test results. + -feature-<feature> ... Enable <feature> + -no-feature-<feature> Disable <feature> [none] + -list-features ....... List available features. Note that some features + have dedicated command line options as well. + + -list-libraries ...... List possible external dependencies. + Build options: -opensource .......... Build the Open-Source Edition of Qt @@ -188,9 +197,6 @@ Component selection: [default on Android and Windows] -dbus-linked ......... Build Qt D-Bus and link to libdbus-1 [auto] -dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no] - DBUS_PATH= DBUS_HOST_PATH= - -feature-<feature> ... Enable <feature>. The available features are described - in src/corelib/global/qfeatures.txt. [all enabled] -accessibility ....... Enable accessibility support [yes] Note: Disabling accessibility is not recommended. -qml-debug ........... Enable QML debugging support [yes] @@ -210,7 +216,6 @@ Core options: -pcre ................ Select used libpcre2 [system/qt] -pps ................. Enable PPS support [auto] (QNX only) -zlib ................ Select used zlib [system/qt] - ZLIB_LIBS= Logging backends: -journald .......... Enable journald support [no] (Unix only) @@ -223,8 +228,6 @@ Network options: -no-openssl .......... Do not use OpenSSL [default on Apple and WinRT] -openssl-linked ...... Use OpenSSL and link to libssl [no] -openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto] - OPENSSL_PATH= OPENSSL_LIBS=, and on Windows also - OPENSSL_LIBS_DEBUG= OPENSSL_LIBS_RELEASE= -securetransport ..... Use SecureTransport [auto] (Apple only) -sctp ................ Enable SCTP support [no] @@ -292,5 +295,4 @@ Database options: -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers: db2 ibase mysql oci odbc psql sqlite2 sqlite tds [all auto] - MYSQL_PATH= PSQL_LIBS= SYBASE= SYBASE_LIBS= -sqlite .............. Select used sqlite3 [system/qt] diff --git a/configure.json b/configure.json index ee931ced06..69019afa80 100644 --- a/configure.json +++ b/configure.json @@ -20,8 +20,7 @@ "commandline": { "assignments": { "DBUS_HOST_PATH": "host_dbus.prefix", - "DBUS_PATH": "dbus.prefix", - "ZLIB_LIBS": "zlib.libs" + "DBUS_PATH": "dbus.prefix" }, "custom": "qmakeArgs", "options": { @@ -1016,7 +1015,10 @@ }, "qml-debug": { "label": "QML debugging", - "output": [ { "type": "publicQtConfig", "negative": true } ] + "output": [ + "privateFeature", + { "type": "publicQtConfig", "negative": true } + ] }, "compile_examples": { "label": "Compile examples", diff --git a/examples/network/network.pro b/examples/network/network.pro index 3a269f16ae..d64b16c760 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -30,7 +30,6 @@ qtHaveModule(widgets) { } qtConfig(openssl): SUBDIRS += securesocketclient - qtConfig(openssl-linked): SUBDIRS += securesocketclient qtConfig(sctp): SUBDIRS += multistreamserver multistreamclient } diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index ba797500e9..03e05e42f6 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -67,6 +67,7 @@ TabletCanvas::TabletCanvas() resize(500, 500); initPixmap(); setAutoFillBackground(true); + setAttribute(Qt::WA_TabletTracking); } void TabletCanvas::initPixmap() diff --git a/mkspecs/features/data/configure.json b/mkspecs/features/data/configure.json index 98ccde1ee3..38623d46a4 100644 --- a/mkspecs/features/data/configure.json +++ b/mkspecs/features/data/configure.json @@ -12,7 +12,10 @@ "recheck": { "type": "void", "name": "cache_use", "value": "positive" }, "recheck-all": { "type": "void", "name": "cache_use", "value": "none" }, - "redo": { "type": "redo" } + "redo": { "type": "redo" }, + + "list-features": "void", + "list-libraries": "void" } } } diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 9719241612..15eb38af31 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -27,7 +27,7 @@ win32:count(MOC_INCLUDEPATH, 40, >) { # QNX's compiler sets "gcc" config, but does not support the -dM option; # UIKit builds are always multi-arch due to simulator_and_device (unless # -sdk is used) so this feature cannot possibly work. -if(gcc|intel_icl|msvc):!rim_qcc:!uikit:if(!macos|count(QMAKE_APPLE_DEVICE_ARCHS, 1)) { +if(gcc|intel_icl|msvc):!rim_qcc:!uikit:!no_moc_predefs:if(!macos|count(QMAKE_APPLE_DEVICE_ARCHS, 1)) { moc_predefs.name = "Generate moc_predefs.h" moc_predefs.CONFIG = no_link gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} diff --git a/mkspecs/features/qmake_use.prf b/mkspecs/features/qmake_use.prf index 9b6c67ccc2..f81d1cece4 100644 --- a/mkspecs/features/qmake_use.prf +++ b/mkspecs/features/qmake_use.prf @@ -5,25 +5,19 @@ for(ever) { use = $$split(use, /) name = $$take_first(use) nu = $$upper($$name) - debug: \ - libs = $$eval(QMAKE_LIBS_$${nu}_DEBUG) - else: \ - libs = $$eval(QMAKE_LIBS_$${nu}_RELEASE) - libs += $$eval(QMAKE_LIBS_$$nu) - libdir = $$eval(QMAKE_LIBDIR_$$nu) - defines = $$eval(QMAKE_DEFINES_$${nu}) - includes = $$eval(QMAKE_INCDIR_$${nu}) - - isEmpty(libs):isEmpty(defines):isEmpty(includes): \ + !defined(QMAKE_LIBS_$$nu, var): \ error("Library '$$name' is not defined.") !contains(use, nolink) { - QMAKE_LIBDIR += $$libdir - LIBS$${suffix} += $$libs + QMAKE_LIBDIR += $$eval(QMAKE_LIBDIR_$$nu) + debug: \ + LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$$nu) + else: \ + LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_RELEASE) $$eval(QMAKE_LIBS_$$nu) } !contains(use, linkonly) { - DEFINES += $$defines - INCLUDEPATH += $$includes + DEFINES += $$eval(QMAKE_DEFINES_$${nu}) + INCLUDEPATH += $$eval(QMAKE_INCDIR_$${nu}) } } !isEmpty(suffix): break() diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 78731595b0..e2e1a5a762 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -401,6 +401,7 @@ defineReplace(qtConfPrepareArgs) { } defineTest(qtConfSetupLibraries) { + asspfx = $${currentConfig}.commandline.assignments for (l, $${currentConfig}.libraries._KEYS_) { lpfx = $${currentConfig}.libraries.$${l} # 'export' may be omitted, in which case it falls back to the library's name @@ -408,6 +409,15 @@ defineTest(qtConfSetupLibraries) { $${lpfx}.export = $$l export($${lpfx}.export) } + # 'export' may also be empty, but we need a derived identifier + alias = $$eval($${lpfx}.export) + isEmpty(alias): alias = $$l + $${lpfx}.alias = $$alias + export($${lpfx}.alias) + # make it easy to refer to the library by its export name. + $${currentConfig}.exports._KEYS_ += $$alias + $${currentConfig}.exports.$$alias += $$l + export($${currentConfig}.exports.$$alias) isEmpty($${lpfx}.sources._KEYS_): \ error("Library $$l defines no sources") for (s, $${lpfx}.sources._KEYS_) { @@ -427,10 +437,33 @@ defineTest(qtConfSetupLibraries) { } } } + $${currentConfig}.exports._KEYS_ = $$unique($${currentConfig}.exports._KEYS_) + export($${currentConfig}.exports._KEYS_) + + for (alias, $${currentConfig}.exports._KEYS_) { + ua = $$upper($$alias) + $${asspfx}._KEYS_ += \ + $${ua}_PREFIX $${ua}_INCDIR $${ua}_LIBDIR \ + $${ua}_LIBS $${ua}_LIBS_DEBUG $${ua}_LIBS_RELEASE + uapfx = $${asspfx}.$${ua} + $${uapfx}_PREFIX = $${alias}.prefix + $${uapfx}_INCDIR = $${alias}.incdir + $${uapfx}_LIBDIR = $${alias}.libdir + $${uapfx}_LIBS = $${alias}.libs + $${uapfx}_LIBS_DEBUG = $${alias}.libs.debug + $${uapfx}_LIBS_RELEASE = $${alias}.libs.release + export($${uapfx}_PREFIX) + export($${uapfx}_INCDIR) + export($${uapfx}_LIBDIR) + export($${uapfx}_LIBS) + export($${uapfx}_LIBS_DEBUG) + export($${uapfx}_LIBS_RELEASE) + } + export($${asspfx}._KEYS_) # reverse mapping for assignments on command line. - for (a, $${currentConfig}.commandline.assignments._KEYS_) { - apfx = $${currentConfig}.commandline.assignments.$${a} + for (a, $${asspfx}._KEYS_) { + apfx = $${asspfx}.$${a} ra = config.commandline.rev_assignments.$$eval($$apfx) $$ra = $$a export($$ra) @@ -444,9 +477,13 @@ defineTest(qtConfLibrary_inline) { !defined($${1}.libs, var): \ error("'inline' source in library '$$lib' does not specify 'libs'.") + # if multiple libraries provide the same export, it makes sense + # to make them recognize the same input variables. + input = $$eval($${2}.alias) + # direct libs. overwrites inline libs. - defined(config.input.$${lib}.libs, var) { - $${1}.libs = $$eval(config.input.$${lib}.libs) + defined(config.input.$${input}.libs, var) { + $${1}.libs = $$eval(config.input.$${input}.libs) export($${1}.libs) } @@ -455,7 +492,7 @@ defineTest(qtConfLibrary_inline) { any = false all = true for (b, $${1}.builds._KEYS_) { - iv = $${lib}.libs.$${b} + iv = $${input}.libs.$${b} vars += $$eval(config.commandline.rev_assignments.$${iv}) defined(config.input.$${iv}, var) { $${1}.builds.$${b}.libs = $$eval(config.input.$${iv}) @@ -471,7 +508,7 @@ defineTest(qtConfLibrary_inline) { } # prefix. prepends to (possibly overwritten) inline libs. - prefix = $$val_escape(config.input.$${lib}.prefix) + prefix = $$val_escape(config.input.$${input}.prefix) !isEmpty(prefix) { $${1}.includedir = $$prefix/include export($${1}.includedir) @@ -479,6 +516,18 @@ defineTest(qtConfLibrary_inline) { export($${1}.libs) } + incdir = $$val_escape(config.input.$${input}.incdir) + !isEmpty(incdir) { + $${1}.includedir = $$incdir + export($${1}.includedir) + } + + libdir = $$val_escape(config.input.$${input}.libdir) + !isEmpty(libdir) { + $${1}.libs = "-L$$libdir $$eval($${1}.libs)" + export($${1}.libs) + } + return(true) } @@ -562,14 +611,20 @@ defineReplace(qtConfLibraryArgs) { } defineTest(qtConfExportLibrary) { - isEmpty(2): return() - !$$qtConfEvaluate($$eval($${1}.export)): return() + lpfx = $${currentConfig}.libraries.$$1 + alias = $$eval($${lpfx}.alias) + $${currentConfig}.found.$$alias = $$1 + export($${currentConfig}.found.$$alias) + name = $$eval($${lpfx}.export) + isEmpty(name): return() + spfx = $${lpfx}.sources.$$eval($${lpfx}.source) + !$$qtConfEvaluate($$eval($${spfx}.export)): return() output = privatePro - eval(libs = $$eval($${1}.libs)) - eval(cflags = $$eval($${1}.cflags)) - eval(includes = $$eval($${1}.includedir)) + eval(libs = $$eval($${spfx}.libs)) + eval(cflags = $$eval($${spfx}.cflags)) + eval(includes = $$eval($${spfx}.includedir)) # Split $$cflags into stuff that goes into DEFINES, INCLUDEPATH, and other stuff. defines = @@ -588,30 +643,46 @@ defineTest(qtConfExportLibrary) { } } !isEmpty(ignored): \ - qtConfAddNote("Dropped compiler flags '$$ignored' when detecting library '$$2'.") + qtConfAddNote("Dropped compiler flags '$$ignored' when detecting library '$$name'.") - NAME = $$upper($$2) - !isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) - for (b, $${1}.builds._KEYS_): \ + NAME = $$upper($$name) + # LIBS is emitted even if empty, as this allows the library to be "seen". + qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) + for (b, $${spfx}.builds._KEYS_): \ qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \ - $$eval($${1}.builds.$${b})) + $$eval($${spfx}.builds.$${b})) !isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines) !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes) !isEmpty($${currentConfig}.module): \ - qtConfExtendVar($$output, "QT.$${currentModule}_private.libraries", $$2) + qtConfExtendVar($$output, "QT.$${currentModule}_private.libraries", $$name) } defineTest(qtConfHandleLibrary) { lpfx = $${currentConfig}.libraries.$$1 defined($${lpfx}.result, var): return() + alias = $$eval($${lpfx}.alias) + !isEmpty($${currentConfig}.found.$$alias) { + # this happening indicates a logic error in the conditions + # of the feature(s) referring to this library. + # note that this does not look across module boundaries, as + # multiple modules may know the same libraries; de-duplication + # happens via the cache (obviously, this assumes identical + # definitions and logic). + error("A library exporting '$$alias' was already found.") + } + qtConfEnsureTestTypeDeps("library") - qtConfTestPrepare_compile($$lpfx) + !qtConfTestPrepare_compile($$lpfx) { + $${lpfx}.result = false + export($${lpfx}.result) + return() + } use_args = $$eval($${lpfx}.literal_args) qtConfLoadResult($${lpfx}, $$1) { $$eval($${lpfx}.result): \ - qtConfExportLibrary($${lpfx}.sources.$$eval($${lpfx}.source), $$eval($${lpfx}.export)) + qtConfExportLibrary($$1) return() } @@ -634,14 +705,14 @@ defineTest(qtConfHandleLibrary) { next() } - !$${call}($$spfx) { + !$${call}($$spfx, $$lpfx) { qtLog(" => source produced no result.") next() } # if the library defines a test, use it to verify the source. !isEmpty($${lpfx}.test) { - $${lpfx}.literal_args = $$use_args $$qtConfLibraryArgs($$spfx) + $${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx) $$use_args $${lpfx}.host = $$eval($${spfx}.host) !qtConfTest_compile($$lpfx) { qtLog(" => source failed verification.") @@ -657,11 +728,12 @@ defineTest(qtConfHandleLibrary) { for (b, $${spfx}.builds._KEYS_): \ $${lpfx}.cache += sources.$${s}.builds.$${b} - # immediately output the library as well. - qtConfExportLibrary($${spfx}, $$eval($${lpfx}.export)) - $${lpfx}.source = $$s export($${lpfx}.source) + + # immediately output the library as well. + qtConfExportLibrary($$1) + result = true break() } @@ -679,27 +751,76 @@ defineTest(qtConfTest_library) { } defineTest(qtConfTestPrepare_compile) { - for (u, $$list($$eval($${1}.use))) { + !isEmpty($${1}.use._KEYS_) { + uses = + for (k, $${1}.use._KEYS_) { + use = $$eval($${1}.use.$${k}.lib) + isEmpty(use): \ + error("'use' entry $$k in test $$1 lacks 'lib' field.") + !$$qtConfEvaluate($$eval($${1}.use.$${k}.condition)): \ + next() + uses += $$use + } + } else { + uses = $$split($${1}.use) + } + for (u, uses) { libConfig = - contains($${currentConfig}.libraries._KEYS_, $$u) { - libConfig = $${currentConfig} + exports = $$eval($${currentConfig}.exports.$$u) + !isEmpty(exports) { + # using a local library by exported name. + ru = $$eval($${currentConfig}.found.$$u) + !isEmpty(ru) { + # if it was already found, all is good. + u = $$ru + } else: count(exports, 1) { + # otherwise, if there is only one option, ensure it's resolved. + u = $$exports + qtConfHandleLibrary($$u) + } else { + # otherwise, verify that all options were resolved. + for (x, exports) { + isEmpty($${currentConfig}.libraries.$${x}.result) { + # the higher-level logic is in the features, which we cannot + # infer from here. so the only option is failing. + error("Test $$1 refers to yet unresolved library export '$$u'") + } + } + return(false) + } + libConfig = $$currentConfig + } else: contains($${currentConfig}.libraries._KEYS_, $$u) { + # using a local library by real name. this should be the exception. qtConfHandleLibrary($$u) + libConfig = $$currentConfig } else { - for (d, QMAKE_CONFIG_DEPS) { - contains($${d}.libraries._KEYS_, $$u) { - libConfig = $$d - break() + for (d, QMAKE_LIBRARY_DEPS) { + exports = $$eval($${d}.exports.$$u) + !isEmpty(exports) { + # using a foreign library by exported name. + # foreign libraries may be external (if they are from a different + # repository and the build is modular), and using these by real + # name is impossible. so for consistency, uses by real name are + # limited to local libraries. + ru = $$eval($${d}.found.$$u) + !isEmpty(ru) { + u = $$ru + libConfig = $$d + break() + } + for (x, exports) { + isEmpty($${d}.libraries.$${x}.result): \ + error("Test $$1 refers to unresolved library export '$$u' in '$$d'") + } + return(false) } } } isEmpty(libConfig) { nu = $$upper($$u) - libs = $$eval(QMAKE_LIBS_$$nu) $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$${nu}_RELEASE) - defines = $$eval(QMAKE_DEFINES_$${nu}) - includes = $$eval(QMAKE_INCDIR_$${nu}) - - isEmpty(libs):isEmpty(defines):isEmpty(includes): \ + !defined(QMAKE_LIBS_$$nu, var): \ error("Test $$1 tries to use undeclared library '$$u'") + # using an external library by exported name. $${1}.literal_args += $$system_quote(QMAKE_USE += $$u) } else { lpfx = $${libConfig}.libraries.$${u} @@ -1252,14 +1373,14 @@ defineTest(qtConfProcessFeatures) { # reporting # -QT_CONF_REPORT_PADDING = "........................................" - -defineTest(qtConfReportPadded) { - pad = $$num_add($$str_size($$QT_CONF_REPORT_PADDING), -$$str_size($${1})) +defineReplace(qtConfPadCols) { + pad = $$num_add($$str_size($$2), -$$str_size($${1})) lessThan(pad, 0): pad = 0 - str = "$$1 $$str_member($$QT_CONF_REPORT_PADDING, 0, $$pad)" + return("$$1 $$str_member($$2, 0, $$pad) $$3") +} - qtConfAddReport("$$str $${2}") +defineTest(qtConfReportPadded) { + qtConfAddReport($$qtConfPadCols($$1, "........................................", $$2)) } defineReplace(qtConfCollectFeatures) { @@ -1749,8 +1870,6 @@ for(ever) { jsonFile = $$thisDir/configure.json priFile = $$thisDir/configure.pri - allConfigs += $$currentConfig - # load configuration data configure_data = $$cat($$jsonFile, blob) !parseJson(configure_data, $$currentConfig): \ @@ -1758,25 +1877,88 @@ for(ever) { exists($$priFile): \ !include($$priFile): error() + # only configs which contain more than just subconfigs are saved for later. + $${currentConfig}._KEYS_ -= subconfigs + !isEmpty($${currentConfig}._KEYS_) { + allConfigs += $$currentConfig + contains($${currentConfig}._KEYS_, libraries) { + qtConfSetupLibraries() + # this ensures that references in QMAKE_LIBRARY_DEPS are unique. + qtConfSetModuleName() + ex = $$eval(config.modules.$${currentModule}) + !isEmpty(ex): \ + error("Module $$currentModule is claimed by both $$currentConfig and $${ex}.") + config.modules.$${currentModule} = $$currentConfig + } + } + # prepend all subconfigs to files to keep a depth first search order subconfigs = for(n, $${currentConfig}.subconfigs._KEYS_) { subconfig = $$eval($${currentConfig}.subconfigs.$${n}) name = $$basename(subconfig) + ex = $$eval(config.$${name}.dir) + !isEmpty(ex): \ + error("Basename clash between $$thisDir/$$subconfig and $${ex}.") config.$${name}.dir = $$thisDir/$$subconfig subconfigs += $$name } configsToProcess = $$subconfigs $$configsToProcess } -for (currentConfig, allConfigs): \ - qtConfSetupLibraries() - QMAKE_SAVED_ARGS = $$QMAKE_EXTRA_ARGS QMAKE_REDO_CONFIG = false qtConfParseCommandLine() qtConfCheckErrors() +!isEmpty(config.input.list-features) { + all_ft = + for (currentConfig, allConfigs) { + for (k, $${currentConfig}.features._KEYS_) { + pp = $$eval($${currentConfig}.features.$${k}.purpose) + !isEmpty(pp) { + all_ft += $$qtConfPadCols($$k, ".......................", \ + $$section(pp, $$escape_expand(\\n), 0, 0)) + } + } + } + all_ft = $$sorted(all_ft) + logn() + for (ft, all_ft): \ + logn($$ft) + error() +} + +!isEmpty(config.input.list-libraries) { + logn() + for (currentConfig, allConfigs) { + !isEmpty($${currentConfig}.exports._KEYS_) { + !isEmpty($${currentConfig}.module): \ + logn($$eval($${currentConfig}.module):) + else: \ + logn($$section(currentConfig, ., -1):) + all_xp = + for (xport, $${currentConfig}.exports._KEYS_) { + libs = $$eval($${currentConfig}.exports.$$xport) + isEqual($${currentConfig}.libraries.$$first(libs).export, "") { # not isEmpty()! + !isEmpty(config.input.verbose): \ + all_xp += "$$xport!" + } else { + out = "$$xport" + !isEmpty(config.input.verbose):!isEqual(xport, $$libs): \ + out += "($$libs)" + all_xp += "$$out" + } + } + all_xp = $$sorted(all_xp) + all_xp ~= s,^([^!]*)!$,(\\1),g + for (xp, all_xp): \ + logn(" $$xp") + } + } + error() +} + for (currentConfig, allConfigs) { qtConfSetModuleName() qtConfSetupModuleOutputs() @@ -1833,11 +2015,15 @@ for (currentConfig, allConfigs) { # correctly setup dependencies QMAKE_CONFIG_DEPS = global global_private + QMAKE_LIBRARY_DEPS = $$eval(config.modules.global) !isEmpty($${currentConfig}.module) { for (d, $${currentConfig}.depends._KEYS_) { dep = $$replace($${currentConfig}.depends.$$d, -private$, _private) - dep *= $$replace(dep, _private$, ) + gdep = $$replace(dep, _private$, ) + dep *= $$gdep QMAKE_CONFIG_DEPS += $$dep + !isEqual(gdep, $$dep): \ # libraries are in the private module. + QMAKE_LIBRARY_DEPS += $$eval(config.modules.$$gdep) } } diff --git a/mkspecs/features/qt_helper_lib.prf b/mkspecs/features/qt_helper_lib.prf index 99ba0c6877..b3e49e4626 100644 --- a/mkspecs/features/qt_helper_lib.prf +++ b/mkspecs/features/qt_helper_lib.prf @@ -42,6 +42,7 @@ THE_TARGET = $$qt5LibraryTarget($$TARGET) darwin: MODULE_DEBUG_LIBS = -L$$DESTDIR -l$${TARGET}_debug MODULE_RELEASE_LIBS = -L$$DESTDIR -l$$TARGET MODULE_PRI_CONT += \ + "QMAKE_LIBS_$${ucmodule} =" \ # Needed for the module to be recognized. "QMAKE_LIBS_$${ucmodule}_DEBUG = $$val_escape(MODULE_DEBUG_LIBS)" \ "QMAKE_LIBS_$${ucmodule}_RELEASE = $$val_escape(MODULE_RELEASE_LIBS)" } else { diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 77bedb1d7f..72d676da6f 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -59,7 +59,7 @@ defineReplace(qtExportLibsForModule) { QMAKE_LIBS_$$NAME QMAKE_LIBS_$${NAME}_DEBUG QMAKE_LIBS_$${NAME}_RELEASE \ QMAKE_DEFINES_$$NAME QMAKE_INCDIR_$$NAME for (var, vars) { - !isEmpty($$var): \ + defined($$var, var): \ result += "$$var = $$val_escape($$var)" } } diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index bc753647ec..801a8acf6a 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -16,7 +16,7 @@ QMAKE_CFLAGS_APP = -fPIC QMAKE_CFLAGS_DEPS = -M QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261,3373 QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O2 -ansi-alias -fstrict-aliasing +QMAKE_CFLAGS_RELEASE = -O2 QMAKE_CFLAGS_DEBUG = -O0 -g QMAKE_CFLAGS_SHLIB = -fPIC QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB diff --git a/mkspecs/macx-icc/qmake.conf b/mkspecs/macx-icc/qmake.conf index 210b281987..bb9a495f6f 100644 --- a/mkspecs/macx-icc/qmake.conf +++ b/mkspecs/macx-icc/qmake.conf @@ -16,8 +16,8 @@ QMAKE_CFLAGS = QMAKE_CFLAGS_DEPS = -M QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125,2259,2261,3280,3373 QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -QMAKE_CFLAGS_DEBUG = -g +QMAKE_CFLAGS_RELEASE = -O2 +QMAKE_CFLAGS_DEBUG = -g -O0 QMAKE_CFLAGS_SHLIB = -fPIC QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses diff --git a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh index b20d6c61f2..9e9c90b4bf 100755 --- a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh +++ b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh @@ -2,31 +2,37 @@ ############################################################################# ## ## Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> -## Contact: http://www.qt.io/licensing/ +## Contact: https://www.qt.io/licensing/ ## ## This file is the build configuration utility of the Qt Toolkit. ## -## $QT_BEGIN_LICENSE:LGPL21$ +## $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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. +## 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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## 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. ## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 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$ ## diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 99fcad1d52..7c11b5d136 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -279,6 +279,9 @@ public class QtActivityDelegate if (m_softInputMode != 0) { m_activity.getWindow().setSoftInputMode(m_softInputMode); + final boolean softInputIsHidden = (m_softInputMode & WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) != 0; + if (softInputIsHidden) + return; } else { if (height > visibleHeight) m_activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); diff --git a/src/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h index a08be69123..111933410b 100644 --- a/src/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/concurrent/qtconcurrentfunctionwrappers.h @@ -192,6 +192,32 @@ QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func return QtConcurrent::ConstMemberFunctionWrapper<T, C>(func); } +#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 +template <typename T, typename U> +QtConcurrent::FunctionWrapper1<T, U> createFunctionWrapper(T (*func)(U) noexcept) +{ + return QtConcurrent::FunctionWrapper1<T, U>(func); +} + +template <typename T, typename C> +QtConcurrent::MemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func)() noexcept) +{ + return QtConcurrent::MemberFunctionWrapper<T, C>(func); +} + +template <typename T, typename C, typename U> +QtConcurrent::MemberFunctionWrapper1<T, C, U> createFunctionWrapper(T (C::*func)(U) noexcept) +{ + return QtConcurrent::MemberFunctionWrapper1<T, C, U>(func); +} + +template <typename T, typename C> +QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func)() const noexcept) +{ + return QtConcurrent::ConstMemberFunctionWrapper<T, C>(func); +} +#endif + struct PushBackWrapper { typedef void result_type; @@ -231,6 +257,20 @@ struct ReduceResultType<T(C::*)(U)> typedef C ResultType; }; +#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 +template <class U, class V> +struct ReduceResultType<void(*)(U&,V) noexcept> +{ + typedef U ResultType; +}; + +template <class T, class C, class U> +struct ReduceResultType<T(C::*)(U) noexcept> +{ + typedef C ResultType; +}; +#endif + template <class InputSequence, class MapFunctor> struct MapResultType { @@ -249,6 +289,20 @@ struct MapResultType<void, T(C::*)() const> typedef T ResultType; }; +#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 +template <class U, class V> +struct MapResultType<void, U (*)(V) noexcept> +{ + typedef U ResultType; +}; + +template <class T, class C> +struct MapResultType<void, T(C::*)() const noexcept> +{ + typedef T ResultType; +}; +#endif + #ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS template <template <typename> class InputSequence, typename MapFunctor, typename T> @@ -269,6 +323,21 @@ struct MapResultType<InputSequence<T>, U(C::*)() const> typedef InputSequence<U> ResultType; }; +#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 + +template <template <typename> class InputSequence, class T, class U, class V> +struct MapResultType<InputSequence<T>, U (*)(V) noexcept> +{ + typedef InputSequence<U> ResultType; +}; + +template <template <typename> class InputSequence, class T, class U, class C> +struct MapResultType<InputSequence<T>, U(C::*)() const noexcept> +{ + typedef InputSequence<U> ResultType; +}; +#endif + #endif // QT_NO_TEMPLATE_TEMPLATE_PARAMETER template <class MapFunctor> @@ -289,6 +358,21 @@ struct MapResultType<QStringList, U(C::*)() const> typedef QList<U> ResultType; }; +#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 + +template <class U, class V> +struct MapResultType<QStringList, U (*)(V) noexcept> +{ + typedef QList<U> ResultType; +}; + +template <class U, class C> +struct MapResultType<QStringList, U(C::*)() const noexcept> +{ + typedef QList<U> ResultType; +}; +#endif + } // namespace QtPrivate. #endif //Q_QDOC diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h index 9734f99d50..8818e23ffa 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm index 8abd576259..2c94178e13 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qrect.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qrect.cpp index 1c7f9d4b54..4bdaa4d657 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qrect.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qrect.cpp @@ -55,6 +55,6 @@ QRect r2(QPoint(100, 200), QSize(11, 16)); //! [1] -QRectF r1(100, 200, 11, 16); -QRectF r2(QPoint(100, 200), QSize(11, 16)); +QRectF r1(100.0, 200.1, 11.2, 16.3); +QRectF r2(QPointF(100.0, 200.1), QSizeF(11.2, 16.3)); //! [1] diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 9ae1e3a4ae..f162dd95dd 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -80,13 +80,16 @@ gcc:ltcg { SOURCES += $$VERSIONTAGGING_SOURCES } -QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h - -qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables) - -qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT} -qfloat16_tables.output = global/qfloat16tables.cpp -qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES -qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE -qfloat16_tables.variable_out = SOURCES -QMAKE_EXTRA_COMPILERS += qfloat16_tables +# On AARCH64 the fp16 extension is mandatory, so we don't need the conversion tables. +!contains(QT_ARCH, "arm64") { + QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h + + qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables) + + qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT} + qfloat16_tables.output = global/qfloat16tables.cpp + qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES + qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE + qfloat16_tables.variable_out = SOURCES + QMAKE_EXTRA_COMPILERS += qfloat16_tables +} diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt deleted file mode 100644 index 458f87ec16..0000000000 --- a/src/corelib/global/qfeatures.txt +++ /dev/null @@ -1,956 +0,0 @@ -# Generic entry format -#Feature: UPPERCASENAME (for the #define) -#Description: One sentence description of what this does. -#Section: Categorization -#Requires: UPPERCASENAME... -#Name: CamelCaseName (often a class name) -#SeeAlso: UPPERCASENAME... (currently unused) - -# Kernel - -Feature: PROPERTIES -Description: Supports scripting Qt-based applications. -Section: Kernel -Requires: -Name: Properties - -Feature: TEXTHTMLPARSER -Description: Parser for HTML -Section: Kernel -Requires: -Name: HtmlParser - -Feature: TEXTODFWRITER -Description: Provides an ODF writer -Section: Kernel -Requires: XMLSTREAMWRITER -Name: OdfWriter - -Feature: CSSPARSER -Description: Parser for Style Sheets -Section: Kernel -Requires: -Name: CssParser - -Feature: REGULAREXPRESSION -Description: Perl-compatible regular expression APIs -Section: Kernel -Requires: -Name: QRegularExpression - -Feature: CONCURRENT -Description: Provides a high-level multi-threaded APIs -Section: Kernel -Requires: -Name: QtConcurrent - -Feature: DRAGANDDROP -Description: Supports the drag and drop mechansim. -Section: Kernel -Requires: IMAGEFORMAT_XPM -Name: Drag and drop - -Feature: SESSIONMANAGER -Description: Supports session management. -Section: Kernel -Requires: -Name: Session Manager - -Feature: SHORTCUT -Description: Supports keyboard accelerators and shortcuts. -Section: Kernel -Requires: -Name: QShortcut - -Feature: ACTION -Description: Supports widget actions. -Section: Kernel -Requires: -Name: QAction - -Feature: CURSOR -Description: Supports mouse cursors. -Section: Kernel -Requires: -Name: QCursor - -Feature: CLIPBOARD -Description: Supports cut and paste operations. -Section: Kernel -Requires: -Name: QClipboard - -Feature: WHEELEVENT -Description: Supports wheel events. -Section: Kernel -Requires: -Name: QWheelEvent - -Feature: TABLETEVENT -Description: Supports tablet events. -Section: Kernel -Requires: -Name: QTabletEvent - -Feature: EFFECTS -Description: Supports special widget effects (e.g. fading and scrolling). -Section: Kernel -Requires: -Name: Effects - -Feature: SHAREDMEMORY -Description: Provides access to a shared memory segment. -Section: Kernel -Requires: -Name: QSharedMemory - -Feature: SYSTEMSEMAPHORE -Description: Provides a general counting system semaphore. -Section: Kernel -Requires: SHAREDMEMORY -Name: QSystemSemaphore - -Feature: XMLSTREAM -Description: Provides a simple streaming API for XML. -Section: Kernel -Requires: -Name: XML Streaming APIs - -Feature: XMLSTREAMREADER -Description: Provides a well-formed XML parser with a simple streaming API. -Section: Kernel -Requires: XMLSTREAM -Name: QXmlStreamReader - -Feature: XMLSTREAMWRITER -Description: Provides a XML writer with a simple streaming API. -Section: Kernel -Requires: XMLSTREAM -Name: QXmlStreamWriter - -Feature: IM -Description: Inputmethods with QInputContext -Section: Kernel -Requires: LIBRARY -Name: QInputContext - -# Data structures - -Feature: TEXTDATE -Description: Supports month and day names in dates. -Section: Data structures -Requires: -Name: Text Date - -Feature: DATESTRING -Description: Supports convertion between dates and strings. -Section: Data structures -Requires: TEXTDATE -Name: QDate/QTime/QDateTime - -# File I/O - -Feature: PROCESS -Description: Supports external process invocation. -Section: File I/O -Requires: -Name: QProcess - -Feature: TEMPORARYFILE -Description: Provides an I/O device that operates on temporary files. -Section: File I/O -Requires: -Name: QTemporaryFile - -Feature: LIBRARY -Description: Supports a shared library wrapper. -Section: File I/O -Requires: -Name: QLibrary - -Feature: SETTINGS -Description: Supports persistent application settings. -Section: File I/O -Requires: -Name: QSettings - -Feature: DOM -Description: Supports the Document Object Model. -Section: File I/O -Requires: -Name: Document Object Model - -Feature: FILESYSTEMMODEL -Description: Provides a data model for the local filesystem. -Section: File I/O -Requires: -Name: QFileSystemModel - -Feature: FILESYSTEMWATCHER -Description: Provides an interface for monitoring files and directories for modications. -Section: File I/O -Requires: -Name: QFileSystemWatcher - -Feature: FILESYSTEMITERATOR -Description: Provides fast file-system iteration. -Section: File I/O -Requires: -Name: QFileSystemIterator - -# Widgets - -Feature: TREEWIDGET -Description: Supports views using tree models. -Section: Widgets -Requires: TREEVIEW -Name: QTreeWidget - -Feature: LISTWIDGET -Description: Supports item-based list widgets. -Section: Widgets -Requires: LISTVIEW -Name: QListWidget - -Feature: TABLEWIDGET -Description: Supports item-based table views. -Section: Widgets -Requires: TABLEVIEW -Name: QTableWidget - -Feature: DATETIMEEDIT -Description: Supports editing dates and times. -Section: Widgets -Requires: CALENDARWIDGET DATESTRING -Name: QDateTimeEdit - -Feature: STACKEDWIDGET -Description: Supports stacked widgets. -Section: Widgets -Requires: -Name: QStackedWidget - -Feature: TEXTBROWSER -Description: Supports HTML document browsing. -Section: Widgets -Requires: TEXTEDIT -Name: QTextBrowser - -Feature: SPLASHSCREEN -Description: Supports splash screens that can be shown during application startup. -Section: Widgets -Requires: -Name: Splash screen widget - -Feature: SPLITTER -Description: Supports user controlled splitter widgets. -Section: Widgets -Requires: RUBBERBAND -Name: QSplitter - -Feature: LCDNUMBER -Description: Supports LCD-like digits. -Section: Widgets -Requires: -Name: QLCDNumber - -Feature: MENU -Description: Supports popup-menus. -Section: Widgets -Requires: ACTION -Name: QMenu - -Feature: LINEEDIT -Description: Supports single-line edits. -Section: Widgets -Requires: -Name: QLineEdit - -Feature: SPINBOX -Description: Supports spin boxes handling integers and discrete sets of values. -Section: Widgets -Requires: SPINWIDGET LINEEDIT VALIDATOR -Name: QSpinBox - -Feature: TABBAR -Description: Supports tab bars, e.g. for use in tabbed dialogs. -Section: Widgets -Requires: TOOLBUTTON -Name: QTabBar - -Feature: TABWIDGET -Description: Supports stacking tabbed widgets. -Section: Widgets -Requires: TABBAR STACKEDWIDGET -Name: QTabWidget - -Feature: COMBOBOX -Description: Supports comboboxes presenting a list of options to the user. -Section: Widgets -Requires: LINEEDIT STANDARDITEMMODEL LISTVIEW -Name: QComboBox - -Feature: FONTCOMBOBOX -Description: Supports a combobox that lets the user select a font family. -Section: Widgets -Requires: COMBOBOX STRINGLISTMODEL -Name: QFontComboBox - -Feature: TOOLBUTTON -Description: Supports quick-access buttons to commands and options. -Section: Widgets -Requires: ACTION -Name: QToolButton - -Feature: TOOLBAR -Description: Supports movable panels containing a set of controls. -Section: Widgets -Requires: MAINWINDOW -Name: QToolBar - -Feature: TOOLBOX -Description: Supports columns of tabbed widget items. -Section: Widgets -Requires: TOOLBUTTON SCROLLAREA -Name: QToolBox - -Feature: GROUPBOX -Description: Supports group box frames. -Section: Widgets -Requires: -Name: QGroupBox - -Feature: BUTTONGROUP -Description: Supports organizing groups of button widgets. -Section: Widgets -Requires: GROUPBOX -Name: QButtonGroup - -Feature: MAINWINDOW -Description: Supports main application windows. -Section: Widgets -Requires: MENU RESIZEHANDLER TOOLBUTTON -Name: QMainWindow - -Feature: DOCKWIDGET -Description: Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop. -Section: Widgets -Requires: RUBBERBAND MAINWINDOW -Name: QDockwidget - -Feature: MDIAREA -Description: Provides an area in which MDI windows are displayed. -Section: Widgets -Requires: SCROLLAREA -Name: QMdiArea - -Feature: RESIZEHANDLER -Description: Supports an internal resize handler. -Section: Widgets -Requires: -Name: Resize Handler - -Feature: STATUSBAR -Description: Supports presentation of status information. -Section: Widgets -Requires: -Name: QStatusBar - -Feature: MENUBAR -Description: Supports pull-down menu items. -Section: Widgets -Requires: MENU TOOLBUTTON -Name: QMenuBar - -Feature: CONTEXTMENU -Description: Supports pop-up menus on right mouse click -Section: Widgets -Requires: MENU -Name: Context menu - -Feature: PROGRESSBAR -Description: Supports presentation of operation progress. -Section: Widgets -Requires: -Name: QProgressBar - -Feature: SLIDER -Description: Supports sliders controlling a bounded value. -Section: Widgets -Requires: -Name: QSlider - -Feature: SCROLLBAR -Description: Supports scrollbars allowing the user access parts of a document that is larger than the widget used to display it. -Section: Widgets -Requires: SLIDER -Name: QScrollBar - -Feature: DIAL -Description: Supports rounded range control, e.g. like a speedometer. -Section: Widgets -Requires: SLIDER -Name: QDial - -Feature: SCROLLAREA -Description: Supports scrolling views onto widgets. -Section: Widgets -Requires: SCROLLBAR -Name: QScrollArea - -Feature: GRAPHICSVIEW -Description: Supports the graphicsview classes. -Section: Widgets -Requires: SCROLLAREA -Name: QGraphicsView - -Feature: GRAPHICSEFFECT -Description: Supports the graphicseffect classes. -Section: Widgets -Requires: GRAPHICSVIEW -Name: QGraphicsEffect - -Feature: SPINWIDGET -Description: Supports spinbox control widgets. -Section: Widgets -Requires: -Name: Spin Widget - -Feature: TEXTEDIT -Description: Supports rich text editing. -Section: Widgets -Requires: SCROLLAREA PROPERTIES -Name: QTextEdit - -Feature: SYNTAXHIGHLIGHTER -Description: Supports custom syntax highlighting. -Section: Widgets -Requires: TEXTEDIT -Name: QSyntaxHighlighter - -Feature: RUBBERBAND -Description: Supports using rubberbands to indicate selections and boundaries. -Section: Widgets -Requires: -Name: QRubberBand - -Feature: TOOLTIP -Description: Supports presentation of tooltips. -Section: Widgets -Requires: -Name: QToolTip - -Feature: STATUSTIP -Description: Supports status tip functionality and events. -Section: Widgets -Requires: -Name: Status Tip - -Feature: WHATSTHIS -Description: Supports displaying "What's this" help. -Section: Widgets -Requires: TOOLBUTTON -Name: QWhatsThis - -Feature: VALIDATOR -Description: Supports validation of input text. -Section: Widgets -Requires: -Name: QValidator - -Feature: SIZEGRIP -Description: Supports corner-grips for resizing a top-level windows. -Section: Widgets -Requires: -Name: QSizeGrip - -Feature: CALENDARWIDGET -Description: Provides a monthly based calendar widget allowing the user to select a date. -Section: Widgets -Requires: TABLEVIEW MENU TEXTDATE SPINBOX TOOLBUTTON -Name: QCalendarWidget - -Feature: PRINTPREVIEWWIDGET -Description: Provides a widget for previewing page layouts for printer output. -Section: Widgets -Requires: GRAPHICSVIEW PRINTER MAINWINDOW -Name: QPrintPreviewWidget - -Feature: KEYSEQUENCEEDIT -Description: Provides a widget for editing QKeySequences -Section: Widgets -Requires: LINEEDIT SHORTCUT -Name: QKeySequenceEdit - -# Dialogs - -Feature: MESSAGEBOX -Description: Supports message boxes displaying -informative messages and simple questions. -Section: Dialogs -Requires: -Name: QMessageBox - -Feature: COLORDIALOG -Description: Supports a dialog widget for specifying colors. -Section: Dialogs -Requires: SPINBOX -Name: QColorDialog - -Feature: FILEDIALOG -Description: Supports a dialog widget for selecting files or directories. -Section: Dialogs -Requires: FILESYSTEMMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL -Name: QFileDialog - -Feature: FONTDIALOG -Description: Supports a dialog widget for selecting fonts. -Section: Dialogs -Requires: STRINGLISTMODEL COMBOBOX VALIDATOR GROUPBOX -Name: QFontDialog - -Feature: PRINTDIALOG -Description: Supports a dialog widget for specifying printer configuration. -Section: Dialogs -Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TABWIDGET -Name: QPrintDialog - -Feature: PRINTPREVIEWDIALOG -Description: Provides a dialog for previewing and configuring page layouts for printer output. -Section: Dialogs -Requires: PRINTPREVIEWWIDGET PRINTDIALOG TOOLBAR -Name: QPrintPreviewDialog - -Feature: PROGRESSDIALOG -Description: Supports feedback on the progress of a slow operation. -Section: Dialogs -Requires: PROGRESSBAR -Name: QProgressDialog - -Feature: INPUTDIALOG -Description: Supports a simple convenience dialog to get a single value from the user. -Section: Dialogs -Requires: COMBOBOX SPINBOX STACKEDWIDGET -Name: QInputDialog - -Feature: ERRORMESSAGE -Description: Supports an error message display dialog. -Section: Dialogs -Requires: TEXTEDIT -Name: QErrorMessage - -Feature: WIZARD -Description: Provides a framework for wizards. -Section: Dialogs -Requires: PROPERTIES -Name: QWizard - -# ItemViews - -Feature: ITEMVIEWS -Description: Supports the model/view architecture managing the relationship between data and the way it is presented to the user. -Section: ItemViews -Requires: RUBBERBAND SCROLLAREA -Name: The Model/View Framework - -Feature: DIRMODEL -Description: Supports a data model for the local filesystem. -Section: ItemViews -Requires: ITEMVIEWS FILESYSTEMMODEL -Name: QDirModel - -Feature: STANDARDITEMMODEL -Description: Supports a generic model for storing custom data. -Section: ItemViews -Requires: ITEMVIEWS -Name: QStandardItemModel - -Feature: PROXYMODEL -Description: Supports processing of data passed between another model and a view. -Section: ItemViews -Requires: ITEMVIEWS -Name: QAbstractProxyModel - -Feature: SORTFILTERPROXYMODEL -Description: Supports sorting and filtering of data passed between another model and a view. -Section: ItemViews -Requires: PROXYMODEL -Name: QSortFilterProxyModel - -Feature: IDENTITYPROXYMODEL -Description: Supports proxying a source model unmodified. -Section: ItemViews -Requires: PROXYMODEL -Name: QIdentityProxyModel - -Feature: STRINGLISTMODEL -Description: Supports a model that supplies strings to views. -Section: ItemViews -Requires: ITEMVIEWS -Name: QStringListModel - -Feature: LISTVIEW -Description: Supports a list or icon view onto a model. -Section: ItemViews -Requires: ITEMVIEWS -Name: QListView - -Feature: TABLEVIEW -Description: Supports a default model/view implementation of a table view. -Section: ItemViews -Requires: ITEMVIEWS -Name: QTableView - -Feature: TREEVIEW -Description: Supports a default model/view implementation of a tree view. -Section: ItemViews -Requires: ITEMVIEWS -Name: QTreeView - -Feature: DATAWIDGETMAPPER -Description: Provides mapping between a section of a data model to widgets. -Section: ItemViews -Requires: ITEMVIEWS PROPERTIES -Name: QDataWidgetMapper - -Feature: COLUMNVIEW -Description: Provides a model/view implementation of a column view. -Section: ItemViews -Requires: LISTVIEW -Name: QColumnView - -# Styles - -Feature: STYLE_WINDOWS -Description: Supports a Microsoft Windows-like look and feel. -Section: Styles -Requires: -Name: QWindowsStyle - -Feature: STYLE_FUSION -Description: Supports a modern platform independent widget style. -Section: Styles -Requires: IMAGEFORMAT_XPM -Name: QFusionStyle - -Feature: STYLE_WINDOWSXP -Description: Supports a Microsoft WindowsXP-like look and feel. -Section: Styles -Requires: STYLE_WINDOWS -Name: QWindowsXPStyle - -Feature: STYLE_WINDOWSVISTA -Description: Supports a Microsoft WindowsVista-like look and feel. -Section: Styles -Requires: STYLE_WINDOWSXP -Name: QWindowsVistaStyle - -Feature: STYLE_WINDOWSCE -Description: WindowsCE look and feel -Section: Styles -Requires: STYLE_WINDOWS IMAGEFORMAT_XPM -Name: QWindowsCEStyle - -Feature: STYLE_WINDOWSMOBILE -Description: WindowsMobile look and feel -Section: Styles -Requires: STYLE_WINDOWS IMAGEFORMAT_XPM -Name: QWindowsMobileStyle - -Feature: STYLE_STYLESHEET -Description: -Section: Styles -Requires: STYLE_WINDOWS PROPERTIES CSSPARSER -Name: QStyleSheetStyle - -# Images - -Feature: IMAGEFORMATPLUGIN -Description: Supports writing an image format plugin. -Section: Images -Requires: LIBRARY -Name: QImageIOPlugin - -Feature: MOVIE -Description: Supports animated images. -Section: Images -Requires: -Name: QMovie - -Feature: IMAGEFORMAT_BMP -Description: Supports Microsoft's Bitmap image file format. -Section: Images -Requires: -Name: BMP Image Format - -Feature: IMAGEFORMAT_PPM -Description: Supports the Portable Pixmap image file format. -Section: Images -Requires: -Name: PPM Image Format - -Feature: IMAGEFORMAT_XBM -Description: Supports the X11 Bitmap image file format. -Section: Images -Requires: -Name: XBM Image Format - -Feature: IMAGEFORMAT_XPM -Description: Supports the X11 Pixmap image file format. -Section: Images -Requires: -Name: XPM Image Format - -Feature: IMAGEFORMAT_PNG -Description: Supports the Portable Network Graphics image file format. -Section: Images -Requires: -Name: PNG Image Format - -Feature: IMAGEFORMAT_JPEG -Description: Supports the Joint Photographic Experts Group image file format. -Section: Images -Requires: -Name: JPEG Image Format - -Feature: IMAGE_HEURISTIC_MASK -Description: Supports creating a 1-bpp heuristic mask for images. -Section: Images -Requires: -Name: QImage::createHeuristicMask() - -Feature: IMAGE_TEXT -Description: Supports image file text strings. -Section: Images -Requires: -Name: Image Text - -# Painting - -Feature: PICTURE -Description: Supports recording and replaying QPainter commands. -Section: Painting -Requires: -Name: QPicture - -Feature: COLORNAMES -Description: Supports color names such as "red", used by QColor and by some HTML documents. -Section: Painting -Requires: -Name: Color Names - -Feature: PDF -Description: Supports pdf format -Section: Painting -Requires: TEMPORARYFILE -Name: QPdf - -Feature: PRINTER -Description: Supports printing -Section: Painting -Requires: PICTURE TEMPORARYFILE PDF -Name: QPrinter - -Feature: CUPS -Description Supports the Common UNIX Printing System -Section: Painting -Requires: PRINTER LIBRARY -Name: Common UNIX Printing System - -Feature: PAINT_DEBUG -Description: Debug painting with the environment variables QT_FLUSH_UPDATE and QT_FLUSH_PAINT -Section: Painting -Requires: -Name: Painting Debug Utilities - -# Fonts - -Feature: FREETYPE -Description: Supports the FreeType 2 font engine (and its supported font formats). -Section: Fonts -Requires: -Name: Freetype Font Engine - -# Internationalization - -Feature: TRANSLATION -Description: Supports translations using QObject::tr(). -Section: Internationalization -Requires: -Name: Translation - -Feature: TEXTCODEC -Description: Supports conversions between text encodings. -Section: Internationalization -Requires: -Name: QTextCodec - -Feature: CODECS -Description: Supports non-unicode text conversions. -Section: Internationalization -Requires: TEXTCODEC -Name: Codecs - -Feature: BIG_CODECS -Description: Supports big codecs, e.g. CJK. -Section: Internationalization -Requires: TEXTCODEC -Name: Big Codecs - -Feature: ICONV -Description: Supports conversions between text encodings using iconv. -Section: Internationalization -Requires: TEXTCODEC -Name: iconv - -# Networking - -Feature: FTP -Description: Supports FTP file access. -Section: Networking -Requires: TEXTDATE -Name: File Transfer Protocol - -Feature: HTTP -Description: Supports HTTP file access. -Section: Networking -Requires: -Name: Hyper Text Transfer Protocol - -Feature: UDPSOCKET -Description: Supports User Datagram Protocol sockets. -Section: Networking -Requires: -Name: QUdpSocket - -Feature: NETWORKPROXY -Description: Supports configuring network layer proxy support to the Qt network classes. -Section: Networking -Requires: -Name: QNetworkProxy - -Feature: SOCKS5 -Description: Supports SOCKS v5 network proxy. -Section: Networking -Requires: NETWORKPROXY -Name: SOCKS5 - -Feature: NETWORKINTERFACE -Description: Supports listing the host's IP addresses and network interfaces -Section: Networking -Requires: -Name: QNetworkInterface - -Feature: NETWORKDISKCACHE -Description: Supports a disk cache for network resources -Section: Networking -Requires: TEMPORARYFILE -Name: QNetworkDiskCache - -Feature: BEARERMANAGEMENT -Description: Provides bearer management support -Section: Networking -Requires: LIBRARY NETWORKINTERFACE PROPERTIES -Name: Bearer Management - -Feature: LOCALSERVER -Description: Supports a local socket based server -Section: Networking -Requires: TEMPORARYFILE -Name: QLocalServer - -# Utilities - -Feature: COMPLETER -Description: Provides completions based on an item model. -Section: Utilities -Requires: PROXYMODEL -Name: QCompleter - -Feature: FSCOMPLETER -Description: Provides completions based on an item model. -Section: Utilities -Requires: FILESYSTEMMODEL COMPLETER -Name: QCompleter - -Feature: DESKTOPSERVICES -Description: Provides methods for accessing common desktop services. -Section: Utilities -Requires: -Name: QDesktopServices - -Feature: MIMETYPE -Description: Describes types of file or data, represented by a MIME type string. -Section: Utilities -Requires: -Name: QMimeType - -Feature: SYSTEMTRAYICON -Description: Provides an icon for an application in the system tray. -Section: Utilities -Requires: -Name: QSystemTrayIcon - -Feature: UNDOCOMMAND -Description: Applies (redo or) undo of a single change in a document. -Section: Utilities -Requires: -Name: QUndoCommand - -Feature: UNDOSTACK -Description: Provides the ability to (redo or) undo a list of changes in a document. -Section: Utilities -Requires: UNDOCOMMAND -Name: QUndoStack - -Feature: UNDOGROUP -Description: -Section: Utilities -Requires: UNDOSTACK -Name: QUndoGroup - -Feature: UNDOVIEW -Description: A widget which shows the contents of an undo stack. -Section: Utilities -Requires: UNDOSTACK LISTVIEW -Name: QUndoView - -Feature: ACCESSIBILITY -Description: Provides accessibility support. -Section: Utilities -Requires: PROPERTIES MENUBAR -Name: Accessibility - -Feature: ANIMATION -Description: Provides a framework for animations. -Section: Utilities -Requires: PROPERTIES -Name: Animation - -Feature: STATEMACHINE -Description: Provides hierarchical finite state machines. -Section: Utilities -Requires: PROPERTIES -Name: State machine - -Feature: GESTURES -Description: Provides a framework for gestures. -Section: Utilities -Requires: -Name: Gesture - -# D-Bus - -Feature: DBUS -Description: Provides classes for D-Bus. -Section: D-Bus -Requires: PROPERTIES XMLSTREAMREADER -Name: Qt D-Bus module - -# XML Patterns - -Feature: XMLSCHEMA -Description: Provides XML schema validation. -Section: Xml Patterns -Requires: -Name: XML Schema APIs diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index c3833c6bd1..da44c01594 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -472,6 +472,8 @@ public: WA_AlwaysStackOnTop = 128, + WA_TabletTracking = 129, + // Add new attributes before this line WA_AttributeCount }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 8da06f71f7..b8588b3f98 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1139,6 +1139,9 @@ \value WA_StyleSheet Indicates that the widget is styled using a \l{Qt Style Sheets}{style sheet}. + \value WA_TabletTracking Indicates that the widget has tablet + tracking enabled. See QWidget::tabletTracking. + \value WA_TranslucentBackground Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 31353523ad..b8dca93f61 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -557,45 +557,75 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM return data.hasFlags(what); } +// Note: if \a shouldMkdirFirst is false, we assume the caller did try to mkdir +// before calling this function. +static bool createDirectoryWithParents(const QByteArray &nativeName, bool shouldMkdirFirst = true) +{ + // helper function to check if a given path is a directory, since mkdir can + // fail if the dir already exists (it may have been created by another + // thread or another process) + const auto isDir = [](const QByteArray &nativeName) { + QT_STATBUF st; + return QT_STAT(nativeName.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR; + }; + + if (shouldMkdirFirst && QT_MKDIR(nativeName, 0777) == 0) + return true; + if (errno == EEXIST) + return isDir(nativeName); + if (errno != ENOENT) + return false; + + // mkdir failed because the parent dir doesn't exist, so try to create it + int slash = nativeName.lastIndexOf('/'); + if (slash < 1) + return false; + + QByteArray parentNativeName = nativeName.left(slash); + if (!createDirectoryWithParents(parentNativeName)) + return false; + + // try again + if (QT_MKDIR(nativeName, 0777) == 0) + return true; + return errno == EEXIST && isDir(nativeName); +} + //static bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents) { QString dirName = entry.filePath(); - if (createParents) { - dirName = QDir::cleanPath(dirName); - for (int oldslash = -1, slash=0; slash != -1; oldslash = slash) { - slash = dirName.indexOf(QDir::separator(), oldslash+1); - if (slash == -1) { - if (oldslash == dirName.length()) - break; - slash = dirName.length(); - } - if (slash) { - const QByteArray chunk = QFile::encodeName(dirName.left(slash)); - if (QT_MKDIR(chunk.constData(), 0777) != 0) { - if (errno == EEXIST -#if defined(Q_OS_QNX) - // On QNX the QNet (VFS paths of other hosts mounted under a directory - // such as /net) mountpoint returns ENOENT, despite existing. stat() - // on the QNet mountpoint returns successfully and reports S_IFDIR. - || errno == ENOENT -#endif - ) { - QT_STATBUF st; - if (QT_STAT(chunk.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR) - continue; - } - return false; - } - } - } + + // Darwin doesn't support trailing /'s, so remove for everyone + while (dirName.size() > 1 && dirName.endsWith(QLatin1Char('/'))) + dirName.chop(1); + + // try to mkdir this directory + QByteArray nativeName = QFile::encodeName(dirName); + if (QT_MKDIR(nativeName, 0777) == 0) return true; + if (!createParents) + return false; + + // we need the cleaned path in order to create the parents + // and we save errno just in case encodeName needs to load codecs + int savedErrno = errno; + bool pathChanged; + { + QString cleanName = QDir::cleanPath(dirName); + + // Check if the cleaned name is the same or not. If we were given a + // path with resolvable "../" sections, cleanPath will remove them, but + // this may change the target dir if one of those segments was a + // symlink. This operation depends on cleanPath's optimization of + // returning the original string if it didn't modify anything. + pathChanged = !dirName.isSharedWith(cleanName); + if (pathChanged) + nativeName = QFile::encodeName(cleanName); } -#if defined(Q_OS_DARWIN) // Mac X doesn't support trailing /'s - if (dirName.endsWith(QLatin1Char('/'))) - dirName.chop(1); -#endif - return (QT_MKDIR(QFile::encodeName(dirName).constData(), 0777) == 0); + + errno = savedErrno; + return createDirectoryWithParents(nativeName, pathChanged); } //static diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index b8d1919ee6..4f7bc95330 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -276,10 +276,11 @@ static QVector<QLoggingRule> loadRulesFromFile(const QString &filePath) */ void QLoggingRegistry::init() { + QVector<QLoggingRule> er, qr, cr; // get rules from environment const QByteArray rulesFilePath = qgetenv("QT_LOGGING_CONF"); if (!rulesFilePath.isEmpty()) - envRules = loadRulesFromFile(QFile::decodeName(rulesFilePath)); + er = loadRulesFromFile(QFile::decodeName(rulesFilePath)); const QByteArray rulesSrc = qgetenv("QT_LOGGING_RULES").replace(';', '\n'); if (!rulesSrc.isEmpty()) { @@ -287,7 +288,7 @@ void QLoggingRegistry::init() QLoggingSettingsParser parser; parser.setSection(QStringLiteral("Rules")); parser.setContent(stream); - envRules += parser.rules(); + er += parser.rules(); } const QString configFileName = QStringLiteral("qtlogging.ini"); @@ -296,17 +297,22 @@ void QLoggingRegistry::init() // get rules from Qt data configuration path const QString qtConfigPath = QDir(QLibraryInfo::location(QLibraryInfo::DataPath)).absoluteFilePath(configFileName); - qtConfigRules = loadRulesFromFile(qtConfigPath); + qr = loadRulesFromFile(qtConfigPath); #endif // get rules from user's/system configuration const QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QString::fromLatin1("QtProject/") + configFileName); if (!envPath.isEmpty()) - configRules = loadRulesFromFile(envPath); + cr = loadRulesFromFile(envPath); + + const QMutexLocker locker(®istryMutex); + + envRules = std::move(er); + qtConfigRules = std::move(qr); + configRules = std::move(cr); if (!envRules.isEmpty() || !qtConfigRules.isEmpty() || !configRules.isEmpty()) { - QMutexLocker locker(®istryMutex); updateRules(); } } @@ -347,11 +353,11 @@ void QLoggingRegistry::setApiRules(const QString &content) parser.setSection(QStringLiteral("Rules")); parser.setContent(content); - QMutexLocker locker(®istryMutex); - if (qtLoggingDebug()) debugMsg("Loading logging rules set by QLoggingCategory::setFilterRules ..."); + const QMutexLocker locker(®istryMutex); + apiRules = parser.rules(); updateRules(); @@ -405,6 +411,8 @@ QLoggingRegistry *QLoggingRegistry::instance() /*! \internal Updates category settings according to rules. + + As a category filter, it is run with registryMutex held. */ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) { diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h index 5197da1ba4..23740c4955 100644 --- a/src/corelib/io/qloggingregistry_p.h +++ b/src/corelib/io/qloggingregistry_p.h @@ -129,6 +129,7 @@ private: QMutex registryMutex; + // protected by mutex: QVector<QLoggingRule> qtConfigRules; QVector<QLoggingRule> configRules; QVector<QLoggingRule> envRules; diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index fcdf13fddb..aa69e9e1db 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -844,7 +844,8 @@ static bool startDetachedUacPrompt(const QString &programIn, const QStringList & SHELLEXECUTEINFOW shellExecuteExInfo; memset(&shellExecuteExInfo, 0, sizeof(SHELLEXECUTEINFOW)); shellExecuteExInfo.cbSize = sizeof(SHELLEXECUTEINFOW); - shellExecuteExInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE | SEE_MASK_FLAG_NO_UI; + shellExecuteExInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE | SEE_MASK_FLAG_NO_UI | SEE_MASK_CLASSNAME; + shellExecuteExInfo.lpClass = L"exefile"; shellExecuteExInfo.lpVerb = L"runas"; const QString program = QDir::toNativeSeparators(programIn); shellExecuteExInfo.lpFile = reinterpret_cast<LPCWSTR>(program.utf16()); diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index a6372b75f6..18ad59f1cb 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4169,10 +4169,10 @@ QUrl QUrl::fromUserInput(const QString &userInput, const QString &workingDirecto return url; } - QUrl url = QUrl(trimmedString, QUrl::TolerantMode); + QUrl url = QUrl(userInput, QUrl::TolerantMode); // Check both QUrl::isRelative (to detect full URLs) and QDir::isAbsolutePath (since on Windows drive letters can be interpreted as schemes) - if (url.isRelative() && !QDir::isAbsolutePath(trimmedString)) { - QFileInfo fileInfo(QDir(workingDirectory), trimmedString); + if (url.isRelative() && !QDir::isAbsolutePath(userInput)) { + QFileInfo fileInfo(QDir(workingDirectory), userInput); if ((options & AssumeLocalFile) || fileInfo.exists()) return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); } diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 7e962f816e..ac974ba411 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -284,6 +284,8 @@ public: Pointer = 218, // QQuickPointerEvent; ### Qt 6: QPointerEvent + TabletTrackingChange = 219, // tablet tracking state has changed + // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm index 27eb3d0337..608dea5426 100644 --- a/src/corelib/kernel/qeventdispatcher_cf.mm +++ b/src/corelib/kernel/qeventdispatcher_cf.mm @@ -44,7 +44,6 @@ #include <QtCore/qthread.h> #include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qcore_unix_p.h> -#include <QtCore/private/qcore_mac_p.h> #include <QtCore/private/qthread_p.h> #include <limits> @@ -59,11 +58,13 @@ QT_USE_NAMESPACE -@interface RunLoopModeTracker : NSObject { +@interface QT_MANGLE_NAMESPACE(RunLoopModeTracker) : NSObject { QStack<CFStringRef> m_runLoopModes; } @end +QT_NAMESPACE_ALIAS_OBJC_CLASS(RunLoopModeTracker); + @implementation RunLoopModeTracker - (id) init diff --git a/src/corelib/kernel/qeventdispatcher_cf_p.h b/src/corelib/kernel/qeventdispatcher_cf_p.h index e6581e2bac..8a234ebc40 100644 --- a/src/corelib/kernel/qeventdispatcher_cf_p.h +++ b/src/corelib/kernel/qeventdispatcher_cf_p.h @@ -90,14 +90,11 @@ #include <QtCore/qabstracteventdispatcher.h> #include <QtCore/private/qtimerinfo_unix_p.h> #include <QtCore/private/qcfsocketnotifier_p.h> +#include <QtCore/private/qcore_mac_p.h> #include <QtCore/qdebug.h> #include <CoreFoundation/CoreFoundation.h> -#ifdef __OBJC__ -@class RunLoopModeTracker; -#else -typedef struct objc_object RunLoopModeTracker; -#endif +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(RunLoopModeTracker)); QT_BEGIN_NAMESPACE @@ -253,7 +250,7 @@ private: RunLoopSource<> m_postedEventsRunLoopSource; RunLoopObserver<> m_runLoopActivityObserver; - RunLoopModeTracker *m_runLoopModeTracker; + QT_MANGLE_NAMESPACE(RunLoopModeTracker) *m_runLoopModeTracker; QTimerInfoList m_timerInfoList; CFRunLoopTimerRef m_runLoopTimer; diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index 959421bf52..5c0acce4c3 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -296,12 +296,15 @@ QMimeGlobMatchResult QMimeBinaryProvider::findByFileName(const QString &fileName const QString lowerFileName = fileName.toLower(); // TODO this parses in the order (local, global). Check that it handles "NOGLOBS" correctly. for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) { + // Check literals (e.g. "Makefile") matchGlobList(result, cacheFile, cacheFile->getUint32(PosLiteralListOffset), fileName); + // Check complex globs (e.g. "callgrind.out[0-9]*") matchGlobList(result, cacheFile, cacheFile->getUint32(PosGlobListOffset), fileName); + // Check the very common *.txt cases with the suffix tree const int reverseSuffixTreeOffset = cacheFile->getUint32(PosReverseSuffixTreeOffset); const int numRoots = cacheFile->getUint32(reverseSuffixTreeOffset); const int firstRootOffset = cacheFile->getUint32(reverseSuffixTreeOffset + 4); - matchSuffixTree(result, cacheFile, numRoots, firstRootOffset, lowerFileName, fileName.length() - 1, false); + matchSuffixTree(result, cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.length() - 1, false); if (result.m_matchingMimeTypes.isEmpty()) matchSuffixTree(result, cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true); } diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index 0876d141c4..70a934c976 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -57,11 +57,22 @@ #include "QtCore/qobject.h" #include "QtCore/qstringlist.h" #include "QtCore/qjsonobject.h" +#include "QtCore/qjsondocument.h" #include "QtCore/qmap.h" +#include "QtCore/qendian.h" #include "private/qlibrary_p.h" QT_BEGIN_NAMESPACE +inline QJsonDocument qJsonFromRawLibraryMetaData(const char *raw) +{ + raw += strlen("QTMETADATA "); + // the size of the embedded JSON object can be found 8 bytes into the data (see qjson_p.h), + // but doesn't include the size of the header (8 bytes) + QByteArray json(raw, qFromLittleEndian<uint>(*(const uint *)(raw + 8)) + 8); + return QJsonDocument::fromBinaryData(json); +} + class QFactoryLoaderPrivate; class Q_CORE_EXPORT QFactoryLoader : public QObject { diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 96cf5371f9..a4a654cd88 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -42,6 +42,7 @@ #ifndef QT_NO_LIBRARY +#include "qfactoryloader_p.h" #include "qlibrary_p.h" #include <qstringlist.h> #include <qfile.h> diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index f883e74843..7147ff6ca2 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -58,25 +58,12 @@ #include "QtCore/qstringlist.h" #include "QtCore/qplugin.h" #include "QtCore/qsharedpointer.h" -#include "QtCore/qjsonobject.h" -#include "QtCore/qjsondocument.h" -#include "QtCore/qendian.h" #ifdef Q_OS_WIN # include "QtCore/qt_windows.h" #endif QT_BEGIN_NAMESPACE -// Needed also in case of QT_NO_LIBRARY, for static plugin loading. -inline QJsonDocument qJsonFromRawLibraryMetaData(const char *raw) -{ - raw += strlen("QTMETADATA "); - // the size of the embedded JSON object can be found 8 bytes into the data (see qjson_p.h), - // but doesn't include the size of the header (8 bytes) - QByteArray json(raw, qFromLittleEndian<uint>(*(const uint *)(raw + 8)) + 8); - return QJsonDocument::fromBinaryData(json); -} - #ifndef QT_NO_LIBRARY diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 4ec4e43952..6723877ad5 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -43,7 +43,7 @@ #include "qcoreapplication.h" #include "qpluginloader.h" #include <qfileinfo.h> -#include "qlibrary_p.h" +#include "qfactoryloader_p.h" #include "qdebug.h" #include "qdir.h" diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index 6302a3a515..42befc4b80 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -392,13 +392,13 @@ bool QReadWriteLock::tryLockForWrite(int timeout) */ void QReadWriteLock::unlock() { - QReadWriteLockPrivate *d = d_ptr.load(); + QReadWriteLockPrivate *d = d_ptr.loadAcquire(); while (true) { Q_ASSERT_X(d, "QReadWriteLock::unlock()", "Cannot unlock an unlocked lock"); // Fast case: no contention: (no waiters, no other readers) if (quintptr(d) <= 2) { // 1 or 2 (StateLockedForRead or StateLockedForWrite) - if (!d_ptr.testAndSetRelease(d, nullptr, d)) + if (!d_ptr.testAndSetOrdered(d, nullptr, d)) continue; return; } @@ -407,7 +407,7 @@ void QReadWriteLock::unlock() Q_ASSERT(quintptr(d) > (1U<<4)); //otherwise that would be the fast case // Just decrease the reader's count. auto val = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(d) - (1U<<4)); - if (!d_ptr.testAndSetRelease(d, val, d)) + if (!d_ptr.testAndSetOrdered(d, val, d)) continue; return; } diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index af85d27868..06a50e5990 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -140,8 +140,6 @@ struct QByteArrayDataPtr Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, sizeof(QByteArrayData)) \ /**/ -#if defined(Q_COMPILER_LAMBDA) - # define QByteArrayLiteral(str) \ ([]() -> QByteArray { \ enum { Size = sizeof(str) - 1 }; \ @@ -154,14 +152,6 @@ struct QByteArrayDataPtr }()) \ /**/ -#endif - -#ifndef QByteArrayLiteral -// no lambdas, not GCC, just return a temporary QByteArray - -# define QByteArrayLiteral(str) QByteArray(str, sizeof(str) - 1) -#endif - class Q_CORE_EXPORT QByteArray { private: diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index efed5d36ee..ba06de8f9e 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -125,7 +125,7 @@ private: friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); #endif }; -Q_DECLARE_TYPEINFO(QEasingCurve, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QEasingCurve) #ifndef QT_NO_DEBUG_STREAM Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index c3efc41d62..a8d1132d06 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -237,7 +237,7 @@ inline int QFreeList<T, ConstantsType>::next() int id, newid, at; ElementType *v; do { - id = _next.load(); + id = _next.loadAcquire(); at = id & ConstantsType::IndexMask; const int block = blockfor(at); @@ -254,7 +254,7 @@ inline int QFreeList<T, ConstantsType>::next() } newid = v[at].next.load() | (id & ~ConstantsType::IndexMask); - } while (!_next.testAndSetRelaxed(id, newid)); + } while (!_next.testAndSetRelease(id, newid)); // qDebug("QFreeList::next(): returning %d (_next now %d, serial %d)", // id & ConstantsType::IndexMask, // newid & ConstantsType::IndexMask, diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index cdda5292e7..ae4befcb9c 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -594,7 +594,6 @@ static QLocalePrivate *c_private() */ QSystemLocale::QSystemLocale() { - delete _systemLocale; _systemLocale = this; if (system_data) diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 4b6183646b..895b6b9701 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -1323,8 +1323,8 @@ QDebug operator<<(QDebug dbg, const QRect &r) rendering. A QRectF can be constructed with a set of left, top, width and - height integers, or from a QPoint and a QSize. The following code - creates two identical rectangles. + height coordinates, or from a QPointF and a QSizeF. The following + code creates two identical rectangles. \snippet code/src_corelib_tools_qrect.cpp 1 @@ -1344,7 +1344,7 @@ QDebug operator<<(QDebug dbg, const QRect &r) translated copy of this rectangle. The size() function returns the rectange's dimensions as a - QSize. The dimensions can also be retrieved separately using the + QSizeF. The dimensions can also be retrieved separately using the width() and height() functions. To manipulate the dimensions use the setSize(), setWidth() or setHeight() functions. Alternatively, the size can be changed by applying either of the functions diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 359c2d0bdb..ec2f7c4af6 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -674,9 +674,9 @@ bool QTimeZone::isDaylightTime(const QDateTime &atDateTime) const QTimeZone::OffsetData QTimeZone::offsetData(const QDateTime &forDateTime) const { if (hasTransitions()) - return d->toOffsetData(d->data(forDateTime.toMSecsSinceEpoch())); + return QTimeZonePrivate::toOffsetData(d->data(forDateTime.toMSecsSinceEpoch())); else - return d->invalidOffsetData(); + return QTimeZonePrivate::invalidOffsetData(); } /*! @@ -712,9 +712,9 @@ bool QTimeZone::hasTransitions() const QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime) const { if (hasTransitions()) - return d->toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch())); + return QTimeZonePrivate::toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch())); else - return d->invalidOffsetData(); + return QTimeZonePrivate::invalidOffsetData(); } /*! @@ -733,9 +733,9 @@ QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime) QTimeZone::OffsetData QTimeZone::previousTransition(const QDateTime &beforeDateTime) const { if (hasTransitions()) - return d->toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch())); + return QTimeZonePrivate::toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch())); else - return d->invalidOffsetData(); + return QTimeZonePrivate::invalidOffsetData(); } /*! @@ -755,7 +755,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime, toDateTime.toMSecsSinceEpoch()); list.reserve(plist.count()); for (const QTimeZonePrivate::Data &pdata : plist) - list.append(d->toOffsetData(pdata)); + list.append(QTimeZonePrivate::toOffsetData(pdata)); } return list; } diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 9985d0672c..0038908160 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -74,7 +74,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone); QT_BEGIN_NAMESPACE -class Q_CORE_EXPORT QTimeZonePrivate : public QSharedData +class Q_AUTOTEST_EXPORT QTimeZonePrivate : public QSharedData { public: //Version of QTimeZone::OffsetData struct using msecs for efficiency diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 25f5176c22..5d0231417b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -146,15 +146,35 @@ public: T value(int i, const T &defaultValue) const; inline void append(const T &t) { - if (s == a) // i.e. s != 0 + if (s == a) { // i.e. s != 0 + T copy(t); realloc(s, s<<1); - const int idx = s++; - if (QTypeInfo<T>::isComplex) { - new (ptr + idx) T(t); + const int idx = s++; + if (QTypeInfo<T>::isComplex) { + new (ptr + idx) T(std::move(copy)); + } else { + ptr[idx] = std::move(copy); + } } else { - ptr[idx] = t; + const int idx = s++; + if (QTypeInfo<T>::isComplex) { + new (ptr + idx) T(t); + } else { + ptr[idx] = t; + } } } + + void append(T &&t) { + if (s == a) + realloc(s, s << 1); + const int idx = s++; + if (QTypeInfo<T>::isComplex) + new (ptr + idx) T(std::move(t)); + else + ptr[idx] = std::move(t); + } + void append(const T *buf, int size); inline QVarLengthArray<T, Prealloc> &operator<<(const T &t) { append(t); return *this; } @@ -208,6 +228,7 @@ public: // STL compatibility: inline bool empty() const { return isEmpty(); } inline void push_back(const T &t) { append(t); } + void push_back(T &&t) { append(std::move(t)); } inline void pop_back() { removeLast(); } inline T &front() { return first(); } inline const T &front() const { return first(); } diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 5e53a969e8..127afcd069 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -303,6 +303,34 @@ */ /*! + \fn void QVarLengthArray::append(T &&t) + \overload append + \since 5.9 + + \note Unlike the lvalue overload of append(), passing a reference to + an object that is already an element of \c *this leads to undefined + behavior: + + \code + vla.append(std::move(vla[0])); // BUG: passing an object that is already in the container + \endcode +*/ + +/*! + \fn void QVarLengthArray::push_back(T &&t) + \overload push_back + \since 5.9 + + \note Unlike the lvalue overload of push_back(), passing a reference to + an object that is already an element of \c *this leads to undefined + behavior: + + \code + vla.push_back(std::move(vla[0])); // BUG: passing an object that is already in the container + \endcode +*/ + +/*! \fn inline void QVarLengthArray::removeLast() \since 4.5 diff --git a/src/gui/configure.json b/src/gui/configure.json index 52ccb60024..e627d6286f 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -161,9 +161,10 @@ "test": "unix/libpng", "sources": [ { "type": "pkgConfig", "args": "libpng" }, - { "libs": "-llibpng -lzdll", "condition": "config.msvc" }, - { "libs": "-lpng -lz", "condition": "!config.msvc" } - ] + { "libs": "-llibpng", "condition": "config.msvc" }, + { "libs": "-lpng", "condition": "!config.msvc" } + ], + "use": "zlib" }, "mirclient": { "label": "Mir client libraries", @@ -974,6 +975,7 @@ "label": "QSystemTrayIcon", "purpose": "Provides an icon for an application in the system tray.", "section": "Utilities", + "condition": "features.temporaryfile", "output": [ "publicFeature", "feature" ] }, "accessibility": { diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 4390e46fde..2f25f4dcbc 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -190,32 +190,42 @@ enum _qt_BuiltInFormatType { _qt_NoFormat = -1 }; +#if !defined(QT_NO_IMAGEFORMAT_PPM) +# define MAX_MT_SIZE 20 +#elif !defined(QT_NO_IMAGEFORMAT_XBM) || !defined(QT_NO_IMAGEFORMAT_XPM) +# define MAX_MT_SIZE 10 +#else +# define MAX_MT_SIZE 4 +#endif + struct _qt_BuiltInFormatStruct { - const char *extension; - const char *mimeType; + char extension[4]; + char mimeType[MAX_MT_SIZE]; }; +#undef MAX_MT_SIZE + static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { #ifndef QT_NO_IMAGEFORMAT_PNG - {"png", "image/png"}, + {"png", "png"}, #endif #ifndef QT_NO_IMAGEFORMAT_BMP - {"bmp", "image/bmp"}, + {"bmp", "bmp"}, #endif #ifndef QT_NO_IMAGEFORMAT_PPM - {"ppm", "image/x-portable-pixmap"}, - {"pgm", "image/x-portable-graymap"}, - {"pbm", "image/x-portable-bitmap"}, + {"ppm", "x-portable-pixmap"}, + {"pgm", "x-portable-graymap"}, + {"pbm", "x-portable-bitmap"}, #endif #ifndef QT_NO_IMAGEFORMAT_XBM - {"xbm", "image/x-xbitmap"}, + {"xbm", "x-xbitmap"}, #endif #ifndef QT_NO_IMAGEFORMAT_XPM - {"xpm", "image/x-xpixmap"}, + {"xpm", "x-xpixmap"}, #endif - {"", ""} }; +Q_STATIC_ASSERT(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats); static QImageIOHandler *createReadHandlerHelper(QIODevice *device, const QByteArray &format, @@ -1604,8 +1614,8 @@ QList<QByteArray> QImageReader::supportedMimeTypes() { QList<QByteArray> mimeTypes; mimeTypes.reserve(_qt_NumFormats); - for (int i = 0; i < _qt_NumFormats; ++i) - mimeTypes << _qt_BuiltInFormats[i].mimeType; + for (const auto &fmt : _qt_BuiltInFormats) + mimeTypes.append(QByteArrayLiteral("image/") + fmt.mimeType); #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanRead, &mimeTypes); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 8e98958949..c94ea0922a 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1814,6 +1814,15 @@ void QWindowPrivate::destroy() q->setVisible(false); + // Let subclasses act, typically by doing graphics resource cleaup, when + // the window, to which graphics resource may be tied, is going away. + // + // NB! This is disfunctional when destroy() is invoked from the dtor since + // a reimplemented event() will not get called in the subclasses at that + // stage. However, the typical QWindow cleanup involves either close() or + // going through QWindowContainer, both of which will do an explicit, early + // destroy(), which is good here. + QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); QGuiApplication::sendEvent(q, &e); diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp index dd9e8e9d1e..3a94fa8805 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -532,7 +532,7 @@ GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id) if (uniformLocations.isEmpty()) uniformLocations.fill(GLuint(-1), NumUniforms); - static const char *const uniformNames[] = { + const char uniformNames[][26] = { "imageTexture", "patternColor", "globalOpacity", diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 06a820a859..cc3ee76f0d 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1006,7 +1006,7 @@ bool QBrush::operator==(const QBrush &b) const */ QDebug operator<<(QDebug dbg, const QBrush &b) { - static const char *const BRUSH_STYLES[] = { + static const char BRUSH_STYLES[][24] = { "NoBrush", "SolidPattern", "Dense1Pattern", @@ -1025,7 +1025,7 @@ QDebug operator<<(QDebug dbg, const QBrush &b) "LinearGradientPattern", "RadialGradientPattern", "ConicalGradientPattern", - 0, 0, 0, 0, 0, 0, + "", "", "", "", "", "", "TexturePattern" // 24 }; diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 2d841b2953..673f64fbca 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1118,16 +1118,16 @@ QDataStream & operator>>(QDataStream &s, QTransform &t) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QTransform &m) { - static const char *const typeStr[] = + static const char typeStr[][12] = { "TxNone", "TxTranslate", "TxScale", - 0, + "", "TxRotate", - 0, 0, 0, + "", "", "", "TxShear", - 0, 0, 0, 0, 0, 0, 0, + "", "", "", "", "", "", "", "TxProject" }; diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 7107c7c26e..7341fa8e83 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -265,7 +265,7 @@ void QTextDocumentPrivate::clear() unreachableCharacterCount = 0; modifiedState = 0; modified = false; - formats = QTextFormatCollection(); + formats.clear(); int len = fragments.length(); fragments.clear(); blocks.clear(); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 39fec032dc..36e0a77bd0 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3371,22 +3371,15 @@ QTextTableCellFormat::QTextTableCellFormat(const QTextFormat &fmt) // ------------------------------------------------------ - -QTextFormatCollection::QTextFormatCollection(const QTextFormatCollection &rhs) -{ - formats = rhs.formats; - objFormats = rhs.objFormats; -} - -QTextFormatCollection &QTextFormatCollection::operator=(const QTextFormatCollection &rhs) +QTextFormatCollection::~QTextFormatCollection() { - formats = rhs.formats; - objFormats = rhs.objFormats; - return *this; } -QTextFormatCollection::~QTextFormatCollection() +void QTextFormatCollection::clear() { + formats.clear(); + objFormats.clear(); + hashes.clear(); } int QTextFormatCollection::indexForFormat(const QTextFormat &format) diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h index f05bfaff71..3557c17a97 100644 --- a/src/gui/text/qtextformat_p.h +++ b/src/gui/text/qtextformat_p.h @@ -63,8 +63,7 @@ public: QTextFormatCollection() {} ~QTextFormatCollection(); - QTextFormatCollection(const QTextFormatCollection &rhs); - QTextFormatCollection &operator=(const QTextFormatCollection &rhs); + void clear(); inline QTextFormat objectFormat(int objectIndex) const { return format(objectFormatIndex(objectIndex)); } @@ -104,6 +103,8 @@ public: private: QFont defaultFnt; + + Q_DISABLE_COPY(QTextFormatCollection) }; QT_END_NAMESPACE diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp index 5e4f75b0ed..3581fbc796 100644 --- a/src/network/access/qhsts.cpp +++ b/src/network/access/qhsts.cpp @@ -39,9 +39,9 @@ #include "qhsts_p.h" -#include "QtCore/qstringlist.h" - #include "QtCore/private/qipaddress_p.h" +#include "QtCore/qvector.h" +#include "QtCore/qlist.h" QT_BEGIN_NAMESPACE @@ -84,7 +84,7 @@ void QHstsCache::updateFromHeaders(const QList<QPair<QByteArray, QByteArray>> &h updateKnownHost(url.host(), parser.expirationDate(), parser.includeSubDomains()); } -void QHstsCache::updateFromPolicies(const QList<QHstsPolicy> &policies) +void QHstsCache::updateFromPolicies(const QVector<QHstsPolicy> &policies) { for (const auto &policy : policies) updateKnownHost(policy.host(), policy.expiry(), policy.includesSubDomains()); @@ -183,9 +183,13 @@ void QHstsCache::clear() knownHosts.clear(); } -QList<QHstsPolicy> QHstsCache::policies() const +QVector<QHstsPolicy> QHstsCache::policies() const { - return knownHosts.values(); + QVector<QHstsPolicy> values; + values.reserve(knownHosts.size()); + for (const auto &host : knownHosts) + values << host; + return values; } // The parser is quite simple: 'nextToken' knowns exactly what kind of tokens diff --git a/src/network/access/qhsts_p.h b/src/network/access/qhsts_p.h index 5d95f39b96..ab3ca536fb 100644 --- a/src/network/access/qhsts_p.h +++ b/src/network/access/qhsts_p.h @@ -57,26 +57,28 @@ #include <QtCore/qdatetime.h> #include <QtCore/qstring.h> #include <QtCore/qglobal.h> -#include <QtCore/qlist.h> #include <QtCore/qpair.h> #include <QtCore/qurl.h> #include <QtCore/qmap.h> QT_BEGIN_NAMESPACE +template<typename T> class QList; +template <typename T> class QVector; + class Q_AUTOTEST_EXPORT QHstsCache { public: void updateFromHeaders(const QList<QPair<QByteArray, QByteArray>> &headers, const QUrl &url); - void updateFromPolicies(const QList<QHstsPolicy> &hosts); + void updateFromPolicies(const QVector<QHstsPolicy> &hosts); void updateKnownHost(const QUrl &url, const QDateTime &expires, bool includeSubDomains); bool isKnownHost(const QUrl &url) const; void clear(); - QList<QHstsPolicy> policies() const; + QVector<QHstsPolicy> policies() const; private: diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp index 6922e1d8f9..634bf4784b 100644 --- a/src/network/access/qhstspolicy.cpp +++ b/src/network/access/qhstspolicy.cpp @@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE applies to subdomains, either in the constructor or by calling setExpiry(), setHost() and setIncludesSubdomains(). - \sa QNetworkAccessManager::enableStrictTransportSecurity() + \sa QNetworkAccessManager::setStrictTransportSecurityEnabled() */ -class QHstsPolicyPrivate +class QHstsPolicyPrivate : public QSharedData { public: QUrl url; @@ -78,6 +78,15 @@ public: }; /*! + Returns \c true if the two policies have the same host and expiration date + while agreeing on whether to include or exclude subdomains. +*/ +bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs) +{ + return *lhs.d == *rhs.d; +} + +/*! Constructs an invalid (expired) policy with empty host name and subdomains not included. */ @@ -121,17 +130,7 @@ QHstsPolicy::~QHstsPolicy() */ QHstsPolicy &QHstsPolicy::operator=(const QHstsPolicy &other) { - *d = *other.d; - return *this; -} - - -/*! - Move-assignment operator. -*/ -QHstsPolicy &QHstsPolicy::operator=(QHstsPolicy &&other) Q_DECL_NOTHROW -{ - qSwap(d, other.d); + d = other.d; return *this; } @@ -196,15 +195,6 @@ bool QHstsPolicy::includesSubDomains() const } /*! - Returns \c true if the two policies have the same host and expiration date - while agreeing on whether to include or exclude subdomains. -*/ -bool QHstsPolicy::operator==(const QHstsPolicy &other) const -{ - return *d == *other.d; -} - -/*! Return \c true if this policy has a valid expiration date and this date is greater than QDateTime::currentGetDateTimeUtc(). diff --git a/src/network/access/qhstspolicy.h b/src/network/access/qhstspolicy.h index 4260ac278c..45fa40dfe8 100644 --- a/src/network/access/qhstspolicy.h +++ b/src/network/access/qhstspolicy.h @@ -42,7 +42,7 @@ #include <QtNetwork/qtnetworkglobal.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/qshareddata.h> #include <QtCore/qurl.h> QT_BEGIN_NAMESPACE @@ -55,13 +55,15 @@ class Q_NETWORK_EXPORT QHstsPolicy public: QHstsPolicy(); - QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host, - QUrl::ParsingMode mode = QUrl::DecodedMode); + explicit QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host, + QUrl::ParsingMode mode = QUrl::DecodedMode); QHstsPolicy(const QHstsPolicy &rhs); QHstsPolicy &operator=(const QHstsPolicy &rhs); - QHstsPolicy &operator=(QHstsPolicy &&rhs) Q_DECL_NOTHROW; + QHstsPolicy &operator=(QHstsPolicy &&other) Q_DECL_NOTHROW { swap(other); return *this; } ~QHstsPolicy(); + void swap(QHstsPolicy &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode); QString host(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const; void setExpiry(const QDateTime &expiry); @@ -69,14 +71,25 @@ public: void setIncludesSubDomains(bool include); bool includesSubDomains() const; - bool operator==(const QHstsPolicy &rhs) const; bool isExpired() const; private: - QScopedPointer<QHstsPolicyPrivate> d; + QSharedDataPointer<QHstsPolicyPrivate> d; + + friend Q_NETWORK_EXPORT bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs); }; +Q_DECLARE_SHARED(QHstsPolicy) + +Q_NETWORK_EXPORT bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs); + +inline bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs) +{ + return !(lhs == rhs); +} + + QT_END_NAMESPACE #endif // QHSTSPOLICY_H diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index fd3cbbe36e..c2458152a3 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -550,15 +550,15 @@ QUrl QHttpNetworkConnectionPrivate::parseRedirectResponse(QAbstractSocket *socke // Check redirect url protocol const QUrl priorUrl(reply->request().url()); if (redirectUrl.scheme() == QLatin1String("http") || redirectUrl.scheme() == QLatin1String("https")) { - switch (reply->request().redirectsPolicy()) { - case QNetworkRequest::NoLessSafeRedirectsPolicy: + switch (reply->request().redirectPolicy()) { + case QNetworkRequest::NoLessSafeRedirectPolicy: // Here we could handle https->http redirects as InsecureProtocolError. // However, if HSTS is enabled and redirectUrl.host() is a known STS // host, then we'll replace its scheme and this won't downgrade protocol, // after all. We cannot access QNAM's STS cache from here, so delegate // this check to QNetworkReplyHttpImpl. break; - case QNetworkRequest::SameOriginRedirectsPolicy: + case QNetworkRequest::SameOriginRedirectPolicy: if (priorUrl.host() != redirectUrl.host() || priorUrl.scheme() != redirectUrl.scheme() || priorUrl.port() != redirectUrl.port()) { @@ -566,7 +566,7 @@ QUrl QHttpNetworkConnectionPrivate::parseRedirectResponse(QAbstractSocket *socke return QUrl(); } break; - case QNetworkRequest::UserVerifiedRedirectsPolicy: + case QNetworkRequest::UserVerifiedRedirectPolicy: break; default: Q_ASSERT(!"Unexpected redirect policy"); diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 7862d464e1..60b566299f 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -49,7 +49,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Oper : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false), http2Allowed(false), withCredentials(true), preConnect(false), redirectCount(0), - redirectsPolicy(QNetworkRequest::ManualRedirectsPolicy) + redirectPolicy(QNetworkRequest::ManualRedirectPolicy) { } @@ -67,7 +67,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest ssl(other.ssl), preConnect(other.preConnect), redirectCount(other.redirectCount), - redirectsPolicy(other.redirectsPolicy) + redirectPolicy(other.redirectPolicy) { } @@ -90,7 +90,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot && (withCredentials == other.withCredentials) && (ssl == other.ssl) && (preConnect == other.preConnect) - && (redirectsPolicy == other.redirectsPolicy); + && (redirectPolicy == other.redirectPolicy); } QByteArray QHttpNetworkRequest::methodName() const @@ -231,17 +231,17 @@ void QHttpNetworkRequest::setPreConnect(bool preConnect) bool QHttpNetworkRequest::isFollowRedirects() const { - return d->redirectsPolicy != QNetworkRequest::ManualRedirectsPolicy; + return d->redirectPolicy != QNetworkRequest::ManualRedirectPolicy; } -void QHttpNetworkRequest::setRedirectsPolicy(QNetworkRequest::RedirectsPolicy policy) +void QHttpNetworkRequest::setRedirectPolicy(QNetworkRequest::RedirectPolicy policy) { - d->redirectsPolicy = policy; + d->redirectPolicy = policy; } -QNetworkRequest::RedirectsPolicy QHttpNetworkRequest::redirectsPolicy() const +QNetworkRequest::RedirectPolicy QHttpNetworkRequest::redirectPolicy() const { - return d->redirectsPolicy; + return d->redirectPolicy; } int QHttpNetworkRequest::redirectCount() const diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h index 3900e9080e..ecf8856ded 100644 --- a/src/network/access/qhttpnetworkrequest_p.h +++ b/src/network/access/qhttpnetworkrequest_p.h @@ -131,8 +131,8 @@ public: void setPreConnect(bool preConnect); bool isFollowRedirects() const; - void setRedirectsPolicy(QNetworkRequest::RedirectsPolicy policy); - QNetworkRequest::RedirectsPolicy redirectsPolicy() const; + void setRedirectPolicy(QNetworkRequest::RedirectPolicy policy); + QNetworkRequest::RedirectPolicy redirectPolicy() const; int redirectCount() const; void setRedirectCount(int count); @@ -176,7 +176,7 @@ public: bool ssl; bool preConnect; int redirectCount; - QNetworkRequest::RedirectsPolicy redirectsPolicy; + QNetworkRequest::RedirectPolicy redirectPolicy; }; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 19e9ecc265..0a6270d417 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -697,36 +697,22 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar) /*! \since 5.9 - Enables HTTP Strict Transport Security (HSTS, RFC6797). When processing a - request, QNetworkAccessManager automatically replaces "http" scheme with - "https" and uses a secure transport if a host is a known HSTS host. - Port 80 if it's set explicitly is replaced by port 443. + If \a enabled is \c true, QNetworkAccessManager follows the HTTP Strict Transport + Security policy (HSTS, RFC6797). When processing a request, QNetworkAccessManager + automatically replaces the "http" scheme with "https" and uses a secure transport + for HSTS hosts. If it's set explicitly, port 80 is replaced by port 443. When HSTS is enabled, for each HTTP response containing HSTS header and received over a secure transport, QNetworkAccessManager will update its HSTS cache, either remembering a host with a valid policy or removing a host with - expired/disabled HSTS policy. + an expired or disabled HSTS policy. - \sa disableStrictTransportSecurity(), strictTransportSecurityEnabled() + \sa isStrictTransportSecurityEnabled() */ -void QNetworkAccessManager::enableStrictTransportSecurity() +void QNetworkAccessManager::setStrictTransportSecurityEnabled(bool enabled) { Q_D(QNetworkAccessManager); - d->stsEnabled = true; -} - -/*! - \since 5.9 - - Disables HTTP Strict Transport Security (HSTS). HSTS headers in responses would - be ignored, no scheme/port mapping is done. - - \sa enableStrictTransportSecurity() -*/ -void QNetworkAccessManager::disableStrictTransportSecurity() -{ - Q_D(QNetworkAccessManager); - d->stsEnabled = false; + d->stsEnabled = enabled; } /*! @@ -735,9 +721,9 @@ void QNetworkAccessManager::disableStrictTransportSecurity() Returns true if HTTP Strict Transport Security (HSTS) was enabled. By default HSTS is disabled. - \sa enableStrictTransportSecurity + \sa setStrictTransportSecurityEnabled() */ -bool QNetworkAccessManager::strictTransportSecurityEnabled() const +bool QNetworkAccessManager::isStrictTransportSecurityEnabled() const { Q_D(const QNetworkAccessManager); return d->stsEnabled; @@ -761,7 +747,7 @@ bool QNetworkAccessManager::strictTransportSecurityEnabled() const \sa addStrictTransportSecurityHosts(), QHstsPolicy */ -void QNetworkAccessManager::addStrictTransportSecurityHosts(const QList<QHstsPolicy> &knownHosts) +void QNetworkAccessManager::addStrictTransportSecurityHosts(const QVector<QHstsPolicy> &knownHosts) { Q_D(QNetworkAccessManager); d->stsCache.updateFromPolicies(knownHosts); @@ -776,7 +762,7 @@ void QNetworkAccessManager::addStrictTransportSecurityHosts(const QList<QHstsPol \sa addStrictTransportSecurityHosts(), QHstsPolicy */ -QList<QHstsPolicy> QNetworkAccessManager::strictTransportSecurityHosts() const +QVector<QHstsPolicy> QNetworkAccessManager::strictTransportSecurityHosts() const { Q_D(const QNetworkAccessManager); return d->stsCache.policies(); @@ -1171,7 +1157,7 @@ void QNetworkAccessManager::connectToHost(const QString &hostName, quint16 port) /*! \since 5.9 - Sets the manager's redirects policy to be the \a policy specified. This policy + Sets the manager's redirect policy to be the \a policy specified. This policy will affect all subsequent requests created by the manager. Use this function to enable or disable HTTP redirects on the manager's level. @@ -1180,18 +1166,18 @@ void QNetworkAccessManager::connectToHost(const QString &hostName, quint16 port) the highest priority, next by priority is QNetworkRequest::FollowRedirectsAttribute. Finally, the manager's policy has the lowest priority. - For backwards compatibility the default value is QNetworkRequest::ManualRedirectsPolicy. + For backwards compatibility the default value is QNetworkRequest::ManualRedirectPolicy. This may change in the future and some type of auto-redirect policy will become the default; clients relying on manual redirect handling are encouraged to set this policy explicitly in their code. - \sa redirectsPolicy(), QNetworkRequest::RedirectsPolicy, + \sa redirectPolicy(), QNetworkRequest::RedirectPolicy, QNetworkRequest::FollowRedirectsAttribute */ -void QNetworkAccessManager::setRedirectsPolicy(QNetworkRequest::RedirectsPolicy policy) +void QNetworkAccessManager::setRedirectPolicy(QNetworkRequest::RedirectPolicy policy) { Q_D(QNetworkAccessManager); - d->redirectsPolicy = policy; + d->redirectPolicy = policy; } /*! @@ -1199,12 +1185,12 @@ void QNetworkAccessManager::setRedirectsPolicy(QNetworkRequest::RedirectsPolicy Returns the redirect policy that is used when creating new requests. - \sa setRedirectsPolicy(), QNetworkRequest::RedirectsPolicy + \sa setRedirectPolicy(), QNetworkRequest::RedirectPolicy */ -QNetworkRequest::RedirectsPolicy QNetworkAccessManager::redirectsPolicy() const +QNetworkRequest::RedirectPolicy QNetworkAccessManager::redirectPolicy() const { Q_D(const QNetworkAccessManager); - return d->redirectsPolicy; + return d->redirectPolicy; } /*! @@ -1294,12 +1280,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera Q_D(QNetworkAccessManager); QNetworkRequest req(originalReq); - if (req.attribute(QNetworkRequest::RedirectsPolicyAttribute).isNull() + if (req.attribute(QNetworkRequest::RedirectPolicyAttribute).isNull() && req.attribute(QNetworkRequest::FollowRedirectsAttribute).isNull()) { // We only apply the general manager's policy if: - // - RedirectsPolicyAttribute is not set already on request and + // - RedirectPolicyAttribute is not set already on request and // - no FollowRedirectsAttribute is set. - req.setAttribute(QNetworkRequest::RedirectsPolicyAttribute, redirectsPolicy()); + req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, redirectPolicy()); } bool isLocalFile = req.url().isLocalFile(); @@ -1390,7 +1376,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera #endif ) { #ifndef QT_NO_SSL - if (strictTransportSecurityEnabled() && d->stsCache.isKnownHost(request.url())) { + if (isStrictTransportSecurityEnabled() && d->stsCache.isKnownHost(request.url())) { QUrl stsUrl(request.url()); // RFC6797, 8.3: // The UA MUST replace the URI scheme with "https" [RFC2818], diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 52769627f3..f035ac5b00 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -42,6 +42,7 @@ #include <QtNetwork/qtnetworkglobal.h> #include <QtNetwork/qnetworkrequest.h> +#include <QtCore/QVector> #include <QtCore/QObject> #ifndef QT_NO_SSL #include <QtNetwork/QSslConfiguration> @@ -121,11 +122,10 @@ public: QNetworkCookieJar *cookieJar() const; void setCookieJar(QNetworkCookieJar *cookieJar); - void enableStrictTransportSecurity(); - void disableStrictTransportSecurity(); - bool strictTransportSecurityEnabled() const; - void addStrictTransportSecurityHosts(const QList<QHstsPolicy> &knownHosts); - QList<QHstsPolicy> strictTransportSecurityHosts() const; + void setStrictTransportSecurityEnabled(bool enabled); + bool isStrictTransportSecurityEnabled() const; + void addStrictTransportSecurityHosts(const QVector<QHstsPolicy> &knownHosts); + QVector<QHstsPolicy> strictTransportSecurityHosts() const; QNetworkReply *head(const QNetworkRequest &request); QNetworkReply *get(const QNetworkRequest &request); @@ -155,8 +155,8 @@ public: #endif void connectToHost(const QString &hostName, quint16 port = 80); - void setRedirectsPolicy(QNetworkRequest::RedirectsPolicy policy); - QNetworkRequest::RedirectsPolicy redirectsPolicy() const; + void setRedirectPolicy(QNetworkRequest::RedirectPolicy policy); + QNetworkRequest::RedirectPolicy redirectPolicy() const; Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index cafc93871a..13a26a54f1 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -93,7 +93,7 @@ public: #endif cookieJarCreated(false), defaultAccessControl(true), - redirectsPolicy(QNetworkRequest::ManualRedirectsPolicy), + redirectPolicy(QNetworkRequest::ManualRedirectPolicy), authenticationManager(QSharedPointer<QNetworkAccessAuthenticationManager>::create()) { #ifndef QT_NO_BEARERMANAGEMENT @@ -196,7 +196,7 @@ public: bool cookieJarCreated; bool defaultAccessControl; - QNetworkRequest::RedirectsPolicy redirectsPolicy; + QNetworkRequest::RedirectPolicy redirectPolicy; // The cache with authorization data: QSharedPointer<QNetworkAccessAuthenticationManager> authenticationManager; diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index ca27e66791..79afd21a1a 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -736,7 +736,7 @@ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config) this function has no effect. \sa sslConfiguration(), sslErrors(), QSslSocket::ignoreSslErrors(), - QNetworkAccessManager::enableStrictTransportSecurity() + QNetworkAccessManager::setStrictTransportSecurityEnabled() */ void QNetworkReply::ignoreSslErrors(const QList<QSslError> &errors) { diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index ece08acc6b..5cd0747e34 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -668,14 +668,14 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq } #endif - auto redirectsPolicy = QNetworkRequest::ManualRedirectsPolicy; - const QVariant value = newHttpRequest.attribute(QNetworkRequest::RedirectsPolicyAttribute); + auto redirectPolicy = QNetworkRequest::ManualRedirectPolicy; + const QVariant value = newHttpRequest.attribute(QNetworkRequest::RedirectPolicyAttribute); if (value.isValid()) - redirectsPolicy = value.value<QNetworkRequest::RedirectsPolicy>(); + redirectPolicy = value.value<QNetworkRequest::RedirectPolicy>(); else if (newHttpRequest.attribute(QNetworkRequest::FollowRedirectsAttribute).toBool()) - redirectsPolicy = QNetworkRequest::NoLessSafeRedirectsPolicy; + redirectPolicy = QNetworkRequest::NoLessSafeRedirectPolicy; - httpRequest.setRedirectsPolicy(redirectsPolicy); + httpRequest.setRedirectPolicy(redirectPolicy); httpRequest.setPriority(convert(newHttpRequest.priority())); @@ -1155,7 +1155,7 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt const bool isLessSafe = schemeBefore == QLatin1String("https") && url.scheme() == QLatin1String("http"); - if (httpRequest.redirectsPolicy() == QNetworkRequest::NoLessSafeRedirectsPolicy + if (httpRequest.redirectPolicy() == QNetworkRequest::NoLessSafeRedirectPolicy && isLessSafe) { error(QNetworkReply::InsecureRedirectError, QCoreApplication::translate("QHttp", "Insecure redirect")); @@ -1165,7 +1165,7 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt redirectRequest = createRedirectRequest(originalRequest, url, maxRedirectsRemaining); operation = getRedirectOperation(operation, httpStatus); - if (httpRequest.redirectsPolicy() != QNetworkRequest::UserVerifiedRedirectsPolicy) + if (httpRequest.redirectPolicy() != QNetworkRequest::UserVerifiedRedirectPolicy) followRedirect(); emit q->redirected(url); diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 169695fa27..e95187de30 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -289,9 +289,9 @@ QT_BEGIN_NAMESPACE marked to be decompressed automatically. (This value was introduced in 5.9.) - \value RedirectsPolicyAttribute + \value RedirectPolicyAttribute Requests only, type: QMetaType::Int, should be one of the - QNetworkRequest::RedirectsPolicy values (default: ManualRedirectsPolicy). + QNetworkRequest::RedirectPolicy values (default: ManualRedirectPolicy). This attribute obsoletes FollowRedirectsAttribute. (This value was introduced in 5.9.) @@ -343,33 +343,33 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QNetworkRequest::RedirectsPolicy + \enum QNetworkRequest::RedirectPolicy \since 5.9 Indicates whether the Network Access API should automatically follow a HTTP redirect response or not. - \value ManualRedirectsPolicy Default value: not following any redirects. - - \value NoLessSafeRedirectsPolicy Only "http"->"http", "http" -> "https" - or "https" -> "https" redirects are allowed. - Equivalent to setting the old FollowRedirectsAttribute - to true - - \value SameOriginRedirectsPolicy Require the same protocol, host and port. - Note, http://example.com and http://example.com:80 - will fail with this policy (implicit/explicit ports - are considered to be a mismatch). - - \value UserVerifiedRedirectsPolicy Client decides whether to follow each - redirect by handling the redirected() - signal, emitting redirectAllowed() on - the QNetworkReply object to allow - the redirect or aborting/finishing it to - reject the redirect. This can be used, - for example, to ask the user whether to - accept the redirect, or to decide - based on some app-specific configuration. + \value ManualRedirectPolicy Default value: not following any redirects. + + \value NoLessSafeRedirectPolicy Only "http"->"http", "http" -> "https" + or "https" -> "https" redirects are allowed. + Equivalent to setting the old FollowRedirectsAttribute + to true + + \value SameOriginRedirectPolicy Require the same protocol, host and port. + Note, http://example.com and http://example.com:80 + will fail with this policy (implicit/explicit ports + are considered to be a mismatch). + + \value UserVerifiedRedirectPolicy Client decides whether to follow each + redirect by handling the redirected() + signal, emitting redirectAllowed() on + the QNetworkReply object to allow + the redirect or aborting/finishing it to + reject the redirect. This can be used, + for example, to ask the user whether to + accept the redirect, or to decide + based on some app-specific configuration. */ class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index 06c895af5f..68d4ae6d6b 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -91,7 +91,7 @@ public: HTTP2AllowedAttribute, HTTP2WasUsedAttribute, OriginalContentLengthAttribute, - RedirectsPolicyAttribute, + RedirectPolicyAttribute, User = 1000, UserMax = 32767 @@ -113,11 +113,11 @@ public: LowPriority = 5 }; - enum RedirectsPolicy { - ManualRedirectsPolicy, - NoLessSafeRedirectsPolicy, - SameOriginRedirectsPolicy, - UserVerifiedRedirectsPolicy + enum RedirectPolicy { + ManualRedirectPolicy, + NoLessSafeRedirectPolicy, + SameOriginRedirectPolicy, + UserVerifiedRedirectPolicy }; @@ -177,6 +177,6 @@ Q_DECLARE_SHARED(QNetworkRequest) QT_END_NAMESPACE Q_DECLARE_METATYPE(QNetworkRequest) -Q_DECLARE_METATYPE(QNetworkRequest::RedirectsPolicy) +Q_DECLARE_METATYPE(QNetworkRequest::RedirectPolicy) #endif diff --git a/src/network/configure.json b/src/network/configure.json index 1e08aa7c49..7bd3f6164a 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -7,9 +7,6 @@ "commandline": { "assignments": { - "OPENSSL_LIBS": "openssl.libs", - "OPENSSL_LIBS_DEBUG": "openssl.libs.debug", - "OPENSSL_LIBS_RELEASE": "openssl.libs.release", "OPENSSL_PATH": "openssl.prefix" }, "options": { @@ -46,13 +43,24 @@ "-lproxy" ] }, + "openssl_headers": { + "label": "OpenSSL Headers", + "export": "openssl", + "test": "unix/openssl", + "sources": [ + { + "comment": "placeholder for OPENSSL_PATH", + "libs": "" + } + ] + }, "openssl": { - "label": "OpenSSL Libraries", - "export": "", + "label": "OpenSSL", + "test": "unix/openssl", "sources": [ { "type": "openssl" }, { - "comment": "placeholder for OPENSSL_LIBS{,_{DEBUG,RELEASE}}", + "comment": "placeholder for OPENSSL_{PATH,LIBS{,_{DEBUG,RELEASE}}}", "libs": "", "builds": { "debug": "", @@ -92,11 +100,6 @@ "test": "unix/ipv6ifname", "use": "network" }, - "openssl": { - "label": "OpenSSL", - "type": "compile", - "test": "unix/openssl" - }, "sctp": { "label": "SCTP support", "type": "compile", @@ -138,7 +141,7 @@ "enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'", "disable": "input.openssl == 'no' || input.ssl == 'no'", "autoDetect": "!config.winrt", - "condition": "!features.securetransport && tests.openssl", + "condition": "!features.securetransport && (features.openssl-linked || libs.openssl_headers)", "output": [ "privateFeature", { "type": "publicQtConfig", "condition": "!features.openssl-linked" }, @@ -149,14 +152,9 @@ "label": " Qt directly linked to OpenSSL", "enable": "input.openssl == 'linked'", "disable": "input.openssl != 'linked'", - "condition": "features.openssl && libs.openssl", + "condition": "!features.securetransport && libs.openssl", "output": [ "privateFeature", - { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "libs.openssl.libs", "eval": "true" }, - { "type": "varAssign", "name": "OPENSSL_LIBS_DEBUG", "value": "libs.openssl.builds.debug.libs", - "eval": "true", "condition": "config.win32" }, - { "type": "varAssign", "name": "OPENSSL_LIBS_RELEASE", "value": "libs.openssl.builds.release.libs", - "eval": "true", "condition": "config.win32" }, { "type": "define", "name": "QT_LINKED_OPENSSL" } ] }, diff --git a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp index 3783a6f939..378022d655 100644 --- a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp +++ b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** diff --git a/src/network/kernel/qnetworkdatagram.cpp b/src/network/kernel/qnetworkdatagram.cpp index 88ca763187..dd412b69d1 100644 --- a/src/network/kernel/qnetworkdatagram.cpp +++ b/src/network/kernel/qnetworkdatagram.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/kernel/qnetworkdatagram.h b/src/network/kernel/qnetworkdatagram.h index a20d69185a..fa994d6170 100644 --- a/src/network/kernel/qnetworkdatagram.h +++ b/src/network/kernel/qnetworkdatagram.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/kernel/qnetworkdatagram_p.h b/src/network/kernel/qnetworkdatagram_p.h index e55651a78b..5b5c037488 100644 --- a/src/network/kernel/qnetworkdatagram_p.h +++ b/src/network/kernel/qnetworkdatagram_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index b56d460b8c..cf3afe1845 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -358,17 +358,41 @@ bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address) #if !defined(QT_NO_NETWORKPROXY) QObject *parent = q_func()->parent(); QNetworkProxy proxy; + QNetworkProxyQuery::QueryType queryType = QNetworkProxyQuery::TcpSocket; if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(parent)) { proxy = socket->proxy(); + switch (socket->socketType()) { + case QAbstractSocket::UdpSocket: + queryType = QNetworkProxyQuery::UdpSocket; + break; + case QAbstractSocket::SctpSocket: + queryType = QNetworkProxyQuery::SctpSocket; + break; + case QAbstractSocket::TcpSocket: + case QAbstractSocket::UnknownSocketType: + queryType = QNetworkProxyQuery::TcpSocket; + } } else if (QTcpServer *server = qobject_cast<QTcpServer *>(parent)) { proxy = server->proxy(); + queryType = QNetworkProxyQuery::TcpServer; +#ifndef QT_NO_SCTP + if (qobject_cast<QSctpServer *>(server)) + queryType = QNetworkProxyQuery::SctpServer; +#endif } else { // no parent -> no proxy return true; } - if (proxy.type() == QNetworkProxy::DefaultProxy) - proxy = QNetworkProxy::applicationProxy(); + if (proxy.type() == QNetworkProxy::DefaultProxy) { + // This is similar to what we have in QNetworkProxy::applicationProxy, + // the only difference is that we provide the correct query type instead of + // always using TcpSocket unconditionally (this is the default type for + // QNetworkProxyQuery). + QNetworkProxyQuery query; + query.setQueryType(queryType); + proxy = QNetworkProxyFactory::systemProxyForQuery(query).constFirst(); + } if (proxy.type() != QNetworkProxy::DefaultProxy && proxy.type() != QNetworkProxy::NoProxy) { diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index c12ae9730f..1e69aebb54 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -678,10 +678,16 @@ static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d, if (interface.isValid()) { const QList<QNetworkAddressEntry> addressEntries = interface.addressEntries(); - if (!addressEntries.isEmpty()) { - QHostAddress firstIP = addressEntries.first().ip(); - mreq4.imr_interface.s_addr = htonl(firstIP.toIPv4Address()); - } else { + bool found = false; + for (const QNetworkAddressEntry &entry : addressEntries) { + const QHostAddress ip = entry.ip(); + if (ip.protocol() == QAbstractSocket::IPv4Protocol) { + mreq4.imr_interface.s_addr = htonl(ip.toIPv4Address()); + found = true; + break; + } + } + if (!found) { d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::NetworkUnreachableErrorString); return false; diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 9e43265e59..2088d3927e 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -953,10 +953,16 @@ static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d, if (iface.isValid()) { const QList<QNetworkAddressEntry> addressEntries = iface.addressEntries(); - if (!addressEntries.isEmpty()) { - QHostAddress firstIP = addressEntries.first().ip(); - mreq4.imr_interface.s_addr = htonl(firstIP.toIPv4Address()); - } else { + bool found = false; + for (const QNetworkAddressEntry &entry : addressEntries) { + const QHostAddress ip = entry.ip(); + if (ip.protocol() == QAbstractSocket::IPv4Protocol) { + mreq4.imr_interface.s_addr = htonl(ip.toIPv4Address()); + found = true; + break; + } + } + if (!found) { d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::NetworkUnreachableErrorString); return false; diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp index de7eab9a9e..cb6c474861 100644 --- a/src/network/ssl/qssldiffiehellmanparameters.cpp +++ b/src/network/ssl/qssldiffiehellmanparameters.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/ssl/qssldiffiehellmanparameters.h b/src/network/ssl/qssldiffiehellmanparameters.h index 4533ea4ed2..497d2bebfb 100644 --- a/src/network/ssl/qssldiffiehellmanparameters.h +++ b/src/network/ssl/qssldiffiehellmanparameters.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp b/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp index 220c017f4c..8fcf141f73 100644 --- a/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp +++ b/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp b/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp index 949da1b7df..90687b05c5 100644 --- a/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp +++ b/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/ssl/qssldiffiehellmanparameters_p.h b/src/network/ssl/qssldiffiehellmanparameters_p.h index 06ecf292ff..dd69895dae 100644 --- a/src/network/ssl/qssldiffiehellmanparameters_p.h +++ b/src/network/ssl/qssldiffiehellmanparameters_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 79351017a6..52ce2eeade 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -56,7 +56,7 @@ qtConfig(ssl) { ssl/qsslellipticcurve_dummy.cpp } - qtConfig(openssl)|qtConfig(openssl-linked) { + qtConfig(openssl) { HEADERS += ssl/qsslcontext_openssl_p.h \ ssl/qsslsocket_openssl_p.h \ ssl/qsslsocket_openssl_symbols_p.h @@ -79,16 +79,10 @@ qtConfig(ssl) { # - libs in <OPENSSL_DIR>\lib\VC\static # - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD" - include($$OUT_PWD/qtnetwork-config.pri) - - CONFIG(debug, debug|release) { - LIBS_PRIVATE += $$OPENSSL_LIBS_DEBUG - } else { - LIBS_PRIVATE += $$OPENSSL_LIBS_RELEASE - } - - QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS - LIBS_PRIVATE += $$OPENSSL_LIBS + qtConfig(openssl-linked): \ + QMAKE_USE_FOR_PRIVATE += openssl + else: \ + QMAKE_USE_FOR_PRIVATE += openssl/nolink win32: LIBS_PRIVATE += -lcrypt32 } } diff --git a/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h b/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h index 7773c275b9..99624bd5d6 100644 --- a/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h +++ b/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h index b596269e0c..ff6085d725 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h @@ -5,27 +5,33 @@ ** ** This file is part of the plugins module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp index 352e4dfd56..09470bccc6 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp @@ -37,6 +37,8 @@ ** ****************************************************************************/ +#include <QtGui/qtgui-config.h> + #ifndef QT_NO_SYSTEMTRAYICON #include "qdbustrayicon_p.h" #endif diff --git a/src/platformsupport/themes/genericunix/genericunix.pri b/src/platformsupport/themes/genericunix/genericunix.pri index 27019b4aa2..11da533bc4 100644 --- a/src/platformsupport/themes/genericunix/genericunix.pri +++ b/src/platformsupport/themes/genericunix/genericunix.pri @@ -3,5 +3,8 @@ SOURCES += $$PWD/qgenericunixthemes.cpp qtConfig(dbus) { include(dbusmenu/dbusmenu.pri) - include(dbustray/dbustray.pri) + + qtConfig(systemtrayicon) { + include(dbustray/dbustray.pri) + } } diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 736c66ebc0..0a55f689c6 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -572,7 +572,8 @@ QString QIBusPlatformInputContextPrivate::getSocketPath() if (debug) qDebug() << "host=" << host << "displayNumber" << displayNumber; - return QDir::homePath() + QLatin1String("/.config/ibus/bus/") + + return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + + QLatin1String("/ibus/bus/") + QLatin1String(QDBusConnection::localMachineId()) + QLatin1Char('-') + QString::fromLocal8Bit(host) + QLatin1Char('-') + QString::fromLocal8Bit(displayNumber); } diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index d9ecdfac3d..d3810329c5 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -100,10 +100,6 @@ bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface) bool ret = QEGLPlatformContext::makeCurrent(surface); QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context()); - const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); - if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) - ctx_d->workaround_missingPrecisionQualifiers = true; - if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) ctx_d->workaround_brokenFBOReadBack = true; diff --git a/src/plugins/platforms/bsdfb/main.cpp b/src/plugins/platforms/bsdfb/main.cpp index f4ab3dee39..b2cd1373a7 100644 --- a/src/plugins/platforms/bsdfb/main.cpp +++ b/src/plugins/platforms/bsdfb/main.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp index 1fa13183f8..6a7d445e69 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.h b/src/plugins/platforms/bsdfb/qbsdfbintegration.h index 2be5ea260d..81195edf7e 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbintegration.h +++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp index 03c6f0dbe9..067a26a7b1 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.h b/src/plugins/platforms/bsdfb/qbsdfbscreen.h index 3e244e3460..890a2eb757 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbscreen.h +++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.h @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index de4fa95530..c71e80d191 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -201,6 +201,10 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const dpr = sourceWindow->devicePixelRatio(); } #endif + else { + if (const QWindow *focusWindow = qApp->focusWindow()) + dpr = focusWindow->devicePixelRatio(); + } pm = QPixmap(width * dpr, height * dpr); pm.setDevicePixelRatio(dpr); QPainter p(&pm); diff --git a/src/plugins/platforms/integrity/main.cpp b/src/plugins/platforms/integrity/main.cpp index 3330ddc5ae..f75e227335 100644 --- a/src/plugins/platforms/integrity/main.cpp +++ b/src/plugins/platforms/integrity/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/integrity/qintegrityfbintegration.cpp b/src/plugins/platforms/integrity/qintegrityfbintegration.cpp index a88c85e30d..ae802bb1fa 100644 --- a/src/plugins/platforms/integrity/qintegrityfbintegration.cpp +++ b/src/plugins/platforms/integrity/qintegrityfbintegration.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/integrity/qintegrityfbintegration.h b/src/plugins/platforms/integrity/qintegrityfbintegration.h index 3210cc9369..a954dc2356 100644 --- a/src/plugins/platforms/integrity/qintegrityfbintegration.h +++ b/src/plugins/platforms/integrity/qintegrityfbintegration.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/integrity/qintegrityfbscreen.cpp b/src/plugins/platforms/integrity/qintegrityfbscreen.cpp index 6dc10890ce..3979937955 100644 --- a/src/plugins/platforms/integrity/qintegrityfbscreen.cpp +++ b/src/plugins/platforms/integrity/qintegrityfbscreen.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/integrity/qintegrityfbscreen.h b/src/plugins/platforms/integrity/qintegrityfbscreen.h index 5b4d900a4b..6bc78913c9 100644 --- a/src/plugins/platforms/integrity/qintegrityfbscreen.h +++ b/src/plugins/platforms/integrity/qintegrityfbscreen.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/integrity/qintegrityhidmanager.cpp b/src/plugins/platforms/integrity/qintegrityhidmanager.cpp index 64eda98e2a..49583735f5 100644 --- a/src/plugins/platforms/integrity/qintegrityhidmanager.cpp +++ b/src/plugins/platforms/integrity/qintegrityhidmanager.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Green Hills Software -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/integrity/qintegrityhidmanager.h b/src/plugins/platforms/integrity/qintegrityhidmanager.h index 9a0f27d833..c8780b2dc2 100644 --- a/src/plugins/platforms/integrity/qintegrityhidmanager.h +++ b/src/plugins/platforms/integrity/qintegrityhidmanager.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Green Hills Software -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm index 2ec0d33a41..8b372b8749 100644 --- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h index df3f6b9fa3..c52d498cd4 100644 --- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm index f9662b964a..78e0f00ab4 100644 --- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/ios/qiosoptionalplugininterface.h b/src/plugins/platforms/ios/qiosoptionalplugininterface.h index bcb8978e02..3f74e41c83 100644 --- a/src/plugins/platforms/ios/qiosoptionalplugininterface.h +++ b/src/plugins/platforms/ios/qiosoptionalplugininterface.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.h b/src/plugins/platforms/ios/qiostextinputoverlay.h index 2f01993b19..9ed3a9b271 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.h +++ b/src/plugins/platforms/ios/qiostextinputoverlay.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm index 48262dad10..78f84729da 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.mm +++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp index dae3e83f37..58dcfc9b51 100644 --- a/src/plugins/platforms/vnc/qvncclient.cpp +++ b/src/plugins/platforms/vnc/qvncclient.cpp @@ -142,7 +142,7 @@ void QVncClient::convertPixels(char *dst, const char *src, int count) const case 16: { quint16 p = *reinterpret_cast<const quint16*>(src); #if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (swapBytes) + if (m_swapBytes) p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8); #endif r = (p >> 11) & 0x1f; @@ -484,7 +484,7 @@ void QVncClient::setPixelFormat() m_sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!m_pixelFormat.bigEndian; m_needConversion = pixelConversionNeeded(); #if Q_BYTE_ORDER == Q_BIG_ENDIAN - m_swapBytes = qvnc_screen->swapBytes(); + m_swapBytes = server()->screen()->swapBytes(); #endif } } @@ -639,7 +639,7 @@ bool QVncClient::pixelConversionNeeded() const return true; #if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (qvnc_screen->swapBytes()) + if (server()->screen()->swapBytes()) return true; #endif diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index 91a8933dba..75c8bedff7 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -43,6 +43,7 @@ #include <QtFbSupport/private/qfbcursor_p.h> #include <QtGui/QPainter> +#include <QtGui/QScreen> #include <QtCore/QRegularExpression> @@ -172,14 +173,18 @@ QPixmap QVncScreen::grabWindow(WId wid, int x, int y, int width, int height) con } #if Q_BYTE_ORDER == Q_BIG_ENDIAN -bool QVNCScreen::swapBytes() const +bool QVncScreen::swapBytes() const { + return false; + + /* TODO if (depth() != 16) return false; if (screen()) return screen()->frameBufferLittleEndian(); return frameBufferLittleEndian(); + */ } #endif diff --git a/src/plugins/platforms/vnc/qvncscreen.h b/src/plugins/platforms/vnc/qvncscreen.h index c0a22ed140..b2dd89a2ed 100644 --- a/src/plugins/platforms/vnc/qvncscreen.h +++ b/src/plugins/platforms/vnc/qvncscreen.h @@ -75,7 +75,7 @@ public: void clearDirty() { dirtyRegion = QRegion(); } #if Q_BYTE_ORDER == Q_BIG_ENDIAN - bool swapBytes() const + bool swapBytes() const; #endif QStringList mArgs; diff --git a/src/plugins/platforms/windows/qwindowsthreadpoolrunner.h b/src/plugins/platforms/windows/qwindowsthreadpoolrunner.h index ad71987ec8..5601cc9305 100644 --- a/src/plugins/platforms/windows/qwindowsthreadpoolrunner.h +++ b/src/plugins/platforms/windows/qwindowsthreadpoolrunner.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index f7fd2ca8b1..4f976986bb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -441,10 +441,10 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) dev->size.setHeight((vci->max - vci->min) * 1000.0 / vciResolution); } else if (vci->label == atom(QXcbAtom::AbsX)) { caps |= QTouchDevice::Position; - dev->size.setHeight((vci->max - vci->min) * 1000.0 / vciResolution); + dev->size.setWidth((vci->max - vci->min) * 1000.0 / vciResolution); } else if (vci->label == atom(QXcbAtom::AbsY)) { caps |= QTouchDevice::Position; - dev->size.setWidth((vci->max - vci->min) * 1000.0 / vciResolution); + dev->size.setHeight((vci->max - vci->min) * 1000.0 / vciResolution); } break; } @@ -1128,10 +1128,7 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD break; } case XI_Motion: - // Report TabletMove only when the stylus is touching the tablet or any button is pressed. - // TODO: report proximity (hover) motion (no suitable Qt event exists yet). - if (tabletData->buttons != Qt::NoButton) - xi2ReportTabletEvent(xiEvent, tabletData); + xi2ReportTabletEvent(xiEvent, tabletData); break; case XI_PropertyEvent: { // This is the wacom driver's way of reporting tool proximity. diff --git a/src/sql/configure.json b/src/sql/configure.json index 72671b6df9..ff2409415b 100644 --- a/src/sql/configure.json +++ b/src/sql/configure.json @@ -8,7 +8,6 @@ "commandline": { "assignments": { "MYSQL_PATH": "mysql.prefix", - "PSQL_LIBS": "psql.libs", "SYBASE": "tds.prefix", "SYBASE_LIBS": "tds.libs" }, @@ -115,8 +114,10 @@ "test": "unix/sqlite", "sources": [ { "type": "pkgConfig", "args": "sqlite3" }, - { "libs": "-lsqlite3", "condition": "config.win32" }, - { "libs": "-lsqlite3 -lz", "condition": "!config.win32" } + "-lsqlite3" + ], + "use": [ + { "lib": "zlib", "condition": "!config.win32" } ] } }, @@ -152,7 +153,7 @@ }, "sql-odbc": { "label": "ODBC", - "condition": "libs.odbc", + "condition": "libs.odbc && features.textdate", "output": [ "publicFeature" ] }, "sql-psql": { @@ -167,6 +168,7 @@ }, "sql-sqlite": { "label": "SQLite", + "condition": "features.textdate", "output": [ "publicFeature" ] }, "system-sqlite": { @@ -177,7 +179,7 @@ }, "sql-tds": { "label": "TDS (Sybase)", - "condition": "libs.tds", + "condition": "libs.tds && features.textdate", "output": [ "publicFeature" ] } }, diff --git a/src/widgets/configure.json b/src/widgets/configure.json index e7007f71b7..7bc2e06a32 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -121,7 +121,7 @@ "label": "QDateTimeEdit", "purpose": "Supports editing dates and times.", "section": "Widgets", - "condition": "features.calendarwidget && features.datestring", + "condition": "features.calendarwidget && features.datestring && features.textdate", "output": [ "publicFeature", "feature" ] }, "stackedwidget": { diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index 713ccb6556..9bb046db61 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -274,7 +274,7 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move) continue; insertRows(row, 1); setUrl(index(row, 0), url, idx); - watching.append(qMakePair(idx, cleanUrl)); + watching.append({idx, cleanUrl}); } } @@ -326,7 +326,7 @@ void QUrlModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto { QModelIndex parent = topLeft.parent(); for (int i = 0; i < watching.count(); ++i) { - QModelIndex index = watching.at(i).first; + QModelIndex index = watching.at(i).index; if (index.model() && topLeft.model()) { Q_ASSERT(index.model() == topLeft.model()); } @@ -335,7 +335,7 @@ void QUrlModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto && index.column() >= topLeft.column() && index.column() <= bottomRight.column() && index.parent() == parent) { - changed(watching.at(i).second); + changed(watching.at(i).path); } } } @@ -349,12 +349,12 @@ void QUrlModel::layoutChanged() const int numPaths = watching.count(); paths.reserve(numPaths); for (int i = 0; i < numPaths; ++i) - paths.append(watching.at(i).second); + paths.append(watching.at(i).path); watching.clear(); for (int i = 0; i < numPaths; ++i) { QString path = paths.at(i); QModelIndex newIndex = fileSystemModel->index(path); - watching.append(QPair<QModelIndex, QString>(newIndex, path)); + watching.append({newIndex, path}); if (newIndex.isValid()) changed(path); } diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h index 3e177e7e68..0685e81b2b 100644 --- a/src/widgets/dialogs/qsidebar_p.h +++ b/src/widgets/dialogs/qsidebar_p.h @@ -108,9 +108,16 @@ private: void changed(const QString &path); void addIndexToWatch(const QString &path, const QModelIndex &index); QFileSystemModel *fileSystemModel; - QVector<QPair<QModelIndex, QString> > watching; + struct WatchItem { + QModelIndex index; + QString path; + }; + friend class QTypeInfo<WatchItem>; + + QVector<WatchItem> watching; QList<QUrl> invalidUrls; }; +Q_DECLARE_TYPEINFO(QUrlModel::WatchItem, Q_MOVABLE_TYPE); class Q_AUTOTEST_EXPORT QSidebar : public QListView { diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 2c85ed3c0b..0e4ee30c19 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3182,17 +3182,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (!w->hasMouseTracking() && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { // but still send them through all application event filters (normally done by notify_helper) - for (int i = 0; d->extraData && i < d->extraData->eventFilters.size(); ++i) { - QObject *obj = d->extraData->eventFilters.at(i); - if (!obj) - continue; - if (Q_UNLIKELY(obj->d_func()->threadData != w->d_func()->threadData)) { - qWarning("QApplication: Object event filter cannot be in a different thread."); - continue; - } - if (obj->eventFilter(w, w == receiver ? mouse : &me)) - break; - } + d->sendThroughApplicationEventFilters(w, w == receiver ? mouse : &me); res = true; } else { w->setAttribute(Qt::WA_NoMouseReplay, false); diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp index b08a9abb1e..b5a0cd3940 100644 --- a/src/widgets/kernel/qsizepolicy.cpp +++ b/src/widgets/kernel/qsizepolicy.cpp @@ -232,7 +232,7 @@ QT_BEGIN_NAMESPACE Returns the control type associated with the widget for which this size policy applies. */ -QSizePolicy::ControlType QSizePolicy::controlType() const +QSizePolicy::ControlType QSizePolicy::controlType() const Q_DECL_NOTHROW { return QSizePolicy::ControlType(1 << bits.ctype); } @@ -253,35 +253,11 @@ QSizePolicy::ControlType QSizePolicy::controlType() const \sa QStyle::layoutSpacing() */ -void QSizePolicy::setControlType(ControlType type) +void QSizePolicy::setControlType(ControlType type) Q_DECL_NOTHROW { bits.ctype = toControlTypeFieldValue(type); } -quint32 QSizePolicy::toControlTypeFieldValue(ControlType type) Q_DECL_NOTHROW -{ - /* - The control type is a flag type, with values 0x1, 0x2, 0x4, 0x8, 0x10, - etc. In memory, we pack it onto the available bits (CTSize) in - setControlType(), and unpack it here. - - Example: - - 0x00000001 maps to 0 - 0x00000002 maps to 1 - 0x00000004 maps to 2 - 0x00000008 maps to 3 - etc. - */ - - int i = 0; - while (true) { - if (type & (0x1 << i)) - return i; - ++i; - } -} - /*! \fn void QSizePolicy::setHeightForWidth(bool dependent) diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 83ce5853ab..07d8393c6f 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -42,6 +42,7 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> +#include <QtCore/qalgorithms.h> QT_BEGIN_NAMESPACE @@ -51,10 +52,6 @@ QT_BEGIN_NAMESPACE # define QT_SIZEPOLICY_CONSTEXPR Q_DECL_CONSTEXPR # if defined(Q_COMPILER_UNIFORM_INIT) # define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT Q_DECL_CONSTEXPR -# if defined(Q_COMPILER_CONSTEXPR) -# define QT_SIZEPOLICY_RETURN_BITS(E1, E2, E3, E4, E5, E6, E7, E8) \ - return Bits{ E1, E2, E3, E4, E5, E6, E7, E8 } -# endif // constexpr && uniform-init # endif // uniform-init #endif @@ -64,10 +61,6 @@ QT_BEGIN_NAMESPACE #ifndef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT # define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT #endif -#ifndef QT_SIZEPOLICY_RETURN_BITS -# define QT_SIZEPOLICY_RETURN_BITS(E1, E2, E3, E4, E5, E6, E7, E8) \ - const Bits result = { E1, E2, E3, E4, E5, E6, E7, E8 }; return result -#endif class QVariant; class QSizePolicy; @@ -117,55 +110,55 @@ public: Q_DECLARE_FLAGS(ControlTypes, ControlType) Q_FLAG(ControlTypes) - QT_SIZEPOLICY_CONSTEXPR QSizePolicy() : data(0) { } + QT_SIZEPOLICY_CONSTEXPR QSizePolicy() Q_DECL_NOTHROW : data(0) { } #ifdef Q_COMPILER_UNIFORM_INIT - QT_SIZEPOLICY_CONSTEXPR QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) + QT_SIZEPOLICY_CONSTEXPR QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) Q_DECL_NOTHROW : bits{0, 0, quint32(horizontal), quint32(vertical), type == DefaultType ? 0 : toControlTypeFieldValue(type), 0, 0, 0} {} #else - QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) + QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) Q_DECL_NOTHROW : data(0) { bits.horPolicy = horizontal; bits.verPolicy = vertical; setControlType(type); } #endif // uniform-init - QT_SIZEPOLICY_CONSTEXPR Policy horizontalPolicy() const { return static_cast<Policy>(bits.horPolicy); } - QT_SIZEPOLICY_CONSTEXPR Policy verticalPolicy() const { return static_cast<Policy>(bits.verPolicy); } - ControlType controlType() const; + QT_SIZEPOLICY_CONSTEXPR Policy horizontalPolicy() const Q_DECL_NOTHROW { return static_cast<Policy>(bits.horPolicy); } + QT_SIZEPOLICY_CONSTEXPR Policy verticalPolicy() const Q_DECL_NOTHROW { return static_cast<Policy>(bits.verPolicy); } + ControlType controlType() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) { bits.horPolicy = d; } - Q_DECL_RELAXED_CONSTEXPR void setVerticalPolicy(Policy d) { bits.verPolicy = d; } - void setControlType(ControlType type); + Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) Q_DECL_NOTHROW { bits.horPolicy = d; } + Q_DECL_RELAXED_CONSTEXPR void setVerticalPolicy(Policy d) Q_DECL_NOTHROW { bits.verPolicy = d; } + void setControlType(ControlType type) Q_DECL_NOTHROW; - QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const { + QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const Q_DECL_NOTHROW { return ( (verticalPolicy() & ExpandFlag) ? Qt::Vertical : Qt::Orientations() ) | ( (horizontalPolicy() & ExpandFlag) ? Qt::Horizontal : Qt::Orientations() ) ; } - Q_DECL_RELAXED_CONSTEXPR void setHeightForWidth(bool b) { bits.hfw = b; } - QT_SIZEPOLICY_CONSTEXPR bool hasHeightForWidth() const { return bits.hfw; } - Q_DECL_RELAXED_CONSTEXPR void setWidthForHeight(bool b) { bits.wfh = b; } - QT_SIZEPOLICY_CONSTEXPR bool hasWidthForHeight() const { return bits.wfh; } + Q_DECL_RELAXED_CONSTEXPR void setHeightForWidth(bool b) Q_DECL_NOTHROW { bits.hfw = b; } + QT_SIZEPOLICY_CONSTEXPR bool hasHeightForWidth() const Q_DECL_NOTHROW { return bits.hfw; } + Q_DECL_RELAXED_CONSTEXPR void setWidthForHeight(bool b) Q_DECL_NOTHROW { bits.wfh = b; } + QT_SIZEPOLICY_CONSTEXPR bool hasWidthForHeight() const Q_DECL_NOTHROW { return bits.wfh; } - QT_SIZEPOLICY_CONSTEXPR bool operator==(const QSizePolicy& s) const { return data == s.data; } - QT_SIZEPOLICY_CONSTEXPR bool operator!=(const QSizePolicy& s) const { return data != s.data; } + QT_SIZEPOLICY_CONSTEXPR bool operator==(const QSizePolicy& s) const Q_DECL_NOTHROW { return data == s.data; } + QT_SIZEPOLICY_CONSTEXPR bool operator!=(const QSizePolicy& s) const Q_DECL_NOTHROW { return data != s.data; } friend Q_DECL_CONST_FUNCTION uint qHash(QSizePolicy key, uint seed) Q_DECL_NOTHROW { return qHash(key.data, seed); } operator QVariant() const; - QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const { return static_cast<int>(bits.horStretch); } - QT_SIZEPOLICY_CONSTEXPR int verticalStretch() const { return static_cast<int>(bits.verStretch); } + QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const Q_DECL_NOTHROW { return static_cast<int>(bits.horStretch); } + QT_SIZEPOLICY_CONSTEXPR int verticalStretch() const Q_DECL_NOTHROW { return static_cast<int>(bits.verStretch); } Q_DECL_RELAXED_CONSTEXPR void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); } Q_DECL_RELAXED_CONSTEXPR void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); } - QT_SIZEPOLICY_CONSTEXPR bool retainSizeWhenHidden() const { return bits.retainSizeWhenHidden; } - Q_DECL_RELAXED_CONSTEXPR void setRetainSizeWhenHidden(bool retainSize) { bits.retainSizeWhenHidden = retainSize; } + QT_SIZEPOLICY_CONSTEXPR bool retainSizeWhenHidden() const Q_DECL_NOTHROW { return bits.retainSizeWhenHidden; } + Q_DECL_RELAXED_CONSTEXPR void setRetainSizeWhenHidden(bool retainSize) Q_DECL_NOTHROW { bits.retainSizeWhenHidden = retainSize; } - Q_DECL_RELAXED_CONSTEXPR void transpose() { *this = transposed(); } + Q_DECL_RELAXED_CONSTEXPR void transpose() Q_DECL_NOTHROW { *this = transposed(); } #ifndef Q_QDOC QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT #endif @@ -179,11 +172,28 @@ private: friend Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); friend Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); #endif - QT_SIZEPOLICY_CONSTEXPR QSizePolicy(int i) : data(i) { } + QT_SIZEPOLICY_CONSTEXPR QSizePolicy(int i) Q_DECL_NOTHROW : data(i) { } struct Bits; QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) Q_DECL_NOTHROW : bits(b) { } - static quint32 toControlTypeFieldValue(ControlType type) Q_DECL_NOTHROW; + static Q_DECL_RELAXED_CONSTEXPR quint32 toControlTypeFieldValue(ControlType type) Q_DECL_NOTHROW + { + /* + The control type is a flag type, with values 0x1, 0x2, 0x4, 0x8, 0x10, + etc. In memory, we pack it onto the available bits (CTSize) in + setControlType(), and unpack it here. + + Example: + + 0x00000001 maps to 0 + 0x00000002 maps to 1 + 0x00000004 maps to 2 + 0x00000008 maps to 3 + etc. + */ + + return qCountTrailingZeroBits(static_cast<quint32>(type)); + } struct Bits { quint32 horStretch : 8; @@ -198,14 +208,14 @@ private: QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT Bits transposed() const Q_DECL_NOTHROW { - QT_SIZEPOLICY_RETURN_BITS(verStretch, // \ swap - horStretch, // / - verPolicy, // \ swap - horPolicy, // / - ctype, - hfw, // \ don't swap (historic behavior) - wfh, // / - retainSizeWhenHidden); + return {verStretch, // \ swap + horStretch, // / + verPolicy, // \ swap + horPolicy, // / + ctype, + hfw, // \ don't swap (historic behavior) + wfh, // / + retainSizeWhenHidden}; } }; union { @@ -216,6 +226,8 @@ private: #if QT_VERSION >= QT_VERSION_CHECK(6,0,0) // Can't add in Qt 5, as QList<QSizePolicy> would be BiC: Q_DECLARE_TYPEINFO(QSizePolicy, Q_PRIMITIVE_TYPE); +#else +Q_DECLARE_TYPEINFO(QSizePolicy, Q_RELOCATABLE_TYPE); #endif Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes) @@ -232,7 +244,6 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &); #undef QT_SIZEPOLICY_CONSTEXPR #undef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT -#undef QT_SIZEPOLICY_RETURN_BITS QT_END_NAMESPACE diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index cf9fbe2572..8a642940cd 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6386,6 +6386,24 @@ void QWidget::setWindowRole(const QString &role) \sa mouseMoveEvent() */ +/*! + \property QWidget::tabletTracking + \brief whether tablet tracking is enabled for the widget + \since 5.9 + + If tablet tracking is disabled (the default), the widget only + receives tablet move events when the stylus is in contact with + the tablet, or at least one stylus button is pressed, + while the stylus is being moved. + + If tablet tracking is enabled, the widget receives tablet move + events even while hovering in proximity. This is useful for + monitoring position as well as the auxiliary properties such + as rotation and tilt, and providing feedback in the UI. + + \sa tabletEvent() +*/ + /*! Sets the widget's focus proxy to widget \a w. If \a w is 0, the @@ -8787,6 +8805,9 @@ bool QWidget::event(QEvent *event) #endif #ifndef QT_NO_TABLETEVENT case QEvent::TabletMove: + if (static_cast<QTabletEvent *>(event)->buttons() == Qt::NoButton && !testAttribute(Qt::WA_TabletTracking)) + break; + Q_FALLTHROUGH(); case QEvent::TabletPress: case QEvent::TabletRelease: tabletEvent((QTabletEvent*)event); @@ -9019,6 +9040,7 @@ bool QWidget::event(QEvent *event) case QEvent::IconTextChange: case QEvent::ModifiedChange: case QEvent::MouseTrackingChange: + case QEvent::TabletTrackingChange: case QEvent::ParentChange: case QEvent::LocaleChange: case QEvent::MacSizeChange: @@ -9424,7 +9446,13 @@ void QWidget::wheelEvent(QWheelEvent *event) The default implementation ignores the event. - \sa QEvent::ignore(), QEvent::accept(), event(), + If tablet tracking is switched off, tablet move events only occur if the + stylus is in contact with the tablet, or at least one stylus button is + pressed, while the stylus is being moved. If tablet tracking is switched on, + tablet move events occur even while the stylus is hovering in proximity of + the tablet, with no buttons pressed. + + \sa QEvent::ignore(), QEvent::accept(), event(), setTabletTracking(), QTabletEvent */ @@ -11193,6 +11221,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) QEvent e(QEvent::MouseTrackingChange); QApplication::sendEvent(this, &e); break; } + case Qt::WA_TabletTracking: { + QEvent e(QEvent::TabletTrackingChange); + QApplication::sendEvent(this, &e); + break; } case Qt::WA_NativeWindow: { d->createTLExtra(); if (on) diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 4c80038a4f..1c378924a0 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -161,6 +161,7 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) #endif Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking) + Q_PROPERTY(bool tabletTracking READ hasTabletTracking WRITE setTabletTracking) Q_PROPERTY(bool isActiveWindow READ isActiveWindow) Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(bool focus READ hasFocus) @@ -328,6 +329,9 @@ public: bool hasMouseTracking() const; bool underMouse() const; + void setTabletTracking(bool enable); + bool hasTabletTracking() const; + void setMask(const QBitmap &); void setMask(const QRegion &); QRegion mask() const; @@ -809,6 +813,12 @@ inline bool QWidget::hasMouseTracking() const inline bool QWidget::underMouse() const { return testAttribute(Qt::WA_UnderMouse); } +inline void QWidget::setTabletTracking(bool enable) +{ setAttribute(Qt::WA_TabletTracking, enable); } + +inline bool QWidget::hasTabletTracking() const +{ return testAttribute(Qt::WA_TabletTracking); } + inline bool QWidget::updatesEnabled() const { return !testAttribute(Qt::WA_UpdatesDisabled); } diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 7295cc36f6..5abce140ce 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -973,22 +973,26 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long void QWidgetWindow::handleTabletEvent(QTabletEvent *event) { static QPointer<QWidget> qt_tablet_target = 0; - if (event->type() == QEvent::TabletPress) { - QWidget *widget = m_widget->childAt(event->pos()); - if (!widget) - widget = m_widget; - qt_tablet_target = widget; + QWidget *widget = qt_tablet_target; + + if (!widget) { + widget = m_widget->childAt(event->pos()); + if (event->type() == QEvent::TabletPress) { + if (!widget) + widget = m_widget; + qt_tablet_target = widget; + } } - if (qt_tablet_target) { + if (widget) { QPointF delta = event->globalPosF() - event->globalPos(); - QPointF mapped = qt_tablet_target->mapFromGlobal(event->globalPos()) + delta; + QPointF mapped = widget->mapFromGlobal(event->globalPos()) + delta; QTabletEvent ev(event->type(), mapped, event->globalPosF(), event->device(), event->pointerType(), event->pressure(), event->xTilt(), event->yTilt(), event->tangentialPressure(), event->rotation(), event->z(), event->modifiers(), event->uniqueId(), event->button(), event->buttons()); ev.setTimestamp(event->timestamp()); - QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); + QGuiApplication::sendSpontaneousEvent(widget, &ev); event->setAccepted(ev.isAccepted()); } diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index e72479fd09..a17c69c5ce 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -241,6 +241,14 @@ QWindow *QWindowContainer::containedWindow() const QWindowContainer::~QWindowContainer() { Q_D(QWindowContainer); + + // Call destroy() explicitly first. The dtor would do this too, but + // QEvent::PlatformSurface delivery relies on virtuals. Getting + // SurfaceAboutToBeDestroyed can be essential for OpenGL, Vulkan, etc. + // QWindow subclasses in particular. Keep these working. + if (d->window) + d->window->destroy(); + delete d->window; } diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index cc895e2c33..f884a1c279 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6669,12 +6669,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; } case CT_Menu: { - QStyleHintReturnMask menuMask; - QStyleOption myOption = *opt; - myOption.rect.setSize(sz); - if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) { - sz = menuMask.region.boundingRect().size(); - } + sz = csz; break; } case CT_HeaderSection:{ const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt); diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 9be19b2679..65894a6dde 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2607,9 +2607,10 @@ void QStyleSheetStyle::unsetPalette(QWidget *w) const bool useStyleSheetPropagationInWidgetStyles = QCoreApplication::testAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles); - if (styleSheetCaches->customPaletteWidgets.contains(w)) { - QPair<QPalette, uint> p = styleSheetCaches->customPaletteWidgets.value(w); - styleSheetCaches->customPaletteWidgets.remove(w); + const auto it = styleSheetCaches->customPaletteWidgets.find(w); + if (it != styleSheetCaches->customPaletteWidgets.end()) { + QPair<QPalette, uint> p = std::move(*it); + styleSheetCaches->customPaletteWidgets.erase(it); QPalette original = p.first; @@ -2649,9 +2650,10 @@ void QStyleSheetStyle::unsetPalette(QWidget *w) void QStyleSheetStyle::unsetStyleSheetFont(QWidget *w) const { - if (styleSheetCaches->customFontWidgets.contains(w)) { - QPair<QFont, uint> f = styleSheetCaches->customFontWidgets.value(w); - styleSheetCaches->customFontWidgets.remove(w); + const auto it = styleSheetCaches->customFontWidgets.find(w); + if (it != styleSheetCaches->customFontWidgets.end()) { + QPair<QFont, uint> f = std::move(*it); + styleSheetCaches->customFontWidgets.erase(it); QFont original = f.first; original.resolve(original.resolve() & f.second); diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h index b94dd170b4..93f3f4e0ec 100644 --- a/src/widgets/widgets/qbuttongroup_p.h +++ b/src/widgets/widgets/qbuttongroup_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index af3c2c29e2..e730eddd57 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2065,7 +2065,7 @@ void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent) const QDockAreaLayoutItem &item = item_list.at(i); if (item.flags & QDockAreaLayoutItem::GapItem) continue; - if (!item.widgetItem && item.skip()) + if (item.skip()) continue; if (item.subinfo) item.subinfo->reparentWidgets(parent); diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 28b97b2107..2928d51d20 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1021,6 +1021,12 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) } } +void QDockWidgetPrivate::recalculatePressPos(QResizeEvent *event) +{ + qreal ratio = event->oldSize().width() / (1.0 * event->size().width()); + state->pressPos.setX(state->pressPos.x() / ratio); +} + /*! \internal Called when the QDockWidget or the QDockWidgetGroupWindow is moved */ @@ -1537,6 +1543,13 @@ bool QDockWidget::event(QEvent *event) // if the mainwindow is plugging us, we don't want to update undocked geometry if (isFloating() && layout != 0 && layout->pluggingWidget != this) d->undockedGeometry = geometry(); + + // Usually the window won't get resized while it's being moved, but it can happen, + // for example on Windows when moving to a screen with bigger scale factor + // (and Qt::AA_EnableHighDpiScaling is enabled). If that happens we should + // update state->pressPos, otherwise it will be outside the window when the window shrinks. + if (d->state && d->state->dragging) + d->recalculatePressPos(static_cast<QResizeEvent*>(event)); break; default: break; diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h index 94a3ad3b34..84bf8efacf 100644 --- a/src/widgets/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -118,6 +118,7 @@ public: void startDrag(bool group = true); void endDrag(bool abort = false); void moveEvent(QMoveEvent *event); + void recalculatePressPos(QResizeEvent *event); void unplug(const QRect &rect); void plug(const QRect &rect); diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 4f94f6e654..63b6bcfaef 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2100,10 +2100,8 @@ void QMainWindowLayout::animationFinished(QWidget *widget) } if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) { - if (currentHoveredFloat) { - dw->setParent(currentHoveredFloat); - dw->show(); - } + dw->setParent(currentHoveredFloat ? currentHoveredFloat.data() : parentWidget()); + dw->show(); dw->d_func()->plug(currentGapRect); } #endif @@ -2278,7 +2276,8 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) // We are unplugging a dock widget from a floating window. if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) { dw->d_func()->unplug(widget->geometry()); - return 0; + int index = widget->parentWidget()->layout()->indexOf(widget); + return widget->parentWidget()->layout()->itemAt(index); } } } diff --git a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro index 3af207ae5a..fd8fd0a74a 100644 --- a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro +++ b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro @@ -3,3 +3,6 @@ TARGET = tst_qtconcurrentmap QT = core testlib concurrent SOURCES = tst_qtconcurrentmap.cpp DEFINES += QT_STRICT_ITERATORS + +# Force C++17 if available +contains(QT_CONFIG, c++1z): CONFIG += c++1z diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index 25ac952396..96656a6dff 100644 --- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -48,6 +48,7 @@ private slots: void blocking_mappedReduced(); void assignResult(); void functionOverloads(); + void noExceptFunctionOverloads(); #ifndef QT_NO_EXCEPTIONS void exceptions(); #endif @@ -2025,6 +2026,16 @@ int fn(int &i) return i; } +int fnConstNoExcept(const int &i) Q_DECL_NOTHROW +{ + return i; +} + +int fnNoExcept(int &i) Q_DECL_NOTHROW +{ + return i; +} + QString changeTypeConst(const int &) { return QString(); @@ -2035,6 +2046,16 @@ QString changeType(int &) return QString(); } +QString changeTypeConstNoExcept(const int &) Q_DECL_NOTHROW +{ + return QString(); +} + +QString changeTypeNoExcept(int &) Q_DECL_NOTHROW +{ + return QString(); +} + int changeTypeQStringListConst(const QStringList &) { return 0; @@ -2045,6 +2066,16 @@ int changeTypeQStringList(QStringList &) return 0; } +int changeTypeQStringListConstNoExcept(const QStringList &) Q_DECL_NOTHROW +{ + return 0; +} + +int changeTypeQStringListNoExcept(QStringList &) Q_DECL_NOTHROW +{ + return 0; +} + class MemFnTester { public: @@ -2069,6 +2100,26 @@ public: { return QString(); } + + MemFnTester fnNoExcept() Q_DECL_NOTHROW + { + return MemFnTester(); + } + + MemFnTester fnConstNoExcept() const Q_DECL_NOTHROW + { + return MemFnTester(); + } + + QString changeTypeNoExcept() Q_DECL_NOTHROW + { + return QString(); + } + + QString changeTypeConstNoExcept() const Q_DECL_NOTHROW + { + return QString(); + } }; Q_DECLARE_METATYPE(QVector<MemFnTester>); @@ -2097,6 +2148,29 @@ void tst_QtConcurrentMap::functionOverloads() QtConcurrent::blockingMapped<QList<QString> >(constMemFnTesterList, &MemFnTester::changeTypeConst); } +void tst_QtConcurrentMap::noExceptFunctionOverloads() +{ + QList<int> intList; + const QList<int> constIntList; + QList<MemFnTester> classList; + const QList<MemFnTester> constMemFnTesterList; + + QtConcurrent::mapped(intList, fnConstNoExcept); + QtConcurrent::mapped(constIntList, fnConstNoExcept); + QtConcurrent::mapped(classList, &MemFnTester::fnConstNoExcept); + QtConcurrent::mapped(constMemFnTesterList, &MemFnTester::fnConstNoExcept); + + QtConcurrent::blockingMapped<QVector<int> >(intList, fnConstNoExcept); + QtConcurrent::blockingMapped<QVector<int> >(constIntList, fnConstNoExcept); + QtConcurrent::blockingMapped<QVector<MemFnTester> >(classList, &MemFnTester::fnConstNoExcept); + QtConcurrent::blockingMapped<QVector<MemFnTester> >(constMemFnTesterList, &MemFnTester::fnConstNoExcept); + + QtConcurrent::blockingMapped<QList<QString> >(intList, changeTypeConstNoExcept); + QtConcurrent::blockingMapped<QList<QString> >(constIntList, changeTypeConstNoExcept); + QtConcurrent::blockingMapped<QList<QString> >(classList, &MemFnTester::changeTypeConstNoExcept); + QtConcurrent::blockingMapped<QList<QString> >(constMemFnTesterList, &MemFnTester::changeTypeConstNoExcept); +} + QAtomicInt currentInstanceCount; QAtomicInt peakInstanceCount; class InstanceCounter diff --git a/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro index f60462f9ed..44891b7ba5 100644 --- a/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro +++ b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro @@ -2,3 +2,6 @@ CONFIG += testcase TARGET = tst_qtconcurrentrun QT = core testlib concurrent SOURCES = tst_qtconcurrentrun.cpp + +# Force C++17 if available +contains(QT_CONFIG, c++1z): CONFIG += c++1z diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp index bd53aa69fe..4e3668d72e 100644 --- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -123,6 +123,28 @@ public: int operator()(int in) const { return in; } }; +class ANoExcept +{ +public: + int member0() Q_DECL_NOTHROW { return 10; } + int member1(int in) Q_DECL_NOTHROW { return in; } + + typedef int result_type; + int operator()() Q_DECL_NOTHROW { return 10; } + int operator()(int in) Q_DECL_NOTHROW { return in; } +}; + +class AConstNoExcept +{ +public: + int member0() const Q_DECL_NOTHROW { return 10; } + int member1(int in) const Q_DECL_NOTHROW { return in; } + + typedef int result_type; + int operator()() const Q_DECL_NOTHROW { return 10; } + int operator()(int in) const Q_DECL_NOTHROW { return in; } +}; + void tst_QtConcurrentRun::returnValue() { QThreadPool pool; @@ -214,6 +236,88 @@ void tst_QtConcurrentRun::returnValue() QCOMPARE(f.result(), 20); f = run(&pool, &aConst, 20); QCOMPARE(f.result(), 20); + + ANoExcept aNoExcept; + f = run(&aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, &aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(&aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, aNoExcept); + QCOMPARE(f.result(), 10); + + f = run(&aNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, &aNoExcept); + QCOMPARE(f.result(), 10); + + f = run(aNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aNoExcept, 20); + QCOMPARE(f.result(), 20); + + f = run(&aNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aNoExcept, 20); + QCOMPARE(f.result(), 20); + + const AConstNoExcept aConstNoExcept = AConstNoExcept(); + f = run(&aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, &aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(&aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aConstNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, aConstNoExcept); + QCOMPARE(f.result(), 10); + + f = run(&aConstNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, &aConstNoExcept); + QCOMPARE(f.result(), 10); + + f = run(aConstNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aConstNoExcept, 20); + QCOMPARE(f.result(), 20); + + f = run(&aConstNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aConstNoExcept, 20); + QCOMPARE(f.result(), 20); } struct TestClass diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 49ee8eb32c..b64de488ed 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -353,7 +353,7 @@ void tst_QDir::mkdir_data() << QDir::currentPath() + "/testdir/two/three"; QTest::newRow("data0") << dirs.at(0) << true; QTest::newRow("data1") << dirs.at(1) << false; - QTest::newRow("data2") << dirs.at(2) << false; + QTest::newRow("data2") << dirs.at(2) << false; // note: requires data1 to have been run! // Ensure that none of these directories already exist QDir dir; diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 71a0c943d2..e1a999abfb 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -46,6 +46,7 @@ class tst_QUrl : public QObject Q_OBJECT private slots: + void initTestCase(); void effectiveTLDs_data(); void effectiveTLDs(); void getSetCheck(); @@ -182,8 +183,15 @@ private slots: private: void testThreadingHelper(); + + QTemporaryDir m_tempDir; }; +void tst_QUrl::initTestCase() +{ + QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString())); +} + // Testing get/set functions void tst_QUrl::getSetCheck() { @@ -3045,49 +3053,59 @@ void tst_QUrl::fromUserInputWithCwd_data() // Null QTest::newRow("null") << QString() << QString() << QUrl() << QUrl(); - // Existing file - QDirIterator it(QDir::currentPath(), QDir::NoDotDot | QDir::AllEntries); - int c = 0; - while (it.hasNext()) { - it.next(); - QUrl url = QUrl::fromLocalFile(it.filePath()); - if (it.fileName() == QLatin1String(".")) { - url = QUrl::fromLocalFile(QDir::currentPath() + // Use a tempdir with files, for testing specific file names + // We use canonicalPath() on the dir path because ::getcwd() canonicalizes, + // so we get a canonical base path for URLs with "." as working directory. + const QString base = QDir(m_tempDir.path()).canonicalPath(); + QDir::setCurrent(base); // for the tests that use "." as working dir + + // "." + { + const QUrl url = QUrl::fromLocalFile(base #ifdef Q_OS_WINRT + QLatin1Char('/') #endif ); // fromUserInput cleans the path - } - QTest::newRow(("file-" + QByteArray::number(c)).constData()) - << it.fileName() << QDir::currentPath() << url << url; - QTest::newRow(("file-" + QByteArray::number(c) + "-dot").constData()) - << it.fileName() << QStringLiteral(".") << url << url; - ++c; + QTest::newRow("dot-in-path") << "." << base << url << url; + QTest::newRow("dot-in-dot") << "." << QStringLiteral(".") << url << url; + } + + // Existing files + for (const char *fileName : {"file.txt", "file#a.txt", "file .txt", "file.txt "}) { + const QString filePath = base + '/' + fileName; + QFile file(filePath); + QVERIFY2(file.open(QIODevice::WriteOnly), qPrintable(filePath)); + file.write("Hello world\n"); + + const QUrl url = QUrl::fromLocalFile(filePath); + QTest::newRow(fileName) << fileName << base << url << url; + QTest::newRow(QByteArray(fileName) + "-in-dot") << fileName << QStringLiteral(".") << url << url; } + #ifndef Q_OS_WINRT // WinRT cannot cd outside current / sandbox - QDir parent = QDir::current(); + QDir parent(base); QVERIFY(parent.cdUp()); QUrl parentUrl = QUrl::fromLocalFile(parent.path()); - QTest::newRow("dotdot") << ".." << QDir::currentPath() << parentUrl << parentUrl; + QTest::newRow("dotdot") << ".." << base << parentUrl << parentUrl; #endif - QTest::newRow("nonexisting") << "nonexisting" << QDir::currentPath() << QUrl("http://nonexisting") << QUrl::fromLocalFile(QDir::currentPath() + "/nonexisting"); - QTest::newRow("short-url") << "example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl::fromLocalFile(QDir::currentPath() + "/example.org"); - QTest::newRow("full-url") << "http://example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl("http://example.org"); - QTest::newRow("absolute") << "/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///doesnotexist.txt") << QUrl("file:///doesnotexist.txt"); + QTest::newRow("nonexisting") << "nonexisting" << base << QUrl("http://nonexisting") << QUrl::fromLocalFile(base + "/nonexisting"); + QTest::newRow("short-url") << "example.org" << base << QUrl("http://example.org") << QUrl::fromLocalFile(base + "/example.org"); + QTest::newRow("full-url") << "http://example.org" << base << QUrl("http://example.org") << QUrl("http://example.org"); + QTest::newRow("absolute") << "/doesnotexist.txt" << base << QUrl("file:///doesnotexist.txt") << QUrl("file:///doesnotexist.txt"); #ifdef Q_OS_WIN - QTest::newRow("windows-absolute") << "c:/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///c:/doesnotexist.txt") << QUrl("file:///c:/doesnotexist.txt"); + QTest::newRow("windows-absolute") << "c:/doesnotexist.txt" << base << QUrl("file:///c:/doesnotexist.txt") << QUrl("file:///c:/doesnotexist.txt"); #endif // IPv4 & IPv6 // same as fromUserInput, but needs retesting - QTest::newRow("ipv4-1") << "127.0.0.1" << QDir::currentPath() << QUrl("http://127.0.0.1") << QUrl::fromLocalFile(QDir::currentPath() + "/127.0.0.1"); - QTest::newRow("ipv6-0") << "::" << QDir::currentPath() << QUrl("http://[::]") << QUrl("http://[::]"); - QTest::newRow("ipv6-1") << "::1" << QDir::currentPath() << QUrl("http://[::1]") << QUrl("http://[::1]"); - QTest::newRow("ipv6-2") << "1::1" << QDir::currentPath() << QUrl("http://[1::1]") << QUrl("http://[1::1]"); - QTest::newRow("ipv6-3") << "1::" << QDir::currentPath() << QUrl("http://[1::]") << QUrl("http://[1::]"); - QTest::newRow("ipv6-4") << "c::" << QDir::currentPath() << QUrl("http://[c::]") << QUrl("http://[c::]"); - QTest::newRow("ipv6-5") << "c:f00:ba4::" << QDir::currentPath() << QUrl("http://[c:f00:ba4::]") << QUrl("http://[c:f00:ba4::]"); + QTest::newRow("ipv4-1") << "127.0.0.1" << base << QUrl("http://127.0.0.1") << QUrl::fromLocalFile(base + "/127.0.0.1"); + QTest::newRow("ipv6-0") << "::" << base << QUrl("http://[::]") << QUrl("http://[::]"); + QTest::newRow("ipv6-1") << "::1" << base << QUrl("http://[::1]") << QUrl("http://[::1]"); + QTest::newRow("ipv6-2") << "1::1" << base << QUrl("http://[1::1]") << QUrl("http://[1::1]"); + QTest::newRow("ipv6-3") << "1::" << base << QUrl("http://[1::]") << QUrl("http://[1::]"); + QTest::newRow("ipv6-4") << "c::" << base << QUrl("http://[c::]") << QUrl("http://[c::]"); + QTest::newRow("ipv6-5") << "c:f00:ba4::" << base << QUrl("http://[c:f00:ba4::]") << QUrl("http://[c:f00:ba4::]"); } void tst_QUrl::fromUserInputWithCwd() diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 8058d3c897..2edb94d542 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -307,6 +307,7 @@ void tst_QMimeDatabase::mimeTypesForFileName_data() QTest::newRow("txtfoobar, 0 hit") << "foo.foobar" << QStringList(); QTest::newRow("m, 2 hits") << "foo.m" << (QStringList() << "text/x-matlab" << "text/x-objcsrc"); QTest::newRow("sub, 3 hits") << "foo.sub" << (QStringList() << "text/x-microdvd" << "text/x-mpsub" << "text/x-subviewer"); + QTest::newRow("non_ascii") << QString::fromUtf8("AİİA.pdf") << (QStringList() << "application/pdf"); } void tst_QMimeDatabase::mimeTypesForFileName() diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro index 132f01092a..44ef12db29 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro @@ -7,6 +7,8 @@ TARGET = $$qtLibraryTarget(plugin1) DESTDIR = ../bin winrt:include(../winrt.pri) +!qtConfig(library): DEFINES += QT_STATICPLUGIN + # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin INSTALLS += target diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro index b47ed91535..5689919108 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro @@ -7,6 +7,8 @@ TARGET = $$qtLibraryTarget(plugin2) DESTDIR = ../bin winrt:include(../winrt.pri) +!qtConfig(library): DEFINES += QT_STATICPLUGIN + # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin INSTALLS += target diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index 0e189ba7aa..f88eac1a9f 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -1033,7 +1033,8 @@ void tst_QDate::fromStringFormat_data() QTest::addColumn<QString>("format"); QTest::addColumn<QDate>("expected"); - //get localized names + // Undo this (inline the C-locale versions) for ### Qt 6 + // Get localized names: QString january = QDate::longMonthName(1); QString february = QDate::longMonthName(2); QString march = QDate::longMonthName(3); diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index b81f3d356d..5eec44dffd 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -31,6 +31,9 @@ #include <time.h> #include <qdatetime.h> #include <private/qdatetime_p.h> +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +# include <locale.h> +#endif #ifdef Q_OS_WIN # include <qt_windows.h> @@ -185,6 +188,14 @@ Q_DECLARE_METATYPE(Qt::DateFormat) tst_QDateTime::tst_QDateTime() { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + // Some tests depend on C locale - BF&I it with belt *and* braces: + qputenv("LC_ALL", "C"); + setlocale(LC_ALL, "C"); + // Need to do this as early as possible, before anything accesses the + // QSystemLocale singleton; once it exists, there's no changing it. +#endif // remove for ### Qt 6 + /* Due to some jurisdictions changing their zones and rules, it's possible for a non-CET zone to accidentally match CET at a few tested moments but @@ -2332,13 +2343,6 @@ void tst_QDateTime::fromStringStringFormat_data() QTest::addColumn<QString>("format"); QTest::addColumn<QDateTime>("expected"); - QString january = QDate::longMonthName(1); - QString oct = QDate::shortMonthName(10); - QString december = QDate::longMonthName(12); - QString thu = QDate::shortDayName(4); - QString fri = QDate::shortDayName(5); - QString date = "10 " + oct + " 10"; - QTest::newRow("data0") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data1") << QString("1020") << QString("sss") << invalidDateTime(); QTest::newRow("data2") << QString("1010") << QString("sss") << QDateTime(defDate(), QTime(0, 0, 10)); @@ -2349,16 +2353,14 @@ void tst_QDateTime::fromStringStringFormat_data() QTest::newRow("data7") << QString("foo") << QString("ap") << invalidDateTime(); // Day non-conflict should not hide earlier year conflict (1963-03-01 was a // Friday; asking for Thursday moves this, without conflict, to the 7th): - QTest::newRow("data8") << QString("77 03 1963 " + thu) << QString("yy MM yyyy ddd") << invalidDateTime(); + QTest::newRow("data8") << QString("77 03 1963 Thu") << QString("yy MM yyyy ddd") << invalidDateTime(); QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); - QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime()); - date = fri + QLatin1Char(' ') + december + " 3 2004"; - QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime()); + QTest::newRow("data11") << QString("10 Oct 10") << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime()); + QTest::newRow("data12") << QString("Fri December 3 2004") << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime()); QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime(); - date = thu + QLatin1Char(' ') + january + " 2004"; - QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); + QTest::newRow("data15") << QString("Thu January 2004") << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z") << QString("yyyy-MM-ddThh:mm:ss.zZ") << QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1)); diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index 059e1e519b..71bf39fc4e 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp @@ -28,10 +28,26 @@ #include <QtTest/QtTest> #include "qdatetime.h" +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +# include <locale.h> +#endif class tst_QTime : public QObject { Q_OBJECT + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +public: + tst_QTime() + { + // Some tests depend on C locale - BF&I it with belt *and* braces: + qputenv("LC_ALL", "C"); + setlocale(LC_ALL, "C"); + // Need to instantiate as early as possible, before anything accesses + // the QSystemLocale singleton; once it exists, there's no changing it. + } +#endif // remove for ### Qt 6 + private slots: void msecsTo_data(); void msecsTo(); diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index abb5b50229..c1f2822b74 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -346,6 +346,7 @@ void tst_QTimeZone::isTimeZoneIdAvailable() foreach (const QByteArray &id, available) QVERIFY(QTimeZone::isTimeZoneIdAvailable(id)); +#ifdef QT_BUILD_INTERNAL // a-z, A-Z, 0-9, '.', '-', '_' are valid chars // Can't start with '-' // Parts separated by '/', each part min 1 and max of 14 chars @@ -368,6 +369,7 @@ void tst_QTimeZone::isTimeZoneIdAvailable() QCOMPARE(QTimeZonePrivate::isValidId("123456789012345"), false); QCOMPARE(QTimeZonePrivate::isValidId("123456789012345/12345678901234"), false); QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/123456789012345"), false); +#endif // QT_BUILD_INTERNAL } void tst_QTimeZone::transitionEachZone_data() diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 280305ddd8..3971353cbb 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -75,8 +75,21 @@ struct Foo void tst_QVarLengthArray::append() { - QVarLengthArray<QString> v; - v.append(QString("hello")); + QVarLengthArray<QString, 2> v; + v.append(QString("1")); + v.append(v.front()); + QCOMPARE(v.capacity(), 2); + // transition from prealloc to heap: + v.append(v.front()); + QVERIFY(v.capacity() > 2); + QCOMPARE(v.front(), v.back()); + while (v.size() < v.capacity()) + v.push_back(v[0]); + QCOMPARE(v.back(), v.front()); + QCOMPARE(v.size(), v.capacity()); + // transition from heap to larger heap: + v.push_back(v.front()); + QCOMPARE(v.back(), v.front()); QVarLengthArray<int> v2; // rocket! v2.append(5); diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp index 71ee980de1..b8afd6a447 100644 --- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp @@ -60,6 +60,7 @@ private slots: void setFont(); void setFont_collection_data(); void setFont_collection(); + void clearCollection(); }; /*! \internal @@ -640,5 +641,32 @@ void tst_QTextFormat::setFont_collection() } } +void tst_QTextFormat::clearCollection() +{ + QTextFormatCollection collection; + QFont f; + f.setUnderline(true); + collection.setDefaultFont(f); + QTextCharFormat charFormat; + charFormat.setFontStyleHint(QFont::SansSerif); + int formatIndex = collection.indexForFormat(charFormat); + QCOMPARE(formatIndex, 0); + QTextCharFormat charFormat2; + charFormat2.setUnderlineStyle(QTextCharFormat::SingleUnderline); + int formatIndex2 = collection.indexForFormat(charFormat2); + QCOMPARE(formatIndex2, 1); + QCOMPARE(collection.formats.count(), 2); + QCOMPARE(collection.hashes.count(), 2); + QCOMPARE(collection.defaultFont(), f); + + collection.clear(); + QCOMPARE(collection.formats.count(), 0); + QCOMPARE(collection.hashes.count(), 0); + QCOMPARE(collection.indexForFormat(charFormat2), 0); + QCOMPARE(collection.formats.count(), 1); + QCOMPARE(collection.hashes.count(), 1); + QCOMPARE(collection.defaultFont(), f); // kept, QTextDocument::clear or setPlainText should not reset the font set by setDefaultFont +} + QTEST_MAIN(tst_QTextFormat) #include "tst_qtextformat.moc" diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index f19ce4ac75..4dcce8509c 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -8194,22 +8194,22 @@ struct SameOriginRedirector : MiniHttpServer void tst_QNetworkReply::ioHttpRedirectPolicy_data() { - QTest::addColumn<QNetworkRequest::RedirectsPolicy>("policy"); + QTest::addColumn<QNetworkRequest::RedirectPolicy>("policy"); QTest::addColumn<bool>("ssl"); QTest::addColumn<int>("redirectCount"); QTest::addColumn<int>("statusCode"); - QTest::newRow("manual-nossl") << QNetworkRequest::ManualRedirectsPolicy << false << 0 << 307; - QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectsPolicy << true << 0 << 307; - QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectsPolicy << false << 1 << 200; - QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectsPolicy << true << 1 << 200; - QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectsPolicy << false << 1 << 200; - QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectsPolicy << true << 1 << 200; + QTest::newRow("manual-nossl") << QNetworkRequest::ManualRedirectPolicy << false << 0 << 307; + QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; + QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200; + QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; + QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200; + QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200; } void tst_QNetworkReply::ioHttpRedirectPolicy() { - QFETCH(const QNetworkRequest::RedirectsPolicy, policy); + QFETCH(const QNetworkRequest::RedirectPolicy, policy); QFETCH(const bool, ssl); #ifdef QT_NO_SSL @@ -8234,16 +8234,16 @@ void tst_QNetworkReply::ioHttpRedirectPolicy() redirectServer.responses.push_back(tempRedirectReplyStr().arg(QString(url.toEncoded())).toLatin1()); // This is the default one we preserve between tests. - QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy); + QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy); - manager.setRedirectsPolicy(policy); - QCOMPARE(manager.redirectsPolicy(), policy); + manager.setRedirectPolicy(policy); + QCOMPARE(manager.redirectPolicy(), policy); QNetworkReplyPtr reply(manager.get(QNetworkRequest(url))); if (ssl) reply->ignoreSslErrors(); // Restore default: - manager.setRedirectsPolicy(QNetworkRequest::ManualRedirectsPolicy); + manager.setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy); QSignalSpy redirectSpy(reply.data(), SIGNAL(redirected(QUrl))); QSignalSpy finishedSpy(reply.data(), SIGNAL(finished())); QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); @@ -8254,43 +8254,43 @@ void tst_QNetworkReply::ioHttpRedirectPolicy() void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() { - QTest::addColumn<QNetworkRequest::RedirectsPolicy>("policy"); + QTest::addColumn<QNetworkRequest::RedirectPolicy>("policy"); QTest::addColumn<bool>("ssl"); QTest::addColumn<QString>("location"); QTest::addColumn<int>("maxRedirects"); QTest::addColumn<QNetworkReply::NetworkError>("expectedError"); // 1. NoLessSafeRedirectsPolicy - QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectsPolicy + QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; - QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectsPolicy + QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; - QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectsPolicy + QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; // 2. SameOriginRedirectsPolicy - QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; - QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; - QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; - QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; - QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; - QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; - QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; - QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectsPolicy + QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; } void tst_QNetworkReply::ioHttpRedirectPolicyErrors() { - QFETCH(const QNetworkRequest::RedirectsPolicy, policy); + QFETCH(const QNetworkRequest::RedirectPolicy, policy); // This should never happen: - QVERIFY(policy != QNetworkRequest::ManualRedirectsPolicy); + QVERIFY(policy != QNetworkRequest::ManualRedirectPolicy); QFETCH(const bool, ssl); QFETCH(const QString, location); @@ -8317,13 +8317,13 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors() request.setMaximumRedirectsAllowed(maxRedirects); // We always reset the policy to the default one ('Manual') after any related // test is finished: - QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy); - manager.setRedirectsPolicy(policy); - QCOMPARE(manager.redirectsPolicy(), policy); + QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy); + manager.setRedirectPolicy(policy); + QCOMPARE(manager.redirectPolicy(), policy); QNetworkReplyPtr reply(manager.get(request)); // Set it back to default: - manager.setRedirectsPolicy(QNetworkRequest::ManualRedirectsPolicy); + manager.setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy); if (ssl) reply->ignoreSslErrors(); @@ -8358,9 +8358,9 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect() redirectServer.setDataToTransmit(tempRedirectReplyStr().arg(QString(url.toEncoded())).toLatin1()); url.setPort(redirectServer.serverPort()); - QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy); - manager.setRedirectsPolicy(QNetworkRequest::UserVerifiedRedirectsPolicy); - QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::UserVerifiedRedirectsPolicy); + QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy); + manager.setRedirectPolicy(QNetworkRequest::UserVerifiedRedirectPolicy); + QCOMPARE(manager.redirectPolicy(), QNetworkRequest::UserVerifiedRedirectPolicy); QNetworkReplyPtr reply(manager.get(QNetworkRequest(url))); reply->connect(reply.data(), &QNetworkReply::redirected, @@ -8376,8 +8376,8 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect() }); // Before any test failed, reset the policy to default: - manager.setRedirectsPolicy(QNetworkRequest::ManualRedirectsPolicy); - QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy); + manager.setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy); + QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy); QSignalSpy finishedSpy(reply.data(), SIGNAL(finished())); waitForFinish(reply); diff --git a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp index 3295580432..5eedd1043b 100644 --- a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp +++ b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage diff --git a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp index cf15e60531..89a1430948 100644 --- a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp +++ b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 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$ ** diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp index ddf503eed6..60add4a51c 100644 --- a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp +++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp @@ -1,11 +1,11 @@ /**************************************************************************** ** ** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $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 @@ -14,24 +14,13 @@ ** 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 +** 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-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro index 5c92ca833a..4ccf0f24b0 100644 --- a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro +++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro @@ -14,12 +14,6 @@ win32 { } } -# OpenSSL support -qtConfig(openssl)|qtConfig(openssl-linked) { - # Add optional SSL libs - LIBS += $$OPENSSL_LIBS -} - DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(qtConfig(private_tests)) diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp index 4ae1f02ce2..d50f46cc16 100644 --- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp +++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp @@ -114,7 +114,10 @@ void tst_QSizePolicy::constExpr() { Q_CONSTEXPR QSizePolicy sp; Q_UNUSED(sp); } { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(); Q_UNUSED(sp); } { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); Q_UNUSED(sp); } - { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType); Q_UNUSED(sp); } + { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType); + Q_CONSTEXPR QSizePolicy tp = sp.transposed(); Q_UNUSED(tp); } + { Q_RELAXED_CONSTEXPR auto sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::CheckBox); + Q_RELAXED_CONSTEXPR auto tp = sp.transposed(); Q_UNUSED(tp); } #else QSKIP("QSizePolicy cannot be constexpr with this version of the compiler."); #endif diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 2657b28d30..7afa7ca42b 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -407,6 +407,8 @@ private slots: void testForOutsideWSRangeFlag(); + void tabletTracking(); + private: bool ensureScreenSize(int width, int height); @@ -10529,5 +10531,109 @@ void tst_QWidget::testForOutsideWSRangeFlag() } } +class TabletWidget : public QWidget +{ +public: + TabletWidget(QWidget *parent) : QWidget(parent) { } + + int tabletEventCount = 0; + int pressEventCount = 0; + int moveEventCount = 0; + int releaseEventCount = 0; + int trackingChangeEventCount = 0; + qint64 uid = -1; + +protected: + void tabletEvent(QTabletEvent *event) override { + ++tabletEventCount; + uid = event->uniqueId(); + switch (event->type()) { + case QEvent::TabletMove: + ++moveEventCount; + break; + case QEvent::TabletPress: + ++pressEventCount; + break; + case QEvent::TabletRelease: + ++releaseEventCount; + break; + default: + break; + } + } + + bool event(QEvent *ev) override { + if (ev->type() == QEvent::TabletTrackingChange) + ++trackingChangeEventCount; + return QWidget::event(ev); + } +}; + +void tst_QWidget::tabletTracking() +{ + QWidget parent; + parent.resize(200,200); + // QWidgetWindow::handleTabletEvent doesn't deliver tablet events to the window's widget, only to a child. + // So it doesn't do any good to show a TabletWidget directly: it needs a parent. + TabletWidget widget(&parent); + widget.resize(200,200); + parent.showNormal(); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); + widget.setAttribute(Qt::WA_TabletTracking); + QTRY_COMPARE(widget.trackingChangeEventCount, 1); + QVERIFY(widget.hasTabletTracking()); + + QWindow *window = parent.windowHandle(); + QPointF local(10, 10); + QPointF global = window->mapToGlobal(local.toPoint()); + QPointF deviceLocal = QHighDpi::toNativeLocalPosition(local, window); + QPointF deviceGlobal = QHighDpi::toNativePixels(global, window->screen()); + qint64 uid = 1234UL; + + QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal, + QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.moveEventCount, 1); + QCOMPARE(widget.uid, uid); + + local += QPoint(10, 10); + deviceLocal += QPoint(10, 10); + deviceGlobal += QPoint(10, 10); + QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal, + QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.moveEventCount, 2); + + widget.setTabletTracking(false); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.trackingChangeEventCount, 2); + + QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal, + QTabletEvent::Stylus, QTabletEvent::Pen, Qt::LeftButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.pressEventCount, 1); + + local += QPoint(10, 10); + deviceLocal += QPoint(10, 10); + deviceGlobal += QPoint(10, 10); + QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal, + QTabletEvent::Stylus, QTabletEvent::Pen, Qt::LeftButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.moveEventCount, 3); + + QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal, + QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.releaseEventCount, 1); + + local += QPoint(10, 10); + deviceLocal += QPoint(10, 10); + deviceGlobal += QPoint(10, 10); + QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal, + QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier); + QCoreApplication::processEvents(); + QTRY_COMPARE(widget.moveEventCount, 3); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index 5e3868ea8f..6ec1b754d0 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -37,6 +37,7 @@ #include <qmainwindow.h> #include <qscreen.h> #include <qscopedpointer.h> +#include <qevent.h> class Window : public QWindow @@ -77,6 +78,7 @@ private slots: void testAncestorChange(); void testDockWidget(); void testNativeContainerParent(); + void testPlatformSurfaceEvent(); void cleanup(); private: @@ -343,6 +345,41 @@ void tst_QWindowContainer::testNativeContainerParent() QTRY_COMPARE(window->parent(), container->windowHandle()); } +class EventWindow : public QWindow +{ +public: + EventWindow(bool *surfaceDestroyFlag) : m_surfaceDestroyFlag(surfaceDestroyFlag) { } + bool event(QEvent *e) override; + +private: + bool *m_surfaceDestroyFlag; +}; + +bool EventWindow::event(QEvent *e) +{ + if (e->type() == QEvent::PlatformSurface) { + if (static_cast<QPlatformSurfaceEvent *>(e)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) + *m_surfaceDestroyFlag = true; + } + return QWindow::event(e); +} + +void tst_QWindowContainer::testPlatformSurfaceEvent() +{ + // Verify that SurfaceAboutToBeDestroyed is delivered and the + // window subclass still gets a chance to process it. + + bool ok = false; + QPointer<EventWindow> window(new EventWindow(&ok)); + window->create(); + QWidget *container = QWidget::createWindowContainer(window); + + delete container; + + QCOMPARE(window.data(), nullptr); + QVERIFY(ok); +} + QTEST_MAIN(tst_QWindowContainer) #include "tst_qwindowcontainer.moc" diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm index 4645de4d7a..af93c18712 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 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$ ** diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 8367994509..a93a003dff 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -54,7 +54,7 @@ dialogs \ windowtransparency \ unc -!qtConfig(openssl):!qtConfig(openssl-linked): SUBDIRS -= qssloptions +!qtConfig(openssl): SUBDIRS -= qssloptions qtConfig(opengl) { SUBDIRS += qopengltextureblitter |