From a72513cab7cdfac638ef572838277aa062f1d296 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 20 Jul 2016 15:47:16 +0200 Subject: [PATCH 01/30] Windows QPA: Hardcode a limit for the default point size Windows uses deprecated API to obtain the default font which has been observed to return bogus sizes in multi monitor setups. Apply a limit in this case and add fixme comment for Qt 6. Task-number: QTBUG-49374 Task-number: QTBUG-58610 Change-Id: I6e805ec792a3f425961a48ef4c4329c3cdf302b6 Reviewed-by: Alessandro Portale --- .../windows/qwindowsfontdatabase.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index d3e4daa341e..58b700b93fc 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -1621,6 +1621,7 @@ void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont) m_uniqueFontData[uniqueFont].refCount.ref(); } +// ### fixme Qt 6 (QTBUG-58610): See comment at QWindowsFontDatabase::systemDefaultFont() HFONT QWindowsFontDatabase::systemFont() { static const HFONT stock_sysfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); @@ -1961,12 +1962,31 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q QFont QWindowsFontDatabase::systemDefaultFont() { +#if QT_VERSION >= 0x060000 + // Qt 6: Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610) + NONCLIENTMETRICS ncm; + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0); + const QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont); +#else LOGFONT lf; GetObject(QWindowsFontDatabase::systemFont(), sizeof(lf), &lf); QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf); // "MS Shell Dlg 2" is the correct system font >= Win2k if (systemFont.family() == QLatin1String("MS Shell Dlg")) systemFont.setFamily(QStringLiteral("MS Shell Dlg 2")); + // Qt 5 by (Qt 4) legacy uses GetStockObject(DEFAULT_GUI_FONT) to + // obtain the default GUI font (typically "MS Shell Dlg 2, 8pt"). This has been + // long deprecated; the message font of the NONCLIENTMETRICS structure obtained by + // SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see + // QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger. + // In single monitor setups, the point sizes revolve around 8 (depending on UI + // scale factor, but not proportional to it). However, in multi monitor setups, + // where the DPI of the primary monitor are smaller than those of the secondary, + // large bogus values are returned. Limit to 8.25 in that case. + if (GetSystemMetrics(SM_CMONITORS) > 1 && systemFont.pointSizeF() > 8.25) + systemFont.setPointSizeF(8.25); +#endif // Qt 5 qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont; return systemFont; } From 6e18293299606d9d87e4567b712a83fe59c420fc Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 25 Aug 2017 16:39:25 +0200 Subject: [PATCH 02/30] Forward the readChannelFinished from the plain socket to the ssl socket Task-number: QTBUG-62257 Change-Id: I12632b7ffd2012adc99b4784892cbb6f79e065f7 Reviewed-by: Jesus Fernandez --- src/network/ssl/qsslsocket.cpp | 12 ++++++++++ src/network/ssl/qsslsocket.h | 1 + src/network/ssl/qsslsocket_p.h | 1 + .../network/ssl/qsslsocket/tst_qsslsocket.cpp | 23 +++++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 84b8f3a8d95..9d11506fcb4 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2286,6 +2286,9 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode) q->connect(plainSocket, SIGNAL(channelBytesWritten(int, qint64)), q, SLOT(_q_channelBytesWrittenSlot(int, qint64)), Qt::DirectConnection); + q->connect(plainSocket, SIGNAL(readChannelFinished()), + q, SLOT(_q_readChannelFinishedSlot()), + Qt::DirectConnection); #ifndef QT_NO_NETWORKPROXY q->connect(plainSocket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); @@ -2504,6 +2507,15 @@ void QSslSocketPrivate::_q_channelBytesWrittenSlot(int channel, qint64 written) emit q->channelBytesWritten(channel, written); } +/*! + \internal +*/ +void QSslSocketPrivate::_q_readChannelFinishedSlot() +{ + Q_Q(QSslSocket); + emit q->readChannelFinished(); +} + /*! \internal */ diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index 1b29cd46370..39e70bccda4 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -224,6 +224,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_channelReadyReadSlot(int)) Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64)) Q_PRIVATE_SLOT(d_func(), void _q_channelBytesWrittenSlot(int, qint64)) + Q_PRIVATE_SLOT(d_func(), void _q_readChannelFinishedSlot()) Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation()) diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index aec34374220..827f27cff11 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -180,6 +180,7 @@ public: void _q_channelReadyReadSlot(int); void _q_bytesWrittenSlot(qint64); void _q_channelBytesWrittenSlot(int, qint64); + void _q_readChannelFinishedSlot(); void _q_flushWriteBuffer(); void _q_flushReadBuffer(); void _q_resumeImplementation(); diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 8a8522760c8..1545743ee98 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -237,6 +237,7 @@ private slots: void ephemeralServerKey(); void allowedProtocolNegotiation(); void pskServer(); + void forwardReadChannelFinished(); #endif void setEmptyDefaultConfiguration(); // this test should be last @@ -3771,6 +3772,28 @@ void tst_QSslSocket::pskServer() QCOMPARE(disconnectedSpy.count(), 1); } +void tst_QSslSocket::forwardReadChannelFinished() +{ + if (!QSslSocket::supportsSsl()) + QSKIP("Needs SSL"); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + QSKIP("This test doesn't work via a proxy"); + + QSslSocket socket; + QSignalSpy readChannelFinishedSpy(&socket, &QAbstractSocket::readChannelFinished); + connect(&socket, &QSslSocket::encrypted, [&socket]() { + const auto data = QString("GET /ip HTTP/1.0\r\nHost: %1\r\n\r\nAccept: */*\r\n\r\n") + .arg(QtNetworkSettings::serverLocalName()).toUtf8(); + socket.write(data); + }); + connect(&socket, &QSslSocket::readChannelFinished, + &QTestEventLoop::instance(), &QTestEventLoop::exitLoop); + socket.connectToHostEncrypted(QtNetworkSettings::serverLocalName(), 443); + enterLoop(10); + QVERIFY(readChannelFinishedSpy.count()); +} + #endif // QT_NO_OPENSSL #endif // QT_NO_SSL From 541a03155222af509ab703cf6665b19baf25344b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 17 Aug 2017 19:13:07 -0700 Subject: [PATCH 03/30] tst_QMutex: produce less noise with MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since MSVC doesn't have (according to QT_HAS_INCLUDE), the QSKIP in the test was printed for every line in the table. Instead, add the skip in the _data() function. Change-Id: I6e9274c1e7444ad48c81fffd14dbcee5e5a322aa Reviewed-by: Mårten Nordheim Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/thread/qmutex/tst_qmutex.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp index 0962001741f..7fb9a861d77 100644 --- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp @@ -99,6 +99,9 @@ void tst_QMutex::convertToMilliseconds_data() QTest::addColumn("intValue"); QTest::addColumn("expected"); +#if !QT_HAS_INCLUDE() + QSKIP("This test requires "); +#endif auto add = [](TimeUnit unit, double d, long long i, qint64 expected) { const QScopedArrayPointer enumName(QTest::toString(unit)); From f71a99c0ebdf3ad88f66a8e731490f496f25592b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 1 Sep 2017 14:23:14 +0200 Subject: [PATCH 04/30] QModelIndex: use std::less to compare pointers Comparing pointers not belonging to the same array requires using std::less. Change-Id: I2725aa0899f6b9fece73dadd9ee5c10242d50ae1 Reviewed-by: David Faure --- src/corelib/itemmodels/qabstractitemmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 907ba096762..a211d8e8caf 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -79,7 +79,7 @@ public: return r < other.r || (r == other.r && (c < other.c || (c == other.c && (i < other.i - || (i == other.i && m < other.m ))))); + || (i == other.i && std::less()(m, other.m)))))); } private: inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) Q_DECL_NOTHROW From fc37e0369929e265db4fa3b9fa75164d63d66d1e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 1 Sep 2017 12:54:00 +0200 Subject: [PATCH 05/30] PCRE2: remove a source file from the .pro pcre2_printint.c does not need to be compliled as a standalone source file, as it's #included from pcre2_compile.c. Apparently qmake does not detect this in all cases, and sometimes tries to compile pcre2_printint.c, resulting in compile errors. Change-Id: If494e5853b52ff1387bfb24f3847b73edcc837b7 Reviewed-by: Thiago Macieira --- src/3rdparty/pcre2/pcre2.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/3rdparty/pcre2/pcre2.pro b/src/3rdparty/pcre2/pcre2.pro index d3a4e08bc5a..855788ffa4b 100644 --- a/src/3rdparty/pcre2/pcre2.pro +++ b/src/3rdparty/pcre2/pcre2.pro @@ -33,7 +33,6 @@ SOURCES += \ $$PWD/src/pcre2_newline.c \ $$PWD/src/pcre2_ord2utf.c \ $$PWD/src/pcre2_pattern_info.c \ - $$PWD/src/pcre2_printint.c \ $$PWD/src/pcre2_serialize.c \ $$PWD/src/pcre2_string_utils.c \ $$PWD/src/pcre2_study.c \ From b649717784368f04e61f5bc240c052c5c4744a2c Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:05:49 +0200 Subject: [PATCH 06/30] Convert features.stackedwidget to QT_[REQUIRE_]CONFIG Change-Id: I06b7fb9736620dcdfda21fc0a06e13cb02f9a1e7 Reviewed-by: Oswald Buddenhagen --- src/widgets/accessible/qaccessiblewidgetfactory.cpp | 2 +- src/widgets/accessible/qaccessiblewidgets.cpp | 6 ++++-- src/widgets/styles/qwindowsxpstyle.cpp | 2 ++ src/widgets/widgets/qstackedwidget.cpp | 4 ---- src/widgets/widgets/qstackedwidget.h | 7 ++----- src/widgets/widgets/widgets.pri | 7 +++++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 3fbc9714f5a..30ba1ddedfd 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -177,7 +177,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje iface = new QAccessibleDisplay(widget, QAccessible::ToolTip); } else if (classname == QLatin1String("QFrame")) { iface = new QAccessibleWidget(widget, QAccessible::Border); -#ifndef QT_NO_STACKEDWIDGET +#if QT_CONFIG(stackedwidget) } else if (classname == QLatin1String("QStackedWidget")) { iface = new QAccessibleStackedWidget(widget); #endif diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index 4e7ba78620c..0ac7d736f81 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -52,7 +52,9 @@ #endif #include "qdebug.h" #include +#if QT_CONFIG(stackedwidget) #include +#endif #if QT_CONFIG(toolbox) #include #endif @@ -310,7 +312,7 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex) #endif // QT_NO_TEXTEDIT && QT_NO_CURSOR -#ifndef QT_NO_STACKEDWIDGET +#if QT_CONFIG(stackedwidget) // ======================= QAccessibleStackedWidget ====================== QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget) : QAccessibleWidget(widget, QAccessible::LayeredPane) @@ -356,7 +358,7 @@ QStackedWidget *QAccessibleStackedWidget::stackedWidget() const { return static_cast(object()); } -#endif // QT_NO_STACKEDWIDGET +#endif // QT_CONFIG(stackedwidget) #if QT_CONFIG(toolbox) // ======================= QAccessibleToolBox ====================== diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 5d7699321ed..fc9b12767d7 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -74,7 +74,9 @@ #if QT_CONFIG(listview) #include #endif +#if QT_CONFIG(stackedwidget) #include +#endif #if QT_CONFIG(pushbutton) #include #endif diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp index 38ce182fbf7..9d92855a403 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -39,8 +39,6 @@ #include "qstackedwidget.h" -#ifndef QT_NO_STACKEDWIDGET - #include #include #include @@ -294,5 +292,3 @@ bool QStackedWidget::event(QEvent *e) QT_END_NAMESPACE #include "moc_qstackedwidget.cpp" - -#endif // QT_NO_STACKEDWIDGET diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h index 36088ae033d..29df145b709 100644 --- a/src/widgets/widgets/qstackedwidget.h +++ b/src/widgets/widgets/qstackedwidget.h @@ -43,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(stackedwidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_STACKEDWIDGET - class QStackedWidgetPrivate; class Q_WIDGETS_EXPORT QStackedWidget : public QFrame @@ -87,8 +86,6 @@ private: Q_DECLARE_PRIVATE(QStackedWidget) }; -#endif // QT_NO_STACKEDWIDGET - QT_END_NAMESPACE #endif // QSTACKEDWIDGET_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index c204dad08de..a3f7061c4f6 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -25,7 +25,6 @@ HEADERS += \ widgets/qsizegrip.h \ widgets/qslider.h \ widgets/qspinbox.h \ - widgets/qstackedwidget.h \ widgets/qtextedit.h \ widgets/qtextedit_p.h \ widgets/qtoolbar.h \ @@ -60,7 +59,6 @@ SOURCES += \ widgets/qsizegrip.cpp \ widgets/qslider.cpp \ widgets/qspinbox.cpp \ - widgets/qstackedwidget.cpp \ widgets/qtextedit.cpp \ widgets/qtoolbar.cpp \ widgets/qtoolbarlayout.cpp \ @@ -232,6 +230,11 @@ qtConfig(splitter) { SOURCES += widgets/qsplitter.cpp } +qtConfig(stackedwidget) { + HEADERS += widgets/qstackedwidget.h + SOURCES += widgets/qstackedwidget.cpp +} + qtConfig(statusbar) { HEADERS += widgets/qstatusbar.h SOURCES += widgets/qstatusbar.cpp From 314a591461c58addd2805e0b4dc2cdb4308d5d31 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:06:42 +0200 Subject: [PATCH 07/30] Convert features.menubar to QT_[REQUIRE_]CONFIG Change-Id: Idbd4978852fa280dd18a5684469d499da3892126 Reviewed-by: Oswald Buddenhagen --- src/widgets/accessible/qaccessiblemenu.cpp | 12 +++--- src/widgets/accessible/qaccessiblemenu_p.h | 4 +- .../accessible/qaccessiblewidgetfactory.cpp | 2 +- src/widgets/kernel/qlayout.cpp | 16 ++++---- src/widgets/kernel/qlayoutitem.cpp | 2 + src/widgets/kernel/qshortcut.cpp | 6 ++- src/widgets/styles/qcommonstyle.cpp | 4 +- src/widgets/styles/qmacstyle_mac.mm | 4 +- src/widgets/styles/qmacstyle_mac_p_p.h | 2 + src/widgets/styles/qstylesheetstyle.cpp | 6 ++- src/widgets/styles/qwindowsstyle.cpp | 14 ++++--- src/widgets/styles/qwindowsvistastyle.cpp | 2 +- src/widgets/styles/qwindowsxpstyle.cpp | 2 +- src/widgets/widgets/qmainwindow.cpp | 9 +++-- src/widgets/widgets/qmainwindow.h | 2 +- src/widgets/widgets/qmdiarea.cpp | 1 + src/widgets/widgets/qmdisubwindow.cpp | 39 ++++++++++--------- src/widgets/widgets/qmdisubwindow_p.h | 8 ++-- src/widgets/widgets/qmenu.cpp | 28 ++++++------- src/widgets/widgets/qmenu_mac.mm | 6 ++- src/widgets/widgets/qmenu_p.h | 2 + src/widgets/widgets/qmenubar.cpp | 6 --- src/widgets/widgets/qmenubar.h | 7 +--- src/widgets/widgets/qmenubar_p.h | 5 +-- src/widgets/widgets/qtoolbar.cpp | 2 + src/widgets/widgets/widgets.pri | 11 ++++-- 26 files changed, 114 insertions(+), 88 deletions(-) diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index ae50bbaef04..715bf1c53f9 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -40,7 +40,9 @@ #include "qaccessiblemenu_p.h" #include +#if QT_CONFIG(menubar) #include +#endif #include #include @@ -139,7 +141,7 @@ int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const return -1; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w) : QAccessibleWidget(w, QAccessible::MenuBar) { @@ -173,7 +175,7 @@ int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const return -1; } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action) : m_action(action), m_owner(owner) @@ -253,13 +255,13 @@ QRect QAccessibleMenuItem::rect() const { QRect rect; QWidget *own = owner(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *menuBar = qobject_cast(own)) { rect = menuBar->actionGeometry(m_action); QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0)); rect = rect.translated(globalPos); } else -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) if (QMenu *menu = qobject_cast(own)) { rect = menu->actionGeometry(m_action); QPoint globalPos = menu->mapToGlobal(QPoint(0,0)); @@ -289,7 +291,7 @@ QAccessible::State QAccessibleMenuItem::state() const if (QMenu *menu = qobject_cast(own)) { if (menu->activeAction() == m_action) s.focused = true; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (QMenuBar *menuBar = qobject_cast(own)) { if (menuBar->activeAction() == m_action) s.focused = true; diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h index 52afeb5a043..35dcd9bad1c 100644 --- a/src/widgets/accessible/qaccessiblemenu_p.h +++ b/src/widgets/accessible/qaccessiblemenu_p.h @@ -82,7 +82,7 @@ protected: QMenu *menu() const; }; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) class QAccessibleMenuBar : public QAccessibleWidget { public: @@ -96,7 +96,7 @@ public: protected: QMenuBar *menuBar() const; }; -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActionInterface diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 30ba1ddedfd..97eaea728cd 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -138,7 +138,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje #endif } else if (classname == QLatin1String("QToolBar")) { iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle()); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (classname == QLatin1String("QMenuBar")) { iface = new QAccessibleMenuBar(widget); #endif diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 129c12885a9..56edd019bbf 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -41,7 +41,9 @@ #include "qapplication.h" #include "qlayoutengine_p.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" +#endif #include "qtoolbar.h" #include "qsizegrip.h" #include "qevent.h" @@ -583,7 +585,7 @@ void QLayoutPrivate::doResize(const QSize &r) const int mbTop = rect.top(); rect.setTop(mbTop + mbh); q->setGeometry(rect); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (menubar) menubar->setGeometry(rect.left(), mbTop, r.width(), mbh); #endif @@ -615,7 +617,7 @@ void QLayout::widgetEvent(QEvent *e) { QChildEvent *c = (QChildEvent *)e; if (c->child()->isWidgetType()) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (c->child() == d->menubar) d->menubar = 0; #endif @@ -664,7 +666,7 @@ int QLayout::totalHeightForWidth(int w) const top += wd->topmargin + wd->bottommargin; } int h = heightForWidth(w - side) + top; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) h += menuBarHeightForWidth(d->menubar, w); #endif return h; @@ -687,7 +689,7 @@ QSize QLayout::totalMinimumSize() const } QSize s = minimumSize(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width() + side); #endif return s + QSize(side, top); @@ -712,7 +714,7 @@ QSize QLayout::totalSizeHint() const QSize s = sizeHint(); if (hasHeightForWidth()) s.setHeight(heightForWidth(s.width() + side)); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width()); #endif return s + QSize(side, top); @@ -735,7 +737,7 @@ QSize QLayout::totalMaximumSize() const } QSize s = maximumSize(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width()); #endif @@ -813,7 +815,7 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) Q_Q(QLayout); int n = q->count(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (menubar && menubar->parentWidget() != mw) { menubar->setParent(mw); } diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 51793bf060b..0bdac43c567 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -41,7 +41,9 @@ #include "qapplication.h" #include "qlayoutengine_p.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" +#endif #include "qtoolbar.h" #include "qevent.h" #include "qstyle.h" diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 891cf563d6c..18376bb1831 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -46,7 +46,9 @@ #include #endif #include +#if QT_CONFIG(menubar) #include +#endif #include #include #include @@ -143,7 +145,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context) static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window) { bool visible = w->isVisible(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *menuBar = qobject_cast(w)) { if (menuBar->isNativeMenuBar()) visible = true; @@ -208,7 +210,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window) { bool visible = w->isVisible(); -#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR) +#if defined(Q_OS_DARWIN) && QT_CONFIG(menubar) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast(w)) visible = true; #endif diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index a8f8c977766..9a11e980324 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1392,7 +1392,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2); break; #endif // QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CE_MenuBarItem: if (const QStyleOptionMenuItem *mbi = qstyleoption_cast(opt)) { uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip @@ -1412,7 +1412,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground)) p->eraseRect(opt->rect); break; -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) #if QT_CONFIG(progressbar) case CE_ProgressBar: if (const QStyleOptionProgressBar *pb diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d9eeb2c83b9..fcda61ef8cb 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -76,7 +76,9 @@ #include #include #include +#if QT_CONFIG(menubar) #include +#endif #include #include #include @@ -677,7 +679,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg #endif else if (qobject_cast(widg)) ct = QStyle::CT_HeaderSection; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) else if (qobject_cast(widg)) ct = QStyle::CT_MenuBar; #endif diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index b9ba1d828eb..142966de409 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -80,7 +80,9 @@ #endif #include #include +#if QT_CONFIG(menubar) #include +#endif #include #include #include diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index f704745c8ff..e781cb2f149 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -46,7 +46,9 @@ #include #include #include +#if QT_CONFIG(menubar) #include +#endif #include #include #include @@ -1660,7 +1662,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w) return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w); #endif -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (qobject_cast(w)) return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w); #endif @@ -2829,7 +2831,7 @@ void QStyleSheetStyle::polish(QWidget *w) #ifndef QT_NO_MDIAREA || qobject_cast(w) #endif -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) || qobject_cast(w) #endif #if QT_CONFIG(dialog) diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 818c3ea07ed..2cdfebae0a4 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -47,8 +47,10 @@ #include "qdrawutil.h" // for now #include "qevent.h" #include "qmenu.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" #include +#endif #include "qpaintengine.h" #include "qpainter.h" #if QT_CONFIG(rubberband) @@ -166,7 +168,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) // Update state and repaint the menu bars. d->alt_down = false; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QList l = widget->findChildren(); for (int i = 0; i < l.size(); ++i) l.at(i)->update(); @@ -574,7 +576,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid // Do nothing if we always paint underlines Q_D(const QWindowsStyle); if (!ret && widget && d) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) const QMenuBar *menuBar = qobject_cast(widget); if (!menuBar && qobject_cast(widget)) { QWidget *w = QApplication::activeWindow(); @@ -587,7 +589,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid ret = 1; // Otherwise draw underlines if the toplevel widget has seen an alt-press } else -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) if (d->hasSeenAlt(widget)) { ret = 1; } @@ -1260,7 +1262,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } break; #endif // QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CE_MenuBarItem: if (const QStyleOptionMenuItem *mbi = qstyleoption_cast(opt)) { bool active = mbi->state & State_Selected; @@ -1284,7 +1286,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai QCommonStyle::drawControl(ce, &newMbi, p, widget); } break; -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) #if QT_CONFIG(tabbar) case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast(opt)) { @@ -2392,7 +2394,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } break; #endif // QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CT_MenuBarItem: if (!sz.isEmpty()) sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2); diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 8ab4a61f5f9..91fc36959b5 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1871,7 +1871,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption sz.setHeight(minimumHeight); } return sz; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CT_MenuBarItem: if (!sz.isEmpty()) sz += QSize(windowsItemHMargin * 5 + 1, 5); diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index fc9b12767d7..8b363b830a2 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -3661,7 +3661,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt case CT_Menu: sz += QSize(1, 0); break; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) case CT_MenuBarItem: if (!sz.isEmpty()) sz += QSize(windowsItemHMargin * 5 + 1, 6); diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index c76d3cb4457..9337595ead4 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -50,7 +50,10 @@ #include "qtoolbar.h" #include +#include +#if QT_CONFIG(menubar) #include +#endif #if QT_CONFIG(statusbar) #include #endif @@ -520,7 +523,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle) emit toolButtonStyleChanged(d->toolButtonStyle); } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /*! Returns the menu bar for the main window. This function creates and returns an empty menu bar if the menu bar does not exist. @@ -607,7 +610,7 @@ void QMainWindow::setMenuWidget(QWidget *menuBar) } d->layout->setMenuBar(menuBar); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) #if QT_CONFIG(statusbar) /*! @@ -1663,7 +1666,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event) // children and for the menu bar as well QWidget *child = childAt(event->pos()); while (child && child != this) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(child)) { if (mb->parentWidget() != this) return; diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h index e0592d2c3ff..ff489efa2d6 100644 --- a/src/widgets/widgets/qmainwindow.h +++ b/src/widgets/widgets/qmainwindow.h @@ -123,7 +123,7 @@ public: bool isSeparator(const QPoint &pos) const; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QMenuBar *menuBar() const; void setMenuBar(QMenuBar *menubar); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 513011f0ad2..36b38285767 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -173,6 +173,7 @@ #include #include #include +#include #include #include diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 663572802cd..0abc4967e17 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -165,6 +165,7 @@ #endif #include #include +#include QT_BEGIN_NAMESPACE @@ -703,7 +704,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) : QObject(mdiChild), previousLeft(0), previousRight(0), -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) m_menuBar(0), #endif mdiChild(mdiChild) @@ -725,7 +726,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) ControlContainer::~ControlContainer() { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) removeButtonsFromMenuBar(); #endif delete m_menuLabel; @@ -734,7 +735,7 @@ ControlContainer::~ControlContainer() m_controllerWidget = 0; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /* \internal */ @@ -846,7 +847,7 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar) mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) void ControlContainer::updateWindowIcon(const QIcon &windowIcon) { @@ -1268,7 +1269,7 @@ void QMdiSubWindowPrivate::setNormalMode() isMaximizeMode = false; ensureWindowState(Qt::WindowNoState); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) removeButtonsFromMenuBar(); #endif @@ -1375,7 +1376,7 @@ void QMdiSubWindowPrivate::setMaximizeMode() updateGeometryConstraints(); if (wasVisible) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mBar = menuBar()) showButtonsInMenuBar(mBar); else @@ -1438,7 +1439,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus) Qt::WindowStates oldWindowState = q->windowState(); ensureWindowState(Qt::WindowActive); emit q->aboutToActivate(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mBar = menuBar()) showButtonsInMenuBar(mBar); #endif @@ -1783,7 +1784,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const #else if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) return true; -#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW) +#if !QT_CONFIG(menubar) || defined(QT_NO_MAINWINDOW) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else @@ -1797,7 +1798,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const #endif } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /*! \internal @@ -1868,7 +1869,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar() originalTitle.clear(); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) { @@ -2295,7 +2296,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) QMdiSubWindow::~QMdiSubWindow() { Q_D(QMdiSubWindow); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif d->setActive(false); @@ -2628,7 +2629,7 @@ void QMdiSubWindow::showShaded() d->ensureWindowState(Qt::WindowMinimized); } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif @@ -2768,7 +2769,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event) if (object == d->baseWidget) { d->updateWindowTitle(true); d->lastChildWindowTitle = d->baseWidget->windowTitle(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { d->originalTitle.clear(); @@ -2831,7 +2832,7 @@ bool QMdiSubWindow::event(QEvent *event) break; case QEvent::ParentChange: { bool wasResized = testAttribute(Qt::WA_Resized); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif d->currentOperation = QMdiSubWindowPrivate::None; @@ -2888,12 +2889,12 @@ bool QMdiSubWindow::event(QEvent *event) case QEvent::ModifiedChange: if (!windowTitle().contains(QLatin1String("[*]"))) break; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { window()->setWindowModified(isWindowModified()); } -#endif // QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) d->updateInternalWindowTitle(); break; case QEvent::LayoutDirectionChange: @@ -2956,7 +2957,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) d->updateDirtyRegions(); // Show buttons in the menu bar if they're already not there. // We want to do this when QMdiSubWindow becomes visible after being hidden. -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (d->controlContainer) { if (QMenuBar *menuBar = d->menuBar()) { if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget()) @@ -2972,7 +2973,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) */ void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d_func()->removeButtonsFromMenuBar(); #endif } @@ -3046,7 +3047,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent) closeEvent->ignore(); return; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) d->removeButtonsFromMenuBar(); #endif d->setActive(false); diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h index 71fcc38378c..51652a78fff 100644 --- a/src/widgets/widgets/qmdisubwindow_p.h +++ b/src/widgets/widgets/qmdisubwindow_p.h @@ -58,7 +58,9 @@ #include #include +#if QT_CONFIG(menubar) #include +#endif #include #include #include @@ -96,7 +98,7 @@ public: ControlContainer(QMdiSubWindow *mdiChild); ~ControlContainer(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) void showButtonsInMenuBar(QMenuBar *menuBar); void removeButtonsFromMenuBar(QMenuBar *menuBar = 0); QMenuBar *menuBar() const { return m_menuBar; } @@ -108,7 +110,7 @@ public: private: QPointer previousLeft; QPointer previousRight; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QPointer m_menuBar; #endif QPointer m_controllerWidget; @@ -252,7 +254,7 @@ public: int titleBarHeight(const QStyleOptionTitleBar &options) const; void sizeParameters(int *margin, int *minWidth) const; bool drawTitleBarWhenMaximized() const; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) QMenuBar *menuBar() const; void showButtonsInMenuBar(QMenuBar *menuBar); void removeButtonsFromMenuBar(); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 9b2856a728e..93ceca1095a 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -64,7 +64,9 @@ #endif #include "qmenu_p.h" +#if QT_CONFIG(menubar) #include "qmenubar_p.h" +#endif #include "qwidgetaction.h" #if QT_CONFIG(toolbutton) #include "qtoolbutton.h" @@ -491,7 +493,7 @@ void QMenuPrivate::hideUpToMenuBar() QWidget *caused = causedPopup.widget; hideMenu(q); //hide after getting causedPopup while(caused) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(caused)) { mb->d_func()->setCurrentAction(0); mb->d_func()->setKeyboardMode(false); @@ -1273,7 +1275,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) bool passOnEvent = false; QWidget *next_widget = 0; QPoint cpos = caused->mapFromGlobal(e->globalPos()); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(caused)) { passOnEvent = mb->rect().contains(cpos); } else @@ -1315,7 +1317,7 @@ void QMenuPrivate::activateCausedStack(const QVector > &caused } else if (action_e == QAction::Hover) { emit qmenu->hovered(action); } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) } else if (QMenuBar *qmenubar = qobject_cast(widget)) { if (action_e == QAction::Trigger) { emit qmenubar->triggered(action); @@ -1410,7 +1412,7 @@ void QMenuPrivate::_q_actionTriggered() QVector< QPointer > list; for(QWidget *widget = q->parentWidget(); widget; ) { if (qobject_cast(widget) -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) || qobject_cast(widget) #endif ) { @@ -2310,7 +2312,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) d->doChildEffects = true; d->updateLayoutDirection(); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) // if this menu is part of a chain attached to a QMenuBar, set the // _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast(d->topCausedWidget()) != 0); @@ -2406,11 +2408,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (snapToMouse) // position flowing left from the mouse pos.setX(mouse.x() - size.width()); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) // if the menu is in a menubar or is a submenu, it should be right-aligned if (qobject_cast(d->causedPopup.widget) || qobject_cast(d->causedPopup.widget)) pos.rx() -= size.width(); -#endif //QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) if (pos.x() < screen.left() + desktopFrame) pos.setX(qMax(p.x(), screen.left() + desktopFrame)); @@ -2486,7 +2488,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) hGuess = QEffects::LeftScroll; } -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) || (qobject_cast(d->causedPopup.widget) && pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y())) @@ -2494,7 +2496,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) #endif if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) { bool doChildEffects = true; -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) { doChildEffects = mb->d_func()->doChildEffects; mb->d_func()->doChildEffects = false; @@ -2656,7 +2658,7 @@ void QMenu::hideEvent(QHideEvent *) QAccessibleEvent event(this, QAccessible::PopupMenuEnd); QAccessible::updateAccessibility(&event); #endif -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) mb->d_func()->setCurrentAction(0); #endif @@ -3204,7 +3206,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) { d->hideMenu(this); -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(QApplication::focusWidget())) { mb->d_func()->setKeyboardMode(false); } @@ -3266,7 +3268,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) { QPointer caused = d->causedPopup.widget; d->hideMenu(this); // hide after getting causedPopup -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(caused)) { mb->d_func()->setCurrentAction(d->menuAction); mb->d_func()->setKeyboardMode(true); @@ -3343,7 +3345,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) } } if (!key_consumed) { -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) if (QMenuBar *mb = qobject_cast(d->topCausedWidget())) { QAction *oldAct = mb->d_func()->currentAction; QApplication::sendEvent(mb, e); diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index f9f3ad08dce..65b7030e20e 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -41,8 +41,10 @@ #import #include "qmenu.h" +#if QT_CONFIG(menubar) #include "qmenubar.h" #include "qmenubar_p.h" +#endif #include "qmacnativewidget_mac.h" #include @@ -139,7 +141,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* #endif //QT_NO_MENU -#ifndef QT_NO_MENUBAR +#if QT_CONFIG(menubar) /*! \since 5.2 @@ -159,7 +161,7 @@ NSMenu *QMenuBar::toNSMenu() } return nil; } -#endif //QT_NO_MENUBAR +#endif // QT_CONFIG(menubar) QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 40cbb3b8917..65975da984f 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -52,7 +52,9 @@ // #include +#if QT_CONFIG(menubar) #include "QtWidgets/qmenubar.h" +#endif #include "QtWidgets/qstyleoption.h" #include "QtCore/qdatetime.h" #include "QtCore/qmap.h" diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index fd48058ec30..a78195d2aaa 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -61,9 +61,6 @@ #include "private/qguiapplication_p.h" #include "qpa/qplatformintegration.h" -#ifndef QT_NO_MENUBAR - - #include "qmenu_p.h" #include "qmenubar_p.h" #include "qdebug.h" @@ -1874,9 +1871,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar() // for private slots - QT_END_NAMESPACE #include - -#endif // QT_NO_MENUBAR diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index 7ad205b77a6..be70f4ea482 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -43,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(menubar); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_MENUBAR - class QMenuBarPrivate; class QStyleOptionMenuItem; class QWindowsStyle; @@ -140,8 +139,6 @@ private: friend class QWindowsStyle; }; -#endif // QT_NO_MENUBAR - QT_END_NAMESPACE #endif // QMENUBAR_H diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index f5409b97622..01d8793a3a8 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -56,9 +56,10 @@ #include // Mac needs what in this file! #include +QT_REQUIRE_CONFIG(menubar); + QT_BEGIN_NAMESPACE -#ifndef QT_NO_MENUBAR class QMenuBarExtension; class QMenuBarPrivate : public QWidgetPrivate { @@ -136,8 +137,6 @@ public: inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); } }; -#endif // QT_NO_MENUBAR - QT_END_NAMESPACE #endif // QMENUBAR_P_H diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index b5c2179bcc8..663e8214c0c 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -49,7 +49,9 @@ #include #include #include +#if QT_CONFIG(menubar) #include +#endif #if QT_CONFIG(rubberband) #include #endif diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index a3f7061c4f6..48d3dd96d55 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -19,8 +19,6 @@ HEADERS += \ widgets/qmdisubwindow_p.h \ widgets/qmenu.h \ widgets/qmenu_p.h \ - widgets/qmenubar.h \ - widgets/qmenubar_p.h \ widgets/qscrollarea_p.h \ widgets/qsizegrip.h \ widgets/qslider.h \ @@ -55,7 +53,6 @@ SOURCES += \ widgets/qmdiarea.cpp \ widgets/qmdisubwindow.cpp \ widgets/qmenu.cpp \ - widgets/qmenubar.cpp \ widgets/qsizegrip.cpp \ widgets/qslider.cpp \ widgets/qspinbox.cpp \ @@ -171,6 +168,14 @@ qtConfig(lcdnumber) { widgets/qlcdnumber.cpp } +qtConfig(menubar) { + HEADERS += \ + widgets/qmenubar.h \ + widgets/qmenubar_p.h + + SOURCES += widgets/qmenubar.cpp +} + qtConfig(progressbar) { HEADERS += widgets/qprogressbar.h SOURCES += widgets/qprogressbar.cpp From ced0f54ec3c79ff4d3e6d8048ce7330d1e19f971 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 26 Aug 2017 22:54:33 +0300 Subject: [PATCH 08/30] Fix resolution of relative links on Windows [ChangeLog][QtCore][QFileInfo] Relative symbolic links on Windows are now resolved to their absolute path by symLinkTarget(). Task-number: QTBUG-62802 Change-Id: I5826517130bd389aef994bf3f4b6d99b2a91b409 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- src/corelib/io/qfilesystemengine_win.cpp | 13 +++++++++---- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 0542d9e16c5..79407afefc5 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -473,12 +473,17 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, if (data.missingFlags(QFileSystemMetaData::LinkType)) QFileSystemEngine::fillMetaData(link, data, QFileSystemMetaData::LinkType); - QString ret; + QString target; if (data.isLnkFile()) - ret = readLink(link); + target = readLink(link); else if (data.isLink()) - ret = readSymLink(link); - return QFileSystemEntry(ret); + target = readSymLink(link); + QFileSystemEntry ret(target); + if (!target.isEmpty() && ret.isRelative()) { + target.prepend(absoluteName(link).path() + QLatin1Char('/')); + ret = QFileSystemEntry(QDir::cleanPath(target)); + } + return ret; } //static diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 17f41cba2bb..f35dab2cad1 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1509,21 +1509,27 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() QVERIFY2(file.exists(), msgDoesNotExist(file.fileName()).constData()); QTest::newRow("absolute dir symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath(); - QTest::newRow("relative dir symlink") << relSymlink << true << QDir::fromNativeSeparators(relTarget) << target.canonicalPath(); + QTest::newRow("relative dir symlink") << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath(); QTest::newRow("file in symlink dir") << fileInSymlink << false << "" << target.canonicalPath().append("/file"); } { //File symlinks + pwd.mkdir("relative"); + QDir relativeDir("relative"); QFileInfo target(m_sourceFile); QString absTarget = QDir::toNativeSeparators(target.absoluteFilePath()); QString absSymlink = QDir::toNativeSeparators(pwd.absolutePath()).append("\\abs_symlink.cpp"); QString relTarget = QDir::toNativeSeparators(pwd.relativeFilePath(target.absoluteFilePath())); QString relSymlink = "rel_symlink.cpp"; + QString relToRelTarget = QDir::toNativeSeparators(relativeDir.relativeFilePath(target.absoluteFilePath())); + QString relToRelSymlink = "relative/rel_symlink"; QVERIFY(pwd.exists("abs_symlink.cpp") || createSymbolicLinkW((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x0)); QVERIFY(pwd.exists(relSymlink) || createSymbolicLinkW((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x0)); - + QVERIFY(pwd.exists(relToRelSymlink) + || createSymbolicLinkW((wchar_t*)relToRelSymlink.utf16(), (wchar_t*)relToRelTarget.utf16(),0x0)); QTest::newRow("absolute file symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); - QTest::newRow("relative file symlink") << relSymlink << true << QDir::fromNativeSeparators(relTarget) << target.canonicalFilePath(); + QTest::newRow("relative file symlink") << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); + QTest::newRow("relative to relative file symlink") << relToRelSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); } //Junctions From 135da4531855349f9e39e9b79fd96d6dabed8b37 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:08:58 +0200 Subject: [PATCH 09/30] Convert features.keysequenceedit to QT_[REQUIRE_]CONFIG Change-Id: Id8ffd7f0e6ef4bdc43959179c26342ecee75b280 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qkeysequenceedit.cpp | 4 ---- src/widgets/widgets/qkeysequenceedit.h | 6 ++---- src/widgets/widgets/qkeysequenceedit_p.h | 6 ++---- src/widgets/widgets/widgets.pri | 11 ++++++++--- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index 4d86c7cfc77..6f2a6b2d5ab 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_KEYSEQUENCEEDIT - Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here void QKeySequenceEditPrivate::init() @@ -332,8 +330,6 @@ void QKeySequenceEdit::timerEvent(QTimerEvent *e) QWidget::timerEvent(e); } -#endif // QT_NO_KEYSEQUENCEEDIT - QT_END_NAMESPACE #include "moc_qkeysequenceedit.cpp" diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h index 81339a98526..d5b4b199cdd 100644 --- a/src/widgets/widgets/qkeysequenceedit.h +++ b/src/widgets/widgets/qkeysequenceedit.h @@ -44,9 +44,9 @@ #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(keysequenceedit); -#ifndef QT_NO_KEYSEQUENCEEDIT +QT_BEGIN_NAMESPACE class QKeySequenceEditPrivate; class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget @@ -82,8 +82,6 @@ private: Q_DECLARE_PRIVATE(QKeySequenceEdit) }; -#endif // QT_NO_KEYSEQUENCEEDIT - QT_END_NAMESPACE #endif // QKEYSEQUENCEEDIT_H diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h index 67e60b4032a..7af034e7352 100644 --- a/src/widgets/widgets/qkeysequenceedit_p.h +++ b/src/widgets/widgets/qkeysequenceedit_p.h @@ -58,9 +58,9 @@ #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(keysequenceedit); -#ifndef QT_NO_KEYSEQUENCEEDIT +QT_BEGIN_NAMESPACE class QLineEdit; @@ -81,8 +81,6 @@ public: int releaseTimer; }; -#endif // QT_NO_KEYSEQUENCEEDIT - QT_END_NAMESPACE #endif // QKEYSEQUENCEEDIT_P_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 48d3dd96d55..22847c9783c 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -7,8 +7,6 @@ HEADERS += \ widgets/qabstractspinbox_p.h \ widgets/qframe.h \ widgets/qframe_p.h \ - widgets/qkeysequenceedit.h \ - widgets/qkeysequenceedit_p.h \ widgets/qlineedit.h \ widgets/qlineedit_p.h \ widgets/qmainwindow.h \ @@ -45,7 +43,6 @@ SOURCES += \ widgets/qabstractspinbox.cpp \ widgets/qeffects.cpp \ widgets/qframe.cpp \ - widgets/qkeysequenceedit.cpp \ widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ widgets/qmainwindow.cpp \ @@ -151,6 +148,14 @@ qtConfig(groupbox) { SOURCES += widgets/qgroupbox.cpp } +qtConfig(keysequenceedit) { + HEADERS += \ + widgets/qkeysequenceedit.h \ + widgets/qkeysequenceedit_p.h + + SOURCES += widgets/qkeysequenceedit.cpp +} + qtConfig(label) { HEADERS += \ widgets/qlabel.h \ From dab49434d87d28c67b486822f510457995c3a934 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:10:29 +0200 Subject: [PATCH 10/30] Convert features.scrollarea to QT_[REQUIRE_]CONFIG Change-Id: Ifc7b0a6b025c282234b4aeaf23daecff8a558236 Reviewed-by: Oswald Buddenhagen --- src/widgets/accessible/complexwidgets.cpp | 6 ++++-- src/widgets/accessible/complexwidgets_p.h | 4 ++-- src/widgets/accessible/qaccessiblewidgetfactory.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 8 ++++---- src/widgets/kernel/qwindowcontainer.cpp | 2 +- src/widgets/styles/qstylesheetstyle.cpp | 10 +++++----- src/widgets/widgets/qabstractscrollarea.cpp | 4 ++-- src/widgets/widgets/qabstractscrollarea.h | 4 ++-- src/widgets/widgets/qabstractscrollarea_p.h | 4 ++-- src/widgets/widgets/qscrollarea.cpp | 4 ---- src/widgets/widgets/qscrollarea.h | 7 ++----- src/widgets/widgets/qscrollarea_p.h | 6 ++---- src/widgets/widgets/qsizegrip.cpp | 4 ++-- src/widgets/widgets/widgets.pri | 11 ++++++++--- 14 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index efbca0331d7..7c19c5d20c0 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -60,7 +60,9 @@ #include #endif #include +#if QT_CONFIG(scrollarea) #include +#endif #if QT_CONFIG(scrollbar) #include #endif @@ -388,7 +390,7 @@ QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionNam #endif // QT_CONFIG(combobox) -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) // ======================= QAccessibleAbstractScrollArea ======================= QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget) : QAccessibleWidget(widget, QAccessible::Client) @@ -497,7 +499,7 @@ QAccessibleScrollArea::QAccessibleScrollArea(QWidget *widget) { Q_ASSERT(qobject_cast(widget)); } -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) QT_END_NAMESPACE diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h index 6f5c950631b..1887f98dcaf 100644 --- a/src/widgets/accessible/complexwidgets_p.h +++ b/src/widgets/accessible/complexwidgets_p.h @@ -70,7 +70,7 @@ class QTitleBar; class QAbstractScrollArea; class QScrollArea; -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) class QAccessibleAbstractScrollArea : public QAccessibleWidget { public: @@ -105,7 +105,7 @@ class QAccessibleScrollArea : public QAccessibleAbstractScrollArea public: explicit QAccessibleScrollArea(QWidget *widget); }; -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) #if QT_CONFIG(tabbar) class QAccessibleTabBar : public QAccessibleWidget diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 97eaea728cd..08652812021 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -207,7 +207,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje } else if (classname == QLatin1String("QTextBrowser")) { iface = new QAccessibleTextBrowser(widget); #endif -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) } else if (classname == QLatin1String("QAbstractScrollArea")) { iface = new QAccessibleAbstractScrollArea(widget); } else if (classname == QLatin1String("QScrollArea")) { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 11915a4a21e..415045a9f7d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2436,7 +2436,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int { Q_Q(const QWidget); -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) bool resetBrushOrigin = false; QPointF oldBrushOrigin; //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture @@ -2449,7 +2449,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int painter->setBrushOrigin(-priv->contentsOffset()); } -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) const QBrush autoFillBrush = q->palette().brush(q->backgroundRole()); @@ -2476,10 +2476,10 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q); } -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (resetBrushOrigin) painter->setBrushOrigin(oldBrushOrigin); -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) } /* diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 7ae63e54b3a..b64182c5ef3 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -101,7 +101,7 @@ public: #ifndef QT_NO_MDIAREA || qobject_cast(p) != 0 #endif -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) || qobject_cast(p) != 0 #endif ) { diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index e781cb2f149..efd9d4c1d7c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2365,7 +2365,7 @@ static QWidget *embeddedWidget(QWidget *w) return sb->findChild(); #endif -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast(w)) return sa->viewport(); #endif @@ -2396,7 +2396,7 @@ static QWidget *containerWidget(const QWidget *w) } #endif // QT_NO_LINEEDIT -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (const QAbstractScrollArea *sa = qobject_cast(w->parentWidget())) { if (sa->viewport() == w) return w->parentWidget(); @@ -2800,7 +2800,7 @@ void QStyleSheetStyle::polish(QWidget *w) } -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast(w)) { QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled); if ((rule.hasBorder() && rule.border()->hasBorderImage()) @@ -2902,7 +2902,7 @@ void QStyleSheetStyle::unpolish(QWidget *w) w->setProperty("_q_stylesheet_maxh", QVariant()); w->setAttribute(Qt::WA_StyleSheet, false); QObject::disconnect(w, 0, this, 0); -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast(w)) { QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), sa, SLOT(update())); @@ -4374,7 +4374,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op } break; } -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) if (const QAbstractScrollArea *sa = qobject_cast(w)) { const QAbstractScrollAreaPrivate *sap = sa->d_func(); rule.drawBackground(p, opt->rect, sap->contentsOffset()); diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index d9cbad4766d..249ebd35d32 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -39,7 +39,7 @@ #include "qabstractscrollarea.h" -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) #include "qscrollbar.h" #include "qapplication.h" @@ -1662,4 +1662,4 @@ QT_END_NAMESPACE #include "moc_qabstractscrollarea.cpp" #include "moc_qabstractscrollarea_p.cpp" -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h index 193fabce56c..cee8481e6fd 100644 --- a/src/widgets/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) class QMargins; class QScrollBar; @@ -146,7 +146,7 @@ private: friend class QWidgetPrivate; }; -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) QT_END_NAMESPACE diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h index a3af77b11b5..c52e7f9fd49 100644 --- a/src/widgets/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) class QScrollBar; class QAbstractScrollAreaScrollBarContainer; @@ -149,7 +149,7 @@ private: Qt::Orientation orientation; }; -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) QT_END_NAMESPACE diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index 0868dcbd690..0bfc56f7fa2 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -40,8 +40,6 @@ #include "qscrollarea.h" #include "private/qscrollarea_p.h" -#ifndef QT_NO_SCROLLAREA - #include "qscrollbar.h" #include "qlayout.h" #include "qstyle.h" @@ -539,5 +537,3 @@ Qt::Alignment QScrollArea::alignment() const QT_END_NAMESPACE #include "moc_qscrollarea.cpp" - -#endif // QT_NO_SCROLLAREA diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h index 92ce287566f..d38bced2f23 100644 --- a/src/widgets/widgets/qscrollarea.h +++ b/src/widgets/widgets/qscrollarea.h @@ -43,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(scrollarea); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_SCROLLAREA - class QScrollAreaPrivate; class Q_WIDGETS_EXPORT QScrollArea : public QAbstractScrollArea @@ -91,8 +90,6 @@ private: Q_DISABLE_COPY(QScrollArea) }; -#endif // QT_NO_SCROLLAREA - QT_END_NAMESPACE #endif // QSCROLLAREA_H diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h index f7c0725dbeb..fa2e0241cf7 100644 --- a/src/widgets/widgets/qscrollarea_p.h +++ b/src/widgets/widgets/qscrollarea_p.h @@ -53,11 +53,11 @@ #include -#ifndef QT_NO_SCROLLAREA - #include "private/qabstractscrollarea_p.h" #include +QT_REQUIRE_CONFIG(scrollarea); + QT_BEGIN_NAMESPACE class QScrollAreaPrivate: public QAbstractScrollAreaPrivate @@ -74,8 +74,6 @@ public: Qt::Alignment alignment; }; -#endif - QT_END_NAMESPACE #endif diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index f0ede5f2ffc..3efb9028051 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -320,13 +320,13 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) // Check if tlw is inside QAbstractScrollArea/QScrollArea. // If that's the case tlw->parentWidget() will return the viewport // and tlw->parentWidget()->parentWidget() will return the scroll area. -#ifndef QT_NO_SCROLLAREA +#if QT_CONFIG(scrollarea) QAbstractScrollArea *scrollArea = qobject_cast(tlwParent->parentWidget()); if (scrollArea) { hasHorizontalSizeConstraint = scrollArea->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; hasVerticalSizeConstraint = scrollArea->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; } -#endif // QT_NO_SCROLLAREA +#endif // QT_CONFIG(scrollarea) availableGeometry = tlwParent->contentsRect(); } diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 22847c9783c..0314b48478d 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -17,7 +17,6 @@ HEADERS += \ widgets/qmdisubwindow_p.h \ widgets/qmenu.h \ widgets/qmenu_p.h \ - widgets/qscrollarea_p.h \ widgets/qsizegrip.h \ widgets/qslider.h \ widgets/qspinbox.h \ @@ -31,7 +30,6 @@ HEADERS += \ widgets/qabstractscrollarea_p.h \ widgets/qwidgetresizehandler_p.h \ widgets/qfocusframe.h \ - widgets/qscrollarea.h \ widgets/qwidgetanimator_p.h \ widgets/qwidgetlinecontrol_p.h \ widgets/qtoolbararealayout_p.h \ @@ -60,7 +58,6 @@ SOURCES += \ widgets/qabstractscrollarea.cpp \ widgets/qwidgetresizehandler.cpp \ widgets/qfocusframe.cpp \ - widgets/qscrollarea.cpp \ widgets/qwidgetanimator.cpp \ widgets/qwidgetlinecontrol.cpp \ widgets/qtoolbararealayout.cpp \ @@ -216,6 +213,14 @@ qtConfig(rubberband) { SOURCES += widgets/qrubberband.cpp } +qtConfig(scrollarea) { + HEADERS += \ + widgets/qscrollarea.h \ + widgets/qscrollarea_p.h + + SOURCES += widgets/qscrollarea.cpp +} + qtConfig(scrollbar) { HEADERS += \ widgets/qscrollbar.h \ From 8a93f5069544d9fb688f05a6b8d92375c9eca42f Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:11:11 +0200 Subject: [PATCH 11/30] Convert features.resizehandler to QT_[REQUIRE_]CONFIG Change-Id: I44ed1be0cf56daf7dc2a7e4bbd3402419a04a530 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qwidgetresizehandler.cpp | 3 --- src/widgets/widgets/qwidgetresizehandler_p.h | 4 +--- src/widgets/widgets/widgets.pri | 7 +++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index dc7353a6cac..37ba5ba9925 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -39,7 +39,6 @@ #include "qwidgetresizehandler_p.h" -#ifndef QT_NO_RESIZEHANDLER #include "qframe.h" #include "qapplication.h" #include "qdesktopwidget.h" @@ -543,5 +542,3 @@ void QWidgetResizeHandler::doMove() QT_END_NAMESPACE #include "moc_qwidgetresizehandler_p.cpp" - -#endif //QT_NO_RESIZEHANDLER diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h index 7bb7d6cd949..669cb6f256a 100644 --- a/src/widgets/widgets/qwidgetresizehandler_p.h +++ b/src/widgets/widgets/qwidgetresizehandler_p.h @@ -55,7 +55,7 @@ #include "QtCore/qobject.h" #include "QtCore/qpoint.h" -#ifndef QT_NO_RESIZEHANDLER +QT_REQUIRE_CONFIG(resizehandler); QT_BEGIN_NAMESPACE @@ -135,6 +135,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_RESIZEHANDLER - #endif // QWIDGETRESIZEHANDLER_P_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 0314b48478d..a34a8d8600b 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -28,7 +28,6 @@ HEADERS += \ widgets/qtoolbarseparator_p.h \ widgets/qabstractscrollarea.h \ widgets/qabstractscrollarea_p.h \ - widgets/qwidgetresizehandler_p.h \ widgets/qfocusframe.h \ widgets/qwidgetanimator_p.h \ widgets/qwidgetlinecontrol_p.h \ @@ -56,7 +55,6 @@ SOURCES += \ widgets/qtoolbarlayout.cpp \ widgets/qtoolbarseparator.cpp \ widgets/qabstractscrollarea.cpp \ - widgets/qwidgetresizehandler.cpp \ widgets/qfocusframe.cpp \ widgets/qwidgetanimator.cpp \ widgets/qwidgetlinecontrol.cpp \ @@ -200,6 +198,11 @@ qtConfig(radiobutton) { widgets/qradiobutton.cpp } +qtConfig(resizehandler) { + HEADERS += widgets/qwidgetresizehandler_p.h + SOURCES += widgets/qwidgetresizehandler.cpp +} + qtConfig(dialogbuttonbox) { HEADERS += \ widgets/qdialogbuttonbox.h From 6380729c48b0c9bf4ef109f77ffd8a65b365165d Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:11:58 +0200 Subject: [PATCH 12/30] Convert features.effects to QT_[REQUIRE_]CONFIG Change-Id: I8421b5e81dc21e8f9f6bdd9f714fb3f535618a3c Reviewed-by: Oswald Buddenhagen --- src/widgets/configure.json | 3 ++- src/widgets/kernel/qtooltip.cpp | 8 ++++++-- src/widgets/widgets/qcombobox.cpp | 10 +++++----- src/widgets/widgets/qeffects.cpp | 3 --- src/widgets/widgets/qeffects_p.h | 5 ++--- src/widgets/widgets/qmenu.cpp | 12 +++++++----- src/widgets/widgets/widgets.pri | 6 +++++- 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 7e2f8e15523..7c00f8c3f4b 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -80,7 +80,8 @@ "effects": { "label": "Effects", "purpose": "Provides special widget effects (e.g. fading and scrolling).", - "section": "Kernel" + "section": "Kernel", + "output": [ "privateFeature" ] }, "filesystemmodel": { "label": "QFileSystemModel", diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 830a3289484..c2610131f30 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -40,6 +40,8 @@ # include #endif +#include + #include #include #include @@ -48,7 +50,9 @@ #include #include #include +#if QT_CONFIG(effects) #include +#endif #include #include #include @@ -285,7 +289,7 @@ void QTipLabel::timerEvent(QTimerEvent *e) || e->timerId() == expireTimer.timerId()){ hideTimer.stop(); expireTimer.stop(); -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(effects) if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ // Fade out tip on mac (makes it invisible). // The tip will not be deleted until a new tip is shown. @@ -505,7 +509,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label")); -#if !defined(QT_NO_EFFECTS) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ +#if QT_CONFIG(effects) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) qFadeEffect(QTipLabel::instance); else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 35f6346cc61..2b7e9653f3e 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -70,12 +70,12 @@ #include #include #include -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && QT_CONFIG(style_mac) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(effetcts) && QT_CONFIG(style_mac) #include #include #include #endif -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) # include #endif #ifndef QT_NO_ACCESSIBILITY @@ -2731,7 +2731,7 @@ void QComboBox::showPopup() const bool updatesEnabled = container->updatesEnabled(); #endif -#if !defined(QT_NO_EFFECTS) +#if QT_CONFIG(effects) bool scrollDown = (listRect.topLeft() == below); if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) @@ -2803,7 +2803,7 @@ void QComboBox::hidePopup() { Q_D(QComboBox); if (d->container && d->container->isVisible()) { -#if !defined(QT_NO_EFFECTS) +#if QT_CONFIG(effects) QSignalBlocker modelBlocker(d->model); QSignalBlocker viewBlocker(d->container->itemView()); QSignalBlocker containerBlocker(d->container); @@ -2847,7 +2847,7 @@ void QComboBox::hidePopup() modelBlocker.unblock(); if (!didFade) -#endif // QT_NO_EFFECTS +#endif // QT_CONFIG(effects) // Fade should implicitly hide as well ;-) d->container->hide(); } diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index 736f2599fe9..437cee93dfd 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qapplication.h" -#ifndef QT_NO_EFFECTS #include "qdesktopwidget.h" #include "qeffects_p.h" #include "qevent.h" @@ -605,5 +604,3 @@ QT_END_NAMESPACE */ #include "qeffects.moc" - -#endif //QT_NO_EFFECTS diff --git a/src/widgets/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h index a93efce1ecf..92f459651f9 100644 --- a/src/widgets/widgets/qeffects_p.h +++ b/src/widgets/widgets/qeffects_p.h @@ -53,8 +53,9 @@ // #include "QtCore/qnamespace.h" +#include -#ifndef QT_NO_EFFECTS +QT_REQUIRE_CONFIG(effects); QT_BEGIN_NAMESPACE @@ -77,6 +78,4 @@ extern void Q_WIDGETS_EXPORT qFadeEffect(QWidget*, int time = -1); QT_END_NAMESPACE -#endif // QT_NO_EFFECTS - #endif // QEFFECTS_P_H diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 93ceca1095a..0a5c52abe6d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -41,6 +41,8 @@ #ifndef QT_NO_MENU +#include + #include "qdebug.h" #include "qstyle.h" #include "qevent.h" @@ -56,7 +58,7 @@ #ifndef QT_NO_ACCESSIBILITY # include "qaccessible.h" #endif -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) # include #endif #if QT_CONFIG(whatsthis) @@ -517,7 +519,7 @@ void QMenuPrivate::hideMenu(QMenu *menu) { if (!menu) return; -#if !defined(QT_NO_EFFECTS) +#if QT_CONFIG(effects) QSignalBlocker blocker(menu); aboutToHide = true; // Flash item which is about to trigger (if any). @@ -539,7 +541,7 @@ void QMenuPrivate::hideMenu(QMenu *menu) aboutToHide = false; blocker.unblock(); -#endif // QT_NO_EFFECTS +#endif // QT_CONFIG(effects) if (activeMenu == menu) activeMenu = 0; menu->d_func()->causedPopup.action = 0; @@ -670,7 +672,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } if (hideActiveMenu && previousAction != currentAction) { if (popup == -1) { -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) // kill any running effect qFadeEffect(0); qScrollEffect(0); @@ -2475,7 +2477,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } } setGeometry(QRect(pos, size)); -#ifndef QT_NO_EFFECTS +#if QT_CONFIG(effects) int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int vGuess = QEffects::DownScroll; if (isRightToLeft()) { diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index a34a8d8600b..c531ca84ccb 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -38,7 +38,6 @@ HEADERS += \ SOURCES += \ widgets/qbuttongroup.cpp \ widgets/qabstractspinbox.cpp \ - widgets/qeffects.cpp \ widgets/qframe.cpp \ widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ @@ -133,6 +132,11 @@ qtConfig(dockwidget) { widgets/qdockarealayout.cpp } +qtConfig(effects) { + HEADERS += widgets/qeffects_p.h + SOURCES += widgets/qeffects.cpp +} + qtConfig(fontcombobox) { HEADERS += widgets/qfontcombobox.h SOURCES += widgets/qfontcombobox.cpp From 66d9a2b9971366c906aea1e9e0ed4e600384a4aa Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 27 Aug 2017 19:12:51 +0200 Subject: [PATCH 13/30] Convert features.buttongroup to QT_[REQUIRE_]CONFIG Change-Id: Id5df397d0aa4cad7f586ef7303902d8ee7b88f1d Reviewed-by: Oswald Buddenhagen --- src/printsupport/configure.json | 1 + src/widgets/widgets/qabstractbutton.cpp | 38 +++++++++++++------------ src/widgets/widgets/qabstractbutton.h | 2 +- src/widgets/widgets/qabstractbutton_p.h | 2 +- src/widgets/widgets/qbuttongroup.cpp | 4 --- src/widgets/widgets/qbuttongroup.h | 7 ++--- src/widgets/widgets/qbuttongroup_p.h | 6 ++-- src/widgets/widgets/qradiobutton.cpp | 2 ++ src/widgets/widgets/widgets.pri | 11 +++++-- 9 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index e8cec22c099..abc704fa18b 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -38,6 +38,7 @@ "label": "CUPS job control widget", "section": "Widgets", "condition": [ + "features.buttongroup", "features.calendarwidget", "features.checkbox", "features.combobox", diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 1d78d24a88a..dbd94e890dc 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -39,11 +39,13 @@ #include "private/qabstractbutton_p.h" -#include "private/qbuttongroup_p.h" #if QT_CONFIG(itemviews) #include "qabstractitemview.h" #endif +#if QT_CONFIG(buttongroup) #include "qbuttongroup.h" +#include "private/qbuttongroup_p.h" +#endif #include "qabstractbutton_p.h" #include "qevent.h" #include "qpainter.h" @@ -173,7 +175,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) #endif checkable(false), checked(false), autoRepeat(false), autoExclusive(false), down(false), blockRefresh(false), pressed(false), -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) group(0), #endif autoRepeatDelay(AUTO_REPEAT_DELAY), @@ -183,7 +185,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) QListQAbstractButtonPrivate::queryButtonList() const { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group) return group->d_func()->buttonList; #endif @@ -192,7 +194,7 @@ QListQAbstractButtonPrivate::queryButtonList() const if (autoExclusive) { auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) { return !candidate->autoExclusive() -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) || candidate->group() #endif ; @@ -206,7 +208,7 @@ QListQAbstractButtonPrivate::queryButtonList() const QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group) return group->d_func()->checkedButton; #endif @@ -226,7 +228,7 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const void QAbstractButtonPrivate::notifyChecked() { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) Q_Q(QAbstractButton); if (group) { QAbstractButton *previous = group->d_func()->checkedButton; @@ -244,7 +246,7 @@ void QAbstractButtonPrivate::notifyChecked() void QAbstractButtonPrivate::moveFocus(int key) { QList buttonList = queryButtonList();; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) bool exclusive = group ? group->d_func()->exclusive : autoExclusive; #else bool exclusive = autoExclusive; @@ -335,7 +337,7 @@ void QAbstractButtonPrivate::moveFocus(int key) void QAbstractButtonPrivate::fixFocusPolicy() { Q_Q(QAbstractButton); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (!group && !autoExclusive) #else if (!autoExclusive) @@ -382,7 +384,7 @@ void QAbstractButtonPrivate::click() bool changeState = true; if (checked && queryCheckedButton() == q) { // the checked button of an exclusive or autoexclusive group cannot be unchecked -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group ? group->d_func()->exclusive : autoExclusive) #else if (autoExclusive) @@ -410,7 +412,7 @@ void QAbstractButtonPrivate::emitClicked() Q_Q(QAbstractButton); QPointer guard(q); emit q->clicked(checked); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonClicked(group->id(q)); if (guard && group) @@ -424,7 +426,7 @@ void QAbstractButtonPrivate::emitPressed() Q_Q(QAbstractButton); QPointer guard(q); emit q->pressed(); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonPressed(group->id(q)); if (guard && group) @@ -438,7 +440,7 @@ void QAbstractButtonPrivate::emitReleased() Q_Q(QAbstractButton); QPointer guard(q); emit q->released(); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonReleased(group->id(q)); if (guard && group) @@ -452,7 +454,7 @@ void QAbstractButtonPrivate::emitToggled(bool checked) Q_Q(QAbstractButton); QPointer guard(q); emit q->toggled(checked); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonToggled(group->id(q), checked); if (guard && group) @@ -476,7 +478,7 @@ QAbstractButton::QAbstractButton(QWidget *parent) */ QAbstractButton::~QAbstractButton() { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) Q_D(QAbstractButton); if (d->group) d->group->removeButton(this); @@ -623,7 +625,7 @@ void QAbstractButton::setChecked(bool checked) if (!checked && d->queryCheckedButton() == this) { // the checked button of an exclusive or autoexclusive group cannot be unchecked -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (d->group ? d->group->d_func()->exclusive : d->autoExclusive) return; if (d->group) @@ -798,7 +800,7 @@ bool QAbstractButton::autoExclusive() const return d->autoExclusive; } -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) /*! Returns the group that this button belongs to. @@ -812,7 +814,7 @@ QButtonGroup *QAbstractButton::group() const Q_D(const QAbstractButton); return d->group; } -#endif // QT_NO_BUTTONGROUP +#endif // QT_CONFIG(buttongroup) /*! Performs an animated click: the button is pressed immediately, and @@ -1070,7 +1072,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) #endif QWidget *pw = parentWidget(); if (d->autoExclusive -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) || d->group #endif #if QT_CONFIG(itemviews) diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h index 4e438bd8512..01dbf4e92d7 100644 --- a/src/widgets/widgets/qabstractbutton.h +++ b/src/widgets/widgets/qabstractbutton.h @@ -108,7 +108,7 @@ public: void setAutoExclusive(bool); bool autoExclusive() const; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) QButtonGroup *group() const; #endif diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h index 8f67c0d3679..39e2e399a7a 100644 --- a/src/widgets/widgets/qabstractbutton_p.h +++ b/src/widgets/widgets/qabstractbutton_p.h @@ -80,7 +80,7 @@ public: uint blockRefresh :1; uint pressed : 1; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) QButtonGroup* group; #endif QBasicTimer repeatTimer; diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index ef73fd1b677..fa1ccd347f6 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -39,8 +39,6 @@ #include "private/qbuttongroup_p.h" -#ifndef QT_NO_BUTTONGROUP - #include "private/qabstractbutton_p.h" QT_BEGIN_NAMESPACE @@ -362,5 +360,3 @@ int QButtonGroup::checkedId() const QT_END_NAMESPACE #include "moc_qbuttongroup.cpp" - -#endif // QT_NO_BUTTONGROUP diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h index ff931b1ee04..1b4f2377ae1 100644 --- a/src/widgets/widgets/qbuttongroup.h +++ b/src/widgets/widgets/qbuttongroup.h @@ -43,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(buttongroup); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_BUTTONGROUP - class QAbstractButton; class QAbstractButtonPrivate; class QButtonGroupPrivate; @@ -94,8 +93,6 @@ private: friend class QAbstractButtonPrivate; }; -#endif // QT_NO_BUTTONGROUP - QT_END_NAMESPACE #endif // QBUTTONGROUP_H diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h index 93f3f4e0ec4..148f5723734 100644 --- a/src/widgets/widgets/qbuttongroup_p.h +++ b/src/widgets/widgets/qbuttongroup_p.h @@ -54,14 +54,14 @@ #include #include -#ifndef QT_NO_BUTTONGROUP - #include #include #include #include +QT_REQUIRE_CONFIG(buttongroup); + QT_BEGIN_NAMESPACE class QButtonGroupPrivate: public QObjectPrivate @@ -81,6 +81,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_BUTTONGROUP - #endif // QBUTTONGROUP_P_H diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index ac711d34c76..dfba32d3e85 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -40,7 +40,9 @@ #include "qradiobutton.h" #include "qapplication.h" #include "qbitmap.h" +#if QT_CONFIG(buttongroup) #include "qbuttongroup.h" +#endif #include "qstylepainter.h" #include "qstyle.h" #include "qstyleoption.h" diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index c531ca84ccb..5737af41c33 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -1,8 +1,6 @@ # Qt widgets module HEADERS += \ - widgets/qbuttongroup.h \ - widgets/qbuttongroup_p.h \ widgets/qabstractspinbox.h \ widgets/qabstractspinbox_p.h \ widgets/qframe.h \ @@ -36,7 +34,6 @@ HEADERS += \ widgets/qplaintextedit_p.h SOURCES += \ - widgets/qbuttongroup.cpp \ widgets/qabstractspinbox.cpp \ widgets/qframe.cpp \ widgets/qlineedit_p.cpp \ @@ -78,6 +75,14 @@ qtConfig(abstractslider) { widgets/qabstractslider.cpp } +qtConfig(buttongroup) { + HEADERS += \ + widgets/qbuttongroup.h \ + widgets/qbuttongroup_p.h + + SOURCES += widgets/qbuttongroup.cpp +} + qtConfig(calendarwidget) { HEADERS += widgets/qcalendarwidget.h SOURCES += widgets/qcalendarwidget.cpp From 093064fdeb6e777d2dc88dbb4f4adb8fddac3aa5 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sat, 2 Sep 2017 20:52:48 +0200 Subject: [PATCH 14/30] Convert features.completer to QT_[REQUIRE_]CONFIG Change-Id: If45a46c08b37d245229a39f3d6ffbb34154934f2 Reviewed-by: Oswald Buddenhagen --- .../dialogs/qprintdialog_unix.cpp | 4 ++- src/widgets/dialogs/qfiledialog.cpp | 2 +- src/widgets/dialogs/qfiledialog_p.h | 2 ++ src/widgets/util/qcompleter.cpp | 4 --- src/widgets/util/qcompleter.h | 7 ++-- src/widgets/util/qcompleter_p.h | 6 ++-- src/widgets/util/util.pri | 13 +++++--- src/widgets/widgets/qcombobox.cpp | 32 +++++++++---------- src/widgets/widgets/qcombobox.h | 10 +++--- src/widgets/widgets/qcombobox_p.h | 6 ++-- src/widgets/widgets/qlineedit.cpp | 10 +++--- src/widgets/widgets/qlineedit.h | 4 +-- src/widgets/widgets/qlineedit_p.cpp | 6 ++-- src/widgets/widgets/qlineedit_p.h | 4 ++- src/widgets/widgets/qwidgetlinecontrol.cpp | 16 +++++----- src/widgets/widgets/qwidgetlinecontrol_p.h | 6 ++-- .../kernel/qprinter/tst_qprinter.cpp | 4 +-- .../widgets/qlineedit/tst_qlineedit.cpp | 6 ++-- 18 files changed, 74 insertions(+), 68 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 51c8a593a16..71312d65f1e 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -63,7 +63,9 @@ #include +#if QT_CONFIG(completer) #include +#endif #include "ui_qprintpropertieswidget.h" #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" @@ -679,7 +681,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter * } widget.properties->setEnabled(true); -#if QT_CONFIG(filesystemmodel) && !defined(QT_NO_COMPLETER) +#if QT_CONFIG(filesystemmodel) && QT_CONFIG(completer) QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 97afce17346..8d0161d96b8 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -4130,7 +4130,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const return parts; } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) QT_END_NAMESPACE diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index f7a3c6b0914..371826ecccb 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -69,7 +69,9 @@ #include #include #include +#if QT_CONFIG(completer) #include +#endif #include #include #include "qsidebar_p.h" diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index a9ab0c22c86..8757956310a 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -143,8 +143,6 @@ #include "qcompleter_p.h" -#ifndef QT_NO_COMPLETER - #include "QtWidgets/qscrollbar.h" #include "QtCore/qstringlistmodel.h" #if QT_CONFIG(dirmodel) @@ -1902,5 +1900,3 @@ QT_END_NAMESPACE #include "moc_qcompleter.cpp" #include "moc_qcompleter_p.cpp" - -#endif // QT_NO_COMPLETER diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h index 33e65402640..1a2c2440f5f 100644 --- a/src/widgets/util/qcompleter.h +++ b/src/widgets/util/qcompleter.h @@ -47,11 +47,10 @@ #include #include +QT_REQUIRE_CONFIG(completer); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_COMPLETER - class QCompleterPrivate; class QAbstractItemView; class QAbstractProxyModel; @@ -162,8 +161,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_fileSystemModelDirectoryLoaded(const QString&)) }; -#endif // QT_NO_COMPLETER - QT_END_NAMESPACE #endif // QCOMPLETER_H diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index 6629c47e069..40b08cc20af 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -55,8 +55,6 @@ #include #include "private/qobject_p.h" -#ifndef QT_NO_COMPLETER - #include "QtWidgets/qabstractitemview.h" #include "QtCore/qabstractproxymodel.h" #include "qcompleter.h" @@ -64,6 +62,8 @@ #include "QtGui/qpainter.h" #include "private/qabstractproxymodel_p.h" +QT_REQUIRE_CONFIG(completer); + QT_BEGIN_NAMESPACE class QCompletionModel; @@ -258,6 +258,4 @@ class QCompletionModelPrivate : public QAbstractProxyModelPrivate QT_END_NAMESPACE -#endif // QT_NO_COMPLETER - #endif // QCOMPLETER_P_H diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 8b28ac8bf02..0b654bbadd9 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -3,14 +3,19 @@ HEADERS += \ util/qsystemtrayicon.h \ util/qcolormap.h \ - util/qcompleter.h \ - util/qcompleter_p.h \ util/qsystemtrayicon_p.h SOURCES += \ util/qsystemtrayicon.cpp \ - util/qcolormap.cpp \ - util/qcompleter.cpp + util/qcolormap.cpp + +qtConfig(completer) { + HEADERS += \ + util/qcompleter.h \ + util/qcompleter_p.h + + SOURCES += util/qcompleter.cpp +} qtConfig(scroller) { HEADERS += \ diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 2b7e9653f3e..3fc5e5a0510 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -107,7 +107,7 @@ QComboBoxPrivate::QComboBoxPrivate() #ifdef Q_OS_MAC , m_platformMenu(0) #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) , completer(0) #endif { @@ -193,7 +193,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt return menuOption; } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index) { Q_Q(QComboBox); @@ -214,7 +214,7 @@ void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index) } # endif // QT_KEYPAD_NAVIGATION } -#endif // !QT_NO_COMPLETER +#endif // QT_CONFIG(completer) void QComboBoxPrivate::updateArrow(QStyle::StateFlag state) { @@ -1196,7 +1196,7 @@ Qt::MatchFlags QComboBoxPrivate::matchFlags() const { // Base how duplicates are determined on the autocompletion case sensitivity Qt::MatchFlags flags = Qt::MatchFixedString; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive) #endif flags |= Qt::MatchCaseSensitive; @@ -1425,7 +1425,7 @@ int QComboBox::maxCount() const return d->maxCount; } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) /*! \property QComboBox::autoCompletion @@ -1520,7 +1520,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity d->lineEdit->completer()->setCaseSensitivity(sensitivity); } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) /*! \property QComboBox::duplicatesEnabled @@ -1802,12 +1802,12 @@ void QComboBox::setLineEdit(QLineEdit *edit) d->updateFocusPolicy(); d->lineEdit->setFocusProxy(this); d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) setAutoCompletion(d->autoCompletion); #endif #ifdef QT_KEYPAD_NAVIGATION -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (QApplication::keypadNavigationEnabled()) { // Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion. // This means that when the user enters edit mode they are immediately presented with a @@ -1871,7 +1871,7 @@ const QValidator *QComboBox::validator() const } #endif // QT_NO_VALIDATOR -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) /*! \fn void QComboBox::setCompleter(QCompleter *completer) @@ -1911,7 +1911,7 @@ QCompleter *QComboBox::completer() const return d->lineEdit ? d->lineEdit->completer() : 0; } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) /*! Returns the item delegate used by the popup list view. @@ -1977,7 +1977,7 @@ void QComboBox::setModel(QAbstractItemModel *model) if (model == d->model) return; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer() == d->completer) d->lineEdit->completer()->setModel(model); @@ -2123,7 +2123,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) const QString newText = itemText(normalized); if (lineEdit->text() != newText) { lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (lineEdit && lineEdit->completer()) lineEdit->completer()->setCompletionPrefix(newText); #endif @@ -2574,7 +2574,7 @@ void QComboBox::showPopup() #endif // Q_OS_MAC #ifdef QT_KEYPAD_NAVIGATION -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (QApplication::keypadNavigationEnabled() && d->completer) { // editable combo box is line edit plus completer setEditFocus(true); @@ -2911,7 +2911,7 @@ void QComboBox::focusInEvent(QFocusEvent *e) update(); if (d->lineEdit) { d->lineEdit->event(e); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit->completer()) d->lineEdit->completer()->setWidget(this); #endif @@ -3137,7 +3137,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e) { Q_D(QComboBox); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer()->popup() @@ -3473,7 +3473,7 @@ void QComboBox::setModelColumn(int visibleColumn) QListView *lv = qobject_cast(d->viewContainer()->itemView()); if (lv) lv->setModelColumn(visibleColumn); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->lineEdit && d->lineEdit->completer() && d->lineEdit->completer() == d->completer) d->lineEdit->completer()->setCompletionColumn(visibleColumn); diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index a6aac6f8aa4..ff27a999d9f 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -71,10 +71,10 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget Q_PROPERTY(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false) Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false) -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled) Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) @@ -91,7 +91,7 @@ public: void setMaxCount(int max); int maxCount() const; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) bool autoCompletion() const; void setAutoCompletion(bool enable); @@ -149,7 +149,7 @@ public: const QValidator *validator() const; #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void setCompleter(QCompleter *c); QCompleter *completer() const; #endif @@ -262,7 +262,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex & parent, int start, int end)) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_modelReset()) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) Q_PRIVATE_SLOT(d_func(), void _q_completerActivated(const QModelIndex &index)) #endif }; diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index ab4dd0281f8..249610825af 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -67,7 +67,9 @@ #include "QtCore/qtimer.h" #include "private/qwidget_p.h" #include "QtCore/qpointer.h" +#if QT_CONFIG(completer) #include "QtWidgets/qcompleter.h" +#endif #include "QtGui/qevent.h" #include "QtCore/qdebug.h" @@ -355,7 +357,7 @@ public: void _q_emitCurrentIndexChanged(const QModelIndex &index); void _q_modelDestroyed(); void _q_modelReset(); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void _q_completerActivated(const QModelIndex &index); #endif void _q_resetButton(); @@ -415,7 +417,7 @@ public: #ifdef Q_OS_MAC QPlatformMenu *m_platformMenu; #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) QPointer completer; #endif static QPalette viewContainerPalette(QComboBox *cmb) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 449a9c0b33f..eb4cb96c01a 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -615,7 +615,7 @@ void QLineEdit::setValidator(const QValidator *v) } #endif // QT_NO_VALIDATOR -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) /*! \since 4.2 @@ -667,7 +667,7 @@ QCompleter *QLineEdit::completer() const return d->control->completer(); } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) /*! Returns a recommended size for the widget. @@ -1742,7 +1742,7 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) d->control->processInputMethodEvent(e); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (!e->commitString().isEmpty()) d->control->complete(Qt::Key_unknown); #endif @@ -1823,7 +1823,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->control->setCancelText(d->control->text()); } #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->control->completer()) { d->control->completer()->setWidget(this); QObject::connect(d->control->completer(), SIGNAL(activated(QString)), @@ -1870,7 +1870,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e) #ifdef QT_KEYPAD_NAVIGATION d->control->setCancelText(QString()); #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (d->control->completer()) { QObject::disconnect(d->control->completer(), 0, this, 0); } diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h index 4d32b11f065..dc0e694d07d 100644 --- a/src/widgets/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -124,7 +124,7 @@ public: const QValidator * validator() const; #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void setCompleter(QCompleter *completer); QCompleter *completer() const; #endif @@ -250,7 +250,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &)) #endif #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 79241ef720b..ae35a646633 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -90,7 +90,7 @@ QRect QLineEditPrivate::cursorRect() const return adjustedControlRect(control->cursorRect()); } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void QLineEditPrivate::_q_completionHighlighted(const QString &newText) { @@ -111,7 +111,7 @@ void QLineEditPrivate::_q_completionHighlighted(const QString &newText) } } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) void QLineEditPrivate::_q_handleWindowActivate() { @@ -124,7 +124,7 @@ void QLineEditPrivate::_q_textEdited(const QString &text) { Q_Q(QLineEdit); emit q->textEdited(text); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (control->completer() && control->completer()->completionMode() != QCompleter::InlineCompletion) control->complete(-1); // update the popup on cut/paste/del diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 92bdd4ad60b..094425e45e9 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -63,7 +63,9 @@ #include "QtGui/qicon.h" #include "QtWidgets/qstyleoption.h" #include "QtCore/qbasictimer.h" +#if QT_CONFIG(completer) #include "QtWidgets/qcompleter.h" +#endif #include "QtCore/qpointer.h" #include "QtCore/qmimedata.h" @@ -203,7 +205,7 @@ public: #endif void _q_selectionChanged(); void _q_updateNeeded(const QRect &); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void _q_completionHighlighted(const QString &); #endif QPoint mousePressPos; diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 9281cc8cedf..3abe82ce59c 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1428,7 +1428,7 @@ void QWidgetLineControl::emitCursorPositionChanged() } } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) // iterating forward(dir=1)/backward(dir=-1) from the // current row based. dir=0 indicates a new completion prefix was set. bool QWidgetLineControl::advanceToEnabledItem(int dir) @@ -1627,7 +1627,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) { bool inlineCompletionAccepted = false; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) if (m_completer) { QCompleter::CompletionMode completionMode = m_completer->completionMode(); if ((completionMode == QCompleter::PopupCompletion @@ -1672,7 +1672,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) } } } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput() || fixup()) { @@ -1774,7 +1774,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) end(1); } else if (event == QKeySequence::MoveToNextChar) { -#if defined(QT_NO_COMPLETER) +#if !QT_CONFIG(completer) const bool inlineCompletion = false; #else const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; @@ -1791,7 +1791,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); } else if (event == QKeySequence::MoveToPreviousChar) { -#if defined(QT_NO_COMPLETER) +#if !QT_CONFIG(completer) const bool inlineCompletion = false; #else const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; @@ -1886,7 +1886,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) del(); } break; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) case Qt::Key_Up: case Qt::Key_Down: complete(event->key()); @@ -1901,7 +1901,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) case Qt::Key_Backspace: if (!isReadOnly()) { backspace(); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) complete(Qt::Key_Backspace); #endif } @@ -1941,7 +1941,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) && !isReadOnly() && isAcceptableInput(event)) { insert(event->text()); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) complete(event->key()); #endif event->accept(); diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 257402e9dc9..243a1a77235 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -62,7 +62,9 @@ #include "QtGui/qclipboard.h" #include "QtGui/qinputmethod.h" #include "QtCore/qpoint.h" +#if QT_CONFIG(completer) #include "QtWidgets/qcompleter.h" +#endif #include "QtCore/qthread.h" #include "QtGui/private/qinputcontrol_p.h" @@ -289,7 +291,7 @@ public: void setValidator(const QValidator *v) { m_validator = const_cast(v); } #endif -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) QCompleter *completer() const { return m_completer; } /* Note that you must set the widget for the completer separately */ void setCompleter(const QCompleter *c) { m_completer = const_cast(c); } @@ -461,7 +463,7 @@ private: QPointer m_validator; #endif QPointer m_completer; -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) bool advanceToEnabledItem(int dir); #endif diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index cc32e73b9ce..88bae686ab3 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -83,7 +83,7 @@ private slots: void customPaperSizeAndMargins(); void customPaperNameSettingBySize(); void customPaperNameSettingByName(); -#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog) +#if QT_CONFIG(completer) && QT_CONFIG(filedialog) void printDialogCompleter(); #endif void testCurrentPage(); @@ -587,7 +587,7 @@ void tst_QPrinter::customPaperSizeAndMargins() } } -#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog) +#if QT_CONFIG(completer) && QT_CONFIG(filedialog) void tst_QPrinter::printDialogCompleter() { QPrintDialog dialog; diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 8a17a4a327a..cf1e19d5989 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -261,7 +261,7 @@ private slots: // task-specific tests: void task180999_focus(); void task174640_editingFinished(); -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) void task198789_currentCompletion(); void task210502_caseInsensitiveInlineCompletion(); #endif @@ -3630,7 +3630,7 @@ void tst_QLineEdit::task174640_editingFinished() QCOMPARE(editingFinishedSpy.count(), 1); } -#ifndef QT_NO_COMPLETER +#if QT_CONFIG(completer) class task198789_Widget : public QWidget { Q_OBJECT @@ -3689,7 +3689,7 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion() QCOMPARE(lineEdit.text(), completion); } -#endif // QT_NO_COMPLETER +#endif // QT_CONFIG(completer) void tst_QLineEdit::task229938_dontEmitChangedWhenTextIsNotChanged() From a2dbf1e779d36915b4c9c3574168e38cdef19ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 4 Sep 2017 08:59:42 +0300 Subject: [PATCH 15/30] Blacklist tst_QItemDelegate::enterKey tests on openSUSE 42.3 Task-number: QTBUG-62967 Change-Id: I42f25120f1a9e2ef6a9a147e4f36edcdff2922a6 Reviewed-by: Heikki Halmet --- tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST diff --git a/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST b/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST new file mode 100644 index 00000000000..0d658dcfb6f --- /dev/null +++ b/tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST @@ -0,0 +1,4 @@ +[enterKey:plaintextedit tab] +opensuse-42.3 +[enterKey:plaintextedit backtab] +opensuse-42.3 From f9fea20c10ca7864cfa551fce23124d358c11b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 4 Sep 2017 09:05:47 +0300 Subject: [PATCH 16/30] Extend blacklisting of tst_QWidget::maskedUpdate to openSUSE 42.3 Task-number: QTBUG-51399 Change-Id: I7fcc52da2ce539251f6bad0394c4580dd76439a7 Reviewed-by: Heikki Halmet --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 07505264644..010e96467c6 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -60,6 +60,7 @@ osx [maskedUpdate] osx opensuse-42.1 +opensuse-42.3 [hideWhenFocusWidgetIsChild] osx-10.10 [hideOpaqueChildWhileHidden] From 52bda430af2749da1a0467b71d9cca5208f22402 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 29 Aug 2017 09:56:36 +0200 Subject: [PATCH 17/30] macOS: Reset composition when focus object changes inside window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the focus object inside a window changes and we are currently composing text, we have to cancel composition to avoid getting into an inconsistent state. This is what already happens if you switch to a different top level window. Note: Because we limit the user's ability to change focus inside a window when composing text, this would only happen under certain circumstances, such as creating a new MDI window with an editor while still composing text in a previous one. [ChangeLog][macOS] Switching focus objects inside a top level window while composing text using dead keys or input method events would leave the application in an inconsistent state. The composition now automatically cancels when the focus object changes. Task-number: QTBUG-59222 Change-Id: I06792a7db1441dcc5c87e4bf0861b422a25f7f7c Reviewed-by: Tor Arne Vestbø --- .../platforms/cocoa/qcocoainputcontext.mm | 17 +++++++++++++- src/plugins/platforms/cocoa/qnsview.h | 2 ++ src/plugins/platforms/cocoa/qnsview.mm | 22 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.mm b/src/plugins/platforms/cocoa/qcocoainputcontext.mm index 9e3d747cd7f..9221099a57a 100644 --- a/src/plugins/platforms/cocoa/qcocoainputcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoainputcontext.mm @@ -124,7 +124,22 @@ void QCocoaInputContext::connectSignals() void QCocoaInputContext::focusObjectChanged(QObject *focusObject) { Q_UNUSED(focusObject); - mWindow = QGuiApplication::focusWindow(); + if (mWindow == QGuiApplication::focusWindow()) { + if (!mWindow) + return; + + QCocoaWindow *window = static_cast(mWindow->handle()); + QNSView *view = qnsview_cast(window->view()); + if (!view) + return; + + if (NSTextInputContext *ctxt = [NSTextInputContext currentInputContext]) { + [ctxt discardMarkedText]; + [view cancelComposingText]; + } + } else { + mWindow = QGuiApplication::focusWindow(); + } } void QCocoaInputContext::updateLocale() diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index c37c45ce80f..384f14ba3ad 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -70,6 +70,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); Qt::MouseButtons m_acceptedMouseDowns; Qt::MouseButtons m_frameStrutButtons; QString m_composingText; + QPointer m_composingFocusObject; bool m_sendKeyEvent; QStringList *currentCustomDragTypes; bool m_sendUpAsRightButton; @@ -104,6 +105,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); - (void)viewDidHide; - (void)viewDidUnhide; - (void)removeFromSuperview; +- (void)cancelComposingText; - (BOOL)isFlipped; - (BOOL)acceptsFirstResponder; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index a40bdfd314a..ba5c0ea25df 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1712,6 +1712,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } m_composingText.clear(); + m_composingFocusObject = nullptr; } - (void) setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange @@ -1766,6 +1767,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_composingText = preeditString; if (QObject *fo = m_platformWindow->window()->focusObject()) { + m_composingFocusObject = fo; QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1778,6 +1780,25 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } } +- (void)cancelComposingText +{ + if (m_composingText.isEmpty()) + return; + + if (m_composingFocusObject) { + QInputMethodQueryEvent queryEvent(Qt::ImEnabled); + if (QCoreApplication::sendEvent(m_composingFocusObject, &queryEvent)) { + if (queryEvent.value(Qt::ImEnabled).toBool()) { + QInputMethodEvent e; + QCoreApplication::sendEvent(m_composingFocusObject, &e); + } + } + } + + m_composingText.clear(); + m_composingFocusObject = nullptr; +} + - (void) unmarkText { if (!m_composingText.isEmpty()) { @@ -1793,6 +1814,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } } m_composingText.clear(); + m_composingFocusObject = nullptr; } - (BOOL) hasMarkedText From 7d323397628e808f49ee9477515a35d743afd131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Fiestas?= Date: Sun, 15 Jan 2017 00:54:43 +0100 Subject: [PATCH 18/30] Pass m_drag_icon_window to getNativeMousePos instead of Event QObject The QWindow passed to eventFilter is static so it might be in a different screen when we call getNativeMousePos, resulting in negative position and all sorts of glitches. Change-Id: Ibc848c6d85d8b6932ee379aa77851094212a0db2 Reviewed-by: David Edmundson Reviewed-by: Friedemann Kleint --- src/gui/kernel/qsimpledrag.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index fc622733259..a1e25dc53c0 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -117,9 +117,9 @@ void QBasicDrag::disableEventFilter() } -static inline QPoint getNativeMousePos(QEvent *e, QObject *o) +static inline QPoint getNativeMousePos(QEvent *e, QWindow *window) { - return QHighDpi::toNativePixels(static_cast(e)->globalPos(), qobject_cast(o)); + return QHighDpi::toNativePixels(static_cast(e)->globalPos(), window); } bool QBasicDrag::eventFilter(QObject *o, QEvent *e) @@ -156,14 +156,14 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) case QEvent::MouseMove: { - QPoint nativePosition = getNativeMousePos(e, o); + QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); move(nativePosition); return true; // Eat all mouse move events } case QEvent::MouseButtonRelease: disableEventFilter(); if (canDrop()) { - QPoint nativePosition = getNativeMousePos(e, o); + QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); drop(nativePosition); } else { cancel(); From e8e0895a335d76b594fc1e2fe9d97d4776d09c86 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 4 Sep 2017 23:46:17 +0200 Subject: [PATCH 19/30] PCRE2: disable JIT on all UIKit platforms Both iOS and tvOS need to have JIT disabled, so use the uikit qmake scope for that. This was already done for PCRE 1, but the corresponding change was lost for PCRE 2 (probably due to a bad merge). Change-Id: Iac7997880c13b34ced46c63b748980c6fb700a0f Task-number: QTBUG-62993 Reviewed-by: Thiago Macieira Reviewed-by: Jake Petroules --- src/3rdparty/pcre2/pcre2.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/pcre2/pcre2.pro b/src/3rdparty/pcre2/pcre2.pro index 855788ffa4b..3dde2f62f83 100644 --- a/src/3rdparty/pcre2/pcre2.pro +++ b/src/3rdparty/pcre2/pcre2.pro @@ -15,7 +15,7 @@ load(qt_helper_lib) DEFINES += HAVE_CONFIG_H # platform/compiler specific definitions -ios|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT +uikit|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT SOURCES += \ $$PWD/src/pcre2_auto_possess.c \ From c7766a41e3dc71b86fbff424735457388e4e4f73 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 4 Sep 2017 14:43:55 +0200 Subject: [PATCH 20/30] PCRE2: remove pcre2_printint.c from the imported sources Follow up of fc37e0369929e265db4fa3b9fa75164d63d66d1e: while the file is #included from pcre2_compile.c, it's never actually compiled (seems to be about a debugging aid for developing PCRE2). So it's safe to get rid of it. Change-Id: I0affaad730e8c5678d3431e47d5fee0dbedc0e78 Reviewed-by: Thiago Macieira --- .../pcre2/import_from_pcre2_tarball.sh | 1 - src/3rdparty/pcre2/src/pcre2_printint.c | 832 ------------------ 2 files changed, 833 deletions(-) delete mode 100644 src/3rdparty/pcre2/src/pcre2_printint.c diff --git a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh index 9e9c90b4bf6..dc2fb05453a 100755 --- a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh +++ b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh @@ -100,7 +100,6 @@ FILES=" src/pcre2_newline.c src/pcre2_ord2utf.c src/pcre2_pattern_info.c - src/pcre2_printint.c src/pcre2_serialize.c src/pcre2_string_utils.c src/pcre2_study.c diff --git a/src/3rdparty/pcre2/src/pcre2_printint.c b/src/3rdparty/pcre2/src/pcre2_printint.c deleted file mode 100644 index 2d30926a744..00000000000 --- a/src/3rdparty/pcre2/src/pcre2_printint.c +++ /dev/null @@ -1,832 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - - Written by Philip Hazel - Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016 University of Cambridge - ------------------------------------------------------------------------------ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the University of Cambridge nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ -*/ - - -/* This module contains a PCRE private debugging function for printing out the -internal form of a compiled regular expression, along with some supporting -local functions. This source file is #included in pcre2test.c at each supported -code unit width, with PCRE2_SUFFIX set appropriately, just like the functions -that comprise the library. It can also optionally be included in -pcre2_compile.c for detailed debugging in error situations. */ - - -/* Tables of operator names. The same 8-bit table is used for all code unit -widths, so it must be defined only once. The list itself is defined in -pcre2_internal.h, which is #included by pcre2test before this file. */ - -#ifndef OP_LISTS_DEFINED -static const char *OP_names[] = { OP_NAME_LIST }; -#define OP_LISTS_DEFINED -#endif - -/* The functions and tables herein must all have mode-dependent names. */ - -#define OP_lengths PCRE2_SUFFIX(OP_lengths_) -#define get_ucpname PCRE2_SUFFIX(get_ucpname_) -#define pcre2_printint PCRE2_SUFFIX(pcre2_printint_) -#define print_char PCRE2_SUFFIX(print_char_) -#define print_custring PCRE2_SUFFIX(print_custring_) -#define print_custring_bylen PCRE2_SUFFIX(print_custring_bylen_) -#define print_prop PCRE2_SUFFIX(print_prop_) - -/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that -the definition is next to the definition of the opcodes in pcre2_internal.h. -The contents of the table are, however, mode-dependent. */ - -static const uint8_t OP_lengths[] = { OP_LENGTHS }; - - - -/************************************************* -* Print one character from a string * -*************************************************/ - -/* In UTF mode the character may occupy more than one code unit. - -Arguments: - f file to write to - ptr pointer to first code unit of the character - utf TRUE if string is UTF (will be FALSE if UTF is not supported) - -Returns: number of additional code units used -*/ - -static unsigned int -print_char(FILE *f, PCRE2_SPTR ptr, BOOL utf) -{ -uint32_t c = *ptr; -BOOL one_code_unit = !utf; - -/* If UTF is supported and requested, check for a valid single code unit. */ - -#ifdef SUPPORT_UNICODE -if (utf) - { -#if PCRE2_CODE_UNIT_WIDTH == 8 - one_code_unit = c < 0x80; -#elif PCRE2_CODE_UNIT_WIDTH == 16 - one_code_unit = (c & 0xfc00) != 0xd800; -#else - one_code_unit = (c & 0xfffff800u) != 0xd800u; -#endif /* CODE_UNIT_WIDTH */ - } -#endif /* SUPPORT_UNICODE */ - -/* Handle a valid one-code-unit character at any width. */ - -if (one_code_unit) - { - if (PRINTABLE(c)) fprintf(f, "%c", (char)c); - else if (c < 0x80) fprintf(f, "\\x%02x", c); - else fprintf(f, "\\x{%02x}", c); - return 0; - } - -/* Code for invalid UTF code units and multi-unit UTF characters is different -for each width. If UTF is not supported, control should never get here, but we -need a return statement to keep the compiler happy. */ - -#ifndef SUPPORT_UNICODE -return 0; -#else - -/* Malformed UTF-8 should occur only if the sanity check has been turned off. -Rather than swallow random bytes, just stop if we hit a bad one. Print it with -\X instead of \x as an indication. */ - -#if PCRE2_CODE_UNIT_WIDTH == 8 -if ((c & 0xc0) != 0xc0) - { - fprintf(f, "\\X{%x}", c); /* Invalid starting byte */ - return 0; - } -else - { - int i; - int a = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes */ - int s = 6*a; - c = (c & PRIV(utf8_table3)[a]) << s; - for (i = 1; i <= a; i++) - { - if ((ptr[i] & 0xc0) != 0x80) - { - fprintf(f, "\\X{%x}", c); /* Invalid secondary byte */ - return i - 1; - } - s -= 6; - c |= (ptr[i] & 0x3f) << s; - } - fprintf(f, "\\x{%x}", c); - return a; -} -#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */ - -/* UTF-16: rather than swallow a low surrogate, just stop if we hit a bad one. -Print it with \X instead of \x as an indication. */ - -#if PCRE2_CODE_UNIT_WIDTH == 16 -if ((ptr[1] & 0xfc00) != 0xdc00) - { - fprintf(f, "\\X{%x}", c); - return 0; - } -c = (((c & 0x3ff) << 10) | (ptr[1] & 0x3ff)) + 0x10000; -fprintf(f, "\\x{%x}", c); -return 1; -#endif /* PCRE2_CODE_UNIT_WIDTH == 16 */ - -/* For UTF-32 we get here only for a malformed code unit, which should only -occur if the sanity check has been turned off. Print it with \X instead of \x -as an indication. */ - -#if PCRE2_CODE_UNIT_WIDTH == 32 -fprintf(f, "\\X{%x}", c); -return 0; -#endif /* PCRE2_CODE_UNIT_WIDTH == 32 */ -#endif /* SUPPORT_UNICODE */ -} - - - -/************************************************* -* Print string as a list of code units * -*************************************************/ - -/* These take no account of UTF as they always print each individual code unit. -The string is zero-terminated for print_custring(); the length is given for -print_custring_bylen(). - -Arguments: - f file to write to - ptr point to the string - len length for print_custring_bylen() - -Returns: nothing -*/ - -static void -print_custring(FILE *f, PCRE2_SPTR ptr) -{ -while (*ptr != '\0') - { - register uint32_t c = *ptr++; - if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c); - } -} - -static void -print_custring_bylen(FILE *f, PCRE2_SPTR ptr, PCRE2_UCHAR len) -{ -for (; len > 0; len--) - { - register uint32_t c = *ptr++; - if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c); - } -} - - - -/************************************************* -* Find Unicode property name * -*************************************************/ - -/* When there is no UTF/UCP support, the table of names does not exist. This -function should not be called in such configurations, because a pattern that -tries to use Unicode properties won't compile. Rather than put lots of #ifdefs -into the main code, however, we just put one into this function. */ - -static const char * -get_ucpname(unsigned int ptype, unsigned int pvalue) -{ -#ifdef SUPPORT_UNICODE -int i; -for (i = PRIV(utt_size) - 1; i >= 0; i--) - { - if (ptype == PRIV(utt)[i].type && pvalue == PRIV(utt)[i].value) break; - } -return (i >= 0)? PRIV(utt_names) + PRIV(utt)[i].name_offset : "??"; -#else /* No UTF support */ -(void)ptype; -(void)pvalue; -return "??"; -#endif /* SUPPORT_UNICODE */ -} - - - -/************************************************* -* Print Unicode property value * -*************************************************/ - -/* "Normal" properties can be printed from tables. The PT_CLIST property is a -pseudo-property that contains a pointer to a list of case-equivalent -characters. - -Arguments: - f file to write to - code pointer in the compiled code - before text to print before - after text to print after - -Returns: nothing -*/ - -static void -print_prop(FILE *f, PCRE2_SPTR code, const char *before, const char *after) -{ -if (code[1] != PT_CLIST) - { - fprintf(f, "%s%s %s%s", before, OP_names[*code], get_ucpname(code[1], - code[2]), after); - } -else - { - const char *not = (*code == OP_PROP)? "" : "not "; - const uint32_t *p = PRIV(ucd_caseless_sets) + code[2]; - fprintf (f, "%s%sclist", before, not); - while (*p < NOTACHAR) fprintf(f, " %04x", *p++); - fprintf(f, "%s", after); - } -} - - - -/************************************************* -* Print compiled pattern * -*************************************************/ - -/* The print_lengths flag controls whether offsets and lengths of items are -printed. Lenths can be turned off from pcre2test so that automatic tests on -bytecode can be written that do not depend on the value of LINK_SIZE. - -Arguments: - re a compiled pattern - f the file to write to - print_lengths show various lengths - -Returns: nothing -*/ - -static void -pcre2_printint(pcre2_code *re, FILE *f, BOOL print_lengths) -{ -PCRE2_SPTR codestart, nametable, code; -uint32_t nesize = re->name_entry_size; -BOOL utf = (re->overall_options & PCRE2_UTF) != 0; - -nametable = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code)); -code = codestart = nametable + re->name_count * re->name_entry_size; - -for(;;) - { - PCRE2_SPTR ccode; - uint32_t c; - int i; - const char *flag = " "; - unsigned int extra = 0; - - if (print_lengths) - fprintf(f, "%3d ", (int)(code - codestart)); - else - fprintf(f, " "); - - switch(*code) - { -/* ========================================================================== */ - /* These cases are never obeyed. This is a fudge that causes a compile- - time error if the vectors OP_names or OP_lengths, which are indexed - by opcode, are not the correct length. It seems to be the only way to do - such a check at compile time, as the sizeof() operator does not work in - the C preprocessor. */ - - case OP_TABLE_LENGTH: - case OP_TABLE_LENGTH + - ((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) && - (sizeof(OP_lengths) == OP_TABLE_LENGTH)): - break; -/* ========================================================================== */ - - case OP_END: - fprintf(f, " %s\n", OP_names[*code]); - fprintf(f, "------------------------------------------------------------------\n"); - return; - - case OP_CHAR: - fprintf(f, " "); - do - { - code++; - code += 1 + print_char(f, code, utf); - } - while (*code == OP_CHAR); - fprintf(f, "\n"); - continue; - - case OP_CHARI: - fprintf(f, " /i "); - do - { - code++; - code += 1 + print_char(f, code, utf); - } - while (*code == OP_CHARI); - fprintf(f, "\n"); - continue; - - case OP_CBRA: - case OP_CBRAPOS: - case OP_SCBRA: - case OP_SCBRAPOS: - if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); - else fprintf(f, " "); - fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE)); - break; - - case OP_BRA: - case OP_BRAPOS: - case OP_SBRA: - case OP_SBRAPOS: - case OP_KETRMAX: - case OP_KETRMIN: - case OP_KETRPOS: - case OP_ALT: - case OP_KET: - case OP_ASSERT: - case OP_ASSERT_NOT: - case OP_ASSERTBACK: - case OP_ASSERTBACK_NOT: - case OP_ONCE: - case OP_ONCE_NC: - case OP_COND: - case OP_SCOND: - case OP_REVERSE: - if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); - else fprintf(f, " "); - fprintf(f, "%s", OP_names[*code]); - break; - - case OP_CLOSE: - fprintf(f, " %s %d", OP_names[*code], GET2(code, 1)); - break; - - case OP_CREF: - fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]); - break; - - case OP_DNCREF: - { - PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE; - fprintf(f, " %s Cond ref <", flag); - print_custring(f, entry); - fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE)); - } - break; - - case OP_RREF: - c = GET2(code, 1); - if (c == RREF_ANY) - fprintf(f, " Cond recurse any"); - else - fprintf(f, " Cond recurse %d", c); - break; - - case OP_DNRREF: - { - PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE; - fprintf(f, " %s Cond recurse <", flag); - print_custring(f, entry); - fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE)); - } - break; - - case OP_FALSE: - fprintf(f, " Cond false"); - break; - - case OP_TRUE: - fprintf(f, " Cond true"); - break; - - case OP_STARI: - case OP_MINSTARI: - case OP_POSSTARI: - case OP_PLUSI: - case OP_MINPLUSI: - case OP_POSPLUSI: - case OP_QUERYI: - case OP_MINQUERYI: - case OP_POSQUERYI: - flag = "/i"; - /* Fall through */ - case OP_STAR: - case OP_MINSTAR: - case OP_POSSTAR: - case OP_PLUS: - case OP_MINPLUS: - case OP_POSPLUS: - case OP_QUERY: - case OP_MINQUERY: - case OP_POSQUERY: - case OP_TYPESTAR: - case OP_TYPEMINSTAR: - case OP_TYPEPOSSTAR: - case OP_TYPEPLUS: - case OP_TYPEMINPLUS: - case OP_TYPEPOSPLUS: - case OP_TYPEQUERY: - case OP_TYPEMINQUERY: - case OP_TYPEPOSQUERY: - fprintf(f, " %s ", flag); - - if (*code >= OP_TYPESTAR) - { - if (code[1] == OP_PROP || code[1] == OP_NOTPROP) - { - print_prop(f, code + 1, "", " "); - extra = 2; - } - else fprintf(f, "%s", OP_names[code[1]]); - } - else extra = print_char(f, code+1, utf); - fprintf(f, "%s", OP_names[*code]); - break; - - case OP_EXACTI: - case OP_UPTOI: - case OP_MINUPTOI: - case OP_POSUPTOI: - flag = "/i"; - /* Fall through */ - case OP_EXACT: - case OP_UPTO: - case OP_MINUPTO: - case OP_POSUPTO: - fprintf(f, " %s ", flag); - extra = print_char(f, code + 1 + IMM2_SIZE, utf); - fprintf(f, "{"); - if (*code != OP_EXACT && *code != OP_EXACTI) fprintf(f, "0,"); - fprintf(f, "%d}", GET2(code,1)); - if (*code == OP_MINUPTO || *code == OP_MINUPTOI) fprintf(f, "?"); - else if (*code == OP_POSUPTO || *code == OP_POSUPTOI) fprintf(f, "+"); - break; - - case OP_TYPEEXACT: - case OP_TYPEUPTO: - case OP_TYPEMINUPTO: - case OP_TYPEPOSUPTO: - if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP) - { - print_prop(f, code + IMM2_SIZE + 1, " ", " "); - extra = 2; - } - else fprintf(f, " %s", OP_names[code[1 + IMM2_SIZE]]); - fprintf(f, "{"); - if (*code != OP_TYPEEXACT) fprintf(f, "0,"); - fprintf(f, "%d}", GET2(code,1)); - if (*code == OP_TYPEMINUPTO) fprintf(f, "?"); - else if (*code == OP_TYPEPOSUPTO) fprintf(f, "+"); - break; - - case OP_NOTI: - flag = "/i"; - /* Fall through */ - case OP_NOT: - fprintf(f, " %s [^", flag); - extra = print_char(f, code + 1, utf); - fprintf(f, "]"); - break; - - case OP_NOTSTARI: - case OP_NOTMINSTARI: - case OP_NOTPOSSTARI: - case OP_NOTPLUSI: - case OP_NOTMINPLUSI: - case OP_NOTPOSPLUSI: - case OP_NOTQUERYI: - case OP_NOTMINQUERYI: - case OP_NOTPOSQUERYI: - flag = "/i"; - /* Fall through */ - - case OP_NOTSTAR: - case OP_NOTMINSTAR: - case OP_NOTPOSSTAR: - case OP_NOTPLUS: - case OP_NOTMINPLUS: - case OP_NOTPOSPLUS: - case OP_NOTQUERY: - case OP_NOTMINQUERY: - case OP_NOTPOSQUERY: - fprintf(f, " %s [^", flag); - extra = print_char(f, code + 1, utf); - fprintf(f, "]%s", OP_names[*code]); - break; - - case OP_NOTEXACTI: - case OP_NOTUPTOI: - case OP_NOTMINUPTOI: - case OP_NOTPOSUPTOI: - flag = "/i"; - /* Fall through */ - - case OP_NOTEXACT: - case OP_NOTUPTO: - case OP_NOTMINUPTO: - case OP_NOTPOSUPTO: - fprintf(f, " %s [^", flag); - extra = print_char(f, code + 1 + IMM2_SIZE, utf); - fprintf(f, "]{"); - if (*code != OP_NOTEXACT && *code != OP_NOTEXACTI) fprintf(f, "0,"); - fprintf(f, "%d}", GET2(code,1)); - if (*code == OP_NOTMINUPTO || *code == OP_NOTMINUPTOI) fprintf(f, "?"); - else - if (*code == OP_NOTPOSUPTO || *code == OP_NOTPOSUPTOI) fprintf(f, "+"); - break; - - case OP_RECURSE: - if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); - else fprintf(f, " "); - fprintf(f, "%s", OP_names[*code]); - break; - - case OP_REFI: - flag = "/i"; - /* Fall through */ - case OP_REF: - fprintf(f, " %s \\%d", flag, GET2(code,1)); - ccode = code + OP_lengths[*code]; - goto CLASS_REF_REPEAT; - - case OP_DNREFI: - flag = "/i"; - /* Fall through */ - case OP_DNREF: - { - PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE; - fprintf(f, " %s \\k<", flag); - print_custring(f, entry); - fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE)); - } - ccode = code + OP_lengths[*code]; - goto CLASS_REF_REPEAT; - - case OP_CALLOUT: - fprintf(f, " %s %d %d %d", OP_names[*code], code[1 + 2*LINK_SIZE], - GET(code, 1), GET(code, 1 + LINK_SIZE)); - break; - - case OP_CALLOUT_STR: - c = code[1 + 4*LINK_SIZE]; - fprintf(f, " %s %c", OP_names[*code], c); - extra = GET(code, 1 + 2*LINK_SIZE); - print_custring_bylen(f, code + 2 + 4*LINK_SIZE, extra - 3 - 4*LINK_SIZE); - for (i = 0; PRIV(callout_start_delims)[i] != 0; i++) - if (c == PRIV(callout_start_delims)[i]) - { - c = PRIV(callout_end_delims)[i]; - break; - } - fprintf(f, "%c %d %d %d", c, GET(code, 1 + 3*LINK_SIZE), GET(code, 1), - GET(code, 1 + LINK_SIZE)); - break; - - case OP_PROP: - case OP_NOTPROP: - print_prop(f, code, " ", ""); - break; - - /* OP_XCLASS cannot occur in 8-bit, non-UTF mode. However, there's no harm - in having this code always here, and it makes it less messy without all - those #ifdefs. */ - - case OP_CLASS: - case OP_NCLASS: - case OP_XCLASS: - { - unsigned int min, max; - BOOL printmap; - BOOL invertmap = FALSE; - uint8_t *map; - uint8_t inverted_map[32]; - - fprintf(f, " ["); - - if (*code == OP_XCLASS) - { - extra = GET(code, 1); - ccode = code + LINK_SIZE + 1; - printmap = (*ccode & XCL_MAP) != 0; - if ((*ccode & XCL_NOT) != 0) - { - invertmap = (*ccode & XCL_HASPROP) == 0; - fprintf(f, "^"); - } - ccode++; - } - else - { - printmap = TRUE; - ccode = code + 1; - } - - /* Print a bit map */ - - if (printmap) - { - map = (uint8_t *)ccode; - if (invertmap) - { - for (i = 0; i < 32; i++) inverted_map[i] = ~map[i]; - map = inverted_map; - } - - for (i = 0; i < 256; i++) - { - if ((map[i/8] & (1 << (i&7))) != 0) - { - int j; - for (j = i+1; j < 256; j++) - if ((map[j/8] & (1 << (j&7))) == 0) break; - if (i == '-' || i == ']') fprintf(f, "\\"); - if (PRINTABLE(i)) fprintf(f, "%c", i); - else fprintf(f, "\\x%02x", i); - if (--j > i) - { - if (j != i + 1) fprintf(f, "-"); - if (j == '-' || j == ']') fprintf(f, "\\"); - if (PRINTABLE(j)) fprintf(f, "%c", j); - else fprintf(f, "\\x%02x", j); - } - i = j; - } - } - ccode += 32 / sizeof(PCRE2_UCHAR); - } - - /* For an XCLASS there is always some additional data */ - - if (*code == OP_XCLASS) - { - PCRE2_UCHAR ch; - while ((ch = *ccode++) != XCL_END) - { - BOOL not = FALSE; - const char *notch = ""; - - switch(ch) - { - case XCL_NOTPROP: - not = TRUE; - notch = "^"; - /* Fall through */ - - case XCL_PROP: - { - unsigned int ptype = *ccode++; - unsigned int pvalue = *ccode++; - - switch(ptype) - { - case PT_PXGRAPH: - fprintf(f, "[:%sgraph:]", notch); - break; - - case PT_PXPRINT: - fprintf(f, "[:%sprint:]", notch); - break; - - case PT_PXPUNCT: - fprintf(f, "[:%spunct:]", notch); - break; - - default: - fprintf(f, "\\%c{%s}", (not? 'P':'p'), - get_ucpname(ptype, pvalue)); - break; - } - } - break; - - default: - ccode += 1 + print_char(f, ccode, utf); - if (ch == XCL_RANGE) - { - fprintf(f, "-"); - ccode += 1 + print_char(f, ccode, utf); - } - break; - } - } - } - - /* Indicate a non-UTF class which was created by negation */ - - fprintf(f, "]%s", (*code == OP_NCLASS)? " (neg)" : ""); - - /* Handle repeats after a class or a back reference */ - - CLASS_REF_REPEAT: - switch(*ccode) - { - case OP_CRSTAR: - case OP_CRMINSTAR: - case OP_CRPLUS: - case OP_CRMINPLUS: - case OP_CRQUERY: - case OP_CRMINQUERY: - case OP_CRPOSSTAR: - case OP_CRPOSPLUS: - case OP_CRPOSQUERY: - fprintf(f, "%s", OP_names[*ccode]); - extra += OP_lengths[*ccode]; - break; - - case OP_CRRANGE: - case OP_CRMINRANGE: - case OP_CRPOSRANGE: - min = GET2(ccode,1); - max = GET2(ccode,1 + IMM2_SIZE); - if (max == 0) fprintf(f, "{%u,}", min); - else fprintf(f, "{%u,%u}", min, max); - if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); - else if (*ccode == OP_CRPOSRANGE) fprintf(f, "+"); - extra += OP_lengths[*ccode]; - break; - - /* Do nothing if it's not a repeat; this code stops picky compilers - warning about the lack of a default code path. */ - - default: - break; - } - } - break; - - case OP_MARK: - case OP_PRUNE_ARG: - case OP_SKIP_ARG: - case OP_THEN_ARG: - fprintf(f, " %s ", OP_names[*code]); - print_custring_bylen(f, code + 2, code[1]); - extra += code[1]; - break; - - case OP_THEN: - fprintf(f, " %s", OP_names[*code]); - break; - - case OP_CIRCM: - case OP_DOLLM: - flag = "/m"; - /* Fall through */ - - /* Anything else is just an item with no data, but possibly a flag. */ - - default: - fprintf(f, " %s %s", flag, OP_names[*code]); - break; - } - - code += OP_lengths[*code] + extra; - fprintf(f, "\n"); - } -} - -/* End of pcre2_printint.c */ From 0adc14d8dbdd9e28ccb72c49d865009dd8df1b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 4 Sep 2017 12:55:19 +0200 Subject: [PATCH 21/30] =?UTF-8?q?macOS:=20Don=E2=80=99t=20color=20convert?= =?UTF-8?q?=20the=20backing=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The backing store was assigned the sRGB color profile as an unintended side effect of the QImage -> CGImage conversion function refactoring in ac899f6d. This caused Core Graphics to add a color convert step, which in some cases caused performance issues. Restore fast, previous behavior by assigning the target display color profile to the backing store image. Color correctness is still a goal, but we’ll add API for it and make it opt-in. Task-number: QTBUG-61384 Change-Id: I107f06a881a34fa711b386265d8dc2edfb246624 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ba5c0ea25df..04e02a274a2 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -516,7 +516,13 @@ static bool _q_dontOverrideCtrlLMB = false; dirtyBackingRect.size.height ); CGImageRef bsCGImage = qt_mac_toCGImage(m_backingStore->toImage()); - CGImageRef cleanImg = CGImageCreateWithImageInRect(bsCGImage, backingStoreRect); + + // Prevent potentially costly color conversion by assiging the display + // color space to the backingstore image. + CGImageRef displayColorSpaceImage = CGImageCreateCopyWithColorSpace(bsCGImage, + self.window.screen.colorSpace.CGColorSpace); + + CGImageRef cleanImg = CGImageCreateWithImageInRect(displayColorSpaceImage, backingStoreRect); // Optimization: Copy frame buffer content instead of blending for // top-level windows where Qt fills the entire window content area. @@ -531,6 +537,7 @@ static bool _q_dontOverrideCtrlLMB = false; CGImageRelease(cleanImg); CGImageRelease(subMask); CGImageRelease(bsCGImage); + CGImageRelease(displayColorSpaceImage); } - (BOOL) isFlipped From d64940891dffcb951f4b76426490cbc94fb4aba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 2 Jun 2017 14:08:32 +0200 Subject: [PATCH 22/30] Add qmake feature and configure option to use ccache Enabled via configure --ccache, or CONFIG += ccache in 3rd party projects. Ensures that we use the right sloppiness and other ccache options during compilation. Task-number: QTBUG-31034 Change-Id: I696b3d3f0398873a29b93d1bc2b4d4e06ef23dc9 Reviewed-by: Oswald Buddenhagen --- config_help.txt | 1 + configure.json | 17 +++++++++++++++++ mkspecs/features/unix/ccache.prf | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 mkspecs/features/unix/ccache.prf diff --git a/config_help.txt b/config_help.txt index d1b0ac56b07..f06584a480d 100644 --- a/config_help.txt +++ b/config_help.txt @@ -144,6 +144,7 @@ Build options: -ltcg ................ Use Link Time Code Generation [no] -use-gold-linker ..... Use the GNU gold linker [auto] -incredibuild-xge .... Use the IncrediBuild XGE [no] (Windows only) + -ccache .............. Use the ccache compiler cache [no] (Unix only) -make-tool .... Use to build qmake [nmake] (Windows only) -mp .................. Use multiple processors for compilation (MSVC only) diff --git a/configure.json b/configure.json index 6221c9803ac..a91456aaf34 100644 --- a/configure.json +++ b/configure.json @@ -61,6 +61,7 @@ "avx2": "boolean", "avx512": { "type": "boolean", "name": "avx512f" }, "c++std": "cxxstd", + "ccache": { "type": "boolean", "name": "ccache" }, "commercial": "void", "compile-examples": { "type": "boolean", "name": "compile_examples" }, "confirm-license": "void", @@ -620,6 +621,11 @@ "label": "IncrediBuild", "type": "files", "files": [ "BuildConsole.exe", "xgConsole.exe" ] + }, + "ccache": { + "label": "ccache", + "type": "files", + "files": [ "ccache" ] } }, @@ -1206,6 +1212,12 @@ "condition": "tests.incredibuild_xge", "output": [ "publicConfig" ] }, + "ccache": { + "label": "Using ccache", + "autoDetect": false, + "condition": "config.unix && tests.ccache", + "output": [ "privateConfig" ] + }, "msvc_mp": { "label": "Use multiple processors when compiling with MSVC", "emitIf": "config.msvc", @@ -1313,6 +1325,11 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5 "type": "firstAvailableFeature", "args": "c++1z c++14 c++11" }, + { + "type": "feature", + "args": "ccache", + "condition": "config.unix" + }, "use_gold_linker", { "type": "feature", diff --git a/mkspecs/features/unix/ccache.prf b/mkspecs/features/unix/ccache.prf new file mode 100644 index 00000000000..d5739d3eaba --- /dev/null +++ b/mkspecs/features/unix/ccache.prf @@ -0,0 +1,19 @@ +macx-xcode: return() + +darwin: load(sdk) + +ccache_prefix = ccache + +precompile_header { + CCACHE_SLOPPINESS += pch_defines time_macros + + ccache_prefix = \ + CCACHE_SLOPPINESS=\"$$join(CCACHE_SLOPPINESS, ',')\$${CCACHE_SLOPPINESS+,\$$CCACHE_SLOPPINESS}\" \ + # Make sure we build sources directly, not from their preprocessed version, + # otherwise precompiled headers will not be used during cache misses. + CCACHE_CPP2=true \ + $$ccache_prefix +} + +for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_LINK_C)): \ + $$tool = $$ccache_prefix $$eval($$tool) From b3717fc7f01ae078faf066538ddc80fca016ef0c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Aug 2017 16:21:17 +0200 Subject: [PATCH 23/30] OpenGL examples: Introduce QCommandLineParser Task-number: QTBUG-60626 Change-Id: I6d102327c89206fcdce10f3ac04e112270b11ad2 Reviewed-by: Laszlo Agocs --- examples/opengl/hellogl2/glwidget.cpp | 5 ++-- examples/opengl/hellogl2/glwidget.h | 5 +++- examples/opengl/hellogl2/main.cpp | 27 ++++++++++++++++--- examples/opengl/hellowindow/main.cpp | 27 ++++++++++++++++--- examples/opengl/qopenglwidget/main.cpp | 15 ++++++++++- .../opengl/threadedqopenglwidget/main.cpp | 15 ++++++++++- 6 files changed, 82 insertions(+), 12 deletions(-) diff --git a/examples/opengl/hellogl2/glwidget.cpp b/examples/opengl/hellogl2/glwidget.cpp index fc961da4c4a..f9518ffac5c 100644 --- a/examples/opengl/hellogl2/glwidget.cpp +++ b/examples/opengl/hellogl2/glwidget.cpp @@ -54,6 +54,8 @@ #include #include +bool GLWidget::m_transparent = false; + GLWidget::GLWidget(QWidget *parent) : QOpenGLWidget(parent), m_xRot(0), @@ -61,10 +63,9 @@ GLWidget::GLWidget(QWidget *parent) m_zRot(0), m_program(0) { - m_core = QCoreApplication::arguments().contains(QStringLiteral("--coreprofile")); + m_core = QSurfaceFormat::defaultFormat().profile() == QSurfaceFormat::CoreProfile; // --transparent causes the clear color to be transparent. Therefore, on systems that // support it, the widget will become transparent apart from the logo. - m_transparent = QCoreApplication::arguments().contains(QStringLiteral("--transparent")); if (m_transparent) { QSurfaceFormat fmt = format(); fmt.setAlphaBufferSize(8); diff --git a/examples/opengl/hellogl2/glwidget.h b/examples/opengl/hellogl2/glwidget.h index cff56338935..21dd200dc7d 100644 --- a/examples/opengl/hellogl2/glwidget.h +++ b/examples/opengl/hellogl2/glwidget.h @@ -68,6 +68,9 @@ public: GLWidget(QWidget *parent = 0); ~GLWidget(); + static bool isTransparent() { return m_transparent; } + static void setTransparent(bool t) { m_transparent = t; } + QSize minimumSizeHint() const override; QSize sizeHint() const override; @@ -108,7 +111,7 @@ private: QMatrix4x4 m_proj; QMatrix4x4 m_camera; QMatrix4x4 m_world; - bool m_transparent; + static bool m_transparent; }; #endif diff --git a/examples/opengl/hellogl2/main.cpp b/examples/opengl/hellogl2/main.cpp index 143f659eb65..b52a5a37d34 100644 --- a/examples/opengl/hellogl2/main.cpp +++ b/examples/opengl/hellogl2/main.cpp @@ -51,25 +51,46 @@ #include #include #include +#include +#include +#include "glwidget.h" #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); + QCoreApplication::setApplicationName("Qt Hello GL 2 Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::applicationName()); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption multipleSampleOption("multisample", "Multisampling"); + parser.addOption(multipleSampleOption); + QCommandLineOption coreProfileOption("coreprofile", "Use core profile"); + parser.addOption(coreProfileOption); + QCommandLineOption transparentOption("transparent", "Transparent window"); + parser.addOption(transparentOption); + + parser.process(app); + QSurfaceFormat fmt; fmt.setDepthBufferSize(24); - if (QCoreApplication::arguments().contains(QStringLiteral("--multisample"))) + if (parser.isSet(multipleSampleOption)) fmt.setSamples(4); - if (QCoreApplication::arguments().contains(QStringLiteral("--coreprofile"))) { + if (parser.isSet(coreProfileOption)) { fmt.setVersion(3, 2); fmt.setProfile(QSurfaceFormat::CoreProfile); } QSurfaceFormat::setDefaultFormat(fmt); MainWindow mainWindow; - if (QCoreApplication::arguments().contains(QStringLiteral("--transparent"))) { + + GLWidget::setTransparent(parser.isSet(transparentOption)); + if (GLWidget::isTransparent()) { mainWindow.setAttribute(Qt::WA_TranslucentBackground); mainWindow.setAttribute(Qt::WA_NoSystemBackground, false); } diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp index a20e7002a1e..7f0be39f5d3 100644 --- a/examples/opengl/hellowindow/main.cpp +++ b/examples/opengl/hellowindow/main.cpp @@ -52,6 +52,8 @@ #include +#include +#include #include #include #include @@ -60,9 +62,26 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); + QCoreApplication::setApplicationName("Qt HelloWindow GL Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::applicationName()); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption multipleOption("multiple", "Create multiple windows"); + parser.addOption(multipleOption); + QCommandLineOption multipleSampleOption("multisample", "Multisampling"); + parser.addOption(multipleSampleOption); + QCommandLineOption multipleScreenOption("multiscreen", "Run on multiple screens"); + parser.addOption(multipleScreenOption); + QCommandLineOption timeoutOption("timeout", "Close after 10s"); + parser.addOption(timeoutOption); + parser.process(app); + // Some platforms can only have one window per screen. Therefore we need to differentiate. - const bool multipleWindows = QGuiApplication::arguments().contains(QStringLiteral("--multiple")); - const bool multipleScreens = QGuiApplication::arguments().contains(QStringLiteral("--multiscreen")); + const bool multipleWindows = parser.isSet(multipleOption); + const bool multipleScreens = parser.isSet(multipleScreenOption); QScreen *screen = QGuiApplication::primaryScreen(); @@ -70,7 +89,7 @@ int main(int argc, char *argv[]) QSurfaceFormat format; format.setDepthBufferSize(16); - if (QGuiApplication::arguments().contains(QStringLiteral("--multisample"))) + if (parser.isSet(multipleSampleOption)) format.setSamples(4); QPoint center = QPoint(screenGeometry.center().x(), screenGeometry.top() + 80); @@ -136,7 +155,7 @@ int main(int argc, char *argv[]) } // Quit after 10 seconds. For platforms that do not have windows that are closeable. - if (QCoreApplication::arguments().contains(QStringLiteral("--timeout"))) + if (parser.isSet(timeoutOption)) QTimer::singleShot(10000, qGuiApp, &QCoreApplication::quit); const int exitValue = app.exec(); diff --git a/examples/opengl/qopenglwidget/main.cpp b/examples/opengl/qopenglwidget/main.cpp index d7aa791142b..ea90dca62fb 100644 --- a/examples/opengl/qopenglwidget/main.cpp +++ b/examples/opengl/qopenglwidget/main.cpp @@ -51,6 +51,8 @@ #include #include #include +#include +#include #include "mainwindow.h" int main( int argc, char ** argv ) @@ -58,10 +60,21 @@ int main( int argc, char ** argv ) Q_INIT_RESOURCE(texture); QApplication a( argc, argv ); + QCoreApplication::setApplicationName("Qt QOpenGLWidget Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::applicationName()); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption multipleSampleOption("multisample", "Multisampling"); + parser.addOption(multipleSampleOption); + parser.process(a); + QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); - if (QCoreApplication::arguments().contains(QStringLiteral("--multisample"))) + if (parser.isSet(multipleSampleOption)) format.setSamples(4); QSurfaceFormat::setDefaultFormat(format); diff --git a/examples/opengl/threadedqopenglwidget/main.cpp b/examples/opengl/threadedqopenglwidget/main.cpp index c22cee92280..b9e491040ff 100644 --- a/examples/opengl/threadedqopenglwidget/main.cpp +++ b/examples/opengl/threadedqopenglwidget/main.cpp @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include "mainwindow.h" #include "glwidget.h" @@ -67,6 +69,17 @@ int main( int argc, char ** argv ) { QApplication a( argc, argv ); + QCoreApplication::setApplicationName("Qt Threaded QOpenGLWidget Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::applicationName()); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption singleOption("single", "Single thread"); + parser.addOption(singleOption); + parser.process(a); + QSurfaceFormat format; format.setDepthBufferSize(16); QSurfaceFormat::setDefaultFormat(format); @@ -93,7 +106,7 @@ int main( int argc, char ** argv ) QScopedPointer mw1; QScopedPointer mw2; - if (!QApplication::arguments().contains(QStringLiteral("--single"))) { + if (!parser.isSet(singleOption)) { if (supportsThreading) { pos += QPoint(100, 100); mw1.reset(new MainWindow); From e29b72384b66ac5fba3b287c8f6a3376d0aff852 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Aug 2017 16:19:09 +0200 Subject: [PATCH 24/30] Hello GL2 example: Fix exit crash Bail out of cleanup() when run 2nd time. Task-number: QTBUG-60626 Change-Id: I8a9be2fcfb0e8a5584ce8ed7952affff24bd2a33 Reviewed-by: Laszlo Agocs --- examples/opengl/hellogl2/glwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/opengl/hellogl2/glwidget.cpp b/examples/opengl/hellogl2/glwidget.cpp index f9518ffac5c..318adb5043f 100644 --- a/examples/opengl/hellogl2/glwidget.cpp +++ b/examples/opengl/hellogl2/glwidget.cpp @@ -128,6 +128,8 @@ void GLWidget::setZRotation(int angle) void GLWidget::cleanup() { + if (m_program == nullptr) + return; makeCurrent(); m_logoVbo.destroy(); delete m_program; From 9d8a4d16c6a94bfed172c61618a345130ecaa864 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Sep 2017 08:55:58 +0200 Subject: [PATCH 25/30] Windows QPA: Do not call EnableNonClientDpiScaling() on Desktop GL Windows It causes artifacts when moving the windows between monitors. Amends e8ecde99df8dc8959e1a5af679961cb946ccae69. Task-number: QTBUG-53255 Task-number: QTBUG-62901 Change-Id: Ia8b0f760370887a75efa05bc9736075afebfe069 Reviewed-by: Oliver Wolff --- .../platforms/windows/qwindowscontext.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 9ab131808b0..e6e6ee8b1ae 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -845,6 +846,18 @@ static inline bool resizeOnDpiChanged(const QWindow *w) return result; } +static bool shouldHaveNonClientDpiScaling(const QWindow *window) +{ + return QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 + && window->isTopLevel() + && !window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid() +#if QT_CONFIG(opengl) // /QTBUG-62901, EnableNonClientDpiScaling has problems with GL + && (window->surfaceType() != QSurface::OpenGLSurface + || QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) +#endif + ; +} + /*! \brief Main windows procedure registered for windows. @@ -970,10 +983,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return true; case QtWindows::NonClientCreate: - if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel() - && !d->m_creationContext->window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()) { + if (shouldHaveNonClientDpiScaling(d->m_creationContext->window)) enableNonClientDpiScaling(msg.hwnd); - } return false; case QtWindows::CalculateSize: return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result); From 30609e684f90d07c66114f2ae5144e0d38f52219 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 5 Sep 2017 12:37:10 +0200 Subject: [PATCH 26/30] testlib: Print event coordinates and window size when event is outside of window This gives the user a much clearer understanding of which part of the test caused the warning. Old warning: WARNING: tst_controls::Default::Dial::test_linearInputMode(mouse) Mouse event occurs outside of target window. New warning: WARNING: tst_controls::Default::Dial::test_linearInputMode(mouse) Mouse event at 501, 179 occurs outside of target window (450x450). Change-Id: I2943d79bab5a808e9b5b721758db216b91a07bbd Reviewed-by: Liang Qi Reviewed-by: Friedemann Kleint --- src/testlib/qtestmouse.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 166622e9508..8f55c1801fa 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -94,8 +94,10 @@ namespace QTest extern int Q_TESTLIB_EXPORT defaultMouseDelay(); // pos is in window local coordinates - if (window->geometry().width() <= pos.x() || window->geometry().height() <= pos.y()) { - QTest::qWarn("Mouse event occurs outside of target window."); + const QSize windowSize = window->geometry().size(); + if (windowSize.width() <= pos.x() || windowSize.height() <= pos.y()) { + QTest::qWarn(qPrintable(QString::fromLatin1("Mouse event at %1, %2 occurs outside of target window (%3x%4).") + .arg(pos.x()).arg(pos.y()).arg(windowSize.width()).arg(windowSize.height()))); } if (delay == -1 || delay < defaultMouseDelay()) From 68b8f2d40858457f4c3433af1e700cef04e121bc Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Thu, 24 Aug 2017 12:56:55 +0300 Subject: [PATCH 27/30] Add change file for Qt 5.6.3 Task-number: QTBUG-62722 Change-Id: Ibb2f27774b3080eceead5c2228cf59db382205e3 Reviewed-by: Thiago Macieira --- dist/changes-5.6.3 | 288 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 dist/changes-5.6.3 diff --git a/dist/changes-5.6.3 b/dist/changes-5.6.3 new file mode 100644 index 00000000000..6bda3cefe47 --- /dev/null +++ b/dist/changes-5.6.3 @@ -0,0 +1,288 @@ +Qt 5.6.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with previous Qt 5.6.x releases. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://doc.qt.io/qt-5/index.html + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +***************************************************************************** +* License Changes * +***************************************************************************** + + - Static libraries that are linked into executables (winmain and + qopenglextensions) are now licensed under BSD _and_ commercial licenses. + +****************************************************************************** +* Important Behavior Changes * +****************************************************************************** + + - QPluginLoader: + * [QTBUG-49061] QPluginLoader no longer performs the actual unloading of + the plugin either on destruction or when unload() is called. This does + not affect QLibrary and QLibrary::unload(). + +****************************************************************************** +* Library * +****************************************************************************** + +QtCore +------ + + - QDir: + * [QTBUG-58390] Fixed the implementation of mkpath() to not attempt to + mkdir directories that already exist, especially those in automount + filesystems (like /home). + + - QHash / QMultiHash: + * [QTBUG-60395] Fixed a bug that caused operator== not to return true if + two containers had the elements with duplicate keys but in different + order. + + - QLocale: + * [QTBUG-59159] Fixed the parsing of day-of-week names that start with the + name of another day. + + - QObject: + * [QTBUG-59500] disconnectNotify() is now called when a connection is + disconnected using its QMetaObject::Connection handle. + * [QTBUG-52439] Fixed a bug that would cause applications compiled with the + Intel compiler to fail to connect signals and slots. + + - QUrl: + * [QTBUG-60364] Fixed a bug that caused certain domain names that look + like Internationalized Domain Names to become corrupt in decoded forms + of QUrl, notably toString() and toDisplayString(). + * Updated the table of valid top level domains + + - QVarLengthArray: + * Fixed a bug involving appending an item already in the container to + the container again. + * [QTBUG-57277] Fixed a crash when initializing the array with an empty + std::initializer_list. + +QtSql +----- + + - MySql + * Fixed the build of MySql plugin with MySql 5.0 + * [QTBUG-53397] Fixed the parsing of tinyint(1) when used via prepared + statements. + + - PostgreSQL: + * [QTBUG-59524] Fixed datetime formats when the system locale doesn't use + arabic numerals + +QtDBus +------ + + - QDBusServer + * [QTBUG-55087] Fixed a bug causing certain messages that arrive soon after + the client connects not to be processed. + +QtNetwork +--------- + + - QNetworkInterface + * Fixed the reporting of virtual interfaces on Linux. + + - QSslSocket + * [QTBUG-43388][QTBUG-55170] Fixed a bug that caused the read buffer's max + size not to be respected when using SecureTransport + * [QTBUG-49554] Made sure that the QSslConfiguration is up-to-date when the + QNetworkReply::encrypted() signal is emitted. + +QtGui +----- + + - Various fixes to our high DPI support. + + - CSS parser: + * [QTBUG-53919] Fixed a crash while parsing malformed CSS. + + - PDF writer: + * [QTBUG-56489] Monochrome images are now handled correctly. + + - QImage: + * Fixed a crash when rendering to GrayScale8 images. + * [QTBUG-56252] Fixed an illegal memory access when rotating images. + * [QTBUG-59211] Improved rejection of corrupt images with invalid header + info. + + - QMatrix4x4: + * operator*=() now calculates the correct result even if the RHS and LHS + are the same object. + + - QPainter + * [QTBUG-14614] Fixed a read-after-free when using gradients. + * [QTBUG-56969] Fixed painting artifacts for certain dashed lines. + + - Text: + * [QTBUG-55222] Always return a correct list of fallback fonts + * [QTBUG-55255][QTBUG-56714] Trailing whitespace are now properly taken + into account when shaping lines + * [QTBUG-53911] Fixed a crash that could happen if you were doing many + different text layouts with different fonts and superscript or + subscript alignment. + * [QTBUG-56659] Fixed a regression where raster fonts on Windows were + detected as smoothly scalable and thus rendering with said fonts in Qt + Quick would break. + * [QTBUG-51223] Fixed synthesized oblique for non-latin text on + platforms using the basic font database, such as Android. + * [QTBUG-56714] Fixed a bug where a no-break space would sometimes cause + the first character of the containing line to not be displayed. + * [QTBUG-48005] Fixed clipping errors and too small bounding rects for + some right-to-left text. + * [QTBUG-57241] Fixed a crash for very tall glyphs. + * [QTBUG-55569] Fixed Myanmar rendering with some fonts. + * [QTBUG-56659] Fixed the reporting of whether fonts are smoothly scalable + on Windows. + * [QTBUG-58364][QTBUG-42074][QTBUG-57003] Formatting characters are now + accepted as valid input. + +QtWidgets +--------- + + - Input: + * [QTBUG-42074][QTBUG-57003] Characters in Private Use Area, as well as + zero-width joiners and zero-width non-joiners are now accepted as input + in QLineEdit and QTextEdit. + + - QDockWidget: + * [QTBUG-7460][QTBUG-52354] Size of widgets no longer changed just because + they are in a floating dock. + * [QTBUG-58036] Dock widgets now have the correct parent after a drag. + * [QTBUG-58049] Fixed clearing the dock indicator when not over a floating + dock group window. + + - QMainWindow: + * [QTBUG-56628] Fixed crash using takeCentralWidget when the central + widget was not set. + + - QPixmapStyle: + * Now handles progress bars with minimum != 0 correctly. + + - QPopup + * [QTBUG-57292] Popups blocked by modal dialogs are now properly closed. + + - QTextEdit + * [QTBUG-55758] Placeholder text is no longer shown while composing text. + + - QTooltip: + * [QTBUG-55523] QTooltip is now properly hidden when a close event is + received. + * [QTBUG-55523] Tooltips no longer prevent closing of the app on + lastWindowClosed() + + - QWidget: + * [QTBUG-50589] Show and hide events are now properly sent to children on + minimize/restore. + * [QTBUG-53068] Fixed enter/leave events on popup menus. + + - Style sheets: + * [QTBUG-55597] Now honors the font set on HeaderView section. + +****************************************************************************** +* Platform-specific Changes * +****************************************************************************** + +Android +------- + + - [QTBUG-44697] Removed old work-around which was causing OpenGL shader + compilation to fail on updated Android emulators. + +Darwin +------ + + - [QTBUG-61034] QT_NO_EXCEPTIONS is now correctly set for Objective C++ + source files. + - [QTBUG-57165] Made QDir::tempPath() return the same directory as + NSTemporaryDirectory, instead of a hardcoded "/tmp". + - [QTBUG-55896] Fixed a bug that would cause QFileSystemWatcher to fail to + watch certain paths containing non-ASCII characters. + - [QTBUG-56124] Fixed a bug that would cause data corruption in QSettings + when storing QStrings containing NULs, when storing to native format. + + - iOS specific: + * Starting from iOS 10, Apple requires all apps that need access to photos + to have the key 'NSPhotoLibraryUsageDescription' in the Info.plist. + Therefore, to get the same support in Qt (when, e.g., using a file + dialog), the Info.plist assigned to QMAKE_INFO_PLIST will need this key + as well. + * [QTBUG-49893] The shortcuts bar on iPad is now hidden when showing menus. + + - macOS specific: + * Speech to text dictation now works for Qt text input. + * Various bug fixes to menu bar handling. + +QNX +--- + + - Qt can now handle more than 256 file descriptors open in the same process, + up to a limit of 1000. + +WinRT +----- + + - Various fixes in our event and timer handling. + +X11 +--- + + - [QTBUG-55942] Qt::WindowNoState event is no longer sent when hiding + minimized windows. + - [QTBUG-49645] Fixed keyboard modifier state for drops from external apps. + - [QTBUG-48795] Fixed the keyboard state when processing key events. + +****************************************************************************** +* Compiler Specific Changes * +****************************************************************************** + +Visual Studio +------------- + + - Visual Studio 2017 is now supported. + - [QTBUG-56594] PDB files are now properly generated even for static builds. + +****************************************************************************** +* Tools * +****************************************************************************** + +configure +--------- + + - Fixed builds that explicitly asked for -sdk iphoneos. + - [QTBUG-56388] Fixed the detection of the Microsoft compiler version when + the CL environment variable was set or when the compiler was configured to + another language (other than English). + +qmake +----- + + - [QTBUG-55505] Fixed an issue with iOS when the project path had a + whitespace. + - [QTBUG-56289] When cross-compiling on Windows to Unix targets, qmake no + longer generates chmod calls. + - [QTBUG-53905] Fixed qmake not to run moc twice on Objective C++ sources + listed in the OBJECTIVE_SOURCES variable. + - [QTBUG-56507] Fixed builds where a lex source refers to a file generated + by yacc. + - [QTBUG-57090][Darwin] Fixed the installation of asset catalog files. + +qdbusxml2cpp +------------ + + - [QTBUG-21577] Fixed the generation of signals when the direction argument + was inverted from expected. From 029e5cde33576a3de68576a0361b108e47883860 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 4 Sep 2017 21:51:17 +0200 Subject: [PATCH 28/30] Convert features.ftp to QT_[REQUIRE_]CONFIG QUrlInfo is used only by the FTP implementation, so it uses the same conditionals. Change-Id: Ia15abf44d2a538e90b792a31c65926cc9e16aecf Reviewed-by: Oswald Buddenhagen --- src/network/access/access.pri | 14 ++++++++++---- src/network/access/qftp.cpp | 4 ---- src/network/access/qftp_p.h | 7 ++----- src/network/access/qnetworkaccesscachebackend.cpp | 2 ++ src/network/access/qnetworkaccessfilebackend.cpp | 2 ++ src/network/access/qnetworkaccessftpbackend.cpp | 4 ---- src/network/access/qnetworkaccessftpbackend_p.h | 4 +--- src/network/access/qnetworkaccessmanager.cpp | 8 +++++--- src/network/kernel/kernel.pri | 11 +++++++---- src/network/kernel/qurlinfo.cpp | 4 ---- src/network/kernel/qurlinfo_p.h | 7 ++----- 11 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 13d52ea44a4..b46c116f77b 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -1,7 +1,6 @@ # Qt network access module HEADERS += \ - access/qftp_p.h \ access/qhttpnetworkheader_p.h \ access/qhttpnetworkrequest_p.h \ access/qhttpnetworkreply_p.h \ @@ -18,7 +17,6 @@ HEADERS += \ access/qnetworkaccessdebugpipebackend_p.h \ access/qnetworkaccessfilebackend_p.h \ access/qnetworkaccesscachebackend_p.h \ - access/qnetworkaccessftpbackend_p.h \ access/qnetworkcookie.h \ access/qnetworkcookie_p.h \ access/qnetworkcookiejar.h \ @@ -44,7 +42,6 @@ HEADERS += \ access/qhstspolicy.h SOURCES += \ - access/qftp.cpp \ access/qhttpnetworkheader.cpp \ access/qhttpnetworkrequest.cpp \ access/qhttpnetworkreply.cpp \ @@ -60,7 +57,6 @@ SOURCES += \ access/qnetworkaccessdebugpipebackend.cpp \ access/qnetworkaccessfilebackend.cpp \ access/qnetworkaccesscachebackend.cpp \ - access/qnetworkaccessftpbackend.cpp \ access/qnetworkcookie.cpp \ access/qnetworkcookiejar.cpp \ access/qnetworkrequest.cpp \ @@ -78,6 +74,16 @@ SOURCES += \ access/qhsts.cpp \ access/qhstspolicy.cpp +qtConfig(ftp) { + HEADERS += \ + access/qftp_p.h \ + access/qnetworkaccessftpbackend_p.h + + SOURCES += \ + access/qftp.cpp \ + access/qnetworkaccessftpbackend.cpp +} + mac: LIBS_PRIVATE += -framework Security include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 47579ba6544..762ef002255 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -43,8 +43,6 @@ #include "private/qftp_p.h" #include "qabstractsocket.h" -#ifndef QT_NO_FTP - #include "qcoreapplication.h" #include "qtcpsocket.h" #include "qurlinfo_p.h" @@ -2453,5 +2451,3 @@ QT_END_NAMESPACE #include "qftp.moc" #include "moc_qftp_p.cpp" - -#endif // QT_NO_FTP diff --git a/src/network/access/qftp_p.h b/src/network/access/qftp_p.h index 6cf51167989..bba1f9b09d4 100644 --- a/src/network/access/qftp_p.h +++ b/src/network/access/qftp_p.h @@ -56,11 +56,10 @@ #include #include +QT_REQUIRE_CONFIG(ftp); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_FTP - class QFtpPrivate; class Q_AUTOTEST_EXPORT QFtp : public QObject @@ -169,8 +168,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_piFtpReply(int, const QString&)) }; -#endif // QT_NO_FTP - QT_END_NAMESPACE #endif // QFTP_P_H diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index 95d87d909c3..0c9a88596d6 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -42,7 +42,9 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" #include "qfileinfo.h" +#if QT_CONFIG(ftp) #include "qurlinfo_p.h" +#endif #include "qdir.h" #include "qcoreapplication.h" diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 604394383d7..a5e7daff115 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -39,7 +39,9 @@ #include "qnetworkaccessfilebackend_p.h" #include "qfileinfo.h" +#if QT_CONFIG(ftp) #include "qurlinfo_p.h" +#endif #include "qdir.h" #include "private/qnoncontiguousbytedevice_p.h" diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 6d1ee645fec..0df2569e875 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -43,8 +43,6 @@ #include "private/qnoncontiguousbytedevice_p.h" #include -#ifndef QT_NO_FTP - QT_BEGIN_NAMESPACE enum { @@ -382,5 +380,3 @@ void QNetworkAccessFtpBackend::ftpRawCommandReply(int code, const QString &text) } QT_END_NAMESPACE - -#endif // QT_NO_FTP diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index cdf6b7a07f2..0f26d053272 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -60,7 +60,7 @@ #include "QtCore/qpointer.h" -#ifndef QT_NO_FTP +QT_REQUIRE_CONFIG(ftp); QT_BEGIN_NAMESPACE @@ -122,6 +122,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_FTP - #endif diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 4b8c03c5acd..92b7fcbe116 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -51,7 +51,9 @@ #include "QtNetwork/qnetworksession.h" #include "QtNetwork/private/qsharednetworksession_p.h" +#if QT_CONFIG(ftp) #include "qnetworkaccessftpbackend_p.h" +#endif #include "qnetworkaccessfilebackend_p.h" #include "qnetworkaccessdebugpipebackend_p.h" #include "qnetworkaccesscachebackend_p.h" @@ -76,9 +78,9 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend) -#ifndef QT_NO_FTP +#if QT_CONFIG(ftp) Q_GLOBAL_STATIC(QNetworkAccessFtpBackendFactory, ftpBackend) -#endif // QT_NO_FTP +#endif // QT_CONFIG(ftp) #ifdef QT_BUILD_INTERNAL Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend) @@ -146,7 +148,7 @@ bool getProxyAuth(const QString& proxyHostname, const QString &scheme, QString& static void ensureInitialized() { -#ifndef QT_NO_FTP +#if QT_CONFIG(ftp) (void) ftpBackend(); #endif diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 2c5975182f7..00c115da842 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -17,8 +17,7 @@ HEADERS += kernel/qtnetworkglobal.h \ kernel/qnetworkdatagram_p.h \ kernel/qnetworkinterface.h \ kernel/qnetworkinterface_p.h \ - kernel/qnetworkproxy.h \ - kernel/qurlinfo_p.h + kernel/qnetworkproxy.h SOURCES += kernel/qauthenticator.cpp \ kernel/qdnslookup.cpp \ @@ -26,8 +25,12 @@ SOURCES += kernel/qauthenticator.cpp \ kernel/qhostinfo.cpp \ kernel/qnetworkdatagram.cpp \ kernel/qnetworkinterface.cpp \ - kernel/qnetworkproxy.cpp \ - kernel/qurlinfo.cpp + kernel/qnetworkproxy.cpp + +qtConfig(ftp) { + HEADERS += kernel/qurlinfo_p.h + SOURCES += kernel/qurlinfo.cpp +} unix { !integrity: SOURCES += kernel/qdnslookup_unix.cpp diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp index 300a51d3e75..7ae6822fb42 100644 --- a/src/network/kernel/qurlinfo.cpp +++ b/src/network/kernel/qurlinfo.cpp @@ -39,8 +39,6 @@ #include "qurlinfo_p.h" -#ifndef QT_NO_FTP - #include "qurl.h" #include "qdir.h" #include @@ -727,5 +725,3 @@ bool QUrlInfo::isValid() const } QT_END_NAMESPACE - -#endif // QT_NO_FTP diff --git a/src/network/kernel/qurlinfo_p.h b/src/network/kernel/qurlinfo_p.h index 3a430a33212..8180796f496 100644 --- a/src/network/kernel/qurlinfo_p.h +++ b/src/network/kernel/qurlinfo_p.h @@ -56,11 +56,10 @@ #include #include +QT_REQUIRE_CONFIG(ftp); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_FTP - class QUrl; class QUrlInfoPrivate; @@ -129,8 +128,6 @@ private: QUrlInfoPrivate *d; }; -#endif // QT_NO_FTP - QT_END_NAMESPACE #endif // QURLINFO_H From c6b9c6e5f2cf04728cd98f2305a2d4ef80e49f2a Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 4 Sep 2017 21:52:30 +0200 Subject: [PATCH 29/30] Convert features.socks5 to QT_[REQUIRE_]CONFIG The sources were already added conditionally in the project file since 179fe5981fa. Change-Id: I0baaec2e772f3e596d311c1973b9745aa2b80423 Reviewed-by: Oswald Buddenhagen --- src/network/kernel/qnetworkproxy.cpp | 10 ++++++---- src/network/socket/qsocks5socketengine.cpp | 4 ---- src/network/socket/qsocks5socketengine_p.h | 7 +++---- tests/auto/network/access/qftp/tst_qftp.cpp | 4 ++-- .../auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 2 +- .../auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 6 +++--- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 11e8fa62647..0ed68042f6e 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -227,7 +227,9 @@ #ifndef QT_NO_NETWORKPROXY #include "private/qnetworkrequest_p.h" +#if QT_CONFIG(socks5) #include "private/qsocks5socketengine_p.h" +#endif #include "private/qhttpsocketengine_p.h" #include "qauthenticator.h" #include "qdebug.h" @@ -251,7 +253,7 @@ public: : mutex(QMutex::Recursive) , applicationLevelProxy(0) , applicationLevelProxyFactory(0) -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) , socks5SocketEngineHandler(0) #endif #ifndef QT_NO_HTTP @@ -263,7 +265,7 @@ public: , useSystemProxies(false) #endif { -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) socks5SocketEngineHandler = new QSocks5SocketEngineHandler(); #endif #ifndef QT_NO_HTTP @@ -275,7 +277,7 @@ public: { delete applicationLevelProxy; delete applicationLevelProxyFactory; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) delete socks5SocketEngineHandler; #endif #ifndef QT_NO_HTTP @@ -335,7 +337,7 @@ private: QMutex mutex; QNetworkProxy *applicationLevelProxy; QNetworkProxyFactory *applicationLevelProxyFactory; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) QSocks5SocketEngineHandler *socks5SocketEngineHandler; #endif #ifndef QT_NO_HTTP diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 2847b910f37..fa5f198bf28 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -39,8 +39,6 @@ #include "qsocks5socketengine_p.h" -#ifndef QT_NO_SOCKS5 - #include "qtcpsocket.h" #include "qudpsocket.h" #include "qtcpserver.h" @@ -1938,6 +1936,4 @@ QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr so return 0; } -#endif // QT_NO_SOCKS5 - QT_END_NAMESPACE diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index ec50d71283c..b248554ae53 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -55,9 +55,9 @@ #include "qabstractsocketengine_p.h" #include "qnetworkproxy.h" -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(socks5); -#ifndef QT_NO_SOCKS5 +QT_BEGIN_NAMESPACE class QSocks5SocketEnginePrivate; @@ -291,7 +291,6 @@ public: virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) Q_DECL_OVERRIDE; }; - QT_END_NAMESPACE -#endif // QT_NO_SOCKS5 + #endif // QSOCKS5SOCKETENGINE_H diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 3711ce431c8..fba0508f04a 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -186,7 +186,7 @@ void tst_QFtp::initTestCase_data() QTest::addColumn("setSession"); QTest::newRow("WithoutProxy") << false << 0 << false; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy) << false; #endif //### doesn't work well yet. @@ -194,7 +194,7 @@ void tst_QFtp::initTestCase_data() #ifndef QT_NO_BEARERMANAGEMENT QTest::newRow("WithoutProxyWithSession") << false << 0 << true; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) QTest::newRow("WithSocks5ProxyAndSession") << true << int(QNetworkProxy::Socks5Proxy) << true; #endif #endif diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index c4432c83eed..31f82539aa8 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -149,7 +149,7 @@ void tst_QTcpServer::initTestCase_data() QTest::addColumn("proxyType"); QTest::newRow("WithoutProxy") << false << 0; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); #endif diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index af7cf248386..aeb6e61cd21 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -205,7 +205,7 @@ void tst_QUdpSocket::initTestCase_data() QTest::addColumn("proxyType"); QTest::newRow("WithoutProxy") << false << 0; -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) if (!newTestServer) QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); #endif @@ -233,14 +233,14 @@ void tst_QUdpSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { -#ifndef QT_NO_SOCKS5 +#if QT_CONFIG(socks5) QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } #else QSKIP("No proxy support"); -#endif // !QT_NO_SOCKS5 +#endif // QT_CONFIG(socks5) } } From d332a2d3ccb485c9decd6c47fa5a5fc02b59d27e Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 4 Sep 2017 21:53:31 +0200 Subject: [PATCH 30/30] Convert features.networkdiskcache to QT_[REQUIRE_]CONFIG Change-Id: I8ba76ba1c7210169df14ffab7dabf4b4be086fb9 Reviewed-by: Oswald Buddenhagen --- src/network/access/access.pri | 11 ++++++++--- src/network/access/qnetworkdiskcache.cpp | 4 ---- src/network/access/qnetworkdiskcache.h | 7 ++----- src/network/access/qnetworkdiskcache_p.h | 4 +--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/network/access/access.pri b/src/network/access/access.pri index b46c116f77b..5806262ac2e 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -31,8 +31,6 @@ HEADERS += \ access/qnetworkreplyfileimpl_p.h \ access/qabstractnetworkcache_p.h \ access/qabstractnetworkcache.h \ - access/qnetworkdiskcache_p.h \ - access/qnetworkdiskcache.h \ access/qhttpthreaddelegate_p.h \ access/qhttpmultipart.h \ access/qhttpmultipart_p.h \ @@ -66,7 +64,6 @@ SOURCES += \ access/qnetworkreplyhttpimpl.cpp \ access/qnetworkreplyfileimpl.cpp \ access/qabstractnetworkcache.cpp \ - access/qnetworkdiskcache.cpp \ access/qhttpthreaddelegate.cpp \ access/qhttpmultipart.cpp \ access/qnetworkfile.cpp \ @@ -84,6 +81,14 @@ qtConfig(ftp) { access/qnetworkaccessftpbackend.cpp } +qtConfig(networkdiskcache) { + HEADERS += \ + access/qnetworkdiskcache_p.h \ + access/qnetworkdiskcache.h + + SOURCES += access/qnetworkdiskcache.cpp +} + mac: LIBS_PRIVATE += -framework Security include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index d72791c1f02..fca880d9b3e 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -60,8 +60,6 @@ #define MAX_COMPRESSION_SIZE (1024 * 1024 * 3) -#ifndef QT_NO_NETWORKDISKCACHE - QT_BEGIN_NAMESPACE /*! @@ -737,5 +735,3 @@ bool QCacheItem::read(QFile *device, bool readData) } QT_END_NAMESPACE - -#endif // QT_NO_NETWORKDISKCACHE diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h index a3aa8d3a074..0e9258f6de9 100644 --- a/src/network/access/qnetworkdiskcache.h +++ b/src/network/access/qnetworkdiskcache.h @@ -43,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(networkdiskcache); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_NETWORKDISKCACHE - class QNetworkDiskCachePrivate; class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache { @@ -84,8 +83,6 @@ private: Q_DISABLE_COPY(QNetworkDiskCache) }; -#endif // QT_NO_NETWORKDISKCACHE - QT_END_NAMESPACE #endif // QNETWORKDISKCACHE_H diff --git a/src/network/access/qnetworkdiskcache_p.h b/src/network/access/qnetworkdiskcache_p.h index e47b93b09d0..f7988e7dda5 100644 --- a/src/network/access/qnetworkdiskcache_p.h +++ b/src/network/access/qnetworkdiskcache_p.h @@ -58,7 +58,7 @@ #include #include -#ifndef QT_NO_NETWORKDISKCACHE +QT_REQUIRE_CONFIG(networkdiskcache); QT_BEGIN_NAMESPACE @@ -123,6 +123,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_NETWORKDISKCACHE - #endif // QNETWORKDISKCACHE_P_H