diff options
author | Liang Qi <liang.qi@qt.io> | 2017-07-05 08:54:21 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2017-07-05 08:54:21 +0000 |
commit | 207253384b69e49db22e9b1cfe472ad0d99a9051 (patch) | |
tree | d31d1f136509cc1942f308c8bb479f7479131e6e /src | |
parent | 4f7507c52390cd19d76e0f36744f21fbc3e14674 (diff) | |
parent | c2b224a758ce7e6dcf3748444fa8e29ab81904be (diff) |
Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev
Diffstat (limited to 'src')
182 files changed, 744 insertions, 763 deletions
diff --git a/src/3rdparty/icu_dependency.pri b/src/3rdparty/icu_dependency.pri deleted file mode 100644 index 6318631f6e..0000000000 --- a/src/3rdparty/icu_dependency.pri +++ /dev/null @@ -1,13 +0,0 @@ -win32 { - CONFIG(static, static|shared) { - CONFIG(debug, debug|release) { - LIBS_PRIVATE += -lsicuind -lsicuucd -lsicudtd - } else { - LIBS_PRIVATE += -lsicuin -lsicuuc -lsicudt - } - } else { - LIBS_PRIVATE += -licuin -licuuc -licudt - } -} else { - LIBS_PRIVATE += -licui18n -licuuc -licudata -} diff --git a/src/3rdparty/wintab/qt_attribution.json b/src/3rdparty/wintab/qt_attribution.json index 742278fb26..ac06e8da5a 100644 --- a/src/3rdparty/wintab/qt_attribution.json +++ b/src/3rdparty/wintab/qt_attribution.json @@ -2,7 +2,7 @@ "Id": "wintab", "Name": "Wintab API", "QDocModule": "qtgui", - "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -DQT_NO_TABLETEVENT to avoid.", + "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -no-feature-tabletevent to avoid.", "Description": "Wintab is a de facto API for pointing devices on Windows.", "Homepage": "http://www.pointing.com/Wintab.html", diff --git a/src/corelib/codecs/qgb18030codec.cpp b/src/corelib/codecs/qgb18030codec.cpp index 9899d47c23..04e4bef4cd 100644 --- a/src/corelib/codecs/qgb18030codec.cpp +++ b/src/corelib/codecs/qgb18030codec.cpp @@ -317,7 +317,7 @@ QList<QByteArray> QGbkCodec::_aliases() QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *state) const { - uchar buf[2]; + uchar buf[2] = {0, 0}; int nbuf = 0; ushort replacement = QChar::ReplacementCharacter; if (state) { @@ -467,7 +467,7 @@ QByteArray QGb2312Codec::_name() QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterState *state) const { - uchar buf[2]; + uchar buf[2] = {0, 0}; int nbuf = 0; ushort replacement = QChar::ReplacementCharacter; if (state) { diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 5e2cb025d3..c32354c771 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -44,7 +44,6 @@ }, "icu": { "label": "ICU", - "export": "", "test": "unix/icu", "sources": [ { diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 244f294312..83ba6e69ee 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -175,7 +175,10 @@ QOperatingSystemVersion QOperatingSystemVersion::current() version.m_major = -1; version.m_minor = -1; - static const int versions[][2] = { + static const struct { + uint major : 4; + uint minor : 4; + } versions[] = { { 1, 0 }, // API level 1 { 1, 1 }, // API level 2 { 1, 5 }, // API level 3 @@ -207,8 +210,8 @@ QOperatingSystemVersion QOperatingSystemVersion::current() const size_t versionIdx = size_t(QJNIObjectPrivate::getStaticField<jint>( "android/os/Build$VERSION", "SDK_INT")) - 1; if (versionIdx < sizeof(versions) / sizeof(versions[0])) { - version.m_major = versions[versionIdx][0]; - version.m_minor = versions[versionIdx][1]; + version.m_major = versions[versionIdx].major; + version.m_minor = versions[versionIdx].minor; } // API level 6 was exactly version 2.0.1 @@ -333,6 +336,7 @@ QString QOperatingSystemVersion::name() const } } +#ifdef Q_COMPILER_INITIALIZER_LISTS /*! \fn bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const @@ -347,6 +351,7 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) c } return false; } +#endif /*! \variable QOperatingSystemVersion::Windows7 diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 295365aad1..2e319e66d5 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -81,7 +81,6 @@ public: static const QOperatingSystemVersion AndroidNougat; static const QOperatingSystemVersion AndroidNougat_MR1; - QOperatingSystemVersion(const QOperatingSystemVersion &other) = default; Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1) : m_os(osType), @@ -99,7 +98,9 @@ public: Q_DECL_CONSTEXPR int segmentCount() const { return m_micro >= 0 ? 3 : m_minor >= 0 ? 2 : m_major >= 0 ? 1 : 0; } +#ifdef Q_COMPILER_INITIALIZER_LISTS bool isAnyOfType(std::initializer_list<OSType> types) const; +#endif Q_DECL_CONSTEXPR OSType type() const { return m_os; } QString name() const; @@ -124,6 +125,7 @@ private: static int compare(const QOperatingSystemVersion &v1, const QOperatingSystemVersion &v2); }; +Q_DECLARE_TYPEINFO(QOperatingSystemVersion, QT_VERSION < QT_VERSION_CHECK(6, 0, 0) ? Q_RELOCATABLE_TYPE : Q_PRIMITIVE_TYPE); QT_END_NAMESPACE diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 35bb44fed4..cf9d38097a 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -147,10 +147,6 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() #if QT_CONFIG(process) -// POSIX requires PIPE_BUF to be 512 or larger -// so we will use 512 -static const int errorBufferMax = 512; - namespace { struct QProcessPoller { @@ -530,11 +526,18 @@ void QProcessPrivate::startProcess() } } +struct ChildError +{ + int code; + char function[8]; +}; + void QProcessPrivate::execChild(const char *workingDir, char **argv, char **envp) { ::signal(SIGPIPE, SIG_DFL); // reset the signal that we ignored Q_Q(QProcess); + ChildError error = { 0, {} }; // force zeroing of function[8] // copy the stdin socket if asked to (without closing on exec) if (inputChannelMode != QProcess::ForwardedInputChannel) @@ -557,9 +560,9 @@ void QProcessPrivate::execChild(const char *workingDir, char **argv, char **envp qt_safe_close(childStartedPipe[0]); // enter the working directory - const char *callthatfailed = "chdir: "; if (workingDir && QT_CHDIR(workingDir) == -1) { // failed, stop the process + strcpy(error.function, "chdir"); goto report_errno; } @@ -569,39 +572,28 @@ void QProcessPrivate::execChild(const char *workingDir, char **argv, char **envp // execute the process if (!envp) { qt_safe_execv(argv[0], argv); - callthatfailed = "execv: "; + strcpy(error.function, "execvp"); } else { #if defined (QPROCESS_DEBUG) fprintf(stderr, "QProcessPrivate::execChild() starting %s\n", argv[0]); #endif qt_safe_execve(argv[0], argv, envp); - callthatfailed = "execve: "; + strcpy(error.function, "execve"); } // notify failure - // we're running in the child process, so we don't need to be thread-safe; - // we can use strerror + // don't use strerror or any other routines that may allocate memory, since + // some buggy libc versions can deadlock on locked mutexes. report_errno: - const char *msg = strerror(errno); -#if defined (QPROCESS_DEBUG) - fprintf(stderr, "QProcessPrivate::execChild() failed (%s), notifying parent process\n", msg); -#endif - qt_safe_write(childStartedPipe[1], callthatfailed, strlen(callthatfailed)); - qt_safe_write(childStartedPipe[1], msg, strlen(msg)); - qt_safe_close(childStartedPipe[1]); + error.code = errno; + qt_safe_write(childStartedPipe[1], &error, sizeof(error)); childStartedPipe[1] = -1; } bool QProcessPrivate::processStarted(QString *errorMessage) { - char buf[errorBufferMax]; - int i = 0; - int ret; - do { - ret = qt_safe_read(childStartedPipe[0], buf + i, sizeof buf - i); - if (ret > 0) - i += ret; - } while (ret > 0 && i < int(sizeof buf)); + ChildError buf; + int ret = qt_safe_read(childStartedPipe[0], &buf, sizeof(buf)); if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); @@ -616,10 +608,10 @@ bool QProcessPrivate::processStarted(QString *errorMessage) #endif // did we read an error message? - if ((i > 0) && errorMessage) - *errorMessage = QString::fromLocal8Bit(buf, i); + if (ret > 0 && errorMessage) + *errorMessage = QLatin1String(buf.function) + QLatin1String(": ") + qt_error_string(buf.code); - return i <= 0; + return ret <= 0; } qint64 QProcessPrivate::bytesAvailableInChannel(const Channel *channel) const diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9663235a67..ac694a464a 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3440,6 +3440,10 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode) /*! Returns a decoded copy of \a input. \a input is first decoded from percent encoding, then converted from UTF-8 to unicode. + + \note Given invalid input (such as a string containing the sequence "%G5", + which is not a valid hexadecimal number) the output will be invalid as + well. As an example: the sequence "%G5" could be decoded to 'W'. */ QString QUrl::fromPercentEncoding(const QByteArray &input) { diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 397d6203aa..96c031eec6 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -42,7 +42,7 @@ #ifndef QT_NO_THREAD #include "qmutex.h" #include "qwaitcondition.h" -#include "qelapsedtimer.h" +#include "qdeadlinetimer.h" #include "qdatetime.h" QT_BEGIN_NAMESPACE @@ -217,20 +217,19 @@ bool QSemaphore::tryAcquire(int n) bool QSemaphore::tryAcquire(int n, int timeout) { Q_ASSERT_X(n >= 0, "QSemaphore::tryAcquire", "parameter 'n' must be non-negative"); + if (timeout < 0) + return tryAcquire(n); + + QDeadlineTimer timer(timeout); QMutexLocker locker(&d->mutex); - if (timeout < 0) { - while (n > d->avail) - d->cond.wait(locker.mutex()); - } else { - QElapsedTimer timer; - timer.start(); - while (n > d->avail) { - const qint64 elapsed = timer.elapsed(); - if (timeout - elapsed <= 0 - || !d->cond.wait(locker.mutex(), timeout - elapsed)) - return false; - } + qint64 remainingTime = timer.remainingTime(); + while (n > d->avail && remainingTime > 0) { + if (!d->cond.wait(locker.mutex(), remainingTime)) + return false; + remainingTime = timer.remainingTime(); } + if (n > d->avail) + return false; d->avail -= n; return true; diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 19c27d9ff8..bbac058f2f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -4563,6 +4563,10 @@ void q_fromPercentEncoding(QByteArray *ba) text.data(); // returns "Qt is great!" \endcode + \note Given invalid input (such as a string containing the sequence "%G5", + which is not a valid hexadecimal number) the output will be invalid as + well. As an example: the sequence "%G5" could be decoded to 'W'. + \sa toPercentEncoding(), QUrl::fromPercentEncoding() */ QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent) diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 3d6cc97205..aa545497a2 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -141,7 +141,7 @@ qtConfig(system-zlib) { } qtConfig(icu) { - include($$PWD/../../3rdparty/icu_dependency.pri) + QMAKE_USE_PRIVATE += icu SOURCES += tools/qlocale_icu.cpp \ tools/qcollator_icu.cpp diff --git a/src/gui/configure.json b/src/gui/configure.json index f25090ddfd..5e85d341dd 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -847,7 +847,7 @@ "xinput2": { "label": "Xinput2", "emitIf": "features.xcb", - "condition": "libs.xinput2", + "condition": "features.xcb-xlib && libs.xinput2", "output": [ "privateFeature" ] }, "xkbcommon-evdev": { @@ -1068,6 +1068,12 @@ "section": "Utilities", "condition": "!config.integrity", "output": [ "privateFeature" ] + }, + "whatsthis": { + "label": "QWhatsThis", + "purpose": "Supports displaying \"What's this\" help.", + "section": "Widget Support", + "output": [ "publicFeature", "feature" ] } }, @@ -1089,7 +1095,7 @@ XKB configuration data. This is required for keyboard input support." { "type": "note", "condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge", - "message": "Disabling Linux Accessibility Bridge: D-Bus is missing." + "message": "Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing." }, { "type": "warning", diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h index a9cde106c1..73107b827c 100644 --- a/src/gui/itemmodels/qstandarditemmodel.h +++ b/src/gui/itemmodels/qstandarditemmodel.h @@ -95,7 +95,7 @@ public: inline void setStatusTip(const QString &statusTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis() const { return qvariant_cast<QString>(data(Qt::WhatsThisRole)); } @@ -272,7 +272,7 @@ inline void QStandardItem::setStatusTip(const QString &astatusTip) { setData(astatusTip, Qt::StatusTipRole); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QStandardItem::setWhatsThis(const QString &awhatsThis) { setData(awhatsThis, Qt::WhatsThisRole); } #endif diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 2777e408c1..680acb16e7 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -767,7 +767,7 @@ QHoverEvent::~QHoverEvent() \sa pos(), pixelDelta(), angleDelta() */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QWheelEvent::QWheelEvent(const QPointF &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient) @@ -952,7 +952,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, invertedScrolling(inverted) {} -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! \fn QPoint QWheelEvent::pixelDelta() const @@ -2264,7 +2264,7 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const return QVariant(); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) /*! \class QTabletEvent @@ -2706,7 +2706,7 @@ Qt::MouseButtons QTabletEvent::buttons() const \sa posF() */ -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifndef QT_NO_GESTURES /*! @@ -3325,7 +3325,7 @@ QStatusTipEvent::~QStatusTipEvent() #endif // QT_NO_STATUSTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \class QWhatsThisClickedEvent @@ -3362,7 +3362,7 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent() This?" text. */ -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_ACTION @@ -3856,7 +3856,7 @@ static void formatDropEvent(QDebug d, const QDropEvent *e) # endif // !QT_NO_DRAGANDDROP -# ifndef QT_NO_TABLETEVENT +# if QT_CONFIG(tabletevent) static void formatTabletEvent(QDebug d, const QTabletEvent *e) { @@ -3883,7 +3883,7 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e) d << ", tangentialPressure=" << e->tangentialPressure(); } -# endif // !QT_NO_TABLETEVENT +# endif // QT_CONFIG(tabletevent) QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) { @@ -3956,13 +3956,13 @@ QDebug operator<<(QDebug dbg, const QEvent *e) dbg << ')'; } break; -# ifndef QT_NO_WHEELEVENT +# if QT_CONFIG(wheelevent) case QEvent::Wheel: { const QWheelEvent *we = static_cast<const QWheelEvent *>(e); dbg << "QWheelEvent(" << "pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta() << ')'; } break; -# endif // !QT_NO_WHEELEVENT +# endif // QT_CONFIG(wheelevent) case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::ShortcutOverride: @@ -4063,7 +4063,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')'; break; # endif // !QT_NO_CONTEXTMENU -# ifndef QT_NO_TABLETEVENT +# if QT_CONFIG(tabletevent) case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: case QEvent::TabletPress: @@ -4071,7 +4071,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) case QEvent::TabletRelease: formatTabletEvent(dbg, static_cast<const QTabletEvent *>(e)); break; -# endif // !QT_NO_TABLETEVENT +# endif // QT_CONFIG(tabletevent) case QEvent::Enter: dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->pos() << ')'; break; diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index cfc3b842d7..b8f86acd75 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -169,7 +169,7 @@ protected: QPointF p, op; }; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class Q_GUI_EXPORT QWheelEvent : public QInputEvent { public: @@ -237,7 +237,7 @@ protected: }; #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class Q_GUI_EXPORT QTabletEvent : public QInputEvent { Q_GADGET @@ -295,7 +295,7 @@ protected: // ### Qt 6: QPointingEvent will have Buttons, QTabletEvent will inherit void *mExtra; }; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifndef QT_NO_GESTURES class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent @@ -699,7 +699,7 @@ private: }; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent { public: diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 1eccfaea78..7df4a1e25b 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -94,7 +94,7 @@ public: QVector<QPointF> rawScreenPositions; }; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class QTabletEventPrivate { public: @@ -106,7 +106,7 @@ public: Qt::MouseButton b; Qt::MouseButtons buttonState; }; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b76ff65aff..51653d9f8a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2004,7 +2004,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) { -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QWindow *window = e->window.data(); QPointF globalPoint = e->globalPos; QPointF localPoint = e->localPos; @@ -2034,7 +2034,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh QGuiApplication::sendSpontaneousEvent(window, &ev); #else Q_UNUSED(e); -#endif /* ifndef QT_NO_WHEELEVENT */ +#endif // QT_CONFIG(wheelevent) } // Remember, Qt convention is: keyboard state is state *before* @@ -2309,7 +2309,7 @@ QGuiApplicationPrivate::TabletPointData &QGuiApplicationPrivate::tabletDevicePoi void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent *e) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletPointData &pointData = tabletDevicePoint(e->uid); QEvent::Type type = QEvent::TabletMove; @@ -2376,7 +2376,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T void QGuiApplicationPrivate::processTabletEnterProximityEvent(QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QTabletEvent ev(QEvent::TabletEnterProximity, QPointF(), QPointF(), e->device, e->pointerType, 0, 0, 0, 0, 0, 0, @@ -2390,7 +2390,7 @@ void QGuiApplicationPrivate::processTabletEnterProximityEvent(QWindowSystemInter void QGuiApplicationPrivate::processTabletLeaveProximityEvent(QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QTabletEvent ev(QEvent::TabletLeaveProximity, QPointF(), QPointF(), e->device, e->pointerType, 0, 0, 0, 0, 0, 0, diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 9f20fe0855..bd52113762 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2268,7 +2268,7 @@ bool QWindow::event(QEvent *ev) #endif break; } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: wheelEvent(static_cast<QWheelEvent*>(ev)); break; @@ -2302,7 +2302,7 @@ bool QWindow::event(QEvent *ev) break; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletPress: case QEvent::TabletMove: case QEvent::TabletRelease: @@ -2466,7 +2466,7 @@ void QWindow::mouseMoveEvent(QMouseEvent *ev) ev->ignore(); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! Override this to handle mouse wheel or other wheel events (\a ev). */ @@ -2474,7 +2474,7 @@ void QWindow::wheelEvent(QWheelEvent *ev) { ev->ignore(); } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! Override this to handle touch events (\a ev). @@ -2484,7 +2484,7 @@ void QWindow::touchEvent(QTouchEvent *ev) ev->ignore(); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) /*! Override this to handle tablet press, move, and release events (\a ev). diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 529589e67b..4a874caacb 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -71,11 +71,11 @@ class QShowEvent; class QHideEvent; class QKeyEvent; class QMouseEvent; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class QWheelEvent; #endif class QTouchEvent; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class QTabletEvent; #endif @@ -354,11 +354,11 @@ protected: virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseDoubleClickEvent(QMouseEvent *); virtual void mouseMoveEvent(QMouseEvent *); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *); #endif virtual void touchEvent(QTouchEvent *); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) virtual void tabletEvent(QTabletEvent *); #endif virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index dfad6bc2d8..fd9c627506 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -867,7 +867,7 @@ void QWindowSystemInterface::handleContextMenuEvent(QWindow *window, bool mouseT } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void QWindowSystemInterface::handleEnterWhatsThisEvent() { QWindowSystemInterfacePrivate::WindowSystemEvent *e = diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index bf3a9a6886..73ef612a06 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -239,7 +239,7 @@ public: const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) static void handleEnterWhatsThisEvent(); #endif diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 4519c4af19..ca82f9a35a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1362,7 +1362,7 @@ static inline void qConvertARGB64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *b const __m128i cmask = _mm_set1_epi32(0x000003ff); int i = 0; __m128i vr, vg, vb, va; - for (; i < count && (const uintptr_t)buffer & 0xF; ++i) { + for (; i < count && uintptr_t(buffer) & 0xF; ++i) { *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); } diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index b796934199..3f7c0d94e1 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -395,7 +395,7 @@ bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address) // QNetworkProxyQuery). QNetworkProxyQuery query; query.setQueryType(queryType); - proxy = QNetworkProxyFactory::systemProxyForQuery(query).constFirst(); + proxy = QNetworkProxyFactory::proxyForQuery(query).constFirst(); } if (proxy.type() != QNetworkProxy::DefaultProxy && diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 2088d3927e..12c5aa0023 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -886,6 +886,7 @@ int QNativeSocketEnginePrivate::nativeAccept() break; case WSAENETDOWN: setError(QAbstractSocket::NetworkError, NetworkUnreachableErrorString); + break; case WSAENOTSOCK: setError(QAbstractSocket::SocketResourceError, NotSocketErrorString); break; diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 38c2b6e8c0..291d85844d 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -251,17 +251,16 @@ public: { HRESULT hr = action->GetResults(); if (FAILED(hr)) { - switch (hr) { - case HRESULT_FROM_WIN32(WSAETIMEDOUT): + if (hr == HRESULT_FROM_WIN32(WSAETIMEDOUT)) { emit connectOpFinished(false, QAbstractSocket::NetworkError, WinRTSocketEngine::ConnectionTimeOutErrorString); return S_OK; - case HRESULT_FROM_WIN32(WSAEHOSTUNREACH): + } else if (hr == HRESULT_FROM_WIN32(WSAEHOSTUNREACH)) { emit connectOpFinished(false, QAbstractSocket::HostNotFoundError, WinRTSocketEngine::HostUnreachableErrorString); return S_OK; - case HRESULT_FROM_WIN32(WSAECONNREFUSED): + } else if (hr == HRESULT_FROM_WIN32(WSAECONNREFUSED)) { emit connectOpFinished(false, QAbstractSocket::ConnectionRefusedError, WinRTSocketEngine::ConnectionRefusedErrorString); return S_OK; - default: + } else { emit connectOpFinished(false, QAbstractSocket::UnknownSocketError, WinRTSocketEngine::UnknownSocketErrorString); return S_OK; } diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 08aa37e5aa..200ee2499e 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -343,7 +343,7 @@ bool QGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) Q_D(QGLBuffer); - if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) + if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id() || !d->funcs->d()->GetBufferSubData) return false; while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state. d->funcs->glGetBufferSubData(d->type, offset, count, data); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 1ee81fa9c9..eb9e9c8b8d 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -395,8 +395,8 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal Qt::KeyboardModifiers modifiers = watcher->modifiers(); QVariantList args = watcher->arguments(); - const ulong time = static_cast<const ulong>(args.at(0).toUInt()); - const QEvent::Type type = static_cast<const QEvent::Type>(args.at(1).toUInt()); + const ulong time = static_cast<ulong>(args.at(0).toUInt()); + const QEvent::Type type = static_cast<QEvent::Type>(args.at(1).toUInt()); const int qtcode = args.at(2).toInt(); const quint32 code = args.at(3).toUInt(); const quint32 sym = args.at(4).toUInt(); diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 32630003d1..ef95b80dd4 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -38,6 +38,8 @@ ** ****************************************************************************/ +#include <QtGui/qtguiglobal.h> + #include "androidjniinput.h" #include "androidjnimain.h" #include "qandroidplatformintegration.h" @@ -292,17 +294,17 @@ namespace QtAndroidInput static bool isTabletEventSupported(JNIEnv */*env*/, jobject /*thiz*/) { -#ifdef QT_NO_TABLETEVENT - return false; -#else +#if QT_CONFIG(tabletevent) return true; -#endif // QT_NO_TABLETEVENT +#else + return false; +#endif // QT_CONFIG(tabletevent) } static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action, jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QPointF globalPosF(x, y); QPoint globalPos((int)x, (int)y); QWindow *tlw = topLevelWindowAt(globalPos); @@ -344,7 +346,7 @@ namespace QtAndroidInput QWindowSystemInterface::handleTabletEvent(tlw, ulong(time), localPos, globalPosF, QTabletEvent::Stylus, pointerType, buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier); -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) } static int mapAndroidKey(int key) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 4d05fb4a46..f48f9ccf30 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -21,8 +21,6 @@ OBJECTIVE_SOURCES += main.mm \ qmultitouch_mac.mm \ qcocoaaccessibilityelement.mm \ qcocoaaccessibility.mm \ - qcocoacolordialoghelper.mm \ - qcocoafiledialoghelper.mm \ qcocoafontdialoghelper.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ @@ -57,8 +55,6 @@ HEADERS += qcocoaintegration.h \ qmultitouch_mac_p.h \ qcocoaaccessibilityelement.h \ qcocoaaccessibility.h \ - qcocoacolordialoghelper.h \ - qcocoafiledialoghelper.h \ qcocoafontdialoghelper.h \ qcocoacursor.h \ qcocoaclipboard.h \ @@ -91,6 +87,8 @@ QT += \ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { + QT_FOR_CONFIG += widgets + OBJECTIVE_SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ @@ -103,6 +101,16 @@ qtHaveModule(widgets) { qcocoaprintersupport.h \ qcocoaprintdevice.h \ + qtConfig(colordialog) { + SOURCES += qcocoacolordialoghelper.mm + HEADERS += qcocoacolordialoghelper.h + } + + qtConfig(filedialog) { + SOURCES += qcocoafiledialoghelper.mm + HEADERS += qcocoafiledialoghelper.h + } + QT += widgets-private printsupport-private } diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h index 55017668d1..133efd6db8 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h @@ -40,9 +40,13 @@ #ifndef QCOCOACOLORDIALOGHELPER_H #define QCOCOACOLORDIALOGHELPER_H +#include <QtWidgets/qtwidgetsglobal.h> + #include <QObject> #include <qpa/qplatformdialoghelper.h> +QT_REQUIRE_CONFIG(colordialog); + QT_BEGIN_NAMESPACE class QCocoaColorDialogHelper : public QPlatformColorDialogHelper diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index a8974c4de5..5d331c0e96 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -37,8 +37,6 @@ ** ****************************************************************************/ -#ifndef QT_NO_COLORDIALOG - #include <QtCore/qdebug.h> #include <QtCore/qtimer.h> #include <qpa/qplatformtheme.h> @@ -424,5 +422,3 @@ QColor QCocoaColorDialogHelper::currentColor() const } QT_END_NAMESPACE - -#endif // QT_NO_COLORDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h index 1cff6f97ba..f5ba1dc22e 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h @@ -41,8 +41,11 @@ #define QCOCOAFILEDIALOGHELPER_H #include <QObject> +#include <QtWidgets/qtwidgetsglobal.h> #include <qpa/qplatformdialoghelper.h> +QT_REQUIRE_CONFIG(filedialog); + Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)); QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index b5a5568f3c..9a00eb89b7 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -41,8 +41,6 @@ #include "qcocoafiledialoghelper.h" -#ifndef QT_NO_FILEDIALOG - /***************************************************************************** QFileDialog debug facilities *****************************************************************************/ @@ -775,5 +773,3 @@ bool QCocoaFileDialogHelper::defaultNameFilterDisables() const } QT_END_NAMESPACE - -#endif // QT_NO_FILEDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index d48ec8c6f7..bac49cfad9 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -47,7 +47,6 @@ #include "qcocoahelpers.h" #include "qcocoaapplication.h" #include "qcocoaapplicationdelegate.h" -#include "qcocoafiledialoghelper.h" #include "qcocoatheme.h" #include "qcocoainputcontext.h" #include "qcocoamimetypes.h" @@ -60,6 +59,13 @@ #include <QtGui/private/qcoregraphics_p.h> +#ifdef QT_WIDGETS_LIB +#include <QtWidgets/qtwidgetsglobal.h> +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include <IOKit/graphics/IOGraphicsLib.h> static void initResources() diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index ad2b27999b..a6104d86cc 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -45,7 +45,6 @@ #include <QtCore/QVariant> #include "qcocoacolordialoghelper.h" -#include "qcocoafiledialoghelper.h" #include "qcocoafontdialoghelper.h" #include "qcocoasystemsettings.h" #include "qcocoasystemtrayicon.h" @@ -63,6 +62,13 @@ #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> +#ifdef QT_WIDGETS_LIB +#include <QtWidgets/qtwidgetsglobal.h> +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include <Carbon/Carbon.h> @interface QT_MANGLE_NAMESPACE(QCocoaThemeNotificationReceiver) : NSObject { @@ -124,7 +130,7 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const { if (dialogType == QPlatformTheme::FileDialog) return true; -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) if (dialogType == QPlatformTheme::ColorDialog) return true; #endif @@ -138,11 +144,11 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const { switch (dialogType) { -#ifndef QT_NO_FILEDIALOG +#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog) case QPlatformTheme::FileDialog: return new QCocoaFileDialogHelper(); #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) case QPlatformTheme::ColorDialog: return new QCocoaColorDialogHelper(); #endif diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 1fe2a91d57..6e5b749747 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include "qnsview.h" #include "qcocoawindow.h" @@ -363,6 +363,14 @@ static QTouchDevice *touchDevice = 0; m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->paintDevice()->devicePixelRatio(); + + // Prevent buildup of NSDisplayCycle objects during setNeedsDisplayInRect, which + // would normally be released as part of the root runloop's autorelease pool, but + // can be kept alive during repeated painting which starve the root runloop. + // FIXME: Move this to the event dispatcher, to cover more cases of starvation. + // FIXME: Figure out if there's a way to detect and/or prevent runloop starvation. + QMacAutoReleasePool pool; + for (const QRect &rect : region) [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } @@ -1356,7 +1364,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } #endif // QT_NO_GESTURES -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) - (void)scrollWheel:(NSEvent *)theEvent { if (!m_platformWindow) @@ -1437,7 +1445,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) QWindowSystemInterface::handleWheelEvent(m_platformWindow->window(), qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph, source, isInverted); } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) - (int) convertKeyCode : (QChar)keyChar { @@ -1512,7 +1520,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); } - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (m_sendKeyEvent && fo) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints); if (QCoreApplication::sendEvent(fo, &queryEvent)) { @@ -1662,8 +1670,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) commitString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString)); }; } - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1730,8 +1737,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_composingText = preeditString; - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1747,8 +1753,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void) unmarkText { if (!m_composingText.isEmpty()) { - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1770,7 +1775,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { Q_UNUSED(actualRange) - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return nil; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); @@ -1805,7 +1810,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { NSRange selectedRange = {0, 0}; - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return selectedRange; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); @@ -1827,7 +1832,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { Q_UNUSED(aRange) Q_UNUSED(actualRange) - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return NSZeroRect; @@ -1867,7 +1872,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (m_platformWindow->window() != QGuiApplication::focusWindow()) return nil; - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return nil; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index ddd779bbac..ef893f8a63 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -60,6 +60,7 @@ #include "qwindowsscreen.h" #include "qwindowstheme.h" +#include <QtGui/qtguiglobal.h> #include <QtGui/QWindow> #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformnativeinterface.h> @@ -940,9 +941,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return false; #endif case QtWindows::DisplayChangedEvent: - return d->m_screenManager.handleDisplayChange(wParam, lParam); if (QWindowsTheme *t = QWindowsTheme::instance()) t->displayChanged(); + return d->m_screenManager.handleDisplayChange(wParam, lParam); case QtWindows::SettingChangedEvent: return d->m_screenManager.handleScreenChanges(); default: @@ -1089,10 +1090,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, *result = LRESULT(MA_NOACTIVATE); return true; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->notifyActivate(); -#endif // !QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) if (platformWindow->testFlag(QWindowsWindow::BlockedByModal)) if (const QWindow *modalWindow = QGuiApplication::modalWindow()) { QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(modalWindow); diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index c2d7632e89..af62936a18 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -1014,6 +1014,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms state |= ((msg.wParam >= '0' && msg.wParam <= '9') || (msg.wParam >= VK_OEM_PLUS && msg.wParam <= VK_OEM_3)) ? 0 : int(Qt::KeypadModifier); + Q_FALLTHROUGH(); default: if (uint(msg.lParam) == 0x004c0001 || uint(msg.lParam) == 0xc04c0001) state |= Qt::KeypadModifier; diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 46306d438f..7e1017426f 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -39,8 +39,6 @@ #include "qwindowstabletsupport.h" -#ifndef QT_NO_TABLETEVENT - #include "qwindowscontext.h" #include "qwindowskeymapper.h" #include "qwindowswindow.h" @@ -498,5 +496,3 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() } QT_END_NAMESPACE - -#endif // QT_NO_TABLETEVENT diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 97eceaf2cc..7878e962e1 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -41,14 +41,15 @@ #define QWINDOWSTABLETSUPPORT_H #include "qtwindowsglobal.h" - -#if !defined(QT_NO_TABLETEVENT) +#include <QtGui/qtguiglobal.h> #include <QtCore/QVector> #include <QtCore/QPointF> #include <wintab.h> +QT_REQUIRE_CONFIG(tabletevent); + QT_BEGIN_NAMESPACE class QDebug; @@ -140,5 +141,4 @@ private: QT_END_NAMESPACE -#endif // !QT_NO_TABLETEVENT #endif // QWINDOWSTABLETSUPPORT_H diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 4ab406acb9..e6e352a21d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -5,14 +5,6 @@ INCLUDEPATH += $$PWD/../ load(qt_build_paths) -# needed by Xcursor ... -qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB - qtConfig(xinput2) { - DEFINES += XCB_USE_XINPUT2 - } -} - # build with session management support qtConfig(xcb-sm) { DEFINES += XCB_USE_SM diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp index 40ecd9e58d..7aa1d631df 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -115,7 +115,7 @@ QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QO void *QXcbEglIntegration::xlib_display() const { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) return m_connection->xlib_display(); #else return EGL_DEFAULT_DISPLAY; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp index 3f7ef94238..9c3fd26d49 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -65,7 +65,7 @@ void QXcbEglWindow::resolveFormat(const QSurfaceFormat &format) m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, format); } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) const xcb_visualtype_t *QXcbEglWindow::createVisual() { QXcbScreen *scr = xcbScreen(); diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h index 3090cef735..e49a3fe2ac 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h @@ -62,7 +62,7 @@ protected: void create() override; void resolveFormat(const QSurfaceFormat &format) override; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) const xcb_visualtype_t *createVisual() override; #endif diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro index 1c193849ca..a39e00ec59 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro @@ -5,8 +5,6 @@ QT += egl_support-private CONFIG += egl -qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB - DEFINES += QT_NO_FOREACH HEADERS += \ diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index 0d02062421..40103a42d7 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -75,7 +75,7 @@ typedef struct xcb_glx_buffer_swap_complete_event_t { } xcb_glx_buffer_swap_complete_event_t; #endif -#if defined(XCB_USE_XLIB) && defined(XCB_USE_GLX) +#if defined(XCB_USE_GLX) typedef struct { int type; unsigned long serial; /* # of last request processed by server */ @@ -197,10 +197,9 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast<Display *>(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "ATI") || !strcmp(glxvendor, "Chromium")) @@ -226,10 +225,9 @@ bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast<Display *>(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "Parallels Inc")) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index 215f5a3fe1..5af6172301 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -4,7 +4,7 @@ include(../gl_integrations_plugin_base.pri) QT += glx_support-private #should be removed from the sources -DEFINES += XCB_USE_GLX XCB_USE_XLIB +DEFINES += XCB_USE_GLX DEFINES += QT_NO_FOREACH qtConfig(xcb-glx) { diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index e0a12f57c2..17927af3e3 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -553,7 +553,7 @@ void QXcbBackingStore::endPaint() return; QPainter p(m_image->image()); while (it != end) { - const QRect rect = *it; + const QRect rect = *(it++); p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } } diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 2985432b7f..94b5994004 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -54,7 +54,7 @@ class QXcbShmImage; class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore { public: - QXcbBackingStore(QWindow *widget); + QXcbBackingStore(QWindow *window); ~QXcbBackingStore(); QPaintDevice *paintDevice() override; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index b4cefd07ed..f0c1659b8e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -69,14 +69,14 @@ #include <xcb/xfixes.h> #include <xcb/xinerama.h> -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include <X11/Xlib.h> #include <X11/Xlib-xcb.h> #include <X11/Xlibint.h> #include <X11/Xutil.h> #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include <X11/extensions/XI2proto.h> #endif @@ -116,7 +116,7 @@ Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen") #define XCB_GE_GENERIC 35 #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: // - "pad0" became "extension" // - "pad1" and "pad" became "pad0" @@ -134,9 +134,9 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) qt_xcb_ge_event_t *e = reinterpret_cast<qt_xcb_ge_event_t *>(event); return e->extension == opCode; } -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(xinput2) -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) static const char * const xcbConnectionErrors[] = { "No error", /* Error 0 */ "I/O error", /* XCB_CONN_ERROR */ @@ -540,7 +540,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , m_nativeInterface(nativeInterface) , has_render_extension(false) { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) Display *dpy = XOpenDisplay(m_displayName.constData()); if (dpy) { m_primaryScreenNumber = DefaultScreen(dpy); @@ -552,7 +552,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra } #else m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreenNumber); -#endif //XCB_USE_XLIB +#endif // QT_CONFIG(xcb_xlib) if (Q_UNLIKELY(!m_connection || xcb_connection_has_error(m_connection))) qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); @@ -587,7 +587,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra initializeScreens(); initializeXRender(); -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2")) initializeXInput2(); #endif @@ -647,7 +647,7 @@ QXcbConnection::~QXcbConnection() delete m_drag; #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) finalizeXInput2(); #endif @@ -668,7 +668,7 @@ QXcbConnection::~QXcbConnection() delete m_glIntegration; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XCloseDisplay(static_cast<Display *>(m_xlib_display)); #else xcb_disconnect(xcb_connection()); @@ -1141,7 +1141,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) } break; } -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) case XCB_GE_GENERIC: // Here the windowEventListener is invoked from xi2HandleEvent() if (m_xi2Enabled && isXIEvent(event, m_xiOpCode)) @@ -1485,7 +1485,7 @@ xcb_window_t QXcbConnection::clientLeader() return m_clientLeader; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) void *QXcbConnection::xlib_display() const { return m_xlib_display; @@ -1508,7 +1508,7 @@ void *QXcbConnection::createVisualInfoForDefaultVisualId() const #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // it is safe to cast XI_* events here as long as we are only touching the first 32 bytes, // after that position event needs memmove, see xi2PrepareXIGenericDeviceEvent static inline bool isXIType(xcb_generic_event_t *event, int opCode, uint16_t type) @@ -1553,7 +1553,7 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, } return false; } -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // compress XI_* events if (responseType == XCB_GE_GENERIC) { if (!m_xi2Enabled) @@ -1561,12 +1561,12 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, // compress XI_Motion, but not from tablet devices if (isXIType(event, m_xiOpCode, XI_Motion)) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) xXIDeviceEvent *xdev = reinterpret_cast<xXIDeviceEvent *>(event); if (!QCoreApplication::testAttribute(Qt::AA_CompressTabletEvents) && const_cast<QXcbConnection *>(this)->tabletDataForDevice(xdev->sourceid)) return false; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) for (int j = nextIndex; j < eventqueue->size(); ++j) { xcb_generic_event_t *next = eventqueue->at(j); if (!isValid(next)) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 8e67621e9b..fd77d56588 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -67,11 +67,11 @@ #undef explicit #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) #include <QTabletEvent> #endif -#if XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #include <X11/extensions/XI2.h> #ifdef XIScrollClass #define XCB_USE_XINPUT21 // XI 2.1 adds smooth scrolling support @@ -80,7 +80,7 @@ #endif #endif struct XInput2TouchDeviceData; -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(xinput2) struct xcb_randr_get_output_info_reply_t; @@ -422,12 +422,12 @@ public: bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; } xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) void *xlib_display() const; void *createVisualInfoForDefaultVisualId() const; #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) void xi2Select(xcb_window_t window); #endif #ifdef XCB_USE_XINPUT21 @@ -552,7 +552,7 @@ private: void destroyScreen(QXcbScreen *screen); void initializeScreens(); bool compressEvent(xcb_generic_event_t *event, int currentIndex, QXcbEventArray *eventqueue) const; -#ifdef XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) bool m_xi2Enabled = false; int m_xi2Minor = 2; void initializeXInput2(); @@ -566,7 +566,7 @@ private: #ifdef XCB_USE_XINPUT22 void xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow); #endif // XCB_USE_XINPUT22 -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) struct TabletData { int deviceId = 0; QTabletEvent::PointerType pointerType = QTabletEvent::UnknownPointer; @@ -588,7 +588,7 @@ private: void xi2ReportTabletEvent(const void *event, TabletData *tabletData); QVector<TabletData> m_tabletData; TabletData *tabletDataForDevice(int id); -#endif // !QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) struct ScrollingDevice { int deviceId = 0; int verticalIndex = 0; @@ -633,11 +633,11 @@ private: QScopedPointer<QXcbWMSupport> m_wmSupport; QXcbNativeInterface *m_nativeInterface = nullptr; -#if defined(XCB_USE_XLIB) +#if QT_CONFIG(xcb_xlib) void *m_xlib_display = nullptr; #endif QXcbEventReader *m_reader = nullptr; -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) QHash<int, XInput2TouchDeviceData*> m_touchDevices; #ifdef XCB_USE_XINPUT22 struct StartSystemResizeInfo { @@ -679,8 +679,8 @@ private: friend class QXcbEventReader; }; -#ifdef XCB_USE_XINPUT2 -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(xinput2) +#if QT_CONFIG(tabletevent) Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); #endif diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 47702741e0..5b80b823de 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -47,8 +47,6 @@ #include <QDebug> #include <cmath> -#ifdef XCB_USE_XINPUT2 - #include <X11/extensions/XInput2.h> #include <X11/extensions/XI2proto.h> @@ -100,7 +98,7 @@ void QXcbConnection::initializeXInput2() void QXcbConnection::xi2SetupDevices() { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) m_tabletData.clear(); #endif m_scrollingDevices.clear(); @@ -116,7 +114,7 @@ void QXcbConnection::xi2SetupDevices() if (devices[i].use != XISlavePointer) continue; qCDebug(lcQpaXInputDevices) << "input device " << devices[i].name << "ID" << devices[i].deviceid; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletData tabletData; #endif ScrollingDevice scrollingDevice; @@ -126,7 +124,7 @@ void QXcbConnection::xi2SetupDevices() XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(devices[i].classes[c]); const int valuatorAtom = qatom(vci->label); qCDebug(lcQpaXInputDevices) << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (valuatorAtom < QXcbAtom::NAtoms) { TabletData::ValuatorClassInfo info; info.minVal = vci->min; @@ -134,7 +132,7 @@ void QXcbConnection::xi2SetupDevices() info.number = vci->number; tabletData.valuatorInfo[valuatorAtom] = info; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) scrollingDevice.lastScrollPosition.setX(vci->value); else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) @@ -191,7 +189,7 @@ void QXcbConnection::xi2SetupDevices() } } bool isTablet = false; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) // If we have found the valuators which we expect a tablet to have, it might be a tablet. if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX) && tabletData.valuatorInfo.contains(QXcbAtom::AbsY) && @@ -241,7 +239,7 @@ void QXcbConnection::xi2SetupDevices() m_tabletData.append(tabletData); qCDebug(lcQpaXInputDevices) << " it's a tablet with pointer type" << dbgType; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) { @@ -330,7 +328,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) #endif // XCB_USE_XINPUT22 QSet<int> tabletDevices; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask); @@ -347,7 +345,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) } XISelectEvents(xDisplay, window, xiEventMask.data(), m_tabletData.count()); } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 // Enable each scroll device @@ -482,12 +480,12 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) return dev; } -#if defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) +#if defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent) static inline qreal fixed1616ToReal(FP1616 val) { return qreal(val) / 0x10000; } -#endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) +#endif // defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent) void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) { @@ -536,13 +534,13 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) return; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!xiEnterEvent) { QXcbConnection::TabletData *tablet = tabletDataForDevice(sourceDeviceId); if (tablet && xi2HandleTabletEvent(xiEvent, tablet)) return; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 QHash<int, ScrollingDevice>::iterator device = m_scrollingDevices.find(sourceDeviceId); @@ -698,10 +696,8 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo if (m_xiGrab) { // XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2) // http://lists.x.org/archives/xorg-devel/2014-July/043059.html -#ifdef XCB_USE_XINPUT2 XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid, xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch); -#endif } break; case XI_TouchUpdate: @@ -1284,6 +1280,4 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id) return Q_NULLPTR; } -#endif // QT_NO_TABLETEVENT - -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(tabletevent) diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index b05a3535b6..da63360333 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -60,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *); typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); typedef int (*PtrXcursorLibraryGetDefaultSize)(void *); -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) #include <X11/Xlib.h> enum { XCursorShape = CursorShape @@ -308,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) const char *cursorStr = "cursor"; xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr); -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static bool function_ptrs_not_initialized = true; if (function_ptrs_not_initialized) { QLibrary xcursorLib(QLatin1String("Xcursor"), 1); @@ -509,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) return cursor; } -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) bool updateCursorTheme(void *dpy, const QByteArray &theme) { if (!ptrXcursorLibraryGetTheme || !ptrXcursorLibrarySetTheme) @@ -553,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) } return cursor; } -#endif // XCB_USE_XLIB / QT_CONFIG(library) +#endif // QT_CONFIG(xcb_xlib) / QT_CONFIG(library) xcb_cursor_t QXcbCursor::createFontCursor(int cshape) { @@ -562,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) xcb_cursor_t cursor = XCB_NONE; // Try Xcursor first -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) if (cshape >= 0 && cshape <= Qt::LastCursor) { void *dpy = connection()->xlib_display(); // special case for non-standard dnd-* cursors diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 41ec4dbbf8..e3f88518fe 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -101,7 +101,7 @@ private: #ifndef QT_NO_CURSOR CursorHash m_cursorHash; #endif -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 94111559b4..4f78f806be 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -63,7 +63,7 @@ #include <QtGui/private/qguiapplication_p.h> -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include <X11/Xlib.h> #if QT_CONFIG(xcb_native_painting) #include "qxcbnativepainting.h" @@ -133,7 +133,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true); qRegisterMetaType<QXcbWindow*>(); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XInitThreads(); #endif m_nativeInterface.reset(new QXcbNativeInterface); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index eff38fc868..76ee8f3fb4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,11 +57,7 @@ #include <QtPlatformHeaders/qxcbintegrationfunctions.h> #include <QtPlatformHeaders/qxcbscreenfunctions.h> -#ifdef XCB_USE_XLIB -# include <X11/Xlib.h> -#else -# include <stdio.h> -#endif +#include <stdio.h> #include <algorithm> @@ -206,7 +202,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr const QXcbScreen *xcbScreen = static_cast<QXcbScreen *>(screen->handle()); switch (resourceType(lowerCaseResource)) { case Display: -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) result = xcbScreen->connection()->xlib_display(); #endif break; @@ -440,7 +436,7 @@ void *QXcbNativeInterface::rootWindow() void *QXcbNativeInterface::display() { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) QXcbIntegration *integration = QXcbIntegration::instance(); QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) @@ -510,7 +506,7 @@ QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window) void *QXcbNativeInterface::displayForWindow(QWindow *window) { -#if defined(XCB_USE_XLIB) +#if QT_CONFIG(xcb_xlib) QXcbScreen *screen = qPlatformScreenForWindow(window); return screen ? screen->connection()->xlib_display() : Q_NULLPTR; #else diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 947d98db58..f22bc83686 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -99,12 +99,12 @@ #include <QTextCodec> #include <stdio.h> -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include <X11/Xlib.h> #include <X11/Xutil.h> #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include <X11/extensions/XInput2.h> #include <X11/extensions/XI2proto.h> #endif @@ -257,7 +257,7 @@ static inline bool positionIncludesFrame(QWindow *w) return qt_window_private(w)->positionPolicy == QWindowPrivate::WindowFrameInclusive; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) { #include <X11/Xatom.h> @@ -303,7 +303,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) #endif return &tp; } -#endif // XCB_USE_XLIB +#endif // QT_CONFIG(xcb_xlib) // TODO move this into a utility function in QWindow or QGuiApplication static QWindow *childWindowAt(QWindow *win, const QPoint &p) @@ -577,7 +577,7 @@ void QXcbWindow::create() 32, 2, (void *)data); -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) connection()->xi2Select(m_window); #endif @@ -588,7 +588,7 @@ void QXcbWindow::create() if (window()->flags() & Qt::WindowTransparentForInput) setTransparentForMouseEvents(true); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) // force sync to read outstanding requests - see QTBUG-29106 XSync(static_cast<Display*>(platformScreen->connection()->xlib_display()), false); #endif @@ -1504,7 +1504,7 @@ void QXcbWindow::setWindowTitle(const QString &title) ba.length(), ba.constData()); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) Display *dpy = static_cast<Display *>(connection()->xlib_display()); XTextProperty *text = qstringToXTP(dpy, title); if (text) diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index b5cefa2726..ba748ea14d 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -51,13 +51,11 @@ HEADERS = \ load(qt_build_paths) DEFINES += QT_BUILD_XCB_PLUGIN -# needed by Xcursor ... + qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB QMAKE_USE += xcb_xlib qtConfig(xinput2) { - DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp QMAKE_USE += xinput2 } diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 1cd1629347..8d991cc721 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -90,7 +90,9 @@ #include <qtreeview.h> #include <qtableview.h> #include <qoperatingsystemversion.h> +#if QT_CONFIG(wizard) #include <qwizard.h> +#endif #include <qdebug.h> #include <qlibrary.h> #include <qdatetimeedit.h> @@ -3090,7 +3092,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_FocusFrame_AboveWidget: ret = true; break; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::MacStyle; break; @@ -4264,6 +4266,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // outside world, unless they read the source, in which case, it's // their own fault). bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem"); + + if (!myTab.documentMode && (myTab.state & State_Selected) && (myTab.state & State_Active)) + if (const auto *tabBar = qobject_cast<const QTabBar *>(w)) + if (!tabBar->tabTextColor(tabBar->currentIndex()).isValid()) + myTab.palette.setColor(QPalette::WindowText, Qt::white); + if (verticalTabs || nonDefaultFont || !tab->icon.isNull() || !myTab.leftButtonSize.isEmpty() || !myTab.rightButtonSize.isEmpty()) { int heightOffset = 0; diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 03282e1bbc..73166b12f7 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -93,7 +93,6 @@ #include <qtoolbutton.h> #include <qtreeview.h> #include <qtableview.h> -#include <qwizard.h> #include <qdebug.h> #include <qdatetimeedit.h> #include <qmath.h> diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index 1a1094a934..ebd3934c90 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -778,10 +778,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt if (qobject_cast<const QMessageBox *> (widget)) buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox")); -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast<const QInputDialog *> (widget)) buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox")); -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) if (buttonBox) { //draw white panel part @@ -2151,6 +2151,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt rect = visualRect(cb->direction, cb->rect, rect); return rect; } + break; #endif // QT_NO_COMBOBOX case CC_TitleBar: if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) { @@ -2321,7 +2322,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) buttonBox->setContentsMargins(0, 9, 0, 0); #endif } -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast<QInputDialog *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground); #if QT_CONFIG(dialogbuttonbox) @@ -2330,7 +2331,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) buttonBox->setContentsMargins(0, 9, 0, 0); #endif } -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover); } @@ -2365,7 +2366,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) buttonBox->setContentsMargins(0, 0, 0, 0); #endif } -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast<QInputDialog *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); #if QT_CONFIG(dialogbuttonbox) @@ -2374,7 +2375,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) buttonBox->setContentsMargins(0, 0, 0, 0); #endif } -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover, false); } else if (qobject_cast<QCommandLinkButton*>(widget)) { diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index beb8c60e3a..a21ce4b531 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -1515,10 +1515,9 @@ case PE_Frame: return; } else if (fillType == BT_NONE) { return; - } else { - break; } } + break; } case PE_FrameLineEdit: { // we try to check if this lineedit is a delegate on a QAbstractItemView-derived class. @@ -2434,6 +2433,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op p->restore(); return; } + break; #endif // QT_NO_RUBBERBAND case CE_HeaderEmptyArea: if (option->state & State_Horizontal) @@ -3760,10 +3760,9 @@ int QWindowsXPStyle::styleHint(StyleHint hint, const QStyleOption *option, const break; #ifndef QT_NO_RUBBERBAND case SH_RubberBand_Mask: - if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) { + if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) res = 0; - break; - } + break; #endif // QT_NO_RUBBERBAND case SH_ItemView_DrawDelegateFrame: diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 8d2a633481..ad38281145 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -40,7 +40,8 @@ "features.combobox", "features.cups", "features.datetimeedit", - "features.groupbox" + "features.groupbox", + "features.tablewidget" ], "output": [ "privateFeature", "feature" ] }, diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index 53a6224f49..5b81440a3c 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -94,9 +94,9 @@ private: #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool)) Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog()) -# if !defined(QT_NO_MESSAGEBOX) +#if QT_CONFIG(messagebox) Q_PRIVATE_SLOT(d_func(), void _q_checkFields()) -# endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) friend class QUnixPrintWidget; # endif // Q_OS_UNIX }; diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 32a06a4f7e..51c8a593a1 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -41,12 +41,18 @@ #include <QtPrintSupport/private/qtprintsupportglobal_p.h> #include "private/qabstractprintdialog_p.h" +#if QT_CONFIG(messagebox) #include <QtWidgets/qmessagebox.h> +#endif #include "qprintdialog.h" +#if QT_CONFIG(filedialog) #include "qfiledialog.h" +#endif #include <QtCore/qdir.h> #include <QtGui/qevent.h> +#if QT_CONFIG(filesystemmodel) #include <QtWidgets/qfilesystemmodel.h> +#endif #include <QtWidgets/qstyleditemdelegate.h> #include <QtPrintSupport/qprinter.h> @@ -57,7 +63,7 @@ #include <QtWidgets/qdialogbuttonbox.h> -#include "private/qfscompleter_p.h" +#include <private/qcompleter_p.h> #include "ui_qprintpropertieswidget.h" #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" @@ -201,7 +207,7 @@ public: void selectPrinter(const QPrinter::OutputFormat outputFormat); void _q_togglePageSetCombo(bool); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) void _q_checkFields(); #endif void _q_collapseOrExpandDialog(); @@ -335,7 +341,7 @@ void QPrintDialogPrivate::init() lay->addWidget(bottom); lay->addWidget(buttons); -#ifdef QT_NO_MESSAGEBOX +#if !QT_CONFIG(messagebox) QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(accept())); #else QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(_q_checkFields())); @@ -494,14 +500,14 @@ void QPrintDialogPrivate::_q_collapseOrExpandDialog() } } -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) void QPrintDialogPrivate::_q_checkFields() { Q_Q(QPrintDialog); if (top->d->checkFields()) q->accept(); } -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) void QPrintDialogPrivate::updateWidgets() @@ -673,7 +679,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter * } widget.properties->setEnabled(true); -#if !defined(QT_NO_FILESYSTEMMODEL) && !defined(QT_NO_COMPLETER) +#if QT_CONFIG(filesystemmodel) && !defined(QT_NO_COMPLETER) QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); @@ -780,7 +786,7 @@ void QUnixPrintWidgetPrivate::setOptionsPane(QPrintDialogPrivate *pane) void QUnixPrintWidgetPrivate::_q_btnBrowseClicked() { QString filename = widget.filename->text(); -#ifndef QT_NO_FILEDIALOG +#if QT_CONFIG(filedialog) filename = QFileDialog::getSaveFileName(parent, QPrintDialog::tr("Print To File ..."), filename, QString(), 0, QFileDialog::DontConfirmOverwrite); #else @@ -834,7 +840,7 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties() propertiesDialog->applyPrinterProperties(printer); } -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) bool QUnixPrintWidgetPrivate::checkFields() { if (widget.filename->isEnabled()) { @@ -885,7 +891,7 @@ bool QUnixPrintWidgetPrivate::checkFields() // Every test passed. Accept the dialog. return true; } -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) void QUnixPrintWidgetPrivate::setupPrinterProperties() { diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp index fd23aea460..dbcbaf3ce5 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.cpp +++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp @@ -51,7 +51,9 @@ #include <QtWidgets/qstyle.h> #include <QtWidgets/qtoolbutton.h> #include <QtGui/qvalidator.h> +#if QT_CONFIG(filedialog) #include <QtWidgets/qfiledialog.h> +#endif #include <QtWidgets/qmainwindow.h> #include <QtWidgets/qtoolbar.h> #include <QtCore/QCoreApplication> diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index e84651ccd5..e11e25e1da 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -88,14 +88,16 @@ mac { LIBS += -framework Foundation load(sdk) - platform_dev_frameworks_path = $${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks - - # We can't put this path into LIBS (so that it propagates to the prl file), as we - # don't know yet if the target that links to testlib will build under Xcode or not. - # The corresponding flags for the target lives in xctest.prf, where we do know. - QMAKE_LFLAGS += -F$${platform_dev_frameworks_path} -weak_framework XCTest - QMAKE_CXXFLAGS += -F$${platform_dev_frameworks_path} - MODULE_CONFIG += xctest + !isEmpty(QMAKE_MAC_SDK_PLATFORM_PATH) { + platform_dev_frameworks_path = $${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks + + # We can't put this path into LIBS (so that it propagates to the prl file), as we + # don't know yet if the target that links to testlib will build under Xcode or not. + # The corresponding flags for the target lives in xctest.prf, where we do know. + QMAKE_LFLAGS += -F$${platform_dev_frameworks_path} -weak_framework XCTest + QMAKE_CXXFLAGS += -F$${platform_dev_frameworks_path} + MODULE_CONFIG += xctest + } } } diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index f7de57fae3..b9f71ddb15 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -559,6 +559,9 @@ void Moc::parse() if (test(EQ)) { // namespace Foo = Bar::Baz; until(SEMIC); + } else if (test(LPAREN)) { + // Ignore invalid code such as: 'namespace __identifier("x")' (QTBUG-56634) + until(RPAREN); } else if (!test(SEMIC)) { NamespaceDef def; def.classname = nsName; diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 397a58a5d4..4770c513cf 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -51,7 +51,9 @@ #include <qstyle.h> #include <qstyleoption.h> #include <qtooltip.h> +#if QT_CONFIG(whatsthis) #include <qwhatsthis.h> +#endif #include <qtreeview.h> #include <private/qtabbar_p.h> #include <QAbstractScrollArea> diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index eec9a0021c..3cef564781 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -43,7 +43,7 @@ #include <qtableview.h> #include <qlistview.h> #include <qtreeview.h> -#include <private/qtreewidget_p.h> +#include <private/qtreeview_p.h> #ifndef QT_NO_ACCESSIBILITY diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index d5f7449e57..f18930f273 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -48,7 +48,9 @@ #include "qlabel.h" #endif #include "qtooltip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "qwidget.h" #include "qdebug.h" #include <qmath.h> @@ -436,7 +438,7 @@ QString QAccessibleWidget::text(QAccessible::Text t) const #endif break; case QAccessible::Help: -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) str = widget()->whatsThis(); #endif break; diff --git a/src/widgets/configure.json b/src/widgets/configure.json index f19188e584..2c183dad65 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -426,13 +426,6 @@ "section": "Widgets", "output": [ "publicFeature", "feature" ] }, - "whatsthis": { - "label": "QWhatsThis", - "purpose": "Supports displaying \"What's this\" help.", - "section": "Widgets", - "condition": "features.toolbutton", - "output": [ "publicFeature", "feature" ] - }, "sizegrip": { "label": "QSizeGrip", "purpose": "Provides corner-grips for resizing top-level windows.", diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index c9438696fa..c2625ec1f4 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -1,42 +1,17 @@ # Qt dialogs module HEADERS += \ - dialogs/qcolordialog.h \ - dialogs/qfscompleter_p.h \ - dialogs/qerrormessage.h \ - dialogs/qfiledialog.h \ - dialogs/qfiledialog_p.h \ dialogs/qfontdialog.h \ - dialogs/qfontdialog_p.h \ - dialogs/qinputdialog.h \ - dialogs/qmessagebox.h \ - dialogs/qprogressdialog.h \ - dialogs/qsidebar_p.h \ - dialogs/qfilesystemmodel.h \ - dialogs/qfilesystemmodel_p.h \ - dialogs/qfileinfogatherer_p.h \ - dialogs/qwizard.h - -win32 { - HEADERS += dialogs/qwizard_win_p.h - SOURCES += dialogs/qwizard_win.cpp -} - -FORMS += dialogs/qfiledialog.ui + dialogs/qfontdialog_p.h INCLUDEPATH += $$PWD SOURCES += \ - dialogs/qcolordialog.cpp \ - dialogs/qerrormessage.cpp \ - dialogs/qfiledialog.cpp \ - dialogs/qfontdialog.cpp \ - dialogs/qinputdialog.cpp \ - dialogs/qmessagebox.cpp \ - dialogs/qprogressdialog.cpp \ - dialogs/qsidebar.cpp \ - dialogs/qfilesystemmodel.cpp \ - dialogs/qfileinfogatherer.cpp \ - dialogs/qwizard.cpp \ + dialogs/qfontdialog.cpp + +qtConfig(colordialog) { + HEADERS += dialogs/qcolordialog.h + SOURCES += dialogs/qcolordialog.cpp +} qtConfig(dialog) { HEADERS += \ @@ -47,4 +22,61 @@ qtConfig(dialog) { dialogs/qdialog.cpp } -RESOURCES += dialogs/qmessagebox.qrc +qtConfig(errormessage) { + HEADERS += dialogs/qerrormessage.h + SOURCES += dialogs/qerrormessage.cpp +} + +qtConfig(filedialog) { + HEADERS += \ + dialogs/qfiledialog.h \ + dialogs/qfiledialog_p.h \ + dialogs/qsidebar_p.h + + SOURCES += \ + dialogs/qfiledialog.cpp \ + dialogs/qsidebar.cpp + + FORMS += dialogs/qfiledialog.ui +} + +qtConfig(filesystemmodel) { + HEADERS += \ + dialogs/qfilesystemmodel.h \ + dialogs/qfilesystemmodel_p.h \ + dialogs/qfileinfogatherer_p.h + + SOURCES += \ + dialogs/qfilesystemmodel.cpp \ + dialogs/qfileinfogatherer.cpp +} + +qtConfig(fscompleter) { + HEADERS += dialogs/qfscompleter_p.h +} + +qtConfig(inputdialog) { + HEADERS += dialogs/qinputdialog.h + SOURCES += dialogs/qinputdialog.cpp +} + +qtConfig(messagebox) { + HEADERS += dialogs/qmessagebox.h + SOURCES += dialogs/qmessagebox.cpp + RESOURCES += dialogs/qmessagebox.qrc +} + +qtConfig(progressdialog) { + HEADERS += dialogs/qprogressdialog.h + SOURCES += dialogs/qprogressdialog.cpp +} + +qtConfig(wizard) { + HEADERS += dialogs/qwizard.h + SOURCES += dialogs/qwizard.cpp + + win32 { + HEADERS += dialogs/qwizard_win_p.h + SOURCES += dialogs/qwizard_win.cpp + } +} diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index dbcd2d7fe2..f361770c3e 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -39,8 +39,6 @@ #include "qcolordialog.h" -#ifndef QT_NO_COLORDIALOG - #include "qapplication.h" #include "qdesktopwidget.h" #include "qdrawutil.h" @@ -2289,6 +2287,3 @@ QT_END_NAMESPACE #include "qcolordialog.moc" #include "moc_qcolordialog.cpp" - -#endif // QT_NO_COLORDIALOG - diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index fb5b843ce4..a27cfaf953 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -42,12 +42,11 @@ #include <QtWidgets/qtwidgetsglobal.h> -#ifndef QT_NO_COLORDIALOG - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(colordialog); +QT_BEGIN_NAMESPACE class QColorDialogPrivate; @@ -127,6 +126,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions) QT_END_NAMESPACE -#endif // QT_NO_COLORDIALOG - #endif // QCOLORDIALOG_H diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 60e1c43721..7cb24d65fc 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -37,20 +37,31 @@ ** ****************************************************************************/ +#include <QtWidgets/qtwidgetsglobal.h> +#if QT_CONFIG(colordialog) #include "qcolordialog.h" +#endif #include "qfontdialog.h" +#if QT_CONFIG(filedialog) #include "qfiledialog.h" +#endif #include "qevent.h" #include "qdesktopwidget.h" #include "qapplication.h" #include "qlayout.h" #include "qsizegrip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "qmenu.h" #include "qcursor.h" +#if QT_CONFIG(messagebox) #include "qmessagebox.h" +#endif +#if QT_CONFIG(errormessage) #include "qerrormessage.h" +#endif #include <qpa/qplatformtheme.h> #include "private/qdialog_p.h" #include "private/qguiapplication_p.h" @@ -62,11 +73,11 @@ QT_BEGIN_NAMESPACE static inline int themeDialogType(const QDialog *dialog) { -#ifndef QT_NO_FILEDIALOG +#if QT_CONFIG(filedialog) if (qobject_cast<const QFileDialog *>(dialog)) return QPlatformTheme::FileDialog; #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) if (qobject_cast<const QColorDialog *>(dialog)) return QPlatformTheme::ColorDialog; #endif @@ -74,11 +85,11 @@ static inline int themeDialogType(const QDialog *dialog) if (qobject_cast<const QFontDialog *>(dialog)) return QPlatformTheme::FontDialog; #endif -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) if (qobject_cast<const QMessageBox *>(dialog)) return QPlatformTheme::MessageDialog; #endif -#ifndef QT_NO_ERRORMESSAGE +#if QT_CONFIG(errormessage) if (qobject_cast<const QErrorMessage *>(dialog)) return QPlatformTheme::MessageDialog; #endif @@ -607,7 +618,7 @@ bool QDialog::eventFilter(QObject *o, QEvent *e) /*! \reimp */ void QDialog::contextMenuEvent(QContextMenuEvent *e) { -#if defined(QT_NO_WHATSTHIS) || defined(QT_NO_MENU) +#if !QT_CONFIG(whatsthis) || defined(QT_NO_MENU) Q_UNUSED(e); #else QWidget *w = childAt(e->pos()); @@ -672,7 +683,7 @@ void QDialog::keyPressEvent(QKeyEvent *e) /*! \reimp */ void QDialog::closeEvent(QCloseEvent *e) { -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (isModal() && QWhatsThis::inWhatsThisMode()) QWhatsThis::leaveWhatsThisMode(); #endif diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 4ec4da6e1a..39035b743d 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -39,13 +39,13 @@ #include "qerrormessage.h" -#ifndef QT_NO_ERRORMESSAGE - #include "qapplication.h" #include "qcheckbox.h" #include "qlabel.h" #include "qlayout.h" +#if QT_CONFIG(messagebox) #include "qmessagebox.h" +#endif #include "qpushbutton.h" #include "qstringlist.h" #include "qtextedit.h" @@ -234,7 +234,7 @@ QErrorMessage::QErrorMessage(QWidget * parent) grid->setColumnStretch(1, 42); grid->setRowStretch(0, 42); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif @@ -390,5 +390,3 @@ void QErrorMessagePrivate::retranslateStrings() QT_END_NAMESPACE #include "moc_qerrormessage.cpp" - -#endif // QT_NO_ERRORMESSAGE diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h index 976ba9abd5..4cb1fad845 100644 --- a/src/widgets/dialogs/qerrormessage.h +++ b/src/widgets/dialogs/qerrormessage.h @@ -42,12 +42,11 @@ #include <QtWidgets/qtwidgetsglobal.h> -#ifndef QT_NO_ERRORMESSAGE - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(errormessage); +QT_BEGIN_NAMESPACE class QErrorMessagePrivate; @@ -75,6 +74,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_ERRORMESSAGE - #endif // QERRORMESSAGE_H diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 98f8147236..b638adeaec 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -43,7 +43,6 @@ #include <private/qwidgetitemdata_p.h> #include "qfiledialog.h" -#ifndef QT_NO_FILEDIALOG #include "qfiledialog_p.h" #include <private/qguiapplication_p.h> #include <qfontmetrics.h> @@ -52,8 +51,9 @@ #include <qshortcut.h> #include <qgridlayout.h> #include <qmenu.h> +#if QT_CONFIG(messagebox) #include <qmessagebox.h> -#include <qinputdialog.h> +#endif #include <stdlib.h> #include <qsettings.h> #include <qdebug.h> @@ -841,7 +841,7 @@ void QFileDialog::setVisible(bool visible) // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below // updates the state correctly, but skips showing the non-native version: setAttribute(Qt::WA_DontShowOnScreen); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) // So the completer doesn't try to complete and therefore show a popup if (!d->nativeDialogInUse) d->completer->setModel(0); @@ -849,7 +849,7 @@ void QFileDialog::setVisible(bool visible) } else { d->createWidgets(); setAttribute(Qt::WA_DontShowOnScreen, false); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) if (!d->nativeDialogInUse) { if (d->proxyModel != 0) d->completer->setModel(d->proxyModel); @@ -922,7 +922,7 @@ void QFileDialog::setDirectory(const QString &directory) if (!d->nativeDialogInUse) { d->qFileDialogUi->newFolderButton->setEnabled(d->model->flags(root) & Qt::ItemIsDropEnabled); if (root != d->rootIndex()) { -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) if (directory.endsWith(QLatin1Char('/'))) d->completer->setCompletionPrefix(newDirectory); else @@ -2629,11 +2629,11 @@ void QFileDialog::accept() if (!info.exists()) info = QFileInfo(d->getEnvironmentVariable(fn)); if (!info.exists()) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QString message = tr("%1\nDirectory not found.\nPlease verify the " "correct directory name was given."); QMessageBox::warning(this, windowTitle(), message.arg(info.fileName())); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) return; } if (info.isDir()) { @@ -2661,7 +2661,7 @@ void QFileDialog::accept() if (!info.exists() || !confirmOverwrite() || acceptMode() == AcceptOpen) { d->emitFilesSelected(QStringList(fn)); QDialog::accept(); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) } else { if (QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") @@ -2683,11 +2683,11 @@ void QFileDialog::accept() if (!info.exists()) info = QFileInfo(d->getEnvironmentVariable(file)); if (!info.exists()) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QString message = tr("%1\nFile not found.\nPlease verify the " "correct file name was given."); QMessageBox::warning(this, windowTitle(), message.arg(info.fileName())); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) return; } if (info.isDir()) { @@ -2909,10 +2909,10 @@ void QFileDialogPrivate::createWidgets() #ifndef QT_NO_SHORTCUT qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit); #endif -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) completer = new QFSCompleter(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); -#endif // QT_NO_FSCOMPLETER +#endif // QT_CONFIG(fscompleter) qFileDialogUi->fileNameEdit->setInputMethodHints(Qt::ImhNoPredictiveText); @@ -3078,7 +3078,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) proxyModel->setSourceModel(d->model); d->qFileDialogUi->listView->setModel(d->proxyModel); d->qFileDialogUi->treeView->setModel(d->proxyModel); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) d->completer->setModel(d->proxyModel); d->completer->proxyModel = d->proxyModel; #endif @@ -3088,7 +3088,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) d->proxyModel = 0; d->qFileDialogUi->listView->setModel(d->model); d->qFileDialogUi->treeView->setModel(d->model); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) d->completer->setModel(d->model); d->completer->sourceModel = d->model; d->completer->proxyModel = 0; @@ -3430,7 +3430,7 @@ void QFileDialogPrivate::_q_deleteCurrent() bool isDir = model->isDir(index); QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt()); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) Q_Q(QFileDialog); if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") @@ -3446,12 +3446,12 @@ void QFileDialogPrivate::_q_deleteCurrent() #else if (!(p & QFile::WriteUser)) return; -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) // the event loop has run, we can NOT reuse index because the model might have removed it. if (isDir) { if (!removeDirectory(filePath)) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QMessageBox::warning(q, q->windowTitle(), QFileDialog::tr("Could not delete directory.")); #endif @@ -3632,7 +3632,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) */ void QFileDialogPrivate::_q_goToDirectory(const QString &path) { - #ifndef QT_NO_MESSAGEBOX + #if QT_CONFIG(messagebox) Q_Q(QFileDialog); #endif QModelIndex index = qFileDialogUi->lookInCombo->model()->index(qFileDialogUi->lookInCombo->currentIndex(), @@ -3651,12 +3651,12 @@ void QFileDialogPrivate::_q_goToDirectory(const QString &path) if (dir.exists() || path2.isEmpty() || path2 == model->myComputer().toString()) { _q_enterDirectory(index); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) } else { QString message = QFileDialog::tr("%1\nDirectory not found.\nPlease verify the " "correct directory name was given."); QMessageBox::warning(q, q->windowTitle(), message.arg(path2)); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) } } @@ -4028,7 +4028,7 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) e->accept(); } -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) QString QFSCompleter::pathFromIndex(const QModelIndex &index) const { @@ -4134,5 +4134,3 @@ QStringList QFSCompleter::splitPath(const QString &path) const QT_END_NAMESPACE #include "moc_qfiledialog.cpp" - -#endif // QT_NO_FILEDIALOG diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 733dd03092..b9092e036d 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -44,13 +44,11 @@ #include <QtCore/qdir.h> #include <QtCore/qstring.h> #include <QtCore/qurl.h> - -#ifndef QT_NO_FILEDIALOG - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(filedialog); +QT_BEGIN_NAMESPACE class QModelIndex; class QItemSelection; @@ -316,6 +314,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options) QT_END_NAMESPACE -#endif // QT_NO_FILEDIALOG - #endif // QFILEDIALOG_H diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index d5df7542b6..f7a3c6b091 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -53,8 +53,6 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> -#ifndef QT_NO_FILEDIALOG - #include "qfiledialog.h" #include "private/qdialog_p.h" #include "qplatformdefs.h" @@ -75,12 +73,16 @@ #include <qpointer.h> #include <qdebug.h> #include "qsidebar_p.h" +#if QT_CONFIG(fscompleter) #include "qfscompleter_p.h" +#endif #if defined (Q_OS_UNIX) #include <unistd.h> #endif +QT_REQUIRE_CONFIG(filedialog); + QT_BEGIN_NAMESPACE class QFileDialogListView; @@ -231,9 +233,9 @@ public: QStringList watching; QFileSystemModel *model; -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) QFSCompleter *completer; -#endif //QT_NO_FSCOMPLETER +#endif //QT_CONFIG(fscompleter) QString setWindowTitle; @@ -432,6 +434,4 @@ QString QFileDialogPrivate::selectedNameFilter_sys() const QT_END_NAMESPACE -#endif // QT_NO_FILEDIALOG - #endif // QFILEDIALOG_P_H diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 08c5a40c7c..9f2d15d31b 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_FILESYSTEMMODEL - #ifdef QT_BUILD_INTERNAL static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false); Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot() @@ -366,8 +364,6 @@ void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bo } } -#endif // QT_NO_FILESYSTEMMODEL - QT_END_NAMESPACE #include "moc_qfileinfogatherer_p.cpp" diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index 0018b6c387..52578126de 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -66,6 +66,8 @@ #include <private/qfilesystemengine_p.h> +QT_REQUIRE_CONFIG(filesystemmodel); + QT_BEGIN_NAMESPACE class QExtendedInformation { @@ -150,8 +152,6 @@ private : class QFileIconProvider; -#ifndef QT_NO_FILESYSTEMMODEL - class Q_AUTOTEST_EXPORT QFileInfoGatherer : public QThread { Q_OBJECT @@ -208,9 +208,6 @@ private: QFileIconProvider *m_iconProvider; // not accessed by run() QFileIconProvider defaultProvider; }; -#endif // QT_NO_FILESYSTEMMODEL - QT_END_NAMESPACE #endif // QFILEINFOGATHERER_H - diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 45a6b4f8a0..872b8daf22 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -43,7 +43,9 @@ #include <qmimedata.h> #include <qurl.h> #include <qdebug.h> +#if QT_CONFIG(messagebox) #include <qmessagebox.h> +#endif #include <qapplication.h> #include <QtCore/qcollator.h> @@ -56,8 +58,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_FILESYSTEMMODEL - /*! \enum QFileSystemModel::Roles \value FileIconRole @@ -867,12 +867,12 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in if (newName.isEmpty() || QDir::toNativeSeparators(newName).contains(QDir::separator()) || !QDir(parentPath).rename(oldName, newName)) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"), QFileSystemModel::tr("<b>The name \"%1\" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks.") .arg(newName), QMessageBox::Ok); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) return false; } else { /* @@ -1979,5 +1979,3 @@ bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const QT_END_NAMESPACE #include "moc_qfilesystemmodel.cpp" - -#endif // QT_NO_FILESYSTEMMODEL diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index 7d790124c8..a5f23c9220 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -47,10 +47,9 @@ #include <QtGui/qicon.h> #include <QtCore/qdiriterator.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(filesystemmodel); -#ifndef QT_NO_FILESYSTEMMODEL +QT_BEGIN_NAMESPACE class ExtendedInformation; class QFileSystemModelPrivate; @@ -166,9 +165,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const { return qvariant_cast<QIcon>(aindex.data(Qt::DecorationRole)); } -#endif // QT_NO_FILESYSTEMMODEL - QT_END_NAMESPACE #endif // QFILESYSTEMMODEL_H - diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index e7149a3097..640225529b 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -54,8 +54,6 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qfilesystemmodel.h" -#ifndef QT_NO_FILESYSTEMMODEL - #include <private/qabstractitemmodel_p.h> #include <qabstractitemmodel.h> #include "qfileinfogatherer_p.h" @@ -66,6 +64,8 @@ #include <qtimer.h> #include <qhash.h> +QT_REQUIRE_CONFIG(filesystemmodel); + QT_BEGIN_NAMESPACE class ExtendedInformation; @@ -313,9 +313,7 @@ public: }; Q_DECLARE_TYPEINFO(QFileSystemModelPrivate::Fetching, Q_MOVABLE_TYPE); -#endif // QT_NO_FILESYSTEMMODEL QT_END_NAMESPACE #endif - diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h index c073fa1521..ce0612f293 100644 --- a/src/widgets/dialogs/qfscompleter_p.h +++ b/src/widgets/dialogs/qfscompleter_p.h @@ -55,9 +55,9 @@ #include "qcompleter.h" #include <QtWidgets/qfilesystemmodel.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(fscompleter); -#ifndef QT_NO_FSCOMPLETER +QT_BEGIN_NAMESPACE /*! QCompleter that can deal with QFileSystemModel @@ -78,8 +78,6 @@ public: QFileSystemModel *sourceModel; }; -#endif // QT_NO_FSCOMPLETER - QT_END_NAMESPACE #endif // QFSCOMPLETOR_P_H diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index 4ca3923d8d..04d13045e5 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -39,8 +39,6 @@ #include "qinputdialog.h" -#ifndef QT_NO_INPUTDIALOG - #include "qapplication.h" #include "qcombobox.h" #include "qdialogbuttonbox.h" @@ -48,7 +46,7 @@ #include "qlayout.h" #include "qlineedit.h" #include "qplaintextedit.h" -#include "qlistwidget.h" +#include "qlistview.h" #include "qpushbutton.h" #include "qspinbox.h" #include "qstackedlayout.h" @@ -1507,5 +1505,3 @@ QT_END_NAMESPACE #include "qinputdialog.moc" #include "moc_qinputdialog.cpp" - -#endif // QT_NO_INPUTDIALOG diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h index 7b43e774a7..5f06785886 100644 --- a/src/widgets/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -44,12 +44,11 @@ #include <QtCore/qstring.h> #include <QtWidgets/qlineedit.h> -#ifndef QT_NO_INPUTDIALOG - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(inputdialog); +QT_BEGIN_NAMESPACE class QInputDialogPrivate; @@ -212,6 +211,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions) QT_END_NAMESPACE -#endif // QT_NO_INPUTDIALOG - #endif // QINPUTDIALOG_H diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 7a98fae99c..843a1bf341 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -39,8 +39,6 @@ #include <QtWidgets/qmessagebox.h> -#ifndef QT_NO_MESSAGEBOX - #include <QtWidgets/qdialogbuttonbox.h> #include "private/qlabel_p.h" #include "private/qapplication_p.h" @@ -2737,5 +2735,3 @@ QT_END_NAMESPACE #include "moc_qmessagebox.cpp" #include "qmessagebox.moc" - -#endif // QT_NO_MESSAGEBOX diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index 40e5c701fe..6d5179602b 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -42,12 +42,11 @@ #include <QtWidgets/qtwidgetsglobal.h> -#ifndef QT_NO_MESSAGEBOX - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(messagebox); +QT_BEGIN_NAMESPACE class QLabel; class QMessageBoxPrivate; @@ -325,6 +324,4 @@ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplicatio QT_END_NAMESPACE -#endif // QT_NO_MESSAGEBOX - #endif // QMESSAGEBOX_H diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 0a6253ea27..a276e28a0c 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -39,8 +39,6 @@ #include "qprogressdialog.h" -#ifndef QT_NO_PROGRESSDIALOG - #include "qshortcut.h" #include "qpainter.h" #include "qdrawutil.h" @@ -886,5 +884,3 @@ void QProgressDialog::open(QObject *receiver, const char *member) QT_END_NAMESPACE #include "moc_qprogressdialog.cpp" - -#endif // QT_NO_PROGRESSDIALOG diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h index f4e63fb088..902a4de5d2 100644 --- a/src/widgets/dialogs/qprogressdialog.h +++ b/src/widgets/dialogs/qprogressdialog.h @@ -42,12 +42,11 @@ #include <QtWidgets/qtwidgetsglobal.h> -#ifndef QT_NO_PROGRESSDIALOG - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(progressdialog); +QT_BEGIN_NAMESPACE class QPushButton; class QLabel; @@ -130,6 +129,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PROGRESSDIALOG - #endif // QPROGRESSDIALOG_H diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index 9bb046db61..b8b042ddb5 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -40,8 +40,6 @@ #include "qsidebar_p.h" #include "qfilesystemmodel.h" -#ifndef QT_NO_FILEDIALOG - #include <qaction.h> #include <qurl.h> #include <qmenu.h> @@ -518,5 +516,3 @@ bool QSidebar::event(QEvent * event) QT_END_NAMESPACE #include "moc_qsidebar_p.cpp" - -#endif diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h index 0685e81b2b..17d576e54d 100644 --- a/src/widgets/dialogs/qsidebar_p.h +++ b/src/widgets/dialogs/qsidebar_p.h @@ -52,13 +52,13 @@ // #include <QtWidgets/private/qtwidgetsglobal_p.h> -#include <qlistwidget.h> +#include <qlistview.h> #include <qstandarditemmodel.h> #include <qstyleditemdelegate.h> #include <qurl.h> #include <qvector.h> -#ifndef QT_NO_FILEDIALOG +QT_REQUIRE_CONFIG(filedialog); QT_BEGIN_NAMESPACE @@ -159,7 +159,5 @@ private: QT_END_NAMESPACE -#endif // QT_NO_FILEDIALOG - #endif // QSIDEBAR_H diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index c272511aae..7bb72a00b7 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -40,8 +40,6 @@ #include "qwizard.h" #include <QtWidgets/private/qtwidgetsglobal_p.h> -#ifndef QT_NO_WIZARD - #include "qabstractspinbox.h" #include "qalgorithms.h" #include "qapplication.h" @@ -3986,5 +3984,3 @@ QWizard *QWizardPage::wizard() const QT_END_NAMESPACE #include "moc_qwizard.cpp" - -#endif // QT_NO_WIZARD diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index 3236ee90df..4d03bf91d4 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -41,13 +41,11 @@ #define QWIZARD_H #include <QtWidgets/qtwidgetsglobal.h> - -#ifndef QT_NO_WIZARD - #include <QtWidgets/qdialog.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(wizard); +QT_BEGIN_NAMESPACE class QAbstractButton; class QWizardPage; @@ -261,6 +259,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_WIZARD - #endif // QWIZARD_H diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 4ab01aca66..666b192e9c 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -37,8 +37,6 @@ ** ****************************************************************************/ -#ifndef QT_NO_WIZARD - #include <QtWidgets/private/qtwidgetsglobal_p.h> #if QT_CONFIG(style_windowsvista) @@ -724,5 +722,3 @@ int QVistaHelper::topOffset() QT_END_NAMESPACE #endif // style_windowsvista - -#endif // QT_NO_WIZARD diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h index bbba53b879..f9122865c2 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -53,7 +53,6 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> -#ifndef QT_NO_WIZARD #if QT_CONFIG(style_windowsvista) #include <qobject.h> @@ -63,6 +62,8 @@ #include <QtWidgets/private/qstylehelper_p.h> #include <qt_windows.h> +QT_REQUIRE_CONFIG(wizard); + QT_BEGIN_NAMESPACE class QVistaBackButton : public QAbstractButton @@ -157,5 +158,4 @@ private: QT_END_NAMESPACE #endif // style_windowsvista -#endif // QT_NO_WIZARD #endif // QWIZARD_WIN_P_H diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 0b9e6e7216..eface182ae 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -1273,7 +1273,7 @@ void QGraphicsProxyWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event) { Q_D(QGraphicsProxyWidget); diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h index 8112c65d63..c1564cba34 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.h +++ b/src/widgets/graphicsview/qgraphicsproxywidget.h @@ -103,7 +103,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 9d7412340f..f5f24649c2 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -3409,7 +3409,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event) #endif } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ @@ -3437,7 +3437,7 @@ void QGraphicsView::wheelEvent(QWheelEvent *event) if (!event->isAccepted()) QAbstractScrollArea::wheelEvent(event); } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! \reimp diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 64d5f5b430..fb975b9d71 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -259,7 +259,7 @@ protected: void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri index ed0e3fe072..af0a6f6898 100644 --- a/src/widgets/itemviews/itemviews.pri +++ b/src/widgets/itemviews/itemviews.pri @@ -17,16 +17,9 @@ HEADERS += \ itemviews/qabstractitemdelegate_p.h \ itemviews/qitemdelegate.h \ itemviews/qdirmodel.h \ - itemviews/qlistwidget.h \ - itemviews/qlistwidget_p.h \ - itemviews/qtablewidget.h \ - itemviews/qtablewidget_p.h \ - itemviews/qtreewidget.h \ - itemviews/qtreewidget_p.h \ itemviews/qwidgetitemdata_p.h \ itemviews/qitemeditorfactory.h \ itemviews/qitemeditorfactory_p.h \ - itemviews/qtreewidgetitemiterator.h \ itemviews/qdatawidgetmapper.h \ itemviews/qstyleditemdelegate.h @@ -40,11 +33,7 @@ SOURCES += \ itemviews/qabstractitemdelegate.cpp \ itemviews/qitemdelegate.cpp \ itemviews/qdirmodel.cpp \ - itemviews/qlistwidget.cpp \ - itemviews/qtablewidget.cpp \ - itemviews/qtreewidget.cpp \ itemviews/qitemeditorfactory.cpp \ - itemviews/qtreewidgetitemiterator.cpp \ itemviews/qdatawidgetmapper.cpp \ itemviews/qstyleditemdelegate.cpp } @@ -60,6 +49,33 @@ qtConfig(columnview) { itemviews/qcolumnviewgrip.cpp } +qtConfig(listwidget) { + HEADERS += \ + itemviews/qlistwidget.h \ + itemviews/qlistwidget_p.h + + SOURCES += itemviews/qlistwidget.cpp +} + +qtConfig(tablewidget) { + HEADERS += \ + itemviews/qtablewidget.h \ + itemviews/qtablewidget_p.h + + SOURCES += itemviews/qtablewidget.cpp +} + +qtConfig(treewidget) { + HEADERS += \ + itemviews/qtreewidget.h \ + itemviews/qtreewidget_p.h \ + itemviews/qtreewidgetitemiterator.h + + SOURCES += \ + itemviews/qtreewidget.cpp \ + itemviews/qtreewidgetitemiterator.cpp +} + HEADERS += \ itemviews/qfileiconprovider.h \ itemviews/qfileiconprovider_p.h \ diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index f7c170f0bb..5b119cc79e 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -43,7 +43,9 @@ #include <qabstractitemmodel.h> #include <qabstractitemview.h> #include <qfontmetrics.h> +#if QT_CONFIG(whatsthis) #include <qwhatsthis.h> +#endif #include <qtooltip.h> #include <qevent.h> #include <qstring.h> @@ -393,7 +395,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event, } break;} #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: { if (index.data(Qt::WhatsThisRole).isValid()) return true; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index e1b6f52225..b225678e0b 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -48,7 +48,6 @@ #include <qdrag.h> #include <qevent.h> #include <qscrollbar.h> -#include <qwhatsthis.h> #include <qtooltip.h> #include <qdatetime.h> #include <qlineedit.h> @@ -174,7 +173,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index if (index.isValid()) { emit q->entered(index); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QString statustip = model->data(index, Qt::StatusTipRole).toString(); if (parent && (shouldClearStatusTip || !statustip.isEmpty())) { QStatusTipEvent tip(statustip); @@ -183,7 +182,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index } #endif } else { -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) if (parent && shouldClearStatusTip) { QString emptyString; QStatusTipEvent tip( emptyString ); @@ -1704,7 +1703,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event) break; case QEvent::Leave: d->setHoverIndex(QModelIndex()); // If we've left, no hover should be needed anymore - #ifndef QT_NO_STATUSTIP + #if QT_CONFIG(statustip) if (d->shouldClearStatusTip && d->parent) { QString empty; QStatusTipEvent tip(empty); diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 20b160c03d..89d0c7f93c 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -47,7 +47,9 @@ #include <qpainter.h> #include <qscrollbar.h> #include <qtooltip.h> +#if QT_CONFIG(whatsthis) #include <qwhatsthis.h> +#endif #include <qstyle.h> #include <qstyleoption.h> #include <qvector.h> @@ -2653,7 +2655,7 @@ bool QHeaderView::viewportEvent(QEvent *e) } break; } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: { QHelpEvent *he = static_cast<QHelpEvent*>(e); int logical = logicalIndexAt(he->pos()); @@ -2673,8 +2675,8 @@ bool QHeaderView::viewportEvent(QEvent *e) } } break; } -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_STATUSTIP +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(statustip) case QEvent::StatusTip: { QHelpEvent *he = static_cast<QHelpEvent*>(e); int logical = logicalIndexAt(he->pos()); @@ -2685,7 +2687,7 @@ bool QHeaderView::viewportEvent(QEvent *e) setStatusTip(statustip); } return true; } -#endif // QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) case QEvent::FontChange: case QEvent::StyleChange: d->invalidateCachedSizeHint(); diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 33943399d1..bc0ca7dc1c 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -800,7 +800,7 @@ void QListView::mouseReleaseEvent(QMouseEvent *e) } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ @@ -827,7 +827,7 @@ void QListView::wheelEvent(QWheelEvent *e) QApplication::sendEvent(d->hbar, e); } } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! \reimp diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h index e918e66d38..6b164aeec8 100644 --- a/src/widgets/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -153,7 +153,7 @@ protected: void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 7611e5c1ca..95ad3f82d0 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -39,7 +39,6 @@ #include "qlistwidget.h" -#ifndef QT_NO_LISTWIDGET #include <qitemdelegate.h> #include <private/qlistview_p.h> #include <private/qwidgetitemdata_p.h> @@ -1983,5 +1982,3 @@ QT_END_NAMESPACE #include "moc_qlistwidget.cpp" #include "moc_qlistwidget_p.cpp" - -#endif // QT_NO_LISTWIDGET diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index fee99fa428..50f4e2ac84 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -46,10 +46,9 @@ #include <QtCore/qvector.h> #include <QtCore/qitemselectionmodel.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(listwidget); -#ifndef QT_NO_LISTWIDGET +QT_BEGIN_NAMESPACE class QListWidget; class QListModel; @@ -100,7 +99,7 @@ public: inline void setToolTip(const QString &toolTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis() const { return data(Qt::WhatsThisRole).toString(); } inline void setWhatsThis(const QString &whatsThis); @@ -180,7 +179,7 @@ inline void QListWidgetItem::setToolTip(const QString &atoolTip) { setData(Qt::ToolTipRole, atoolTip); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QListWidgetItem::setWhatsThis(const QString &awhatsThis) { setData(Qt::WhatsThisRole, awhatsThis); } #endif @@ -340,8 +339,6 @@ inline void QListWidgetItem::setHidden(bool ahide) inline bool QListWidgetItem::isHidden() const { return (view ? view->isItemHidden(this) : false); } -#endif // QT_NO_LISTWIDGET - QT_END_NAMESPACE #endif // QLISTWIDGET_H diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h index 0594fd511e..e8f5540f9c 100644 --- a/src/widgets/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -58,7 +58,7 @@ #include <private/qlistview_p.h> #include <private/qwidgetitemdata_p.h> -#ifndef QT_NO_LISTWIDGET +QT_REQUIRE_CONFIG(listwidget); QT_BEGIN_NAMESPACE @@ -171,6 +171,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_LISTWIDGET - #endif // QLISTWIDGET_P_H diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 7bb11aef14..bb1970e3ac 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -39,7 +39,6 @@ #include "qtablewidget.h" -#ifndef QT_NO_TABLEWIDGET #include <qitemdelegate.h> #include <qpainter.h> #include <private/qtablewidget_p.h> @@ -2729,5 +2728,3 @@ QT_END_NAMESPACE #include "moc_qtablewidget.cpp" #include "moc_qtablewidget_p.cpp" - -#endif // QT_NO_TABLEWIDGET diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 092ce77306..9c231d5127 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -44,12 +44,10 @@ #include <QtWidgets/qtableview.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> -//#include <QtWidgets/qitemselectionmodel.h> - -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(tablewidget); -#ifndef QT_NO_TABLEWIDGET +QT_BEGIN_NAMESPACE class Q_WIDGETS_EXPORT QTableWidgetSelectionRange { @@ -118,7 +116,7 @@ public: inline void setToolTip(const QString &toolTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis() const { return data(Qt::WhatsThisRole).toString(); } inline void setWhatsThis(const QString &whatsThis); @@ -198,7 +196,7 @@ inline void QTableWidgetItem::setToolTip(const QString &atoolTip) { setData(Qt::ToolTipRole, atoolTip); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QTableWidgetItem::setWhatsThis(const QString &awhatsThis) { setData(Qt::WhatsThisRole, awhatsThis); } #endif @@ -379,8 +377,6 @@ inline void QTableWidgetItem::setSelected(bool aselect) inline bool QTableWidgetItem::isSelected() const { return (view ? view->isItemSelected(this) : false); } -#endif // QT_NO_TABLEWIDGET - QT_END_NAMESPACE #endif // QTABLEWIDGET_H diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h index 2db7337cd6..6412477be0 100644 --- a/src/widgets/itemviews/qtablewidget_p.h +++ b/src/widgets/itemviews/qtablewidget_p.h @@ -58,7 +58,7 @@ #include <private/qtableview_p.h> #include <private/qwidgetitemdata_p.h> -#ifndef QT_NO_TABLEWIDGET +QT_REQUIRE_CONFIG(tablewidget); QT_BEGIN_NAMESPACE @@ -218,6 +218,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_TABLEWIDGET - #endif // QTABLEWIDGET_P_H diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index a58da489aa..d7b46a0835 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -39,7 +39,6 @@ #include "qtreewidget.h" -#ifndef QT_NO_TREEWIDGET #include <qheaderview.h> #include <qpainter.h> #include <qitemdelegate.h> @@ -3476,5 +3475,3 @@ QT_END_NAMESPACE #include "moc_qtreewidget.cpp" #include "moc_qtreewidget_p.cpp" - -#endif // QT_NO_TREEWIDGET diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index 5fa6ffcd17..783627cde9 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -46,10 +46,9 @@ #include <QtCore/qvariant.h> #include <QtCore/qvector.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(treewidget); -#ifndef QT_NO_TREEWIDGET +QT_BEGIN_NAMESPACE class QTreeWidget; class QTreeModel; @@ -120,7 +119,7 @@ public: inline void setToolTip(int column, const QString &toolTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis(int column) const { return data(column, Qt::WhatsThisRole).toString(); } inline void setWhatsThis(int column, const QString &whatsThis); @@ -225,7 +224,7 @@ inline void QTreeWidgetItem::setText(int column, const QString &atext) inline void QTreeWidgetItem::setIcon(int column, const QIcon &aicon) { setData(column, Qt::DecorationRole, aicon); } -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) inline void QTreeWidgetItem::setStatusTip(int column, const QString &astatusTip) { setData(column, Qt::StatusTipRole, astatusTip); } #endif @@ -235,7 +234,7 @@ inline void QTreeWidgetItem::setToolTip(int column, const QString &atoolTip) { setData(column, Qt::ToolTipRole, atoolTip); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QTreeWidgetItem::setWhatsThis(int column, const QString &awhatsThis) { setData(column, Qt::WhatsThisRole, awhatsThis); } #endif @@ -432,8 +431,6 @@ inline void QTreeWidgetItem::setDisabled(bool disabled) inline bool QTreeWidgetItem::isDisabled() const { return !(flags() & Qt::ItemIsEnabled); } -#endif // QT_NO_TREEWIDGET - QT_END_NAMESPACE #endif // QTREEWIDGET_H diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h index 7789693db4..7aa4daefc0 100644 --- a/src/widgets/itemviews/qtreewidget_p.h +++ b/src/widgets/itemviews/qtreewidget_p.h @@ -59,7 +59,7 @@ #include <private/qtreeview_p.h> #include <QtWidgets/qheaderview.h> -#ifndef QT_NO_TREEWIDGET +QT_REQUIRE_CONFIG(treewidget); QT_BEGIN_NAMESPACE @@ -242,6 +242,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_TREEWIDGET - #endif // QTREEWIDGET_P_H diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp index 4f27af70a8..1c1f60bc37 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp +++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp @@ -42,8 +42,6 @@ #include "qtreewidget_p.h" #include "qwidgetitemdata_p.h" -#ifndef QT_NO_TREEWIDGET - QT_BEGIN_NAMESPACE /*! @@ -453,5 +451,3 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * */ QT_END_NAMESPACE - -#endif // QT_NO_TREEWIDGET diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h index db17a96abd..39e0244776 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.h +++ b/src/widgets/itemviews/qtreewidgetitemiterator.h @@ -43,10 +43,9 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qscopedpointer.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(treewidget); -#ifndef QT_NO_TREEWIDGET +QT_BEGIN_NAMESPACE class QTreeWidget; class QTreeWidgetItem; @@ -146,7 +145,5 @@ inline QTreeWidgetItem *QTreeWidgetItemIterator::operator*() const Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags) - QT_END_NAMESPACE -#endif // QT_NO_TREEWIDGET #endif // QTREEWIDGETITEMITERATOR_H diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri index c91be918b6..3e3c795839 100644 --- a/src/widgets/kernel/kernel.pri +++ b/src/widgets/kernel/kernel.pri @@ -24,7 +24,6 @@ HEADERS += \ kernel/qsizepolicy.h \ kernel/qstackedlayout.h \ kernel/qtooltip.h \ - kernel/qwhatsthis.h \ kernel/qwidget.h \ kernel/qwidget_p.h \ kernel/qwidgetaction.h \ @@ -52,7 +51,6 @@ SOURCES += \ kernel/qsizepolicy.cpp \ kernel/qstackedlayout.cpp \ kernel/qtooltip.cpp \ - kernel/qwhatsthis.cpp \ kernel/qwidget.cpp \ kernel/qwidgetaction.cpp \ kernel/qgesture.cpp \ @@ -87,3 +85,8 @@ qtConfig(formlayout) { HEADERS += kernel/qformlayout.h SOURCES += kernel/qformlayout.cpp } + +qtConfig(whatsthis) { + HEADERS += kernel/qwhatsthis.h + SOURCES += kernel/qwhatsthis.cpp +} diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 130c354132..57b1f31188 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -93,7 +93,7 @@ QActionPrivate::~QActionPrivate() bool QActionPrivate::showStatusText(QWidget *widget, const QString &str) { -#ifdef QT_NO_STATUSTIP +#if !QT_CONFIG(statustip) Q_UNUSED(widget); Q_UNUSED(str); #else diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index dc75d5eee7..0286a11612 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -65,7 +65,9 @@ #include "qdebug.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" +#if QT_CONFIG(messagebox) #include "qmessagebox.h" +#endif #include "qwidgetwindow_p.h" #include <QtWidgets/qgraphicsproxywidget.h> #include <QtGui/qstylehints.h> @@ -73,7 +75,7 @@ #include <QtGui/private/qwindow_p.h> #include <QtGui/qtouchdevice.h> #include <qpa/qplatformtheme.h> -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) #include <QtWidgets/QWhatsThis> #endif @@ -407,7 +409,7 @@ QWidget *QApplicationPrivate::main_widget = 0; // main application widget QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show() QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QPointer<QWidget> QApplicationPrivate::wheel_widget; #endif bool qt_in_tab_key_event = false; @@ -1916,9 +1918,9 @@ void QApplication::closeAllWindows() */ void QApplication::aboutQt() { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QMessageBox::aboutQt(activeWindow()); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) } /*! @@ -1999,7 +2001,7 @@ bool QApplication::event(QEvent *e) } else if (te->timerId() == d->toolTipFallAsleep.timerId()) { d->toolTipFallAsleep.stop(); } -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) } else if (e->type() == QEvent::EnterWhatsThisMode) { QWhatsThis::enterWhatsThisMode(); return true; @@ -2987,13 +2989,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::MouseMove: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: @@ -3230,7 +3232,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) d->hoverGlobalPos = mouse->globalPos(); } break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: { QWidget* w = static_cast<QWidget *>(receiver); @@ -3352,7 +3354,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif // QT_NO_CONTEXTMENU -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: @@ -3382,9 +3384,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e) tablet->setAccepted(eventAccepted); } break; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) -#if !defined(QT_NO_TOOLTIP) || !defined(QT_NO_WHATSTHIS) +#if !defined(QT_NO_TOOLTIP) || QT_CONFIG(whatsthis) case QEvent::ToolTip: case QEvent::WhatsThis: case QEvent::QueryWhatsThis: @@ -3409,7 +3411,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif -#if !defined(QT_NO_STATUSTIP) || !defined(QT_NO_WHATSTHIS) +#if QT_CONFIG(statustip) || QT_CONFIG(whatsthis) case QEvent::StatusTip: case QEvent::WhatsThisClicked: { @@ -4043,7 +4045,7 @@ int QApplication::keyboardInputInterval() \sa QStyleHints::wheelScrollLines() */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) int QApplication::wheelScrollLines() { return styleHints()->wheelScrollLines(); diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index be5ec2ad05..396d0c9474 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -76,7 +76,7 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime) Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval) Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval) -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines) #endif Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut) @@ -154,7 +154,7 @@ public: static void setKeyboardInputInterval(int); static int keyboardInputInterval(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) static void setWheelScrollLines(int); static int wheelScrollLines(); #endif diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index f20d10fe6f..1bd114aad7 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -195,7 +195,7 @@ public: static QWidget *focus_widget; static QWidget *hidden_focus_widget; static QWidget *active_window; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) static int wheel_scroll_lines; static QPointer<QWidget> wheel_widget; #endif diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 5ea306f463..5bc408a8cd 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -1427,6 +1427,8 @@ bool QOpenGLWidget::event(QEvent *e) break; if (d->initialized) d->reset(); + if (isHidden()) + break; // FALLTHROUGH case QEvent::Show: // reparenting may not lead to a resize so reinitalize on Show too if (d->initialized && window()->windowHandle() diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index be5788274e..a09cba0ddc 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -42,7 +42,9 @@ #ifndef QT_NO_SHORTCUT #include <qevent.h> +#if QT_CONFIG(whatsthis) #include <qwhatsthis.h> +#endif #include <qmenu.h> #include <qmenubar.h> #include <qapplication.h> @@ -641,7 +643,7 @@ bool QShortcut::event(QEvent *e) if (d->sc_enabled && e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast<QShortcutEvent *>(e); if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){ -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (QWhatsThis::inWhatsThisMode()) { QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); handled = true; diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 4286019717..e2cfebb8a1 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qwhatsthis.h" -#ifndef QT_NO_WHATSTHIS #include "qpointer.h" #include "qapplication.h" #include <private/qguiapplication_p.h> @@ -54,7 +53,6 @@ #include "qtextdocument.h" #include <qpa/qplatformtheme.h> #include "private/qtextdocumentlayout_p.h" -#include "qtoolbutton.h" #include "qdebug.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -681,5 +679,3 @@ QAction *QWhatsThis::createAction(QObject *parent) QT_END_NAMESPACE #include "qwhatsthis.moc" - -#endif // QT_NO_WHATSTHIS diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h index 746fd3ff22..3211796d3e 100644 --- a/src/widgets/kernel/qwhatsthis.h +++ b/src/widgets/kernel/qwhatsthis.h @@ -44,10 +44,9 @@ #include <QtCore/qobject.h> #include <QtGui/qcursor.h> -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(whatsthis); -#ifndef QT_NO_WHATSTHIS +QT_BEGIN_NAMESPACE class QAction; @@ -67,8 +66,6 @@ public: }; -#endif // QT_NO_WHATSTHIS - QT_END_NAMESPACE #endif // QWHATSTHIS_H diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 95e1a247bb..b0e5900f36 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -70,7 +70,9 @@ #include "private/qwidgetwindow_p.h" #include "qpainter.h" #include "qtooltip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "qdebug.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" @@ -5114,8 +5116,11 @@ void qt_qpa_set_cursor(QWidget *w, bool force) \snippet code/src_gui_kernel_qwidget.cpp 8 - \note To obtain the contents of an OpenGL widget, use QGLWidget::grabFrameBuffer() - or QGLWidget::renderPixmap() instead. + \note To obtain the contents of a QOpenGLWidget, use QOpenGLWidget::grabFramebuffer() + instead. + + \note To obtain the contents of a QGLWidget (deprecated), use + QGLWidget::grabFrameBuffer() or QGLWidget::renderPixmap() instead. */ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, RenderFlags renderFlags) @@ -5845,7 +5850,7 @@ QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) con void QWidgetEffectSourcePrivate::draw(QPainter *painter) { - if (!context || context->painter != painter || !context->sharedPainter) { + if (!context || context->painter != painter) { m_widget->render(painter); return; } @@ -8762,7 +8767,7 @@ bool QWidget::event(QEvent *event) case QEvent::ContextMenu: case QEvent::KeyPress: case QEvent::KeyRelease: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif return false; @@ -8786,12 +8791,12 @@ bool QWidget::event(QEvent *event) case QEvent::MouseButtonDblClick: mouseDoubleClickEvent((QMouseEvent*)event); break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: wheelEvent((QWheelEvent*)event); break; #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: if (static_cast<QTabletEvent *>(event)->buttons() == Qt::NoButton && !testAttribute(Qt::WA_TabletTracking)) break; @@ -8838,7 +8843,7 @@ bool QWidget::event(QEvent *event) } } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (!k->isAccepted() && k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1 && d->whatsThis.size()) { @@ -8906,7 +8911,7 @@ bool QWidget::event(QEvent *event) break; case QEvent::Enter: -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) if (d->statusTip.size()) { QStatusTipEvent tip(d->statusTip); QApplication::sendEvent(const_cast<QWidget *>(this), &tip); @@ -8916,7 +8921,7 @@ bool QWidget::event(QEvent *event) break; case QEvent::Leave: -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) if (d->statusTip.size()) { QString empty; QStatusTipEvent tip(empty); @@ -9137,7 +9142,7 @@ bool QWidget::event(QEvent *event) event->ignore(); break; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::WhatsThis: if (d->whatsThis.size()) QWhatsThis::showText(static_cast<QHelpEvent *>(event)->globalPos(), d->whatsThis, this); @@ -9403,7 +9408,7 @@ void QWidget::mouseDoubleClickEvent(QMouseEvent *event) mousePressEvent(event); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! This event handler, for event \a event, can be reimplemented in a subclass to receive wheel events for the widget. @@ -9422,9 +9427,9 @@ void QWidget::wheelEvent(QWheelEvent *event) { event->ignore(); } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) /*! This event handler, for event \a event, can be reimplemented in a subclass to receive tablet events for the widget. @@ -9449,7 +9454,7 @@ void QWidget::tabletEvent(QTabletEvent *event) { event->ignore(); } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) /*! This event handler, for event \a event, can be reimplemented in a @@ -10494,7 +10499,7 @@ static void sendWindowChangeToTextureChildrenRecursively(QWidget *widget) for (int i = 0; i < d->children.size(); ++i) { QWidget *w = qobject_cast<QWidget *>(d->children.at(i)); - if (w && !w->isWindow() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) + if (w && !w->isWindow() && QWidgetPrivate::get(w)->textureChildSeen) sendWindowChangeToTextureChildrenRecursively(w); } } @@ -11542,7 +11547,7 @@ int QWidget::toolTipDuration() const #endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) /*! \property QWidget::statusTip \brief the widget's status tip @@ -11562,9 +11567,9 @@ QString QWidget::statusTip() const Q_D(const QWidget); return d->statusTip; } -#endif // QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \property QWidget::whatsThis @@ -11585,7 +11590,7 @@ QString QWidget::whatsThis() const Q_D(const QWidget); return d->whatsThis; } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_ACCESSIBILITY /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 1c378924a0..87a841c729 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -183,10 +183,10 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) Q_PROPERTY(int toolTipDuration READ toolTipDuration WRITE setToolTipDuration) #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) #endif #ifndef QT_NO_ACCESSIBILITY @@ -386,11 +386,11 @@ public: void setToolTipDuration(int msec); int toolTipDuration() const; #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) void setStatusTip(const QString &); QString statusTip() const; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void setWhatsThis(const QString &); QString whatsThis() const; #endif @@ -613,7 +613,7 @@ protected: virtual void mouseReleaseEvent(QMouseEvent *event); virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *event); #endif virtual void keyPressEvent(QKeyEvent *event); @@ -629,7 +629,7 @@ protected: #ifndef QT_NO_CONTEXTMENU virtual void contextMenuEvent(QContextMenuEvent *event); #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) virtual void tabletEvent(QTabletEvent *event); #endif #ifndef QT_NO_ACTION diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index b830895788..db054b9c58 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -702,10 +702,10 @@ public: QString toolTip; int toolTipDuration; #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QString statusTip; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QString whatsThis; #endif #ifndef QT_NO_ACCESSIBILITY diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 653714743c..d5d4ae844b 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -283,7 +283,7 @@ bool QWidgetWindow::event(QEvent *event) handleResizeEvent(static_cast<QResizeEvent *>(event)); return true; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: handleWheelEvent(static_cast<QWheelEvent *>(event)); return true; @@ -317,7 +317,7 @@ bool QWidgetWindow::event(QEvent *event) } return true; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletPress: case QEvent::TabletMove: case QEvent::TabletRelease: @@ -794,7 +794,7 @@ void QWidgetWindow::handleCloseEvent(QCloseEvent *event) event->setAccepted(is_closing); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QWidgetWindow::handleWheelEvent(QWheelEvent *event) { @@ -824,7 +824,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event) QGuiApplication::forwardEvent(widget, &translated, event); } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) #ifndef QT_NO_DRAGANDDROP @@ -978,7 +978,7 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long return m_widget->nativeEvent(eventType, message, result); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) void QWidgetWindow::handleTabletEvent(QTabletEvent *event) { static QPointer<QWidget> qt_tablet_target = 0; @@ -1008,7 +1008,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton) qt_tablet_target = 0; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifndef QT_NO_GESTURES void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e) diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h index 4c7e30da2f..be3f808a22 100644 --- a/src/widgets/kernel/qwidgetwindow_p.h +++ b/src/widgets/kernel/qwidgetwindow_p.h @@ -92,7 +92,7 @@ protected: void handleTouchEvent(QTouchEvent *); void handleMoveEvent(QMoveEvent *); void handleResizeEvent(QResizeEvent *); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void handleWheelEvent(QWheelEvent *); #endif #ifndef QT_NO_DRAGANDDROP @@ -103,7 +103,7 @@ protected: void handleExposeEvent(QExposeEvent *); void handleWindowStateChangedEvent(QWindowStateChangeEvent *event); bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) void handleTabletEvent(QTabletEvent *); #endif #ifndef QT_NO_GESTURES diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index 8d722a4475..543011b754 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -100,10 +100,10 @@ static QEvent *cloneEvent(QEvent *e) return new QEvent(*e); case QEvent::HideToParent: return new QEvent(*e); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: return new QWheelEvent(*static_cast<QWheelEvent*>(e)); -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) case QEvent::WindowTitleChange: return new QEvent(*e); case QEvent::WindowIconChange: @@ -183,12 +183,12 @@ static QEvent *cloneEvent(QEvent *e) return new QEvent(*e); case QEvent::Style: return new QEvent(*e); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: return new QTabletEvent(*static_cast<QTabletEvent*>(e)); -#endif //QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) case QEvent::OkRequest: return new QEvent(*e); case QEvent::HelpRequest: @@ -223,10 +223,10 @@ static QEvent *cloneEvent(QEvent *e) return new QHelpEvent(*static_cast<QHelpEvent*>(e)); case QEvent::WhatsThis: return new QHelpEvent(*static_cast<QHelpEvent*>(e)); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) case QEvent::StatusTip: return new QStatusTipEvent(*static_cast<QStatusTipEvent*>(e)); -#endif //QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) #ifndef QT_NO_ACTION case QEvent::ActionChanged: case QEvent::ActionAdded: @@ -243,10 +243,10 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::ShortcutOverride: return new QKeyEvent(*static_cast<QKeyEvent*>(e)); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::WhatsThisClicked: return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e)); -#endif //QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_TOOLBAR case QEvent::ToolBarChange: @@ -372,11 +372,11 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::DynamicPropertyChange: return new QDynamicPropertyChangeEvent(*static_cast<QDynamicPropertyChangeEvent*>(e)); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: return new QTabletEvent(*static_cast<QTabletEvent*>(e)); -#endif //QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) case QEvent::NonClientAreaMouseMove: case QEvent::NonClientAreaMouseButtonPress: diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7c6466f5da..8bad65273e 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -74,7 +74,9 @@ #include <private/qmath_p.h> #include <qdebug.h> #include <qtextformat.h> +#if QT_CONFIG(wizard) #include <qwizard.h> +#endif #include <qfileinfo.h> #include <qdir.h> #include <qsettings.h> @@ -5187,7 +5189,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget vret->variant = fmt; } break; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::ClassicStyle; break; diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 1120958b87..704a226866 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -65,7 +65,9 @@ #include <qslider.h> #include <qsplitter.h> #include <qprogressbar.h> +#if QT_CONFIG(wizard) #include <qwizard.h> +#endif #include <qdrawutil.h> #include <private/qstylehelper_p.h> #include <private/qdrawhelper_p.h> @@ -3683,7 +3685,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW case SH_MessageBox_TextInteractionFlags: return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: return QWizard::ClassicStyle; #endif diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index b537931f49..efbb972a06 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -60,7 +60,9 @@ #include "qfile.h" #include "qtextstream.h" #include "qpixmapcache.h" +#if QT_CONFIG(wizard) #include "qwizard.h" +#endif #include "qlistview.h" #include <private/qmath_p.h> #include <qmath.h> @@ -621,7 +623,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid } break; #endif // QT_NO_RUBBERBAND -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::ModernStyle; break; diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index e22f0e7f28..96f91188b8 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -148,7 +148,9 @@ #include "QtWidgets/qscrollbar.h" #include "QtCore/qstringlistmodel.h" #include "QtWidgets/qdirmodel.h" +#if QT_CONFIG(filesystemmodel) #include "QtWidgets/qfilesystemmodel.h" +#endif #include "QtWidgets/qheaderview.h" #include "QtWidgets/qlistview.h" #include "QtWidgets/qapplication.h" @@ -467,7 +469,7 @@ QMatchData QCompletionEngine::filterHistory() const bool isDirModel = false; #endif Q_UNUSED(isDirModel) -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) const bool isFsModel = (qobject_cast<QFileSystemModel *>(source) != 0); #else const bool isFsModel = false; @@ -889,7 +891,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted) completion += QDir::separator(); } #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) // add a trailing separator in inline if (mode == QCompleter::InlineCompletion) { if (qobject_cast<QFileSystemModel *>(proxy->sourceModel()) && QFileInfo(completion).isDir()) @@ -1061,7 +1063,7 @@ void QCompleter::setModel(QAbstractItemModel *model) { Q_D(QCompleter); QAbstractItemModel *oldModel = d->proxy->sourceModel(); -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) if (qobject_cast<const QFileSystemModel *>(oldModel)) setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel #endif @@ -1079,7 +1081,7 @@ void QCompleter::setModel(QAbstractItemModel *model) #endif } #endif // QT_NO_DIRMODEL -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model); if (fsModel) { #if defined(Q_OS_WIN) @@ -1090,7 +1092,7 @@ void QCompleter::setModel(QAbstractItemModel *model) setCompletionRole(QFileSystemModel::FileNameRole); connect(fsModel, SIGNAL(directoryLoaded(QString)), this, SLOT(_q_fileSystemModelDirectoryLoaded(QString))); } -#endif // QT_NO_FILESYSTEMMODEL +#endif // QT_CONFIG(filesystemmodel) } /*! @@ -1787,7 +1789,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const #ifndef QT_NO_DIRMODEL isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0; #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) isFsModel = qobject_cast<QFileSystemModel *>(d->proxy->sourceModel()) != 0; #endif if (!isDirModel && !isFsModel) @@ -1799,7 +1801,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const QString t; if (isDirModel) t = sourceModel->data(idx, Qt::EditRole).toString(); -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) else t = sourceModel->data(idx, QFileSystemModel::FileNameRole).toString(); #endif @@ -1837,7 +1839,7 @@ QStringList QCompleter::splitPath(const QString& path) const Q_D(const QCompleter); isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0; #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) #ifdef QT_NO_DIRMODEL Q_D(const QCompleter); #endif diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index cbd5d9eb80..fd9fdfb507 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -210,7 +210,7 @@ bool QSystemTrayIconSys::event(QEvent *e) case QEvent::ToolTip: QApplication::sendEvent(q, e); break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: return QApplication::sendEvent(q, e); #endif diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp index ec4fc2788a..f9605c7a2f 100644 --- a/src/widgets/util/qundogroup.cpp +++ b/src/widgets/util/qundogroup.cpp @@ -41,8 +41,6 @@ #include "qundostack.h" #include "qundostack_p.h" -#ifndef QT_NO_UNDOGROUP - QT_BEGIN_NAMESPACE class QUndoGroupPrivate : public QObjectPrivate @@ -502,5 +500,3 @@ QAction *QUndoGroup::createRedoAction(QObject *parent, const QString &prefix) co QT_END_NAMESPACE #include "moc_qundogroup.cpp" - -#endif // QT_NO_UNDOGROUP diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h index 4e2fdeed26..dba79ea706 100644 --- a/src/widgets/util/qundogroup.h +++ b/src/widgets/util/qundogroup.h @@ -44,15 +44,14 @@ #include <QtCore/qobject.h> #include <QtCore/qstring.h> +QT_REQUIRE_CONFIG(undogroup); + QT_BEGIN_NAMESPACE class QUndoGroupPrivate; class QUndoStack; class QAction; - -#ifndef QT_NO_UNDOGROUP - class Q_WIDGETS_EXPORT QUndoGroup : public QObject { Q_OBJECT @@ -97,8 +96,6 @@ private: Q_DISABLE_COPY(QUndoGroup) }; -#endif // QT_NO_UNDOGROUP - QT_END_NAMESPACE #endif // QUNDOGROUP_H diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index dc0b6855ac..b371e903a6 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -39,11 +39,11 @@ #include <QtCore/qdebug.h> #include "qundostack.h" +#if QT_CONFIG(undogroup) #include "qundogroup.h" +#endif #include "qundostack_p.h" -#ifndef QT_NO_UNDOCOMMAND - QT_BEGIN_NAMESPACE /*! @@ -340,9 +340,7 @@ const QUndoCommand *QUndoCommand::child(int index) const return d->child_list.at(index); } -#endif // QT_NO_UNDOCOMMAND - -#ifndef QT_NO_UNDOSTACK +#if QT_CONFIG(undostack) /*! \class QUndoStack @@ -544,7 +542,7 @@ bool QUndoStackPrivate::checkUndoLimit() QUndoStack::QUndoStack(QObject *parent) : QObject(*(new QUndoStackPrivate), parent) { -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) if (QUndoGroup *group = qobject_cast<QUndoGroup*>(parent)) group->addStack(this); #endif @@ -559,7 +557,7 @@ QUndoStack::QUndoStack(QObject *parent) QUndoStack::~QUndoStack() { -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) Q_D(QUndoStack); if (d->group != 0) d->group->removeStack(this); @@ -1247,7 +1245,7 @@ int QUndoStack::undoLimit() const void QUndoStack::setActive(bool active) { -#ifdef QT_NO_UNDOGROUP +#if !QT_CONFIG(undogroup) Q_UNUSED(active); #else Q_D(QUndoStack); @@ -1263,7 +1261,7 @@ void QUndoStack::setActive(bool active) bool QUndoStack::isActive() const { -#ifdef QT_NO_UNDOGROUP +#if !QT_CONFIG(undogroup) return true; #else Q_D(const QUndoStack); @@ -1332,4 +1330,4 @@ QT_END_NAMESPACE #include "moc_qundostack.cpp" #include "moc_qundostack_p.cpp" -#endif // QT_NO_UNDOSTACK +#endif // QT_CONFIG(undostack) diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index 2a8f4decb6..7ab90b507a 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -44,15 +44,14 @@ #include <QtCore/qobject.h> #include <QtCore/qstring.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(undocommand); +QT_BEGIN_NAMESPACE class QAction; class QUndoCommandPrivate; class QUndoStackPrivate; -#ifndef QT_NO_UNDOCOMMAND - class Q_WIDGETS_EXPORT QUndoCommand { QUndoCommandPrivate *d; @@ -83,9 +82,7 @@ private: friend class QUndoStack; }; -#endif // QT_NO_UNDOCOMMAND - -#ifndef QT_NO_UNDOSTACK +#if QT_CONFIG(undostack) class Q_WIDGETS_EXPORT QUndoStack : public QObject { @@ -150,7 +147,7 @@ private: friend class QUndoGroup; }; -#endif // QT_NO_UNDOSTACK +#endif // QT_CONFIG(undostack) QT_END_NAMESPACE diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h index e92a1fe620..04bc381114 100644 --- a/src/widgets/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -74,7 +74,7 @@ public: bool obsolete; }; -#ifndef QT_NO_UNDOSTACK +#if QT_CONFIG(undostack) class QUndoStackPrivate : public QObjectPrivate { @@ -108,7 +108,6 @@ private: }; #endif // QT_NO_ACTION - QT_END_NAMESPACE -#endif // QT_NO_UNDOSTACK +#endif // QT_CONFIG(undostack) #endif // QUNDOSTACK_P_H diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 93c1778ea2..b56aa42aed 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -40,9 +40,9 @@ #include "qundostack.h" #include "qundoview.h" -#ifndef QT_NO_UNDOVIEW - +#if QT_CONFIG(undogroup) #include "qundogroup.h" +#endif #include <QtCore/qabstractitemmodel.h> #include <QtCore/qpointer.h> #include <QtGui/qicon.h> @@ -273,12 +273,12 @@ class QUndoViewPrivate : public QListViewPrivate Q_DECLARE_PUBLIC(QUndoView) public: QUndoViewPrivate() : -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) group(0), #endif model(0) {} -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) QPointer<QUndoGroup> group; #endif QUndoModel *model; @@ -318,7 +318,7 @@ QUndoView::QUndoView(QUndoStack *stack, QWidget *parent) setStack(stack); } -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) /*! Constructs a new view with parent \a parent and sets the observed group to \a group. @@ -334,7 +334,7 @@ QUndoView::QUndoView(QUndoGroup *group, QWidget *parent) setGroup(group); } -#endif // QT_NO_UNDOGROUP +#endif // QT_CONFIG(undogroup) /*! Destroys this view. @@ -369,13 +369,13 @@ QUndoStack *QUndoView::stack() const void QUndoView::setStack(QUndoStack *stack) { Q_D(QUndoView); -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) setGroup(0); #endif d->model->setStack(stack); } -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) /*! Sets the group displayed by this view to \a group. If \a group is 0, the view will @@ -423,7 +423,7 @@ QUndoGroup *QUndoView::group() const return d->group; } -#endif // QT_NO_UNDOGROUP +#endif // QT_CONFIG(undogroup) /*! \property QUndoView::emptyLabel @@ -473,5 +473,3 @@ QT_END_NAMESPACE #include "qundoview.moc" #include "moc_qundoview.cpp" - -#endif // QT_NO_UNDOVIEW diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h index 3ed9ea5989..0bfcdd0c18 100644 --- a/src/widgets/util/qundoview.h +++ b/src/widgets/util/qundoview.h @@ -44,7 +44,7 @@ #include <QtWidgets/qlistview.h> #include <QtCore/qstring.h> -#ifndef QT_NO_UNDOVIEW +QT_REQUIRE_CONFIG(undoview); QT_BEGIN_NAMESPACE @@ -64,13 +64,13 @@ class Q_WIDGETS_EXPORT QUndoView : public QListView public: explicit QUndoView(QWidget *parent = Q_NULLPTR); explicit QUndoView(QUndoStack *stack, QWidget *parent = Q_NULLPTR); -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) explicit QUndoView(QUndoGroup *group, QWidget *parent = Q_NULLPTR); #endif ~QUndoView(); QUndoStack *stack() const; -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) QUndoGroup *group() const; #endif @@ -82,7 +82,7 @@ public: public Q_SLOTS: void setStack(QUndoStack *stack); -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) void setGroup(QUndoGroup *group); #endif @@ -92,5 +92,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_UNDOVIEW #endif // QUNDOVIEW_H diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 6abf6c8809..701758a406 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -5,19 +5,12 @@ HEADERS += \ util/qcolormap.h \ util/qcompleter.h \ util/qcompleter_p.h \ - util/qsystemtrayicon_p.h \ - util/qundogroup.h \ - util/qundostack.h \ - util/qundostack_p.h \ - util/qundoview.h + util/qsystemtrayicon_p.h SOURCES += \ util/qsystemtrayicon.cpp \ util/qcolormap.cpp \ - util/qcompleter.cpp \ - util/qundogroup.cpp \ - util/qundostack.cpp \ - util/qundoview.cpp + util/qcompleter.cpp qtConfig(scroller) { HEADERS += \ @@ -33,6 +26,24 @@ qtConfig(scroller) { util/qflickgesture.cpp \ } +qtConfig(undocommand) { + HEADERS += \ + util/qundostack.h \ + util/qundostack_p.h + + SOURCES += util/qundostack.cpp +} + +qtConfig(undogroup) { + HEADERS += util/qundogroup.h + SOURCES += util/qundogroup.cpp +} + +qtConfig(undoview) { + HEADERS += util/qundoview.h + SOURCES += util/qundoview.cpp +} + qtConfig(xcb) { SOURCES += util/qsystemtrayicon_x11.cpp } else { diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 77fb203b82..e65613d5cd 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -935,7 +935,7 @@ bool QAbstractButton::event(QEvent *e) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::ContextMenu: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif return true; diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index abdd946c49..673983d575 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -1188,7 +1188,7 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e) case QEvent::TouchEnd: case QEvent::MouseMove: case QEvent::ContextMenu: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif #ifndef QT_NO_DRAGANDDROP @@ -1305,7 +1305,7 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) \sa QWidget::wheelEvent() */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QAbstractScrollArea::wheelEvent(QWheelEvent *e) { Q_D(QAbstractScrollArea); diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h index 476914b781..193fabce56 100644 --- a/src/widgets/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -116,7 +116,7 @@ protected: void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 0ea9250695..99ee1eccb7 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -710,7 +710,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. qreal stepsToScrollF = -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QApplication::wheelScrollLines() * #endif offset * effectiveSingleStep(); @@ -759,7 +759,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QAbstractSlider::wheelEvent(QWheelEvent * e) { Q_D(QAbstractSlider); diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h index 8979685724..d26d6a879c 100644 --- a/src/widgets/widgets/qabstractslider.h +++ b/src/widgets/widgets/qabstractslider.h @@ -146,7 +146,7 @@ protected: void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE; void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif void changeEvent(QEvent *e) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 501d9560d9..4a3abe0c32 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1119,7 +1119,7 @@ void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event) \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QAbstractSpinBox::wheelEvent(QWheelEvent *event) { Q_D(QAbstractSpinBox); diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h index b60178b94c..d81cbfdc34 100644 --- a/src/widgets/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -137,7 +137,7 @@ protected: void resizeEvent(QResizeEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void keyReleaseEvent(QKeyEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void focusInEvent(QFocusEvent *event) override; diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index f81377a85c..c5db3a7c9a 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -957,7 +957,7 @@ protected: void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; @@ -1412,7 +1412,7 @@ void QCalendarView::keyPressEvent(QKeyEvent *event) QTableView::keyPressEvent(event); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QCalendarView::wheelEvent(QWheelEvent *event) { const int numDegrees = event->delta() / 8; diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 29c51a2de1..21b3eab0ad 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3294,7 +3294,7 @@ void QComboBox::keyReleaseEvent(QKeyEvent *e) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QComboBox::wheelEvent(QWheelEvent *e) { #ifdef Q_OS_DARWIN diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 2da1ceb047..8f99594a76 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -234,7 +234,7 @@ protected: void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index c9db198d21..46e6369e3c 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1194,7 +1194,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event) \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QDateTimeEdit::wheelEvent(QWheelEvent *event) { QAbstractSpinBox::wheelEvent(event); diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index b54b0e7cf0..30e4a58bb3 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -177,7 +177,7 @@ public Q_SLOTS: protected: void keyPressEvent(QKeyEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void focusInEvent(QFocusEvent *event) override; diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 9bd33409ae..f206d01999 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -39,8 +39,6 @@ #include "qfontcombobox.h" -#ifndef QT_NO_FONTCOMBOBOX - #include <qstringlistmodel.h> #include <qitemdelegate.h> #include <qlistview.h> @@ -563,5 +561,3 @@ QT_END_NAMESPACE #include "qfontcombobox.moc" #include "moc_qfontcombobox.cpp" - -#endif // QT_NO_FONTCOMBOBOX diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h index 983d5224dd..1e4555ce2d 100644 --- a/src/widgets/widgets/qfontcombobox.h +++ b/src/widgets/widgets/qfontcombobox.h @@ -44,11 +44,10 @@ #include <QtWidgets/qcombobox.h> #include <QtGui/qfontdatabase.h> -#ifndef QT_NO_FONTCOMBOBOX +QT_REQUIRE_CONFIG(fontcombobox); QT_BEGIN_NAMESPACE - class QFontComboBoxPrivate; class Q_WIDGETS_EXPORT QFontComboBox : public QComboBox @@ -101,5 +100,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontComboBox::FontFilters) QT_END_NAMESPACE -#endif // QT_NO_FONTCOMBOBOX #endif diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 75e3524ab2..1a4e9ae87b 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -60,7 +60,6 @@ #include "qvalidator.h" #include "qvariant.h" #include "qvector.h" -#include "qwhatsthis.h" #include "qdebug.h" #include "qtextedit.h" #include <private/qtextedit_p.h> diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index e47efb50b3..889082cb2a 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1311,7 +1311,7 @@ bool QMainWindow::event(QEvent *event) } #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) case QEvent::StatusTip: #ifndef QT_NO_STATUSBAR if (QStatusBar *sb = d->layout->statusBar()) @@ -1320,7 +1320,7 @@ bool QMainWindow::event(QEvent *event) #endif static_cast<QStatusTipEvent*>(event)->ignore(); return true; -#endif // QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) case QEvent::StyleChange: #ifndef QT_NO_DOCKWIDGET diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index c2dcacc6ba..664dd8d710 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -153,7 +153,9 @@ #include <QStylePainter> #include <QVBoxLayout> #include <QMouseEvent> +#if QT_CONFIG(whatsthis) #include <QWhatsThis> +#endif #include <QToolTip> #include <QMainWindow> #include <QScrollBar> @@ -1487,7 +1489,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() Q_Q(QMdiSubWindow); switch (activeSubControl) { case QStyle::SC_TitleBarContextHelpButton: -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QWhatsThis::enterWhatsThisMode(); #endif break; diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index bdcc4afff3..1b8409dba2 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -59,7 +59,7 @@ #ifndef QT_NO_EFFECTS # include <private/qeffects_p.h> #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) # include <qwhatsthis.h> #endif @@ -187,7 +187,7 @@ private: void QMenuPrivate::init() { Q_Q(QMenu); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) q->setAttribute(Qt::WA_CustomWhatsThis); #endif q->setAttribute(Qt::WA_X11NetWmWindowTypePopupMenu); @@ -663,7 +663,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } } } -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) } else if (previousAction) { previousAction->d_func()->showStatusText(topCausedWidget(), QString()); #endif @@ -1333,12 +1333,12 @@ void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &caused void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e, bool self) { Q_Q(QMenu); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) bool inWhatsThisMode = QWhatsThis::inWhatsThisMode(); #endif if (!action || !q->isEnabled() || (action_e == QAction::Trigger -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) && !inWhatsThisMode #endif && (action->isSeparator() ||!action->isEnabled()))) @@ -1349,7 +1349,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e */ const QVector<QPointer<QWidget> > causedStack = calcCausedStack(); if (action_e == QAction::Trigger) { -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (!inWhatsThisMode) actionAboutToTrigger = action; #endif @@ -1368,7 +1368,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e } } -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (inWhatsThisMode) { QString s = action->whatsThis(); if (s.isEmpty()) @@ -2805,7 +2805,7 @@ void QMenu::paintEvent(QPaintEvent *e) style()->drawControl(QStyle::CE_MenuEmptyArea, &menuOpt, &p, this); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ @@ -2979,7 +2979,7 @@ QMenu::event(QEvent *e) } break; #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: e->setAccepted(d->whatsThis.size()); if (QAction *action = d->actionAt(static_cast<QHelpEvent*>(e)->pos())) { @@ -3241,7 +3241,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = true; break; } -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case Qt::Key_F1: if (!d->currentAction || d->currentAction->whatsThis().isNull()) break; diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index dbfd12124c..61849790cf 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -237,7 +237,7 @@ protected: void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif void enterEvent(QEvent *) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index c16b2a5ac1..552409a4ed 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -52,7 +52,9 @@ #include <qmainwindow.h> #include <qtoolbar.h> #include <qtoolbutton.h> +#if QT_CONFIG(whatsthis) #include <qwhatsthis.h> +#endif #include <qpa/qplatformtheme.h> #include "private/qguiapplication_p.h" #include "qpa/qplatformintegration.h" @@ -376,7 +378,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat q->update(actionRect(currentAction)); popupState = popup; -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QAction *previousAction = currentAction; #endif currentAction = action; @@ -385,7 +387,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat if(popup) popupAction(action, activateFirst); q->update(actionRect(action)); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) } else if (previousAction) { QString empty; QStatusTipEvent tip(empty); @@ -1013,7 +1015,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) QAction *action = d->actionAt(e->pos()); if (!action || !d->isVisible(action) || !action->isEnabled()) { d->setCurrentAction(0); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (QWhatsThis::inWhatsThisMode()) QWhatsThis::showText(e->globalPos(), d->whatsThis, this); #endif @@ -1432,7 +1434,7 @@ bool QMenuBar::event(QEvent *e) } break; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: e->setAccepted(d->whatsThis.size()); if (QAction *action = d->actionAt(static_cast<QHelpEvent*>(e)->pos())) { diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 746dc20122..173be7aa88 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2296,7 +2296,7 @@ void QPlainTextEdit::changeEvent(QEvent *e) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QPlainTextEdit::wheelEvent(QWheelEvent *e) { Q_D(QPlainTextEdit); diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index 432ec85a57..d773c4791c 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -250,7 +250,7 @@ protected: virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 66f1a4c689..a98f3fe085 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -493,7 +493,7 @@ bool QScrollBar::event(QEvent *event) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QScrollBar::wheelEvent(QWheelEvent *event) { event->ignore(); diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h index b99ad219eb..963ae4263b 100644 --- a/src/widgets/widgets/qscrollbar.h +++ b/src/widgets/widgets/qscrollbar.h @@ -64,7 +64,7 @@ public: bool event(QEvent *event) Q_DECL_OVERRIDE; protected: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 060d1f9a03..9e803f4388 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -49,7 +49,9 @@ #include "qstylepainter.h" #include "qtabwidget.h" #include "qtooltip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "private/qtextengine_p.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -176,10 +178,6 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) if (tab.textColor.isValid()) option->palette.setColor(q->foregroundRole(), tab.textColor); - else if (q->style()->inherits("QMacStyle") - && isCurrent && !documentMode && q->isActiveWindow()) { - option->palette.setColor(QPalette::WindowText, Qt::white); - } option->icon = tab.icon; option->iconSize = q->iconSize(); // Will get the default value then. @@ -451,9 +449,10 @@ void QTabBarPrivate::layoutTabs() QVector<QLayoutStruct> tabChain(tabList.count() + 2); // We put an empty item at the front and back and set its expansive attribute - // depending on tabAlignment. + // depending on tabAlignment and expanding. tabChain[tabChainIndex].init(); - tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignLeft) + tabChain[tabChainIndex].expansive = (!expanding) + && (tabAlignment != Qt::AlignLeft) && (tabAlignment != Qt::AlignJustify); tabChain[tabChainIndex].empty = true; ++tabChainIndex; @@ -518,13 +517,12 @@ void QTabBarPrivate::layoutTabs() maxExtent = maxWidth; } - if (!expanding) { - // Mirror our front item. - tabChain[tabChainIndex].init(); - tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight) - && (tabAlignment != Qt::AlignJustify); - tabChain[tabChainIndex].empty = true; - } + // Mirror our front item. + tabChain[tabChainIndex].init(); + tabChain[tabChainIndex].expansive = (!expanding) + && (tabAlignment != Qt::AlignRight) + && (tabAlignment != Qt::AlignJustify); + tabChain[tabChainIndex].empty = true; Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure. // Do the calculation @@ -1224,7 +1222,7 @@ QString QTabBar::tabToolTip(int index) const } #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \since 4.1 @@ -1252,7 +1250,7 @@ QString QTabBar::tabWhatsThis(int index) const return QString(); } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) /*! Sets the data of the tab at position \a index to \a data. @@ -1632,7 +1630,7 @@ bool QTabBar::event(QEvent *event) } } #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) } else if (event->type() == QEvent::QueryWhatsThis) { const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast<QHelpEvent*>(event)->pos())); if (!tab || tab->whatsThis.isEmpty()) @@ -1646,7 +1644,7 @@ bool QTabBar::event(QEvent *event) return true; } } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_SHORTCUT } else if (event->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast<QShortcutEvent *>(event); @@ -2185,7 +2183,7 @@ void QTabBar::keyPressEvent(QKeyEvent *event) /*!\reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QTabBar::wheelEvent(QWheelEvent *event) { #ifndef Q_OS_MAC @@ -2197,7 +2195,7 @@ void QTabBar::wheelEvent(QWheelEvent *event) Q_UNUSED(event) #endif } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void QTabBarPrivate::setCurrentNextEnabledIndex(int offset) { diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 71ca58c993..2a27a98661 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -123,7 +123,7 @@ public: QString tabToolTip(int index) const; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void setTabWhatsThis(int index, const QString &text); QString tabWhatsThis(int index) const; #endif @@ -203,7 +203,7 @@ protected: void mousePressEvent (QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent (QMouseEvent *) Q_DECL_OVERRIDE; void mouseReleaseEvent (QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 6c5db02764..7141ffc8d5 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -118,7 +118,7 @@ public: #ifndef QT_NO_TOOLTIP QString toolTip; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QString whatsThis; #endif QIcon icon; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 7c75f859ed..c84c78275d 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -1163,7 +1163,7 @@ QString QTabWidget::tabToolTip(int index) const } #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \since 4.1 @@ -1187,7 +1187,7 @@ QString QTabWidget::tabWhatsThis(int index) const Q_D(const QTabWidget); return d->tabs->tabWhatsThis(index); } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) /*! This virtual handler is called after a new tab was added or diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index 59fcea223f..7d8864241a 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -94,7 +94,7 @@ public: QString tabToolTip(int index) const; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void setTabWhatsThis(int index, const QString &text); QString tabWhatsThis(int index) const; #endif diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index df92fc0e1e..902a6afb8a 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -52,7 +52,9 @@ #include <qtextcodec.h> #include <qpainter.h> #include <qdir.h> +#if QT_CONFIG(whatsthis) #include <qwhatsthis.h> +#endif #include <qtextobject.h> #include <qdesktopservices.h> @@ -307,7 +309,7 @@ void QTextBrowserPrivate::setSource(const QUrl &url) #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QWhatsThis::showText(QCursor::pos(), txt, q); #endif return; diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 1abc9bef8e..6973cec429 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1831,7 +1831,7 @@ void QTextEdit::changeEvent(QEvent *e) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QTextEdit::wheelEvent(QWheelEvent *e) { Q_D(QTextEdit); diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h index b0e19193a9..745b644511 100644 --- a/src/widgets/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -288,7 +288,7 @@ protected: virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 80a061e6d5..13595575e6 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -919,10 +919,10 @@ void QToolButton::setDefaultAction(QAction *action) #ifndef QT_NO_TOOLTIP setToolTip(action->toolTip()); #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) setStatusTip(action->statusTip()); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) setWhatsThis(action->whatsThis()); #endif #ifndef QT_NO_MENU diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 1779c8d183..726235ef4e 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -14,7 +14,6 @@ HEADERS += \ widgets/qdockwidget.h \ widgets/qdockwidget_p.h \ widgets/qdockarealayout_p.h \ - widgets/qfontcombobox.h \ widgets/qframe.h \ widgets/qframe_p.h \ widgets/qgroupbox.h \ @@ -78,7 +77,6 @@ SOURCES += \ widgets/qdockwidget.cpp \ widgets/qdockarealayout.cpp \ widgets/qeffects.cpp \ - widgets/qfontcombobox.cpp \ widgets/qframe.cpp \ widgets/qgroupbox.cpp \ widgets/qkeysequenceedit.cpp \ @@ -152,6 +150,11 @@ qtConfig(commandlinkbutton) { widgets/qcommandlinkbutton.cpp } +qtConfig(fontcombobox) { + HEADERS += widgets/qfontcombobox.h + SOURCES += widgets/qfontcombobox.cpp +} + qtConfig(label) { HEADERS += \ widgets/qlabel.h \ |