From da6a706eb31f1505edfaeefefc1adfb65ea6d893 Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Sun, 21 Dec 2014 06:36:24 +0530 Subject: [PATCH 01/68] fix error when cross-compiling with --system-zlib This is broken since 1f461ac45bfa8887261510a95fb33a346d68eaba, where Z_PREFIX was defined to namespace the bundled zlib symbols. The bundled zlib is used by bootstrap.pro when cross-compiling which uses the namespaced symbols. This breaks linking of rcc when --system-zlib is used, as it will try to link to compress2 instead of z_compress2. To fix this, the aliases are pulled in via zconf.h and the bundled zlib is prepended to the INCLUDEPATH (i.e. before the system zlib). Change-Id: Iec76cbdead40f888e2ac6a887ec8f3b7bc7db501 Reviewed-by: Oswald Buddenhagen --- src/3rdparty/zlib.pri | 2 +- src/corelib/tools/qbytearray.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/zlib.pri b/src/3rdparty/zlib.pri index a7073d5c3a..868d1c71bb 100644 --- a/src/3rdparty/zlib.pri +++ b/src/3rdparty/zlib.pri @@ -1,5 +1,5 @@ wince*: DEFINES += NO_ERRNO_H -INCLUDEPATH += $$PWD/zlib +INCLUDEPATH = $$PWD/zlib $$INCLUDEPATH SOURCES+= \ $$PWD/zlib/adler32.c \ $$PWD/zlib/compress.c \ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d8b2efbef3..a3c1cc3907 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -43,6 +43,7 @@ #include #ifndef QT_NO_COMPRESS +#include #include #endif #include From 05b96ae5d7f4c42bce5b82a68139eb1f90bf1e10 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 6 Jan 2015 14:05:40 +0100 Subject: [PATCH 02/68] iOS: bump QMAKE_IOS_DEPLOYMENT_TARGET to 5.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AppStore validation requires deployment target to be at least 5.1.1 for 64-bit applications. Change-Id: I4d857ad983e6d4059f541bff523dd63479aca849 Reviewed-by: Tor Arne Vestbø --- mkspecs/macx-ios-clang/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index 0c083edf80..0dd761760c 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -7,7 +7,7 @@ CONFIG += app_bundle reduce_exports incremental global_init_link QMAKE_INCREMENTAL_STYLE = sublib QMAKE_MACOSX_DEPLOYMENT_TARGET = -QMAKE_IOS_DEPLOYMENT_TARGET = 5.0 +QMAKE_IOS_DEPLOYMENT_TARGET = 5.1.1 INCLUDEPATH += $$PWD/ios DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG From 57949b5f2d1434fd935b94331dcf97a81663d6db Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 8 Jan 2015 09:57:10 +0200 Subject: [PATCH 03/68] Android: Fix qimagewriter test. We must add all test data to resources. Write output data into a writable location. Change-Id: I5a1c212f6108abf2a82288a2c84cfb31eda5e101 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../gui/image/qimagewriter/qimagewriter.pro | 2 +- .../gui/image/qimagewriter/qimagewriter.qrc | 16 ++++++++++ .../image/qimagewriter/tst_qimagewriter.cpp | 30 +++++++++++-------- 3 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 tests/auto/gui/image/qimagewriter/qimagewriter.qrc diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index f77ff0659b..ce6707ec92 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -5,5 +5,5 @@ SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 - +android:!android-no-sdk:RESOURCES+= qimagewriter.qrc TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.qrc b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc new file mode 100644 index 0000000000..29b036e303 --- /dev/null +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc @@ -0,0 +1,16 @@ + + + images/beavis.jpg + images/colorful.bmp + images/earth.gif + images/font.bmp + images/gnus.xbm + images/kollada.png + images/marble.xpm + images/ship63.pbm + images/teapot.ppm + images/trolltech.gif + images/YCbCr_cmyk.jpg + images/YCbCr_rgb.jpg + + diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 7e826310a1..f1045a8cf7 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -90,6 +90,7 @@ private slots: void saveToTemporaryFile(); private: QString prefix; + QString writePrefix; }; // helper to skip an autotest when the given image format is not supported @@ -114,6 +115,11 @@ void tst_QImageWriter::initTestCase() prefix = QFINDTESTDATA("images/"); if (prefix.isEmpty()) QFAIL("Can't find images directory!"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + writePrefix = QDir::homePath(); +#else + writePrefix = prefix; +#endif } // Testing get/set functions @@ -212,7 +218,7 @@ void tst_QImageWriter::writeImage() QVERIFY2(!image.isNull(), qPrintable(reader.errorString())); } { - QImageWriter writer(prefix + "gen-" + fileName, format); + QImageWriter writer(writePrefix + "gen-" + fileName, format); QVERIFY(writer.write(image)); } @@ -224,11 +230,11 @@ void tst_QImageWriter::writeImage() #endif if (!skip) { // Shouldn't be able to write to read-only file - QFile sourceFile(prefix + "gen-" + fileName); + QFile sourceFile(writePrefix + "gen-" + fileName); QFile::Permissions permissions = sourceFile.permissions(); QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); - QImageWriter writer(prefix + "gen-" + fileName, format); + QImageWriter writer(writePrefix + "gen-" + fileName, format); QVERIFY(!writer.write(image)); QVERIFY(sourceFile.setPermissions(permissions)); @@ -237,7 +243,7 @@ void tst_QImageWriter::writeImage() QImage image2; { - QImageReader reader(prefix + "gen-" + fileName); + QImageReader reader(writePrefix + "gen-" + fileName); image2 = reader.read(); QVERIFY(!image2.isNull()); } @@ -456,7 +462,7 @@ void tst_QImageWriter::supportsOption() << QImageIOHandler::Animation << QImageIOHandler::BackgroundColor; - QImageWriter writer(prefix + fileName); + QImageWriter writer(writePrefix + fileName); for (int i = 0; i < options.size(); ++i) { QVERIFY(writer.supportsOption(QImageIOHandler::ImageOption(options.at(i)))); allOptions.remove(QImageIOHandler::ImageOption(options.at(i))); @@ -472,13 +478,13 @@ void tst_QImageWriter::saveWithNoFormat_data() QTest::addColumn("format"); QTest::addColumn("error"); - QTest::newRow("garble") << prefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError; - QTest::newRow("bmp") << prefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0); - QTest::newRow("xbm") << prefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0); - QTest::newRow("xpm") << prefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0); - QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); - QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); - QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); + QTest::newRow("garble") << writePrefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError; + QTest::newRow("bmp") << writePrefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0); + QTest::newRow("xbm") << writePrefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0); + QTest::newRow("xpm") << writePrefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0); + QTest::newRow("png") << writePrefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); + QTest::newRow("ppm") << writePrefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); + QTest::newRow("pbm") << writePrefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); } void tst_QImageWriter::saveWithNoFormat() From 954d355fbcf901587a4dd177fe176cc2131ec4a0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Jan 2015 15:53:03 +0100 Subject: [PATCH 04/68] Android: Fix QPainter autotest The testdata needs to be in a qrc to be available on Android. Note that a single test will still fail. Since this requires a platform-independent fix, it will be committed separately. Change-Id: Ib2438a3298d81d77b7f4f240ef045aa0500d8382 Reviewed-by: BogDan Vatra --- tests/auto/gui/painting/qpainter/qpainter.pro | 5 + tests/auto/gui/painting/qpainter/testdata.qrc | 186 ++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 tests/auto/gui/painting/qpainter/testdata.qrc diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 752f9be1f4..7e9d438e1b 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -10,3 +10,8 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/gui/painting/qpainter/testdata.qrc b/tests/auto/gui/painting/qpainter/testdata.qrc new file mode 100644 index 0000000000..a7b8c222e5 --- /dev/null +++ b/tests/auto/gui/painting/qpainter/testdata.qrc @@ -0,0 +1,186 @@ + + + task217400.png + drawEllipse/10x10SizeAt0x0.png + drawEllipse/10x10SizeAt100x100.png + drawEllipse/10x10SizeAt200x200.png + drawEllipse/13x100SizeAt0x0.png + drawEllipse/13x100SizeAt100x100.png + drawEllipse/13x100SizeAt200x200.png + drawEllipse/200x200SizeAt0x0.png + drawEllipse/200x200SizeAt100x100.png + drawEllipse/200x200SizeAt200x200.png + drawLine_rop_bitmap/dst.xbm + drawLine_rop_bitmap/res/res_AndNotROP.xbm + drawLine_rop_bitmap/res/res_AndROP.xbm + drawLine_rop_bitmap/res/res_ClearROP.xbm + drawLine_rop_bitmap/res/res_CopyROP.xbm + drawLine_rop_bitmap/res/res_NandROP.xbm + drawLine_rop_bitmap/res/res_NopROP.xbm + drawLine_rop_bitmap/res/res_NorROP.xbm + drawLine_rop_bitmap/res/res_NotAndROP.xbm + drawLine_rop_bitmap/res/res_NotCopyROP.xbm + drawLine_rop_bitmap/res/res_NotOrROP.xbm + drawLine_rop_bitmap/res/res_NotROP.xbm + drawLine_rop_bitmap/res/res_NotXorROP.xbm + drawLine_rop_bitmap/res/res_OrNotROP.xbm + drawLine_rop_bitmap/res/res_OrROP.xbm + drawLine_rop_bitmap/res/res_SetROP.xbm + drawLine_rop_bitmap/res/res_XorROP.xbm + drawPixmap_rop/dst1.png + drawPixmap_rop/dst2.png + drawPixmap_rop/dst3.png + drawPixmap_rop/src1.xbm + drawPixmap_rop/src2-mask.xbm + drawPixmap_rop/src2.xbm + drawPixmap_rop/src3.xbm + drawPixmap_rop/res/res_AndNotROP0.png + drawPixmap_rop/res/res_AndNotROP1.png + drawPixmap_rop/res/res_AndNotROP2.png + drawPixmap_rop/res/res_AndNotROP3.png + drawPixmap_rop/res/res_AndNotROP4.png + drawPixmap_rop/res/res_AndNotROP5.png + drawPixmap_rop/res/res_AndNotROP6.png + drawPixmap_rop/res/res_AndNotROP7.png + drawPixmap_rop/res/res_AndROP0.png + drawPixmap_rop/res/res_AndROP1.png + drawPixmap_rop/res/res_AndROP2.png + drawPixmap_rop/res/res_AndROP3.png + drawPixmap_rop/res/res_AndROP4.png + drawPixmap_rop/res/res_AndROP5.png + drawPixmap_rop/res/res_AndROP6.png + drawPixmap_rop/res/res_AndROP7.png + drawPixmap_rop/res/res_ClearROP0.png + drawPixmap_rop/res/res_ClearROP1.png + drawPixmap_rop/res/res_ClearROP2.png + drawPixmap_rop/res/res_ClearROP3.png + drawPixmap_rop/res/res_ClearROP4.png + drawPixmap_rop/res/res_ClearROP5.png + drawPixmap_rop/res/res_ClearROP6.png + drawPixmap_rop/res/res_ClearROP7.png + drawPixmap_rop/res/res_CopyROP0.png + drawPixmap_rop/res/res_CopyROP1.png + drawPixmap_rop/res/res_CopyROP2.png + drawPixmap_rop/res/res_CopyROP3.png + drawPixmap_rop/res/res_CopyROP4.png + drawPixmap_rop/res/res_CopyROP5.png + drawPixmap_rop/res/res_CopyROP6.png + drawPixmap_rop/res/res_CopyROP7.png + drawPixmap_rop/res/res_NandROP0.png + drawPixmap_rop/res/res_NandROP1.png + drawPixmap_rop/res/res_NandROP2.png + drawPixmap_rop/res/res_NandROP3.png + drawPixmap_rop/res/res_NandROP4.png + drawPixmap_rop/res/res_NandROP5.png + drawPixmap_rop/res/res_NandROP6.png + drawPixmap_rop/res/res_NandROP7.png + drawPixmap_rop/res/res_NopROP0.png + drawPixmap_rop/res/res_NopROP1.png + drawPixmap_rop/res/res_NopROP2.png + drawPixmap_rop/res/res_NopROP3.png + drawPixmap_rop/res/res_NopROP4.png + drawPixmap_rop/res/res_NopROP5.png + drawPixmap_rop/res/res_NopROP6.png + drawPixmap_rop/res/res_NopROP7.png + drawPixmap_rop/res/res_NorROP0.png + drawPixmap_rop/res/res_NorROP1.png + drawPixmap_rop/res/res_NorROP2.png + drawPixmap_rop/res/res_NorROP3.png + drawPixmap_rop/res/res_NorROP4.png + drawPixmap_rop/res/res_NorROP5.png + drawPixmap_rop/res/res_NorROP6.png + drawPixmap_rop/res/res_NorROP7.png + drawPixmap_rop/res/res_NotAndROP0.png + drawPixmap_rop/res/res_NotAndROP1.png + drawPixmap_rop/res/res_NotAndROP2.png + drawPixmap_rop/res/res_NotAndROP3.png + drawPixmap_rop/res/res_NotAndROP4.png + drawPixmap_rop/res/res_NotAndROP5.png + drawPixmap_rop/res/res_NotAndROP6.png + drawPixmap_rop/res/res_NotAndROP7.png + drawPixmap_rop/res/res_NotCopyROP0.png + drawPixmap_rop/res/res_NotCopyROP1.png + drawPixmap_rop/res/res_NotCopyROP2.png + drawPixmap_rop/res/res_NotCopyROP3.png + drawPixmap_rop/res/res_NotCopyROP4.png + drawPixmap_rop/res/res_NotCopyROP5.png + drawPixmap_rop/res/res_NotCopyROP6.png + drawPixmap_rop/res/res_NotCopyROP7.png + drawPixmap_rop/res/res_NotOrROP0.png + drawPixmap_rop/res/res_NotOrROP1.png + drawPixmap_rop/res/res_NotOrROP2.png + drawPixmap_rop/res/res_NotOrROP3.png + drawPixmap_rop/res/res_NotOrROP4.png + drawPixmap_rop/res/res_NotOrROP5.png + drawPixmap_rop/res/res_NotOrROP6.png + drawPixmap_rop/res/res_NotOrROP7.png + drawPixmap_rop/res/res_NotROP0.png + drawPixmap_rop/res/res_NotROP1.png + drawPixmap_rop/res/res_NotROP2.png + drawPixmap_rop/res/res_NotROP3.png + drawPixmap_rop/res/res_NotROP4.png + drawPixmap_rop/res/res_NotROP5.png + drawPixmap_rop/res/res_NotROP6.png + drawPixmap_rop/res/res_NotROP7.png + drawPixmap_rop/res/res_NotXorROP0.png + drawPixmap_rop/res/res_NotXorROP1.png + drawPixmap_rop/res/res_NotXorROP2.png + drawPixmap_rop/res/res_NotXorROP3.png + drawPixmap_rop/res/res_NotXorROP4.png + drawPixmap_rop/res/res_NotXorROP5.png + drawPixmap_rop/res/res_NotXorROP6.png + drawPixmap_rop/res/res_NotXorROP7.png + drawPixmap_rop/res/res_OrNotROP0.png + drawPixmap_rop/res/res_OrNotROP1.png + drawPixmap_rop/res/res_OrNotROP2.png + drawPixmap_rop/res/res_OrNotROP3.png + drawPixmap_rop/res/res_OrNotROP4.png + drawPixmap_rop/res/res_OrNotROP5.png + drawPixmap_rop/res/res_OrNotROP6.png + drawPixmap_rop/res/res_OrNotROP7.png + drawPixmap_rop/res/res_OrROP0.png + drawPixmap_rop/res/res_OrROP1.png + drawPixmap_rop/res/res_OrROP2.png + drawPixmap_rop/res/res_OrROP3.png + drawPixmap_rop/res/res_OrROP4.png + drawPixmap_rop/res/res_OrROP5.png + drawPixmap_rop/res/res_OrROP6.png + drawPixmap_rop/res/res_OrROP7.png + drawPixmap_rop/res/res_SetROP0.png + drawPixmap_rop/res/res_SetROP1.png + drawPixmap_rop/res/res_SetROP2.png + drawPixmap_rop/res/res_SetROP3.png + drawPixmap_rop/res/res_SetROP4.png + drawPixmap_rop/res/res_SetROP5.png + drawPixmap_rop/res/res_SetROP6.png + drawPixmap_rop/res/res_SetROP7.png + drawPixmap_rop/res/res_XorROP0.png + drawPixmap_rop/res/res_XorROP1.png + drawPixmap_rop/res/res_XorROP2.png + drawPixmap_rop/res/res_XorROP3.png + drawPixmap_rop/res/res_XorROP4.png + drawPixmap_rop/res/res_XorROP5.png + drawPixmap_rop/res/res_XorROP6.png + drawPixmap_rop/res/res_XorROP7.png + drawPixmap_rop_bitmap/dst.xbm + drawPixmap_rop_bitmap/src1-mask.xbm + drawPixmap_rop_bitmap/src1.xbm + drawPixmap_rop_bitmap/src2.xbm + drawPixmap_rop_bitmap/res/res_AndNotROP.xbm + drawPixmap_rop_bitmap/res/res_AndROP.xbm + drawPixmap_rop_bitmap/res/res_ClearROP.xbm + drawPixmap_rop_bitmap/res/res_CopyROP.xbm + drawPixmap_rop_bitmap/res/res_NandROP.xbm + drawPixmap_rop_bitmap/res/res_NopROP.xbm + drawPixmap_rop_bitmap/res/res_NorROP.xbm + drawPixmap_rop_bitmap/res/res_NotAndROP.xbm + drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm + drawPixmap_rop_bitmap/res/res_NotOrROP.xbm + drawPixmap_rop_bitmap/res/res_NotROP.xbm + drawPixmap_rop_bitmap/res/res_NotXorROP.xbm + drawPixmap_rop_bitmap/res/res_OrNotROP.xbm + drawPixmap_rop_bitmap/res/res_OrROP.xbm + drawPixmap_rop_bitmap/res/res_SetROP.xbm + drawPixmap_rop_bitmap/res/res_XorROP.xbm + + From 7ad75cd8ef7e95bba3cfc694b7baffbc445bd2b0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 19 Dec 2014 14:34:46 +0100 Subject: [PATCH 05/68] Android: Fix QTemporaryFile tests Fixed a few instances of files that should be deployed to the file system. The way we do this on Android is via qrc. We also need a special case for the resources/test.txt, because QFINDTESTDATA will find this in qrc, but that's not the one we are looking for. Change-Id: I7097e8b7795b3a8fd483adad090208f295478412 Reviewed-by: BogDan Vatra --- .../io/qtemporaryfile/android_testdata.qrc | 6 +++ .../io/qtemporaryfile/qtemporaryfile.pro | 6 ++- .../io/qtemporaryfile/tst_qtemporaryfile.cpp | 45 +++++++++++++++---- 3 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc diff --git a/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc new file mode 100644 index 0000000000..f30290c262 --- /dev/null +++ b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc @@ -0,0 +1,6 @@ + + + tst_qtemporaryfile.cpp + resources/test.txt + + diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index 8a91340e5f..c16a729ad0 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,4 +5,8 @@ QT = core testlib SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -RESOURCES += qtemporaryfile.qrc \ No newline at end of file +RESOURCES += qtemporaryfile.qrc + +android:!android-no-sdk { + RESOURCES += android_testdata.qrc +} diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index a08a0ae777..29a3c4e18a 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -92,6 +92,24 @@ void tst_QTemporaryFile::initTestCase() // For QTBUG_4796 QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); + +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString sourceDir(":/android_testdata/"); + QDirIterator it(sourceDir, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo sourceFileInfo = it.fileInfo(); + if (!sourceFileInfo.isDir()) { + QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length())); + + if (!destinationFileInfo.exists()) { + QVERIFY(QDir().mkpath(destinationFileInfo.path())); + QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath())); + } + } + } +#endif } void tst_QTemporaryFile::cleanupTestCase() @@ -253,20 +271,21 @@ void tst_QTemporaryFile::autoRemove() QVERIFY(!QFile::exists(fileName)); } +struct ChdirOnReturn +{ + ChdirOnReturn(const QString& d) : dir(d) {} + ~ChdirOnReturn() { + QDir::setCurrent(dir); + } + QString dir; +}; + void tst_QTemporaryFile::nonWritableCurrentDir() { #ifdef Q_OS_UNIX if (::geteuid() == 0) QSKIP("not valid running this test as root"); - struct ChdirOnReturn - { - ChdirOnReturn(const QString& d) : dir(d) {} - ~ChdirOnReturn() { - QDir::setCurrent(dir); - } - QString dir; - }; ChdirOnReturn cor(QDir::currentPath()); #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) @@ -443,6 +462,12 @@ void tst_QTemporaryFile::rename() void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX + +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + ChdirOnReturn cor(QDir::currentPath()); + QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); +# endif + const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__)); QVERIFY(!sourceFile.isEmpty()); // Test this on Unix only @@ -646,7 +671,11 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn("valid"); QTest::addColumn("content"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); +#else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); +#endif QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray(); QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray(); From d056618d685bd93d57538b703f25d8cb35d91aed Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Jan 2015 15:41:05 +0100 Subject: [PATCH 06/68] Make sure widget is polished before checking its font QWidget is polished when show() is called, so unless you do this first, QWidget::font() will return a default constructed QFont, and not necessarily the default specified in the platform theme. Comparing this to QPainter::font() later, which has been resolved against the platform theme font, and not the default constructed font, you can get a mismatch and a false test failure. This happened on Android. Change-Id: I41ef5b10879bbd4bb8ef8d52ecaccf5e8e894075 Reviewed-by: Gunnar Sletta --- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 41ceebb646..8a0705630d 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -730,6 +730,7 @@ void tst_QPainter::initFrom() pal.setColor(QPalette::Foreground, QColor(255, 0, 0)); pal.setBrush(QPalette::Background, QColor(0, 255, 0)); widget->setPalette(pal); + widget->show(); QFont font = widget->font(); font.setPointSize(26); From 14c94240f9d7d630873dc402d787c0fe4a7b38bd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Jan 2015 20:27:47 +0100 Subject: [PATCH 07/68] Android: Fix some QStyle tests This adds the testdata to a qrc to make them available on Android. There are still some failures which might be actual errors, and which will be addressed separately. Change-Id: I1bdcfb2c6676134ca52388d49a1b2d25cf2813f9 Reviewed-by: BogDan Vatra --- tests/auto/widgets/styles/qstyle/qstyle.pro | 5 +++++ tests/auto/widgets/styles/qstyle/testdata.qrc | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/auto/widgets/styles/qstyle/testdata.qrc diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 4d18971cc6..b4546aa760 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -10,3 +10,8 @@ wince* { addPixmap.path = . DEPLOYMENT += addPixmap } + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/styles/qstyle/testdata.qrc b/tests/auto/widgets/styles/qstyle/testdata.qrc new file mode 100644 index 0000000000..c16b9be775 --- /dev/null +++ b/tests/auto/widgets/styles/qstyle/testdata.qrc @@ -0,0 +1,20 @@ + + + images/mac/button.png + images/mac/combobox.png + images/mac/lineedit.png + images/mac/mdi.png + images/mac/menu.png + images/mac/radiobutton.png + images/mac/slider.png + images/mac/spinbox.png + images/vista/button.png + images/vista/combobox.png + images/vista/lineedit.png + images/vista/menu.png + images/vista/radiobutton.png + images/vista/slider.png + images/vista/spinbox.png + task_25863.png + + From c161197b5f749393e462015d0c5fdecad42127b5 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 8 Jan 2015 11:07:48 +0200 Subject: [PATCH 08/68] Android: Fix qimage test. We must add all test data to resources. Change-Id: I1b18415cd53a27bd23e51ac6b738d3ed94162ac9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/image/qimage/qimage.pro | 2 ++ tests/auto/gui/image/qimage/qimage.qrc | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/auto/gui/image/qimage/qimage.qrc diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 117e34653d..42280d3bd4 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -6,4 +6,6 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib contains(QT_CONFIG, c++11): CONFIG += c++11 +android:!android-no-sdk:RESOURCES+=qimage.qrc + TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/qimage.qrc b/tests/auto/gui/image/qimage/qimage.qrc new file mode 100644 index 0000000000..e5de27faf8 --- /dev/null +++ b/tests/auto/gui/image/qimage/qimage.qrc @@ -0,0 +1,22 @@ + + + images/image.bmp + images/image.gif + images/image.ico + images/image.jpg + images/image.pbm + images/image.pgm + images/image.png + images/image.ppm + images/image.xbm + images/image.xpm + images/jpeg_exif_orientation_value_1.jpg + images/jpeg_exif_orientation_value_2.jpg + images/jpeg_exif_orientation_value_3.jpg + images/jpeg_exif_orientation_value_4.jpg + images/jpeg_exif_orientation_value_5.jpg + images/jpeg_exif_orientation_value_6.jpg + images/jpeg_exif_orientation_value_7.jpg + images/jpeg_exif_orientation_value_8.jpg + + From 7ab513d539f34fe5183c93bc15c190970d468a74 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 19 Dec 2014 16:07:59 +0200 Subject: [PATCH 09/68] Android: Fix qpixmap test. Add all test data to resources. Change-Id: I31b0dbb7546a15151f64523c86bf8eb687ff9ec0 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/image/qpixmap/qpixmap.qrc | 28 +++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/auto/gui/image/qpixmap/qpixmap.qrc b/tests/auto/gui/image/qpixmap/qpixmap.qrc index 99fde61a29..3965622dba 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.qrc +++ b/tests/auto/gui/image/qpixmap/qpixmap.qrc @@ -1,5 +1,27 @@ - - + + + loadFromData/designer_argb32.png + loadFromData/designer_indexed8_no_alpha_animated.gif + loadFromData/designer_indexed8_no_alpha.gif + loadFromData/designer_indexed8_no_alpha.png + loadFromData/designer_indexed8_with_alpha_animated.gif + loadFromData/designer_indexed8_with_alpha.gif + loadFromData/designer_indexed8_with_alpha.png + loadFromData/designer_rgb32.jpg + loadFromData/designer_rgb32.png + convertFromImage/task31722_1/img1.png + convertFromImage/task31722_1/img2.png + convertFromToHICON/icon_8bpp_16x16.png + convertFromToHICON/icon_8bpp_32x32.png + convertFromToHICON/icon_8bpp_48x48.png + convertFromToHICON/icon_8bpp.ico + convertFromToHICON/icon_32bpp_16x16.png + convertFromToHICON/icon_32bpp_32x32.png + convertFromToHICON/icon_32bpp_48x48.png + convertFromToHICON/icon_32bpp_256x256.png + convertFromToHICON/icon_32bpp.ico + convertFromImage/task31722_0/img1.png + convertFromImage/task31722_0/img2.png images/designer.png images/dx_0_dy_0_50_50_100_100.png images/dx_0_dy_0_null.png @@ -25,5 +47,5 @@ images/dx_-128_dy_-128_x_y_w_h.png images/dx_128_dy_128_x_y_w_h.png images/dx_1_dy_0_null.png - + From e6699afbee77b853773579d29d78a1ade2a4ab2c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Jan 2015 15:19:07 +0100 Subject: [PATCH 10/68] Fix physical DPI and size for rotated screens on X11 Rotated screens would use the unrotated physical geometry, causing the calculated physical DPI to be completely wrong. In RandR, the output does not rotate, so the physical size is always for the unrotated display. The transformation is done on the crtc. http://www.x.org/releases/X11R7.6/doc/randrproto/randrproto.txt Task-number: QTBUG-43688 Change-Id: Ifde192fcc99a37d0bfd6d57b4cdeac124a054ca3 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge Reviewed-by: Uli Schlachter --- src/plugins/platforms/xcb/qxcbscreen.cpp | 22 +++++++++++++++++++++- src/plugins/platforms/xcb/qxcbscreen.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8bdedba8ac..73f27c7117 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -53,7 +53,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_screen(scr) , m_crtc(output ? output->crtc : 0) , m_outputName(outputName) - , m_sizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) + , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) , m_virtualSize(scr->width_in_pixels, scr->height_in_pixels) , m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters) , m_orientation(Qt::PrimaryOrientation) @@ -71,6 +71,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, updateGeometry(output ? output->timestamp : 0); updateRefreshRate(); + const int dpr = int(devicePixelRatio()); // On VNC, it can be that physical size is unknown while // virtual size is known (probably back-calculated from DPI and resolution) @@ -93,6 +94,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height()); qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height()); qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y()); + qDebug(" orientation....: %d", m_orientation); qDebug(" pixel ratio....: %d", m_devicePixelRatio); qDebug(" depth..........: %d", screen()->root_depth); qDebug(" white pixel....: %x", screen()->white_pixel); @@ -413,6 +415,24 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) if (crtc) { xGeometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height); xAvailableGeometry = xGeometry; + switch (crtc->rotation) { + case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal + m_orientation = Qt::LandscapeOrientation; + m_sizeMillimeters = m_outputSizeMillimeters; + break; + case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left + m_orientation = Qt::PortraitOrientation; + m_sizeMillimeters = m_outputSizeMillimeters.transposed(); + break; + case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted + m_orientation = Qt::InvertedLandscapeOrientation; + m_sizeMillimeters = m_outputSizeMillimeters; + break; + case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right + m_orientation = Qt::InvertedPortraitOrientation; + m_sizeMillimeters = m_outputSizeMillimeters.transposed(); + break; + } free(crtc); } } diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ca0aee2cc4..b9ee331104 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -111,6 +111,7 @@ private: xcb_screen_t *m_screen; xcb_randr_crtc_t m_crtc; QString m_outputName; + QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; QRect m_availableGeometry; From d62cd6508a54fbc7950b669c1bc966663d7c10b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 7 Jan 2015 13:44:34 +0100 Subject: [PATCH 11/68] iOS: Move implementation details of QIOSViewController to class extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I602d8f1c9f20d3bfed4db3405460021146b546d8 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosviewcontroller.h | 12 +++++------- src/plugins/platforms/ios/qiosviewcontroller.mm | 6 ++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index 586edd589d..684e06e030 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -35,15 +35,13 @@ class QIOSScreen; -@interface QIOSViewController : UIViewController { - QIOSScreen *m_screen; -} - -@property (nonatomic, assign) BOOL changingOrientation; -@property (nonatomic, assign) BOOL prefersStatusBarHidden; -@property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; +@interface QIOSViewController : UIViewController - (id)initWithQIOSScreen:(QIOSScreen *)screen; - (void)updateProperties; + +@property (nonatomic, assign) BOOL prefersStatusBarHidden; +@property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; + @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index f678f7e807..8f59d41509 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -119,6 +119,12 @@ // ------------------------------------------------------------------------- +@interface QIOSViewController () { + QIOSScreen *m_screen; +} +@property (nonatomic, assign) BOOL changingOrientation; +@end + @implementation QIOSViewController - (id)initWithQIOSScreen:(QIOSScreen *)screen From 5c5f43e95b8f56d2bdf34cf5c11aae9d5102f9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Thu, 8 Jan 2015 11:31:27 +0000 Subject: [PATCH 12/68] docs: Explain the limitations of QWidget::grabMouse() on Windows Because carbon is dead, I merged both OSX and Windows in the same note. Change-Id: I5d43c5fce30e187f63a1e3e5af688c344eb80d28 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c362530264..c99e15b9b8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12392,10 +12392,9 @@ static void releaseMouseGrabOfWidget(QWidget *widget) \note Only visible widgets can grab mouse input. If isVisible() returns \c false for a widget, that widget cannot call grabMouse(). - \note \b{(Mac OS X developers)} For \e Cocoa, calling - grabMouse() on a widget only works when the mouse is inside the - frame of that widget. For \e Carbon, it works outside the widget's - frame as well, like for Windows and X11. + \note On Windows, grabMouse() only works when the mouse is inside a window + owned by the process. + On OS X, grabMouse() only works when the mouse is inside the frame of that widget. \sa releaseMouse(), grabKeyboard(), releaseKeyboard() */ @@ -12416,7 +12415,7 @@ void QWidget::grabMouse() \warning Grabbing the mouse might lock the terminal. - \note \b{(Mac OS X developers)} See the note in QWidget::grabMouse(). + \note See the note in QWidget::grabMouse(). \sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor() */ From 95cb745e002c38e821b385e90d954adf73363e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 11 Dec 2013 14:37:19 +0100 Subject: [PATCH 13/68] iOS: Fix QWindow::reportContentOrientationChange on iOS6+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On iOS 6 and above, [UIViewController supportedInterfaceOrientations] needs to return 0 for [UIApplication setStatusBarOrientation] to work. This means once you report a content orientation other than the primary orientation, you'll disable auto-rotation. Reporting the orientation as Qt::PrimaryOrientation restores the auto-rotation behavior. Change-Id: I1b8c765c507728fdbc5b828e0b4215324014e221 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosscreen.mm | 17 ++++ .../platforms/ios/qiosviewcontroller.h | 4 + .../platforms/ios/qiosviewcontroller.mm | 93 ++++++++++++++++--- src/plugins/platforms/ios/qioswindow.mm | 19 +++- 4 files changed, 116 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 4af2a4965f..712bf0098b 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -46,6 +46,7 @@ #include #include "qiosapplicationdelegate.h" #include "qiosviewcontroller.h" +#include "quiview.h" #include @@ -244,6 +245,22 @@ void QIOSScreen::updateProperties() m_geometry = fromCGRect([rootView convertRect:m_uiScreen.bounds fromView:m_uiWindow]).toRect(); m_availableGeometry = fromCGRect([rootView convertRect:m_uiScreen.applicationFrame fromView:m_uiWindow]).toRect(); + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 && ![m_uiWindow.rootViewController shouldAutorotate]) { + // Setting the statusbar orientation (content orientation) on iOS8+ will result in the UIScreen + // updating its geometry and available geometry, which in the case of content orientation is not + // what we want. We want to reflect the screen geometry based on the locked orientation, and + // adjust the available geometry based on the repositioned status bar for the current status + // bar orientation. + + Qt::ScreenOrientation lockedOrientation = toQtScreenOrientation(UIDeviceOrientation(rootView.qtViewController.lockedOrientation)); + Qt::ScreenOrientation contenOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation)); + + QTransform transform = screen()->transformBetween(lockedOrientation, contenOrientation, m_geometry).inverted(); + + m_geometry = transform.mapRect(m_geometry); + m_availableGeometry = transform.mapRect(m_availableGeometry); + } + if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry) { const qreal millimetersPerInch = 25.4; m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index 684e06e030..df7ce0ff4a 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -40,6 +40,10 @@ class QIOSScreen; - (id)initWithQIOSScreen:(QIOSScreen *)screen; - (void)updateProperties; +@property (nonatomic, assign) UIInterfaceOrientation lockedOrientation; + +// UIViewController +@property (nonatomic, assign) BOOL shouldAutorotate; @property (nonatomic, assign) BOOL prefersStatusBarHidden; @property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 8f59d41509..0afd2bf8ba 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -153,6 +153,7 @@ #endif self.changingOrientation = NO; + self.shouldAutorotate = [super shouldAutorotate]; // Status bar may be initially hidden at startup through Info.plist self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false); @@ -179,6 +180,10 @@ [center addObserver:self selector:@selector(willChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:[UIApplication sharedApplication]]; + + [center addObserver:self selector:@selector(didChangeStatusBarOrientation:) + name:UIApplicationDidChangeStatusBarOrientationNotification + object:[UIApplication sharedApplication]]; } - (void)viewDidUnload @@ -189,19 +194,16 @@ // ------------------------------------------------------------------------- --(BOOL)shouldAutorotate -{ - // Until a proper orientation and rotation API is in place, we always auto rotate. - // If auto rotation is not wanted, you would need to switch it off manually from Info.plist. - return YES; -} - #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) -(NSUInteger)supportedInterfaceOrientations { - // We need to tell iOS that we support all orientations in order to set - // status bar orientation when application content orientation changes. - return UIInterfaceOrientationMaskAll; + // As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated: + // only works if the supportedInterfaceOrientations of the view controller is 0, making + // us responsible for ensuring that the status bar orientation is consistent. We enter + // this mode when auto-rotation is disabled due to an explicit content orientation being + // set on the focus window. Note that this is counter to what the documentation for + // supportedInterfaceOrientations says, which states that the method should not return 0. + return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0; } #endif @@ -209,7 +211,7 @@ -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { Q_UNUSED(interfaceOrientation); - return YES; + return [self shouldAutorotate]; } #endif @@ -256,6 +258,22 @@ }]; } +- (void)didChangeStatusBarOrientation:(NSNotification *)notification +{ + Q_UNUSED(notification); + + if (self.view.window.screen != [UIScreen mainScreen]) + return; + + // If the statusbar changes orientation due to auto-rotation we don't care, + // there will be re-layout anyways. Only if the statusbar changes due to + // reportContentOrientation, we need to update the window layout. + if (self.changingOrientation) + return; + + [self.view setNeedsLayout]; +} + - (void)viewWillLayoutSubviews { if (!QCoreApplication::instance()) @@ -287,6 +305,8 @@ // All decisions are based on the the top level window focusWindow = qt_window_private(focusWindow)->topLevelWindow(); + UIApplication *uiApplication = [UIApplication sharedApplication]; + bool currentStatusBarVisibility = self.prefersStatusBarHidden; self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen; @@ -297,13 +317,60 @@ } else #endif { - [[UIApplication sharedApplication] - setStatusBarHidden:self.prefersStatusBarHidden + [uiApplication setStatusBarHidden:self.prefersStatusBarHidden withAnimation:self.preferredStatusBarUpdateAnimation]; } [self.view setNeedsLayout]; } + + + // -------------- Content orientation --------------- + + static BOOL kAnimateContentOrientationChanges = YES; + + Qt::ScreenOrientation contentOrientation = focusWindow->contentOrientation(); + if (contentOrientation != Qt::PrimaryOrientation) { + // An explicit content orientation has been reported for the focus window, + // so we keep the status bar in sync with content orientation. This will ensure + // that the task bar (and associated gestures) are also rotated accordingly. + + if (self.shouldAutorotate) { + // We are moving from Qt::PrimaryOrientation to an explicit orientation, + // so we need to store the current statusbar orientation, as we need it + // later when mapping screen coordinates for QScreen and for returning + // to Qt::PrimaryOrientation. + self.lockedOrientation = uiApplication.statusBarOrientation; + + // Calling setStatusBarOrientation only has an effect when auto-rotation is + // disabled, which makes sense when there's an explicit content orientation. + self.shouldAutorotate = NO; + } + + [uiApplication setStatusBarOrientation: + UIInterfaceOrientation(fromQtScreenOrientation(contentOrientation)) + animated:kAnimateContentOrientationChanges]; + + } else { + // The content orientation is set to Qt::PrimaryOrientation, meaning + // that auto-rotation should be enabled. But we may be coming out of + // a state of locked orientation, which needs some cleanup before we + // can enable auto-rotation again. + if (!self.shouldAutorotate) { + // First we need to restore the statusbar to what it was at the + // time of locking the orientation, otherwise iOS will be very + // confused when it starts doing auto-rotation again. + [uiApplication setStatusBarOrientation: + UIInterfaceOrientation(self.lockedOrientation) + animated:kAnimateContentOrientationChanges]; + + // Then we can re-enable auto-rotation + self.shouldAutorotate = YES; + + // And finally let iOS rotate the root view to match the device orientation + [UIViewController attemptRotationToDeviceOrientation]; + } + } } #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 480062e4de..6c4614408d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -75,6 +75,15 @@ QIOSWindow::QIOSWindow(QWindow *window) setWindowState(window->windowState()); setOpacity(window->opacity()); + + Qt::ScreenOrientation initialOrientation = window->contentOrientation(); + if (initialOrientation != Qt::PrimaryOrientation) { + // Start up in portrait, then apply possible content orientation, + // as per Apple's documentation. + dispatch_async(dispatch_get_main_queue(), ^{ + handleContentOrientationChange(initialOrientation); + }); + } } QIOSWindow::~QIOSWindow() @@ -322,10 +331,12 @@ void QIOSWindow::updateWindowLevel() void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - // Keep the status bar in sync with content orientation. This will ensure - // that the task bar (and associated gestures) are aligned correctly: - UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation)); - [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO]; + // Update the QWindow representation straight away, so that + // we can update the statusbar orientation based on the new + // content orientation. + qt_window_private(window())->contentOrientation = orientation; + + [m_view.qtViewController updateProperties]; } void QIOSWindow::applicationStateChanged(Qt::ApplicationState) From 56a82e87e654fa9e77bee8956e94e08a77941e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 7 Jan 2015 15:14:17 +0100 Subject: [PATCH 14/68] iOS: Prevent recursion when updating/syncing QIOSViewController properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I22f1eaa892cba23c498ae210a9a483e468268581 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosviewcontroller.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 0afd2bf8ba..01bc84ae68 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -41,6 +41,8 @@ #import "qiosviewcontroller.h" +#include + #include #include #include @@ -121,6 +123,7 @@ @interface QIOSViewController () { QIOSScreen *m_screen; + BOOL m_updatingProperties; } @property (nonatomic, assign) BOOL changingOrientation; @end @@ -289,6 +292,15 @@ if (!isQtApplication()) return; + // Prevent recursion caused by updating the status bar appearance (position + // or visibility), which in turn may cause a layout of our subviews, and + // a reset of window-states, which themselves affect the view controller + // properties such as the statusbar visibilty. + if (m_updatingProperties) + return; + + QScopedValueRollback updateRollback(m_updatingProperties, YES); + QWindow *focusWindow = QGuiApplication::focusWindow(); // If we don't have a focus window we leave the statusbar From 099db090d5772439f13e7c0bfd8268923db5a87f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 13:39:54 +0100 Subject: [PATCH 15/68] Android: Fix QTextBoundaryFinder test Include test data on Android. Change-Id: I35c17618d84822df126fe3462a00d3d49b1377c8 Reviewed-by: BogDan Vatra --- .../tools/qtextboundaryfinder/qtextboundaryfinder.pro | 5 +++++ tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 498d8f9c40..29b9854ebb 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,3 +5,8 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc new file mode 100644 index 0000000000..0cc4ccaa57 --- /dev/null +++ b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc @@ -0,0 +1,8 @@ + + + data/GraphemeBreakTest.txt + data/LineBreakTest.txt + data/SentenceBreakTest.txt + data/WordBreakTest.txt + + From d30c446d35ae404f5a67421ac59e6f0997123321 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 13:26:06 +0100 Subject: [PATCH 16/68] Android: Fix QDataStream test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include test data on Android. Change-Id: Ic0890495c0bf8d2e38595585226a03073b043d57 Reviewed-by: Tony Sarajärvi Reviewed-by: BogDan Vatra --- tests/auto/corelib/io/qdatastream/qdatastream.pro | 5 +++++ tests/auto/corelib/io/qdatastream/testdata.qrc | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/io/qdatastream/testdata.qrc diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 25c29b83ee..9ab2b0948d 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,3 +5,8 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/io/qdatastream/testdata.qrc b/tests/auto/corelib/io/qdatastream/testdata.qrc new file mode 100644 index 0000000000..fb63cb3438 --- /dev/null +++ b/tests/auto/corelib/io/qdatastream/testdata.qrc @@ -0,0 +1,5 @@ + + + datastream.q42 + + From ccf50893e8086ae15db10296655db23364e55674 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Jan 2015 16:02:07 +0100 Subject: [PATCH 17/68] Skip incompatible QTextLayout tests when dpi-scaling is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On e.g. Android, the tabs will be scaled by DPI. This breaks the logic in the QTextLayout tests for tabs. It's not possible to just scale the expected sizes either, since the whole text layout will be affected by font sizes and scaling, and it's difficult to predict where characters will land on different platforms and resolutions. To avoid breaking this test on other platforms, we just skip them when we know they will break. Since the code tested is cross-platform, this will hopefully not have any significant impact on our coverage. Change-Id: I65d6c33c9c6724665983a17f99eadcf1baedcc20 Reviewed-by: Tony Sarajärvi Reviewed-by: BogDan Vatra --- .../gui/text/qtextlayout/tst_qtextlayout.cpp | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 4b2970cd17..4fa8575153 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1280,6 +1280,13 @@ void tst_QTextLayout::smallTextLengthWrapAtWordBoundaryOrAnywhere() void tst_QTextLayout::testDefaultTabs() { QTextLayout layout("Foo\tBar\ta slightly longer text\tend.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1322,6 +1329,13 @@ void tst_QTextLayout::testDefaultTabs() void tst_QTextLayout::testTabs() { QTextLayout layout("Foo\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); QTextOption option = layout.textOption(); option.setTabStop(150); @@ -1339,6 +1353,13 @@ void tst_QTextLayout::testTabs() void tst_QTextLayout::testMultilineTab() { QTextLayout layout("Lorem ipsum dolor sit\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // test if this works on the second line. layout.beginLayout(); @@ -1348,12 +1369,20 @@ void tst_QTextLayout::testMultilineTab() line.setLineWidth(220.); layout.endLayout(); + QCOMPARE(line.cursorToX(22), 80.); } void tst_QTextLayout::testMultiTab() { QTextLayout layout("Foo\t\t\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1367,6 +1396,13 @@ void tst_QTextLayout::testTabsInAlignedParag() { QTextLayout layout("Foo\tsome more words", testFont); layout.setCacheEnabled(true); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); // right option.setAlignment(Qt::AlignRight); @@ -1426,6 +1462,12 @@ void tst_QTextLayout::testRightTab() */ layout.setCacheEnabled(true); + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); QList tabs; QTextOption::Tab tab; @@ -1463,6 +1505,13 @@ void tst_QTextLayout::testRightTab() void tst_QTextLayout::testCenteredTab() { QTextLayout layout("Foo\tBar", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // test if centering the tab works. We expect the center of 'Bar.' to be at the tab point. QTextOption option = layout.textOption(); @@ -1484,6 +1533,13 @@ void tst_QTextLayout::testCenteredTab() void tst_QTextLayout::testDelimiterTab() { QTextLayout layout("Foo\tBar. Barrabas", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // try the different delimiter characters to see if the alignment works there. QTextOption option = layout.textOption(); @@ -1537,6 +1593,12 @@ void tst_QTextLayout::tabsForRtl() */ layout.setCacheEnabled(true); + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); QList tabs; QTextOption::Tab tab; From 8f095d67a0a28d28b463e80a398041989ccdeb88 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 9 Dec 2014 17:04:38 +0100 Subject: [PATCH 18/68] Fix glyph runs painted badly with perspective transform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A mismatch between requiresPretransformedGlyphPositions and shouldDrawCachedGlyphs in QRasterPaintEngine will cause the text position to be transformed twice when using drawGlyphRun on a QPainter with a perspective transform. Since this case falls back to drawing text as paths there is no reason to require any special treatment. Change-Id: Ib1c14aee4cc6774dd8feadc5748f0b0ee59633b9 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gunnar Sletta --- src/gui/painting/qpaintengineex.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 0c3ea37b29..f5e6f7cca6 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1075,9 +1075,9 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) } } -bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &t) const +bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const { - return t.type() >= QTransform::TxProject; + return false; } bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const From 2153ac61c921c8da3852ff018eec2279ee7d06f7 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 8 Jan 2015 11:09:36 +0100 Subject: [PATCH 19/68] Doc: add Qt Creator 3.3.1 pages to externalsites Change-Id: I9dd02f7fc1da30d68dca5983e5c9a0cba41bcab5 Reviewed-by: Martin Smith --- doc/global/externalsites/qtcreator.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index c2eed07c6d..c96920a689 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -391,6 +391,14 @@ \externalpage http://doc.qt.io/qtcreator/creator-project-wizards.html \title Qt Creator: Adding New Custom Wizards */ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-json.html + \title Qt Creator: Adding JSON-Based Wizards +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-xml.html + \title Qt Creator: Adding XML-Based Wizards +*/ /*! \externalpage http://doc.qt.io/qtcreator/creator-projects-autotools.html \title Qt Creator: Setting Up an Autotools Project From e0981a0d9e0330fe3a1c4f310e7c9877c341ba5d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 9 Jan 2015 15:12:19 +0100 Subject: [PATCH 20/68] QScreen manual test: use sizeHint; don't override QLineEdit text color The window size was too small on high-DPI screens. Save the default text color instead of setting it to black. Change-Id: I78b50624110be0cb1d077d3782d421eb323f4fb0 Reviewed-by: Paul Olav Tvete --- tests/manual/qscreen/main.cpp | 5 ++++- tests/manual/qscreen/propertyfield.cpp | 7 ++++--- tests/manual/qscreen/propertyfield.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index 487e95266b..dc1e0e08c0 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -80,8 +80,11 @@ void screenAdded(QScreen* screen) // But this works as long as the screens are all virtual siblings w->show(); QRect geom = w->geometry(); + geom.setSize(w->sizeHint()); + if (geom.height() > screen->geometry().height()) + geom.setHeight(screen->geometry().height() * 9 / 10); geom.moveCenter(screen->geometry().center()); - w->move(geom.topLeft()); + w->setGeometry(geom); props->insert(screen, w); diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp index e6392465f2..f1e5e22ec9 100644 --- a/tests/manual/qscreen/propertyfield.cpp +++ b/tests/manual/qscreen/propertyfield.cpp @@ -34,8 +34,9 @@ #include "propertyfield.h" #include -PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) : - QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) +PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) + : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) + , m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text)) { setReadOnly(true); if (prop.hasNotifySignal()) { @@ -99,7 +100,7 @@ void PropertyField::propertyChanged() setText(text); m_lastText = text; m_lastTextShowing = text; - modPalette.setBrush(QPalette::Text, Qt::black); + modPalette.setBrush(QPalette::Text, m_defaultBrush); } setPalette(modPalette); } diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h index 2738a215a6..f76ac7fc6b 100644 --- a/tests/manual/qscreen/propertyfield.h +++ b/tests/manual/qscreen/propertyfield.h @@ -63,6 +63,7 @@ private: QString m_lastTextShowing; QTime m_lastChangeTime; const QMetaProperty m_prop; + QBrush m_defaultBrush; }; #endif // PROPERTYFIELD_H From b077ed746ae91321ff9aa72ebd17a463bec98413 Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Wed, 7 Jan 2015 23:52:01 +0530 Subject: [PATCH 21/68] allow detection of static/shared target in the config tests It was not possible to determine whether Qt is being built as a shared or static library in the config tests, as that information was not added to QMAKE_CONFIG used in the compileTest function. For linking to ICU on Windows, there is logic which depends on it in config.tests/unix/icu/icu.pro, but was broken for the static target, as the expected library name was not found (icuXX -> sicuXX). Change-Id: I22c2d543ea14feebbad36961c9a29e99f66323ff Reviewed-by: Oswald Buddenhagen --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 31a59fc802..75fe189bef 100755 --- a/configure +++ b/configure @@ -3954,7 +3954,13 @@ compileTest() path=config.tests/$1 name=$2 shift 2 - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" + # allow config tests which behave differently depending on the type of + # library being built (shared/static) e.g. see config.tests/unix/icu + test_config="$QMAKE_CONFIG shared" + if [ "$CFG_SHARED" = "no" ]; then + test_config="$QMAKE_CONFIG static" + fi + "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" } #------------------------------------------------------------------------------- From 6e217f067800541ccb9596cf03d52093b2909385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 6 Jan 2015 18:13:27 +0000 Subject: [PATCH 22/68] QColorDialog: Don't loose focus while color picking On Windows mouse grabbing doesn't work across processes, which means we're interacting with other windows when picking colors. Workaround that by having a transparent 1x1 window below the cursor at all times so we catch the mouse click. Clicking before the window is below the cursor won't happen because our timer interval is 30ms, so it's quite fast. It's hacky but it's what we can do for a feature which was very broken on Windows. Task-number: QTBUG-43663 Change-Id: I295378e033ddc6d9c2230335f0953a727c21e1dd Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qcolordialog.cpp | 24 +++++++++++++++++++----- src/widgets/dialogs/qcolordialog_p.h | 6 ++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 882bb999fb..b133c49b5e 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1579,12 +1579,17 @@ void QColorDialogPrivate::_q_pickScreenColor() q->grabMouse(); #endif -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 // excludes WinCE and WinRT // On Windows mouse tracking doesn't work over other processes's windows updateTimer->start(30); + + // HACK: Because mouse grabbing doesn't work across processes, we have to have a dummy, + // invisible window to catch the mouse click, otherwise we will click whatever we clicked + // and loose focus. + dummyTransparentWindow.show(); #endif q->grabKeyboard(); - /* With setMouseTracking(true) the desired color can be more precisedly picked up, + /* With setMouseTracking(true) the desired color can be more precisely picked up, * and continuously pushing the mouse button is not necessary. */ q->setMouseTracking(true); @@ -1606,8 +1611,9 @@ void QColorDialogPrivate::releaseColorPicking() cp->setCrossVisible(true); q->removeEventFilter(colorPickingEventFilter); q->releaseMouse(); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 updateTimer->stop(); + dummyTransparentWindow.setVisible(false); #endif q->releaseKeyboard(); q->setMouseTracking(false); @@ -1635,6 +1641,10 @@ void QColorDialogPrivate::init(const QColor &initial) #ifdef Q_WS_MAC delegate = 0; #endif +#ifdef Q_OS_WIN32 + dummyTransparentWindow.resize(1, 1); + dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint); +#endif q->setCurrentColor(initial); } @@ -1791,7 +1801,7 @@ void QColorDialogPrivate::initWidgets() cancel = buttons->addButton(QDialogButtonBox::Cancel); QObject::connect(cancel, SIGNAL(clicked()), q, SLOT(reject())); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 updateTimer = new QTimer(q); QObject::connect(updateTimer, SIGNAL(timeout()), q, SLOT(_q_updateColorPicking())); #endif @@ -2219,8 +2229,12 @@ void QColorDialogPrivate::_q_updateColorPicking() return; lastGlobalPos = newGlobalPos; - if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called + if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) { // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called updateColorPicking(newGlobalPos); +#ifdef Q_OS_WIN32 + dummyTransparentWindow.setPosition(newGlobalPos); +#endif + } #endif // ! QT_NO_CURSOR } diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index 2b501522f5..9182b510f1 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -49,6 +49,7 @@ #include "private/qdialog_p.h" #include "qcolordialog.h" #include "qsharedpointer.h" +#include "qwindow.h" #ifndef QT_NO_COLORDIALOG @@ -77,7 +78,7 @@ public: }; QColorDialogPrivate() : options(new QColorDialogOptions) -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 , updateTimer(0) #endif {} @@ -143,8 +144,9 @@ public: QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 QTimer *updateTimer; + QWindow dummyTransparentWindow; #endif #ifdef Q_WS_MAC From 079adae309398b3c8670ebc45c1749e98e40ff53 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 20 Nov 2014 17:39:43 +0100 Subject: [PATCH 23/68] fix distclean for dynamic libraries again Task-number: QTBUG-40264 Change-Id: I1d28d2ef96c5c53274ca21c0ea3f416f0d9628dd Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8270f02feb..9165da4d38 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1019,8 +1019,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) -r " << bundlePath << endl; } else if(project->isActiveConfig("compile_libtool")) { t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n"; - } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() && - !project->isActiveConfig("plugin")) { + } else if (project->isActiveConfig("staticlib")) { + t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; + } else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; if (!project->isActiveConfig("unversioned_libname")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " @@ -1029,7 +1030,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) $(TARGETA)\n"; } } else { - t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; + t << "\t-$(DEL_FILE) $(TARGET) \n"; } t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n"); { From a19f1d320a5d97b08741ea51f8bda40747d11d71 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 Nov 2014 21:08:45 +0100 Subject: [PATCH 24/68] document QMAKE_CFLAGS Task-number: QTBUG-16577 Change-Id: I9ab76dc0715187e059c3403447c27929261bd064 Reviewed-by: Joerg Bornemann Reviewed-by: Leena Miettinen --- qmake/doc/src/qmake-manual.qdoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 202df7e03c..414b42d48e 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1464,6 +1464,15 @@ executable needs to be specified as long as it is on a path contained in the \c PATH variable when the Makefile is processed. + \section1 QMAKE_CFLAGS + + Specifies the C compiler flags for building + a project. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. The flags specific to debug and release modes can be + adjusted by modifying the \c QMAKE_CFLAGS_DEBUG and + \c QMAKE_CFLAGS_RELEASE variables, respectively. + \target QMAKE_CFLAGS_DEBUG \section1 QMAKE_CFLAGS_DEBUG From 4c3fdc01c40585e552dbef0b43d30c305289d88d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 Nov 2014 20:20:19 +0100 Subject: [PATCH 25/68] fix file separators in 'clean' targets Task-number: QTBUG-39690 Change-Id: Ibbed847258a3a7e21d6d10b9400af0001d10c6f8 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/winmakefile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 81bc16a3c6..663665897b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -537,12 +537,13 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const QString del_statement("-$(DEL_FILE)"); if(project->isActiveConfig("no_delete_multiple_files")) { for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) - t << "\n\t" << del_statement << " " << escapeFilePath((*it)); + t << "\n\t" << del_statement + << ' ' << escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); } else { QString files, file; const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { - file = " " + escapeFilePath((*it)); + file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); if(del_statement.length() + files.length() + qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { t << "\n\t" << del_statement << files; From 26547c0275a25d19ddbc53edd71b277f71c4de59 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Dec 2014 19:17:05 +0100 Subject: [PATCH 26/68] remove nonsensical conditional we are in an #else of #ifndef QT_BOOTSTRAPPED here already. Change-Id: I02c4ff2959490110c21ad1016c664b7ddcfea7c0 Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 7ca0aa7f0b..1f8de2e05d 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -128,9 +128,7 @@ QLibrarySettings::QLibrarySettings() settings.reset(0); #else } else { -#ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = false; -#endif haveEffectivePaths = false; havePaths = false; #endif From 44f8f2084b36960fd5e04636604b2e3416e8c947 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Dec 2014 19:19:05 +0100 Subject: [PATCH 27/68] de-duplicate and comment EffectivePaths presence detection Change-Id: Ibf9731c216df84c9e17ebd699d8349cc716ff3cc Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1f8de2e05d..4f9f54cde8 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -116,10 +116,11 @@ QLibrarySettings::QLibrarySettings() QStringList children = settings->childGroups(); #ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths")); - haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); #else - haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); + // EffectiveSourcePaths is for the Qt build only, so needs no backwards compat trickery. + bool haveEffectiveSourcePaths = false; #endif + haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); // Backwards compat: an existing but empty file is claimed to contain the Paths section. havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection))) || children.contains(QLatin1String("Paths")); From b25cfdce468c59305113b06c31473cbfaec1c139 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 7 Jan 2015 14:20:34 -0800 Subject: [PATCH 28/68] Fix compilation with MSVC 2010 2013 and 2015 compile this fine. I didn't test 2012. I wouldn't have fixed if the objective weren't to enable QtDBus by default on all architectures: since it is, we can't have Qt fail to compile from sources on MSVC 2010. qdbus_symbols.cpp(92) : fatal error C1001: An internal error has occurred in the compiler Change-Id: I42b930bc37c4e478a66725d83c8a73836fbf567c Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/dbus/qdbus_symbols.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp index e475a23f48..67643098d9 100644 --- a/src/dbus/qdbus_symbols.cpp +++ b/src/dbus/qdbus_symbols.cpp @@ -86,9 +86,9 @@ bool qdbus_loadLibDBus() static int majorversions[] = { 3, 2, -1 }; const QString baseNames[] = { #ifdef Q_OS_WIN - QStringLiteral("dbus-1"), + QLatin1String("dbus-1"), #endif - QStringLiteral("libdbus-1") + QLatin1String("libdbus-1") }; lib->unload(); From b9258717f4fb98a6a89c967fd3ddfe9b66a6e2f8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Dec 2014 14:21:55 -0800 Subject: [PATCH 29/68] Remove EXTRA_CPPFLAGS This is not used or referenced anywhere Change-Id: I02e1aa76631627f64e5d1f9b36a13cdb5677e93f Reviewed-by: Oswald Buddenhagen --- qmake/Makefile.win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index ebadd52f99..4a1347c954 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -42,7 +42,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS -CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS) +CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) CXXFLAGS = $(CFLAGS) From 8761b2b5d9f36395a52608ec853047fc6052e600 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 29 Oct 2014 13:21:22 -0700 Subject: [PATCH 30/68] Print some debugging information for pkg-config detection Commit d44781730ccd4d48af79f480813bf3f9a4000253 disabled use of pkg- config on Mac, which in turn automatically disables all of the tests that depend on pkg-config too, like D-Bus. If you then use the -dbus flag, configure would error out telling you that it couldn't find D-Bus, despite it being there. Now we print some helpful information on error and extra information for finding out why it may have got disabled. Change-Id: Ic4e41c58d62d80eb1a0f3ca1c93529e049aaf231 Reviewed-by: Oswald Buddenhagen --- configure | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure b/configure index 75fe189bef..5ad29bb784 100755 --- a/configure +++ b/configure @@ -3883,13 +3883,16 @@ fi if [ -z "$PKG_CONFIG" ]; then # See if PKG_CONFIG is set in the mkspec: PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`" + [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG" fi if [ -z "$PKG_CONFIG" ]; then PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null` + [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from \$PATH: $PKG_CONFIG" fi if [ "$CFG_PKGCONFIG" = "no" ]; then PKG_CONFIG= + [ "$OPT_VERBOSE" = "yes" ] && echo "pkg-config support disabled." elif [ "$CFG_PKGCONFIG" = "force" ]; then echo >&2 "" echo >&2 "You have asked to use pkg-config. Please make sure you have" @@ -4657,6 +4660,7 @@ if [ "$CFG_DBUS" = "linked" ]; then else if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found." + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4678,6 +4682,7 @@ if [ "$CFG_GLIB" != "no" ]; then else if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "Glib support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4705,6 +4710,7 @@ if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then else if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "GTK theme support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the fin al report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4749,6 +4755,7 @@ if [ "$CFG_PULSEAUDIO" != "no" ]; then else if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "PulseAudio support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4875,6 +4882,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then compileTest unix/opengles2 "OpenGL ES 2.0" $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2 if [ $? != "0" ]; then echo "The OpenGL ES 2.0 functionality test failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in" echo " ${XQMAKESPEC}." @@ -4948,6 +4956,7 @@ if [ "$CFG_LIBUDEV" != "no" ]; then QT_CONFIG="$QT_CONFIG libudev" elif [ "$CFG_LIBUDEV" = "yes" ]; then echo "The libudev functionality test failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" exit 1 else CFG_LIBUDEV=no @@ -5099,6 +5108,7 @@ if [ "$CFG_XCB" != "no" ]; then else if [ "$CFG_XCB" != "auto" ]; then echo "The test for linking against libxcb failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to install dependency packages for libxcb." echo " See src/plugins/platforms/xcb/README." exit 1 @@ -5115,6 +5125,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then CFG_DIRECTFB=yes elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo " DirectFB support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -5171,6 +5182,7 @@ if [ "$CFG_XCB" != "no" ]; then elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo " xkbcommon support cannot be enabled because either xkbcommon or " echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -5231,6 +5243,7 @@ if [ "$CFG_EGL" != "no" ]; then fi elif [ "$CFG_EGL" = "yes" ]; then echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces." + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}." exit 1 From 05d39ec9c0428696d3d523e6b024df59d456fc59 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 12:28:38 -0200 Subject: [PATCH 31/68] Optimize QHostAddress::operator== for SpecialAddress There's no need to allocate memory for the special address. Change-Id: I5f3760565807731ab595e91fc934c21d10df212a Reviewed-by: Richard J. Moore --- src/network/kernel/qhostaddress.cpp | 36 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 10fdf2f97d..b68f6adfff 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -778,18 +778,34 @@ bool QHostAddress::operator==(const QHostAddress &other) const bool QHostAddress::operator ==(SpecialAddress other) const { QT_ENSURE_PARSED(this); - QHostAddress otherAddress(other); - QT_ENSURE_PARSED(&otherAddress); + switch (other) { + case Null: + return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol; - if (d->protocol == QAbstractSocket::IPv4Protocol) - return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a; - if (d->protocol == QAbstractSocket::IPv6Protocol) { - return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol - && memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0; + case Broadcast: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_BROADCAST; + + case LocalHost: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_LOOPBACK; + + case Any: + return d->protocol == QAbstractSocket::AnyIPProtocol; + + case AnyIPv4: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_ANY; + + case LocalHostIPv6: + case AnyIPv6: + if (d->protocol == QAbstractSocket::IPv6Protocol) { + Q_IPV6ADDR ip6 = { { 0 } }; + ip6[15] = quint8(other == LocalHostIPv6); // 1 for localhost, 0 for any + return memcmp(&d->a6, &ip6, sizeof ip6) == 0; + } + return false; } - if (d->protocol == QAbstractSocket::AnyIPProtocol) - return other == QHostAddress::Any; - return int(other) == int(Null); + + Q_UNREACHABLE(); + return false; } /*! From a0737f65a62a5d72f15f5f1196b86f16605d936b Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 8 Jan 2015 17:11:43 +0200 Subject: [PATCH 32/68] Fixes for surface creation/destruction - After reset a surface we must call makeCurrent before we are usign swapBuffers. - No need to set the surface in QPA when surfaceCreated are called in QtSurface.java, some time the OpenGL surface is not fully initialized at this stage. Is better to wait for surfaceChanged which is always fired at least once. - DO NOT reset m_surfaceId to 1 when there is no surface. The problem is that if we have one surface and when we distory it we don't (need to) wait for its surfaceChanged/surfaceDestroyed notifications, and if we create another one quicly it will have the same id (1). Task-number: QTBUG-39712 Change-Id: I2aa31e5b59d81ef3b03624d4636a4381eea6d543 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../org/qtproject/qt5/android/QtSurface.java | 2 -- .../platforms/android/androidjnimain.cpp | 2 -- .../android/qandroidplatformopenglcontext.cpp | 6 ++++-- .../android/qandroidplatformopenglwindow.cpp | 20 +++++++++++-------- .../android/qandroidplatformopenglwindow.h | 4 ++-- .../android/qandroidplatformscreen.cpp | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index 34fc31b222..516671739e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -45,7 +45,6 @@ package org.qtproject.qt5.android; import android.app.Activity; import android.content.Context; import android.graphics.PixelFormat; -import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.SurfaceHolder; @@ -87,7 +86,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback @Override public void surfaceCreated(SurfaceHolder holder) { - QtNative.setSurface(getId(), holder.getSurface(), getWidth(), getHeight()); } @Override diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index d1e78dfe5d..1c157c79c3 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -376,8 +376,6 @@ namespace QtAndroid const auto &it = m_surfaces.find(surfaceId); if (it != m_surfaces.end()) m_surfaces.remove(surfaceId); - if (m_surfaces.isEmpty()) - m_surfaceId = 1; QJNIEnvironmentPrivate env; if (!env) diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 5781f0d7c6..4c38178343 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -50,8 +50,10 @@ QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceForma void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) { - if (surface->surface()->surfaceClass() == QSurface::Window) - static_cast(surface)->checkNativeSurface(eglConfig()); + if (surface->surface()->surfaceClass() == QSurface::Window && + static_cast(surface)->checkNativeSurface(eglConfig())) { + QEGLPlatformContext::makeCurrent(surface); + } QEGLPlatformContext::swapBuffers(surface); } diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 8dc8e84f0a..de7f1f6990 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -138,19 +138,19 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) return m_eglSurface; } -void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) +bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) { QMutexLocker lock(&m_surfaceMutex); if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid()) - return; + return false; // makeCurrent is NOT needed. createEgl(config); - // we've create another surface, the window should be repainted QRect availableGeometry = screen()->availableGeometry(); if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + return true; // makeCurrent is needed! } void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state) @@ -209,15 +209,19 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac Q_UNUSED(jniEnv); Q_UNUSED(w); Q_UNUSED(h); + lockSurface(); m_androidSurfaceObject = surface; - m_surfaceWaitCondition.wakeOne(); + if (surface) // wait until we have a valid surface to draw into + m_surfaceWaitCondition.wakeOne(); unlockSurface(); - // repaint the window - QRect availableGeometry = screen()->availableGeometry(); - if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) - QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + if (surface) { + // repaint the window, when we have a valid surface + QRect availableGeometry = screen()->availableGeometry(); + if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) + QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + } } QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index 71787edee1..6d6548fc6a 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -54,7 +54,7 @@ public: EGLSurface eglSurface(EGLConfig config); QSurfaceFormat format() const; - void checkNativeSurface(EGLConfig config); + bool checkNativeSurface(EGLConfig config); void applicationStateChanged(Qt::ApplicationState); @@ -66,7 +66,7 @@ protected: void clearEgl(); private: - EGLDisplay m_eglDisplay; + EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; EGLSurface m_eglSurface = EGL_NO_SURFACE; EGLNativeWindowType m_nativeWindow = nullptr; diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index b70f936be1..092ade2e4a 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -391,7 +391,7 @@ Qt::ScreenOrientation QAndroidPlatformScreen::nativeOrientation() const void QAndroidPlatformScreen::surfaceChanged(JNIEnv *env, jobject surface, int w, int h) { lockSurface(); - if (surface && w && h) { + if (surface && w > 0 && h > 0) { releaseSurface(); m_nativeSurface = ANativeWindow_fromSurface(env, surface); QMetaObject::invokeMethod(this, "setDirty", Qt::QueuedConnection, Q_ARG(QRect, QRect(0, 0, w, h))); From 2924279c235e9cb12b58b0f3ae0b139f8ac5ac2c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 16:29:30 -0200 Subject: [PATCH 33/68] Don't unnecessariy set localAddress in QNativeSocketEngine's nativeBind The outer QNativeSocketEngine::bind() function will call fetchConnectionParameters() as soon as nativeBind() returns, so don't bother copying localAddress. Change-Id: Ice13e507ccb9c575a7d3bdf0b41394f35230b746 Reviewed-by: Richard J. Moore --- src/network/socket/qnativesocketengine_unix.cpp | 3 --- src/network/socket/qnativesocketengine_win.cpp | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index ad170e187c..eed1b70025 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -567,9 +567,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 return false; } - localPort = port; - localAddress = address; - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true", address.toString().toLatin1().constData(), port); diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index f5943d657f..184add15c3 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -852,9 +852,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port) return false; } - localPort = port; - localAddress = address; - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true", address.toString().toLatin1().constData(), port); From cefaf61edac309216b7ff6c170602f5474aa1209 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 9 Jan 2015 13:02:39 +0100 Subject: [PATCH 34/68] remove pointless pwd fallbacks neither qmake_getpwd()'s return value nor a fileFixify()'d version of it can be empty. Change-Id: Ic3b7d20becc57209b9dbe71ad9dc8e7547d435b1 Reviewed-by: Thiago Macieira --- qmake/generators/mac/pbuilder_pbx.cpp | 2 -- qmake/generators/makefile.cpp | 2 -- qmake/generators/unix/unixmake2.cpp | 2 -- qmake/generators/win32/mingw_make.cpp | 2 -- 4 files changed, 8 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 0ff42500de..f80c3e84c8 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -742,8 +742,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "INCPATH = -I" << specdir(); if(!project->isActiveConfig("no_include_pwd")) { QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if(pwd.isEmpty()) - pwd = "."; mkt << " -I" << pwd; } { diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4c501983d8..e34b820a8b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -795,8 +795,6 @@ MakefileGenerator::init() incDirs += v["INCLUDEPATH"]; if(!project->isActiveConfig("no_include_pwd")) { QString pwd = qmake_getpwd(); - if(pwd.isEmpty()) - pwd = "."; incDirs += pwd; } QList deplist; diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9165da4d38..3f9df31a1c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -187,8 +187,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "INCPATH = -I" << specdir(); if(!project->isActiveConfig("no_include_pwd")) { QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if(pwd.isEmpty()) - pwd = "."; t << " -I" << pwd; } { diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 3c53421fc4..9bb5b1e416 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -308,8 +308,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) if (!project->isActiveConfig("no_include_pwd")) { QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if (pwd.isEmpty()) - pwd = "."; t << "-I" << pwd << " "; } From a90bb5b89a09490a1795064133f6d8ce33b6874e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 9 Jan 2015 13:42:57 +0100 Subject: [PATCH 35/68] centralize/unify/sanitize INCLUDEPATH "enrichment" instead of having each generator do its own magic (little surprisingly, with different outcomes), add "stuff" to the search path in one place used by all generators. this has several consequences: - (unless disabled via CONFIG+=no_include_pwd) $$PWD is now consistently prepended by all generators. most notably, this was entirely missing from the MSVC generators (both nmake and VS) - despite them needing it most. this also affects Xcode projects. - $$OUT_PWD (if different from $$PWD) is now added right after $$PWD, not at the end. this precedence clarification only makes sense, given that qmake tries to make shadow builds as transparent as possible. - the qmakespec's dir is now consistently appended. the UNIX and PBX generators prepended it, while the rest already appended. few files actually include qplatformdefs.h, so having it late in the search path seems reasonable. - the effect of CONFIG+=depend_includepath is now fully consistent with the actual include path. Change-Id: I5f7570183351ade29342ea74fef706a0738842bf Reviewed-by: Simon Hausmann Reviewed-by: Thiago Macieira --- qmake/generators/mac/pbuilder_pbx.cpp | 8 ++------ qmake/generators/makefile.cpp | 28 +++++++++++++++++--------- qmake/generators/unix/unixmake2.cpp | 6 +----- qmake/generators/win32/mingw_make.cpp | 8 +------- qmake/generators/win32/msvc_vcproj.cpp | 1 - qmake/generators/win32/winmakefile.cpp | 3 +-- 6 files changed, 24 insertions(+), 30 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index f80c3e84c8..8f24c20712 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -739,11 +739,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") << varGlue("DEFINES","-D"," -D","") << endl; - mkt << "INCPATH = -I" << specdir(); - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - mkt << " -I" << pwd; - } + mkt << "INCPATH ="; { const ProStringList &incs = project->values("INCLUDEPATH"); for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) @@ -1495,7 +1491,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";\n" << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";\n"; } - t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";\n" + t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH"), SettingsAsList, 5) << ";\n" << "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";\n" << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), !project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";\n"; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index e34b820a8b..804eab9ca7 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -444,6 +444,25 @@ MakefileGenerator::init() setSystemIncludes(v["QMAKE_DEFAULT_INCDIRS"]); + ProStringList &incs = project->values("INCLUDEPATH"); + if (!project->isActiveConfig("no_include_pwd")) { + if (Option::output_dir != qmake_getpwd()) { + // Pretend that the build dir is the source dir for #include purposes, + // consistently with the "transparent shadow builds" strategy. This is + // also consistent with #include "foo.h" falling back to #include + // behavior if it doesn't find the file in the source dir. + incs.prepend(Option::output_dir); + } + // This makes #include work if the header lives in the source dir. + // The benefit of that is questionable, as generally the user should use the + // correct include style, and extra compilers that put stuff in the source dir + // should add the dir themselves. + // More importantly, it makes #include "foo.h" work with MSVC when shadow-building, + // as this compiler looks files up relative to %CD%, not the source file's parent. + incs.prepend(qmake_getpwd()); + } + incs.append(project->specDir()); + const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 }; for (int i = 0; cacheKeys[i]; ++i) { if (v[cacheKeys[i]].isEmpty()) @@ -793,10 +812,6 @@ MakefileGenerator::init() ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; if(project->isActiveConfig("depend_includepath")) incDirs += v["INCLUDEPATH"]; - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = qmake_getpwd(); - incDirs += pwd; - } QList deplist; for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) deplist.append(QMakeLocalFileName(unescapeFilePath((*it).toQString()))); @@ -848,11 +863,6 @@ MakefileGenerator::init() (*it) = Option::fixPathToLocalOS((*it).toQString()); } - if(!project->isActiveConfig("no_include_pwd")) { //get the output_dir into the pwd - if(Option::output_dir != qmake_getpwd()) - project->values("INCLUDEPATH").append("."); - } - //fix up the target deps static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 }; for (int path = 0; fixpaths[path]; path++) { diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 3f9df31a1c..469f23340d 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -184,11 +184,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << varGlue("DEFINES","-D"," -D","") << endl; t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; - t << "INCPATH = -I" << specdir(); - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - t << " -I" << pwd; - } + t << "INCPATH ="; { QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); const ProStringList &incs = project->values("INCLUDEPATH"); diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 9bb5b1e416..f2d6678cdf 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -306,11 +306,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) { t << "INCPATH = "; - if (!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - t << "-I" << pwd << " "; - } - QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); const ProStringList &incs = project->values("INCLUDEPATH"); for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { @@ -324,8 +319,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) t << "-I"; t << quote << inc << quote << " "; } - t << "-I" << quote << specdir() << quote - << endl; + t << endl; } void MingwMakefileGenerator::writeLibsPart(QTextStream &t) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index f271eb0679..e3031d559c 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1688,7 +1688,6 @@ void VcprojGenerator::initOld() inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already project->values("MSVCPROJ_INCPATH").append("-I" + inc); } - project->values("MSVCPROJ_INCPATH").append("-I" + specdir()); QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT"); project->values("MSVCPROJ_TARGET") = ProStringList(dest); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 663665897b..3a2e146a33 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -606,8 +606,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) if(!inc.isEmpty()) t << "-I\"" << inc << "\" "; } - t << "-I\"" << specdir() << "\"" - << endl; + t << endl; } void Win32MakefileGenerator::writeStandardParts(QTextStream &t) From fb166648936410f791ae6e600756d255b4a50545 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Jan 2015 22:06:18 -0200 Subject: [PATCH 36/68] Fix memory leaks with QDBusServer Two serious mistakes: - we need to call dbus_server_free_data_slot as many times as we call dbus_server_allocate_data_slot - we need to delete the d pointer... The changes to the unit tests are simply to cause the used peer connections to be removed so they don't show up in valgrind. Change-Id: I9fd1ada5503db9ba481806c09116874ee81f450d Reviewed-by: Alex Blasche --- src/dbus/qdbus_symbols_p.h | 2 ++ src/dbus/qdbusintegrator.cpp | 9 ++++++--- src/dbus/qdbusserver.cpp | 1 + tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 0785fea4b4..4bec3af490 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -323,6 +323,8 @@ DEFINEFUNC(void , dbus_pending_call_unref, (DBusPendingCall /* dbus-server.h */ DEFINEFUNC(dbus_bool_t , dbus_server_allocate_data_slot, (dbus_int32_t *slot_p), (slot_p), return) +DEFINEFUNC(void , dbus_server_free_data_slot, (dbus_int32_t *slot_p), + (slot_p), return) DEFINEFUNC(void , dbus_server_disconnect, (DBusServer *server), (server), ) DEFINEFUNC(char* , dbus_server_get_address, (DBusServer *server), diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index dd92602dce..698fb1b46c 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -66,6 +66,9 @@ QT_BEGIN_NAMESPACE +// used with dbus_server_allocate_data_slot +static dbus_int32_t server_slot = -1; + static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1); #define qDBusDebug if (::isDebugging == 0); else qDebug @@ -1084,8 +1087,10 @@ void QDBusConnectionPrivate::closeConnection() mode = InvalidMode; // prevent reentrancy baseService.clear(); - if (server) + if (server) { q_dbus_server_disconnect(server); + q_dbus_server_free_data_slot(&server_slot); + } if (oldMode == ClientMode || oldMode == PeerMode) { if (connection) { @@ -1651,8 +1656,6 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg) handleSignal(key, msg); // third try } -static dbus_int32_t server_slot = -1; - void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error) { mode = ServerMode; diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index b2c76a8750..3fec7c9111 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -110,6 +110,7 @@ QDBusServer::~QDBusServer() } d->serverConnectionNames.clear(); } + d->deleteLater(); } /*! diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index df6fb9e9bc..70794a52f5 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -294,6 +294,7 @@ void tst_QDBusConnection::connectToPeer() "", "newconn"); QVERIFY(!con.isConnected()); QVERIFY(con.lastError().isValid()); + QDBusConnection::disconnectFromPeer("newconn"); } QDBusServer server; @@ -303,6 +304,7 @@ void tst_QDBusConnection::connectToPeer() "unix:abstract=/tmp/dbus-XXXXXXXXXX,guid=00000000000000000000000000000000", "newconn2"); QVERIFY(!con.isConnected()); QVERIFY(con.lastError().isValid()); + QDBusConnection::disconnectFromPeer("newconn2"); } { From 3ba1b989a6c7e22e8f0b92c59c5bbb52cdcab638 Mon Sep 17 00:00:00 2001 From: Tomasz Olszak Date: Fri, 9 Jan 2015 22:20:02 +0100 Subject: [PATCH 37/68] xcb: build fix when XCB_USE_XLIB is not defined. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When XCB_USE_XLIB was not defined QXcbXSettings still used XIproto.h. This change removes XIProto.h dependency and leaves QXcbXSettings uninitialized when XCB_USE_XLIB is not defined. QXcbXSettings::initialize() is already used in other parts of code e.g. qxcbcursor.cpp. Change-Id: I48eb82e39c5c091b41e8ec19e742a21d41de2610 Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbxsettings.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 13d42832db..a1dadb0e54 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -36,7 +36,9 @@ #include #include +#ifdef XCB_USE_XLIB #include +#endif //XCB_USE_XLIB QT_BEGIN_NAMESPACE /* Implementation of http://standards.freedesktop.org/xsettings-spec/xsettings-0.5.html */ @@ -138,6 +140,7 @@ public: return value + 4 - remainder; } +#ifdef XCB_USE_XLIB void populateSettings(const QByteArray &xSettings) { if (xSettings.length() < 12) @@ -212,6 +215,7 @@ public: } } +#endif //XCB_USE_XLIB QXcbScreen *screen; xcb_window_t x_settings_window; @@ -258,8 +262,10 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); +#ifdef XCB_USE_XLIB d_ptr->populateSettings(d_ptr->getSettings()); d_ptr->initialized = true; +#endif //XCB_USE_XLIB } QXcbXSettings::~QXcbXSettings() @@ -279,7 +285,9 @@ void QXcbXSettings::handlePropertyNotifyEvent(const xcb_property_notify_event_t Q_D(QXcbXSettings); if (event->window != d->x_settings_window) return; +#ifdef XCB_USE_XLIB d->populateSettings(d->getSettings()); +#endif //XCB_USE_XLIB } void QXcbXSettings::registerCallbackForProperty(const QByteArray &property, QXcbXSettings::PropertyChangeFunc func, void *handle) From 075ae987c48ce732e6a22c1eba71023fa0ea1775 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Jan 2015 15:44:12 +0100 Subject: [PATCH 38/68] X11 devicePixelRatio screen mapping fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix screen detection and window geometry when screens have different displayPixelRatios. We must use the native coordinate system to figure out which screen a window belongs to. Also, when a window moves to a screen with a different devicePixelRatio, we must recalculate the Qt geometry. Task-number: QTBUG-43713 Change-Id: I93063e37354ff88f3c8a13320b76dfb272e43a9c Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbscreen.cpp | 5 +++- src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ src/plugins/platforms/xcb/qxcbwindow.cpp | 29 ++++++++++++++++++++++-- src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 73f27c7117..f8d68c68f0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -77,8 +77,10 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, // virtual size is known (probably back-calculated from DPI and resolution) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = m_virtualSizeMillimeters; - if (m_geometry.isEmpty()) + if (m_geometry.isEmpty()) { m_geometry = QRect(QPoint(), m_virtualSize/dpr); + m_nativeGeometry = QRect(QPoint(), m_virtualSize); + } if (m_availableGeometry.isEmpty()) m_availableGeometry = m_geometry; @@ -461,6 +463,7 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) m_devicePixelRatio = qRound(dpi/96); const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr); + m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index b9ee331104..4675b12d9c 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -62,6 +62,7 @@ public: QWindow *topLevelAt(const QPoint &point) const; QRect geometry() const { return m_geometry; } + QRect nativeGeometry() const { return m_nativeGeometry; } QRect availableGeometry() const {return m_availableGeometry;} int depth() const { return m_screen->root_depth; } QImage::Format format() const; @@ -114,6 +115,7 @@ private: QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; + QRect m_nativeGeometry; QRect m_availableGeometry; QSize m_virtualSize; QSizeF m_virtualSizeMillimeters; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e1ccc3f086..590e296f61 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1831,6 +1831,23 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } } +// Temporary workaround for bug in QPlatformScreen::screenForNativeGeometry +// we need the native geometries to detect our screen, but that's not +// available in cross-platform code. Will be fixed properly when highDPI +// support is refactored to expose the native coordinate system. + +QPlatformScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const +{ + QXcbScreen *currentScreen = static_cast(screen()); + if (!parent() && !currentScreen->nativeGeometry().intersects(newGeometry)) { + Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { + if (static_cast(screen)->nativeGeometry().intersects(newGeometry)) + return screen; + } + } + return currentScreen; +} + void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) { bool fromSendEvent = (event->response_type & 0x80); @@ -1847,15 +1864,23 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * } } - QRect rect = mapFromNative(QRect(pos, QSize(event->width, event->height)), int(devicePixelRatio())); + const int dpr = devicePixelRatio(); + const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); + const QRect rect = mapFromNative(nativeRect, dpr); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); - QPlatformScreen *newScreen = screenForGeometry(rect); + QPlatformScreen *newScreen = screenForNativeGeometry(nativeRect); if (newScreen != m_screen) { m_screen = static_cast(newScreen); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); + int newDpr = devicePixelRatio(); + if (newDpr != dpr) { + QRect newRect = mapFromNative(nativeRect, newDpr); + QPlatformWindow::setGeometry(newRect); + QWindowSystemInterface::handleGeometryChange(window(), newRect); + } } m_configureNotifyPending = false; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 12d20d004d..254421e57d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -154,6 +154,8 @@ public: qreal devicePixelRatio() const; + QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const; + public Q_SLOTS: void updateSyncRequestCounter(); From 3f0b8a9f198cd1e0e8ae9150561f93fb1b931b7e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 8 Jan 2015 13:55:32 +0100 Subject: [PATCH 39/68] Multi-screen DPI support for X11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calculate the logical DPI independently per screen, but only when auto dpr is enabled. Using a constant DPI value for all screens, based on the combined geometry is arguably incorrect, but changing this now will cause pixel-size fonts to behave visibly different from point-size fonts when moving the window to a different screen. However, with QT_DEVICE_PIXEL_RATIO=auto, the pixel size fonts are already changing when the devicePixelRatio changes. Without this change, the point-size fonts will *not* adapt, which is a clear bug. Task-number: QTBUG-43713 Change-Id: I3e71618f9d55b7828ccd70b69a7b7ce656c69d65 Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind Reviewed-by: Simon Hausmann Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbscreen.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index f8d68c68f0..6559a0bdba 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -317,8 +317,14 @@ QDpi QXcbScreen::logicalDpi() const if (m_forcedDpi > 0) return QDpi(m_forcedDpi/dpr, m_forcedDpi/dpr); - return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, - Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + static const bool auto_dpr = qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"; + if (auto_dpr) { + return QDpi(Q_MM_PER_INCH * m_geometry.width() / m_sizeMillimeters.width(), + Q_MM_PER_INCH * m_geometry.height() / m_sizeMillimeters.height()); + } else { + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + } } From e1bd0ee534fe396b244c587fb51d2c00ef1c1953 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 15:31:58 +0100 Subject: [PATCH 40/68] Android: XFAIL a few tests in QDnsLookup Some of these tests are verifying things that are not supported on Android, so we XFAIL these cases when we see the appropriate error message. Change-Id: I8245266f061c902515bb12251521159a8e19bfb7 Reviewed-by: Thiago Macieira --- .../kernel/qdnslookup/tst_qdnslookup.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index cc8dd2105f..e7f30f8940 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -200,6 +200,12 @@ void tst_QDnsLookup::lookup() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString())); if (error == QDnsLookup::NoError) QVERIFY(lookup.errorString().isEmpty()); @@ -295,6 +301,12 @@ void tst_QDnsLookup::lookupReuse() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single")); @@ -333,6 +345,12 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); From 34ce66cd89ea1c618d8f63dd2d9b95aed0a81b11 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 2 Jan 2015 12:56:18 +0100 Subject: [PATCH 41/68] Doc: link issue D-Bus Viewer Moved doc D-Bus Viewer from qdbusviewer.cpp to qtdbus-index.qdoc Doc moved from qttools to qtbase Task-number: QTBUG-43537 Change-Id: I718781a8f5029f64fea0f2be241b4d584cc8bfce Reviewed-by: Martin Smith --- src/dbus/doc/src/qtdbus-index.qdoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/dbus/doc/src/qtdbus-index.qdoc b/src/dbus/doc/src/qtdbus-index.qdoc index 2249924ada..d534ea9140 100644 --- a/src/dbus/doc/src/qtdbus-index.qdoc +++ b/src/dbus/doc/src/qtdbus-index.qdoc @@ -212,5 +212,22 @@ \li \l{Qt D-Bus XML compiler (qdbusxml2cpp)} \li \l{Qt D-Bus C++ Classes} \li \l{Qt D-Bus Examples} + \li \l{D-Bus Viewer} \endlist */ + +/*! + \page qdbusviewer.html + \title D-Bus Viewer + \keyword qdbusviewer + + The Qt D-Bus Viewer is a tool that lets you introspect D-Bus objects and messages. You can + choose between the system bus and the session bus. Click on any service on the list + on the left side to see all the exported objects. + + You can invoke methods by double-clicking on them. If a method takes one or more IN parameters, + a property editor opens. + + Right-click on a signal to connect to it. All emitted signals including their parameters + are output in the message view on the lower side of the window. +*/ From 13ecde3b7af364be2db466029f796f3cb6310685 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 13 Jan 2015 12:53:04 +0100 Subject: [PATCH 42/68] iOS: guard text responder from clearing selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When programatically setting a text selection on iOS, we call [UITextInputDelegate selectionWillChange] to report the change. If auto correction is enabled, UIKit will then reset the current tracking, and for some reason tell us to clear the selection. This is contradictory to us saying the the selection is about to change, and will cause an unwanted recursion back to Qt. Since there seems to be no way to stop UIKit from doing this, this patch will instead add a guard that refuses to change the selection recursively while processing a selection change from Qt. Task-number: QTBUG-43716 Change-Id: Id487a57cdda55d7e2d09c3efc14c7f03f566f15a Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.h | 1 + src/plugins/platforms/ios/qiostextresponder.mm | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/ios/qiostextresponder.h b/src/plugins/platforms/ios/qiostextresponder.h index 118ab8958a..21b61bf8da 100644 --- a/src/plugins/platforms/ios/qiostextresponder.h +++ b/src/plugins/platforms/ios/qiostextresponder.h @@ -51,6 +51,7 @@ class QIOSInputContext; QIOSInputContext *m_inputContext; QString m_markedText; BOOL m_inSendEventToFocusObject; + BOOL m_inSelectionChange; } - (id)initWithInputContext:(QIOSInputContext *)context; diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index bebc7577f8..15fade0838 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -171,6 +171,7 @@ return self; m_inSendEventToFocusObject = NO; + m_inSelectionChange = NO; m_inputContext = inputContext; QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap(); @@ -302,6 +303,7 @@ return; if (updatedProperties & (Qt::ImCursorPosition | Qt::ImAnchorPosition)) { + QScopedValueRollback rollback(m_inSelectionChange, true); [self.inputDelegate selectionWillChange:self]; [self.inputDelegate selectionDidChange:self]; } @@ -349,6 +351,15 @@ - (void)setSelectedTextRange:(UITextRange *)range { + if (m_inSelectionChange) { + // After [UITextInputDelegate selectionWillChange], UIKit will cancel + // any ongoing auto correction (if enabled) and ask us to set an empty selection. + // This is contradictory to our current attempt to set a selection, so we ignore + // the callback. UIKit will be re-notified of the new selection after + // [UITextInputDelegate selectionDidChange]. + return; + } + QUITextRange *r = static_cast(range); QList attrs; attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, r.range.location, r.range.length, 0); From c3590c76775c889fde13dc155c2a31508db612e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 15:34:45 -0800 Subject: [PATCH 43/68] Update doc saying QDateTime::setTime with invalid time sets to midnight QDateTimePrivate::setDateTime has a comment saying this is intentional, so document it. Task-number: QTBUG-43704 Change-Id: Ic5d393bfd36e48a193fcffff13b965409eaf7be9 Reviewed-by: Martin Smith --- src/corelib/tools/qdatetime.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index d52dea8d4f..082b721e82 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3296,8 +3296,8 @@ bool QDateTime::isDaylightTime() const } /*! - Sets the date part of this datetime to \a date. - If no time is set, it is set to midnight. + Sets the date part of this datetime to \a date. If no time is set yet, it + is set to midnight. If \a date is invalid, this QDateTime becomes invalid. \sa date(), setTime(), setTimeSpec() */ @@ -3309,7 +3309,14 @@ void QDateTime::setDate(const QDate &date) } /*! - Sets the time part of this datetime to \a time. + Sets the time part of this datetime to \a time. If \a time is not valid, + this function sets it to midnight. Therefore, it's possible to clear any + set time in a QDateTime by setting it to a default QTime: + + \code + QDateTime dt = QDateTime::currentDateTime(); + dt.setTime(QTime()); + \endcode \sa time(), setDate(), setTimeSpec() */ From 63ca2846e19df60e3eff1a451ef6fa459aa1bbdd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 11 Jan 2015 10:06:44 -0800 Subject: [PATCH 44/68] Fix compilation with older MSVC: use qIsNan instead of isnan isnan is C99 and POSIX.1, which the older MSVC do not support. Use the Qt equivalent. Change-Id: Ic5d393bfd36e48a193fcffff13b8679cb83d12db Reviewed-by: Alex Blasche Reviewed-by: Friedemann Kleint --- tests/auto/dbus/qdbusmarshall/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h index 76fe0e4bfb..323b54a137 100644 --- a/tests/auto/dbus/qdbusmarshall/common.h +++ b/tests/auto/dbus/qdbusmarshall/common.h @@ -30,7 +30,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include // isnan +#include // qIsNan #include #ifdef Q_OS_UNIX @@ -320,7 +320,7 @@ bool compare(const QVariant &v1, const QVariant &v2); bool compare(double d1, double d2) { - if (isnan(d1) && isnan(d2)) + if (qIsNaN(d1) && qIsNaN(d2)) return true; return d1 == d2; } From 241d32bfe3638b0e92e8e1dd1ae75411fe1aa6c7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 15 Jan 2015 14:45:46 +0100 Subject: [PATCH 45/68] Fix inlining order of functions in qpathclipper_p.h. When compiling tst_qpathclipper with MinGW: In file included from QtGui/private/qpathclipper_p.h:1:0, from tst_qpathclipper.cpp:33: src/gui/painting/qpathclipper_p.h:469:29: warning: 'static QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal)' redeclared without dllimport attribute after being referenced with dll linkage inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal) ^ qpathclipper_p.h:474:29: warning: 'static QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction)' redeclared without dllimport attribute after being referenced with dll linkage inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction) Change-Id: I38feb07d693768285c1d405b3fc92a58c3309547 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpathclipper_p.h | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index 5475503f22..5fc8bbaf09 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -414,22 +414,6 @@ inline void QPathSegments::addIntersection(int index, const Intersection &inters } } -inline void QWingedEdge::TraversalStatus::flipDirection() -{ - direction = QWingedEdge::flip(direction); -} - -inline void QWingedEdge::TraversalStatus::flipTraversal() -{ - traversal = QWingedEdge::flip(traversal); -} - -inline void QWingedEdge::TraversalStatus::flip() -{ - flipDirection(); - flipTraversal(); -} - inline int QWingedEdge::edgeCount() const { return m_edges.size(); @@ -471,11 +455,27 @@ inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal) return traversal == QPathEdge::RightTraversal ? QPathEdge::LeftTraversal : QPathEdge::RightTraversal; } +inline void QWingedEdge::TraversalStatus::flipTraversal() +{ + traversal = QWingedEdge::flip(traversal); +} + inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction) { return direction == QPathEdge::Forward ? QPathEdge::Backward : QPathEdge::Forward; } +inline void QWingedEdge::TraversalStatus::flipDirection() +{ + direction = QWingedEdge::flip(direction); +} + +inline void QWingedEdge::TraversalStatus::flip() +{ + flipDirection(); + flipTraversal(); +} + QT_END_NAMESPACE #endif // QPATHCLIPPER_P_H From ccb5978c6d45569e590bba527255fafbcb840d08 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 3 Dec 2014 14:08:39 +0100 Subject: [PATCH 46/68] Fix namespacing of QNSViewMouseMoveHelper Task-number: QTBUG-43061 Change-Id: Ied8cdf49c34ef155b0f0bbc7e547b7c01bcd1d11 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.h | 4 ++-- src/plugins/platforms/cocoa/qnsview.mm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 8d8df13dc3..fa71ab4086 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -48,7 +48,7 @@ class QCocoaBackingStore; class QCocoaGLContext; QT_END_NAMESPACE -Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); @interface QT_MANGLE_NAMESPACE(QNSView) : NSView { QImage m_backingStore; @@ -72,7 +72,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); bool m_shouldSetGLContextinDrawRect; #endif NSString *m_inputSource; - QNSViewMouseMoveHelper *m_mouseMoveHelper; + QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper; bool m_resendKeyEvent; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 699340795d..771b464805 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -83,7 +83,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (CGFloat)deviceDeltaZ; @end -@interface QNSViewMouseMoveHelper : NSObject +@interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject { QNSView *view; } @@ -97,7 +97,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; @end -@implementation QNSViewMouseMoveHelper +@implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) - (id)initWithView:(QNSView *)theView { @@ -158,7 +158,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; currentCustomDragTypes = 0; m_sendUpAsRightButton = false; m_inputSource = 0; - m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self]; + m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; m_resendKeyEvent = false; if (!touchDevice) { From f6a59f8defbb478f7960c36982acb611d709ae40 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Mon, 5 Jan 2015 14:11:05 +0100 Subject: [PATCH 47/68] Benchmarks: Build gui benchmarks only when gui module available Change-Id: I57fc2f09a4e31e379c256dfe3f5d7546cdcf2b4b Reviewed-by: Frederik Gladhorn --- tests/benchmarks/benchmarks.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index e5a6f5d7d2..8ee8d017ab 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -1,12 +1,12 @@ TEMPLATE = subdirs SUBDIRS = \ corelib \ - gui \ sql \ # removed-by-refactor qtHaveModule(opengl): SUBDIRS += opengl qtHaveModule(dbus): SUBDIRS += dbus qtHaveModule(network): SUBDIRS += network +qtHaveModule(gui): SUBDIRS += gui check-trusted.CONFIG += recursive QMAKE_EXTRA_TARGETS += check-trusted From 997b04031039408790131359b4af393f7600bac6 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Tue, 13 Jan 2015 15:49:09 +0100 Subject: [PATCH 48/68] Autotest: Find all autotests due to changed naming conventions The algorithm searches for all executables in search path starting with "tst_". Tests are not named like the folder they are contained in anymore. Change-Id: I360f293e43e30292fe0ae6230fd3ec7abf3d632d Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/test.pl | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/tests/auto/test.pl b/tests/auto/test.pl index 7c3708472c..48166e1c30 100755 --- a/tests/auto/test.pl +++ b/tests/auto/test.pl @@ -138,35 +138,22 @@ sub handleDir { my ($dir) = @_; my $currentDir = getcwd(); - chdir($dir) || die("Could not chdir to $dir"); - my @components; - my $command; - @components = split(/\//, $dir); - my $component = $components[$#components]; - - $command = "tst_".$component; - - if ( -e $command.$EXE_SUFFIX ) - { - executeTestCurrentDir($command); - } else { - opendir(DIR, $dir); - my @files = readdir(DIR); - closedir DIR; - my $file; - foreach $file (@files) - { - #skip hidden files - next if (substr($file,0,1) eq "."); - - if ( -d $dir."/".$file) - { - handleDir($dir."/".$file) - } + opendir(DIR, $dir); + my @files = readdir(DIR); + closedir DIR; + my $file; + foreach $file (@files) { + #skip hidden files + next if (substr($file,0,1) eq "."); + if ( -d $dir."/".$file) { + handleDir($dir."/".$file) + } elsif ( $file =~ /^tst_/ and -x $dir."/".$file ) { + chdir($dir) || die("Could not chdir to $dir"); + executeTestCurrentDir($file); + chdir($currentDir); } } - chdir($currentDir); } sub executeTestCurrentDir { From 988f1b2e5745646cf1bd7f9f65507356ff2ba12e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 6 Jan 2015 16:21:41 +0100 Subject: [PATCH 49/68] Windows: Use DND effect chosen in DragEnter/Move for Drop. The value of pdwEffect passed to IOleDropTarget::Drop() is always the one with which the drag was initiated. Task-number: QTBUG-43466 Change-Id: I045fef634b55d4f113b393aa0ad4aa15d37db372 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsdrag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index fce60c3169..d3eb049269 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState, const QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(), m_lastPoint / QWindowsScaling::factor(), - translateToQDragDropActions(*pdwEffect)); + translateToQDragDropActions(m_chosenEffect)); if (response.isAccepted()) { const Qt::DropAction action = response.acceptedAction(); From b4031387f91d9e96c19521486b82accdc45c178e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Jan 2015 16:01:16 +0100 Subject: [PATCH 50/68] Android: Fix QImageReader test The files for the test have to be included in a qrc to be available on Android. Most of the image files are already in a qrc, but a couple were missing. We add this in a separate qrc to avoid interfering with the tests on other platforms. Change-Id: Ibb24f5015a1aba4d5622e14f7aae80bc18611ec4 Reviewed-by: BogDan Vatra --- tests/auto/gui/image/qimagereader/android_testdata.qrc | 6 ++++++ tests/auto/gui/image/qimagereader/qimagereader.pro | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/gui/image/qimagereader/android_testdata.qrc diff --git a/tests/auto/gui/image/qimagereader/android_testdata.qrc b/tests/auto/gui/image/qimagereader/android_testdata.qrc new file mode 100644 index 0000000000..bba32781fa --- /dev/null +++ b/tests/auto/gui/image/qimagereader/android_testdata.qrc @@ -0,0 +1,6 @@ + + + images/trans.gif + images/kollada-noext + + diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 7686643b3a..76fb4d8bfc 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -5,6 +5,10 @@ MOC_DIR=tmp QT += core-private gui-private network testlib RESOURCES += qimagereader.qrc +android: !android-no-sdk { + RESOURCES += android_testdata.qrc +} + win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300 From 1ee6fdc72c8f9903ef813341007156436f0758ea Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Jan 2015 11:59:23 +0100 Subject: [PATCH 51/68] Fix QRawFont test when used with bundled FreeType The auto-hinter in the FreeType version bundled in Qt gives slightly different advances on some glyphs. As noted in the removed code, this was already observed on Windows and QNX, and recently also on Android. I'm sure it could also happen on platforms using the system library if the system library was the same version as the one bundled in Qt. Instead of expect-failing the test, we simply accept both the observed results as valid. Note that we need to accept 9 as a result for the default hinting preference on all platforms, not just Windows, since the default hinting preference in FreeType can be a system setting. Change-Id: I3cc0f33f0f66dd64419770b37c10dee457706b5e Reviewed-by: Konstantin Ritt Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index bd4da12ea3..969c8f9ce7 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -307,24 +307,22 @@ void tst_QRawFont::advances() bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions(); QVector advances = font.advancesForGlyphIndexes(glyphIndices); - // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs - // when full hinting is used (default on Windows). - bool mayFail = false; -#if defined (Q_OS_WIN) - mayFail = font_d->fontEngine->type() == QFontEngine::Freetype - && (hintingPreference == QFont::PreferFullHinting - || hintingPreference == QFont::PreferDefaultHinting); -#elif defined(Q_OS_QNX) - mayFail = font_d->fontEngine->type() == QFontEngine::Freetype - && hintingPreference == QFont::PreferFullHinting; -#endif + bool mayDiffer = font_d->fontEngine->type() == QFontEngine::Freetype + && (hintingPreference == QFont::PreferFullHinting + || hintingPreference == QFont::PreferDefaultHinting); for (int i = 0; i < glyphIndices.size(); ++i) { - if (mayFail && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "FreeType engine reports unexpected advance " - "for some glyphs (9 instead of 8)", Continue); + if ((i == 0 || i == 5) && mayDiffer) { + QVERIFY2(qRound(advances.at(i).x()) == 8 + || qRound(advances.at(i).x()) == 9, + qPrintable(QStringLiteral("%1 != %2 && %1 != %3") + .arg(qRound(advances.at(i).x())) + .arg(8) + .arg(9))); + } else { + QCOMPARE(qRound(advances.at(i).x()), 8); } - QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); + if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); @@ -342,11 +340,17 @@ void tst_QRawFont::advances() QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs)); for (int i = 0; i < glyphIndices.size(); ++i) { - if (mayFail && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "FreeType engine reports unexpected advance " - "for some glyphs (9 instead of 8)", Continue); + if ((i == 0 || i == 5) && mayDiffer) { + QVERIFY2(qRound(advances.at(i).x()) == 8 + || qRound(advances.at(i).x()) == 9, + qPrintable(QStringLiteral("%1 != %2 && %1 != %3") + .arg(qRound(advances.at(i).x())) + .arg(8) + .arg(9))); + } else { + QCOMPARE(qRound(advances.at(i).x()), 8); } - QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); + if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); From 9a34b69b7dfa40d19957a61457fc47e25af2d81f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 12 Jan 2015 13:24:55 +0100 Subject: [PATCH 52/68] Android: Skip QProcess_and_GuiEventLoop test This requires building a command line tool and running it using QProcess, which is not a supported deployment option on Android. Change-Id: I795374bf809a8e4d8634a55f5ebf1699ee9745d1 Reviewed-by: Christian Stromme --- .../tst_qprocess_and_guieventloop.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index 8321f4fee1..a44afcbe8f 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -45,6 +45,10 @@ private slots: void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Not supported on Android"); +#endif + // based on testcase provided in QTBUG-39488 QByteArray msg = "Hello World"; From a0c21829eaa2bfc70b4d134c26ac96a63e48a6a5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 12 Jan 2015 14:30:28 +0100 Subject: [PATCH 53/68] Android: Fix QSideBar test On Android, the HOME and TMPDIR environment variables both point to the application sandbox, whereas the QSideBar test assumed they were different. We work around this simply by creating a new directory and using this as the test dir in place of the home directory. Change-Id: I67e01926b901ddf237b05aff116d30b6c7885535 Reviewed-by: BogDan Vatra --- tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 3ed8e1e88e..273be1d9c3 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -113,6 +113,12 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + // temp and home is the same directory on Android + testDir.mkdir(QStringLiteral("test")); + QVERIFY(testDir.cd(QStringLiteral("test"))); +#endif + // default QCOMPARE(model->rowCount(), 0); From 7a760f5ed91055b536219b7beff7a1e5446e1b59 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 13 Jan 2015 16:02:48 +0100 Subject: [PATCH 54/68] Android: Fix QDirModel tests This test needs to have a test environment available on the regular file system, so we create this when initializing the test. In addition we QEXPECT_FAIL one of the tests which seems to expose a legitimate bug. A bug report has been created for this. Change-Id: I7c90aea78a067815cb647a51db5d91a652a9fc1c Reviewed-by: BogDan Vatra --- .../widgets/itemviews/qdirmodel/qdirmodel.pro | 6 +++- .../widgets/itemviews/qdirmodel/testdata.qrc | 11 ++++++ .../itemviews/qdirmodel/tst_qdirmodel.cpp | 34 +++++++++++++++++-- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 tests/auto/widgets/itemviews/qdirmodel/testdata.qrc diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 680286d1e4..79848ac22c 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -13,9 +13,13 @@ wince* { DEPLOYMENT += addit tests sourceFile } -wince*: { +android|wince*: { DEFINES += SRCDIR=\\\"./\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc new file mode 100644 index 0000000000..e0ef4203fe --- /dev/null +++ b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc @@ -0,0 +1,11 @@ + + + dirtest/test1/dummy + dirtest/test1/test + test/file01.tst + test/file02.tst + test/file03.tst + test/file04.tst + tst_qdirmodel.cpp + + diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 4fee5fb1e5..56a8d1f1f4 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -42,6 +42,7 @@ class tst_QDirModel : public QObject { Q_OBJECT public slots: + void initTestCase(); void cleanupTestCase(); void init(); private slots: @@ -113,6 +114,29 @@ void tst_QDirModel::getSetCheck() QCOMPARE(true, obj1.lazyChildCount()); } +void tst_QDirModel::initTestCase() +{ +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString dataPath = SRCDIR; + QString resourceSourcePath = QStringLiteral(":/android_testdata"); + QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo fileInfo = it.fileInfo(); + if (!fileInfo.isDir()) { + QString destination = dataPath + QLatin1Char('/') + fileInfo.filePath().mid(resourceSourcePath.length()); + QFileInfo destinationFileInfo(destination); + if (!destinationFileInfo.exists()) { + QDir().mkpath(destinationFileInfo.path()); + if (!QFile::copy(fileInfo.filePath(), destination)) + qWarning("Failed to copy %s", qPrintable(fileInfo.filePath())); + } + } + } +#endif +} + void tst_QDirModel::cleanupTestCase() { QDir current; @@ -556,10 +580,12 @@ void tst_QDirModel::filePath() model.setResolveSymlinks(false); QModelIndex index = model.index(SRCDIR "test.lnk"); QVERIFY(index.isValid()); -#ifndef Q_OS_WINCE +#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID) QString path = SRCDIR; #else - QString path = QFileInfo(SRCDIR).absoluteFilePath() + "/"; + QString path = QFileInfo(SRCDIR).absoluteFilePath(); + if (!path.endsWith("/")) + path += "/"; #endif QCOMPARE(model.filePath(index), path + QString( "test.lnk")); model.setResolveSymlinks(true); @@ -592,6 +618,10 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QEXPECT_FAIL("", "QTBUG-43818", Continue); +#endif + QCOMPARE(index.data(), index2.data()); } From 4448576ae04ad9261ffad07c8ff15486d56fa28c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 13 Jan 2015 16:13:34 +0100 Subject: [PATCH 55/68] Android: Fix QLayout tests This test requires test data to be available and the testRetainSizeWhenHidden test assumes that a widget will be sized based on its sizeHint(), which does not work on platforms where show() implies showMaximized(). Change-Id: I9bf372d8c0ea94845ae08481ec555fe25dcfebc0 Reviewed-by: BogDan Vatra --- tests/auto/widgets/kernel/qlayout/qlayout.pro | 5 +++++ tests/auto/widgets/kernel/qlayout/testdata.qrc | 5 +++++ tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 tests/auto/widgets/kernel/qlayout/testdata.qrc diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 4a5db512c8..8bdbde9282 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -11,3 +11,8 @@ wince* { } else { TESTDATA += baseline/* } + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/kernel/qlayout/testdata.qrc b/tests/auto/widgets/kernel/qlayout/testdata.qrc new file mode 100644 index 0000000000..24e8e56263 --- /dev/null +++ b/tests/auto/widgets/kernel/qlayout/testdata.qrc @@ -0,0 +1,5 @@ + + + baseline/smartmaxsize + + diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index c889643524..0bdc71e55b 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -345,6 +345,10 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Test does not work on platforms which default to showMaximized()"); +#endif + QWidget widget; QBoxLayout layout(QBoxLayout::TopToBottom, &widget); From c1d08afd31074a2733057ed6620735ef2f4dd8c6 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Jan 2015 10:14:44 +0100 Subject: [PATCH 56/68] Fix constantly growing window bug with devicePixelRatio Rectangles need to be mapped differently depending on what they are used for. Expose events need to cover the entire geometry, so they must be rounded up, potentially increasing the size. If we use the same conversion for window geometries, it is possible to end up with a feedback loop if the window reacts to the new size. Task-number: QTBUG-43743 Change-Id: I7881cc77bf2148fed2ae743c4226617a61197434 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbwindow.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 590e296f61..4fd71f1635 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -151,7 +151,7 @@ static inline QRect mapToNative(const QRect &qtRect, int dpr) return QRect(qtRect.x() * dpr, qtRect.y() * dpr, qtRect.width() * dpr, qtRect.height() * dpr); } -// When converting native rects to Qt rects: round top/left towards the origin and +// When mapping expose events to Qt rects: round top/left towards the origin and // bottom/right away from the origin, making sure that we cover the whole widget static inline QPoint dpr_floor(const QPoint &p, int dpr) @@ -164,11 +164,15 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr) return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr); } -static inline QRect mapFromNative(const QRect &xRect, int dpr) +static inline QRect mapExposeFromNative(const QRect &xRect, int dpr) { return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr)); } +static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr) +{ + return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr); +} // Returns \c true if we should set WM_TRANSIENT_FOR on \a w static inline bool isTransient(const QWindow *w) @@ -1718,7 +1722,7 @@ public: return false; if (expose->count == 0) m_pending = false; - *m_region |= mapFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr); + *m_region |= mapExposeFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr); return true; } @@ -1746,7 +1750,7 @@ void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { const int dpr = int(devicePixelRatio()); QRect x_rect(event->x, event->y, event->width, event->height); - QRect rect = mapFromNative(x_rect, dpr); + QRect rect = mapExposeFromNative(x_rect, dpr); if (m_exposeRegion.isEmpty()) m_exposeRegion = rect; @@ -1866,7 +1870,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * const int dpr = devicePixelRatio(); const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); - const QRect rect = mapFromNative(nativeRect, dpr); + const QRect rect = mapGeometryFromNative(nativeRect, dpr); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); @@ -1877,7 +1881,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); int newDpr = devicePixelRatio(); if (newDpr != dpr) { - QRect newRect = mapFromNative(nativeRect, newDpr); + QRect newRect = mapGeometryFromNative(nativeRect, newDpr); QPlatformWindow::setGeometry(newRect); QWindowSystemInterface::handleGeometryChange(window(), newRect); } From a8a00f646b57b5a7ca2cf8603311888ff6ff09f8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Jan 2015 12:45:28 +0100 Subject: [PATCH 57/68] Turn off font hinting when we do high DPI scaling Font hinting depends on the specific pixel size, and ends up very wrong when the painter is scaled. Change-Id: I2007ec7e7ad8d52358d76e88e030ea4df7e91455 Task-number: QTBUG-43809 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 5 +++++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 6 +++++- src/plugins/platforms/xcb/qxcbnativeinterface.h | 3 ++- src/plugins/platforms/xcb/qxcbscreen.cpp | 7 +++++++ src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 5dec1d0915..27ff33be86 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -521,6 +521,11 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin break; } + if (QGuiApplication::platformNativeInterface()->nativeResourceForScreen("nofonthinting", + QGuiApplication::primaryScreen())) { + return QFontEngine::HintNone; + } + if (useXftConf) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 3058b29f2d..31dedd40a2 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -78,7 +78,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"), QByteArrayLiteral("rootwindow"), - QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled") + QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled"), + QByteArrayLiteral("nofonthinting") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -283,6 +284,9 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q case GetTimestamp: result = getTimestamp(xcbScreen); break; + case NoFontHinting: + result = xcbScreen->noFontHinting() ? this : 0; //qboolptr... + break; default: break; } diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index b667f1a372..330dd008c4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -67,7 +67,8 @@ public: X11Screen, RootWindow, ScreenSubpixelType, - ScreenAntialiasingEnabled + ScreenAntialiasingEnabled, + NoFontHinting }; QXcbNativeInterface(); diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 6559a0bdba..7136455754 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -62,6 +62,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_forcedDpi(-1) , m_devicePixelRatio(1) , m_hintStyle(QFontEngine::HintStyle(-1)) + , m_noFontHinting(false) , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1)) , m_antialiasingEnabled(-1) , m_xSettings(0) @@ -86,6 +87,12 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, readXResources(); + // disable font hinting when we do UI scaling + static bool dpr_scaling_enabled = (qgetenv("QT_DEVICE_PIXEL_RATIO").toInt() > 1 + || qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"); + if (dpr_scaling_enabled) + m_noFontHinting = true; + #ifdef Q_XCB_DEBUG qDebug(); qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 4675b12d9c..e9ab2edaa0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -98,6 +98,7 @@ public: void readXResources(); QFontEngine::HintStyle hintStyle() const { return m_hintStyle; } + bool noFontHinting() const { return m_noFontHinting; } QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; } int antialiasingEnabled() const { return m_antialiasingEnabled; } @@ -132,6 +133,7 @@ private: int m_forcedDpi; int m_devicePixelRatio; QFontEngine::HintStyle m_hintStyle; + bool m_noFontHinting; QFontEngine::SubpixelAntialiasingType m_subpixelType; int m_antialiasingEnabled; QXcbXSettings *m_xSettings; From 24238e6a3188062521ce7ed6d8d5468751a28d97 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 4 Dec 2014 15:14:18 +0100 Subject: [PATCH 58/68] Doc: link issues in corelib Task-number: QTBUG-43115 Change-Id: Ia80802e698f16730698e9a90102f549fb35f9305 Reviewed-by: Martin Smith --- src/corelib/doc/src/external-resources.qdoc | 11 +++++++++++ src/corelib/kernel/qobject.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc index a4f1b8723a..03af1d81bf 100644 --- a/src/corelib/doc/src/external-resources.qdoc +++ b/src/corelib/doc/src/external-resources.qdoc @@ -55,3 +55,14 @@ \externalpage http://www.iana.org/assignments/character-sets/character-sets.xml \title IANA character-sets encoding file */ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html + \title Using a Designer UI File in Your Application +*/ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor + \title Qt Designer's Widget Editing Mode#The Property Editor +*/ +*/ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 492031d7fe..a1a04b3ce5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2741,9 +2741,9 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign You can check if the QMetaObject::Connection is valid by casting it to a bool. This function works in the same way as - connect(const QObject *sender, const char *signal, + \c {connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, - Qt::ConnectionType type) + Qt::ConnectionType type)} but it uses QMetaMethod to specify signal and method. \sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) @@ -2996,7 +2996,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, otherwise returns \c false. This function provides the same possibilities like - disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) + \c {disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) } but uses QMetaMethod to represent the signal and the method to be disconnected. Additionally this function returnsfalse and no signals and slots disconnected @@ -4110,7 +4110,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { This macro associates extra information to the class, which is available using QObject::metaObject(). Qt makes only limited use of this feature, in - the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML} modules. + the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML module}{Qt QML}. The extra information takes the form of a \a Name string and a \a Value literal string. @@ -4122,7 +4122,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \sa QMetaObject::classInfo() \sa QAxFactory \sa {Using Qt D-Bus Adaptors} - \sa {Extending QML - Default Property Example} + \sa {Extending QML} */ /*! From 871560d45c1e4ad5c70c9d6b77cad8d3b15a4103 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 23 Dec 2014 13:39:24 +0100 Subject: [PATCH 59/68] Doc: define target voor function qsnprintf() Task-number: QTBUG-43537 Change-Id: I76c511891a1a07eca77da399d23097e76047f824 Reviewed-by: Martin Smith --- src/corelib/tools/qvsnprintf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp index cf595b8f31..be92e20fac 100644 --- a/src/corelib/tools/qvsnprintf.cpp +++ b/src/corelib/tools/qvsnprintf.cpp @@ -97,6 +97,7 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap) #endif /*! + \target bytearray-qsnprintf \relates QByteArray A portable snprintf() function, calls qvsnprintf. From ddbac7de8d904d02d1f84d4d2d76c2885ffa32c0 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 5 Jan 2015 13:11:18 +0100 Subject: [PATCH 60/68] Doc: added entry for link to main page Qt Creator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-43115 Change-Id: I10413536b981bf248950522dfe07b96394db9c29 Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- doc/global/externalsites/qch-urls.qdoc | 95 -------------------------- qmake/doc/src/qmake-manual.qdoc | 8 +-- 2 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 doc/global/externalsites/qch-urls.qdoc diff --git a/doc/global/externalsites/qch-urls.qdoc b/doc/global/externalsites/qch-urls.qdoc deleted file mode 100644 index 53ab94091e..0000000000 --- a/doc/global/externalsites/qch-urls.qdoc +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-qml-application.html - \title external: Developing Qt Quick Applications with Creator -*/ -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-visual-editor.html - \title external: Developing Qt Quick Applications -*/ -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-publish-ovi.html - \title external: Publishing Applications to Ovi Store -*/ -/*! - \externalpage http://doc.qt.io/qtcreator - \title external: Qt Creator Manual -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/index.html - \title external: Qt Mobility Manual -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/qml-plugins.html - \title external: Qt Mobility QML Plugins -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-project-managing.html - \title external: Creating Qt Projects in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-building-running.html - \title external: Building and Running Applications in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-running-targets.html - \title external: Set Compiler Targets in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-build-settings.html - \title external: Build Settings in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-run-settings.html - \title external: Run Settings in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-using-qt-designer.html - \title external: Designer in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-debugging.html - \title external: Debugging Applications in Creator -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/multimedia.html - \title external: Mobility Multimedia -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/location-overview.html - \title external: Mobility Location -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/all-examples.html - \title external: Qt Mobility Examples -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-overview.html - \title external: Qt Creator Overview -*/ diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 414b42d48e..b78a742999 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -122,10 +122,10 @@ configuration options to fine tune the build process. For more information, see \l{Building Common Project Types}. - You can use the \l{external: Qt Creator Manual}{Qt Creator} new project - wizard to create the project file. You choose the project template, and Qt - Creator creates a project file with default values that enable you to build - and run the project. You can modify the project file to suit your purposes. + You can use the \l{Qt Creator: Creating Projects}{Qt Creator new project wizard} to create the project file. + You choose the project template, and Qt Creator creates a project file with + default values that enable you to build and run the project. You can modify + the project file to suit your purposes. You can also use qmake to generate project files. For a full description of qmake command line options, see \l{Running qmake}. From 576cf413bb126e0350a2d8d79267496d7619e6c2 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 6 Jan 2015 12:55:58 +0100 Subject: [PATCH 61/68] Doc: verb "to layout" changed to "to lay out" Task-number: QTBUG-43657 Change-Id: I574186253ee423cc380ec3c6f274f1caa2a6aa2a Reviewed-by: Martin Smith --- src/gui/text/qfontmetrics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 9610482145..e010dd62ae 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -647,7 +647,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -817,7 +817,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -1432,7 +1432,7 @@ qreal QFontMetricsF::width(QChar ch) const e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -1606,7 +1606,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as From 5884160db62f32bed91f8449c4ca1204b8ba5dbd Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Jan 2015 13:49:52 +0100 Subject: [PATCH 62/68] iOS: add AppIcon asset name to Xcode project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current work-flow for adding app icons to an iOS app during deployment is not good. You basically need to specify that you want to use asset catalogs from within Xcode and add your icons there. The problem is that qmake will regenerate the Xcode project the next time it runs, and your changes will then be lost. This patch will check if the project has a valid asset catalog assigned to QMAKE_BUNDLE_DATA, and configure the Xcode project to use it for app icons. Change-Id: I06621ca46aad91de96cb23ba8ca3b1a3f1226670 Reviewed-by: Tor Arne Vestbø --- mkspecs/macx-ios-clang/features/default_post.prf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index aa849eb8b1..f1f23dd716 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -174,6 +174,21 @@ macx-xcode { ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += ios_device_family + # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an + # AppIcon.appiconset, we configure Xcode to use it for app icons. + for(bundle_data, QMAKE_BUNDLE_DATA) { + for(bundle_file, $${bundle_data}.files) { + !contains(bundle_file, .*\.xcassets$): next() + !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() + + asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME" + asset_catalog_appicon.value = "AppIcon" + QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon + break() + } + !isEmpty(asset_catalog_appicon.name): break() + } + # Set up default 4-inch iPhone/iPod launch image so that our apps # support the full screen resolution of those devices. launch_image = Default-568h@2x.png From e01c8103e14371dab7660343aff058528a11d763 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 22 Dec 2014 16:45:09 +0100 Subject: [PATCH 63/68] fix MSVC target architecture detection for amd64_x86 When using the cross-compiler toolchain for 32 bit on a 64 bit machine, qmake generated a 64 bit VS project. This was because qmake didn't know about the amd64_x86 cross-compiler, and qmake did not use the first MSVC bin directory it found in PATH. Task-number: QTBUG-43457 Change-Id: I50c6f7bb9afe44a58321c670d680dbcc7cd07223 Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakeevaluator.cpp | 57 +++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 4eb624aa87..fe089c1059 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -944,6 +944,45 @@ void QMakeEvaluator::setTemplate() } } +#if defined(Q_CC_MSVC) +static ProString msvcBinDirToQMakeArch(QString subdir) +{ + int idx = subdir.indexOf(QLatin1Char('\\')); + if (idx == -1) + return ProString("x86"); + subdir.remove(0, idx + 1); + idx = subdir.indexOf(QLatin1Char('_')); + if (idx >= 0) + subdir.remove(0, idx + 1); + subdir = subdir.toLower(); + if (subdir == QStringLiteral("amd64")) + return ProString("x86_64"); + return ProString(subdir); +} + +static ProString defaultMsvcArchitecture() +{ + return ProString("x86"); +} + +static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pathVar) +{ + if (vcInstallDir.isEmpty()) + return defaultMsvcArchitecture(); + QString vcBinDir = vcInstallDir; + if (vcBinDir.endsWith(QLatin1Char('\\'))) + vcBinDir.chop(1); + foreach (const QString &dir, pathVar.split(QLatin1Char(';'))) { + if (!dir.startsWith(vcBinDir, Qt::CaseInsensitive)) + continue; + const ProString arch = msvcBinDirToQMakeArch(dir.mid(vcBinDir.length() + 1)); + if (!arch.isEmpty()) + return arch; + } + return defaultMsvcArchitecture(); +} +#endif // defined(Q_CC_MSVC) + void QMakeEvaluator::loadDefaults() { ProValueMap &vars = m_valuemapStack.top(); @@ -1004,21 +1043,9 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("QMAKE_HOST.arch")] << archStr; # if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake - QLatin1Char backslash('\\'); - QString paths = m_option->getEnv(QLatin1String("PATH")); - QString vcBin64 = m_option->getEnv(QLatin1String("VCINSTALLDIR")); - if (!vcBin64.endsWith(backslash)) - vcBin64.append(backslash); - vcBin64.append(QLatin1String("bin\\amd64")); - QString vcBinX86_64 = m_option->getEnv(QLatin1String("VCINSTALLDIR")); - if (!vcBinX86_64.endsWith(backslash)) - vcBinX86_64.append(backslash); - vcBinX86_64.append(QLatin1String("bin\\x86_amd64")); - if (paths.contains(vcBin64, Qt::CaseInsensitive) - || paths.contains(vcBinX86_64, Qt::CaseInsensitive)) - vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86_64"); - else - vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86"); + vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture( + m_option->getEnv(QLatin1String("VCINSTALLDIR")), + m_option->getEnv(QLatin1String("PATH"))); # endif #elif defined(Q_OS_UNIX) struct utsname name; From c28718b88b0cfc712a5177f04475813045c45119 Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Fri, 16 Jan 2015 11:44:59 +0100 Subject: [PATCH 64/68] Correction on bound values in case of repeated QSqlQuery::execBatch Until now, QSqlQuery::execBatch did not call resetBindCount, which lead the next call to QSqlQuery::addBindValue to start at non zero index. This is problematic in case of a prepared query which is called several times. Task-number: QTBUG-43874 Change-Id: I1a0f46e39b74d9538009967fd98a269e05aac6f2 Reviewed-by: Mark Brand --- src/sql/kernel/qsqlquery.cpp | 1 + .../sql/kernel/qsqlquery/tst_qsqlquery.cpp | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 98e262a7e2..2808587d96 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -1060,6 +1060,7 @@ bool QSqlQuery::exec() */ bool QSqlQuery::execBatch(BatchExecutionMode mode) { + d->sqlResult->resetBindCount(); return d->sqlResult->execBatch(mode == ValuesAsColumns); } diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index a862ce2094..ecf3a9b050 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -147,6 +147,8 @@ private slots: void invalidQuery(); void batchExec_data() { generic_data(); } void batchExec(); + void QTBUG_43874_data() { generic_data(); } + void QTBUG_43874(); void oraArrayBind_data() { generic_data(); } void oraArrayBind(); void lastInsertId_data() { generic_data(); } @@ -338,6 +340,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName("blobstest", __FILE__, db) << qTableName("oraRowId", __FILE__, db) << qTableName("qtest_batch", __FILE__, db) + << qTableName("bug43874", __FILE__, db) << qTableName("bug6421", __FILE__, db).toUpper() << qTableName("bug5765", __FILE__, db) << qTableName("bug6852", __FILE__, db) @@ -2185,6 +2188,33 @@ void tst_QSqlQuery::batchExec() QVERIFY( q.value( 3 ).isNull() ); } +void tst_QSqlQuery::QTBUG_43874() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + const QString tableName = qTableName("bug43874", __FILE__, db); + + QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INT)")); + QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)")); + + for (int i = 0; i < 2; ++i) { + QVariantList ids; + ids << i; + q.addBindValue(ids); + QVERIFY_SQL(q, execBatch()); + } + QVERIFY_SQL(q, exec("SELECT id FROM " + tableName + " ORDER BY id")); + + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 0); + + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 1); +} + void tst_QSqlQuery::oraArrayBind() { QFETCH( QString, dbName ); From 593e3f2fbb324f076e4d3f05b269f21f8c3ca403 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Tue, 9 Dec 2014 14:58:26 +0100 Subject: [PATCH 65/68] Update printer metrics after resolution change. [ChangeLog][QtPrintSupport] Fixed QPrinter::{width,height} return values when the resolution is changed in the print dialog. Task-number: QTBUG-43124 Change-Id: Ib805907affed4b1ffb48e6b1ff89f7a79ab3e329 Reviewed-by: Andy Shaw --- src/printsupport/kernel/qprintengine_win.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 4e0a3e0795..69f74ef775 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -931,6 +931,8 @@ void QWin32PrintEnginePrivate::initHDC() default: break; } + + updateMetrics(); } void QWin32PrintEnginePrivate::release() From 5239ba95e8d68a96b2783793576490f119fb5700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 15 Jan 2015 23:42:25 +0100 Subject: [PATCH 66/68] Add missing AppDataLocation case This amends commit f3bc9f5c. Change-Id: I69b1a5080e7ac92b8a39746d814da77b17c271c2 Task-number: QTBUG-43868 Reviewed-by: Friedemann Kleint --- src/corelib/io/qstandardpaths_mac.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index 01d1c01f78..13b864600e 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -167,6 +167,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) case TempLocation: return QDir::tempPath(); case GenericDataLocation: + case AppDataLocation: case AppLocalDataLocation: case GenericCacheLocation: case CacheLocation: From b2cff0b4bf93bc85b9b76098e8e8ff2fdaf83198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 14 Jan 2015 14:20:04 +0100 Subject: [PATCH 67/68] Fix stylesheet crash. Style sheets that refer to the progress bar (like "QProgressDialog[maximum='0']{}") may dereference a null-pointer during the styleHint() call in QProgressDialogPrivate::init() since the progress bar has not been created yet. Move the creation of the progress bar closer to the top of init(), before the styleHint() call. Change-Id: I31c3c1c346430fc9fe86b0977403dea0c0dc5e90 Task-number: QTBUG-43830 Reviewed-by: Andras Becsi --- src/widgets/dialogs/qprogressdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 01ca398a14..371949e768 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -108,10 +108,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance { Q_Q(QProgressDialog); label = new QLabel(labelText, q); - int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); - label->setAlignment(Qt::Alignment(align)); bar = new QProgressBar(q); bar->setRange(min, max); + int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); + label->setAlignment(Qt::Alignment(align)); autoClose = true; autoReset = true; forceHide = false; From 9d1bcd727ae50331980e52119f2256266c27b5d4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Jan 2015 14:15:30 +0100 Subject: [PATCH 68/68] Diaglib/Event filter: Output application state on focus events. Output the current active/modal/popup windows when receiving FocusAboutToChange or FocusIn events. Task-number: QTBUG-42731 Change-Id: Ia88e9a9b41f7c80fb7a2a048b06da56d989ff18a Reviewed-by: Shawn Rutledge --- tests/manual/diaglib/eventfilter.cpp | 74 ++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp index 23a6d44fef..0a815fd883 100644 --- a/tests/manual/diaglib/eventfilter.cpp +++ b/tests/manual/diaglib/eventfilter.cpp @@ -36,6 +36,28 @@ #include #include +#if QT_VERSION >= 0x050000 +# if defined(QT_WIDGETS_LIB) +# define HAVE_APPLICATION +# endif +# if defined(QT_GUI_LIB) +# define HAVE_GUI_APPLICATION +# endif +#else // Qt 5 +# if defined(QT_GUI_LIB) +# define HAVE_APPLICATION +# endif +#endif + +#ifdef HAVE_APPLICATION +# include +# include +#endif +#ifdef HAVE_GUI_APPLICATION +# include +# include +#endif + namespace QtDiag { EventFilter::EventFilter(EventCategories eventCategories, QObject *p) @@ -131,16 +153,60 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types) return types & EventFilter::OtherType; } +static void formatObject(const QObject *o, QDebug debug) +{ + if (o) { + debug << o->metaObject()->className(); + const QString on = o->objectName(); + if (!on.isEmpty()) + debug << '/' << on; + } else { + debug << "null"; + } +} + +static void formatApplicationState(QDebug debug) +{ +#if defined(HAVE_APPLICATION) + if (const QWidget *mw = QApplication::activeModalWidget()) { + debug << "\n QApplication::activeModalWidget = "; + formatObject(mw, debug); + } + if (const QWidget *pw = QApplication::activePopupWidget()) { + debug << "\n QApplication::activePopupWidget = "; + formatObject(pw, debug); + } + debug << "\n QApplication::activeWindow = "; + formatObject(QApplication::activeWindow(), debug); +#endif // HAVE_APPLICATION +#if defined(HAVE_GUI_APPLICATION) + if (const QWindow *mw = QGuiApplication::modalWindow()) { + debug << "\n QGuiApplication::modalWindow = "; + formatObject(mw, debug); + } + debug << "\n QGuiApplication::focusWindow = "; + formatObject(QGuiApplication::focusWindow(), debug); +#endif // HAVE_GUI_APPLICATION +} + bool EventFilter::eventFilter(QObject *o, QEvent *e) { static int n = 0; if (matchesType(o, m_objectTypes) && m_eventTypes.contains(e->type())) { QDebug debug = qDebug().nospace(); - const QString on = o->objectName(); - debug << '#' << n++ << ' ' << o->metaObject()->className(); - if (!on.isEmpty()) - debug << '/' << on; + debug << '#' << n++ << ' '; + formatObject(o, debug); debug << ' ' << e; + switch (e->type()) { +#if QT_VERSION >= 0x050000 + case QEvent::FocusAboutToChange: +#endif + case QEvent::FocusIn: + formatApplicationState(debug); + break; + default: + break; + } } return false; }