From d345783e4dacffc870c944f88e9323407eb63a07 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 24 Feb 2016 14:30:21 +0100 Subject: Remove superfluous Windows CE special cases from tst_qprocess.cpp Use default timeouts for wait functions. The increased timeouts will only have an effect if the tests fail. Print process errors if the process could not be started, while we're at it. Contract consecutive "#ifndef Q_OS_WINCE" blocks. Change-Id: I6324e4c5b91b89ebb2580635b88705bbda922907 Reviewed-by: Oliver Wolff --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 35 +++++-------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 8b311921e2..8b8c731987 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -689,11 +689,7 @@ void tst_QProcess::waitForFinished() process.start("testProcessOutput/testProcessOutput"); -#if !defined(Q_OS_WINCE) - QVERIFY(process.waitForFinished(5000)); -#else - QVERIFY(process.waitForFinished(30000)); -#endif + QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); #if defined (Q_OS_WINCE) @@ -917,12 +913,7 @@ void tst_QProcess::hardExit() proc.start("testProcessEcho/testProcessEcho"); #endif -#ifndef Q_OS_WINCE - QVERIFY(proc.waitForStarted(5000)); -#else - QVERIFY(proc.waitForStarted(10000)); -#endif - + QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); proc.kill(); QVERIFY(proc.waitForFinished(5000)); @@ -1415,24 +1406,17 @@ void tst_QProcess::spaceArgsTest() QString program = programs.at(i); process.start(program, args); -#if defined(Q_OS_WINCE) - const int timeOutMS = 10000; -#else - const int timeOutMS = 5000; -#endif QByteArray errorMessage; - bool started = process.waitForStarted(timeOutMS); + bool started = process.waitForStarted(); if (!started) errorMessage = startFailMessage(program, process); QVERIFY2(started, errorMessage.constData()); - QVERIFY(process.waitForFinished(timeOutMS)); + QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); #if !defined(Q_OS_WINCE) QStringList actual = QString::fromLatin1(process.readAll()).split("|"); -#endif -#if !defined(Q_OS_WINCE) QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); @@ -1457,8 +1441,6 @@ void tst_QProcess::spaceArgsTest() #if !defined(Q_OS_WINCE) actual = QString::fromLatin1(process.readAll()).split("|"); -#endif -#if !defined(Q_OS_WINCE) QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); @@ -1480,13 +1462,8 @@ void tst_QProcess::nativeArguments() proc.start(QString::fromLatin1("testProcessSpacesArgs/nospace"), QStringList()); -#if !defined(Q_OS_WINCE) - QVERIFY(proc.waitForStarted(5000)); - QVERIFY(proc.waitForFinished(5000)); -#else - QVERIFY(proc.waitForStarted(10000)); - QVERIFY(proc.waitForFinished(10000)); -#endif + QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); + QVERIFY(proc.waitForFinished()); QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); -- cgit v1.2.3 From 837d75eed500bd0138d78c60edc54d0dd75967cf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 26 Feb 2016 13:24:05 +0100 Subject: qt_handleTouchEvent(): Scale coordinates when converting touch points. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove outdated static functions to convert touch points and use QWindowSystemInterfacePrivate::fromNativeTouchPoints(). Fix tst_QWidget::underMouse() to pass when High DPI scaling is in effect. .\tst_qwidget.cpp(9000) : failure location FAIL! : tst_QWidget::underMouse() 'childWidget1.underMouse()' returned FALSE. () .\tst_qwidget.cpp(10161) : failure location Task-number: QTBUG-46615 Change-Id: Ie73dba610da357e7be396f2ea0229987f7503462 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qwindowsysteminterface.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index e10ddf22a7..b0772e7a96 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -906,36 +906,14 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int #endif } -static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt) -{ - QWindowSystemInterface::TouchPoint p; - p.id = pt.id(); - p.flags = pt.flags(); - p.normalPosition = pt.normalizedPos(); - p.area = pt.screenRect(); - p.pressure = pt.pressure(); - p.state = pt.state(); - p.velocity = pt.velocity(); - p.rawPositions = pt.rawScreenPositions(); - return p; -} -static QList touchPointList(const QList& pointList) -{ - QList newList; - - Q_FOREACH (QTouchEvent::TouchPoint p, pointList) - newList.append(touchPoint(p)); - - return newList; -} - Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier) { bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; QWindowSystemInterface::setSynchronousWindowSystemEvents(true); - QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods); + QWindowSystemInterface::handleTouchEvent(w, device, + QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods); QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } -- cgit v1.2.3 From c7e213334bb70fb023e2bdc3a590dfd4605b73ba Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 29 Feb 2016 10:42:58 +0100 Subject: tst_QDialog: Instantiate test dialog on the stack. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the member variable and instantiate only where needed on the stack to prevent it from interfering with windows created by other tests. Remove flag Qt::X11BypassWindowManagerHint as it does not seem to have any effect. Task-number: QTBUG-51516 Change-Id: I3bf88bf148f365c57aaf989671f8b9c3c3f0d8e2 Reviewed-by: Tony Sarajärvi Reviewed-by: Simon Hausmann --- tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 89 ++++++++++------------ 1 file changed, 41 insertions(+), 48 deletions(-) diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 438884df33..dc796dbd73 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -55,7 +55,7 @@ QT_FORWARD_DECLARE_CLASS(QDialog) class DummyDialog : public QDialog { public: - DummyDialog(): QDialog(0, Qt::X11BypassWindowManagerHint) {} + DummyDialog(): QDialog() {} using QDialog::showExtension; }; @@ -65,10 +65,8 @@ class tst_QDialog : public QObject public: tst_QDialog(); -public slots: - void initTestCase(); - void cleanupTestCase(); private slots: + void cleanup(); void getSetCheck(); void showExtension_data(); void showExtension(); @@ -91,9 +89,6 @@ private slots: void transientParent_data(); void transientParent(); void dialogInGraphicsView(); - -private: - DummyDialog *testWidget; }; // Testing get/set functions @@ -149,25 +144,12 @@ private: }; tst_QDialog::tst_QDialog() - { } -void tst_QDialog::initTestCase() +void tst_QDialog::cleanup() { - // Create the test class - testWidget = new DummyDialog; - testWidget->resize(200,200); - testWidget->show(); - qApp->setActiveWindow(testWidget); -} - -void tst_QDialog::cleanupTestCase() -{ - if (testWidget) { - delete testWidget; - testWidget = 0; - } + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QDialog::showExtension_data() @@ -190,44 +172,52 @@ void tst_QDialog::showExtension() QFETCH( QSize, extSize ); QFETCH( bool, horizontal ); - // set geometry of main dialog and extension widget - testWidget->setFixedSize( dlgSize ); - QWidget *ext = new QWidget( testWidget ); + DummyDialog testWidget; + testWidget.resize(200, 200); + testWidget.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(':') + + QLatin1String(QTest::currentDataTag())); + testWidget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); + + testWidget.setFixedSize( dlgSize ); + QWidget *ext = new QWidget( &testWidget ); ext->setFixedSize( extSize ); - testWidget->setExtension( ext ); - testWidget->setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical ); + testWidget.setExtension( ext ); + testWidget.setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical ); - QCOMPARE( testWidget->size(), dlgSize ); - QPoint oldPosition = testWidget->pos(); + QCOMPARE( testWidget.size(), dlgSize ); + QPoint oldPosition = testWidget.pos(); // show - testWidget->showExtension( true ); + testWidget.showExtension( true ); // while ( testWidget->size() == dlgSize ) // qApp->processEvents(); - QTEST( testWidget->size(), "result" ); + QTEST( testWidget.size(), "result" ); - QCOMPARE(testWidget->pos(), oldPosition); + QCOMPARE(testWidget.pos(), oldPosition); // hide extension. back to old size ? - testWidget->showExtension( false ); - QCOMPARE( testWidget->size(), dlgSize ); + testWidget.showExtension( false ); + QCOMPARE( testWidget.size(), dlgSize ); - testWidget->setExtension( 0 ); + testWidget.setExtension( 0 ); } void tst_QDialog::defaultButtons() { - QLineEdit *lineEdit = new QLineEdit(testWidget); - QPushButton *push = new QPushButton("Button 1", testWidget); - QPushButton *pushTwo = new QPushButton("Button 2", testWidget); - QPushButton *pushThree = new QPushButton("Button 3", testWidget); + DummyDialog testWidget; + testWidget.resize(200, 200); + testWidget.setWindowTitle(QTest::currentTestFunction()); + QLineEdit *lineEdit = new QLineEdit(&testWidget); + QPushButton *push = new QPushButton("Button 1", &testWidget); + QPushButton *pushTwo = new QPushButton("Button 2", &testWidget); + QPushButton *pushThree = new QPushButton("Button 3", &testWidget); pushThree->setAutoDefault(false); - //we need to show the buttons. Otherwise they won't get the focus - push->show(); - pushTwo->show(); - pushThree->show(); + testWidget.show(); + QApplication::setActiveWindow(&testWidget); + QVERIFY(QTest::qWaitForWindowActive(&testWidget)); push->setDefault(true); QVERIFY(push->isDefault()); @@ -380,11 +370,15 @@ void tst_QDialog::showAsTool() #if defined(Q_OS_UNIX) QSKIP("Qt/X11: Skipped since activeWindow() is not respected by all window managers"); #endif - ToolDialog dialog(testWidget); - testWidget->activateWindow(); + DummyDialog testWidget; + testWidget.resize(200, 200); + testWidget.setWindowTitle(QTest::currentTestFunction()); + ToolDialog dialog(&testWidget); + testWidget.show(); + testWidget.activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(&testWidget)); dialog.exec(); - QTest::qWait(100); - if (testWidget->style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, testWidget)) { + if (testWidget.style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, &testWidget)) { QCOMPARE(dialog.wasActive(), true); } else { QCOMPARE(dialog.wasActive(), false); @@ -607,7 +601,6 @@ void tst_QDialog::transientParent_data() void tst_QDialog::transientParent() { QFETCH(bool, nativewidgets); - testWidget->hide(); QWidget topLevel; topLevel.resize(200, 200); topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100)); -- cgit v1.2.3 From 6f75c189e1e5651b716afb316c801d080001c155 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 24 Feb 2016 12:36:36 +0100 Subject: Fix crash in QProcess::waitForFinished on Windows Suppose the user connects QProcess::readyReadStandardOutput with a slot that calls QCoreApplication::processEvents. Assume the event loop did not handle events between QProcess::start and QProcess::waitForFinished. The process writes to stdout and exits. QProcessPrivate::waitForFinished calls drainOutputPipes which calls QWindowsPipeWriter::waitForReadyRead. This in turn will trigger _q_processDied via the readyRead signal and processEvents. _q_processDied will delete the pid object and set pid to null. After drainOutputPipes returns, _q_processDied is called again but it must not be called if pid is already destroyed. Prevent calling _q_processDied if pid is null. Task-number: QTBUG-48697 Change-Id: Iee047938ee1529057a1a43d71f4e882750903c7e Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_win.cpp | 6 +++-- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 33 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 80e6d5bb61..98ada82446 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -647,7 +647,8 @@ bool QProcessPrivate::waitForReadyRead(int msecs) return false; if (WaitForSingleObjectEx(pid->hProcess, 0, false) == WAIT_OBJECT_0) { bool readyReadEmitted = drainOutputPipes(); - _q_processDied(); + if (pid) + _q_processDied(); return readyReadEmitted; } @@ -752,7 +753,8 @@ bool QProcessPrivate::waitForFinished(int msecs) if (WaitForSingleObject(pid->hProcess, timer.nextSleepTime()) == WAIT_OBJECT_0) { drainOutputPipes(); - _q_processDied(); + if (pid) + _q_processDied(); return true; } diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 8b8c731987..46bf1a19e8 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -145,6 +145,8 @@ private slots: void startStopStartStop(); void startStopStartStopBuffers_data(); void startStopStartStopBuffers(); + void processEventsInAReadyReadSlot_data(); + void processEventsInAReadyReadSlot(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -157,6 +159,7 @@ private slots: protected slots: void readFromProcess(); void exitLoopSlot(); + void processApplicationEvents(); #ifndef Q_OS_WINCE void restartProcess(); void waitForReadyReadInAReadyReadSlotSlot(); @@ -475,6 +478,11 @@ void tst_QProcess::exitLoopSlot() QTestEventLoop::instance().exitLoop(); } +void tst_QProcess::processApplicationEvents() +{ + QCoreApplication::processEvents(); +} + #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest2() @@ -2499,6 +2507,31 @@ void tst_QProcess::startStopStartStopBuffers() } } +void tst_QProcess::processEventsInAReadyReadSlot_data() +{ + QTest::addColumn("callWaitForReadyRead"); + + QTest::newRow("no waitForReadyRead") << false; + QTest::newRow("waitForReadyRead") << true; +} + +void tst_QProcess::processEventsInAReadyReadSlot() +{ + // Test whether processing events in a readyReadXXX slot crashes. (QTBUG-48697) + QFETCH(bool, callWaitForReadyRead); + QProcess process; + QObject::connect(&process, &QProcess::readyReadStandardOutput, + this, &tst_QProcess::processApplicationEvents); + process.start("testProcessEcho/testProcessEcho"); + QVERIFY(process.waitForStarted()); + const QByteArray data(156, 'x'); + process.write(data.constData(), data.size() + 1); + if (callWaitForReadyRead) + QVERIFY(process.waitForReadyRead()); + if (process.state() == QProcess::Running) + QVERIFY(process.waitForFinished()); +} + #endif //QT_NO_PROCESS QTEST_MAIN(tst_QProcess) -- cgit v1.2.3 From 717ff946391233e7e4a99b8042494512ca3957d7 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 26 Feb 2016 10:15:20 -0800 Subject: QMenuBar: Acknowledge AA_DontUseNativeMenuBar Change-Id: I756f4181d66ef6e79ab7b7be8a23a10171a9f30c Task-number: QTBUG-28960 Reviewed-by: Timur Pocheptsov --- src/widgets/widgets/qmenubar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 2e48607f82..cca0853a8f 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -690,7 +690,8 @@ void QMenuBarPrivate::init() q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); q->setAttribute(Qt::WA_CustomWhatsThis); - platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(); + if (!QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar)) + platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(); if (platformMenuBar) q->hide(); -- cgit v1.2.3 From 8b94ceaff8e67827302a1190ad828cb90cf3b977 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 26 Feb 2016 10:15:43 -0800 Subject: QMacStyle and QCocoaTheme: Fix selected item color for non-native menubar Change-Id: I3b55e9ce896383338cf6ed768d912ca1835b7742 Task-number: QTBUG-28960 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoasystemsettings.mm | 4 +++- src/widgets/styles/qmacstyle_mac.mm | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 93f8b2ba6f..48f2f72b7e 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -143,6 +143,7 @@ static QMacPaletteMap mac_widget_colors[] = { QMacPaletteMap(QPlatformTheme::LabelPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), QMacPaletteMap(QPlatformTheme::GroupBoxPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), QMacPaletteMap(QPlatformTheme::MenuPalette, kThemeTextColorMenuItemActive, kThemeTextColorMenuItemDisabled), + QMacPaletteMap(QPlatformTheme::MenuBarPalette, kThemeTextColorMenuItemActive, kThemeTextColorMenuItemDisabled), //### TODO: The zeros below gives white-on-black text. QMacPaletteMap(QPlatformTheme::TextEditPalette, 0, 0), QMacPaletteMap(QPlatformTheme::TextLineEditPalette, 0, 0), @@ -167,7 +168,8 @@ QHash qt_mac_createRolePalettes() pal.setColor(QPalette::Disabled, QPalette::WindowText, qc); pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc); } - if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette) { + if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette + || mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) { qc = qt_mac_colorForTheme(kThemeBrushMenuBackground); pal.setBrush(QPalette::Background, qc); qc = qt_mac_colorForThemeTextColor(kThemeTextColorMenuItemActive); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index ac23512f1d..4f688f6f28 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4608,7 +4608,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIRect menuRect = qt_hirectForQRect(mi->menuRect); HIRect itemRect = qt_hirectForQRect(mi->rect); - if ((opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken)){ + const bool selected = (opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken); + if (selected) { // Draw a selected menu item background: HIThemeMenuItemDrawInfo mdi; mdi.version = qt_mac_hitheme_version; @@ -4636,7 +4637,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip | Qt::TextSingleLine, mi->palette, mi->state & State_Enabled, - mi->text, QPalette::ButtonText); + mi->text, selected ? QPalette::HighlightedText : QPalette::ButtonText); } } break; -- cgit v1.2.3 From 3e58e15c3d95a7ca0786c837dd9c0d93c93ae562 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 19 Jul 2015 21:58:32 +0200 Subject: QJsonPrivate::q_littleendian: mark as primitive/movable, depending on T Inherit the type-classification from the underlying type. This amends commit 4889269ff0fb37130b332863e82dd7c19564116c, which introduced a QVector, but failed to mark the payload as primitive. Change-Id: I525a0456a550e0694b33b36b4aa71475aeac192b Reviewed-by: Lars Knoll --- src/corelib/json/qjson_p.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 1767b3e9e6..0b3f517990 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -144,6 +144,13 @@ public: return *this; } }; +} // namespace QJsonPrivate + +template +class QTypeInfo > + : public QTypeInfoMerger, T> {}; + +namespace QJsonPrivate { typedef q_littleendian qle_short; typedef q_littleendian qle_ushort; -- cgit v1.2.3 From d7d4a3ecfc9da82c04c3a217fdfee0324f4ad9fa Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 23 Feb 2016 10:49:35 +0100 Subject: Doc: Add the missing \l command and the target section title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8478467a074ecff9834850c36961ae8e218cea02 Task-number: QTBUG-51290 Reviewed-by: Topi Reiniö Reviewed-by: Edward Welbourne --- src/corelib/doc/src/objectmodel/signalsandslots.qdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index 6f183d3e71..216bd985db 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -251,7 +251,8 @@ This example illustrates that objects can work together without needing to know any information about each other. To enable this, the objects only need to be connected together, and this can be achieved with some simple - QObject::connect() function calls, or with \c{uic}'s {automatic connections} feature. + QObject::connect() function calls, or with \c{uic}'s + \l{Automatic Connections}{automatic connections} feature. \section1 A Real Example -- cgit v1.2.3 From c2530c7d2005ec734cc310d9122b0bf135120444 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 29 Feb 2016 19:47:57 +0800 Subject: Windows QPA: QWindowsWindow - always treat WM_ERASEBKGND as handled under certain conditions, a WM_ERASEBKGND message is sent, to a window without update region. in this case we declare the message as 'handled' to avoid flickering. Task-number: QTBUG-48235 Change-Id: I2ed27e020db4b54ec93a445cb219de00f38a62fd Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c0892feabe..e640d38241 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1559,11 +1559,11 @@ void QWindowsWindow::releaseDC() bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, WPARAM, LPARAM) { + if (message == WM_ERASEBKGND) // Backing store - ignored. + return true; // Ignore invalid update bounding rectangles if (!GetUpdateRect(m_data.hwnd, 0, FALSE)) return false; - if (message == WM_ERASEBKGND) // Backing store - ignored. - return true; PAINTSTRUCT ps; // Observed painting problems with Aero style disabled (QTBUG-7865). -- cgit v1.2.3 From 495e8c205424253186bef47421de63534d23dd59 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 14 Feb 2016 19:57:23 +0800 Subject: corewlan: avoid unnecessary currentInterface.serviceActive checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit currentInterface.serviceActive is relatively expensive and causes significant spikes in cpu load. Luckily, we can easily memorize the result. Change-Id: Ic7983b63bba5507bc1e34b0644e73365dc44f200 Task-number: QTBUG-45798 Task-number: QTCREATORBUG-15741 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 6d16b59d35..d89078465b 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -158,6 +158,7 @@ void QScanThread::run() mutex.lock(); CWInterface *currentInterface = [CWInterface interfaceWithName: QCFString::toNSString(interfaceName)]; mutex.unlock(); + const bool currentInterfaceServiceActive = currentInterface.serviceActive; if (currentInterface.powerOn) { NSError *err = nil; @@ -172,7 +173,7 @@ void QScanThread::run() QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; bool known = isKnownSsid(networkSsid); - if (currentInterface.serviceActive) { + if (currentInterfaceServiceActive) { if( networkSsid == QCFString::toQString( [currentInterface ssid])) { state = QNetworkConfiguration::Active; } @@ -215,7 +216,7 @@ void QScanThread::run() interfaceName = ij.value(); } - if (currentInterface.serviceActive) { + if (currentInterfaceServiceActive) { if( networkSsid == QCFString::toQString([currentInterface ssid])) { state = QNetworkConfiguration::Active; } -- cgit v1.2.3 From cb6d751efa2199746cd3c19e6639f8c23891e283 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 16 Feb 2016 08:46:56 +0100 Subject: Fix tests for platforms without process support Change-Id: I2d1cefdb5ff574635a75b54499efc392aba84434 Reviewed-by: Oliver Wolff --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 2 ++ tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro | 4 +++- tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 0d43b09d6b..f3334b1222 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -279,8 +279,10 @@ static void playWithObjects() void tst_QObject::initTestCase() { +#ifndef QT_NO_PROCESS const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath(); QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir)); +#endif } void tst_QObject::disconnect() diff --git a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro index a36b15c906..69062a9741 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro +++ b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro @@ -1,3 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = sharedmemoryhelper test +!winrt: SUBDIRS = sharedmemoryhelper + +SUBDIRS += test diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 26bb70fc66..43e25743d7 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -138,7 +138,9 @@ tst_QSharedMemory::~tst_QSharedMemory() void tst_QSharedMemory::initTestCase() { +#ifndef QT_NO_PROCESS QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary"); +#endif } void tst_QSharedMemory::init() -- cgit v1.2.3 From bd43dcae8a0761f265a4b1a10e34f301fc49f311 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 17 Feb 2016 12:00:05 +0100 Subject: Only copy the data if the image is not null If the image was unable to do the smooth scaling due to running out of memory then it will return a null QImage, so this should be checked before copying the data to prevent a crash. Change-Id: I82a6443ce2d701c45110b5dd3c5ed4813d078312 Reviewed-by: aavit Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qimage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 667b65431e..6f649efcf4 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4411,7 +4411,8 @@ QImage QImage::smoothScaled(int w, int h) const { src = src.convertToFormat(QImage::Format_RGB32); } src = qSmoothScaleImage(src, w, h); - copyMetadata(src.d, d); + if (!src.isNull()) + copyMetadata(src.d, d); return src; } -- cgit v1.2.3 From defd302f64f213a8764875a88788dbcea76d66f0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 26 Feb 2016 13:22:36 +0100 Subject: qt_handleMouseEvent(): Scale coordinates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix tst_qwindow::testInputEvents() to pass when High DPI scaling is in effect. FAIL! : tst_QWindow::testInputEvents() Compared values are not the same Actual (window.mousePressLocalPos): QPointF(6,17) Expected (local) : QPointF(12,34) .\tst_qwindow.cpp(771) : failure location Task-number: QTBUG-46615 Change-Id: I1ccacc807f3390b6ab26a369d13fd7896e64cbca Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qwindowsysteminterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index b0772e7a96..841e4f8f41 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -857,7 +857,9 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QP { bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; QWindowSystemInterface::setSynchronousWindowSystemEvents(true); - QWindowSystemInterface::handleMouseEvent(w, timestamp, local, global, b, mods); + const qreal factor = QHighDpiScaling::factor(w); + QWindowSystemInterface::handleMouseEvent(w, timestamp, local * factor, + global * factor, b, mods); QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } -- cgit v1.2.3 From 361142b5fcd199e7c301765b0dd16227cde71080 Mon Sep 17 00:00:00 2001 From: Vincas Dargis Date: Fri, 26 Feb 2016 09:54:38 +0200 Subject: PostgreSQL: Fix memory leak in subscribeToNotification() and unsubscribeFromNotification() Both subscribeToNotification() and unsubscribeFromNotification() are missing PQclear calls to free PGresult. Task-number: QTBUG-51412 Change-Id: I72ec3438b22bc99205c984b67b922766bcdbed08 Reviewed-by: Mark Brand --- src/sql/drivers/psql/qsql_psql.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index de1f1638fd..4f36e0b513 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1390,8 +1390,10 @@ bool QPSQLDriver::subscribeToNotification(const QString &name) PGresult *result = d->exec(query); if (PQresultStatus(result) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Unable to subscribe"), QSqlError::StatementError, d, result)); + PQclear(result); return false; } + PQclear(result); if (!d->sn) { d->sn = new QSocketNotifier(socket, QSocketNotifier::Read); @@ -1423,8 +1425,10 @@ bool QPSQLDriver::unsubscribeFromNotification(const QString &name) PGresult *result = d->exec(query); if (PQresultStatus(result) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Unable to unsubscribe"), QSqlError::StatementError, d, result)); + PQclear(result); return false; } + PQclear(result); d->seid.removeAll(name); -- cgit v1.2.3 From 359546b069051213a7b337fefbe21b664618f959 Mon Sep 17 00:00:00 2001 From: Romain Pokrzywka Date: Thu, 17 Sep 2015 10:21:32 -0700 Subject: evdevtouch: ensure touchpoints released with typeB mtdev drivers This happens in one particular case: when the touchpoint corresponding to the last slot is reported as released and a new point is reported as pressed right after, so that both events happens within a same sync. In this case, there will be two ABS_MT_TRACKING_ID events received, first with -1 to report the released touchpoint, then with a new id to report the pressed touchpoint, then the SYN_REPORT afterwards. This results in m_contacts[m_currentSlot].state being updated to Qt::TouchPointReleased then Qt::TouchPointPressed, with the former never being reported during the handling of SYN_REPORT. To handle this scenario we need to inspect m_lastContacts for a change in tracking id for a particular slot combined with a non-null state, indicating that slot has not yet been reported released and processed in the previous sync. (the state for processed released points is reset to zero at the end of the SYN_REPORT handler) Task-number: QTBUG-51563 Change-Id: I01493008cf9f267e758d974dab29556d0a1425ea Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs Reviewed-by: Robin Burchell --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index ad348cc083..7cb4813c7b 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -531,9 +531,16 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) it.next(); Contact &contact(it.value()); int key = m_typeB ? it.key() : contact.trackingId; - if (!m_contacts.contains(key)) { - contact.state = Qt::TouchPointReleased; - addTouchPoint(contact, &combinedStates); + if (m_typeB) { + if (contact.trackingId != m_contacts[key].trackingId && contact.state) { + contact.state = Qt::TouchPointReleased; + addTouchPoint(contact, &combinedStates); + } + } else { + if (!m_contacts.contains(key)) { + contact.state = Qt::TouchPointReleased; + addTouchPoint(contact, &combinedStates); + } } } -- cgit v1.2.3 From 0db793fe4117c243361d4b8eff4fb5ab87f66020 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Wed, 24 Feb 2016 20:05:48 +0200 Subject: QAbstractSocket: fix a possible crash in waitForReadyRead() waitForConnected() could return 'true' even when the socket was disconnected. Change-Id: I99d9c9730f4e9b6c8a54696eb92c24c3ef36d261 Reviewed-by: Markus Goetz (Woboq GmbH) --- src/network/socket/qabstractsocket.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 385146bb95..e60c821da6 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2149,8 +2149,10 @@ bool QAbstractSocket::waitForReadyRead(int msecs) return false; } - Q_ASSERT(d->socketEngine); do { + if (state() != ConnectedState) + return false; + bool readyToRead = false; bool readyToWrite = false; if (!d->socketEngine->waitForReadOrWrite(&readyToRead, &readyToWrite, true, !d->writeBuffer.isEmpty(), @@ -2172,9 +2174,6 @@ bool QAbstractSocket::waitForReadyRead(int msecs) if (readyToWrite) d->canWriteNotification(); - - if (state() != ConnectedState) - return false; } while (msecs == -1 || qt_subtract_from_timeout(msecs, stopWatch.elapsed()) > 0); return false; } -- cgit v1.2.3 From 82b8158022064851ef9151d441241aa4019605c2 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 10 Feb 2016 08:24:50 +0100 Subject: Windows: Extract the suffix from the simple file filter case Since the filter can either be something like "*.txt" or "Text Files (*.txt)" then it should have the suffix default to "txt" in both cases. Change-Id: I36a72f5bf0fb12c84db103f91c4fca94d0d933ae Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 2d75e1720a..ca5b90b429 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1466,18 +1466,21 @@ public: }; // Return the first suffix from the name filter "Foo files (*.foo;*.bar)" -> "foo". +// Also handles the simple name filter case "*.txt" -> "txt" static inline QString suffixFromFilter(const QString &filter) { - int suffixPos = filter.indexOf(QLatin1String("(*.")); + int suffixPos = filter.indexOf(QLatin1String("*.")); if (suffixPos < 0) return QString(); - suffixPos += 3; + suffixPos += 2; int endPos = filter.indexOf(QLatin1Char(' '), suffixPos + 1); if (endPos < 0) endPos = filter.indexOf(QLatin1Char(';'), suffixPos + 1); if (endPos < 0) endPos = filter.indexOf(QLatin1Char(')'), suffixPos + 1); - return endPos >= 0 ? filter.mid(suffixPos, endPos - suffixPos) : QString(); + if (endPos < 0) + endPos = filter.size(); + return filter.mid(suffixPos, endPos - suffixPos); } void QWindowsNativeSaveFileDialog::setNameFilters(const QStringList &f) -- cgit v1.2.3 From acba844c6ba0d72c6f37d8cbee8b343c23b05de1 Mon Sep 17 00:00:00 2001 From: David Weisgerber Date: Mon, 29 Feb 2016 15:48:47 +0100 Subject: Fixed reading REG_SZ without terminating \0 delivers garbage When reading from the registry, sometimes the string is not null terminated. In order to fix this, the preallocated QByteArray size is increased, so that there are guaranteed enough terminating \0 [Windows] Not null terminated strings are now read properly from the registry Change-Id: I95fdf42cbbb7074fcf010dd14d0241f02d3c412b Task-number: QTBUG-51382 Reviewed-by: Friedemann Kleint --- src/corelib/io/qsettings_win.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 1546219c3b..da0c4c3c14 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -484,6 +484,12 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa return false; } + // workaround for rare cases where trailing '\0' are missing in registry + if (dataType == REG_SZ || dataType == REG_EXPAND_SZ) + dataSize += 2; + else if (dataType == REG_MULTI_SZ) + dataSize += 4; + // get the value QByteArray data(dataSize, 0); res = RegQueryValueEx(handle, reinterpret_cast(rSubkeyName.utf16()), 0, 0, -- cgit v1.2.3 From 52a5ffb505f737836d69e512c50bb6aff0b75f02 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 1 Mar 2016 15:14:34 +0100 Subject: QMimeBinaryProvider::loadMimeTypePrivate(): Make name check case insensitive. RFC 2045 mandates case-insensitive comparison for MIME type and subtype. Fixes numerous warnings appearing when dumping the database on Ubuntu 14.04.1 LTS: Got name "application/vnd.ms-excel.sheet.binary.macroenabled.12" in file "application/vnd.ms-excel.sheet.binary.macroEnabled.12.xml" expected "application/vnd.ms-excel.sheet.binary.macroEnabled.12" Got name "application/vnd.ms-excel.sheet.macroenabled.12" in file "application/vnd.ms-excel.sheet.macroEnabled.12.xml" expected "application/vnd.ms-excel.sheet.macroEnabled.12" Got name "application/vnd.ms-excel.template.macroenabled.12" in file "application/vnd.ms-excel.template.macroEnabled.12.xml" expected "application/vnd.ms-excel.template.macroEnabled.12" Got name "application/vnd.ms-powerpoint.presentation.macroenabled.12" in file "application/vnd.ms-powerpoint.presentation.macroEnabled.12.xml" expected "application/vnd.ms-powerpoint.presentation.macroEnabled.12" Got name "application/vnd.ms-powerpoint.template.macroenabled.12" in file "application/vnd.ms-powerpoint.template.macroEnabled.12.xml" expected "application/vnd.ms-powerpoint.template.macroEnabled.12" Got name "application/vnd.ms-word.document.macroenabled.12" in file "application/vnd.ms-word.document.macroEnabled.12.xml" expected "application/vnd.ms-word.document.macroEnabled.12" Got name "application/vnd.ms-word.template.macroenabled.12" in file "application/vnd.ms-word.template.macroEnabled.12.xml" expected "application/vnd.ms-word.template.macroEnabled.12" Change-Id: Ie2a427069024080302a95ac46a456288787542c4 Reviewed-by: Edward Welbourne Reviewed-by: David Faure --- src/corelib/mimetypes/qmimeprovider.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index 917c29b8d6..0c64db4d48 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -591,9 +591,8 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data) const QStringRef name = xml.attributes().value(QLatin1String("type")); if (name.isEmpty()) continue; - if (name != data.name) { + if (name.compare(data.name, Qt::CaseInsensitive)) qWarning() << "Got name" << name << "in file" << file << "expected" << data.name; - } while (xml.readNextStartElement()) { const QStringRef tag = xml.name(); -- cgit v1.2.3 From 0aed4fd941c610517a68447cafa474a0c26ff2d2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 1 Mar 2016 15:31:39 +0100 Subject: tst_qimagewriter: Fix leaking temporary files. Add missing slash to the prefix pointing to the temporary directory. Change-Id: I0d00f706af58214a9922758a60d097cab7d6bc9d Reviewed-by: Frederik Gladhorn --- tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 1dd4d69ea8..b3fdd00eb6 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -117,7 +117,7 @@ void tst_QImageWriter::initTestCase() prefix = QFINDTESTDATA("images/"); if (prefix.isEmpty()) QFAIL("Can't find images directory!"); - writePrefix = m_temporaryDir.path(); + writePrefix = m_temporaryDir.path() + QLatin1Char('/'); } // Testing get/set functions -- cgit v1.2.3 From afe3c30759d1bf9f52278d8dc40f85a93a1d963b Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 26 Feb 2016 13:56:55 -0800 Subject: Don't create accessible interface for QWidgets being destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I975ee556913707e8595b2a89f1bba4299187bcfb Reviewed-by: Wayne Arnold Reviewed-by: Jan Arve Sæther --- src/widgets/accessible/qaccessiblewidgetfactory.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 4fa7c89482..261bc69000 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -33,6 +33,7 @@ #include "qaccessiblewidgets_p.h" #include "qaccessiblemenu_p.h" +#include "private/qwidget_p.h" #include "simplewidgets_p.h" #include "rangecontrols_p.h" #include "complexwidgets_p.h" @@ -53,7 +54,15 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje QAccessibleInterface *iface = 0; if (!object || !object->isWidgetType()) return iface; + QWidget *widget = static_cast(object); + // QWidget emits destroyed() from its destructor instead of letting the QObject + // destructor do it, which means the QWidget is unregistered from the accessibillity + // cache. But QWidget destruction also emits enter and leave events, which may end + // up here, so we have to ensure that we don't fill the cache with an entry of + // a widget that is going away. + if (QWidgetPrivate::get(widget)->data.in_destructor) + return iface; if (false) { #ifndef QT_NO_LINEEDIT -- cgit v1.2.3 From 76f6ceec36b33c55876ecd6691ff912a143b1899 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 24 Feb 2016 13:13:09 +0100 Subject: mkspecs: Add a benchmark "feature". Testcases and benchmarks are rather different entities. You won't usually want to run benchmarks in the same environment you are wanting to run tests in, so this feature allows to differentiate between the two. We also add a "benchmark" make target (similar to check), which runs all configured benchmarks. Change-Id: I33759ce44c34e42a6a3a88f34e7b9c4372380721 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/benchmark.prf | 1 + mkspecs/features/testcase.prf | 43 +++++++++++++++++++---------------- mkspecs/features/testcase_targets.prf | 10 ++++++++ 3 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 mkspecs/features/benchmark.prf diff --git a/mkspecs/features/benchmark.prf b/mkspecs/features/benchmark.prf new file mode 100644 index 0000000000..bfae922700 --- /dev/null +++ b/mkspecs/features/benchmark.prf @@ -0,0 +1 @@ +load(testcase) diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index 5ad372f976..0bf0ed7b94 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -6,13 +6,16 @@ have_target { # qt_build_config tells us to re-enable exceptions here. testcase_exceptions: CONFIG += exceptions -check.files = -check.path = . +benchmark: type = benchmark +else: type = check + +$${type}.files = +$${type}.path = . # Add environment for non-installed builds. Do this first, so the # 'make' variable expansions don't end up in a batch file/script. QT_TOOL_NAME = target -qtAddTargetEnv(check.commands, QT) +qtAddTargetEnv($${type}.commands, QT) # If the test ends up in a different directory, we should cd to that directory. TESTRUN_CWD = $$DESTDIR @@ -27,44 +30,44 @@ debug_and_release:debug_and_release_target { } # Allow for a custom test runner script -check.commands += $(TESTRUNNER) +$${type}.commands += $(TESTRUNNER) unix { isEmpty(TEST_TARGET_DIR): TEST_TARGET_DIR = . app_bundle: \ - check.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET) + $${type}.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET) else: \ - check.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET) + $${type}.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET) } else { # Windows !isEmpty(TEST_TARGET_DIR): TEST_TARGET_DIR = $${TEST_TARGET_DIR}$${QMAKE_DIR_SEP} - check.commands += $${TEST_TARGET_DIR}$(TARGET) + $${type}.commands += $${TEST_TARGET_DIR}$(TARGET) } # Allow for custom arguments to tests -check.commands += $(TESTARGS) +$${type}.commands += $(TESTARGS) !isEmpty(TESTRUN_CWD):!contains(TESTRUN_CWD, ^\\./?): \ - check.commands = cd $$shell_path($$TESTRUN_CWD) && $$check.commands + $${type}.commands = cd $$shell_path($$TESTRUN_CWD) && $$eval($${type}.commands) # If the test is marked as insignificant, discard the exit code -insignificant_test:check.commands = -$${check.commands} +insignificant_test: $${type}.commands = -$$eval($${type}.commands) -QMAKE_EXTRA_TARGETS *= check +QMAKE_EXTRA_TARGETS *= $${type} isEmpty(BUILDS)|build_pass { - check.depends = first + $${type}.depends = first } else { # For exclusive builds, only run the test once. - check.CONFIG = recursive - check.target = check_all - check.recurse_target = check - check.commands = - - check_first.depends = $$eval($$first(BUILDS).target)-check - check_first.target = check - QMAKE_EXTRA_TARGETS += check_first + $${type}.CONFIG = recursive + $${type}.target = $${type}_all + $${type}.recurse_target = $${type} + $${type}.commands = + + $${type}_first.depends = $$eval($$first(BUILDS).target)-$${type} + $${type}_first.target = $${type} + QMAKE_EXTRA_TARGETS += $${type}_first } !no_testcase_installs:!contains(INSTALLS, target) { diff --git a/mkspecs/features/testcase_targets.prf b/mkspecs/features/testcase_targets.prf index e9b107735a..16ec6a9f0d 100644 --- a/mkspecs/features/testcase_targets.prf +++ b/mkspecs/features/testcase_targets.prf @@ -7,3 +7,13 @@ check.depends = first # `make check' implies build QMAKE_EXTRA_TARGETS += check } + +# ... and the same for benchmarks, too. +!contains(QMAKE_EXTRA_TARGETS, benchmark) { + contains(TEMPLATE, subdirs): \ + prepareRecursiveTarget(benchmark) + else: \ + benchmark.depends = first # `make benchmark' implies build + QMAKE_EXTRA_TARGETS += benchmark +} + -- cgit v1.2.3 From 007039eae9fa24c14be6c4a63d59b28b07093579 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 22 Dec 2015 18:00:06 +0100 Subject: Don't include in the Windows CE qplatformdefs.h This header defines "interface" which will break compilation of dbus. Change-Id: I16fa35f822adca14304aa827b047358409d4a150 Reviewed-by: Oswald Buddenhagen Reviewed-by: Oliver Wolff --- mkspecs/common/wince/qplatformdefs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h index a351c886ba..4faa344e55 100644 --- a/mkspecs/common/wince/qplatformdefs.h +++ b/mkspecs/common/wince/qplatformdefs.h @@ -52,7 +52,6 @@ #include #include #include -#include #ifdef QT_LARGEFILE_SUPPORT #define QT_STATBUF struct _stati64 // non-ANSI defs -- cgit v1.2.3 From 2b2232b5ea8e952310f9b7e09c9691080dfb778e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 2 Mar 2016 16:09:38 +0100 Subject: Speed up tst_QLocalSocket::sendData The data function for this test re-used listenAndConnect_data that has an additional column "connections" which was never used in sendData. Thus sendData executed three times the same code which is just uselessly burned CI time. Copied the actually needed code of listenAndConnect_data to sendData_data. Change-Id: I6cdb1c1b72cb4ce7be7c13e90eea30ac09a14914 Reviewed-by: Friedemann Kleint --- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index d7480a4109..0505544a29 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -498,7 +498,11 @@ void tst_QLocalSocket::connectWithOldOpen() void tst_QLocalSocket::sendData_data() { - listenAndConnect_data(); + QTest::addColumn("name"); + QTest::addColumn("canListen"); + + QTest::newRow("null") << QString() << false; + QTest::newRow("tst_localsocket") << "tst_localsocket" << true; } void tst_QLocalSocket::sendData() -- cgit v1.2.3 From 43e535dd6f23ee5660dad58bee2ee7e368e67866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 29 Feb 2016 12:56:54 +0200 Subject: Blacklist tst_qnetworkreply tests that fail in RHEL 7.1 Task-number: QTBUG-51545 Change-Id: I0f5fdef315f87401ca5e638bce5dd2dbe85bcb83 Reviewed-by: Akseli Salovaara --- tests/auto/network/access/qnetworkreply/BLACKLIST | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 3ec580ddde..0605677e29 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -7,3 +7,7 @@ ubuntu-14.04 * [backgroundRequestInterruption:ftp, bg, nobg] * +[authenticationCacheAfterCancel:http+socksauth] +rhel-7.1 +[authenticationCacheAfterCancel:https+socksauth] +rhel-7.1 -- cgit v1.2.3 From fdd2ab58ae5c0ed581c0897f5207aa62cb29c785 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Thu, 3 Mar 2016 11:29:10 +0100 Subject: Fix compile with clang and -Werror. Fixes the following warning/error: src/sql/drivers/sqlite2/qsql_sqlite2.cpp:142:19: error: unused variable 'initial_cache_size' [-Werror,-Wunused-const-variable] static const uint initial_cache_size = 128; ^ 1 error generated. Change-Id: I4ed7f789561dd9b68dd374c122f4db3813e63e05 Reviewed-by: Thomas McGuire --- src/sql/drivers/sqlite2/qsql_sqlite2.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index 3b540fd193..3b00e6f848 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -139,8 +139,6 @@ public: QVector firstRow; }; -static const uint initial_cache_size = 128; - QSQLite2ResultPrivate::QSQLite2ResultPrivate(QSQLite2Result* res) : q(res), access(0), currentTail(0), currentMachine(0), skippedStatus(false), skipRow(false), utf8(false) { -- cgit v1.2.3 From 840831b6116a289ce45377aa5366974e6ec7c0e8 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 4 Mar 2016 11:11:17 +0100 Subject: Cocoa integration - do not invalidate backing store on move MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If window is only moving, there is no reason to reset a backing store, otherwise with current expose/flush events machinery it's possible to have glitches while moving a window programmatically. Change-Id: Ia4408bd23388e529ae93617a92ae84304b707ca1 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 05dcbd33ad..cb119e7e0d 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -356,6 +356,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; if (m_platformWindow->m_nsWindow && geometry == m_platformWindow->geometry()) return; + const bool isResize = geometry.size() != m_platformWindow->geometry().size(); + // It can happen that self.window is nil (if we are changing // styleMask from/to borderless and content view is being re-parented) // - this results in an invalid coordinates. @@ -385,7 +387,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; // calles, which Qt and Qt applications do not excpect. if (!m_platformWindow->m_inSetGeometry) QWindowSystemInterface::flushWindowSystemEvents(); - else + else if (isResize) m_backingStore = 0; } } -- cgit v1.2.3 From 9a999eb7b09b5ddf1545546b9e71b0326c0bb0d2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 26 Feb 2016 15:42:51 +0100 Subject: Remove QT_MOC_COMPAT from deprecated QProcess::error signal QT_MOC_COMPAT has the unfortunate behavior that it generates a warning at runtime, which also cannot be disabled. This is too draconic. Task-number: QTBUG-51517 Change-Id: I80af8b8b482671e4c9567281c3b1c504d737e202 Reviewed-by: hjk Reviewed-by: Eike Ziller Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index f95358250e..60c513d12e 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -243,7 +243,7 @@ Q_SIGNALS: void finished(int exitCode); // ### Qt 6: merge the two signals with a default value void finished(int exitCode, QProcess::ExitStatus exitStatus); #if QT_DEPRECATED_SINCE(5,6) - QT_MOC_COMPAT void error(QProcess::ProcessError error); + void error(QProcess::ProcessError error); #endif void errorOccurred(QProcess::ProcessError error); void stateChanged(QProcess::ProcessState state, QPrivateSignal); -- cgit v1.2.3 From 04db3f28af549b343fc88a089e0093551585e911 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 Mar 2016 14:11:45 +0100 Subject: Check if WINAPI_FAMILY_PC_APP is defined before using it Not all Windows compilers (e.g. MinGW 4.9.2) have WINAPI_FAMILY_PC_APP defined in their headers and report build failures in several Qt modules including QtActiveQt. This is fixed by defining the needed values before they are used. Task-number: QTBUG-49971 Change-Id: Ib7bac1fe07eb76c64d66fa152427918ee39a2eef Reviewed-by: Andrew Knight --- src/corelib/global/qsystemdetection.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 751c6a9a0e..f1abc88b99 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -106,6 +106,9 @@ # if defined(WINCE) || defined(_WIN32_WCE) # define Q_OS_WINCE # elif defined(WINAPI_FAMILY) +# ifndef WINAPI_FAMILY_PC_APP +# define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP +# endif # if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP # define Q_OS_WINPHONE # define Q_OS_WINRT -- cgit v1.2.3 From 409151ea2b2a607e96ce7a6462d54b3092d9c617 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Fri, 4 Mar 2016 11:36:45 +0100 Subject: [Windows] Blacklist AMD FirePro V5900 cards for angle. They seem to cause crashes on Windows 7 and 8. Change-Id: I6e91a195077313610a79358d6787ed211357b56a Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/openglblacklists/default.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index 767eac161c..f7a8844611 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -78,6 +78,18 @@ "features": [ "disable_rotation" ] + }, + { + "id": 7, + "description": "AMD FirePro V5900 driver causes crashes in Direct3D on Windows.", + "vendor_id": "0x1002", + "device_id": ["0x6707"], + "os": { + "type": "win" + }, + "features": [ + "disable_angle" + ] } ] } -- cgit v1.2.3 From caa82c3518b4a5c09b1de990874190d5d765656f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Thu, 3 Mar 2016 01:43:41 +0100 Subject: xcb: resourceType names must have only small letters Change-Id: I563ae26c9e7e6111399fd0b9af7bfb3ff750b34a Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index dfb0a125e2..f6bd878bde 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -76,7 +76,7 @@ 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"), QByteArrayLiteral("atspibus") }; -- cgit v1.2.3 From 273ddd5b234a5f89f65a41b926378f73701926b9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 3 Mar 2016 15:26:59 +0100 Subject: DirectWrite: Output correct error code on failure GetLastError() does not return the correct error code for the DirectWrite functions, they are returned by the function itself. Task-number: QTBUG-18711 Change-Id: I3931f58bb29a5f2dc4a5aa911ff16a873267d185 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 05e5af418a..40ea92155a 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1765,14 +1765,14 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, IDWriteFont *directWriteFont = 0; HRESULT hr = data->directWriteGdiInterop->CreateFontFromLOGFONT(&lf, &directWriteFont); if (FAILED(hr)) { - const QString errorString = qt_error_string(int(GetLastError())); + const QString errorString = qt_error_string(int(hr)); qWarning().noquote().nospace() << "DirectWrite: CreateFontFromLOGFONT() failed (" << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; } else { IDWriteFontFace *directWriteFontFace = NULL; hr = directWriteFont->CreateFontFace(&directWriteFontFace); if (FAILED(hr)) { - const QString errorString = qt_error_string(int(GetLastError())); + const QString errorString = qt_error_string(int(hr)); qWarning().noquote() << "DirectWrite: CreateFontFace() failed (" << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; } else { -- cgit v1.2.3 From 21c7421d4e86b6048f9c2c7a9a81ec4ff1ed278c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 4 Mar 2016 11:44:05 +0100 Subject: Fix application fonts with DirectWrite font engine There is no way to add fonts to the system font collection with DirectWrite. Instead you have to write custom collections. But that would mean keeping two instances of the same font data in memory since we are already registering them for the GDI engine, and we have no way of knowing which engine will be used. When we at some point replace the GDI engine completely, we could implement this in the proper way, but for now, instead of looking up the equivalent to the LOGFONT in DirectWrite's system font collection, we look it up using GDI and then convert the HFONT to DirectWrite. [ChangeLog][Windows][Text] Fixed disabling hinting for application fonts, e.g. when automatic scaling by device pixel ratio is in effect. Task-number: QTBUG-18711 Change-Id: I5c1365ab956dfa23d4d687877d7440473ee03bb0 Reviewed-by: Konstantin Ritt Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowsfontdatabase.cpp | 27 ++++++---- .../windows/qwindowsfontenginedirectwrite.cpp | 62 +--------------------- .../windows/qwindowsfontenginedirectwrite.h | 2 +- 3 files changed, 19 insertions(+), 72 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 40ea92155a..4be215ec8a 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1762,28 +1762,35 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, lf.lfFaceName[nameSubstituteLength] = 0; } - IDWriteFont *directWriteFont = 0; - HRESULT hr = data->directWriteGdiInterop->CreateFontFromLOGFONT(&lf, &directWriteFont); - if (FAILED(hr)) { - const QString errorString = qt_error_string(int(hr)); - qWarning().noquote().nospace() << "DirectWrite: CreateFontFromLOGFONT() failed (" - << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; + HFONT hfont = CreateFontIndirect(&lf); + if (!hfont) { + qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__); } else { + HGDIOBJ oldFont = SelectObject(data->hdc, hfont); + IDWriteFontFace *directWriteFontFace = NULL; - hr = directWriteFont->CreateFontFace(&directWriteFontFace); + HRESULT hr = data->directWriteGdiInterop->CreateFontFaceFromHdc(data->hdc, &directWriteFontFace); if (FAILED(hr)) { const QString errorString = qt_error_string(int(hr)); - qWarning().noquote() << "DirectWrite: CreateFontFace() failed (" + qWarning().noquote().nospace() << "DirectWrite: CreateFontFaceFromHDC() failed (" << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; } else { QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, request.pixelSize, data); - fedw->initFontInfo(request, dpi, directWriteFont); + + wchar_t n[64]; + GetTextFace(data->hdc, 64, n); + + QFontDef fontDef = request; + fontDef.family = QString::fromWCharArray(n); + + fedw->initFontInfo(fontDef, dpi); fe = fedw; } - directWriteFont->Release(); + SelectObject(data->hdc, oldFont); + DeleteObject(hfont); } } #endif // QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index a7de0e1783..16c16fefbe 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -648,71 +648,11 @@ QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const return fontEngine; } -// Dynamically resolve GetUserDefaultLocaleName, which is available from Windows -// Vista onwards. ### fixme 5.7: Consider reverting to direct linking. -typedef int (WINAPI *GetUserDefaultLocaleNamePtr)(LPWSTR, int); - -static inline GetUserDefaultLocaleNamePtr resolveGetUserDefaultLocaleName() -{ - QSystemLibrary library(QStringLiteral("kernel32")); - return (GetUserDefaultLocaleNamePtr)library.resolve("GetUserDefaultLocaleName"); -} - void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, - int dpi, IDWriteFont *font) + int dpi) { fontDef = request; - IDWriteFontFamily *fontFamily = NULL; - HRESULT hr = font->GetFontFamily(&fontFamily); - - IDWriteLocalizedStrings *familyNames = NULL; - if (SUCCEEDED(hr)) - hr = fontFamily->GetFamilyNames(&familyNames); - - UINT32 index = 0; - - if (SUCCEEDED(hr)) { - BOOL exists = false; - - wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; - static const GetUserDefaultLocaleNamePtr getUserDefaultLocaleName = resolveGetUserDefaultLocaleName(); - const int defaultLocaleSuccess = getUserDefaultLocaleName - ? getUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) : 0; - if (defaultLocaleSuccess) - hr = familyNames->FindLocaleName(localeName, &index, &exists); - - if (SUCCEEDED(hr) && !exists) - hr = familyNames->FindLocaleName(L"en-us", &index, &exists); - - if (!exists) - index = 0; - } - - // Get the family name. - if (SUCCEEDED(hr)) { - UINT32 length = 0; - - hr = familyNames->GetStringLength(index, &length); - - if (SUCCEEDED(hr)) { - QVarLengthArray name(length+1); - - hr = familyNames->GetString(index, name.data(), name.size()); - - if (SUCCEEDED(hr)) - fontDef.family = QString::fromWCharArray(name.constData()); - } - } - - if (familyNames != NULL) - familyNames->Release(); - if (fontFamily) - fontFamily->Release(); - - if (FAILED(hr)) - qErrnoWarning(hr, "initFontInfo: Failed to get family name"); - if (fontDef.pointSize < 0) fontDef.pointSize = fontDef.pixelSize * 72. / dpi; else if (fontDef.pixelSize == -1) diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 07e040ed33..91de871311 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -59,7 +59,7 @@ public: const QSharedPointer &d); ~QWindowsFontEngineDirectWrite(); - void initFontInfo(const QFontDef &request, int dpi, IDWriteFont *font); + void initFontInfo(const QFontDef &request, int dpi); QFixed lineThickness() const Q_DECL_OVERRIDE; QFixed underlinePosition() const Q_DECL_OVERRIDE; -- cgit v1.2.3 From 2263e5e0aac17d8489d5e41856b025e8e7904ec3 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Thu, 3 Mar 2016 10:28:25 +0100 Subject: Fixing the SQLite3 build for WEC2013 again. The new version broke the build again -> fix it again. (cherry picked from commit af2f3bde4866005d512d694f205231714d6e25b3) Change-Id: Ifcc33fbd9f7d7e98901de5130a67501ba19d9895 Reviewed-by: Lars Knoll Reviewed-by: Kevin Funk --- ...ixing-the-SQLite3-build-for-WEC2013-again.patch | 33 ++++++++++++++++++++++ src/3rdparty/sqlite/sqlite3.c | 4 ++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch diff --git a/src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch b/src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch new file mode 100644 index 0000000000..2d92cfffa7 --- /dev/null +++ b/src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch @@ -0,0 +1,33 @@ +From c7bbe85015995c1e0627d88bac6fd5715b1338a0 Mon Sep 17 00:00:00 2001 +From: Bjoern Breitmeyer +Date: Fri, 3 Jul 2015 14:08:04 +0200 +Subject: [PATCH] Fixing the SQLite3 build for WEC2013 again. + +The new version broke the build again +-> fix it again. + +Change-Id: I75761d134d97a2784f1de5076412aa814fdf9bcd +--- + src/3rdparty/sqlite/sqlite3.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c +index 71f6c10..040a9e1 100644 +--- a/src/3rdparty/sqlite/sqlite3.c ++++ b/src/3rdparty/sqlite/sqlite3.c +@@ -15474,9 +15474,11 @@ static void clearYMD_HMS_TZ(DateTime *p){ + #define HAVE_LOCALTIME_S 1 + #endif + +-#if defined(_WIN32_WCE) ++#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + #undef HAVE_LOCALTIME_S + struct tm *__cdecl localtime(const time_t *t); ++#elif defined(_WIN32_WCE) && _WIN32_WCE >= 0x800 ++# define SQLITE_MSVC_LOCALTIME_API 1 + #endif + + #ifndef SQLITE_OMIT_LOCALTIME +-- +1.8.1.msysgit.1 + diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index 06f6d154f1..65379a822d 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -15742,9 +15742,11 @@ static void clearYMD_HMS_TZ(DateTime *p){ #define HAVE_LOCALTIME_S 1 #endif -#if defined(_WIN32_WCE) +#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 #undef HAVE_LOCALTIME_S struct tm *__cdecl localtime(const time_t *t); +#elif defined(_WIN32_WCE) && _WIN32_WCE >= 0x800 +# define SQLITE_MSVC_LOCALTIME_API 1 #endif #ifndef SQLITE_OMIT_LOCALTIME -- cgit v1.2.3 From 4f577051676ad8ff161d481030f016d0c6bb324f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Mar 2016 00:34:01 +0100 Subject: Fix GCC 6 -Wunused-functions warnings GCC 6 is able to identify member functions that are unused. Remove them. Change-Id: Ic77548164b38a1cd3c957d2c57a5bccb979bc02e Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qpathclipper.cpp | 8 -------- src/widgets/dialogs/qcolordialog.cpp | 15 --------------- src/widgets/widgets/qcalendarwidget.cpp | 6 ------ 3 files changed, 29 deletions(-) diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 3a686bd209..a5557c99ff 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -252,8 +252,6 @@ class SegmentTree public: SegmentTree(QPathSegments &segments); - QRectF boundingRect() const; - void produceIntersections(int segment); private: @@ -304,12 +302,6 @@ SegmentTree::SegmentTree(QPathSegments &segments) m_tree[0] = root; } -QRectF SegmentTree::boundingRect() const -{ - return QRectF(QPointF(m_bounds.x1, m_bounds.y1), - QPointF(m_bounds.x2, m_bounds.y2)); -} - static inline qreal coordinate(const QPointF &pos, int axis) { return axis == 0 ? pos.x() : pos.y(); diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 468bffe49e..9a8bfc552d 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -190,7 +190,6 @@ public: QSize sizeHint() const Q_DECL_OVERRIDE; virtual void setCellBrush(int row, int col, const QBrush &); - QBrush cellBrush(int row, int col); inline int cellWidth() const { return cellw; } @@ -459,20 +458,6 @@ void QWellArray::setCellBrush(int row, int col, const QBrush &b) d->brush[row*numCols()+col] = b; } -/* - Returns the brush set for the cell at \a row, \a column. If no brush is - set, Qt::NoBrush is returned. -*/ - -QBrush QWellArray::cellBrush(int row, int col) -{ - if (d && row >= 0 && row < numRows() && col >= 0 && col < numCols()) - return d->brush[row*numCols()+col]; - return Qt::NoBrush; -} - - - /*!\reimp */ diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 48b224fe13..89cde851e5 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -654,7 +654,6 @@ public: int dateEditAcceptDelay() const; void setDateEditAcceptDelay(int delay); - QDate date() const; void setDate(const QDate &date); bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE; @@ -690,11 +689,6 @@ void QCalendarTextNavigator::setWidget(QWidget *widget) m_widget = widget; } -QDate QCalendarTextNavigator::date() const -{ - return m_date; -} - void QCalendarTextNavigator::setDate(const QDate &date) { m_date = date; -- cgit v1.2.3 From 992e762f66f6dd5ed2c5e369da77c7b3fdfcfd80 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Mar 2016 01:50:54 +0100 Subject: qt_common.prf: when looking for GCC >= 4.6, match GCC 6+, too Change-Id: Ia04690f62faa214fb91dffc758e253b5a64e5648 Reviewed-by: Olivier Goffart (Woboq GmbH) --- mkspecs/features/qt_common.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 38602f642d..e70d3bf172 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -69,9 +69,9 @@ warnings_are_errors:warning_clean { QMAKE_CXXFLAGS_WARN_ON += -Werror -ww177,1224,1478,1881 $$WERROR } } else:gcc:!clang:!intel_icc { - # GCC 4.6-4.9, 5.x + # GCC 4.6-4.9, 5.x, ... ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION} - contains(ver, "(4\\.[6789]|5\\..)") { + contains(ver, "(4\\.[6789]|[5-9]\\..)") { QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=cpp -Wno-error=deprecated-declarations $$WERROR # GCC prints this bogus warning, after it has inlined a lot of code -- cgit v1.2.3 From 362b977e7c99d47c9c598cef946273089881fd81 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 10 Sep 2015 14:44:52 +0300 Subject: Expose the number of X screen through the QXcbScreenFunctions X screen corresponds to Qt virtual desktop, and RandR output corresponds to QScreen. There can be more than one X screen, so we need a way to get the number of X screen for QScreen, in particular for the right implementation of some methods in QX11Info. Change-Id: Ib5e38703bf11ae08bb283f26a7b7b15f1a5e8671 Reviewed-by: Shawn Rutledge --- .../xcbfunctions/qxcbscreenfunctions.h | 56 ++++++++++++++++++++++ src/platformheaders/xcbfunctions/xcbfunctions.pri | 3 +- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 5 ++ src/plugins/platforms/xcb/qxcbscreen.cpp | 8 ++++ src/plugins/platforms/xcb/qxcbscreen.h | 1 + 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/platformheaders/xcbfunctions/qxcbscreenfunctions.h diff --git a/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h b/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h new file mode 100644 index 0000000000..7773c275b9 --- /dev/null +++ b/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBSCREENFUNCTIONS_H +#define QXCBSCREENFUNCTIONS_H + +#include + +QT_BEGIN_NAMESPACE + +class QScreen; + +class QXcbScreenFunctions +{ +public: + typedef bool (*VirtualDesktopNumber)(const QScreen *screen); + static const QByteArray virtualDesktopNumberIdentifier() { return QByteArrayLiteral("XcbVirtualDesktopNumber"); } + static int virtualDesktopNumber(const QScreen *screen) + { + return QPlatformHeaderHelper::callPlatformFunction(virtualDesktopNumberIdentifier(), screen); + } +}; + +QT_END_NAMESPACE + +#endif /*QXCBSCREENFUNCTIONS_H*/ diff --git a/src/platformheaders/xcbfunctions/xcbfunctions.pri b/src/platformheaders/xcbfunctions/xcbfunctions.pri index 7f611d80bd..3f2bcb2b34 100644 --- a/src/platformheaders/xcbfunctions/xcbfunctions.pri +++ b/src/platformheaders/xcbfunctions/xcbfunctions.pri @@ -1,3 +1,4 @@ HEADERS += \ $$PWD/qxcbwindowfunctions.h \ - $$PWD/qxcbintegrationfunctions.h + $$PWD/qxcbintegrationfunctions.h \ + $$PWD/qxcbscreenfunctions.h diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index f6bd878bde..96239a0f20 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -48,6 +48,7 @@ #include #include +#include #ifndef QT_NO_DBUS #include "QtPlatformSupport/private/qdbusmenuconnection_p.h" @@ -367,6 +368,10 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio if (function == QXcbWindowFunctions::visualIdIdentifier()) { return QFunctionPointer(QXcbWindowFunctions::VisualId(QXcbWindow::visualIdStatic)); } + + if (function == QXcbScreenFunctions::virtualDesktopNumberIdentifier()) + return QFunctionPointer(QXcbScreenFunctions::VirtualDesktopNumber(QXcbScreen::virtualDesktopNumberStatic)); + return Q_NULLPTR; } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 28b1753712..1a90f824fc 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -438,6 +438,14 @@ void QXcbScreen::setOutput(xcb_randr_output_t outputId, // TODO: Send an event to the QScreen instance that the screen changed its name } +int QXcbScreen::virtualDesktopNumberStatic(const QScreen *screen) +{ + if (screen && screen->handle()) + return static_cast(screen->handle())->screenNumber(); + + return 0; +} + /*! \brief handle the XCB screen change event and update properties diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index f4de2b9dfd..7376ddf35c 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -133,6 +133,7 @@ public: bool isPrimary() const { return m_primary; } int screenNumber() const { return m_virtualDesktop->number(); } + static int virtualDesktopNumberStatic(const QScreen *screen); xcb_screen_t *screen() const { return m_virtualDesktop->screen(); } xcb_window_t root() const { return screen()->root; } -- cgit v1.2.3 From d5fde514106f5479f9c929c8a165aced4a1b2c84 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 1 Mar 2016 13:17:13 +0100 Subject: QWheelEvent: make NoScrollPhase opt-in The fix for QTBUG-50199 involves adding an undocumented enum value which can be returned from QWheelEvent::phase(). This will be quite unexpected for applications that use it, which work fine with 5.6.0 and then start receiving this new phase value in 5.6.1. So it should not happen by default. Set the env variable QT_ENABLE_MOUSE_WHEEL_TRACKING to enable this functionality. In 5.7 it will be default behavior. But in 5.6 the default behavior is as it was before: if you use a conventional mouse wheel, the phase stays at ScrollUpdate continuously. [ChangeLog][QtCore] QWheelEvent::phase() returns 0 rather than Qt::ScrollUpdate when the wheel event comes from an actual non-emulated mouse wheel and the environment variable QT_ENABLE_MOUSE_WHEEL_TRACKING is set. In Qt 5.6, this is required to enable the fix for QTBUG-50199. Change-Id: Ieb2152ff767df24c42730d201235d1225aaec832 Reviewed-by: Gabriel de Dietrich Reviewed-by: Shawn Rutledge Reviewed-by: Alex Blasche --- src/gui/kernel/qevent.cpp | 9 ++++++++- src/gui/kernel/qguiapplication.cpp | 5 +++++ src/gui/kernel/qguiapplication_p.h | 3 +++ src/gui/kernel/qwindowsysteminterface.cpp | 11 +++++++++++ src/gui/kernel/qwindowsysteminterface_p.h | 3 +-- src/plugins/platforms/cocoa/qnsview.mm | 2 ++ src/widgets/kernel/qapplication.cpp | 2 +- 7 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8abec2b05e..9281744692 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -729,6 +729,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta, : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) { + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; g = QCursor::pos(); if (orient == Qt::Vertical) angleD = QPoint(0, delta); @@ -764,6 +766,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) { + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; if (orient == Qt::Vertical) angleD = QPoint(0, delta); else @@ -800,7 +804,10 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) -{} +{ + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; +} /*! Constructs a wheel event object. diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3fe6698955..3808bec8a4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -186,6 +186,9 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true; QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; +// enable the fix for QTBUG-50199; TODO remove this check in 5.7 +bool QGuiApplicationPrivate::scrollNoPhaseAllowed = false; + static qreal fontSmoothingGamma = 1.7; extern void qRegisterGuiVariant(); @@ -1412,6 +1415,8 @@ void QGuiApplicationPrivate::init() if (layout_direction == Qt::LayoutDirectionAuto || force_reverse) QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); + + scrollNoPhaseAllowed = qEnvironmentVariableIsSet("QT_ENABLE_MOUSE_WHEEL_TRACKING"); } extern void qt_cleanupFontDatabase(); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 7c7da9790b..9c8b655c71 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -285,6 +285,9 @@ public: static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false); + // enable the fix for QTBUG-50199; TODO remove this check in 5.7 + static bool scrollNoPhaseAllowed; + protected: virtual void notifyThemeChanged(); bool tryCloseRemainingWindows(QWindowList processedWindows); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 841e4f8f41..cae976098c 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -311,6 +311,9 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source) { + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase) + phase = Qt::ScrollUpdate; + // Qt 4 sends two separate wheel events for horizontal and vertical // deltas. For Qt 5 we want to send the deltas in one event, but at the // same time preserve source and behavior compatibility with Qt 4. @@ -930,5 +933,13 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS return true; } +QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD, + QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src) + : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), + qt4Orientation(qt4O), localPos(local), globalPos(global), + phase(!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase ? Qt::ScrollUpdate : phase), + source(src) +{ +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index c2569f29cd..b3c6d0d96d 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -236,8 +236,7 @@ public: class WheelEvent : public InputEvent { public: WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O, - Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized) - : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src) { } + Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized); QPoint pixelDelta; QPoint angleDelta; int qt4Delta; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index cb119e7e0d..90a7004938 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1409,6 +1409,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_scrolling = false; } else if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) { ph = Qt::NoScrollPhase; + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; } QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph, source); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 7c5a0da0c1..50e5ccf938 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3341,7 +3341,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = d->notify_helper(w, &we); eventAccepted = we.isAccepted(); if (res && eventAccepted) { - if (spontaneous && phase != Qt::NoScrollPhase) + if (spontaneous && phase != Qt::NoScrollPhase && QGuiApplicationPrivate::scrollNoPhaseAllowed) QApplicationPrivate::wheel_widget = w; break; } -- cgit v1.2.3 From ec29c76e18f3a30e559e9eb31dfcc20b80b9522c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Mar 2016 11:21:02 +0100 Subject: Fix UB in QFontEngineFT::loadGlyph() Reported by UBSan: src/gui/text/qfontengine_ft.cpp:1079:54: runtime error: null pointer passed as argument 1, which is declared to never be null The default-constructed QScopedArrayPointer is not reset() in every code path. In fact, in the code path leading to this memset, the only reset() call is in the if block right above it, so move the memset into the if block. Change-Id: I1f793c313ca56f3315c6bdd55456cb025cafc089 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 0a0e174343..8fbeff3596 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1073,8 +1073,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, if (glyph_buffer_size < pitch * info.height) { glyph_buffer_size = pitch * info.height; glyph_buffer.reset(new uchar[glyph_buffer_size]); + memset(glyph_buffer.data(), 0, glyph_buffer_size); } - memset(glyph_buffer.data(), 0, glyph_buffer_size); if (slot->format == FT_GLYPH_FORMAT_OUTLINE) { FT_Bitmap bitmap; -- cgit v1.2.3 From 8135e52cb45bd24c288c29da470828fe4fe5e3de Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 2 Mar 2016 11:34:44 +0100 Subject: Fix MIPS DSP optimized fetchUntransformed These have been wrong since being introduced in 5.3. Change-Id: I5b4aa198c8d4c6726f1c5097abe8d43275722dab Reviewed-by: Ljubomir Papuga Reviewed-by: Gunnar Sletta --- src/gui/painting/qdrawhelper_mips_dsp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index 721b228395..c28b594de3 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -489,7 +489,7 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_888_asm_mips_dsp(buffer, line, length); return buffer; } @@ -497,7 +497,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 2; fetchUntransformed_444_asm_mips_dsp(buffer, line, length); return buffer; } @@ -505,7 +505,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length); return buffer; } -- cgit v1.2.3 From bfdbfeb01233a76ea36f53c4f4be9014db5d8d86 Mon Sep 17 00:00:00 2001 From: HyungDon Lee Date: Wed, 24 Feb 2016 20:57:14 +0900 Subject: ODBC: Fix a memory leak when open() fails. When connection or login fails, the ODBC SQL driver was leaking memory. This bug has been present since Qt 4.8 and up. Task-number: QTBUG-51334 Change-Id: Ie17f3d575a08d47e047a65d1b30af9ce0789b2d0 Reviewed-by: Mark Brand --- src/sql/drivers/odbc/qsql_odbc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 8db06e6831..8a3919267f 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1879,11 +1879,14 @@ bool QODBCDriver::open(const QString & db, if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { qSqlWarning(QLatin1String("QODBCDriver::open: Unable to allocate connection"), d); setOpenError(true); + cleanup(); return false; } - if (!d->setConnectionOptions(connOpts)) + if (!d->setConnectionOptions(connOpts)) { + cleanup(); return false; + } // Create the connection string QString connQStr; @@ -1916,6 +1919,7 @@ bool QODBCDriver::open(const QString & db, if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d)); setOpenError(true); + cleanup(); return false; } @@ -1923,6 +1927,7 @@ bool QODBCDriver::open(const QString & db, setLastError(qMakeError(tr("Unable to connect - Driver doesn't support all " "functionality required"), QSqlError::ConnectionError, d)); setOpenError(true); + cleanup(); return false; } -- cgit v1.2.3 From 00f1c4ac3a0bbaac6996a0192abc3240972a34b5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 22 Feb 2016 20:21:44 -0800 Subject: Silence the warning: Unhandled client message: "_GTK_LOAD_ICONTHEMES" Qt Creator keeps printing that warning. Change-Id: I0c94a5c2846b48c8aea7ffff1435775f04234656 Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection.cpp | 4 +++- src/plugins/platforms/xcb/qxcbconnection.h | 1 + src/plugins/platforms/xcb/qxcbwindow.cpp | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index b9f6df1104..05c02249cc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1954,7 +1954,9 @@ static const char * xcb_atomnames = { "_COMPIZ_DECOR_PENDING\0" "_COMPIZ_DECOR_REQUEST\0" "_COMPIZ_DECOR_DELETE_PIXMAP\0" - "_COMPIZ_TOOLKIT_ACTION\0" // \0\0 terminates loop. + "_COMPIZ_TOOLKIT_ACTION\0" + "_GTK_LOAD_ICONTHEMES\0" + // \0\0 terminates loop. }; QXcbAtom::Atom QXcbConnection::qatom(xcb_atom_t xatom) const diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index b799e46a36..47ef173cf4 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -288,6 +288,7 @@ namespace QXcbAtom { _COMPIZ_DECOR_REQUEST, _COMPIZ_DECOR_DELETE_PIXMAP, _COMPIZ_TOOLKIT_ACTION, + _GTK_LOAD_ICONTHEMES, NPredefinedAtoms, diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 7eae2d92ab..bfbc38e4c2 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2033,8 +2033,9 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } else if (event->type == atom(QXcbAtom::_COMPIZ_DECOR_PENDING) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_REQUEST) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_DELETE_PIXMAP) - || event->type == atom(QXcbAtom::_COMPIZ_TOOLKIT_ACTION)) { - //silence the _COMPIZ messages for now + || event->type == atom(QXcbAtom::_COMPIZ_TOOLKIT_ACTION) + || event->type == atom(QXcbAtom::_GTK_LOAD_ICONTHEMES)) { + //silence the _COMPIZ and _GTK messages for now } else { qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type); } -- cgit v1.2.3 From 559152d911ceff8af5020355b35d7a1da100398c Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 18 Sep 2014 13:13:21 +0400 Subject: Make an implicit grab on TouchBegin for a widget subscribed to a gesture A receiver of TouchUpdate and TouchEnd events is determined either as a widget which has an implicit grab for the touch point or as a visible widget if there are no implicit grabs. The events are sent if the receiver has accepted TouchBegin event or if it is subscribed to a gesture. Before sending the events to the widget they are delivered to the gesture manager. Thus, in order to detect gestures for the widget, it must own an implicit grab or be a visible widget. It can happen that the parent widget is subscribed to a gesture, but doesn't accept TouchBegin event, as in the case of QScrollArea. Then it will not get an implicit grab and gesture detection will be impossible. Activate an implicit grab for such widgets. Also don't send TouchUpdate and TouchEnd to them, because it's against the documentation. Task-number: QTBUG-43277 Change-Id: Id767583991def6d76c48ad15eb39af822cad115d Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qapplication.cpp | 52 +++++++++++++++++++---- src/widgets/kernel/qapplication_p.h | 1 + tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 48 +++++++++++++++++++++ 3 files changed, 93 insertions(+), 8 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 50e5ccf938..f7d4139ed8 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3548,6 +3548,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, localPos); } +#ifndef QT_NO_GESTURES + QPointer gesturePendingWidget; +#endif + while (widget) { // first, try to deliver the touch event acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); @@ -3565,14 +3569,16 @@ bool QApplication::notify(QObject *receiver, QEvent *e) touchEvent->spont = false; if (res && eventAccepted) { // the first widget to accept the TouchBegin gets an implicit grab. - for (int i = 0; i < touchEvent->touchPoints().count(); ++i) { - const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); - d->activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget; - } - break; - } else if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) { + d->activateImplicitTouchGrab(widget, touchEvent); break; } +#ifndef QT_NO_GESTURES + if (gesturePendingWidget.isNull() && widget && QGestureManager::gesturePending(widget)) + gesturePendingWidget = widget; +#endif + if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) + break; + QPoint offset = widget->pos(); widget = widget->parentWidget(); touchEvent->setTarget(widget); @@ -3586,9 +3592,27 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } } +#ifndef QT_NO_GESTURES + if (!eventAccepted && !gesturePendingWidget.isNull()) { + // the first widget subscribed to a gesture gets an implicit grab + d->activateImplicitTouchGrab(gesturePendingWidget, touchEvent); + } +#endif + touchEvent->setAccepted(eventAccepted); break; } + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + { + QWidget *widget = static_cast(receiver); + // We may get here if the widget is subscribed to a gesture, + // but has not accepted TouchBegin. Propagate touch events + // only if TouchBegin has been accepted. + if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) + res = d->notify_helper(widget, e); + break; + } case QEvent::RequestSoftwareInputPanel: inputMethod()->show(); break; @@ -4328,6 +4352,17 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, return static_cast(closestTarget); } +void QApplicationPrivate::activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchEvent) +{ + if (touchEvent->type() != QEvent::TouchBegin) + return; + + for (int i = 0, tc = touchEvent->touchPoints().count(); i < tc; ++i) { + const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); + activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget; + } +} + bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchDevice *device, const QList &touchPoints, @@ -4458,10 +4493,11 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, || QGestureManager::gesturePending(widget) #endif ) { - if (touchEvent.type() == QEvent::TouchEnd) - widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) accepted = true; + // widget can be deleted on TouchEnd + if (touchEvent.type() == QEvent::TouchEnd && !widget.isNull()) + widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); } break; } diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 4cce2d84e8..cb158011f0 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -282,6 +282,7 @@ public: QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint); void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); void removeTouchPoint(int touchPointId); + void activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchBeginEvent); static bool translateRawTouchEvent(QWidget *widget, QTouchDevice *device, const QList &touchPoints, diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 293689bff3..fb3e644a5c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -447,6 +447,7 @@ private slots: void touchEventSynthesizedMouseEvent(); void touchUpdateOnNewTouch(); + void touchEventsForGesturePendingWidgets(); void styleSheetPropagation(); @@ -9788,6 +9789,7 @@ public: m_touchUpdateCount(0), m_touchEndCount(0), m_touchEventCount(0), + m_gestureEventCount(0), m_acceptTouch(false), m_mouseEventCount(0), m_acceptMouse(true) @@ -9825,6 +9827,9 @@ protected: else e->ignore(); return true; + case QEvent::Gesture: + ++m_gestureEventCount; + return true; case QEvent::MouseButtonPress: case QEvent::MouseMove: @@ -9847,6 +9852,7 @@ public: int m_touchUpdateCount; int m_touchEndCount; int m_touchEventCount; + int m_gestureEventCount; bool m_acceptTouch; int m_mouseEventCount; bool m_acceptMouse; @@ -10002,6 +10008,48 @@ void tst_QWidget::touchUpdateOnNewTouch() QCOMPARE(widget.m_touchEndCount, 1); } +void tst_QWidget::touchEventsForGesturePendingWidgets() +{ + QTouchDevice *device = new QTouchDevice; + device->setType(QTouchDevice::TouchScreen); + QWindowSystemInterface::registerTouchDevice(device); + + TouchMouseWidget parent; + TouchMouseWidget child(&parent); + parent.grabGesture(Qt::TapAndHoldGesture); + parent.show(); + + QWindow* window = parent.windowHandle(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + QTest::qWait(500); // needed for QApplication::topLevelAt(), which is used by QGestureManager + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchEventCount, 0); + QCOMPARE(parent.m_gestureEventCount, 0); + QTest::touchEvent(window, device).press(0, QPoint(20, 20), window); + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchBeginCount, 1); // QTapAndHoldGestureRecognizer::create() sets Qt::WA_AcceptTouchEvents + QCOMPARE(parent.m_touchUpdateCount, 0); + QCOMPARE(parent.m_touchEndCount, 0); + QCOMPARE(parent.m_gestureEventCount, 0); + QTest::touchEvent(window, device).move(0, QPoint(25, 25), window); + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchBeginCount, 1); + QCOMPARE(parent.m_touchUpdateCount, 0); + QCOMPARE(parent.m_touchEndCount, 0); + QCOMPARE(parent.m_gestureEventCount, 0); + QTest::qWait(1000); + QTest::touchEvent(window, device).release(0, QPoint(25, 25), window); + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchBeginCount, 1); + QCOMPARE(parent.m_touchUpdateCount, 0); + QCOMPARE(parent.m_touchEndCount, 0); + QVERIFY(parent.m_gestureEventCount > 0); +} + void tst_QWidget::styleSheetPropagation() { QTableView tw; -- cgit v1.2.3 From a90485dd01bd6c067bf977cb30604032352da6be Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 20 Jan 2016 10:46:00 +0100 Subject: Make use of defaultDropAction in QListView icon mode Before this patch, using setDefaultDropAction on QListView in icon mode would not have any effect. Now the drag behaves properly. The default action is set to CopyAction rather than IgnoreAction to keep the current behavior and avoid breaking user code. [ChangeLog][QtWidgets][QListWidget] Fixed a bug that caused the default drop action to be ignored when using icon mode. Task-number: QTBUG-15741 Change-Id: I49654cde382af344ffc4594699303c928e27e05d Reviewed-by: Marc Mutz --- src/widgets/itemviews/qlistview.cpp | 7 ++++++- src/widgets/itemviews/qlistview_p.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index a17d89e735..18ea19c8b9 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1978,6 +1978,11 @@ int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView: /* * ListMode ListView Implementation */ +QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d) + : QCommonListViewBase(q, d) +{ + dd->defaultDropAction = Qt::CopyAction; +} #ifndef QT_NO_DRAGANDDROP QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const @@ -2744,7 +2749,7 @@ bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) drag->setMimeData(dd->model->mimeData(indexes)); drag->setPixmap(pixmap); drag->setHotSpot(dd->pressedPosition - rect.topLeft()); - Qt::DropAction action = drag->exec(supportedActions, Qt::CopyAction); + Qt::DropAction action = drag->exec(supportedActions, dd->defaultDropAction); draggedItems.clear(); if (action == Qt::MoveAction) dd->clearOrRemove(); diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 62fa45e640..d1ea6fe328 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -193,7 +193,7 @@ public: class QListModeViewBase : public QCommonListViewBase { public: - QListModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d) {} + QListModeViewBase(QListView *q, QListViewPrivate *d); QVector flowPositions; QVector segmentPositions; -- cgit v1.2.3 From 5e68c84ca6d619f51292aab4ee6dc6c6ed69438a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 6 Mar 2016 01:29:28 +0100 Subject: QPlatformPrintDevice: fix uninit'ed member variable Found by UBSan: src/printsupport/kernel/qplatformprintdevice.cpp:370:10: runtime error: load of value 196, which is not a valid value for type 'bool' Change-Id: I184e5bf5e4917eeb492b54fe87950bcf03421887 Reviewed-by: Lars Knoll --- src/printsupport/kernel/qplatformprintdevice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp index 6385f58aa1..802a12603a 100644 --- a/src/printsupport/kernel/qplatformprintdevice.cpp +++ b/src/printsupport/kernel/qplatformprintdevice.cpp @@ -53,6 +53,9 @@ QPlatformPrintDevice::QPlatformPrintDevice() m_haveOutputBins(false), m_haveDuplexModes(false), m_haveColorModes(false) +#ifndef QT_NO_MIMETYPES + , m_haveMimeTypes(false) +#endif { } @@ -68,6 +71,9 @@ QPlatformPrintDevice::QPlatformPrintDevice(const QString &id) m_haveOutputBins(false), m_haveDuplexModes(false), m_haveColorModes(false) +#ifndef QT_NO_MIMETYPES + , m_haveMimeTypes(false) +#endif { } -- cgit v1.2.3 From 65ec933f91dd9ac95679c24c830533953e384991 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Mar 2016 11:09:52 +0100 Subject: QCompleter: QMatchData: init all fields in default ctor Found by UBSan: src/widgets/util/qcompleter_p.h:130:8: runtime error: load of value 249, which is not a valid value for type 'bool' Change-Id: I0529e54e17a6f4d6add91786a2d5687f2d043531 Reviewed-by: Milian Wolff --- src/widgets/util/qcompleter_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index b100f24f9b..afcdfe7aa2 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -122,7 +122,7 @@ private: }; struct QMatchData { - QMatchData() : exactMatchIndex(-1) { } + QMatchData() : exactMatchIndex(-1), partial(false) { } QMatchData(const QIndexMapper& indices, int em, bool p) : indices(indices), exactMatchIndex(em), partial(p) { } QIndexMapper indices; -- cgit v1.2.3 From 15fcd691dbd2bd029fde7a9c3becafa4b6708a52 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Thu, 3 Mar 2016 10:33:13 +0100 Subject: configure: Fix (Open)SSL detection on WinCE "ssl" should be defined when "openssl" is defined, and WinCE should default to autodetection of OpenSSL. (cherry picked from commit f2fbee5134c2c0b33bdddf0a6419f3c770e1f89c) Change-Id: I9110b245d66fac233eb2bfe89b26cb34cee3e291 Reviewed-by: Lars Knoll --- tools/configure/configureapp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 555ccbf740..298e27244e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -903,8 +903,10 @@ void Configure::parseCmdLine() dictionary[ "OPENSSL"] = "no"; } else if (configCmdLine.at(i) == "-openssl") { dictionary[ "OPENSSL" ] = "yes"; + dictionary[ "SSL" ] = "yes"; } else if (configCmdLine.at(i) == "-openssl-linked") { dictionary[ "OPENSSL" ] = "linked"; + dictionary[ "SSL" ] = "yes"; } else if (configCmdLine.at(i) == "-no-libproxy") { dictionary[ "LIBPROXY"] = "no"; } else if (configCmdLine.at(i) == "-libproxy") { @@ -1700,8 +1702,6 @@ void Configure::applySpecSpecifics() dictionary[ "STYLE_WINDOWSCE" ] = "yes"; dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes"; dictionary[ "OPENGL" ] = "no"; - dictionary[ "SSL" ] = "no"; - dictionary[ "OPENSSL" ] = "no"; dictionary[ "RTTI" ] = "no"; dictionary[ "SSE2" ] = "no"; dictionary[ "SSE3" ] = "no"; -- cgit v1.2.3 From 393f096ec3bb62a9c7de77288cd9fbe75412ebdd Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 25 Feb 2016 18:35:21 +0400 Subject: Bundled HarfBuzz: simplify the built-in shapers list configuration Change-Id: If7819b5b6ad23e319bfedeb4c9e1e12054b216a7 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 106 ++++++++++++++++--------------- 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index edfc0e7954..163842e8fc 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -7,8 +7,12 @@ CONFIG += \ load(qt_helper_lib) +# built-in shapers list configuration: +SHAPERS += opentype # HB's main shaper; enabling it should be enough most of the time +mac: SHAPERS += coretext # native shaper on OSX/iOS; could be used alone to handle both OT and AAT fonts + DEFINES += HAVE_CONFIG_H -DEFINES += HAVE_OT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED +DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED # platform/compiler specific definitions DEFINES += HAVE_ATEXIT @@ -78,57 +82,59 @@ HEADERS += \ $$PWD/src/hb-unicode.h \ $$PWD/src/hb-version.h -# Open Type -SOURCES += \ - $$PWD/src/hb-ot-font.cc \ - $$PWD/src/hb-ot-layout.cc \ - $$PWD/src/hb-ot-map.cc \ - $$PWD/src/hb-ot-shape.cc \ - $$PWD/src/hb-ot-shape-complex-arabic.cc \ - $$PWD/src/hb-ot-shape-complex-default.cc \ - $$PWD/src/hb-ot-shape-complex-hangul.cc \ - $$PWD/src/hb-ot-shape-complex-hebrew.cc \ - $$PWD/src/hb-ot-shape-complex-indic.cc \ - $$PWD/src/hb-ot-shape-complex-indic-table.cc \ - $$PWD/src/hb-ot-shape-complex-myanmar.cc \ - $$PWD/src/hb-ot-shape-complex-thai.cc \ - $$PWD/src/hb-ot-shape-complex-tibetan.cc \ - $$PWD/src/hb-ot-shape-complex-use.cc \ - $$PWD/src/hb-ot-shape-complex-use-table.cc \ - $$PWD/src/hb-ot-shape-fallback.cc \ - $$PWD/src/hb-ot-shape-normalize.cc +contains(SHAPERS, opentype) { + DEFINES += HAVE_OT -HEADERS += \ - $$PWD/src/hb-ot-layout-common-private.hh \ - $$PWD/src/hb-ot-layout-gdef-table.hh \ - $$PWD/src/hb-ot-layout-gpos-table.hh \ - $$PWD/src/hb-ot-layout-gsubgpos-private.hh \ - $$PWD/src/hb-ot-layout-gsub-table.hh \ - $$PWD/src/hb-ot-layout-jstf-table.hh \ - $$PWD/src/hb-ot-layout-private.hh \ - $$PWD/src/hb-ot-map-private.hh \ - $$PWD/src/hb-ot-shape-complex-arabic-fallback.hh \ - $$PWD/src/hb-ot-shape-complex-arabic-private.hh \ - $$PWD/src/hb-ot-shape-complex-arabic-table.hh \ - $$PWD/src/hb-ot-shape-complex-indic-machine.hh \ - $$PWD/src/hb-ot-shape-complex-indic-private.hh \ - $$PWD/src/hb-ot-shape-complex-myanmar-machine.hh \ - $$PWD/src/hb-ot-shape-complex-private.hh \ - $$PWD/src/hb-ot-shape-complex-use-machine.hh \ - $$PWD/src/hb-ot-shape-complex-use-private.hh \ - $$PWD/src/hb-ot-shape-fallback-private.hh \ - $$PWD/src/hb-ot-shape-normalize-private.hh \ - $$PWD/src/hb-ot-shape-private.hh + SOURCES += \ + $$PWD/src/hb-ot-font.cc \ + $$PWD/src/hb-ot-layout.cc \ + $$PWD/src/hb-ot-map.cc \ + $$PWD/src/hb-ot-shape.cc \ + $$PWD/src/hb-ot-shape-complex-arabic.cc \ + $$PWD/src/hb-ot-shape-complex-default.cc \ + $$PWD/src/hb-ot-shape-complex-hangul.cc \ + $$PWD/src/hb-ot-shape-complex-hebrew.cc \ + $$PWD/src/hb-ot-shape-complex-indic.cc \ + $$PWD/src/hb-ot-shape-complex-indic-table.cc \ + $$PWD/src/hb-ot-shape-complex-myanmar.cc \ + $$PWD/src/hb-ot-shape-complex-thai.cc \ + $$PWD/src/hb-ot-shape-complex-tibetan.cc \ + $$PWD/src/hb-ot-shape-complex-use.cc \ + $$PWD/src/hb-ot-shape-complex-use-table.cc \ + $$PWD/src/hb-ot-shape-fallback.cc \ + $$PWD/src/hb-ot-shape-normalize.cc -HEADERS += \ - $$PWD/src/hb-ot.h \ - $$PWD/src/hb-ot-font.h \ - $$PWD/src/hb-ot-layout.h \ - $$PWD/src/hb-ot-shape.h \ - $$PWD/src/hb-ot-tag.h - -mac { - # Apple Advanced Typography + HEADERS += \ + $$PWD/src/hb-ot-layout-common-private.hh \ + $$PWD/src/hb-ot-layout-gdef-table.hh \ + $$PWD/src/hb-ot-layout-gpos-table.hh \ + $$PWD/src/hb-ot-layout-gsubgpos-private.hh \ + $$PWD/src/hb-ot-layout-gsub-table.hh \ + $$PWD/src/hb-ot-layout-jstf-table.hh \ + $$PWD/src/hb-ot-layout-private.hh \ + $$PWD/src/hb-ot-map-private.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-fallback.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-private.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-table.hh \ + $$PWD/src/hb-ot-shape-complex-indic-machine.hh \ + $$PWD/src/hb-ot-shape-complex-indic-private.hh \ + $$PWD/src/hb-ot-shape-complex-myanmar-machine.hh \ + $$PWD/src/hb-ot-shape-complex-private.hh \ + $$PWD/src/hb-ot-shape-complex-use-machine.hh \ + $$PWD/src/hb-ot-shape-complex-use-private.hh \ + $$PWD/src/hb-ot-shape-fallback-private.hh \ + $$PWD/src/hb-ot-shape-normalize-private.hh \ + $$PWD/src/hb-ot-shape-private.hh + + HEADERS += \ + $$PWD/src/hb-ot.h \ + $$PWD/src/hb-ot-font.h \ + $$PWD/src/hb-ot-layout.h \ + $$PWD/src/hb-ot-shape.h \ + $$PWD/src/hb-ot-tag.h +} + +contains(SHAPERS, coretext) { DEFINES += HAVE_CORETEXT SOURCES += \ -- cgit v1.2.3 From 229c51978511e71781f0afcf5051e625cc18901d Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 21 Feb 2016 19:37:17 +0400 Subject: Increase chances of finding the ellipsis glyph in elided text The glyph for the ellipsis could be absent in the main font, so we should try to find it in a fallback font; otherwise fall back to "...". Change-Id: Ic53060ed42f3c800aba055d2be2a1c7c3cfeec64 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index c545240c57..d0c2779a65 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2747,8 +2747,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int QFixed ellipsisWidth; QString ellipsisText; { - QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common); - QFontEngine *engine = fe->type() == QFontEngine::Multi ? static_cast(fe)->engine(0) : fe; + QFontEngine *engine = fnt.d->engineForScript(QChar::Script_Common); QChar ellipsisChar(0x2026); -- cgit v1.2.3 From 248488c894e5501c45a8c3bad215b9f9eca7475a Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 14 Dec 2015 00:51:38 +0400 Subject: QCoreTextFontDatabase: Get rid of local fallbacksForFamily cache The centralized one (in QFontDatabase) does the job. Change-Id: I33def7a7bcddeaa62b904d8812321a7f4648a9d0 Reviewed-by: Lars Knoll Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 0af779097c..e24f4aac8f 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -518,9 +518,6 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo if (&CTFontCopyDefaultCascadeListForLanguages) #endif { - if (fallbackLists.contains(family)) - return fallbackLists.value(family); - QCFType attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family)); if (QCFType fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) { @@ -548,12 +545,9 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo fallbackList.append(QStringLiteral("Arial Unicode MS")); #endif - fallbackLists[family] = fallbackList; + return fallbackList; } } - - if (fallbackLists.contains(family)) - return fallbackLists.value(family); } } #endif -- cgit v1.2.3 From a51085fc68998a2d56528a7cb13092d362c7f2e5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 3 Mar 2016 14:29:53 +0100 Subject: export private module's deps as run deps of the public module this is necessary for: - generating -rpath-link arguments when link_prl is not used. link_prl is enabled by default, so this has no effect on most projects. - deployment purposes, which is hypothetical as of now. Change-Id: I9e629f3eef93c4edf12efc016ecc27dbe2186d61 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_module_pris.prf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 5f5639a1cf..e9e5865a84 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -42,8 +42,11 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri module_libs = "\$\$QT_MODULE_HOST_LIB_BASE" else: \ module_libs = "\$\$QT_MODULE_LIB_BASE" - !isEmpty(QT_PRIVATE): \ - module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(QT_PRIVATE, -private$, _private)" + # In addition to the library's private deps, the private module's deps + # are logically runtime deps of the public module. + runtime_deps = $$QT_PRIVATE $$QT_FOR_PRIVATE + !isEmpty(runtime_deps): \ + module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(runtime_deps, -private$, _private)" else: \ module_rundep = module_build_type = v2 -- cgit v1.2.3 From 27c87e31dd07611e9505033d00547002d61ee7c3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 2 Mar 2016 18:36:09 +0100 Subject: Revert "Don't add qmutex_xxx.cpp to SOURCES, as qmutex.cpp #include's them" This reverts commit 40cbf1927bdd2fa9f531a047d1ba66f68c35d170 - the qmake parser bug this worked around has been fixed. As a side effect, the platform conditionals were simplified. Change-Id: Ibfc1253e3c2252ab954c725a9effd6e719cb691c Reviewed-by: Edward Welbourne Reviewed-by: Joerg Bornemann --- src/corelib/thread/thread.pri | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri index 2cb00a6cf4..0a989cfcaf 100644 --- a/src/corelib/thread/thread.pri +++ b/src/corelib/thread/thread.pri @@ -43,24 +43,20 @@ SOURCES += thread/qatomic.cpp \ thread/qthreadpool.cpp \ thread/qthreadstorage.cpp -unix:SOURCES += thread/qthread_unix.cpp \ - thread/qwaitcondition_unix.cpp - -win32:SOURCES += thread/qthread_win.cpp \ - thread/qwaitcondition_win.cpp - -integrity:SOURCES += thread/qthread_unix.cpp \ - thread/qwaitcondition_unix.cpp - -false { - # files #included by others, but listed here so IDEs parsing this file know - # they are part of QtCore. Usually, qmake can find out that certain files - # are #included by others and thus remove from SOURCES, but it gets lost - # with qmutex.cpp. +win32 { SOURCES += \ - thread/qmutex_linux.cpp \ - thread/qmutex_mac.cpp \ - thread/qmutex_unix.cpp \ - thread/qmutex_win.cpp + thread/qmutex_win.cpp \ + thread/qthread_win.cpp \ + thread/qwaitcondition_win.cpp +} else { + darwin { + SOURCES += thread/qmutex_mac.cpp + } else: linux { + SOURCES += thread/qmutex_linux.cpp + } else { + SOURCES += thread/qmutex_unix.cpp + } + SOURCES += \ + thread/qthread_unix.cpp \ + thread/qwaitcondition_unix.cpp } - -- cgit v1.2.3 From a28364bc1c7144b9c5c383cc5d18d62a68076a38 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:03:42 +0100 Subject: consistently put {qt,qml}_{module,plugin} at the end of project files this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3 Reviewed-by: Joerg Bornemann --- src/concurrent/concurrent.pro | 4 ++-- src/corelib/corelib.pro | 9 ++++++--- src/dbus/dbus.pro | 4 ++-- src/gui/gui.pro | 3 +-- src/network/network.pro | 9 ++++----- src/opengl/opengl.pro | 4 ++-- src/openglextensions/openglextensions.pro | 4 ++-- src/plugins/bearer/android/src/src.pro | 8 ++++---- src/plugins/bearer/blackberry/blackberry.pro | 8 ++++---- src/plugins/bearer/connman/connman.pro | 7 +++---- src/plugins/bearer/corewlan/corewlan.pro | 8 ++++---- src/plugins/bearer/generic/generic.pro | 8 ++++---- src/plugins/bearer/nativewifi/nativewifi.pro | 8 ++++---- src/plugins/bearer/networkmanager/networkmanager.pro | 8 ++++---- src/plugins/bearer/nla/nla.pro | 8 ++++---- src/plugins/generic/evdevkeyboard/evdevkeyboard.pro | 9 ++++----- src/plugins/generic/evdevmouse/evdevmouse.pro | 9 ++++----- src/plugins/generic/evdevtablet/evdevtablet.pro | 10 +++++----- src/plugins/generic/evdevtouch/evdevtouch.pro | 9 ++++----- src/plugins/generic/libinput/libinput.pro | 10 +++++----- src/plugins/generic/tslib/tslib.pro | 10 +++++----- src/plugins/generic/tuiotouch/tuiotouch.pro | 10 +++++----- src/plugins/imageformats/gif/gif.pro | 8 ++++---- src/plugins/imageformats/ico/ico.pro | 8 ++++---- src/plugins/imageformats/jpeg/jpeg.pro | 8 ++++---- src/plugins/platforminputcontexts/compose/compose.pro | 10 +++++----- src/plugins/platforminputcontexts/ibus/ibus.pro | 10 +++++----- src/plugins/platforms/android/android.pro | 7 +++---- src/plugins/platforms/cocoa/cocoa.pro | 10 +++++----- src/plugins/platforms/direct2d/direct2d.pro | 10 +++++----- src/plugins/platforms/directfb/directfb.pro | 10 +++++----- .../eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro | 8 ++++---- .../platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro | 8 ++++---- .../eglfs_kms_egldevice/eglfs_kms_egldevice.pro | 8 ++++---- .../eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro | 8 ++++---- .../platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro | 8 ++++---- .../eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro | 8 ++++---- .../platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro | 8 ++++---- src/plugins/platforms/eglfs/eglfs-plugin.pro | 10 +++++----- src/plugins/platforms/eglfs/eglfs_device_lib.pro | 4 ++-- src/plugins/platforms/haiku/haiku.pro | 7 ++++--- src/plugins/platforms/ios/ios.pro | 10 +++++----- src/plugins/platforms/linuxfb/linuxfb.pro | 10 +++++----- src/plugins/platforms/minimal/minimal.pro | 10 +++++----- src/plugins/platforms/minimalegl/minimalegl.pro | 10 +++++----- src/plugins/platforms/mirclient/mirclient.pro | 10 +++++----- src/plugins/platforms/offscreen/offscreen.pro | 10 +++++----- src/plugins/platforms/openwfd/openwf.pro | 9 ++++----- src/plugins/platforms/windows/windows.pro | 10 +++++----- src/plugins/platforms/winrt/winrt.pro | 11 ++++++----- src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro | 9 ++++----- src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro | 9 ++++----- src/plugins/platforms/xcb/xcb-plugin.pro | 9 ++++----- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 3 +-- src/plugins/platformthemes/gtk2/gtk2.pro | 10 +++++----- src/plugins/printsupport/cocoa/cocoa.pro | 7 ++++--- src/plugins/printsupport/cups/cups.pro | 7 ++++--- src/plugins/printsupport/windows/windows.pro | 7 ++++--- src/plugins/styles/bb10style/bb10style.pro | 7 +++---- src/printsupport/printsupport.pro | 9 ++++----- src/sql/sql.pro | 9 ++++----- src/tools/bootstrap-dbus/bootstrap-dbus.pro | 4 ++-- src/tools/bootstrap/bootstrap.pro | 10 +++++----- src/widgets/accessible/widgets.pro | 10 ++++------ src/widgets/widgets.pro | 9 ++++----- src/xml/xml.pro | 4 ++-- 66 files changed, 264 insertions(+), 274 deletions(-) diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro index 2b8fef2d6a..2a519314f3 100644 --- a/src/concurrent/concurrent.pro +++ b/src/concurrent/concurrent.pro @@ -7,8 +7,6 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf -load(qt_module) - PRECOMPILED_HEADER = ../corelib/global/qt_pch.h SOURCES += \ @@ -41,3 +39,5 @@ HEADERS += \ contains(QT_CONFIG, clock-gettime) { linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt } + +load(qt_module) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index ab3f29e2c7..37f33253e0 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -7,6 +7,7 @@ MODULE_CONFIG = moc resources !isEmpty(QT_NAMESPACE): MODULE_DEFINES = QT_NAMESPACE=$$QT_NAMESPACE CONFIG += $$MODULE_CONFIG +DEFINES += $$MODULE_DEFINES DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused @@ -31,7 +32,6 @@ ANDROID_PERMISSIONS = \ # variable and on FreeBSD, this variable is in the final executable itself freebsd: QMAKE_LFLAGS_NOUNDEF = -load(qt_module) load(qfeatures) include(animation/animation.pri) @@ -60,8 +60,6 @@ mac|darwin { LIBS_PRIVATE += -framework CoreFoundation LIBS_PRIVATE += -framework Foundation } -win32:DEFINES-=QT_NO_CAST_TO_ASCII -DEFINES += $$MODULE_DEFINES QMAKE_LIBS += $$QMAKE_LIBS_CORE @@ -78,6 +76,11 @@ qt_conf.variable = QT_CONFIG QMAKE_PKGCONFIG_VARIABLES += host_bins qt_conf +load(qt_module) + +# Override qt_module, so the symbols are actually included into the library. +win32: DEFINES -= QT_NO_CAST_TO_ASCII + ctest_macros_file.input = $$PWD/Qt5CTestMacros.cmake ctest_macros_file.output = $$DESTDIR/cmake/Qt5Core/Qt5CTestMacros.cmake ctest_macros_file.CONFIG = verbatim diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index ebeab5c1b0..4c1aec7bb3 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -25,8 +25,6 @@ win32 { QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf -load(qt_module) - PUB_HEADERS = qdbusargument.h \ qdbusconnectioninterface.h \ qdbusmacros.h \ @@ -91,3 +89,5 @@ SOURCES += qdbusconnection.cpp \ qdbusservicewatcher.cpp \ qdbusunixfiledescriptor.cpp \ qdbusvirtualobject.cpp + +load(qt_module) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index aa05d72a3d..69434e801f 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -23,8 +23,6 @@ win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) { \$\$QT_MODULE_INCLUDE_BASE/QtANGLE } -load(qt_module) - # Code coverage with TestCocoon # The following is required as extra compilers use $$QMAKE_CXX instead of $(CXX). # Without this, testcocoon.prf is read only after $$QMAKE_CXX is used by the @@ -50,6 +48,7 @@ include(itemmodels/itemmodels.pri) QMAKE_LIBS += $$QMAKE_LIBS_GUI +load(qt_module) load(cmake_functions) win32: CMAKE_WINDOWS_BUILD = True diff --git a/src/network/network.pro b/src/network/network.pro index 4cced923f7..cdea190222 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -11,13 +11,8 @@ DEFINES += QT_NO_USING_NAMESPACE #DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000 -MODULE_PLUGIN_TYPES = \ - bearer - QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf -load(qt_module) - include(access/access.pri) include(bearer/bearer.pri) include(kernel/kernel.pri) @@ -36,3 +31,7 @@ MODULE_PLUGIN_TYPES = \ bearer ANDROID_PERMISSIONS += \ android.permission.ACCESS_NETWORK_STATE + +MODULE_PLUGIN_TYPES = \ + bearer +load(qt_module) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 9c62d41d3e..007f73c45f 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -8,8 +8,6 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf -load(qt_module) - contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles2):CONFIG += opengles2 @@ -53,3 +51,5 @@ SOURCES += qglshaderprogram.cpp \ gl2paintengineex/qpaintengineex_opengl2.cpp \ gl2paintengineex/qglcustomshaderstage.cpp \ gl2paintengineex/qtextureglyphcache_gl.cpp + +load(qt_module) diff --git a/src/openglextensions/openglextensions.pro b/src/openglextensions/openglextensions.pro index 948465165e..18eec27e1c 100644 --- a/src/openglextensions/openglextensions.pro +++ b/src/openglextensions/openglextensions.pro @@ -4,11 +4,11 @@ CONFIG += static contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles2):CONFIG += opengles2 -load(qt_module) - DEFINES += QT_NO_CAST_FROM_ASCII PRECOMPILED_HEADER = HEADERS = qopenglextensions.h SOURCES = qopenglextensions.cpp + +load(qt_module) diff --git a/src/plugins/bearer/android/src/src.pro b/src/plugins/bearer/android/src/src.pro index 1050601896..77c95a0b38 100644 --- a/src/plugins/bearer/android/src/src.pro +++ b/src/plugins/bearer/android/src/src.pro @@ -2,10 +2,6 @@ include(wrappers/wrappers.pri) TARGET = qandroidbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QAndroidBearerEnginePlugin -load(qt_plugin) - QT = core-private network-private HEADERS += qandroidbearerengine.h \ @@ -15,3 +11,7 @@ HEADERS += qandroidbearerengine.h \ SOURCES += main.cpp \ qandroidbearerengine.cpp \ ../../qnetworksession_impl.cpp + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QAndroidBearerEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/blackberry/blackberry.pro b/src/plugins/bearer/blackberry/blackberry.pro index c75de3aaad..031b598482 100644 --- a/src/plugins/bearer/blackberry/blackberry.pro +++ b/src/plugins/bearer/blackberry/blackberry.pro @@ -1,9 +1,5 @@ TARGET = qbbbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QBBEnginePlugin -load(qt_plugin) - QT = core-private network-private # Uncomment this to enable debugging output for the plugin @@ -18,3 +14,7 @@ SOURCES += qbbengine.cpp \ main.cpp OTHER_FILES += blackberry.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QBBEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro index efa13a6ebd..9f3fff304b 100644 --- a/src/plugins/bearer/connman/connman.pro +++ b/src/plugins/bearer/connman/connman.pro @@ -1,9 +1,5 @@ TARGET = qconnmanbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QConnmanEnginePlugin -load(qt_plugin) - QT = core network-private dbus CONFIG += link_pkgconfig @@ -21,3 +17,6 @@ SOURCES += main.cpp \ OTHER_FILES += connman.json +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QConnmanEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 674af0cbbe..ab0257aecd 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -1,9 +1,5 @@ TARGET = qcorewlanbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QCoreWlanEnginePlugin -load(qt_plugin) - QT = core-private network-private LIBS += -framework Foundation -framework SystemConfiguration @@ -21,3 +17,7 @@ SOURCES += main.cpp \ OBJECTIVE_SOURCES += qcorewlanengine.mm OTHER_FILES += corewlan.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QCoreWlanEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index d0e17380e3..f71a901341 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -1,9 +1,5 @@ TARGET = qgenericbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QGenericEnginePlugin -load(qt_plugin) - QT = core-private network-private HEADERS += qgenericengine.h \ @@ -15,3 +11,7 @@ SOURCES += qgenericengine.cpp \ main.cpp OTHER_FILES += generic.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QGenericEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index e372c8ca05..da7f2da353 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -1,9 +1,5 @@ TARGET = qnativewifibearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QNativeWifiEnginePlugin -load(qt_plugin) - QT = core-private network-private HEADERS += qnativewifiengine.h \ @@ -16,3 +12,7 @@ SOURCES += main.cpp \ ../qnetworksession_impl.cpp OTHER_FILES += nativewifi.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QNativeWifiEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index b3a270615c..e71c93f66f 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -1,9 +1,5 @@ TARGET = qnmbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QNetworkManagerEnginePlugin -load(qt_plugin) - QT = core network-private dbus HEADERS += qnetworkmanagerservice.h \ @@ -19,3 +15,7 @@ SOURCES += main.cpp \ ../qnetworksession_impl.cpp OTHER_FILES += networkmanager.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QNetworkManagerEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index bac7608477..32ff5446e5 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -1,9 +1,5 @@ TARGET = qnlabearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QNlaEnginePlugin -load(qt_plugin) - QT = core core-private network network-private !wince* { @@ -22,3 +18,7 @@ SOURCES += main.cpp \ ../qnetworksession_impl.cpp OTHER_FILES += nla.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QNlaEnginePlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro index 101ea30bcc..d23ad3bad0 100644 --- a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro +++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro @@ -1,10 +1,5 @@ TARGET = qevdevkeyboardplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevKeyboardPlugin -load(qt_plugin) - QT += core-private platformsupport-private gui-private SOURCES = main.cpp @@ -12,3 +7,7 @@ SOURCES = main.cpp OTHER_FILES += \ evdevkeyboard.json +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevKeyboardPlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevmouse/evdevmouse.pro b/src/plugins/generic/evdevmouse/evdevmouse.pro index 57a67ead8d..1a0bc08853 100644 --- a/src/plugins/generic/evdevmouse/evdevmouse.pro +++ b/src/plugins/generic/evdevmouse/evdevmouse.pro @@ -1,10 +1,5 @@ TARGET = qevdevmouseplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevMousePlugin -load(qt_plugin) - QT += core-private platformsupport-private gui-private SOURCES = main.cpp @@ -12,3 +7,7 @@ SOURCES = main.cpp OTHER_FILES += \ evdevmouse.json +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevMousePlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevtablet/evdevtablet.pro b/src/plugins/generic/evdevtablet/evdevtablet.pro index 8ffc0db84d..aaf0ef4c67 100644 --- a/src/plugins/generic/evdevtablet/evdevtablet.pro +++ b/src/plugins/generic/evdevtablet/evdevtablet.pro @@ -1,13 +1,13 @@ TARGET = qevdevtabletplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevTabletPlugin -load(qt_plugin) - SOURCES = main.cpp QT += core-private platformsupport-private gui-private OTHER_FILES += \ evdevtablet.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevTabletPlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevtouch/evdevtouch.pro b/src/plugins/generic/evdevtouch/evdevtouch.pro index 1f4d1b7e93..4d61db4eb0 100644 --- a/src/plugins/generic/evdevtouch/evdevtouch.pro +++ b/src/plugins/generic/evdevtouch/evdevtouch.pro @@ -1,10 +1,5 @@ TARGET = qevdevtouchplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevTouchScreenPlugin -load(qt_plugin) - SOURCES = main.cpp QT += core-private platformsupport-private gui-private @@ -12,3 +7,7 @@ QT += core-private platformsupport-private gui-private OTHER_FILES += \ evdevtouch.json +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevTouchScreenPlugin +load(qt_plugin) diff --git a/src/plugins/generic/libinput/libinput.pro b/src/plugins/generic/libinput/libinput.pro index 17dbb23ef0..335605d354 100644 --- a/src/plugins/generic/libinput/libinput.pro +++ b/src/plugins/generic/libinput/libinput.pro @@ -1,12 +1,12 @@ TARGET = qlibinputplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QLibInputPlugin -load(qt_plugin) - QT += core-private platformsupport-private gui-private SOURCES = main.cpp OTHER_FILES = libinput.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QLibInputPlugin +load(qt_plugin) diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro index be6fc4fbea..200d231cc8 100644 --- a/src/plugins/generic/tslib/tslib.pro +++ b/src/plugins/generic/tslib/tslib.pro @@ -1,10 +1,5 @@ TARGET = qtslibplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QTsLibPlugin -load(qt_plugin) - SOURCES = main.cpp QT += gui-private platformsupport-private @@ -12,3 +7,8 @@ QT += gui-private platformsupport-private LIBS += -lts OTHER_FILES += tslib.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QTsLibPlugin +load(qt_plugin) diff --git a/src/plugins/generic/tuiotouch/tuiotouch.pro b/src/plugins/generic/tuiotouch/tuiotouch.pro index 5e53403f5b..ae2ccde058 100644 --- a/src/plugins/generic/tuiotouch/tuiotouch.pro +++ b/src/plugins/generic/tuiotouch/tuiotouch.pro @@ -1,10 +1,5 @@ TARGET = qtuiotouchplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QTuioTouchPlugin -load(qt_plugin) - QT += \ core-private \ gui-private \ @@ -24,3 +19,8 @@ HEADERS += \ OTHER_FILES += \ tuiotouch.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QTuioTouchPlugin +load(qt_plugin) diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index 2a5048bb1c..a361bc2532 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -1,11 +1,11 @@ TARGET = qgif -PLUGIN_TYPE = imageformats -PLUGIN_CLASS_NAME = QGifPlugin -load(qt_plugin) - include(../../../gui/image/qgifhandler.pri) INCLUDEPATH += ../../../gui/image SOURCES += $$PWD/main.cpp HEADERS += $$PWD/main.h OTHER_FILES += gif.json + +PLUGIN_TYPE = imageformats +PLUGIN_CLASS_NAME = QGifPlugin +load(qt_plugin) diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro index 4250fcb4bc..60afdaed70 100644 --- a/src/plugins/imageformats/ico/ico.pro +++ b/src/plugins/imageformats/ico/ico.pro @@ -1,12 +1,12 @@ TARGET = qico -PLUGIN_TYPE = imageformats -PLUGIN_CLASS_NAME = QICOPlugin -load(qt_plugin) - QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)" HEADERS += qicohandler.h main.h SOURCES += main.cpp \ qicohandler.cpp OTHER_FILES += ico.json + +PLUGIN_TYPE = imageformats +PLUGIN_CLASS_NAME = QICOPlugin +load(qt_plugin) diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index e33fde1cdb..526556179c 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -1,9 +1,5 @@ TARGET = qjpeg -PLUGIN_TYPE = imageformats -PLUGIN_CLASS_NAME = QJpegPlugin -load(qt_plugin) - QT += core-private QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)" @@ -13,3 +9,7 @@ INCLUDEPATH += ../../../gui/image SOURCES += main.cpp HEADERS += main.h OTHER_FILES += jpeg.json + +PLUGIN_TYPE = imageformats +PLUGIN_CLASS_NAME = QJpegPlugin +load(qt_plugin) diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index a4b5280e64..86bdd4729b 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -1,10 +1,5 @@ TARGET = composeplatforminputcontextplugin -PLUGIN_TYPE = platforminputcontexts -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QComposePlatformInputContextPlugin -load(qt_plugin) - QT += core-private gui-private DEFINES += X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"' @@ -27,3 +22,8 @@ contains(QT_CONFIG, xkbcommon-qt): { } OTHER_FILES += $$PWD/compose.json + +PLUGIN_TYPE = platforminputcontexts +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QComposePlatformInputContextPlugin +load(qt_plugin) diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro index 401be6d42f..9f6c848e6a 100644 --- a/src/plugins/platforminputcontexts/ibus/ibus.pro +++ b/src/plugins/platforminputcontexts/ibus/ibus.pro @@ -1,10 +1,5 @@ TARGET = ibusplatforminputcontextplugin -PLUGIN_TYPE = platforminputcontexts -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QIbusPlatformInputContextPlugin -load(qt_plugin) - QT += dbus gui-private SOURCES += $$PWD/qibusplatforminputcontext.cpp \ $$PWD/qibusproxy.cpp \ @@ -18,3 +13,8 @@ HEADERS += $$PWD/qibusplatforminputcontext.h \ $$PWD/qibustypes.h OTHER_FILES += $$PWD/ibus.json + +PLUGIN_TYPE = platforminputcontexts +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QIbusPlatformInputContextPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro index 3ba817bf5b..045e55ec65 100644 --- a/src/plugins/platforms/android/android.pro +++ b/src/plugins/platforms/android/android.pro @@ -1,13 +1,9 @@ TARGET = qtforandroid -PLUGIN_TYPE = platforms - # STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in androidjnimain.cpp # Yes, the plugin imports itself statically DEFINES += QT_STATICPLUGIN -load(qt_plugin) - LIBS += -ljnigraphics -landroid QT += core-private gui-private platformsupport-private @@ -79,6 +75,9 @@ HEADERS += $$PWD/qandroidplatformintegration.h \ android-style-assets: SOURCES += $$PWD/extract.cpp else: SOURCES += $$PWD/extract-dummy.cpp +PLUGIN_TYPE = platforms +load(qt_plugin) + #Non-standard install directory, QTBUG-29859 DESTDIR = $$DESTDIR/android target.path = $${target.path}/android diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index ba0e6b001a..05d0bb4094 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -1,10 +1,5 @@ TARGET = qcocoa -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QCocoaIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - OBJECTIVE_SOURCES += main.mm \ qcocoaintegration.mm \ qcocoatheme.mm \ @@ -112,3 +107,8 @@ OTHER_FILES += cocoa.json # Window debug support #DEFINES += QT_COCOA_ENABLE_WINDOW_DEBUG + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QCocoaIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro index 8f2ccc3aa6..005a4da6db 100644 --- a/src/plugins/platforms/direct2d/direct2d.pro +++ b/src/plugins/platforms/direct2d/direct2d.pro @@ -1,10 +1,5 @@ TARGET = qdirect2d -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWindowsDirect2DIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT *= core-private QT *= gui-private QT *= platformsupport-private @@ -40,3 +35,8 @@ HEADERS += \ qwindowsdirect2dwindow.h OTHER_FILES += direct2d.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWindowsDirect2DIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 89d8d42cea..5c81e0283a 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -1,10 +1,5 @@ TARGET = qdirectfb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DIRECTFB @@ -51,3 +46,8 @@ contains(QT_CONFIG, directfb_egl) { CONFIG += qpa/genericunixfontdatabase OTHER_FILES += directfb.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro index 2026b6a6c6..e2ebf9f7ee 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-brcm-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSBrcmIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -21,3 +17,7 @@ SOURCES += $$PWD/qeglfsbrcmmain.cpp \ HEADERS += $$PWD/qeglfsbrcmintegration.h OTHER_FILES += $$PWD/eglfs_brcm.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSBrcmIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro index e53793ce54..12ae0a13b1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-kms-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -29,3 +25,7 @@ HEADERS += $$PWD/qeglfskmsintegration.h \ $$PWD/qeglfskmscursor.h OTHER_FILES += $$PWD/eglfs_kms.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSKmsIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro index 393ddd14a5..1932f861b9 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-kms-egldevice-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsEglDeviceIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -21,3 +17,7 @@ HEADERS += $$PWD/qeglfskmsegldeviceintegration.h OTHER_FILES += $$PWD/eglfs_kms_egldevice.json LIBS += -ldrm + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSKmsEglDeviceIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro index 33f219db96..7fc4568ae3 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-mali-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSMaliIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private # Avoid X11 header collision @@ -19,3 +15,7 @@ SOURCES += $$PWD/qeglfsmalimain.cpp \ HEADERS += $$PWD/qeglfsmaliintegration.h OTHER_FILES += $$PWD/eglfs_mali.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSMaliIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro index fc0533127c..6fac2f529a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-viv-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSVivIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -18,3 +14,7 @@ SOURCES += $$PWD/qeglfsvivmain.cpp \ HEADERS += $$PWD/qeglfsvivintegration.h OTHER_FILES += $$PWD/eglfs_viv.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSVivIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro index 26b6a2e9ea..44f75c40e0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-viv-wl-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSVivWaylandIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -21,3 +17,7 @@ OTHER_FILES += $$PWD/eglfs_viv_wl.json CONFIG += link_pkgconfig PKGCONFIG_PRIVATE += wayland-server + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSVivWaylandIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index 86fefac8aa..83f0c74910 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-x11-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSX11IntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private # Avoid X11 header collision @@ -21,3 +17,7 @@ SOURCES += $$PWD/qeglfsx11main.cpp \ HEADERS += $$PWD/qeglfsx11integration.h OTHER_FILES += $$PWD/eglfs_x11.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSX11IntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro index 0f493fdc01..a628cdccd9 100644 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro @@ -1,12 +1,12 @@ TARGET = qeglfs -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += platformsupport-private eglfs_device_lib-private SOURCES += $$PWD/qeglfsmain.cpp OTHER_FILES += $$PWD/eglfs.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/eglfs_device_lib.pro b/src/plugins/platforms/eglfs/eglfs_device_lib.pro index 4fe2ce4897..f784020fb6 100644 --- a/src/plugins/platforms/eglfs/eglfs_device_lib.pro +++ b/src/plugins/platforms/eglfs/eglfs_device_lib.pro @@ -6,8 +6,6 @@ TARGET = QtEglDeviceIntegration CONFIG += no_module_headers internal_module -load(qt_module) - QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DYNLOAD @@ -52,3 +50,5 @@ INCLUDEPATH += $$PWD CONFIG += egl qpa/genericunixfontdatabase !contains(DEFINES, QT_NO_CURSOR): RESOURCES += $$PWD/cursor.qrc + +load(qt_module) diff --git a/src/plugins/platforms/haiku/haiku.pro b/src/plugins/platforms/haiku/haiku.pro index 87f31997a3..ea5bb632db 100644 --- a/src/plugins/platforms/haiku/haiku.pro +++ b/src/plugins/platforms/haiku/haiku.pro @@ -1,7 +1,4 @@ TARGET = qhaiku -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QHaikuIntegrationPlugin -load(qt_plugin) QT += platformsupport-private core-private gui-private @@ -40,3 +37,7 @@ LIBS += -lbe OTHER_FILES += haiku.json include (../../../platformsupport/fontdatabases/fontdatabases.pri) + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QHaikuIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index bf7849b740..545db8c093 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -1,10 +1,5 @@ TARGET = qios -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QIOSIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary @@ -59,3 +54,8 @@ HEADERS = \ OTHER_FILES = \ quiview_textinput.mm \ quiview_accessibility.mm + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QIOSIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 389d45c29c..b5de192346 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,10 +1,5 @@ TARGET = qlinuxfb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private SOURCES = main.cpp qlinuxfbintegration.cpp qlinuxfbscreen.cpp @@ -13,3 +8,8 @@ HEADERS = qlinuxfbintegration.h qlinuxfbscreen.h CONFIG += qpa/genericunixfontdatabase OTHER_FILES += linuxfb.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 3ed4d2cdde..d6914026ae 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -1,10 +1,5 @@ TARGET = qminimal -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private SOURCES = main.cpp \ @@ -14,3 +9,8 @@ HEADERS = qminimalintegration.h \ qminimalbackingstore.h OTHER_FILES += minimal.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index e78dcb8bc5..ac67249591 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -1,10 +1,5 @@ TARGET = qminimalegl -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QMinimalEglIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private #DEFINES += QEGL_EXTRA_DEBUG @@ -29,3 +24,8 @@ CONFIG += egl qpa/genericunixfontdatabase OTHER_FILES += \ minimalegl.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QMinimalEglIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 0851e8d719..4ea5593478 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,11 +1,6 @@ TARGET = mirclient TEMPLATE = lib -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = MirServerIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private dbus CONFIG += qpa/genericunixfontdatabase @@ -47,3 +42,8 @@ HEADERS = \ qmirclientscreen.h \ qmirclienttheme.h \ qmirclientwindow.h + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = MirServerIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro index 94eeac6acc..999550a7e1 100644 --- a/src/plugins/platforms/offscreen/offscreen.pro +++ b/src/plugins/platforms/offscreen/offscreen.pro @@ -1,10 +1,5 @@ TARGET = qoffscreen -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QOffscreenIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private SOURCES = main.cpp \ @@ -25,3 +20,8 @@ contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, openg } else { SOURCES += qoffscreenintegration_dummy.cpp } + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QOffscreenIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro index 38bac057bd..152e4f57d7 100644 --- a/src/plugins/platforms/openwfd/openwf.pro +++ b/src/plugins/platforms/openwfd/openwf.pro @@ -1,10 +1,5 @@ TARGET = qopenwf -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private CONFIG += qpa/genericunixfontdatabase @@ -38,3 +33,7 @@ SOURCES += \ LIBS += -lWFD -lgbm -lGLESv2 -lEGL +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index cc0373c077..2e0f723693 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -1,10 +1,5 @@ TARGET = qwindows -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT *= core-private QT *= gui-private QT *= platformsupport-private @@ -25,3 +20,8 @@ HEADERS += \ qwindowsgdinativeinterface.h OTHER_FILES += windows.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro index 991ec1789b..261295ef0b 100644 --- a/src/plugins/platforms/winrt/winrt.pro +++ b/src/plugins/platforms/winrt/winrt.pro @@ -1,10 +1,6 @@ TARGET = qwinrt -CONFIG -= precompile_header -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) +CONFIG -= precompile_header QT += core-private gui-private platformsupport-private @@ -50,3 +46,8 @@ HEADERS = \ qwinrtwindow.h OTHER_FILES += winrt.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro index 28a572a2c9..6d52332bad 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro @@ -1,10 +1,5 @@ TARGET = qxcb-egl-integration -PLUGIN_CLASS_NAME = QXcbEglIntegrationPlugin -PLUGIN_TYPE = xcbglintegrations - -load(qt_plugin) - include(../gl_integrations_plugin_base.pri) CONFIG += egl @@ -22,3 +17,7 @@ SOURCES += \ qxcbeglwindow.cpp \ qxcbeglmain.cpp \ qxcbeglnativeinterfacehandler.cpp + +PLUGIN_CLASS_NAME = QXcbEglIntegrationPlugin +PLUGIN_TYPE = xcbglintegrations +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index 1c577e5dc9..67fd68765a 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -1,10 +1,5 @@ TARGET = qxcb-glx-integration -PLUGIN_CLASS_NAME = QXcbGlxIntegrationPlugin -PLUGIN_TYPE = xcbglintegrations - -load(qt_plugin) - include(../gl_integrations_plugin_base.pri) #should be removed from the sources @@ -31,3 +26,7 @@ SOURCES += \ qxcbglxwindow.cpp \ qglxintegration.cpp \ qxcbglxnativeinterfacehandler.cpp + +PLUGIN_CLASS_NAME = QXcbGlxIntegrationPlugin +PLUGIN_TYPE = xcbglintegrations +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 09ab1ad77a..75684a769b 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -1,13 +1,12 @@ TARGET = qxcb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QXcbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private xcb_qpa_lib-private SOURCES = \ qxcbmain.cpp OTHER_FILES += xcb.json README +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QXcbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 302d87e007..f4a4e5a78a 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -1,8 +1,6 @@ TARGET = QtXcbQpa CONFIG += no_module_headers internal_module -load(qt_module) - QT += core-private gui-private platformsupport-private SOURCES = \ @@ -105,3 +103,4 @@ contains(QT_CONFIG, xkbcommon-qt) { QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON } +load(qt_module) diff --git a/src/plugins/platformthemes/gtk2/gtk2.pro b/src/plugins/platformthemes/gtk2/gtk2.pro index 73c156f82b..1c434e1d4d 100644 --- a/src/plugins/platformthemes/gtk2/gtk2.pro +++ b/src/plugins/platformthemes/gtk2/gtk2.pro @@ -1,10 +1,5 @@ TARGET = qgtk2 -PLUGIN_TYPE = platformthemes -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QGtk2ThemePlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private CONFIG += X11 @@ -19,3 +14,8 @@ SOURCES += \ main.cpp \ qgtk2dialoghelpers.cpp \ qgtk2theme.cpp \ + +PLUGIN_TYPE = platformthemes +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QGtk2ThemePlugin +load(qt_plugin) diff --git a/src/plugins/printsupport/cocoa/cocoa.pro b/src/plugins/printsupport/cocoa/cocoa.pro index a3b9e2dfcf..feed33a231 100644 --- a/src/plugins/printsupport/cocoa/cocoa.pro +++ b/src/plugins/printsupport/cocoa/cocoa.pro @@ -1,8 +1,5 @@ TARGET = cocoaprintersupport MODULE = cocoaprintersupport -PLUGIN_TYPE = printsupport -PLUGIN_CLASS_NAME = QCocoaPrinterSupportPlugin -load(qt_plugin) QT += gui-private printsupport-private LIBS += -framework Cocoa @@ -10,3 +7,7 @@ LIBS += -framework Cocoa SOURCES += main.cpp OTHER_FILES += cocoa.json + +PLUGIN_TYPE = printsupport +PLUGIN_CLASS_NAME = QCocoaPrinterSupportPlugin +load(qt_plugin) diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro index cdbb08b10a..757408e7f7 100644 --- a/src/plugins/printsupport/cups/cups.pro +++ b/src/plugins/printsupport/cups/cups.pro @@ -1,8 +1,5 @@ TARGET = cupsprintersupport MODULE = cupsprintersupport -PLUGIN_TYPE = printsupport -PLUGIN_CLASS_NAME = QCupsPrinterSupportPlugin -load(qt_plugin) QT += core-private gui-private printsupport printsupport-private @@ -20,3 +17,7 @@ HEADERS += qcupsprintersupport_p.h \ qcupsprintengine_p.h OTHER_FILES += cups.json + +PLUGIN_TYPE = printsupport +PLUGIN_CLASS_NAME = QCupsPrinterSupportPlugin +load(qt_plugin) diff --git a/src/plugins/printsupport/windows/windows.pro b/src/plugins/printsupport/windows/windows.pro index 3366262ef0..06694fb7fe 100644 --- a/src/plugins/printsupport/windows/windows.pro +++ b/src/plugins/printsupport/windows/windows.pro @@ -1,8 +1,5 @@ TARGET = windowsprintersupport MODULE = windowsprintersupport -PLUGIN_TYPE = printsupport -PLUGIN_CLASS_NAME = QWindowsPrinterSupportPlugin -load(qt_plugin) QT *= core-private QT *= gui-private @@ -22,3 +19,7 @@ HEADERS += \ OTHER_FILES += windows.json LIBS += -lwinspool -lcomdlg32 -lgdi32 -luser32 + +PLUGIN_TYPE = printsupport +PLUGIN_CLASS_NAME = QWindowsPrinterSupportPlugin +load(qt_plugin) diff --git a/src/plugins/styles/bb10style/bb10style.pro b/src/plugins/styles/bb10style/bb10style.pro index ad35df6de7..543f67f169 100644 --- a/src/plugins/styles/bb10style/bb10style.pro +++ b/src/plugins/styles/bb10style/bb10style.pro @@ -1,9 +1,5 @@ TARGET = bb10styleplugin -PLUGIN_TYPE = styles -PLUGIN_CLASS_NAME = BlackBerry10StylePlugin -load(qt_plugin) - INCLUDEPATH += $$PWD QT += widgets @@ -26,3 +22,6 @@ RESOURCES += \ OTHER_FILES += qbb10styleplugin.json +PLUGIN_TYPE = styles +PLUGIN_CLASS_NAME = BlackBerry10StylePlugin +load(qt_plugin) diff --git a/src/printsupport/printsupport.pro b/src/printsupport/printsupport.pro index 6dd3eaab3c..52eab672d3 100644 --- a/src/printsupport/printsupport.pro +++ b/src/printsupport/printsupport.pro @@ -3,15 +3,14 @@ QT = core-private gui-private widgets-private DEFINES += QT_NO_USING_NAMESPACE -MODULE_PLUGIN_TYPES = \ - printsupport - QMAKE_DOCS = $$PWD/doc/qtprintsupport.qdocconf -load(qt_module) - QMAKE_LIBS += $$QMAKE_LIBS_PRINTSUPPORT include(kernel/kernel.pri) include(widgets/widgets.pri) include(dialogs/dialogs.pri) + +MODULE_PLUGIN_TYPES = \ + printsupport +load(qt_module) diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 10004cb445..218671d7e7 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -4,13 +4,8 @@ QT = core-private DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000 -MODULE_PLUGIN_TYPES = \ - sqldrivers - QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf -load(qt_module) - DEFINES += QT_NO_CAST_FROM_ASCII PRECOMPILED_HEADER = ../corelib/global/qt_pch.h SQL_P = sql @@ -18,3 +13,7 @@ SQL_P = sql include(kernel/kernel.pri) include(drivers/drivers.pri) include(models/models.pri) + +MODULE_PLUGIN_TYPES = \ + sqldrivers +load(qt_module) diff --git a/src/tools/bootstrap-dbus/bootstrap-dbus.pro b/src/tools/bootstrap-dbus/bootstrap-dbus.pro index 4c466ba0e9..3b28c23311 100644 --- a/src/tools/bootstrap-dbus/bootstrap-dbus.pro +++ b/src/tools/bootstrap-dbus/bootstrap-dbus.pro @@ -9,8 +9,6 @@ DEFINES += \ MODULE_INCNAME = QtDBus -load(qt_module) - QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS SOURCES = \ @@ -25,5 +23,7 @@ SOURCES = \ ../../dbus/qdbus_symbols.cpp \ ../../dbus/qdbusunixfiledescriptor.cpp +load(qt_module) + lib.CONFIG = dummy_install INSTALLS = lib diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 4f2456cf79..b3df192110 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -27,11 +27,6 @@ DEFINES += \ DEFINES -= QT_EVAL -load(qt_module) - -# otherwise mingw headers do not declare common functions like putenv -mingw: CONFIG -= strict_c++ - SOURCES += \ ../../corelib/codecs/qlatincodec.cpp \ ../../corelib/codecs/qtextcodec.cpp \ @@ -142,5 +137,10 @@ else:include(../../3rdparty/zlib_dependency.pri) win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32 +load(qt_module) + +# otherwise mingw headers do not declare common functions like putenv +mingw: CONFIG -= strict_c++ + lib.CONFIG = dummy_install INSTALLS += lib diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro index c6af6d3f71..da8607c637 100644 --- a/src/widgets/accessible/widgets.pro +++ b/src/widgets/accessible/widgets.pro @@ -1,10 +1,5 @@ TARGET = qtaccessiblewidgets -PLUGIN_TYPE = accessible -PLUGIN_EXTENDS = widgets -PLUGIN_CLASS_NAME = AccessibleFactory -load(qt_plugin) - QT += core-private gui-private widgets-private QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" @@ -24,4 +19,7 @@ HEADERS += qaccessiblewidgets.h \ qaccessiblemenu.h \ itemviews.h - +PLUGIN_TYPE = accessible +PLUGIN_EXTENDS = widgets +PLUGIN_CLASS_NAME = AccessibleFactory +load(qt_plugin) diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index ceb6f96f7c..b609e4c434 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -8,13 +8,8 @@ DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused -MODULE_PLUGIN_TYPES += \ - styles - QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf -load(qt_module) - #platforms mac:include(kernel/mac.pri) win32:include(kernel/win.pri) @@ -45,3 +40,7 @@ QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtWidgets.dynlist testcocoon { load(testcocoon) } + +MODULE_PLUGIN_TYPES += \ + styles +load(qt_module) diff --git a/src/xml/xml.pro b/src/xml/xml.pro index 57bf11e5aa..f281e35444 100644 --- a/src/xml/xml.pro +++ b/src/xml/xml.pro @@ -6,11 +6,11 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000 QMAKE_DOCS = $$PWD/doc/qtxml.qdocconf -load(qt_module) - HEADERS += qtxmlglobal.h PRECOMPILED_HEADER = include(dom/dom.pri) include(sax/sax.pri) + +load(qt_module) -- cgit v1.2.3 From fab4ac60c95ff3dc72339554c289a58f931f6649 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:04:28 +0100 Subject: remove redundant TEMPLATE assignment qt_plugin.prf does that already. Change-Id: Ia0329c3b508c86c2b71782a4e9744cfda528559a Reviewed-by: Simon Hausmann --- src/plugins/platforms/mirclient/mirclient.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 4ea5593478..8c1ac02703 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,5 +1,4 @@ TARGET = mirclient -TEMPLATE = lib QT += core-private gui-private platformsupport-private dbus -- cgit v1.2.3 From cadfae0f9da2c458186b453138cf493b6efbb856 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:05:09 +0100 Subject: fix mir platform plugin name all platform plugins are supposed to start with a q. Change-Id: I4871cc553995aa68a09f8f045bdd378f5022cd87 Reviewed-by: Simon Hausmann Reviewed-by: aavit --- src/plugins/platforms/mirclient/mirclient.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 8c1ac02703..d5d35f1632 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,4 +1,4 @@ -TARGET = mirclient +TARGET = qmirclient QT += core-private gui-private platformsupport-private dbus -- cgit v1.2.3 From 7c200b6dabdc10131d4f839052f8bba1a9d42ea1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:05:32 +0100 Subject: standardize statement order in project file a bit Change-Id: I9fa42d9afa726f52390a2b01637e6f4e9b2fb537 Reviewed-by: Simon Hausmann --- src/plugins/bearer/android/src/src.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/android/src/src.pro b/src/plugins/bearer/android/src/src.pro index 77c95a0b38..eb0738386c 100644 --- a/src/plugins/bearer/android/src/src.pro +++ b/src/plugins/bearer/android/src/src.pro @@ -1,5 +1,3 @@ -include(wrappers/wrappers.pri) - TARGET = qandroidbearer QT = core-private network-private @@ -12,6 +10,8 @@ SOURCES += main.cpp \ qandroidbearerengine.cpp \ ../../qnetworksession_impl.cpp +include(wrappers/wrappers.pri) + PLUGIN_TYPE = bearer PLUGIN_CLASS_NAME = QAndroidBearerEnginePlugin load(qt_plugin) -- cgit v1.2.3 From 5e800fb4147d9e5a30600bb73356872bcfa5b7b7 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 1 Mar 2016 16:01:10 +0100 Subject: QNX: Fix logging of QtDebugMsg in slog2 backend With the introduction of QtInfoMsg in commit ef6279fd we also changed the mapping of Qt to slog2 levels: QtInfoMsg now ends up as SLOG2_DEBUG1, instead of SLOG2_INFO. Anyhow, we didn't change the default buffer verbosity level accordingly. Task-number: QTBUG-51378 Change-Id: Ia464f9e5a31e19413902e877d4f2be0ba6d340db Reviewed-by: Dan Cape Reviewed-by: Janne Koskinen Reviewed-by: Rafael Roquetto --- src/corelib/global/qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index e629e16e8d..ca38d672c3 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1189,7 +1189,7 @@ static void slog2_default_handler(QtMsgType msgType, const char *message) buffer_config.buffer_set_name = __progname; buffer_config.num_buffers = 1; - buffer_config.verbosity_level = SLOG2_INFO; + buffer_config.verbosity_level = SLOG2_DEBUG1; buffer_config.buffer_config[0].buffer_name = "default"; buffer_config.buffer_config[0].num_pages = 8; -- cgit v1.2.3 From bceb1b260cebba27afb5c6c5ab2c01ebda5103dd Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 29 Jan 2016 10:24:58 +0100 Subject: Remove WebEngine examples metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is now maintained in qtwebengine module. Change-Id: Id468be297dfd0a28920fb92d4ba793ff3d3ceab2 Reviewed-by: Topi Reiniö --- doc/global/manifest-meta.qdocconf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf index c45470838a..f535f5e290 100644 --- a/doc/global/manifest-meta.qdocconf +++ b/doc/global/manifest-meta.qdocconf @@ -55,9 +55,7 @@ manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ "QtMultimedia/QML Video Shader Effects Example" \ "QtCanvas3D/Planets Example" \ "QtCanvas3D/Interactive Mobile Phone Example" \ - "QtLocation/Map Viewer (QML)" \ - "QtWebEngine/WebEngine Quick Nano Browser" \ - "QtWebEngine/Markdown Editor Example" + "QtLocation/Map Viewer (QML)" manifestmeta.highlighted.attributes = isHighlighted:true -- cgit v1.2.3 From b8f98d956501dfa4ce03a137f15d404930a56066 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sat, 5 Mar 2016 10:25:33 +0300 Subject: alsatest: Fix the check to treat alsalib 1.1.x as correct version Task-number: QTBUG-51681 Change-Id: I63266c33342f02f4d1a5ea5786f5fbc5a1b421b3 Reviewed-by: Oswald Buddenhagen --- config.tests/unix/alsa/alsatest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.tests/unix/alsa/alsatest.cpp b/config.tests/unix/alsa/alsatest.cpp index cab6533977..0b45819b61 100644 --- a/config.tests/unix/alsa/alsatest.cpp +++ b/config.tests/unix/alsa/alsatest.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ #include -#if(!(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 10)) +#if SND_LIB_VERSION < 0x1000a // 1.0.10 #error "Alsa version found too old, require >= 1.0.10" #endif -- cgit v1.2.3 From bc087db590ddaa68c6d3845bf4e6bd97abf83104 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Mar 2016 11:31:27 +0100 Subject: QtTest: fix UB in QSpontaneKeyEvent::setSpontaneous() Found by UBSan: src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc33019650 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc33019650: note: object is of type 'QMouseEvent' 83 2b 00 00 98 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 02 00 04 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QMouseEvent' src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc330196e0 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc330196e0: note: object is of type 'QKeyEvent' 00 00 00 00 f8 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 07 00 04 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QKeyEvent' Fix by providing setSpontaneous() on QEvent as a private function and befriending QSpontaneKeyEvent. Make setSpontaneous() always-inline to avoid BiC between 5.6.0 and 5.6.1. Change-Id: Ic60d82ed6a858f4f13f41fa3d2d1db6e808896b7 Reviewed-by: Lars Knoll --- src/corelib/kernel/qcoreevent.h | 5 +++++ src/testlib/qtestspontaneevent.h | 11 ++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 53da4a849b..9aa3a2d290 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -317,6 +317,11 @@ private: friend class QGraphicsView; friend class QGraphicsScene; friend class QGraphicsScenePrivate; + // from QtTest: + friend class QSpontaneKeyEvent; + // needs this: + Q_ALWAYS_INLINE + void setSpontaneous() { spont = true; } }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/testlib/qtestspontaneevent.h b/src/testlib/qtestspontaneevent.h index 18c4221f72..bc775aa803 100644 --- a/src/testlib/qtestspontaneevent.h +++ b/src/testlib/qtestspontaneevent.h @@ -76,17 +76,10 @@ public: } #endif + // ### Qt 6: remove everything except this function: static inline void setSpontaneous(QEvent *ev) { - // use a union instead of a reinterpret_cast to prevent alignment warnings - union - { - QSpontaneKeyEvent *skePtr; - QEvent *evPtr; - } helper; - - helper.evPtr = ev; - helper.skePtr->setSpontaneous(); + ev->setSpontaneous(); } protected: -- cgit v1.2.3 From f2bd0d119200d5b66069725563f7f12952e66da8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 3 Mar 2016 15:17:01 +0100 Subject: Clean up WINVER, _WIN32_WINNT macros for MinGW. Define WINVER, _WIN32_WINNT as 0x501 (Windows XP) in qt_windows.h. Remove definitions of the same/lower versions and unneeded definitions in other places. Remove definition for Borland compiler. Task-number: QTBUG-51673 Change-Id: I2a344a7f7cf78b2afbf45dcdf8bf2a19b93f0a07 Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qt_windows.h | 20 ++++++-------------- src/corelib/io/qfilesystemiterator_win.cpp | 7 ------- src/corelib/thread/qthread_win.cpp | 6 ------ src/plugins/platforms/windows/qwindowsfontengine.cpp | 5 ----- .../windows/qwindowsfontenginedirectwrite.cpp | 9 --------- src/widgets/dialogs/qwizard_win.cpp | 12 ------------ src/widgets/styles/qwindowsxpstyle_p_p.h | 12 ------------ src/widgets/util/qsystemtrayicon_win.cpp | 7 ------- 8 files changed, 6 insertions(+), 72 deletions(-) diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 92ed1966d0..fcb8d27cd6 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -39,22 +39,14 @@ #pragma qt_sync_stop_processing #endif -#if defined(Q_CC_BOR) -// Borland's windows.h does not set these correctly, resulting in -// unusable WinSDK standard dialogs -#ifndef WINVER -# define WINVER 0x0501 -#endif -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -#endif -#endif - #if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation -#ifndef WINVER -# define WINVER 0x501 -#endif +# ifndef WINVER +# define WINVER 0x501 +# endif +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif #endif #ifndef NOMINMAX diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index d7fed87222..b00a56785e 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -31,13 +31,6 @@ ** ****************************************************************************/ -#if !defined(WINAPI_FAMILY) -# if _WIN32_WINNT < 0x0500 -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0500 -# endif // _WIN32_WINNT < 0x500 -#endif // !WINAPI_FAMILY - #include "qfilesystemiterator_p.h" #include "qfilesystemengine_p.h" #include "qplatformdefs.h" diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 32e8a52a28..6df85d8b8f 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -31,12 +31,6 @@ ** ****************************************************************************/ -//#define WINVER 0x0500 -#if !defined(WINAPI_FAMILY) && (_WIN32_WINNT < 0x0400) -#define _WIN32_WINNT 0x0400 -#endif - - #include "qthread.h" #include "qthread_p.h" #include "qthreadstorage.h" diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index cda8386ca0..a97062273f 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -31,11 +31,6 @@ ** ****************************************************************************/ -#if _WIN32_WINNT < 0x0500 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 -#endif - #include "qwindowsintegration.h" #include "qwindowsfontengine.h" #include "qwindowsnativeimage.h" diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 16c16fefbe..5b2e220fd6 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -33,15 +33,6 @@ #ifndef QT_NO_DIRECTWRITE -#if WINVER < 0x0600 -# undef WINVER -# define WINVER 0x0600 -#endif -#if _WIN32_WINNT < 0x0600 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - #include "qwindowsfontenginedirectwrite.h" #include "qwindowsfontdatabase.h" #include "qwindowscontext.h" diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index a4b37f360b..b210cb904d 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -47,18 +47,6 @@ #include #include -// Note, these tests are duplicates in qwindowsxpstyle_p.h. -#ifdef Q_CC_GNU -# include -# if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5)) -# ifdef _WIN32_WINNT -# undef _WIN32_WINNT -# endif -# define _WIN32_WINNT 0x0501 -# include -# endif -#endif - #include Q_DECLARE_METATYPE(QMargins) diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 5a0abc1d78..e1e1369850 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -50,18 +50,6 @@ #include #include -// Note, these tests are duplicated in qwizard_win.cpp. -#ifdef Q_CC_GNU -# include -# if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5)) -# ifdef _WIN32_WINNT -# undef _WIN32_WINNT -# endif -# define _WIN32_WINNT 0x0501 -# include -# endif -#endif - #include #if WINVER >= 0x0600 diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index f1b86ba2df..7e0212a233 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -34,13 +34,6 @@ #include "qsystemtrayicon_p.h" #ifndef QT_NO_SYSTEMTRAYICON -#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 -# undef _WIN32_WINNT -#endif -#if !defined(_WIN32_WINNT) -# define _WIN32_WINNT 0x0600 -#endif - #if defined(_WIN32_IE) && _WIN32_IE < 0x0600 # undef _WIN32_IE #endif -- cgit v1.2.3 From d0b54cede8d8ea0b8431c64abb51d0cd1a71327b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 27 Nov 2015 13:28:45 +0100 Subject: Ensure QTextStream doesn't modify the Text flag on the underlying iodevice An empty read or a failed write on the underlying QIODevice of the text stream would lead to an early return where we wouldn't correctly restore the QIODevice::Text flag of the io device. Change-Id: I5b632f45dea6ede3f408113556c3dad1b96574e2 Task-number: QTBUG-47176 Reviewed-by: Marc Mutz Reviewed-by: Simon Hausmann --- src/corelib/io/qtextstream.cpp | 19 ++++++++++--------- tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index a8fd2dd7ab..78dcbfe0e7 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -449,6 +449,10 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) bytesRead = device->read(buf, sizeof(buf)); } + // reset the Text flag. + if (textModeEnabled) + device->setTextModeEnabled(true); + if (bytesRead <= 0) return false; @@ -484,10 +488,6 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) readBuffer += QString::fromLatin1(buf, bytesRead); #endif - // reset the Text flag. - if (textModeEnabled) - device->setTextModeEnabled(true); - // remove all '\r\n' in the string. if (readBuffer.size() > oldReadBufferSize && textModeEnabled) { QChar CR = QLatin1Char('\r'); @@ -586,17 +586,18 @@ void QTextStreamPrivate::flushWriteBuffer() qDebug("QTextStreamPrivate::flushWriteBuffer(), device->write(\"%s\") == %d", qt_prettyDebug(data.constData(), qMin(data.size(),32), data.size()).constData(), int(bytesWritten)); #endif - if (bytesWritten <= 0) { - status = QTextStream::WriteFailed; - return; - } #if defined (Q_OS_WIN) - // replace the text flag + // reset the text flag if (textModeEnabled) device->setTextModeEnabled(true); #endif + if (bytesWritten <= 0) { + status = QTextStream::WriteFailed; + return; + } + // flush the file #ifndef QT_NO_QOBJECT QFileDevice *file = qobject_cast(device); diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 3ab53848d8..a0348f3c54 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -228,6 +228,8 @@ private slots: void alignAccountingStyle(); void setCodec(); + void textModeOnEmptyRead(); + private: void generateLineData(bool for_QString); void generateAllData(bool for_QString); @@ -3045,6 +3047,21 @@ void tst_QTextStream::int_write_with_locale() QCOMPARE(result, output); } +void tst_QTextStream::textModeOnEmptyRead() +{ + const QString filename("textmodetest.txt"); + QFile::remove(filename); // Remove file if exists + + + QFile file(filename); + QVERIFY(file.open(QIODevice::ReadWrite | QIODevice::Text)); + QTextStream stream(&file); + QVERIFY(file.isTextModeEnabled()); + QString emptyLine = stream.readLine(); // Text mode flag cleared here + QVERIFY(file.isTextModeEnabled()); +} + + // ------------------------------------------------------------------------------ QTEST_MAIN(tst_QTextStream) -- cgit v1.2.3 From 2027c0b926d1fc41c929616e209e31fa11b5dc4d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 8 Mar 2016 13:18:39 +0100 Subject: Duplicate trivial code for clarity on early return. Having a variable in which to store a function's return in two branches of a switch in order to return if either was true saved little relative to just testing the function in each case and returning in situ, which reads more clearly. Change-Id: Ibd95a95721eaa6fc4861b10e723038b96caf269a Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 04d391a14c..afb7a204e2 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -676,18 +676,19 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq if (newHttpRequest.attribute(QNetworkRequest::FollowRedirectsAttribute).toBool()) httpRequest.setFollowRedirects(true); - bool loadedFromCache = false; httpRequest.setPriority(convert(newHttpRequest.priority())); switch (operation) { case QNetworkAccessManager::GetOperation: httpRequest.setOperation(QHttpNetworkRequest::Get); - loadedFromCache = loadFromCacheIfAllowed(httpRequest); + if (loadFromCacheIfAllowed(httpRequest)) + return; // no need to send the request! :) break; case QNetworkAccessManager::HeadOperation: httpRequest.setOperation(QHttpNetworkRequest::Head); - loadedFromCache = loadFromCacheIfAllowed(httpRequest); + if (loadFromCacheIfAllowed(httpRequest)) + return; // no need to send the request! :) break; case QNetworkAccessManager::PostOperation: @@ -719,10 +720,6 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq break; // can't happen } - if (loadedFromCache) { - return; // no need to send the request! :) - } - QList headers = newHttpRequest.rawHeaderList(); if (resumeOffset != 0) { if (headers.contains("Range")) { -- cgit v1.2.3 From b366530f584eb4d3e94e32783d533a4a0557f8f4 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 8 Mar 2016 13:29:01 +0100 Subject: Simplified repeated #if-ery and entangled conditionals. Three checks of the same #if managed to save repetition of (if I felt charitable) three shared lines, compared to combining the three into one, which leaves the code easier to read (and obviates the need for one of the "shared" lines). Split a long line while moving it. Change-Id: I762d10ae1df1224c749206b8eb490bafd7ea4900 Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index afb7a204e2..5d0e5b998b 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1746,10 +1746,8 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; } -#endif if (!start(request)) { -#ifndef QT_NO_BEARERMANAGEMENT // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. @@ -1771,21 +1769,21 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; } + } else if (session) { + QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), + Qt::QueuedConnection); + } #else + if (!start(request)) { qWarning("Backend start failed"); QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::UnknownNetworkError), Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "backend start error."))); QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; -#endif - } else { -#ifndef QT_NO_BEARERMANAGEMENT - if (session) - QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); -#endif } +#endif // QT_NO_BEARERMANAGEMENT if (synchronous) { state = Finished; -- cgit v1.2.3 From 5834f5a509e3ac0ddd8f18c71846986d2214fc07 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 8 Mar 2016 13:34:29 +0100 Subject: Purge a verbose no-op. An if with no side-effects in its test and an empty body is a no-op. An else block with nothing but a no-op in it is a no-op. A no-op without even pedagogic value is just a distraction. Change-Id: I224831a325e6b770d0a99d726d96f73da4b8c11f Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 5d0e5b998b..2adaff95a5 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1788,10 +1788,6 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() if (synchronous) { state = Finished; q_func()->setFinished(true); - } else { - if (state != Finished) { - - } } } -- cgit v1.2.3 From 2d276b3ada712f3af13dbfe79fd936acb13fe8ee Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 8 Mar 2016 13:11:13 +0100 Subject: Use booleans as booleans; don't compare == true to do so ! Change-Id: Ic900bf000cec52b3ebf0fd0fc61f42252f3200e6 Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 2adaff95a5..6ba6928ade 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -747,10 +747,10 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header)); - if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true) + if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool()) httpRequest.setPipeliningAllowed(true); - if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool() == true) + if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool()) httpRequest.setSPDYAllowed(true); if (static_cast @@ -758,7 +758,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual) httpRequest.setWithCredentials(false); - if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool() == true) + if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool()) emitAllUploadProgressSignals = true; -- cgit v1.2.3 From 4ef990ce4a15959c5eabc8f9731b5b5155db5b07 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 8 Mar 2016 09:19:01 +0100 Subject: tst_QKeyEvent: Fix MSVC warning about 64bit shift. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tst_qkeyevent.cpp(140): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) Change-Id: Id3e0eea125f7f7ec13f9b9428e034b922d2ce204 Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp index bd68400047..db0bfaf622 100644 --- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp +++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp @@ -137,7 +137,7 @@ void tst_QKeyEvent::modifiers_data() for (quint64 bitmask = 1; bitmask < (1 << kNumModifiers) ; ++bitmask) { QVector modifierCombination; for (quint64 modifier = 0; modifier < kNumModifiers; ++modifier) { - if (bitmask & (1 << modifier)) + if (bitmask & (quint64(1) << modifier)) modifierCombination.append(modifier); } modifierCombinations.append(modifierCombination); -- cgit v1.2.3 From e69e69519661954716d59bfa5bbd0626515cfda9 Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Thu, 3 Mar 2016 15:17:31 +0100 Subject: Disable c++ standard compiler flags for the host build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no test for c++ standard support for the host build (only for the target compiler/build) which leads to trouble in some cross compiling environments (old host compiler, new cross compiler): g++: error: unrecognized command line option ‘-std=c++1z’ So disable c++ standard compiler flags unconditionally for host builds. Task-number: QTBUG-51644 Change-Id: Ifb3042e125fe199a7e081740d1171d26ccacf0c5 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/default_post.prf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index cd8d8859aa..561c8f4858 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -95,7 +95,10 @@ breakpad { !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME) } -c++11|c++14|c++1z { +# Disable special compiler flags for host builds (needs to be changed for 5.7 +# to fall back to c++11 because since 5.7 c++11 is required everywhere, +# including host builds). +if(!host_build|!cross_compile):if(c++11|c++14|c++1z) { c++1z: cxxstd = CXX1Z else: c++14: cxxstd = CXX14 else: cxxstd = CXX11 -- cgit v1.2.3 From fb7ef2b9f5cbc375fb35690326501be6a117314d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 6 Mar 2016 15:06:48 +0100 Subject: QCosmeticStroker: fix out-of-bounds access in drawPixel() Found by UBSan: src/gui/painting/qcosmeticstroker.cpp:150:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]' src/gui/painting/qcosmeticstroker.cpp:150:99: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]' src/gui/painting/qcosmeticstroker.cpp:151:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]' That code path makes no sense if no span has been populated yet, so skip the whole block if current_span == 0. Change-Id: I832b989e89c118dc48ab5add3a28bb44c1936a76 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qcosmeticstroker.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 8c3fd2ce4f..b310336b9b 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -141,12 +141,14 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) return; - int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; - int lasty = stroker->spans[stroker->current_span-1].y; + if (stroker->current_span > 0) { + const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; + const int lasty = stroker->spans[stroker->current_span-1].y; - if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { - stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); - stroker->current_span = 0; + if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { + stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); + stroker->current_span = 0; + } } stroker->spans[stroker->current_span].x = ushort(x); -- cgit v1.2.3 From 1b441c3941efc56f9b0ead35a4501056a74a77e1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 7 Mar 2016 20:26:14 +0100 Subject: Q*Application: fix UB caused by accessing QGuiApplication from QCoreApplication ctor As reported by ubsan: src/gui/kernel/qplatformintegration.cpp:463:10: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication' 0x7ffdc2942490: note: object is of type 'QCoreApplication' src/gui/kernel/qplatformintegration.cpp:466:14: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication' 0x7ffdc2942490: note: object is of type 'QCoreApplication' src/gui/kernel/qplatformintegration.cpp:466:43: runtime error: member call on address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication' 0x7ffdc2942490: note: object is of type 'QCoreApplication' to name just a few which are reported when running gui and widget auto-tests; there're definitely more where these came from. This is caused by QCoreApplication::init() being called from the QCoreApplication ctor, calling virtual functions on Q*AppPrivate, which happen to attempt, in this case, to emit QGuiApp signals. At that point in time, the QGuiApplication ctor has not entered the constructor body, ergo the object is still a QCoreApplication, and calling the signal, as a member function on the derived class, invokes UB. Fix by cleaning up the wild mix of initialization functions used in this hierarchy. The cleanup restores the 1. Q*ApplicationPrivate::Q*ApplicationPrivate() 2. Q*ApplicationPrivate::init(), calling each base class' init() as the first thing two-stage construction pattern commonly used elsewhere in Qt to make sure that the public class' object is fully constructed by the time each level's Private::init() is called. Change-Id: I290402b3232315d7ed687c97e740bfbdbd3ecd1a Reviewed-by: Lars Knoll --- src/corelib/kernel/qcoreapplication.cpp | 47 ++++++++++++++++----------------- src/corelib/kernel/qcoreapplication.h | 2 -- src/corelib/kernel/qcoreapplication_p.h | 2 ++ src/gui/kernel/qguiapplication.cpp | 4 ++- src/gui/kernel/qguiapplication_p.h | 4 +-- src/widgets/kernel/qapplication.cpp | 9 +++++-- src/widgets/kernel/qapplication_p.h | 2 +- 7 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6dcd0ed5b4..30a3204d3d 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -703,7 +703,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p) : QObject(p, 0) #endif { - init(); + d_func()->q_ptr = this; // note: it is the subclasses' job to call // QCoreApplicationPrivate::eventDispatcher->startingUp(); } @@ -752,27 +752,26 @@ QCoreApplication::QCoreApplication(int &argc, char **argv : QObject(*new QCoreApplicationPrivate(argc, argv, _internal)) #endif { - init(); + d_func()->q_ptr = this; + d_func()->init(); #ifndef QT_NO_QOBJECT QCoreApplicationPrivate::eventDispatcher->startingUp(); #endif } -// ### move to QCoreApplicationPrivate constructor? -void QCoreApplication::init() +void QCoreApplicationPrivate::init() { - d_ptr->q_ptr = this; - Q_D(QCoreApplication); + Q_Q(QCoreApplication); - QCoreApplicationPrivate::initLocale(); + initLocale(); - Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object"); - QCoreApplication::self = this; + Q_ASSERT_X(!QCoreApplication::self, "QCoreApplication", "there should be only one application object"); + QCoreApplication::self = q; // Store app name (so it's still available after QCoreApplication is destroyed) if (!coreappdata()->applicationNameSet) - coreappdata()->application = d_func()->appName(); + coreappdata()->application = appName(); QLoggingRegistry::instance()->init(); @@ -788,7 +787,7 @@ void QCoreApplication::init() // anywhere in the list, we can just linearly scan the lists and find the items that // have been removed. Once the original list is exhausted we know all the remaining // items have been added. - QStringList newPaths(libraryPaths()); + QStringList newPaths(q->libraryPaths()); for (int i = manualPaths->length(), j = appPaths->length(); i > 0 || j > 0; qt_noop()) { if (--j < 0) { newPaths.prepend((*manualPaths)[--i]); @@ -808,28 +807,28 @@ void QCoreApplication::init() #ifndef QT_NO_QOBJECT // use the event dispatcher created by the app programmer (if any) - if (!QCoreApplicationPrivate::eventDispatcher) - QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher.load(); + if (!eventDispatcher) + eventDispatcher = threadData->eventDispatcher.load(); // otherwise we create one - if (!QCoreApplicationPrivate::eventDispatcher) - d->createEventDispatcher(); - Q_ASSERT(QCoreApplicationPrivate::eventDispatcher != 0); + if (!eventDispatcher) + createEventDispatcher(); + Q_ASSERT(eventDispatcher); - if (!QCoreApplicationPrivate::eventDispatcher->parent()) { - QCoreApplicationPrivate::eventDispatcher->moveToThread(d->threadData->thread); - QCoreApplicationPrivate::eventDispatcher->setParent(this); + if (!eventDispatcher->parent()) { + eventDispatcher->moveToThread(threadData->thread); + eventDispatcher->setParent(q); } - d->threadData->eventDispatcher = QCoreApplicationPrivate::eventDispatcher; - d->eventDispatcherReady(); + threadData->eventDispatcher = eventDispatcher; + eventDispatcherReady(); #endif #ifdef QT_EVAL extern void qt_core_eval_init(QCoreApplicationPrivate::Type); - qt_core_eval_init(d->application_type); + qt_core_eval_init(application_type); #endif - d->processCommandLineArguments(); + processCommandLineArguments(); qt_call_pre_routines(); qt_startup_hook(); @@ -839,7 +838,7 @@ void QCoreApplication::init() #endif #ifndef QT_NO_QOBJECT - QCoreApplicationPrivate::is_app_running = true; // No longer starting up. + is_app_running = true; // No longer starting up. #endif } diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index d865c4e7a8..a008c25c76 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -200,8 +200,6 @@ private: static bool notifyInternal2(QObject *receiver, QEvent *); #endif - void init(); - static QCoreApplication *self; Q_DISABLE_COPY(QCoreApplication) diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 9a9e8dd09a..45c34b7df2 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -74,6 +74,8 @@ public: QCoreApplicationPrivate(int &aargc, char **aargv, uint flags); ~QCoreApplicationPrivate(); + void init(); + QString appName() const; #ifdef Q_OS_MAC diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3808bec8a4..385264d70a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -577,7 +577,7 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags) QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p) : QCoreApplication(p) { - d_func()->init(); } +} /*! Destructs the application. @@ -1260,6 +1260,8 @@ void QGuiApplicationPrivate::eventDispatcherReady() void QGuiApplicationPrivate::init() { + QCoreApplicationPrivate::init(); + QCoreApplicationPrivate::is_app_running = false; // Starting up. bool loadTestability = false; diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 9c8b655c71..9e157aad51 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -75,6 +75,8 @@ public: QGuiApplicationPrivate(int &argc, char **argv, int flags); ~QGuiApplicationPrivate(); + void init(); + void createPlatformIntegration(); void createEventDispatcher() Q_DECL_OVERRIDE; void eventDispatcherReady() Q_DECL_OVERRIDE; @@ -298,8 +300,6 @@ protected: private: friend class QDragManager; - void init(); - static QGuiApplicationPrivate *self; static QTouchDevice *m_fakeTouchDevice; static int m_fakeMouseSourcePointId; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f7d4139ed8..b7de0d7a7e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -562,13 +562,18 @@ QApplication::QApplication(int &argc, char **argv) QApplication::QApplication(int &argc, char **argv, int _internal) #endif : QGuiApplication(*new QApplicationPrivate(argc, argv, _internal)) -{ Q_D(QApplication); d->construct(); } +{ + Q_D(QApplication); + d->init(); +} /*! \internal */ -void QApplicationPrivate::construct() +void QApplicationPrivate::init() { + QGuiApplicationPrivate::init(); + initResources(); qt_is_gui_used = (application_type != QApplicationPrivate::Tty); diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index cb158011f0..832d37a329 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -150,7 +150,7 @@ public: bool notify_helper(QObject *receiver, QEvent * e); - void construct( + void init( #ifdef Q_DEAD_CODE_FROM_QT4_X11 Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0 #endif -- cgit v1.2.3 From 1bfc7f680fc3dd839eac553c80d151a2cc7bfa3d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 6 Mar 2016 19:34:06 +0100 Subject: QString, QJson, QHash: Fix UBs involving unaligned loads Found by UBSan: src/corelib/tools/qstring.cpp:587:42: runtime error: load of misaligned address 0x2acbf4b7551b for type 'const long long int', which requires 8 byte alignment src/corelib/json/qjson_p.h:405:30: runtime error: store to misaligned address 0x0000019b1e52 for type 'quint64', which requires 8 byte alignment src/corelib/tools/qhash.cpp:116:27: runtime error: load of misaligned address 0x2b8f9ce80e85 for type 'const qlonglong', which requires 8 byte alignment src/corelib/tools/qhash.cpp:133:26: runtime error: load of misaligned address 0x2b8f9ce80e8d for type 'const ushort', which requires 2 byte alignment Fix by memcpy()ing into a local variable. Wrap this trick in template functions in qsimd_p.h. These are marked as always- inline and use __builtin_memcpy() where available in an attempt to avoid the memcpy() function call overhead in debug builds. While this looks prohibitively expensive, from the pov of the C++ abstract machine, it is 100% equivalent, except for the absence of undefined behavior. In one case, the cast produces a local temporary which is then copied into the function, and in the other case, that local variable comes from return value of qUnalignedLoad(). Consequently, GCC compiles these two versions into identical assembler code (only verfied for ucstrncmp, but there's no reason to believe that it wouldn't hold for the other cases, too). Task-number: QTBUG-51651 Change-Id: Ia50d4a1d7580b6f803e0895c9f3d89c7da37840c Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Allan Sandfeld Jensen --- src/corelib/json/qjson_p.h | 2 +- src/corelib/tools/qhash.cpp | 8 ++++---- src/corelib/tools/qsimd.cpp | 22 ++++++++++++++++++++++ src/corelib/tools/qsimd_p.h | 37 +++++++++++++++++++++++++++++++++++++ src/corelib/tools/qstring.cpp | 2 +- 5 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 0b3f517990..59d0c91785 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -402,7 +402,7 @@ public: // pack with itself, we'll discard the high part anyway chunk = _mm_packus_epi16(chunk, chunk); // unaligned 64-bit store - *(quint64*)&l[i] = _mm_cvtsi128_si64(chunk); + qUnalignedStore(l + i, _mm_cvtsi128_si64(chunk)); i += 8; } # endif diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 775e1364a1..ac9e08de8b 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -106,24 +106,24 @@ static uint crc32(const Char *ptr, size_t len, uint h) p += 8; for ( ; p <= e; p += 8) - h2 = _mm_crc32_u64(h2, *reinterpret_cast(p - 8)); + h2 = _mm_crc32_u64(h2, qUnalignedLoad(p - 8)); h = h2; p -= 8; len = e - p; if (len & 4) { - h = _mm_crc32_u32(h, *reinterpret_cast(p)); + h = _mm_crc32_u32(h, qUnalignedLoad(p)); p += 4; } # else p += 4; for ( ; p <= e; p += 4) - h = _mm_crc32_u32(h, *reinterpret_cast(p - 4)); + h = _mm_crc32_u32(h, qUnalignedLoad(p - 4)); p -= 4; len = e - p; # endif if (len & 2) { - h = _mm_crc32_u16(h, *reinterpret_cast(p)); + h = _mm_crc32_u16(h, qUnalignedLoad(p)); p += 2; } if (sizeof(Char) == 1 && len & 1) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index f07eb098f2..5ca2ce4c6f 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -716,4 +716,26 @@ void qDumpCPUFeatures() puts(""); } +/*! + \internal + \fn T qUnalignedLoad(const void *ptr) + \since 5.6.1 + + Loads a \c{T} from address \a ptr, which may be misaligned. + + Use of this function avoid the undefined behavior that the C++ standard + otherwise attributes to unaligned loads. +*/ + +/*! + \internal + \fn void qUnalignedStore(void *ptr, T t) + \since 5.6.1 + + Stores \a t to address \a ptr, which may be misaligned. + + Use of this function avoid the undefined behavior that the C++ standard + otherwise attributes to unaligned stores. +*/ + QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 12a329f36c..8171184ad2 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -470,6 +470,43 @@ unsigned _bit_scan_forward(unsigned val) #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast(qMin(static_cast(length), ((4 - ((reinterpret_cast(ptr) >> 2) & 0x3)) & 0x3))); ++i) +// these defines are copied from qendian.h +// in Qt 5.7, they have been moved to qglobal.h +// drop them when merging this to 5.7 +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif + +template +Q_ALWAYS_INLINE +T qUnalignedLoad(const void *ptr) Q_DECL_NOTHROW +{ + T result; +#if QT_HAS_BUILTIN(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + /*memcpy*/(&result, ptr, sizeof result); + return result; +} + +template +Q_ALWAYS_INLINE +void qUnalignedStore(void *ptr, T t) Q_DECL_NOTHROW +{ +#if QT_HAS_BUILTIN(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + /*memcpy*/(ptr, &t, sizeof t); +} + +#undef QT_HAS_BUILTIN + QT_END_NAMESPACE #endif // QSIMD_P_H diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 39ec66c7f1..9924b606c5 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -577,7 +577,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) // we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes) if (uc + offset + 7 < e) { // same, but we're using an 8-byte load - __m128i chunk = _mm_cvtsi64_si128(*(const long long *)(c + offset)); + __m128i chunk = _mm_cvtsi64_si128(qUnalignedLoad(c + offset)); __m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask); __m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset)); -- cgit v1.2.3 From 3856099d9a6c9cd90747d530819df8c99198fa54 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 9 Mar 2016 11:09:18 +0100 Subject: QGestureManager: fix UB in filterEvent() The code infers from the presence of an address in a QHash that the address belongs to a QGesture. So far that is fine enough. But in order to perform the lookup, it static_cast<>s the QObject* argument to a QGesture* for the QHash:: contains() call. Even though the pointer is not dereferenced, the cast is UB. Says UBSan: qgesturemanager.cpp:558:73: runtime error: downcast of address 0x2ab83364f3a0 which does not point to an object of type 'QGesture' 0x2ab83364f3a0: note: object is of type 'QDBusConnectionManager' which is a particularly hideous error message because of the constantly-changing completely-unrelated actual type in the second line of the message: 52 QDBusConnectionManager 19 QSocketNotifier 14 QFusionStyle 13 QAction 6 QApplication 3 QGraphicsWidget 1 Window 1 TestRunnable 1 RectWidget 1 QTimer 1 QSingleShotTimer 1 QOffscreenSurface 1 QGraphicsProxyWidget 1 QDefaultAnimationDriver 1 QDBusPendingCallWatcherHelper This error is also _very_ common, triggered 116 times in a single run of make -C tests/auto check. Fix by using qobject_cast first and then doing the lookup only when the cast succeeded. Depending on the performance of qobject_cast<>, this may actually perform better, too. Change-Id: I884ec7d885711acc3c1d004ce93c628268d8fc18 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/kernel/qgesturemanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index fb2914d53a..967ef6b40c 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -548,9 +548,9 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) if (widgetWindow) return filterEvent(widgetWindow->widget(), event); - if (!m_gestureToRecognizer.contains(static_cast(receiver))) + QGesture *state = qobject_cast(receiver); + if (!state || !m_gestureToRecognizer.contains(state)) return false; - QGesture *state = static_cast(receiver); QMultiMap contexts; contexts.insert(state, state->gestureType()); return filterEventThroughContexts(contexts, event); -- cgit v1.2.3 From 62e89f474551d6de025cc9d53950199df181de16 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 8 Mar 2016 22:41:39 +0100 Subject: tst_QMetaType: fix misleading indention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As found by GCC 6: tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1476:9: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation] tn += ">"; ^~ tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1474:5: note: ...this ‘if’ clause, but it is not if (tn.endsWith('>')) ^~ Fix += argument from char[2] to char as a drive-by. Change-Id: I814dc58830934cac7fcf81eb7fd7564b2abeb631 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index c74a43b682..e35790351d 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1475,7 +1475,7 @@ static QByteArray createTypeName(const char *begin, const char *va) } if (tn.endsWith('>')) tn += ' '; - tn += ">"; + tn += '>'; return tn; } #endif -- cgit v1.2.3 From 7d374b7ba68c29a1b065cb1645789dbbc3d5ac33 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 8 Mar 2016 16:55:06 +0100 Subject: QString::vasprintf(): Use quintptr when casting pointer for %p. Previously, the macro Q_OS_WIN64 was checked, causing warnings: tools\qstring.cpp(6183): warning C4311: 'reinterpret_cast': pointer truncation from 'void *' to 'unsigned long' tools\qstring.cpp(6183): warning C4302: 'reinterpret_cast': truncation from 'void *' to 'unsigned long' when compiling WinRT/64bit, where it is not defined. Change-Id: Ib9d8405108c85170aba18b13f9c64083136bc5ee Reviewed-by: Maurice Kalinowski Reviewed-by: Marc Mutz --- src/corelib/tools/qstring.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 9924b606c5..cdf37cca07 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6163,11 +6163,7 @@ QString QString::vasprintf(const char *cformat, va_list ap) } case 'p': { void *arg = va_arg(ap, void*); -#ifdef Q_OS_WIN64 - quint64 i = reinterpret_cast(arg); -#else - quint64 i = reinterpret_cast(arg); -#endif + const quint64 i = reinterpret_cast(arg); flags |= QLocaleData::Alternate; subst = QLocaleData::c()->unsLongLongToString(i, precision, 16, width, flags); ++c; -- cgit v1.2.3 From cb24903ef4df0571f8498fca6bc58f5df6dd68af Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 9 Mar 2016 10:22:43 +0100 Subject: Generate QVariant::fromValue(enum_value) for enum values Instead of just QVariant(enum_value). Task-number: QTBUG-49383 Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727 Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteinitialization.cpp | 5 ++- tests/auto/tools/uic/baseline/enumnostdset.ui | 39 ++++++++++++++++++ tests/auto/tools/uic/baseline/enumnostdset.ui.h | 55 +++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 tests/auto/tools/uic/baseline/enumnostdset.ui create mode 100644 tests/auto/tools/uic/baseline/enumnostdset.ui.h diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 9c2d7cbc2c..e0d4bea5b9 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1267,7 +1267,10 @@ void WriteInitialization::writeProperties(const QString &varName, } else { setFunction = QLatin1String("->setProperty(\""); setFunction += propertyName; - setFunction += QLatin1String("\", QVariant("); + setFunction += QLatin1String("\", QVariant"); + if (p->kind() == DomProperty::Enum) + setFunction += QLatin1String("::fromValue"); + setFunction += QLatin1Char('('); } QString varNewName = varName; diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui b/tests/auto/tools/uic/baseline/enumnostdset.ui new file mode 100644 index 0000000000..59e27b1be3 --- /dev/null +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui @@ -0,0 +1,39 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 100 + 100 + 100 + 100 + + + + Qt::DashDotLine + + + + + + WorldTimeClock + QWidget +
worldtimeclock.h
+
+
+ + +
diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui.h b/tests/auto/tools/uic/baseline/enumnostdset.ui.h new file mode 100644 index 0000000000..89a8411b4a --- /dev/null +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui.h @@ -0,0 +1,55 @@ +/******************************************************************************** +** Form generated from reading UI file 'enumnostdset.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef ENUMNOSTDSET_H +#define ENUMNOSTDSET_H + +#include +#include +#include +#include +#include +#include +#include "worldtimeclock.h" + +QT_BEGIN_NAMESPACE + +class Ui_Form +{ +public: + WorldTimeClock *worldTimeClock; + + void setupUi(QWidget *Form) + { + if (Form->objectName().isEmpty()) + Form->setObjectName(QStringLiteral("Form")); + Form->resize(400, 300); + worldTimeClock = new WorldTimeClock(Form); + worldTimeClock->setObjectName(QStringLiteral("worldTimeClock")); + worldTimeClock->setGeometry(QRect(100, 100, 100, 100)); + worldTimeClock->setProperty("penStyle", QVariant::fromValue(Qt::DashDotLine)); + + retranslateUi(Form); + + QMetaObject::connectSlotsByName(Form); + } // setupUi + + void retranslateUi(QWidget *Form) + { + Form->setWindowTitle(QApplication::translate("Form", "Form", 0)); + } // retranslateUi + +}; + +namespace Ui { + class Form: public Ui_Form {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // ENUMNOSTDSET_H -- cgit v1.2.3 From d29443c9c88d2b15c9a4735cf4d001c65b103a9b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 19 Oct 2015 14:08:28 +0200 Subject: Manual touch test: Remove QDebug operator for QTouchDevice. It now exists in QtGui. Task-number: QTBUG-48849 Change-Id: I9107c96e0010252bc50bcb02ef006cb46bd942df Reviewed-by: Friedemann Kleint --- tests/manual/touch/main.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tests/manual/touch/main.cpp b/tests/manual/touch/main.cpp index b7029767c9..2a5c2b508e 100644 --- a/tests/manual/touch/main.cpp +++ b/tests/manual/touch/main.cpp @@ -91,24 +91,6 @@ static void drawArrow(const QPointF ¢er, qreal length, qreal angleDegrees, painter.restore(); } -QDebug operator<<(QDebug debug, const QTouchDevice *d) -{ - QDebugStateSaver saver(debug); - debug.nospace(); - debug << "QTouchDevice(" << d->name() << ','; - switch (d->type()) { - case QTouchDevice::TouchScreen: - debug << "TouchScreen"; - break; - case QTouchDevice::TouchPad: - debug << "TouchPad"; - break; - } - debug << ", capabilities=" << d->capabilities() - << ", maximumTouchPoints=" << d->maximumTouchPoints() << ')'; - return debug; -} - // Hierarchy of classes containing gesture parameters and drawing functionality. class Gesture { Q_DISABLE_COPY(Gesture) -- cgit v1.2.3 From d7db6c6c1944894737babf3958d0cff1e6222a22 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 8 Mar 2016 15:50:20 +0100 Subject: xcb: mark mouse events from tablet devices as synthesized Task-number: QTBUG-51617 Change-Id: Ic1d258c56165947ff821b1bf4d044bcf29b41a3b Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection.h | 2 +- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 39 +++++++++++++++--------- src/plugins/platforms/xcb/qxcbwindow.h | 11 ++++--- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 47ef173cf4..86af5dc9c5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -350,7 +350,7 @@ public: virtual void handleFocusOutEvent(const xcb_focus_out_event_t *) {} virtual void handlePropertyNotifyEvent(const xcb_property_notify_event_t *) {} #ifdef XCB_USE_XINPUT22 - virtual void handleXIMouseEvent(xcb_ge_event_t *) {} + virtual void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource = Qt::MouseEventNotSynthesized) {} virtual void handleXIEnterLeave(xcb_ge_event_t *) {} #endif virtual QXcbWindow *toWindow() { return 0; } diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 81cdaa56c5..9911afb11e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -1130,7 +1130,7 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q // Synthesize mouse events since otherwise there are no mouse events from // the pen on the XI 2.2+ path. if (xi2MouseEvents() && eventListener) - eventListener->handleXIMouseEvent(reinterpret_cast(event)); + eventListener->handleXIMouseEvent(reinterpret_cast(event), Qt::MouseEventSynthesizedByQt); #else Q_UNUSED(eventListener); #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index bfbc38e4c2..cd1774fed7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -34,6 +34,7 @@ #include "qxcbwindow.h" #include +#include #include #include #include @@ -2158,7 +2159,7 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) } void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp) + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source) { const bool isWheel = detail >= 4 && detail <= 7; if (!isWheel && window() != QGuiApplication::focusWindow()) { @@ -2194,11 +2195,11 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in return; } - handleMouseEvent(timestamp, local, global, modifiers); + handleMouseEvent(timestamp, local, global, modifiers, source); } void QXcbWindow::handleButtonReleaseEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp) + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source) { QPoint local(event_x, event_y); QPoint global(root_x, root_y); @@ -2208,7 +2209,7 @@ void QXcbWindow::handleButtonReleaseEvent(int event_x, int event_y, int root_x, return; } - handleMouseEvent(timestamp, local, global, modifiers); + handleMouseEvent(timestamp, local, global, modifiers, source); } static bool ignoreLeaveEvent(quint8 mode, quint8 detail) @@ -2291,11 +2292,11 @@ void QXcbWindow::handleLeaveNotifyEvent(int root_x, int root_y, } void QXcbWindow::handleMotionNotifyEvent(int event_x, int event_y, int root_x, int root_y, - Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp) + Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source) { QPoint local(event_x, event_y); QPoint global(root_x, root_y); - handleMouseEvent(timestamp, local, global, modifiers); + handleMouseEvent(timestamp, local, global, modifiers, source); } // Handlers for plain xcb events. Used only when XI 2.2 or newer is not available. @@ -2326,7 +2327,7 @@ static inline int fixed1616ToInt(FP1616 val) } // With XI 2.2+ press/release/motion comes here instead of the above handlers. -void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event) +void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source) { QXcbConnection *conn = connection(); xXIDeviceEvent *ev = reinterpret_cast(event); @@ -2346,20 +2347,27 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event) conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i)); } + const char *sourceName = nullptr; + if (lcQpaXInput().isDebugEnabled()) { + const QMetaObject *metaObject = qt_getEnumMetaObject(source); + const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(source))); + sourceName = me.valueToKey(source); + } + switch (ev->evtype) { case XI_ButtonPress: - qCDebug(lcQpaXInput, "XI2 mouse press, button %d, time %d", button, ev->time); + qCDebug(lcQpaXInput, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName); conn->setButton(button, true); - handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time); + handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source); break; case XI_ButtonRelease: - qCDebug(lcQpaXInput, "XI2 mouse release, button %d, time %d", button, ev->time); + qCDebug(lcQpaXInput, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName); conn->setButton(button, false); - handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time); + handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source); break; case XI_Motion: - qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d, time %d", event_x, event_y, ev->time); - handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time); + qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName); + handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source); break; default: qWarning() << "Unrecognized XI2 mouse event" << ev->evtype; @@ -2402,10 +2410,11 @@ void QXcbWindow::handleXIEnterLeave(xcb_ge_event_t *event) QXcbWindow *QXcbWindow::toWindow() { return this; } -void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers) +void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, + Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source) { connection()->setTime(time); - QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttons(), modifiers); + QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttons(), modifiers, source); } void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 69790f29ae..4673f3dd33 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -133,13 +133,14 @@ public: void handleFocusOutEvent(const xcb_focus_out_event_t *event) Q_DECL_OVERRIDE; void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE; #ifdef XCB_USE_XINPUT22 - void handleXIMouseEvent(xcb_ge_event_t *) Q_DECL_OVERRIDE; + void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) Q_DECL_OVERRIDE; void handleXIEnterLeave(xcb_ge_event_t *) Q_DECL_OVERRIDE; #endif QXcbWindow *toWindow() Q_DECL_OVERRIDE; - void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers); + void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, + Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); void updateNetWmUserTime(xcb_timestamp_t timestamp); @@ -207,13 +208,13 @@ protected: bool compressExposeEvent(QRegion &exposeRegion); void handleButtonPressEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp); + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); void handleButtonReleaseEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp); + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); void handleMotionNotifyEvent(int event_x, int event_y, int root_x, int root_y, - Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp); + Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); void handleEnterNotifyEvent(int event_x, int event_y, int root_x, int root_y, quint8 mode, quint8 detail, xcb_timestamp_t timestamp); -- cgit v1.2.3 From f8f1bac3f0df29e9a3103d385a0c5f9153a9eb66 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Mon, 7 Mar 2016 20:27:09 -0800 Subject: Accept LFCRLF to mark end of HTTP Headers Some embedded servers use LF to mark the end of an individual header, but use CRLF to mark the end of all the headers. The GoPro WiFi interface does this, as an example. Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69 Reviewed-by: Marc Mutz Reviewed-by: Markus Goetz (Woboq GmbH) --- src/network/access/qhttpnetworkreply.cpp | 5 +- src/network/access/qhttpnetworkreply_p.h | 2 +- .../qhttpnetworkreply/tst_qhttpnetworkreply.cpp | 67 ++++++++++++++++++++++ 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index a0f05523e3..f1b0a844c8 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -554,9 +554,8 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) if (c == '\n') { // check for possible header endings. As per HTTP rfc, // the header endings will be marked by CRLFCRLF. But - // we will allow CRLFCRLF, CRLFLF, LFLF - if (fragment.endsWith("\r\n\r\n") - || fragment.endsWith("\r\n\n") + // we will allow CRLFCRLF, CRLFLF, LFCRLF, LFLF + if (fragment.endsWith("\n\r\n") || fragment.endsWith("\n\n")) allHeaders = true; diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index e8ed73fdac..4e09fd9110 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -175,7 +175,7 @@ private: }; -class QHttpNetworkReplyPrivate : public QObjectPrivate, public QHttpNetworkHeaderPrivate +class Q_AUTOTEST_EXPORT QHttpNetworkReplyPrivate : public QObjectPrivate, public QHttpNetworkHeaderPrivate { public: QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl()); diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp index 16faee9705..231c2de4cb 100644 --- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp +++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp @@ -33,6 +33,9 @@ #include +#include +#include + #include "private/qhttpnetworkconnection_p.h" class tst_QHttpNetworkReply: public QObject @@ -46,6 +49,9 @@ private Q_SLOTS: void parseHeader_data(); void parseHeader(); + + void parseEndOfHeader_data(); + void parseEndOfHeader(); }; @@ -122,5 +128,66 @@ void tst_QHttpNetworkReply::parseHeader() } } +class TestHeaderSocket : public QAbstractSocket +{ +public: + explicit TestHeaderSocket(const QByteArray &input) : QAbstractSocket(QAbstractSocket::TcpSocket, Q_NULLPTR) + { + inputBuffer.setData(input); + inputBuffer.open(QIODevice::ReadOnly | QIODevice::Unbuffered); + open(QIODevice::ReadOnly | QIODevice::Unbuffered); + } + + qint64 readData(char *data, qint64 maxlen) { return inputBuffer.read(data, maxlen); } + + QBuffer inputBuffer; +}; + +class TestHeaderReply : public QHttpNetworkReply +{ +public: + QHttpNetworkReplyPrivate *replyPrivate() { return static_cast(d_ptr.data()); } +}; + +void tst_QHttpNetworkReply::parseEndOfHeader_data() +{ + QTest::addColumn("headers"); + QTest::addColumn("lengths"); + + QTest::newRow("CRLFCRLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\r\n\r\nHTTPBODY") + << qint64(90); + + QTest::newRow("CRLFLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\r\n\nHTTPBODY") + << qint64(89); + + QTest::newRow("LFCRLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\n\r\nHTTPBODY") + << qint64(89); + + QTest::newRow("LFLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\n\nHTTPBODY") + << qint64(88); +} + +void tst_QHttpNetworkReply::parseEndOfHeader() +{ + QFETCH(QByteArray, headers); + QFETCH(qint64, lengths); + + TestHeaderSocket socket(headers); + + TestHeaderReply reply; + + QHttpNetworkReplyPrivate *replyPrivate = reply.replyPrivate(); + qint64 headerBytes = replyPrivate->readHeader(&socket); + QCOMPARE(headerBytes, lengths); +} + QTEST_MAIN(tst_QHttpNetworkReply) #include "tst_qhttpnetworkreply.moc" -- cgit v1.2.3 From 2020d2cb63b851723e188c002acbe25b5f066525 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 4 Mar 2016 15:19:50 -0800 Subject: QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This warning is triggered when we try to apply the Q_DECL_HIDDEN attribute to a class in an unnamed namespace. Such classes are already not exported. qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes] qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes] Added a test on gadgets (and QObjects) in unnamed namespaces, because qtbase currently does not contain such Q_GADGETs. Done-with: Thiago Macieira Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672 Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobjectdefs.h | 15 ++++++++++-- tests/auto/tools/moc/tst_moc.cpp | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index b1ed971eba..2e9ed4fb5f 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -152,6 +152,12 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} # define Q_OBJECT_NO_OVERRIDE_WARNING #endif +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 600 +# define Q_OBJECT_NO_ATTRIBUTES_WARNING QT_WARNING_DISABLE_GCC("-Wattributes") +#else +# define Q_OBJECT_NO_ATTRIBUTES_WARNING +#endif + /* qmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ @@ -162,10 +168,11 @@ public: \ virtual const QMetaObject *metaObject() const; \ virtual void *qt_metacast(const char *); \ virtual int qt_metacall(QMetaObject::Call, int, void **); \ - QT_WARNING_POP \ QT_TR_FUNCTIONS \ private: \ + Q_OBJECT_NO_ATTRIBUTES_WARNING \ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ struct QPrivateSignal {}; /* qmake ignore Q_OBJECT */ @@ -179,7 +186,11 @@ public: \ void qt_check_for_QGADGET_macro(); \ typedef void QtGadgetHelper; \ private: \ - Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); + QT_WARNING_PUSH \ + Q_OBJECT_NO_ATTRIBUTES_WARNING \ + Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ + /*end*/ #endif // QT_NO_META_MACROS #else // Q_MOC_RUN diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index c113b7cd60..5c16c7a48f 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -131,6 +131,33 @@ typedef struct { int doNotConfuseMoc; } OldStyleCStruct; +namespace { + + class GadgetInUnnamedNS + { + Q_GADGET + Q_PROPERTY(int x READ x WRITE setX) + Q_PROPERTY(int y READ y WRITE setY) + public: + explicit GadgetInUnnamedNS(int x, int y) : m_x(x), m_y(y) {} + int x() const { return m_x; } + int y() const { return m_y; } + void setX(int x) { m_x = x; } + void setY(int y) { m_y = y; } + + private: + int m_x, m_y; + }; + + class ObjectInUnnamedNS : public QObject + { + Q_OBJECT + public: + explicit ObjectInUnnamedNS(QObject *parent = Q_NULLPTR) : QObject(parent) {} + }; + +} + class Sender : public QObject { Q_OBJECT @@ -597,6 +624,7 @@ private slots: void relatedMetaObjectsNameConflict_data(); void relatedMetaObjectsNameConflict(); void strignLiteralsInMacroExtension(); + void unnamedNamespaceObjectsAndGadgets(); void veryLongStringData(); void gadgetHierarchy(); @@ -3421,6 +3449,28 @@ class VeryLongStringData : public QObject #undef repeat65534 }; +void tst_Moc::unnamedNamespaceObjectsAndGadgets() +{ + // these just test very basic functionality of gadgets and objects + // defined in unnamed namespaces. + { + GadgetInUnnamedNS gadget(21, 42); + QCOMPARE(gadget.x(), 21); + QCOMPARE(gadget.y(), 42); + gadget.staticMetaObject.property(0).writeOnGadget(&gadget, 12); + gadget.staticMetaObject.property(1).writeOnGadget(&gadget, 24); + QCOMPARE(gadget.x(), 12); + QCOMPARE(gadget.y(), 24); + } + + { + ObjectInUnnamedNS object; + QObject *qObject = &object; + QCOMPARE(static_cast(qObject), + qobject_cast(qObject)); + } +} + void tst_Moc::veryLongStringData() { const QMetaObject *mobj = &VeryLongStringData::staticMetaObject; -- cgit v1.2.3 From 85a57f7a2e85ac61bb65e66b003cb21f58d5a5b7 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 3 Mar 2016 13:51:19 -0800 Subject: Wheel event widget: Harden logic an extra bit This is quite an unlikely scenario, but not impossible. It could be that the wheel widget is destroyed during an update phase event. In that case, wheel_widget would be a dangling pointer for any subsequent wheel event. We protect against this with a QPointer. However, that would mean that if the next wheel event were to be an end phase event, that event would be lost. So we go through the usual code path, except that we won't set wheel_widget in the case of an end phase event. Change-Id: I59a912b845dcc249e1edc60b4dc28bf308d807d9 Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qapplication.cpp | 76 +++++++++++++++++++++++++------------ src/widgets/kernel/qapplication_p.h | 2 +- 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index b7de0d7a7e..b34380dbc3 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -417,7 +417,7 @@ QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard inpu QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus #ifndef QT_NO_WHEELEVENT int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll -QWidget *QApplicationPrivate::wheel_widget = Q_NULLPTR; +QPointer QApplicationPrivate::wheel_widget; #endif bool qt_in_tab_key_event = false; int qt_antialiasing_threshold = -1; @@ -3326,9 +3326,32 @@ bool QApplication::notify(QObject *receiver, QEvent *e) const bool spontaneous = wheel->spontaneous(); const Qt::ScrollPhase phase = wheel->phase(); - if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin - || (phase == Qt::ScrollUpdate && !QApplicationPrivate::wheel_widget)) { - + // Ideally, we should lock on a widget when it starts receiving wheel + // events. This avoids other widgets to start receiving those events + // as the mouse cursor hovers them. However, given the way common + // wheeled mice work, there's no certain way of connecting different + // wheel events as a stream. This results in the NoScrollPhase case, + // where we just send the event from the original receiver and up its + // hierarchy until the event gets accepted. + // + // In the case of more evolved input devices, like Apple's trackpad or + // Magic Mouse, we receive the scroll phase information. This helps us + // connect wheel events as a stream and therefore makes it easier to + // lock on the widget onto which the scrolling was initiated. + // + // We assume that, when supported, the phase cycle follows the pattern: + // + // ScrollBegin (ScrollUpdate* ScrollEnd)+ + // + // This means that we can have scrolling sequences (starting with ScrollBegin) + // or partial sequences (after a ScrollEnd and starting with ScrollUpdate). + // If wheel_widget is null because it was deleted, we also take the same + // code path as an initial sequence. + if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin || !QApplicationPrivate::wheel_widget) { + + // A system-generated ScrollBegin event starts a new user scrolling + // sequence, so we reset wheel_widget in case no one accepts the event + // or if we didn't get (or missed) a ScrollEnd previously. if (spontaneous && phase == Qt::ScrollBegin) QApplicationPrivate::wheel_widget = Q_NULLPTR; @@ -3346,7 +3369,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = d->notify_helper(w, &we); eventAccepted = we.isAccepted(); if (res && eventAccepted) { - if (spontaneous && phase != Qt::NoScrollPhase && QGuiApplicationPrivate::scrollNoPhaseAllowed) + // A new scrolling sequence or partial sequence starts and w has accepted + // the event. Therefore, we can set wheel_widget, but only if it's not + // the end of a sequence. + if (spontaneous && (phase == Qt::ScrollBegin || phase == Qt::ScrollUpdate) && QGuiApplicationPrivate::scrollNoPhaseAllowed) QApplicationPrivate::wheel_widget = w; break; } @@ -3357,25 +3383,27 @@ bool QApplication::notify(QObject *receiver, QEvent *e) w = w->parentWidget(); } wheel->setAccepted(eventAccepted); - } else if (QApplicationPrivate::wheel_widget) { - if (!spontaneous) { - // wheel_widget may forward the wheel event to a delegate widget, - // either directly or indirectly (e.g. QAbstractScrollArea will - // forward to its QScrollBars through viewportEvent()). In that - // case, the event will not be spontaneous but synthesized, so - // we can send it straigth to the receiver. - d->notify_helper(w, wheel); - } else { - const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos()); - QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), - wheel->modifiers(), wheel->phase(), wheel->source()); - we.spont = true; - we.ignore(); - d->notify_helper(QApplicationPrivate::wheel_widget, &we); - wheel->setAccepted(we.isAccepted()); - if (phase == Qt::ScrollEnd) - QApplicationPrivate::wheel_widget = Q_NULLPTR; - } + } else if (!spontaneous) { + // wheel_widget may forward the wheel event to a delegate widget, + // either directly or indirectly (e.g. QAbstractScrollArea will + // forward to its QScrollBars through viewportEvent()). In that + // case, the event will not be spontaneous but synthesized, so + // we can send it straight to the receiver. + d->notify_helper(w, wheel); + } else { + // The phase is either ScrollUpdate or ScrollEnd, and wheel_widget + // is set. Since it accepted the wheel event previously, we continue + // sending those events until we get a ScrollEnd, which signifies + // the end of the natural scrolling sequence. + const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos()); + QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), + wheel->modifiers(), wheel->phase(), wheel->source()); + we.spont = true; + we.ignore(); + d->notify_helper(QApplicationPrivate::wheel_widget, &we); + wheel->setAccepted(we.isAccepted()); + if (phase == Qt::ScrollEnd) + QApplicationPrivate::wheel_widget = Q_NULLPTR; } } break; diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 832d37a329..4b3cf773dc 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -202,7 +202,7 @@ public: static QWidget *active_window; #ifndef QT_NO_WHEELEVENT static int wheel_scroll_lines; - static QWidget *wheel_widget; + static QPointer wheel_widget; #endif static int enabledAnimations; // Combination of QPlatformTheme::UiEffect -- cgit v1.2.3 From f64737527559e22783b57d30ce8bab9ee517974d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 9 Mar 2016 16:27:47 +0100 Subject: Fix signed integer overflows in tst_QAtomicInteger Signed integer overflows and underflows are undefined behavior. A test that invokes UB tests nothing, because the standard permits any outcome. Fix by guarding the respective operations so they are not executed if they would overflow or underflow. Change-Id: I40354ee88f40e4b47b70eac7790dc3a79ac70a57 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../thread/qatomicinteger/tst_qatomicinteger.cpp | 88 ++++++++++++++++++++-- 1 file changed, 80 insertions(+), 8 deletions(-) diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index d3c85c54a7..ff41ccf26b 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -362,28 +362,46 @@ void tst_QAtomicIntegerXX::loadAcquireStoreRelease() void tst_QAtomicIntegerXX::refDeref() { QFETCH(LargeInt, value); - T nextValue = T(value + 1); - T prevValue = T(value - 1); + const bool needToPreventOverflow = TypeIsSigned && value == std::numeric_limits::max(); + const bool needToPreventUnderflow = TypeIsSigned && value == std::numeric_limits::min(); + T nextValue = T(value); + if (!needToPreventOverflow) + ++nextValue; + T prevValue = T(value); + if (!needToPreventUnderflow) + --prevValue; QAtomicInteger atomic(value); + if (!needToPreventOverflow) { QCOMPARE(atomic.ref(), (nextValue != 0)); QCOMPARE(atomic.load(), nextValue); QCOMPARE(atomic.deref(), (value != 0)); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.deref(), (prevValue != 0)); QCOMPARE(atomic.load(), prevValue); QCOMPARE(atomic.ref(), (value != 0)); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(++atomic, nextValue); QCOMPARE(--atomic, T(value)); + } + if (!needToPreventUnderflow) { QCOMPARE(--atomic, prevValue); QCOMPARE(++atomic, T(value)); + } + if (!needToPreventOverflow) { QCOMPARE(atomic++, T(value)); QCOMPARE(atomic--, nextValue); + } + if (!needToPreventUnderflow) { QCOMPARE(atomic--, T(value)); QCOMPARE(atomic++, prevValue); + } QCOMPARE(atomic.load(), T(value)); } @@ -486,53 +504,80 @@ void tst_QAtomicIntegerXX::fetchAndAdd() QFETCH(LargeInt, value); QAtomicInteger atomic(value); - // note: this test has undefined behavior for signed max and min T parcel1 = 42; T parcel2 = T(0-parcel1); - T newValue1 = T(value) + parcel1; - T newValue2 = T(value) + parcel2; + const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits::max() + parcel2; + const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits::min() + parcel1; + + T newValue1 = T(value); + if (!needToPreventOverflow) + newValue1 += parcel1; + T newValue2 = T(value); + if (!needToPreventUnderflow) + newValue2 += parcel2; + + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddAcquire(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndAddAcquire(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddAcquire(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndAddAcquire(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddRelease(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndAddRelease(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddRelease(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndAddRelease(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddOrdered(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndAddOrdered(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddOrdered(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndAddOrdered(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); // operator+= + if (!needToPreventOverflow) { QCOMPARE(atomic += parcel1, newValue1); QCOMPARE(atomic += parcel2, T(value)); + } + if (!needToPreventUnderflow) { QCOMPARE(atomic += parcel2, newValue2); QCOMPARE(atomic += parcel1, T(value)); + } } void tst_QAtomicIntegerXX::fetchAndSub() @@ -540,53 +585,80 @@ void tst_QAtomicIntegerXX::fetchAndSub() QFETCH(LargeInt, value); QAtomicInteger atomic(value); - // note: this test has undefined behavior for signed max and min T parcel1 = 42; T parcel2 = T(0-parcel1); - T newValue1 = T(value) - parcel1; - T newValue2 = T(value) - parcel2; + const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits::max() - parcel1; + const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits::min() - parcel2; + + T newValue1 = T(value); + if (!needToPreventUnderflow) + newValue1 -= parcel1; + T newValue2 = T(value); + if (!needToPreventOverflow) + newValue2 -= parcel2; + + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubAcquire(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndSubAcquire(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubAcquire(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndSubAcquire(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubRelease(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndSubRelease(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubRelease(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndSubRelease(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubOrdered(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndSubOrdered(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubOrdered(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndSubOrdered(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); // operator-= + if (!needToPreventUnderflow) { QCOMPARE(atomic -= parcel1, newValue1); QCOMPARE(atomic -= parcel2, T(value)); + } + if (!needToPreventOverflow) { QCOMPARE(atomic -= parcel2, newValue2); QCOMPARE(atomic -= parcel1, T(value)); + } } void tst_QAtomicIntegerXX::addSub() -- cgit v1.2.3 From 807240a8831f1b75e945471c129597c4b79a95ea Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 10 Mar 2016 09:49:22 +0100 Subject: QJsonParser: fix UB (misaligned store) in Parser::parseNumber() Found by UBSan: qjsonparser.cpp:741:30: runtime error: store to misaligned address 0x0000019b1e94 for type 'quint64', which requires 8 byte alignment Fix by using the qToLittleEndian() overload that can store to misaligned memory. Change-Id: Ib84bd30b13c68f7fdb8870c9fbbfac15cff0112d Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/json/qjsonparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 0d62687388..b8a628fdcc 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -732,7 +732,7 @@ bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset) } int pos = reserveSpace(sizeof(double)); - *(quint64 *)(data + pos) = qToLittleEndian(ui); + qToLittleEndian(ui, reinterpret_cast(data + pos)); if (current - baseOffset >= Value::MaxSize) { lastError = QJsonParseError::DocumentTooLarge; return false; -- cgit v1.2.3 From 62e0a98282081911616a8c005464d483a3a480d2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Dec 2015 17:15:15 +0100 Subject: Fix debug operators for QPageSize/QPageLayout. Remove placeholder formatting and add noquote. Change-Id: I4a89f88778caf007ce42bbf57edfb514fe76bcdb Reviewed-by: Kai Koehne --- src/gui/painting/qpagelayout.cpp | 33 +++++++++++++++------------------ src/gui/painting/qpagesize.cpp | 14 +++++++------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index f443bbd5ac..15dfa6f8c1 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -943,40 +943,37 @@ QRect QPageLayout::paintRectPixels(int resolution) const QDebug operator<<(QDebug dbg, const QPageLayout &layout) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageLayout("; if (layout.isValid()) { - QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)"); - QString units; + const QMarginsF margins = layout.margins(); + dbg << '"' << layout.pageSize().name() << "\", " + << (layout.orientation() == QPageLayout::Portrait ? "Portrait" : "Landscape") + << ", l:" << margins.left() << " r:" << margins.right() << " t:" + << margins.top() << " b:" << margins.bottom() << ' '; switch (layout.units()) { case QPageLayout::Millimeter: - units = QStringLiteral("mm"); + dbg << "mm"; break; case QPageLayout::Point: - units = QStringLiteral("pt"); + dbg << "pt"; break; case QPageLayout::Inch: - units = QStringLiteral("in"); + dbg << "in"; break; case QPageLayout::Pica: - units = QStringLiteral("pc"); + dbg << "pc"; break; case QPageLayout::Didot: - units = QStringLiteral("DD"); + dbg << "DD"; break; case QPageLayout::Cicero: - units = QStringLiteral("CC"); + dbg << "CC"; break; } - output = output.arg(layout.pageSize().name()) - .arg(layout.orientation() == QPageLayout::Portrait ? QStringLiteral("Portrait") : QStringLiteral("Landscape")) - .arg(layout.margins().left()) - .arg(layout.margins().right()) - .arg(layout.margins().top()) - .arg(layout.margins().bottom()) - .arg(units); - dbg.nospace() << output; - } else { - dbg.nospace() << "QPageLayout()"; } + dbg << ')'; return dbg; } #endif diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index c0aae603b7..17f6b7bb64 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -1855,17 +1855,17 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution) QDebug operator<<(QDebug dbg, const QPageSize &pageSize) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageSize("; if (pageSize.isValid()) { - QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)"); - output = output.arg(pageSize.name()) - .arg(pageSize.key()) - .arg(pageSize.sizePoints().width()) - .arg(pageSize.sizePoints().height()) - .arg(pageSize.id()); - dbg.nospace() << output; + dbg << '"' << pageSize.name() << "\", key=\"" << pageSize.key() + << "\", " << pageSize.sizePoints().width() << 'x' + << pageSize.sizePoints().height() << "pt, id=" << pageSize.id(); } else { dbg.nospace() << "QPageSize()"; } + dbg << ')'; return dbg; } #endif -- cgit v1.2.3 From fb196e88074a8547ef93030ee385227664965106 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 10 Mar 2016 09:53:36 +0100 Subject: QMimeMagicRule: fix UB (misaligned load) in matchNumber() Found by UBSan: qmimemagicrule.cpp:166:53: runtime error: load of misaligned address 0x00000124bcb9 for type 'const short unsigned int', which requires 2 byte alignment qmimemagicrule.cpp:166:53: runtime error: load of misaligned address 0x00000124bcb9 for type 'const unsigned int', which requires 4 byte alignment Fix by using new qUnalignedLoad() instead of a load through a type-punned pointer and misaligned pointer. Change-Id: I6b876f1ce7e01369fbb25a51263d1ad04be07d52 Reviewed-by: David Faure --- src/corelib/mimetypes/qmimemagicrule.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 6a3a429179..44834420fe 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -42,6 +42,7 @@ #include #include #include +#include // for qUnalignedLoad QT_BEGIN_NAMESPACE @@ -176,7 +177,7 @@ static bool matchNumber(const QMimeMagicRulePrivate *d, const QByteArray &data) const char *p = data.constData() + d->startPos; const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), d->endPos + 1); for ( ; p <= e; ++p) { - if ((*reinterpret_cast(p) & mask) == (value & mask)) + if ((qUnalignedLoad(p) & mask) == (value & mask)) return true; } -- cgit v1.2.3 From 437f5662d37ec2334e16b51e8d4543025e36d929 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 9 Mar 2016 18:27:50 +0100 Subject: Allow overriding Android NDK host on Windows The -android-ndk-host argument to configure existed in the shell script, but not in the Windows version. When using a 64-bit NDK but a 32-bit host compiler (which is what we bundle with our SDK), we would not detect the correct NDK host, making it impossible to build Qt with this combo. [ChangeLog][Android] Added -android-ndk-host configure option on Windows. Change-Id: Ie6a92b66e6875ed53f46fe41ecced70c3ec67585 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 298e27244e..f63892b6cc 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1370,6 +1370,14 @@ void Configure::parseCmdLine() dictionary[ "ANDROID_PLATFORM" ] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-android-ndk-host") { + ++i; + if (i == argCount) + break; + + dictionary[ "ANDROID_HOST" ] = configCmdLine.at(i); + } + else if (configCmdLine.at(i) == "-android-arch") { ++i; if (i == argCount) @@ -3464,7 +3472,9 @@ void Configure::generateQDevicePri() deviceStream << "android_install {" << endl; deviceStream << " DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl; deviceStream << " DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl; - if (QSysInfo::WordSize == 64) + if (dictionary.contains("ANDROID_HOST")) + deviceStream << " DEFAULT_ANDROID_NDK_HOST = " << dictionary["ANDROID_HOST"] << endl; + else if (QSysInfo::WordSize == 64) deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl; else deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows" << endl; -- cgit v1.2.3 From 5655d061b2aa47f7c3268bf0b59c47c9c624cb58 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 10 Mar 2016 13:07:58 +0100 Subject: Xft antialias settings must not override requested NoAntialias If Xft enabled font antialiasing, QFont::NoAntialias would have no effect as it would be overridden. Change-Id: I4dae264bc6674ae81f181cc9ce85851174d42544 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index a5fe88871d..5305b8b970 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -861,7 +861,7 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")); - if (useXftConf) { + if (useXftConf && !forcedAntialiasSetting) { void *antialiasResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled", QGuiApplication::primaryScreen()); -- cgit v1.2.3 From f3487308e4534183f42f5cb9de86a9ae5f201be8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Mar 2016 12:23:05 +0100 Subject: fix file separators in target.targets INSTALLS Task-number: QTBUG-51775 Change-Id: I8d9442bfd5084f1670b79dfdd422638bc62780aa Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 5c6db3364e..d2483459d8 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -569,7 +569,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1))); if(!ret.isEmpty()) ret += "\n\t"; - ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + dst; + ret += "-$(INSTALL_FILE) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst; if(!uninst.isEmpty()) uninst.append("\n\t"); uninst.append("-$(DEL_FILE) " + dst); -- cgit v1.2.3 From 1fd0d57ce3da83631423d17faadf97133f5c7835 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 7 Mar 2016 15:29:44 +0100 Subject: qmake: fix UB in QMakeParser::putHashStr() Found by UBSan: qmake/library/qmakeparser.cpp:278:33: runtime error: null pointer passed as argument 2, which is declared to never be null Guard the call. Change-Id: I99341ab439a511f366dae9344ddcc8727c33b9b6 Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakeparser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 95a072392e..8170eee76c 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -280,7 +280,8 @@ void QMakeParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len) *tokPtr++ = (ushort)hash; *tokPtr++ = (ushort)(hash >> 16); *tokPtr++ = (ushort)len; - memcpy(tokPtr, buf, len * 2); + if (len) // buf may be nullptr; don't pass that to memcpy (-> undefined behavior) + memcpy(tokPtr, buf, len * 2); pTokPtr = tokPtr + len; } -- cgit v1.2.3 From 45dc347a95fd674cefcf5d1ac63b01557fcb2fef Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 10 Mar 2016 09:44:03 +0100 Subject: tst_QStaticText: Output verbose message for test failures. Factor out function to check on the pixel color that outputs a verbose message on failure. Change-Id: I2331fe45f35327d1ff8ae547a58d93a2e6fe9184 Reviewed-by: Simon Hausmann --- .../auto/gui/text/qstatictext/tst_qstatictext.cpp | 55 +++++++++++++--------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index b8134291af..4b322efa7c 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -610,6 +610,29 @@ void tst_QStaticText::plainTextVsRichText() QCOMPARE(imagePlainText, imageRichText); } +static bool checkPixels(const QImage &image, + Qt::GlobalColor expectedColor1, Qt::GlobalColor expectedColor2, + QByteArray *errorMessage) +{ + const QRgb expectedRgb1 = QColor(expectedColor1).rgba(); + const QRgb expectedRgb2 = QColor(expectedColor2).rgba(); + + for (int x = 0, w = image.width(); x < w; ++x) { + for (int y = 0, h = image.height(); y < h; ++y) { + const QRgb pixel = image.pixel(x, y); + if (pixel != expectedRgb1 && pixel != expectedRgb2) { + QString message; + QDebug(&message) << "Color mismatch in image" << image + << "at" << x << ',' << y << ':' << showbase << hex << pixel + << "(expected: " << expectedRgb1 << ',' << expectedRgb2 << ')'; + *errorMessage = message.toLocal8Bit(); + return false; + } + } + } + return true; +} + void tst_QStaticText::setPenPlainText_data() { QTest::addColumn("format"); @@ -640,13 +663,9 @@ void tst_QStaticText::setPenPlainText() p.drawStaticText(0, 0, staticText); } - for (int x=0; x