From 2634ba5b4da5e315f4b0d396d8f8ab3cc48d9c8e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 19 Dec 2018 18:18:24 +0100 Subject: [PATCH 1/9] qmake: don't mess up linking order of frameworks make it "last one wins", consistently with regular libraries. this isn't really relevant in qmake, because the order matters only for static frameworks, which qmake defines out of existence. note that specifying frameworks by full path does not work, so we don't need to amend 9d76beee5 in that regard. Change-Id: Ib027109339e1b5973c577d69906b6daf83ba9611 Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 4cbe06d9dc..7f42fbe09e 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -506,17 +506,14 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) if (opt.startsWith("-Xarch")) opt = l.at(++lit); // The user has done the right thing and prefixed each part } - bool found = false; for(int x = 0; x < lflags[arch].size(); ++x) { if (lflags[arch].at(x) == "-framework" && lflags[arch].at(++x) == opt) { - found = true; + lflags[arch].remove(x - 1, 2); break; } } - if(!found) { - lflags[arch].append("-framework"); - lflags[arch].append(opt); - } + lflags[arch].append("-framework"); + lflags[arch].append(opt); } else { lflags[arch].append(opt); } From 44b91a619d14932635e9a3fe155de4df9f98a25c Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 14 Feb 2019 04:06:27 +1000 Subject: [PATCH 2/9] wasm: fix building examples and applications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a bug where app build would fail with AssertionError: SIMD is used, but not supported in WASM mode yet Change-Id: I27d5eb00b2c869b890dc519a7a793b7f87aeb9d2 Fixes: QTBUG-73795 Reviewed-by: Morten Johan Sørvig --- src/3rdparty/freetype/src/sfnt/pngshim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/freetype/src/sfnt/pngshim.c b/src/3rdparty/freetype/src/sfnt/pngshim.c index 16020266af..cd110776c8 100644 --- a/src/3rdparty/freetype/src/sfnt/pngshim.c +++ b/src/3rdparty/freetype/src/sfnt/pngshim.c @@ -68,6 +68,7 @@ ( ( __clang_major__ >= 4 ) || \ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ defined( __OPTIMIZE__ ) && \ + !defined( __EMSCRIPTEN__ ) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __clang__ From feb5fdd0cfe63252437b20296ccc2b982a85c6dc Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 12 Feb 2019 14:14:16 +0100 Subject: [PATCH 3/9] Fix OpenGL ES2 build on Linux The feature detection in QOpenGL test project file needed adjustment. This amends commit dd988e20. Change-Id: I7efaaec9fbf564be4033e99a8554dbe51322f494 Fixes: QTBUG-73592 Reviewed-by: Gatis Paeglis --- tests/auto/gui/qopengl/qopengl.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro index d744d37280..722c99ee0b 100644 --- a/tests/auto/gui/qopengl/qopengl.pro +++ b/tests/auto/gui/qopengl/qopengl.pro @@ -8,4 +8,4 @@ QT += gui-private core-private testlib SOURCES += tst_qopengl.cpp -linux:qtConfig(xcb):qtConfig(xcb-glx):qtConfig(xcb-xlib):!qtConfig(egl): DEFINES += USE_GLX +linux:qtConfig(xcb):qtConfig(xcb-glx-plugin): DEFINES += USE_GLX From 0c03316ec94361bd1d80b391d77a1dcd52f2a23a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 14 Feb 2019 17:03:19 +0100 Subject: [PATCH 4/9] Revert "Fix determination of OpenGL include paths on macOS" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 37970d7b3e6fff92dca98db974ada865c1bfd730. That commit broke the build on macOS, because the OpenGL headers aren't resolved anymore at configure time. Change-Id: Iec6ef009c9ea7e28b12eeca6b5eb06918bf49d98 Fixes: QTBUG-73827 Reviewed-by: Tor Arne Vestbø Reviewed-by: Mitch Curtis --- mkspecs/common/mac.conf | 2 +- mkspecs/features/mac/sdk.prf | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index e000d1026b..b77494ec9b 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -17,7 +17,7 @@ QMAKE_EXTENSION_SHLIB = dylib QMAKE_EXTENSIONS_AUX_SHLIB = tbd QMAKE_LIBDIR = -# The proper SDK sysroot will be automatically prepended +# sdk.prf will prefix the proper SDK sysroot QMAKE_INCDIR_OPENGL = \ /System/Library/Frameworks/OpenGL.framework/Headers \ /System/Library/Frameworks/AGL.framework/Headers/ diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 50a41657d8..8360dd8b38 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -33,6 +33,10 @@ QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path) QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath) QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion) +sysrootified = +for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val +QMAKE_INCDIR_OPENGL = $$sysrootified + QMAKESPEC_NAME = $$basename(QMAKESPEC) # Resolve SDK version of various tools From 8fe36801930872ef4a57e2ff7d7f935de12a33e9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 1 Feb 2019 15:16:00 +0100 Subject: [PATCH 5/9] Add cmdline feature to qmake [ChangeLog][qmake] A new feature "cmdline" was added that implies "CONFIG += console" and "CONFIG -= app_bundle". Task-number: QTBUG-27079 Change-Id: I6e52b07c9341c904bb1424fc717057432f9360e1 Reviewed-by: Oswald Buddenhagen --- examples/corelib/serialization/cbordump/cbordump.pro | 3 +-- examples/corelib/serialization/convert/convert.pro | 3 +-- examples/corelib/serialization/savegame/savegame.pro | 3 +-- examples/corelib/threads/semaphores/semaphores.pro | 3 +-- .../corelib/threads/waitconditions/waitconditions.pro | 4 ++-- examples/network/dnslookup/dnslookup.pro | 3 +-- examples/network/download/download.pro | 3 +-- examples/network/downloadmanager/downloadmanager.pro | 3 +-- examples/qmake/precompile/precompile.pro | 3 +-- examples/qtconcurrent/map/map.pro | 3 +-- examples/qtconcurrent/runfunction/runfunction.pro | 3 +-- examples/qtconcurrent/wordcount/wordcount.pro | 3 +-- examples/widgets/statemachine/factorial/factorial.pro | 3 +-- examples/widgets/statemachine/pingpong/pingpong.pro | 3 +-- examples/xml/htmlinfo/htmlinfo.pro | 3 +-- examples/xml/xmlstreamlint/xmlstreamlint.pro | 3 +-- mkspecs/features/cmdline.prf | 2 ++ mkspecs/features/qt_test_helper.prf | 3 +-- qmake/doc/src/qmake-manual.qdoc | 11 +++++++---- qmake/qmake.pro | 4 ++-- src/tools/moc/util/generate_keywords.pro | 2 +- tests/auto/corelib/global/qlogging/app/app.pro | 3 +-- .../qlockfiletesthelper/qlockfile_test_helper.pro | 3 +-- .../qprocess/fileWriterProcess/fileWriterProcess.pro | 3 +-- .../corelib/io/qprocess/testDetached/testDetached.pro | 3 +-- .../io/qprocess/testExitCodes/testExitCodes.pro | 4 ++-- .../io/qprocess/testForwarding/testForwarding.pro | 3 +-- .../testForwardingHelper/testForwardingHelper.pro | 4 ++-- .../io/qprocess/testGuiProcess/testGuiProcess.pro | 3 +-- .../io/qprocess/testProcessCrash/testProcessCrash.pro | 4 ++-- .../testProcessDeadWhileReading.pro | 4 ++-- .../io/qprocess/testProcessEOF/testProcessEOF.pro | 4 ++-- .../io/qprocess/testProcessEcho/testProcessEcho.pro | 4 ++-- .../io/qprocess/testProcessEcho2/testProcessEcho2.pro | 4 ++-- .../io/qprocess/testProcessEcho3/testProcessEcho3.pro | 4 ++-- .../testProcessEnvironment/testProcessEnvironment.pro | 6 +----- .../io/qprocess/testProcessHang/testProcessHang.pro | 4 ++-- .../qprocess/testProcessNormal/testProcessNormal.pro | 4 ++-- .../qprocess/testProcessOutput/testProcessOutput.pro | 4 ++-- .../io/qprocess/testProcessSpacesArgs/nospace.pro | 4 ++-- .../io/qprocess/testProcessSpacesArgs/onespace.pro | 4 ++-- .../io/qprocess/testProcessSpacesArgs/twospaces.pro | 4 ++-- .../testSetNamedPipeHandleState.pro | 4 ++-- .../testSetWorkingDirectory.pro | 3 +-- .../corelib/io/qprocess/testSoftExit/testSoftExit.pro | 4 ++-- .../io/qprocess/testSpaceInName/testSpaceInName.pro | 6 +----- .../readAllStdinProcess/readAllStdinProcess.pro | 3 +-- .../readLineStdinProcess/readLineStdinProcess.pro | 3 +-- .../qtextstream/stdinProcess/stdinProcess.pro | 3 +-- .../thread/qthreadstorage/crashonexit/crashonexit.pro | 3 +-- .../testhelper/qcommandlineparser_test_helper.pro | 3 +-- .../tools/qlocale/syslocaleapp/syslocaleapp.pro | 3 +-- .../corelib/tools/qsharedpointer/externaltests.cpp | 3 +-- .../dbus/qdbusabstractinterface/qpinger/qpinger.pro | 3 +-- tests/auto/dbus/qdbusmarshall/qpong/qpong.pro | 4 +--- tests/auto/network/access/qnetworkreply/echo/echo.pro | 4 ++-- .../network/bearer/qnetworksession/lackey/lackey.pro | 3 +-- .../qlocalsocket/socketprocess/socketprocess.pro | 3 +-- .../socket/qtcpsocket/stressTest/stressTest.pro | 3 +-- .../socket/qudpsocket/clientserver/clientserver.pro | 3 +-- .../network/socket/qudpsocket/udpServer/udpServer.pro | 4 +--- .../write-read-write/write-read-write.pro | 4 ++-- tests/baselineserver/src/baselineserver.pro | 3 +-- .../testProcessLoopback/testProcessLoopback.pro | 4 ++-- .../tools/qcryptographichash/qcryptographichash.pro | 4 ++-- .../embeddedintoforeignwindow.pro | 3 +-- tests/manual/filetest/filetest.pro | 3 +-- tests/manual/foreignwindows/foreignwindows.pro | 3 +-- tests/manual/highdpi/highdpi.pro | 3 +-- tests/manual/lance/lance.pro | 3 +-- tests/manual/qdesktopservices/qdesktopservices.pro | 3 +-- tests/manual/qmimedatabase/qmimedatabase.pro | 3 +-- tests/manual/qstorageinfo/qstorageinfo.pro | 3 +-- tests/manual/qsysinfo/qsysinfo.pro | 3 +-- tests/manual/widgets/styles/styles.pro | 3 +-- util/glgen/glgen.pro | 3 +-- util/gradientgen/tobinaryjson.pro | 3 +-- 77 files changed, 106 insertions(+), 161 deletions(-) create mode 100644 mkspecs/features/cmdline.prf diff --git a/examples/corelib/serialization/cbordump/cbordump.pro b/examples/corelib/serialization/cbordump/cbordump.pro index 7fb2ef69f0..8149cb1d4c 100644 --- a/examples/corelib/serialization/cbordump/cbordump.pro +++ b/examples/corelib/serialization/cbordump/cbordump.pro @@ -2,8 +2,7 @@ QT += core QT -= gui TARGET = cbordump -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline TEMPLATE = app diff --git a/examples/corelib/serialization/convert/convert.pro b/examples/corelib/serialization/convert/convert.pro index d9b1de41e3..4c6b0b557a 100644 --- a/examples/corelib/serialization/convert/convert.pro +++ b/examples/corelib/serialization/convert/convert.pro @@ -2,8 +2,7 @@ QT += core QT -= gui TARGET = convert -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline TEMPLATE = app diff --git a/examples/corelib/serialization/savegame/savegame.pro b/examples/corelib/serialization/savegame/savegame.pro index 15a38c32ef..69e6b216f2 100644 --- a/examples/corelib/serialization/savegame/savegame.pro +++ b/examples/corelib/serialization/savegame/savegame.pro @@ -2,8 +2,7 @@ QT += core QT -= gui TARGET = savegame -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline TEMPLATE = app diff --git a/examples/corelib/threads/semaphores/semaphores.pro b/examples/corelib/threads/semaphores/semaphores.pro index 69154e57eb..de909508c4 100644 --- a/examples/corelib/threads/semaphores/semaphores.pro +++ b/examples/corelib/threads/semaphores/semaphores.pro @@ -1,8 +1,7 @@ SOURCES += semaphores.cpp QT = core -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline # install target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/semaphores diff --git a/examples/corelib/threads/waitconditions/waitconditions.pro b/examples/corelib/threads/waitconditions/waitconditions.pro index 2dbe7df68a..19b56a246d 100644 --- a/examples/corelib/threads/waitconditions/waitconditions.pro +++ b/examples/corelib/threads/waitconditions/waitconditions.pro @@ -1,6 +1,6 @@ QT = core -CONFIG -= moc app_bundle -CONFIG += console +CONFIG -= moc +CONFIG += cmdline SOURCES += waitconditions.cpp diff --git a/examples/network/dnslookup/dnslookup.pro b/examples/network/dnslookup/dnslookup.pro index 0c6b512d3b..c72301420c 100644 --- a/examples/network/dnslookup/dnslookup.pro +++ b/examples/network/dnslookup/dnslookup.pro @@ -1,7 +1,6 @@ TEMPLATE = app QT = core network -mac:CONFIG -= app_bundle -win32:CONFIG += console +CONFIG += cmdline HEADERS += dnslookup.h SOURCES += dnslookup.cpp diff --git a/examples/network/download/download.pro b/examples/network/download/download.pro index 2c784c4197..63d80a0e7c 100644 --- a/examples/network/download/download.pro +++ b/examples/network/download/download.pro @@ -1,6 +1,5 @@ QT = core network -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/examples/network/downloadmanager/downloadmanager.pro b/examples/network/downloadmanager/downloadmanager.pro index 68972610fa..cd1a977e5d 100644 --- a/examples/network/downloadmanager/downloadmanager.pro +++ b/examples/network/downloadmanager/downloadmanager.pro @@ -1,6 +1,5 @@ QT = core network -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline HEADERS += downloadmanager.h textprogressbar.h SOURCES += downloadmanager.cpp main.cpp textprogressbar.cpp diff --git a/examples/qmake/precompile/precompile.pro b/examples/qmake/precompile/precompile.pro index 6a23d82c32..27564cd390 100644 --- a/examples/qmake/precompile/precompile.pro +++ b/examples/qmake/precompile/precompile.pro @@ -6,8 +6,7 @@ #! [0] TEMPLATE = app LANGUAGE = C++ -CONFIG += console precompile_header -CONFIG -= app_bundle +CONFIG += cmdline precompile_header QT += widgets # Use Precompiled headers (PCH) diff --git a/examples/qtconcurrent/map/map.pro b/examples/qtconcurrent/map/map.pro index 166f596909..7f267beb22 100644 --- a/examples/qtconcurrent/map/map.pro +++ b/examples/qtconcurrent/map/map.pro @@ -1,8 +1,7 @@ TEMPLATE = app TARGET = mapdemo QT += concurrent -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/examples/qtconcurrent/runfunction/runfunction.pro b/examples/qtconcurrent/runfunction/runfunction.pro index 5624c87df7..42c05551ba 100644 --- a/examples/qtconcurrent/runfunction/runfunction.pro +++ b/examples/qtconcurrent/runfunction/runfunction.pro @@ -1,6 +1,5 @@ QT += concurrent widgets -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/examples/qtconcurrent/wordcount/wordcount.pro b/examples/qtconcurrent/wordcount/wordcount.pro index 771efadc4a..18545b1a65 100644 --- a/examples/qtconcurrent/wordcount/wordcount.pro +++ b/examples/qtconcurrent/wordcount/wordcount.pro @@ -1,6 +1,5 @@ QT += concurrent widgets -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/examples/widgets/statemachine/factorial/factorial.pro b/examples/widgets/statemachine/factorial/factorial.pro index f200c738ba..bf285acf4d 100644 --- a/examples/widgets/statemachine/factorial/factorial.pro +++ b/examples/widgets/statemachine/factorial/factorial.pro @@ -1,6 +1,5 @@ QT = core -win32: CONFIG += console -mac:CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/examples/widgets/statemachine/pingpong/pingpong.pro b/examples/widgets/statemachine/pingpong/pingpong.pro index 7cc27a13f5..18dee0400d 100644 --- a/examples/widgets/statemachine/pingpong/pingpong.pro +++ b/examples/widgets/statemachine/pingpong/pingpong.pro @@ -1,6 +1,5 @@ QT = core -win32: CONFIG += console -mac:CONFIG -= app_bundle +CONFIG += cmdline SOURCES = main.cpp diff --git a/examples/xml/htmlinfo/htmlinfo.pro b/examples/xml/htmlinfo/htmlinfo.pro index e106c69b52..8fea3b38dd 100644 --- a/examples/xml/htmlinfo/htmlinfo.pro +++ b/examples/xml/htmlinfo/htmlinfo.pro @@ -1,10 +1,9 @@ SOURCES += main.cpp QT -= gui -CONFIG -= app_bundle RESOURCES = resources.qrc -win32: CONFIG += console +CONFIG += cmdline # install target.path = $$[QT_INSTALL_EXAMPLES]/xml/htmlinfo diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.pro b/examples/xml/xmlstreamlint/xmlstreamlint.pro index cf03c4817a..90a6387afe 100644 --- a/examples/xml/xmlstreamlint/xmlstreamlint.pro +++ b/examples/xml/xmlstreamlint/xmlstreamlint.pro @@ -1,5 +1,4 @@ -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT -= gui SOURCES += main.cpp diff --git a/mkspecs/features/cmdline.prf b/mkspecs/features/cmdline.prf new file mode 100644 index 0000000000..f9d90d3a50 --- /dev/null +++ b/mkspecs/features/cmdline.prf @@ -0,0 +1,2 @@ +win32: CONFIG *= console +macos: CONFIG -= app_bundle diff --git a/mkspecs/features/qt_test_helper.prf b/mkspecs/features/qt_test_helper.prf index 5daa14731d..86b65dd884 100644 --- a/mkspecs/features/qt_test_helper.prf +++ b/mkspecs/features/qt_test_helper.prf @@ -16,8 +16,7 @@ # Additionally the helper's executable is suffixed with "_helper" to # avoid name clashes with its folder. -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline debug_and_release { CONFIG(debug, debug|release) { diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index fb8bad32a2..84e3fb6df4 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1060,8 +1060,12 @@ proper include paths, compiler flags and libraries will automatically be added to the project. \row \li console \li The target is a Win32 console application (app only). The - proper include paths, compiler flags and libraries will - automatically be added to the project. + proper include paths, compiler flags and libraries will automatically be + added to the project. Consider using the option \c{cmdline} for + cross-platform applications. + \row \li cmdline \li The target is a cross-platform command line application. + On Windows, this implies \c{CONFIG += console}. + On macOS, this implies \c{CONFIG -= app_bundle}. \row \li shared \li{1,2} The target is a shared object/DLL. The proper include paths, compiler flags and libraries will automatically be added to the project. Note that \c dll can also be used on all platforms; @@ -4887,8 +4891,7 @@ \code TEMPLATE = app LANGUAGE = C++ - CONFIG += console precompile_header - CONFIG -= app_bundle + CONFIG += cmdline precompile_header # Use Precompiled headers (PCH) PRECOMPILED_HEADER = stable.h diff --git a/qmake/qmake.pro b/qmake/qmake.pro index ebd61751b7..5399e8c298 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -3,8 +3,8 @@ # and the configures. option(host_build) -CONFIG += console -CONFIG -= qt app_bundle +CONFIG += cmdline +CONFIG -= qt DEFINES += \ PROEVALUATOR_FULL \ diff --git a/src/tools/moc/util/generate_keywords.pro b/src/tools/moc/util/generate_keywords.pro index 88e5553f54..2bbc3ced61 100644 --- a/src/tools/moc/util/generate_keywords.pro +++ b/src/tools/moc/util/generate_keywords.pro @@ -1,4 +1,4 @@ CONFIG -= moc -mac:CONFIG -= app_bundle +CONFIG += cmdline SOURCES += generate_keywords.cpp diff --git a/tests/auto/corelib/global/qlogging/app/app.pro b/tests/auto/corelib/global/qlogging/app/app.pro index b90b685749..3ada382ff4 100644 --- a/tests/auto/corelib/global/qlogging/app/app.pro +++ b/tests/auto/corelib/global/qlogging/app/app.pro @@ -14,8 +14,7 @@ QT = core DESTDIR = ./ -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline SOURCES += main.cpp DEFINES += QT_MESSAGELOGCONTEXT diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro index 3ac3be9c9b..97135d279e 100644 --- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro @@ -1,7 +1,6 @@ TARGET = qlockfile_test_helper SOURCES += qlockfile_test_helper.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT = core DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro index 947dc916f2..2744491151 100644 --- a/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro +++ b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro @@ -1,5 +1,4 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT = core DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro index 8d1fcba624..3d80b668df 100644 --- a/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro +++ b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro @@ -1,6 +1,5 @@ SOURCES = main.cpp QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline INSTALLS = DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro index b08371804f..5eaf8dc881 100644 --- a/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro +++ b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro @@ -1,5 +1,5 @@ SOURCES += main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro b/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro index 45b498c32a..4d91e0cf36 100644 --- a/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro +++ b/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro @@ -1,5 +1,4 @@ SOURCES = main.cpp -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro b/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro +++ b/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro index 8778da7ffe..ef438d6399 100644 --- a/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro +++ b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro @@ -1,5 +1,4 @@ SOURCES += main.cpp QT += widgets -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro index 7ccc976efc..640ce4cd09 100644 --- a/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro +++ b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= qt app_bundle +CONFIG += cmdline +CONFIG -= qt DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro index fbb3411d47..c7be60a82d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro +++ b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro index 98fe78c8b9..ab1394a5c9 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline win32:!mingw:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS- DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro index a07ae00605..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro @@ -1,8 +1,4 @@ SOURCES = main.cpp CONFIG -= qt -CONFIG += console +CONFIG += cmdline DESTDIR = ./ - -mac { - CONFIG -= app_bundle -} diff --git a/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro b/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro +++ b/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro index c6db9d1bac..7e1119c117 100644 --- a/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro +++ b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= qt app_bundle +CONFIG += cmdline +CONFIG -= qt DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro index 95191098bd..0bbb6b3c0e 100644 --- a/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro +++ b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro index dd7e8e4a85..7954a2f74b 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ OBJECTS_DIR = $${OBJECTS_DIR}-nospace DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro index d18a683e1c..44a365c9a5 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ OBJECTS_DIR = $${OBJECTS_DIR}-onespace diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro index 8b16f65e34..bd2db9fb6d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ OBJECTS_DIR = $${OBJECTS_DIR}-twospaces diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro +++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro index 21a115b536..4d91e0cf36 100644 --- a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro +++ b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro @@ -1,5 +1,4 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro index 80e8bcad98..2cfcb4794e 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro +++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro @@ -6,7 +6,7 @@ unix { SOURCES = main_unix.cpp } -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro index afa4f32a85..48f28c4c8b 100644 --- a/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro +++ b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro @@ -1,9 +1,5 @@ SOURCES = main.cpp CONFIG -= qt -CONFIG += console +CONFIG += cmdline DESTDIR = "../test Space In Name" - -mac { - CONFIG -= app_bundle -} QT = core diff --git a/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/readAllStdinProcess.pro b/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/readAllStdinProcess.pro index 4a4c091dcb..f2b5aa619f 100644 --- a/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/readAllStdinProcess.pro +++ b/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/readAllStdinProcess.pro @@ -1,7 +1,6 @@ SOURCES += main.cpp QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ # This app is testdata for tst_qtextstream diff --git a/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/readLineStdinProcess.pro b/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/readLineStdinProcess.pro index 4a4c091dcb..f2b5aa619f 100644 --- a/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/readLineStdinProcess.pro +++ b/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/readLineStdinProcess.pro @@ -1,7 +1,6 @@ SOURCES += main.cpp QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ # This app is testdata for tst_qtextstream diff --git a/tests/auto/corelib/serialization/qtextstream/stdinProcess/stdinProcess.pro b/tests/auto/corelib/serialization/qtextstream/stdinProcess/stdinProcess.pro index 4a4c091dcb..f2b5aa619f 100644 --- a/tests/auto/corelib/serialization/qtextstream/stdinProcess/stdinProcess.pro +++ b/tests/auto/corelib/serialization/qtextstream/stdinProcess/stdinProcess.pro @@ -1,7 +1,6 @@ SOURCES += main.cpp QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ # This app is testdata for tst_qtextstream diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro index d5c09ebc84..57bd78bcee 100644 --- a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro +++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro @@ -9,8 +9,7 @@ debug_and_release { TARGET = ../crashOnExit_helper } QT = core -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline # This app is testdata for tst_qthreadstorage target.path = $$[QT_INSTALL_TESTS]/tst_qthreadstorage/$$TARGET diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.pro b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.pro index dce1ac0d37..5020658835 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.pro +++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.pro @@ -1,5 +1,4 @@ -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT = core DESTDIR = ./ diff --git a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro index b61f51d53a..3e283c05a4 100644 --- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro +++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro @@ -1,8 +1,7 @@ SOURCES += syslocaleapp.cpp DESTDIR = ./ -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT = core diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index 4dc620e6ab..d1bb89f549 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -470,9 +470,8 @@ namespace QTest { "TEMPLATE = app\n" "\n" "TARGET = externaltest\n" - "CONFIG -= app_bundle\n" // for the Mac "CONFIG -= debug_and_release\n" - "CONFIG += console\n" + "CONFIG += cmdline\n" "DESTDIR = .\n" "OBJECTS_DIR = .\n" "UI_DIR = .\n" diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro index 206522b557..a876cbfa33 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro +++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro @@ -2,6 +2,5 @@ SOURCES = qpinger.cpp ../interface.cpp HEADERS = ../interface.h TARGET = qpinger DESTDIR = ./ -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline QT = core dbus diff --git a/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro b/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro index 57f8b2a598..97a5e7e19d 100644 --- a/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro +++ b/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro @@ -2,6 +2,4 @@ SOURCES = qpong.cpp TARGET = qpong DESTDIR = ./ QT = core dbus -CONFIG -= app_bundle -CONFIG += console - +CONFIG += cmdline diff --git a/tests/auto/network/access/qnetworkreply/echo/echo.pro b/tests/auto/network/access/qnetworkreply/echo/echo.pro index 1f05fd9a54..3e304f4105 100644 --- a/tests/auto/network/access/qnetworkreply/echo/echo.pro +++ b/tests/auto/network/access/qnetworkreply/echo/echo.pro @@ -1,4 +1,4 @@ SOURCES += main.cpp QT = core -CONFIG -= app_bundle debug_and_release_target -CONFIG += console +CONFIG -= debug_and_release_target +CONFIG += cmdline diff --git a/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro b/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro index 1605b31d94..dd83d905e6 100644 --- a/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro +++ b/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro @@ -5,5 +5,4 @@ QT = core network DESTDIR = ./ -win32:CONFIG += console -mac:CONFIG -= app_bundle +CONFIG += cmdline diff --git a/tests/auto/network/socket/qlocalsocket/socketprocess/socketprocess.pro b/tests/auto/network/socket/qlocalsocket/socketprocess/socketprocess.pro index 643c4c5733..e11ed5644b 100644 --- a/tests/auto/network/socket/qlocalsocket/socketprocess/socketprocess.pro +++ b/tests/auto/network/socket/qlocalsocket/socketprocess/socketprocess.pro @@ -3,7 +3,6 @@ QT = core network testlib DESTDIR = ./ TARGET = socketprocess -win32:CONFIG += console -mac:CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro b/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro index 2eb00593e0..6afc008e7d 100644 --- a/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro +++ b/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro @@ -2,8 +2,7 @@ HEADERS += Test.h SOURCES += main.cpp Test.cpp QT = core network testlib -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline DESTDIR = ./ MOC_DIR = .moc/ TMP_DIR = .tmp/ diff --git a/tests/auto/network/socket/qudpsocket/clientserver/clientserver.pro b/tests/auto/network/socket/qudpsocket/clientserver/clientserver.pro index a1b0021232..83a31b11e9 100644 --- a/tests/auto/network/socket/qudpsocket/clientserver/clientserver.pro +++ b/tests/auto/network/socket/qudpsocket/clientserver/clientserver.pro @@ -1,6 +1,5 @@ QT = core network SOURCES += main.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline TARGET = clientserver DESTDIR = ./ diff --git a/tests/auto/network/socket/qudpsocket/udpServer/udpServer.pro b/tests/auto/network/socket/qudpsocket/udpServer/udpServer.pro index cf707aa14a..c8f9ebf648 100644 --- a/tests/auto/network/socket/qudpsocket/udpServer/udpServer.pro +++ b/tests/auto/network/socket/qudpsocket/udpServer/udpServer.pro @@ -1,5 +1,3 @@ SOURCES += main.cpp QT = core network -CONFIG -= app_bundle -CONFIG += console - +CONFIG += cmdline diff --git a/tests/auto/other/qprocess_and_guieventloop/write-read-write/write-read-write.pro b/tests/auto/other/qprocess_and_guieventloop/write-read-write/write-read-write.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/other/qprocess_and_guieventloop/write-read-write/write-read-write.pro +++ b/tests/auto/other/qprocess_and_guieventloop/write-read-write/write-read-write.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/baselineserver/src/baselineserver.pro b/tests/baselineserver/src/baselineserver.pro index a77014c1e6..2d8438cb51 100644 --- a/tests/baselineserver/src/baselineserver.pro +++ b/tests/baselineserver/src/baselineserver.pro @@ -5,8 +5,7 @@ QT += core network TARGET = baselineserver DESTDIR = ../bin -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline TEMPLATE = app diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro index cb8dfdcdcb..a0230e1cb8 100644 --- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro +++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline winrt: QMAKE_LFLAGS += /ENTRY:mainCRTStartup DESTDIR = ./ diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/benchmarks/corelib/tools/qcryptographichash/qcryptographichash.pro index 9c55de8b47..cf9d640f7e 100644 --- a/tests/benchmarks/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/benchmarks/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -1,5 +1,5 @@ TARGET = tst_bench_qcryptographichash -CONFIG -= debug app_bundle -CONFIG += release console +CONFIG -= debug +CONFIG += release cmdline QT = core testlib SOURCES += main.cpp diff --git a/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro b/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro index 93da4b8c91..dba33a139e 100644 --- a/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro +++ b/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro @@ -1,7 +1,6 @@ TEMPLATE = app QT += gui-private -CONFIG += console c++11 -CONFIG -= app_bundle +CONFIG += cmdline c++11 SOURCES += main.cpp itemwindow.cpp HEADERS += itemwindow.h include(../diaglib/diaglib.pri) diff --git a/tests/manual/filetest/filetest.pro b/tests/manual/filetest/filetest.pro index 5d2ba9b82b..b91689e0ff 100644 --- a/tests/manual/filetest/filetest.pro +++ b/tests/manual/filetest/filetest.pro @@ -1,6 +1,5 @@ TEMPLATE = app QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/tests/manual/foreignwindows/foreignwindows.pro b/tests/manual/foreignwindows/foreignwindows.pro index 6a370a6813..15bf2395f8 100644 --- a/tests/manual/foreignwindows/foreignwindows.pro +++ b/tests/manual/foreignwindows/foreignwindows.pro @@ -1,6 +1,5 @@ TEMPLATE = app QT += widgets -CONFIG += console c++11 -CONFIG -= app_bundle +CONFIG += cmdline c++11 SOURCES += main.cpp include(../diaglib/diaglib.pri) diff --git a/tests/manual/highdpi/highdpi.pro b/tests/manual/highdpi/highdpi.pro index 7d6b42535e..9db083cd82 100644 --- a/tests/manual/highdpi/highdpi.pro +++ b/tests/manual/highdpi/highdpi.pro @@ -2,8 +2,7 @@ TEMPLATE = app TARGET = highdpi INCLUDEPATH += . QT += widgets gui-private -CONFIG +=console -CONFIG -= app_bundle +CONFIG += cmdline CONFIG += c++11 # Input SOURCES += \ diff --git a/tests/manual/lance/lance.pro b/tests/manual/lance/lance.pro index 312106c2f0..78ca2f56e5 100644 --- a/tests/manual/lance/lance.pro +++ b/tests/manual/lance/lance.pro @@ -1,6 +1,5 @@ LANCELOT_DIR = $$PWD/../../auto/other/lancelot -CONFIG+=console moc -CONFIG -= app_bundle +CONFIG += cmdline moc TEMPLATE = app INCLUDEPATH += . $$LANCELOT_DIR QT += core-private gui-private widgets printsupport diff --git a/tests/manual/qdesktopservices/qdesktopservices.pro b/tests/manual/qdesktopservices/qdesktopservices.pro index c96287e159..baa3c325ff 100644 --- a/tests/manual/qdesktopservices/qdesktopservices.pro +++ b/tests/manual/qdesktopservices/qdesktopservices.pro @@ -1,8 +1,7 @@ QT += testlib TARGET = tst_qdesktopservices -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline TEMPLATE = app diff --git a/tests/manual/qmimedatabase/qmimedatabase.pro b/tests/manual/qmimedatabase/qmimedatabase.pro index 5473330edf..fd931d5eec 100644 --- a/tests/manual/qmimedatabase/qmimedatabase.pro +++ b/tests/manual/qmimedatabase/qmimedatabase.pro @@ -1,5 +1,4 @@ TEMPLATE = app QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/tests/manual/qstorageinfo/qstorageinfo.pro b/tests/manual/qstorageinfo/qstorageinfo.pro index 25acd24c80..e47ecc5b3e 100644 --- a/tests/manual/qstorageinfo/qstorageinfo.pro +++ b/tests/manual/qstorageinfo/qstorageinfo.pro @@ -1,4 +1,3 @@ QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/tests/manual/qsysinfo/qsysinfo.pro b/tests/manual/qsysinfo/qsysinfo.pro index c73d8282cb..ff0a09d42e 100644 --- a/tests/manual/qsysinfo/qsysinfo.pro +++ b/tests/manual/qsysinfo/qsysinfo.pro @@ -1,7 +1,6 @@ QT = core TARGET = qsysinfo TEMPLATE = app -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline SOURCES += main.cpp diff --git a/tests/manual/widgets/styles/styles.pro b/tests/manual/widgets/styles/styles.pro index ef8217a9a3..d302ae0691 100644 --- a/tests/manual/widgets/styles/styles.pro +++ b/tests/manual/widgets/styles/styles.pro @@ -1,7 +1,6 @@ TEMPLATE = app QT = widgets -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline CONFIG += c++11 SOURCES += main.cpp diff --git a/util/glgen/glgen.pro b/util/glgen/glgen.pro index 11018e942d..22c377e5f1 100644 --- a/util/glgen/glgen.pro +++ b/util/glgen/glgen.pro @@ -1,6 +1,5 @@ QT -= gui -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline # Uncomment following to enable debug output #DEFINES += SPECPARSER_DEBUG diff --git a/util/gradientgen/tobinaryjson.pro b/util/gradientgen/tobinaryjson.pro index 8ed3509278..8aa9d0d008 100644 --- a/util/gradientgen/tobinaryjson.pro +++ b/util/gradientgen/tobinaryjson.pro @@ -1,4 +1,3 @@ SOURCES += tobinaryjson.cpp QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline From c7318e899ea00cf9f3979c8876b2402187000905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 13 Feb 2019 15:28:44 +0100 Subject: [PATCH 6/9] macOS: Remove dead code in window activation handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I321ab68b51c4ba63204c0e15fec74164e2c93d34 Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- .../cocoa/qcocoaapplicationdelegate.mm | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 44ab16d300..9e3c89b6a4 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -353,21 +353,6 @@ QT_USE_NAMESPACE [reflectionDelegate applicationDidBecomeActive:notification]; QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive); -/* - onApplicationChangedActivation(true); - - if (!QWidget::mouseGrabber()){ - // Update enter/leave immidiatly, don't wait for a move event. But only - // if no grab exists (even if the grab points to this widget, it seems, ref X11) - QPoint qlocal, qglobal; - QWidget *widgetUnderMouse = 0; - qt_mac_getTargetForMouseEvent(0, QEvent::Enter, qlocal, qglobal, 0, &widgetUnderMouse); - QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, 0); - qt_last_mouse_receiver = widgetUnderMouse; - qt_last_native_mouse_receiver = widgetUnderMouse ? - (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0; - } -*/ } - (void)applicationDidResignActive:(NSNotification *)notification @@ -377,15 +362,6 @@ QT_USE_NAMESPACE [reflectionDelegate applicationDidResignActive:notification]; QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive); -/* - onApplicationChangedActivation(false); - - if (!QWidget::mouseGrabber()) - QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver); - qt_last_mouse_receiver = 0; - qt_last_native_mouse_receiver = 0; - qt_button_down = 0; -*/ } - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag From 025128a7e0d7100da7e1705cd448012e0421e05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Feb 2019 20:07:35 +0100 Subject: [PATCH 7/9] macOS: Simplify QCocoaWindow::setVisible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need all the checks for the event dispatcher, it should always be there. Change-Id: Ib89a9c1c5524b49c2d85fae12425d19ced960597 Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 50 ++++++++------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ebdd51acb4..ec7ad38be5 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -303,13 +303,17 @@ void QCocoaWindow::setVisible(bool visible) { qCDebug(lcQpaWindow) << "QCocoaWindow::setVisible" << window() << visible; - m_inSetVisible = true; + QScopedValueRollback rollback(m_inSetVisible, true); QMacAutoReleasePool pool; QCocoaWindow *parentCocoaWindow = nullptr; if (window()->transientParent()) parentCocoaWindow = static_cast(window()->transientParent()->handle()); + auto eventDispatcher = [] { + return static_cast(QObjectPrivate::get(qApp->eventDispatcher())); + }; + if (visible) { // We need to recreate if the modality has changed as the style mask will need updating recreateWindowIfNeeded(); @@ -350,28 +354,15 @@ void QCocoaWindow::setVisible(bool visible) applyWindowState(window()->windowStates()); if (window()->windowState() != Qt::WindowMinimized) { - if ((window()->modality() == Qt::WindowModal - || window()->type() == Qt::Sheet) - && parentCocoaWindow) { - // show the window as a sheet + if (parentCocoaWindow && (window()->modality() == Qt::WindowModal || window()->type() == Qt::Sheet)) { + // Show the window as a sheet [parentCocoaWindow->nativeWindow() beginSheet:m_view.window completionHandler:nil]; - } else if (window()->modality() != Qt::NonModal) { - // show the window as application modal - QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast(QGuiApplication::instance()->eventDispatcher()); - Q_ASSERT(cocoaEventDispatcher); - QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast(QObjectPrivate::get(cocoaEventDispatcher)); - cocoaEventDispatcherPrivate->beginModalSession(window()); + } else if (window()->modality() == Qt::ApplicationModal) { + // Show the window as application modal + eventDispatcher()->beginModalSession(window()); m_hasModalSession = true; - } else if ([m_view.window canBecomeKeyWindow]) { - QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast(QGuiApplication::instance()->eventDispatcher()); - QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = nullptr; - if (cocoaEventDispatcher) - cocoaEventDispatcherPrivate = static_cast(QObjectPrivate::get(cocoaEventDispatcher)); - - if (cocoaEventDispatcherPrivate && cocoaEventDispatcherPrivate->cocoaModalSessionStack.isEmpty()) - [m_view.window makeKeyAndOrderFront:nil]; - else - [m_view.window orderFront:nil]; + } else if (m_view.window.canBecomeKeyWindow && eventDispatcher()->cocoaModalSessionStack.isEmpty()) { + [m_view.window makeKeyAndOrderFront:nil]; } else { [m_view.window orderFront:nil]; } @@ -396,21 +387,18 @@ void QCocoaWindow::setVisible(bool visible) } } } + // In some cases, e.g. QDockWidget, the content view is hidden before moving to its own // Cocoa window, and then shown again. Therefore, we test for the view being hidden even // if it's attached to an NSWindow. if ([m_view isHidden]) [m_view setHidden:NO]; + } else { - // qDebug() << "close" << this; - QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast(QGuiApplication::instance()->eventDispatcher()); - QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = nullptr; - if (cocoaEventDispatcher) - cocoaEventDispatcherPrivate = static_cast(QObjectPrivate::get(cocoaEventDispatcher)); + // Window not visible, hide it if (isContentView()) { if (m_hasModalSession) { - if (cocoaEventDispatcherPrivate) - cocoaEventDispatcherPrivate->endModalSession(window()); + eventDispatcher()->endModalSession(window()); m_hasModalSession = false; } else { if ([m_view.window isSheet]) { @@ -421,8 +409,7 @@ void QCocoaWindow::setVisible(bool visible) [m_view.window orderOut:nil]; - if (m_view.window == [NSApp keyWindow] - && !(cocoaEventDispatcherPrivate && cocoaEventDispatcherPrivate->currentModalSession())) { + if (m_view.window == [NSApp keyWindow] && !eventDispatcher()->currentModalSession()) { // Probably because we call runModalSession: outside [NSApp run] in QCocoaEventDispatcher // (e.g., when show()-ing a modal QDialog instead of exec()-ing it), it can happen that // the current NSWindow is still key after being ordered out. Then, after checking we @@ -434,6 +421,7 @@ void QCocoaWindow::setVisible(bool visible) } else { [m_view setHidden:YES]; } + removeMonitor(); if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) @@ -447,8 +435,6 @@ void QCocoaWindow::setVisible(bool visible) nativeParentWindow.styleMask |= NSWindowStyleMaskResizable; } } - - m_inSetVisible = false; } NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags) From c36c5e9b552f826c96bf066252b49de03921c03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Feb 2019 20:33:13 +0100 Subject: [PATCH 8/9] macOS: Modernize worksWhenModal handling The code in QCocoaEventDispatcher was dead and could be removed. Change-Id: I0c57e64791045d65033376c096220983059028ba Reviewed-by: Timur Pocheptsov --- .../platforms/cocoa/qcocoaeventdispatcher.h | 1 - .../platforms/cocoa/qcocoaeventdispatcher.mm | 41 ------------------- src/plugins/platforms/cocoa/qcocoawindow.mm | 30 ++++++-------- src/plugins/platforms/cocoa/qnswindow.h | 1 + src/plugins/platforms/cocoa/qnswindow.mm | 13 ++++++ 5 files changed, 27 insertions(+), 59 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index ebf33cf4e2..44a9c52b7b 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -168,7 +168,6 @@ public: uint processEventsCalled; NSModalSession currentModalSessionCached; NSModalSession currentModalSession(); - void updateChildrenWorksWhenModal(); void temporarilyStopAllModalSessions(); void beginModalSession(QWindow *widget); void endModalSession(QWindow *widget); diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index b0f2b6d940..b944c3d28c 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -672,45 +672,6 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession() return currentModalSessionCached; } -static void setChildrenWorksWhenModal(QWindow *window, bool worksWhenModal) -{ - Q_UNUSED(window) - Q_UNUSED(worksWhenModal) - - // For NSPanels (but not NSWindows, sadly), we can set the flag - // worksWhenModal, so that they are active even when they are not modal. -/* - ### not ported - QList dialogs = window->findChildren(); - for (int i=0; i(window) setWorksWhenModal:worksWhenModal]; - if (worksWhenModal && [window isVisible]){ - [window orderFront:window]; - } - } - } -*/ -} - -void QCocoaEventDispatcherPrivate::updateChildrenWorksWhenModal() -{ - // Make the dialog children of the window - // active. And make the dialog children of - // the previous modal dialog unactive again: - QMacAutoReleasePool pool; - int size = cocoaModalSessionStack.size(); - if (size > 0){ - if (QWindow *prevModal = cocoaModalSessionStack[size-1].window) - setChildrenWorksWhenModal(prevModal, true); - if (size > 1){ - if (QWindow *prevModal = cocoaModalSessionStack[size-2].window) - setChildrenWorksWhenModal(prevModal, false); - } - } -} - void QCocoaEventDispatcherPrivate::cleanupModalSessions() { // Go through the list of modal sessions, and end those @@ -743,7 +704,6 @@ void QCocoaEventDispatcherPrivate::cleanupModalSessions() cocoaModalSessionStack.remove(i); } - updateChildrenWorksWhenModal(); cleanupModalSessionsNeeded = false; } @@ -764,7 +724,6 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window) // stopped in cleanupModalSessions()). QCocoaModalSessionInfo info = {window, nullptr, nullptr}; cocoaModalSessionStack.push(info); - updateChildrenWorksWhenModal(); currentModalSessionCached = nullptr; } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ec7ad38be5..5a26f57c8c 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -367,23 +367,19 @@ void QCocoaWindow::setVisible(bool visible) [m_view.window orderFront:nil]; } - // We want the events to properly reach the popup, dialog, and tool - if ((window()->type() == Qt::Popup || window()->type() == Qt::Dialog || window()->type() == Qt::Tool) - && [m_view.window isKindOfClass:[NSPanel class]]) { - ((NSPanel *)m_view.window).worksWhenModal = YES; - if (!(parentCocoaWindow && window()->transientParent()->isActive()) && window()->type() == Qt::Popup) { - removeMonitor(); - NSEventMask eventMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown - | NSEventMaskOtherMouseDown | NSEventMaskMouseMoved; - monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *e) { - const auto button = cocoaButton2QtButton(e); - const auto buttons = currentlyPressedMouseButtons(); - const auto eventType = cocoaEvent2QtMouseEvent(e); - const auto globalPoint = QCocoaScreen::mapFromNative(NSEvent.mouseLocation); - const auto localPoint = window()->mapFromGlobal(globalPoint.toPoint()); - QWindowSystemInterface::handleMouseEvent(window(), localPoint, globalPoint, buttons, button, eventType); - }]; - } + // Close popup when clicking outside it + if (window()->type() == Qt::Popup && !(parentCocoaWindow && window()->transientParent()->isActive())) { + removeMonitor(); + NSEventMask eventMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown + | NSEventMaskOtherMouseDown | NSEventMaskMouseMoved; + monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *e) { + const auto button = cocoaButton2QtButton(e); + const auto buttons = currentlyPressedMouseButtons(); + const auto eventType = cocoaEvent2QtMouseEvent(e); + const auto globalPoint = QCocoaScreen::mapFromNative(NSEvent.mouseLocation); + const auto localPoint = window()->mapFromGlobal(globalPoint.toPoint()); + QWindowSystemInterface::handleMouseEvent(window(), localPoint, globalPoint, buttons, button, eventType); + }]; } } } diff --git a/src/plugins/platforms/cocoa/qnswindow.h b/src/plugins/platforms/cocoa/qnswindow.h index 64f1ed0802..dcbcd58901 100644 --- a/src/plugins/platforms/cocoa/qnswindow.h +++ b/src/plugins/platforms/cocoa/qnswindow.h @@ -62,6 +62,7 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow) @protocol QNSWindowProtocol @optional - (BOOL)canBecomeKeyWindow; +- (BOOL)worksWhenModal; - (void)sendEvent:(NSEvent*)theEvent; - (void)closeAndRelease; - (void)dealloc; diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index c17ad47aba..28a9fa8607 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -177,6 +177,19 @@ static bool isMouseEvent(NSEvent *ev) return canBecomeMain; } +- (BOOL)worksWhenModal +{ + if ([self isKindOfClass:[QNSPanel class]]) { + if (QCocoaWindow *pw = self.platformWindow) { + Qt::WindowType type = pw->window()->type(); + if (type == Qt::Popup || type == Qt::Dialog || type == Qt::Tool) + return YES; + } + } + + return qt_objcDynamicSuper(); +} + - (BOOL)isOpaque { return self.platformWindow ? From 6273b484b35479eb5788425c8d90acacdf239623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Feb 2019 20:55:31 +0100 Subject: [PATCH 9/9] macOS: Remove redundant tracking of modal sessions in QCocoaWindow Change-Id: I43a40889b0731e4b480155256fc51eaa836e62a3 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoaeventdispatcher.h | 1 + src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoawindow.h | 1 - src/plugins/platforms/cocoa/qcocoawindow.mm | 9 +++------ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index 44a9c52b7b..9771cd0289 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -171,6 +171,7 @@ public: void temporarilyStopAllModalSessions(); void beginModalSession(QWindow *widget); void endModalSession(QWindow *widget); + bool hasModalSession() const; void cleanupModalSessions(); void cancelWaitForMoreEvents(); diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index b944c3d28c..84ffadea83 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -672,6 +672,11 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession() return currentModalSessionCached; } +bool QCocoaEventDispatcherPrivate::hasModalSession() const +{ + return !cocoaModalSessionStack.isEmpty(); +} + void QCocoaEventDispatcherPrivate::cleanupModalSessions() { // Go through the list of modal sessions, and end those diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 0a913ef66e..fef72bc496 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -253,7 +253,6 @@ public: // for QNSView bool m_needsInvalidateShadow; - bool m_hasModalSession; bool m_frameStrutEventsEnabled; QRect m_exposedRect; int m_registerTouchCount; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 5a26f57c8c..2718dc9600 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -153,7 +153,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle) , m_inSetStyleMask(false) , m_menubar(nullptr) , m_needsInvalidateShadow(false) - , m_hasModalSession(false) , m_frameStrutEventsEnabled(false) , m_registerTouchCount(0) , m_resizableTransientParent(false) @@ -360,8 +359,7 @@ void QCocoaWindow::setVisible(bool visible) } else if (window()->modality() == Qt::ApplicationModal) { // Show the window as application modal eventDispatcher()->beginModalSession(window()); - m_hasModalSession = true; - } else if (m_view.window.canBecomeKeyWindow && eventDispatcher()->cocoaModalSessionStack.isEmpty()) { + } else if (m_view.window.canBecomeKeyWindow && !eventDispatcher()->hasModalSession()) { [m_view.window makeKeyAndOrderFront:nil]; } else { [m_view.window orderFront:nil]; @@ -393,9 +391,8 @@ void QCocoaWindow::setVisible(bool visible) } else { // Window not visible, hide it if (isContentView()) { - if (m_hasModalSession) { + if (eventDispatcher()->hasModalSession()) { eventDispatcher()->endModalSession(window()); - m_hasModalSession = false; } else { if ([m_view.window isSheet]) { Q_ASSERT_X(parentCocoaWindow, "QCocoaWindow", "Window modal dialog has no transient parent."); @@ -405,7 +402,7 @@ void QCocoaWindow::setVisible(bool visible) [m_view.window orderOut:nil]; - if (m_view.window == [NSApp keyWindow] && !eventDispatcher()->currentModalSession()) { + if (m_view.window == [NSApp keyWindow] && !eventDispatcher()->hasModalSession()) { // Probably because we call runModalSession: outside [NSApp run] in QCocoaEventDispatcher // (e.g., when show()-ing a modal QDialog instead of exec()-ing it), it can happen that // the current NSWindow is still key after being ordered out. Then, after checking we