diff --git a/configure b/configure index 73679de621..bf37224d24 100755 --- a/configure +++ b/configure @@ -234,7 +234,7 @@ macSDKify() sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1") if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi - sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null) + sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null) if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi case "$sdk" in @@ -322,18 +322,23 @@ fi if [ "$BUILD_ON_MAC" = "yes" ]; then if ! /usr/bin/xcode-select --print-path >/dev/null 2>&1; then echo >&2 - echo " No Xcode is selected. Use xcode-select -switch to choose an Xcode" >&2 - echo " version. See the xcode-select man page for more information." >&2 + echo " No Xcode selected. Please install Xcode via the App Store, " >&2 + echo " or the command line developer tools via xcode-select --install, " >&2 + echo " and use xcode-select --switch to choose the right installation. " >&2 + echo " See the xcode-select man page for more information." >&2 echo >&2 exit 2 fi - if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then - echo >&2 - echo " Xcode not set up properly. You may need to confirm the license" >&2 - echo " agreement by running /usr/bin/xcodebuild without arguments." >&2 - echo >&2 - exit 2 + # In the else case we are probably using a Command Line Tools installation + if /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then + if ! /usr/bin/xcrun xcodebuild -license check 2>/dev/null; then + echo >&2 + echo " Xcode setup not complete. You need to confirm the license" >&2 + echo " agreement by running 'sudo xcrun xcodebuild -license accept'." >&2 + echo >&2 + exit 2 + fi fi fi diff --git a/dist/changes-5.9.1 b/dist/changes-5.9.1 new file mode 100644 index 0000000000..4458aee89b --- /dev/null +++ b/dist/changes-5.9.1 @@ -0,0 +1,131 @@ +Qt 5.9.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.9.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.9.1 Changes * +**************************************************************************** + +Deprecation Notice +------------------ + + - The following platforms or toolchains are deprecated and will be + removed as of Qt 5.11: + * Microsoft Visual Studio 2013 + +Important Behavior Changes +-------------------------- + + - The Q_REQUIRED_RESULT macro now expands to the C++17 attribute + [[nodiscard]] if the compiler supports it. Code using this macro needs + to pay attention to its placement, as C++ function attributes must come + before the declaration, unlike the GCC extension that this macro + previously expanded to. + +Binary Compatibility Note +------------------------- + + - The variable QOperatingSystemVersion::MacOSHighSierra was added in this + release. Code that uses this variable will not run under Qt 5.9.0. If + backwards compatibility is desired, use instead + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 13) + +Third-Party Code +---------------- + + - Sqlite was updated to version 3.16.2. + - Deleted the src/3rdparty/atspi2 directory. + +QtCore +------ + + - [QTBUG-60558] Fixed a bug that caused QInternal::unregisterCallback to + crash on exit. + - [QTBUG-61034] QT_NO_EXCEPTIONS is now reliably set when using Clang, even + in Objective C++ mode. + + - QHash/QMultiHash: + * [QTBUG-60395] Fixed operator== so that two containers compare equal when + there are multiple values with the same key. + + - QStorageInfo + * [QTBUG-61096] Fixed a hang on certain systems when retrieving + information from unresponsive filesystems. + + - QTimeZone: + * [QTBUG-60595] Fixed sending IANA standard UTC-offset QTimeZones + through QDataStream, which previously came out invalid after + deserialization. + +moc +--- + + - [QTBUG-61204] moc no longer errors out if a C++ keyword is #define'ed + +Platform Specific Changes +------------------------- + + - macOS / iOS: + * [QTBUG-41978] QCollator now respects the ignorePunctuation property on + Apple based platforms correctly. + * [QTBUG-61205] Fixed the architecture information in QSysInfo. + * QSysInfo and QOperatingSystemVersion now support the newest versions of + Apple's operating systems. + * [QTBUG-61053] Fixed SSL certificate verification on iOS with Secure + Transport back-end. + + - Windows: + * [QTBUG-61315] Fixed invalid sorting of custom environment variables set + via QProcessEnvironment when starting subprocesses. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-58372] The SQL driver plugins can be built separately again. + Note that it is necessary to configure the whole sqldrivers directory. + - [QTBUG-60925][Unix] Fixed library retrieval from pkg-config. Again. + - [QTBUG-60936] Fixed module version number in Qt modules' cmake config files. + - [QTBUG-61017] Fixed configure hanging upon selecting commercial license. + - [QTBUG-61044] Fixed license checker invocation on 32 bit systems. + - [MinGW] The gold linker is no longer used. + +qmake +----- + + - [QTBUG-42830][Android] INSTALL targets are no longer created for static + libraries. + - [QTBUG-40825][QTBUG-59457][Unix] Fixed various makespecs to append shared + include and library locations only at the end of the search lists. + - [QTBUG-52383][Windows] midl and rc are now invoked with /NOLOGO. + - [QTBUG-58391][MSVC] MSVC extensions are not disabled any more when + querying the compiler for the predefined macros to pass to moc. + - [QTBUG-59431][VS] Fixed parsing of /utf-8 option. Again. + - [QTBUG-60895][VS] Fixed .vcxproj generation for ActiveQt server projects. + - [QTBUG-60059] qmake will now be more verbose when it fails to run the + compiler while querying the toolchain's properties. + - Various QT__VERSION variables were reverted to refer to the + toolchain Qt was built with. The current toolchain's versions can be + found in the QMAKE__VERSION variables. + - QMAKE_DEFAULT_{INC,LIB}DIRS is now populated also when using clang. + - [MinGW] Re-builds of static library projects will now create a new library + instead of updating the previously built one. + - [VS] Unknown /Zc:XXX options are no longer complained about. diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp index 8b11c20972..fd0060d8a9 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp @@ -171,7 +171,7 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event) } //! [11] -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) //! [12] void MandelbrotWidget::wheelEvent(QWheelEvent *event) { diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h index cbacc2cdd0..a04bfa6e81 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h @@ -68,7 +68,7 @@ protected: void paintEvent(QPaintEvent *event) override; void resizeEvent(QResizeEvent *event) override; void keyPressEvent(QKeyEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void mousePressEvent(QMouseEvent *event) override; diff --git a/examples/widgets/dialogs/dialogs.pro b/examples/widgets/dialogs/dialogs.pro index 7a01e818e0..6f19309440 100644 --- a/examples/widgets/dialogs/dialogs.pro +++ b/examples/widgets/dialogs/dialogs.pro @@ -1,3 +1,5 @@ +QT_FOR_CONFIG += widgets + TEMPLATE = subdirs SUBDIRS = classwizard \ configdialog \ @@ -13,5 +15,7 @@ SUBDIRS = classwizard \ } !qtHaveModule(printsupport): SUBDIRS -= licensewizard -contains(DEFINES, QT_NO_WIZARD): SUBDIRS -= trivialwizard licensewizard classwizard +!qtConfig(wizard) { + SUBDIRS -= trivialwizard licensewizard classwizard +} wince: SUBDIRS += sipdialog diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index 79b173bec7..491f1a54cf 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -64,7 +64,7 @@ #endif #include -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void GraphicsView::wheelEvent(QWheelEvent *e) { if (e->modifiers() & Qt::ControlModifier) { diff --git a/examples/widgets/graphicsview/chip/view.h b/examples/widgets/graphicsview/chip/view.h index 2d174250c2..89b2e813f1 100644 --- a/examples/widgets/graphicsview/chip/view.h +++ b/examples/widgets/graphicsview/chip/view.h @@ -69,7 +69,7 @@ public: GraphicsView(View *v) : QGraphicsView(), view(v) { } protected: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) override; #endif diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp index 8b2f0a0629..844c8f8aac 100644 --- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp +++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp @@ -184,7 +184,7 @@ void GraphWidget::timerEvent(QTimerEvent *event) } //! [4] -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) //! [5] void GraphWidget::wheelEvent(QWheelEvent *event) { diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.h b/examples/widgets/graphicsview/elasticnodes/graphwidget.h index 79acb89985..5ed6aed452 100644 --- a/examples/widgets/graphicsview/elasticnodes/graphwidget.h +++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.h @@ -73,7 +73,7 @@ public slots: protected: void keyPressEvent(QKeyEvent *event) override; void timerEvent(QTimerEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void drawBackground(QPainter *painter, const QRectF &rect) override; diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index e48c101262..e47bc9d251 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -260,7 +260,7 @@ void XFormView::timerEvent(QTimerEvent *e) } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void XFormView::wheelEvent(QWheelEvent *e) { m_scale += e->delta() / qreal(600); diff --git a/examples/widgets/painting/affine/xform.h b/examples/widgets/painting/affine/xform.h index f2eed99b4f..1dce3b26da 100644 --- a/examples/widgets/painting/affine/xform.h +++ b/examples/widgets/painting/affine/xform.h @@ -125,7 +125,7 @@ signals: protected: void timerEvent(QTimerEvent *e) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) override; #endif diff --git a/examples/widgets/widgets/mousebuttons/buttontester.cpp b/examples/widgets/widgets/mousebuttons/buttontester.cpp index 3faf6e3553..6653221698 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.cpp +++ b/examples/widgets/widgets/mousebuttons/buttontester.cpp @@ -89,7 +89,7 @@ void ButtonTester::mouseDoubleClickEvent(QMouseEvent *e) this->setText(result); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void ButtonTester::wheelEvent (QWheelEvent *e) { QString result; diff --git a/examples/widgets/widgets/mousebuttons/buttontester.h b/examples/widgets/widgets/mousebuttons/buttontester.h index cd05171d86..d99dcceb18 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.h +++ b/examples/widgets/widgets/mousebuttons/buttontester.h @@ -64,7 +64,7 @@ protected: void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void mouseDoubleClickEvent(QMouseEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent * event) override; #endif int buttonByNumber(const Qt::MouseButton button); diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index 7cae85e6e6..4b11568dfe 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -195,7 +195,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) case QTabletEvent::FourDMouse: { const QString error(tr("This input device is not supported by the example.")); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QStatusTipEvent status(error); QApplication::sendEvent(this, &status); #else @@ -206,7 +206,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) default: { const QString error(tr("Unknown tablet device - treating as stylus")); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QStatusTipEvent status(error); QApplication::sendEvent(this, &status); #else diff --git a/mkspecs/features/android/android.prf b/mkspecs/features/android/android.prf index 45eadc9fdb..1dc8f87313 100644 --- a/mkspecs/features/android/android.prf +++ b/mkspecs/features/android/android.prf @@ -1,6 +1,3 @@ -android_install:contains(INSTALLS, target):!isEmpty(target.path): \ - CONFIG -= android_install - contains(TEMPLATE, ".*app") { !android_app { !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so @@ -11,7 +8,7 @@ contains(TEMPLATE, ".*app") { INSTALLS *= target } } -} else: contains(TEMPLATE, "lib"):!static:android_install { +} else: contains(TEMPLATE, "lib"):!static:!QTDIR_build:android_install { target.path = /libs/$$ANDROID_TARGET_ARCH/ INSTALLS *= target } diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 395ac34001..e645ba5803 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -183,6 +183,7 @@ macx-xcode { } cache(QMAKE_XCODE_DEVELOPER_PATH, stash) -cache(QMAKE_XCODE_VERSION, stash) +!isEmpty(QMAKE_XCODE_VERSION): \ + cache(QMAKE_XCODE_VERSION, stash) QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index e21e749ee9..44636f2288 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -10,18 +10,23 @@ isEmpty(QMAKE_XCODE_DEVELOPER_PATH) { # Make sure Xcode path is valid !exists($$QMAKE_XCODE_DEVELOPER_PATH): \ error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.") - - # Make sure Xcode is set up properly - isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \ - error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.") } -isEmpty(QMAKE_XCODE_VERSION) { - # Extract Xcode version using xcodebuild - xcode_version = $$system("/usr/bin/xcodebuild -version") - QMAKE_XCODE_VERSION = $$member(xcode_version, 1) - isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") - unset(xcode_version) +isEmpty(QMAKE_XCODEBUILD_PATH): \ + QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null") + +!isEmpty(QMAKE_XCODEBUILD_PATH) { + # Make sure Xcode is set up properly + !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \ + error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.") + + isEmpty(QMAKE_XCODE_VERSION) { + # Extract Xcode version using xcodebuild + xcode_version = $$system("/usr/bin/xcrun xcodebuild -version") + QMAKE_XCODE_VERSION = $$member(xcode_version, 1) + isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") + unset(xcode_version) + } } isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) { diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 68ab7e4053..3f6dc076ca 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -7,13 +7,22 @@ contains(QMAKE_MAC_SDK, .*/.*): \ defineReplace(xcodeSDKInfo) { info = $$1 + equals(info, "Path"): \ + info = --show-sdk-path + equals(info, "PlatformPath"): \ + info = --show-sdk-platform-path + equals(info, "SDKVersion"): \ + info = --show-sdk-version sdk = $$2 isEmpty(sdk): \ sdk = $$QMAKE_MAC_SDK isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) { - QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcodebuild -sdk $$sdk -version $$info 2>/dev/null") - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}): error("Could not resolve SDK $$info for \'$$sdk\'") + QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null") + # --show-sdk-platform-path won't work for Command Line Tools; this is fine + # only used by the XCTest backend to testlib + isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \ + error("Could not resolve SDK $$info for \'$$sdk\'") cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info}) } diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 34bd8f1d78..eb7b1385f2 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -25,9 +25,11 @@ isEmpty($${target_prefix}.INCDIRS) { !equals(QMAKE_HOST.os, Windows) { cmd_prefix = "LC_ALL=C" cmd_suffix = "/dev/null" + null_file = /dev/null } else { cmd_prefix = "set LC_ALL=C&" cmd_suffix = "NUL" + null_file = NUL } cxx_flags = $$QMAKE_CXXFLAGS @@ -38,9 +40,17 @@ isEmpty($${target_prefix}.INCDIRS) { # While technically incorrect but without any likely practical effect, # UIKit simulator platforms will see the device SDK's sysroot in # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. - darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH + darwin { + uikit:macx-xcode: \ + cxx_flags += -isysroot $$sdk_path_device.value + else: \ + cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH + } - clang: \ + rim_qcc: \ + # Need the cc1plus and ld command lines to pick up the paths + cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v + else: clang: \ # Need to link to pick up library paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v else: \ @@ -50,33 +60,60 @@ isEmpty($${target_prefix}.INCDIRS) { output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec) !equals(ec, 0): \ error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?") - add_includes = false - add_libraries = false - for (line, output) { - line ~= s/^[ \\t]*// # remove leading spaces - contains(line, "LIBRARY_PATH=.*") { - line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= - paths = $$split(line, $$QMAKE_DIRLIST_SEP) - for (path, paths): \ - QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path) - } else: contains(line, "Library search paths:") { - add_libraries = true - } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here: - add_includes = true - } else: contains(line, "End of search.*") { - add_includes = false - } else: $$add_libraries { - # We assume all library search paths are absolute - !contains(line, "^/.*") { - add_libraries = false - next() + + rim_qcc { + for (line, output) { + contains(line, "^[^ ]*cc1plus .*") { + take_next = false + for (parameter, $$list($$line)) { + $$take_next { + QMAKE_DEFAULT_INCDIRS += $$clean_path($$parameter) + take_next = false + } else: equals(parameter, "-isystem") { + take_next = true + } + } + } else: contains(line, "^[^ ]*-ld .*") { + for (parameter, $$list($$line)) { + contains(parameter, "^-L.*") { + parameter ~= s/^-L// + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$parameter) + } + } + } + } + } else { + add_includes = false + add_libraries = false + for (line, output) { + line ~= s/^[ \\t]*// # remove leading spaces + contains(line, "LIBRARY_PATH=.*") { + line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= + paths = $$split(line, $$QMAKE_DIRLIST_SEP) + for (path, paths): \ + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path) + } else: contains(line, "Library search paths:") { + add_libraries = true + } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here: + add_includes = true + } else: contains(line, "End of search.*") { + add_includes = false + } else: $$add_libraries { + # We assume all library search paths are absolute + !contains(line, "^/.*") { + add_libraries = false + next() + } + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line) + } else: $$add_includes { + !contains(line, ".* \\(framework directory\\)"): \ + QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) } - QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line) - } else: $$add_includes { - !contains(line, ".* \\(framework directory\\)"): \ - QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) } } + isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ + !integrity: \ + error("failed to parse default search paths from compiler output") QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) } else: msvc { # This doesn't differentiate between host and target, diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf index 0a2e4122f5..f7245e48b1 100644 --- a/mkspecs/features/uikit/default_post.prf +++ b/mkspecs/features/uikit/default_post.prf @@ -19,7 +19,7 @@ equals(TEMPLATE, app):qt { load(default_post) macx-xcode { - ios:isEmpty(QMAKE_APPLE_TARGETED_DEVICE_FAMILY):!isEmpty(QMAKE_IOS_TARGETED_DEVICE_FAMILY) { + ios:!isEmpty(QMAKE_IOS_TARGETED_DEVICE_FAMILY) { warning("QMAKE_IOS_TARGETED_DEVICE_FAMILY is deprecated; use QMAKE_APPLE_TARGETED_DEVICE_FAMILY") QMAKE_APPLE_TARGETED_DEVICE_FAMILY = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY } diff --git a/mkspecs/features/xctest.prf b/mkspecs/features/xctest.prf index 4b84682df7..4ee504f0ad 100644 --- a/mkspecs/features/xctest.prf +++ b/mkspecs/features/xctest.prf @@ -2,5 +2,6 @@ equals(TEMPLATE, app) { load(sdk) # Make the XCTest framework available. This is normally handled automatically # by Xcode based on heuristics, but we need to explicitly link to XCTest. - QMAKE_LFLAGS += -F$${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks -weak_framework XCTest + !isEmpty(QMAKE_MAC_SDK_PLATFORM_PATH): \ + QMAKE_LFLAGS += -F$${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks -weak_framework XCTest } diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index eb4f46cd7e..073d315aab 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -118,14 +118,15 @@ ProjectGenerator::init() dir = regex.left(s+1); regex = regex.right(regex.length() - (s+1)); } + const QDir d(dir); if (Option::recursive) { - QStringList entries = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot); + QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (int i = 0; i < entries.count(); i++) dirs.append(dir + entries[i] + QDir::separator() + regex); } - QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regex)); + QStringList files = d.entryList(QDir::nameFiltersFromString(regex)); for(int i = 0; i < (int)files.count(); i++) { - QString file = dir + files[i]; + QString file = d.absoluteFilePath(files[i]); if (addFile(file)) { add_depend = true; file_count++; 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 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( "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 types) const @@ -347,6 +351,7 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list 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 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(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(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(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(e)); break; -# endif // !QT_NO_TABLETEVENT +# endif // QT_CONFIG(tabletevent) case QEvent::Enter: dbg << "QEnterEvent(" << static_cast(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 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(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(*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(args.at(0).toUInt()); - const QEvent::Type type = static_cast(args.at(1).toUInt()); + const ulong time = static_cast(args.at(0).toUInt()); + const QEvent::Type type = static_cast(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 + #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 + #include #include +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 #include #include @@ -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 +#include #include +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 +#ifdef QT_WIDGETS_LIB +#include +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include 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 #include "qcocoacolordialoghelper.h" -#include "qcocoafiledialoghelper.h" #include "qcocoafontdialoghelper.h" #include "qcocoasystemsettings.h" #include "qcocoasystemtrayicon.h" @@ -63,6 +62,13 @@ #include #include +#ifdef QT_WIDGETS_LIB +#include +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include @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 +#include #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(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 #include #include #include @@ -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 #include #include #include +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(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(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 #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #include #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #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(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(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(event); if (!QCoreApplication::testAttribute(Qt::AA_CompressTabletEvents) && const_cast(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 #endif -#if XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #include #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 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 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 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 #include -#ifdef XCB_USE_XINPUT2 - #include #include @@ -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(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 tabletDevices; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast(&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::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(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 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 -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #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(); -#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 #include -#ifdef XCB_USE_XLIB -# include -#else -# include -#endif +#include #include @@ -206,7 +202,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr const QXcbScreen *xcbScreen = static_cast(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 #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #include #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 @@ -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(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(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 #include #include +#if QT_CONFIG(wizard) #include +#endif #include #include #include @@ -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(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 #include #include -#include #include #include #include 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 (widget)) buttonBox = widget->findChild(QLatin1String("qt_msgbox_buttonbox")); -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast (widget)) buttonBox = widget->findChild(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(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 (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 (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 (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 (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover, false); } else if (qobject_cast(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(option)) { + if (qstyleoption_cast(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 #include "private/qabstractprintdialog_p.h" +#if QT_CONFIG(messagebox) #include +#endif #include "qprintdialog.h" +#if QT_CONFIG(filedialog) #include "qfiledialog.h" +#endif #include #include +#if QT_CONFIG(filesystemmodel) #include +#endif #include #include @@ -57,7 +63,7 @@ #include -#include "private/qfscompleter_p.h" +#include #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 #include #include +#if QT_CONFIG(filedialog) #include +#endif #include #include #include 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 + !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 + # 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 #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include 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 #include #include -#include +#include #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 @@ -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 -#ifndef QT_NO_COLORDIALOG - #include -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 +#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 #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(dialog)) return QPlatformTheme::FileDialog; #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) if (qobject_cast(dialog)) return QPlatformTheme::ColorDialog; #endif @@ -74,11 +85,11 @@ static inline int themeDialogType(const QDialog *dialog) if (qobject_cast(dialog)) return QPlatformTheme::FontDialog; #endif -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) if (qobject_cast(dialog)) return QPlatformTheme::MessageDialog; #endif -#ifndef QT_NO_ERRORMESSAGE +#if QT_CONFIG(errormessage) if (qobject_cast(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 -#ifndef QT_NO_ERRORMESSAGE - #include -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 #include "qfiledialog.h" -#ifndef QT_NO_FILEDIALOG #include "qfiledialog_p.h" #include #include @@ -52,8 +51,9 @@ #include #include #include +#if QT_CONFIG(messagebox) #include -#include +#endif #include #include #include @@ -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 #include #include - -#ifndef QT_NO_FILEDIALOG - #include -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 -#ifndef QT_NO_FILEDIALOG - #include "qfiledialog.h" #include "private/qdialog_p.h" #include "qplatformdefs.h" @@ -75,12 +73,16 @@ #include #include #include "qsidebar_p.h" +#if QT_CONFIG(fscompleter) #include "qfscompleter_p.h" +#endif #if defined (Q_OS_UNIX) #include #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 +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 #include #include +#if QT_CONFIG(messagebox) #include +#endif #include #include @@ -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("The name \"%1\" can not be used.

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,11 +47,10 @@ #include #include +QT_REQUIRE_CONFIG(filesystemmodel); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_FILESYSTEMMODEL - class ExtendedInformation; class QFileSystemModelPrivate; class QFileIconProvider; @@ -166,9 +165,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const { return qvariant_cast(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 #include "qfilesystemmodel.h" -#ifndef QT_NO_FILESYSTEMMODEL - #include #include #include "qfileinfogatherer_p.h" @@ -66,6 +64,8 @@ #include #include +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 -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 #include -#ifndef QT_NO_INPUTDIALOG - #include -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 -#ifndef QT_NO_MESSAGEBOX - #include #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 -#ifndef QT_NO_MESSAGEBOX - #include -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 -#ifndef QT_NO_PROGRESSDIALOG - #include -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 #include #include @@ -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 -#include +#include #include #include #include #include -#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 -#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 - -#ifndef QT_NO_WIZARD - #include -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 #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 -#ifndef QT_NO_WIZARD #if QT_CONFIG(style_windowsvista) #include @@ -63,6 +62,8 @@ #include #include +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 #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -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 #include #include -#include #include #include #include @@ -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 #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -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(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(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 #include #include @@ -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,11 +46,10 @@ #include #include +QT_REQUIRE_CONFIG(listwidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LISTWIDGET - class QListWidget; class QListModel; class QWidgetItemData; @@ -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 #include -#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 #include #include @@ -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,13 +44,11 @@ #include #include #include -//#include + +QT_REQUIRE_CONFIG(tablewidget); QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TABLEWIDGET - class Q_WIDGETS_EXPORT QTableWidgetSelectionRange { public: @@ -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 #include -#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 #include #include @@ -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,11 +46,10 @@ #include #include +QT_REQUIRE_CONFIG(treewidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TREEWIDGET - class QTreeWidget; class QTreeModel; class QWidgetItemData; @@ -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 #include -#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,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(treewidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TREEWIDGET - class QTreeWidget; class QTreeWidgetItem; class QTreeModel; @@ -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 #include @@ -73,7 +75,7 @@ #include #include #include -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) #include #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 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(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 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 +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -641,7 +643,7 @@ bool QShortcut::event(QEvent *e) if (d->sc_enabled && e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast(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 @@ -54,7 +53,6 @@ #include "qtextdocument.h" #include #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,11 +44,10 @@ #include #include +QT_REQUIRE_CONFIG(whatsthis); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_WHATSTHIS - class QAction; class Q_WIDGETS_EXPORT QWhatsThis @@ -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(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(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(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(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(event)); return true; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: handleWheelEvent(static_cast(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 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(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(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(e)); case QEvent::WhatsThis: return new QHelpEvent(*static_cast(e)); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) case QEvent::StatusTip: return new QStatusTipEvent(*static_cast(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(e)); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::WhatsThisClicked: return new QWhatsThisClickedEvent(*static_cast(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(e)); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: return new QTabletEvent(*static_cast(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 #include #include +#if QT_CONFIG(wizard) #include +#endif #include #include #include @@ -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 #include #include +#if QT_CONFIG(wizard) #include +#endif #include #include #include @@ -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 #include @@ -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(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(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(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(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(d->proxy->sourceModel()) != 0; #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) isFsModel = qobject_cast(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(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 #include +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 #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(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 #include -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 #include #include @@ -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 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 #include -#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 #include #include @@ -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 #include -#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 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(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 #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -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 #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) # include #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 > &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 > 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(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 #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #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(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 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(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(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 #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include @@ -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 \ diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST new file mode 100644 index 0000000000..fe1d5bd968 --- /dev/null +++ b/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST @@ -0,0 +1,2 @@ +[deleteChildrenWithRunningGroup] +osx-10.12 diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index 7ad047e8a2..1472ddbb83 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -4,6 +4,12 @@ QT = core-private core testlib qtHaveModule(network): QT += network else: DEFINES += QT_NO_NETWORK +contains(CONFIG, builtin_testdata) { + DEFINES += BUILTIN_TESTDATA +} + +TESTDATA += ../BLACKLIST + TARGET = ../tst_qfile SOURCES = ../tst_qfile.cpp INCLUDEPATH += ../../../../../shared/ diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index f97501e8a6..17497e46b9 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -250,6 +250,9 @@ private slots: void reuseQFile(); private: +#ifdef BUILTIN_TESTDATA + QSharedPointer m_dataDir; +#endif enum FileType { OpenQFile, OpenFd, @@ -428,8 +431,15 @@ void tst_QFile::initTestCase() QVERIFY(!m_forRenamingFile.isEmpty()); m_twoDotsFile = QFINDTESTDATA("two.dots.file"); QVERIFY(!m_twoDotsFile.isEmpty()); + +#ifndef BUILTIN_TESTDATA m_testFile = QFINDTESTDATA("testfile.txt"); QVERIFY(!m_testFile.isEmpty()); +#else + m_dataDir = QEXTRACTTESTDATA("/"); + QVERIFY2(!m_dataDir.isNull(), qPrintable("Could not extract test data")); + m_testFile = m_dataDir->path() + "/testfile.txt"; +#endif m_resourcesDir = QFINDTESTDATA("resources"); QVERIFY(!m_resourcesDir.isEmpty()); m_noEndOfLineFile = QFINDTESTDATA("noendofline.txt"); diff --git a/tests/auto/corelib/io/qtextstream/BLACKLIST b/tests/auto/corelib/io/qtextstream/BLACKLIST index bc3f118b33..b54b53cd74 100644 --- a/tests/auto/corelib/io/qtextstream/BLACKLIST +++ b/tests/auto/corelib/io/qtextstream/BLACKLIST @@ -1,2 +1,3 @@ [stillOpenWhenAtEnd] windows +winrt diff --git a/tests/auto/corelib/io/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro index 50335524d3..3dcfa0b414 100644 --- a/tests/auto/corelib/io/qtextstream/test/test.pro +++ b/tests/auto/corelib/io/qtextstream/test/test.pro @@ -18,7 +18,8 @@ TESTDATA += \ ../task113817.txt \ ../qtextstream.qrc \ ../tst_qtextstream.cpp \ - ../resources + ../resources \ + ../BLACKLIST builtin_testdata { DEFINES += BUILTIN_TESTDATA diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 1cbb7ad19c..7eeaea564f 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -3061,11 +3061,7 @@ void tst_QUrl::fromUserInputWithCwd_data() // "." { - const QUrl url = QUrl::fromLocalFile(base -#ifdef Q_OS_WINRT - + QLatin1Char('/') -#endif - ); // fromUserInput cleans the path + const QUrl url = QUrl::fromLocalFile(base); // fromUserInput cleans the path QTest::newRow("dot-in-path") << "." << base << url << url; QTest::newRow("dot-in-dot") << "." << QStringLiteral(".") << url << url; } diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 06e2b0ea8c..e17d8ee38b 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -37,6 +37,7 @@ #include #include +#include #if defined Q_OS_UNIX #include @@ -498,6 +499,9 @@ void tst_QTimer::moveToThread() { #if defined(Q_OS_WIN32) QSKIP("Does not work reliably on Windows :("); +#elif defined(Q_OS_MACOS) + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSierra) + QSKIP("Does not work reliably on macOS 10.12 (QTBUG-59679)"); #endif QTimer ti1; QTimer ti2; diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 4fccd9f4fc..97fce88f19 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -77,7 +77,7 @@ public: enum MetaEnumTest_Enum0 { MetaEnumTest_Enum0_dummy = 2, MetaEnumTest_Enum0_value = 42, MetaEnsureSignedEnum0 = -1 }; Q_ENUM(MetaEnumTest_Enum0) - enum MetaEnumTest_Enum1 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; + enum MetaEnumTest_Enum1 : qint64 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_ENUM(MetaEnumTest_Enum1) enum MetaEnumTest_Enum3 ENUM_SIZE(qint64) { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5, MetaEnumTest_Enum3_bigNegValue = -(Q_INT64_C(1) << 56) - 3 }; @@ -4631,7 +4631,7 @@ void tst_QVariant::pairElements() enum EnumTest_Enum0 { EnumTest_Enum0_value = 42, EnumTest_Enum0_negValue = -8 }; Q_DECLARE_METATYPE(EnumTest_Enum0) -enum EnumTest_Enum1 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; +enum EnumTest_Enum1 : qint64 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_DECLARE_METATYPE(EnumTest_Enum1) #if defined(Q_COMPILER_CLASS_ENUM) diff --git a/tests/auto/corelib/thread/qthread/qthread.pro b/tests/auto/corelib/thread/qthread/qthread.pro index 381f6c9e45..37552f1fca 100644 --- a/tests/auto/corelib/thread/qthread/qthread.pro +++ b/tests/auto/corelib/thread/qthread/qthread.pro @@ -4,3 +4,6 @@ QT = core testlib SOURCES = tst_qthread.cpp qtConfig(c++14):CONFIG += c++14 qtConfig(c++1z):CONFIG += c++1z + +INCLUDEPATH += ../../../../shared/ +HEADERS += ../../../../shared/emulationdetector.h diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index b107cf4b60..27a617ec85 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -51,6 +51,8 @@ #include #endif +#include "emulationdetector.h" + class tst_QThread : public QObject { Q_OBJECT @@ -943,6 +945,9 @@ void tst_QThread::adoptMultipleThreadsOverlap() // Disconnects on WinCE void tst_QThread::stressTest() { + if (EmulationDetector::isRunningArmOnX86()) + QSKIP("Qemu uses too much memory for each thread. Test would run out of memory."); + QTime t; t.start(); while (t.elapsed() < one_minute) { diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 16a9c03351..93c10d78db 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -1372,7 +1372,7 @@ void tst_QByteArray::toULongLong() QCOMPARE(b, ok); } -static bool checkSize(size_t value, uint min) +static bool checkSize(size_t value, size_t min) { return value >= min && value <= INT_MAX; } diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index e8f56fc1d3..62dd33131b 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -593,6 +593,8 @@ namespace QTest { } else { ok = qmake.waitForFinished(); exitCode = qmake.exitCode(); + if (!ok) + qmake.terminate(); std_out += qmake.readAllStandardOutput(); std_err += qmake.readAllStandardError(); diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST index d55c67998d..2303d9380e 100644 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventloop/BLACKLIST @@ -1,2 +1,4 @@ [processEvents] osx-10.12 +[testQuitLock] +osx-10.12 diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 2d32876a8d..9ef8699164 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -1644,7 +1644,7 @@ void tst_QWindow::inputReentrancy() QCOMPARE(window.touchReleasedCount, 1); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class TabletTestWindow : public QWindow { public: @@ -1672,7 +1672,7 @@ public: void tst_QWindow::tabletEvents() { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletTestWindow window; window.setGeometry(QRect(m_availableTopLeft + QPoint(10, 10), m_testWindowSize)); qGuiApp->installEventFilter(&window); diff --git a/tests/auto/gui/qopenglconfig/qopenglconfig.pro b/tests/auto/gui/qopenglconfig/qopenglconfig.pro index 9b0175acea..446a960835 100644 --- a/tests/auto/gui/qopenglconfig/qopenglconfig.pro +++ b/tests/auto/gui/qopenglconfig/qopenglconfig.pro @@ -7,4 +7,4 @@ TARGET = tst_qopenglconfig QT += gui-private core-private testlib SOURCES += tst_qopenglconfig.cpp -OTHER_FILES = buglist.json +TESTDATA += buglist.json diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp index 9f77419461..d0686eb01c 100644 --- a/tests/auto/network/access/http2/http2srv.cpp +++ b/tests/auto/network/access/http2/http2srv.cpp @@ -61,7 +61,7 @@ namespace inline bool is_valid_client_stream(quint32 streamID) { // A valid client stream ID is an odd integer number in the range [1, INT_MAX]. - return (streamID & 0x1) && streamID <= std::numeric_limits::max(); + return (streamID & 0x1) && streamID <= quint32(std::numeric_limits::max()); } void fill_push_header(const HttpHeader &originalRequest, HttpHeader &promisedRequest) diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index 715fc586cd..d72e92b859 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -32,16 +32,7 @@ #include #include -static bool waitForDone(QDnsLookup *lookup) -{ - if (lookup->isFinished()) - return true; - - QObject::connect(lookup, SIGNAL(finished()), - &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(10); - return !QTestEventLoop::instance().timeout(); -} +static const int Timeout = 15000; // 15s class tst_QDnsLookup: public QObject { @@ -231,8 +222,7 @@ void tst_QDnsLookup::lookup() lookup.setType(static_cast(type)); lookup.setName(domain); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) @@ -331,8 +321,7 @@ void tst_QDnsLookup::lookupReuse() lookup.setType(QDnsLookup::A); lookup.setName(domainName("a-single")); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) @@ -348,8 +337,7 @@ void tst_QDnsLookup::lookupReuse() lookup.setType(QDnsLookup::AAAA); lookup.setName(domainName("aaaa-single")); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); @@ -366,8 +354,7 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.setName(domainName("a-single")); lookup.lookup(); lookup.abort(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); QCOMPARE(int(lookup.error()), int(QDnsLookup::OperationCancelledError)); QVERIFY(lookup.hostAddressRecords().isEmpty()); @@ -375,8 +362,7 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.setType(QDnsLookup::AAAA); lookup.setName(domainName("aaaa-single")); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index 7faf0d947c..4f947a5738 100644 --- a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -41,7 +41,7 @@ #include #include #include - +#include #include class tst_QNetworkProxyFactory : public QObject { @@ -416,6 +416,9 @@ public: //regression test for QTBUG-18799 void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread() { + if (QSysInfo::productType() == QLatin1String("windows") && QSysInfo::productVersion() == QLatin1String("7sp1")) { + QSKIP("This test fails by the systemProxyForQuery() call hanging - QTQAINFRA-1200"); + } QUrl url(QLatin1String("http://qt-project.org")); QNetworkProxyQuery query(url); QSPFQThread thread; diff --git a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST index 2a32a326d0..60526827bf 100644 --- a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST +++ b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST @@ -4,3 +4,5 @@ * [serverTest] windows +[downloadBigFile] +windows diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index 18da122000..1212ea20e5 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -728,6 +728,10 @@ void tst_QSocks5SocketEngine::downloadBigFile() QTcpSocket socket; qint64 bytesAvailable = 0; + + QElapsedTimer stopWatch; + stopWatch.start(); + connect(&socket, &QAbstractSocket::connected, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop); connect(&socket, &QIODevice::readyRead, @@ -743,10 +747,11 @@ void tst_QSocks5SocketEngine::downloadBigFile() }); connect(&socket, QOverload::of(&QAbstractSocket::error), - [&socket] (QAbstractSocket::SocketError errorCode) + [&socket, &stopWatch] (QAbstractSocket::SocketError errorCode) { qWarning().noquote().nospace() << QTest::currentTestFunction() - << ": error " << errorCode << ": " << socket.errorString(); + << ": error " << errorCode << ": " << socket.errorString() + << " (" << stopWatch.elapsed() << "ms)"; }); socket.connectToHost(QtNetworkSettings::serverName(), 80); @@ -763,11 +768,7 @@ void tst_QSocks5SocketEngine::downloadBigFile() QVERIFY(socket.write("\r\n") > 0); QVERIFY(socket.write("\r\n") > 0); - - - QTime stopWatch; - stopWatch.start(); - + stopWatch.restart(); QTestEventLoop::instance().enterLoop(60); if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 22c2e1fbc7..14ede33500 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -197,7 +197,7 @@ void tst_languageChange::retranslatability_data() << "QFileDialog::Back" << "QFileDialog::Create New Folder" << "QFileDialog::Detail View" -#ifndef Q_OS_MAC +#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT) << "QFileDialog::File" #endif << "QFileDialog::Files of type:" diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST index 3e68ba0cf0..f1eb038201 100644 --- a/tests/auto/other/macnativeevents/BLACKLIST +++ b/tests/auto/other/macnativeevents/BLACKLIST @@ -21,3 +21,6 @@ osx osx [testMouseDragToNonClientArea] osx +# QTQAINFRA-1292 +[testPushButtonPressRelease] +osx-10.11 ci diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index eb056475d1..3a6102f2fa 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -94,7 +94,7 @@ private slots: void customPaperSizeAndMargins(); void customPaperNameSettingBySize(); void customPaperNameSettingByName(); -#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG) +#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog) void printDialogCompleter(); #endif void testCurrentPage(); @@ -601,7 +601,7 @@ void tst_QPrinter::customPaperSizeAndMargins() } } -#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG) +#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog) void tst_QPrinter::printDialogCompleter() { QPrintDialog dialog; diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h index 6e04831589..43d00e82f3 100644 --- a/tests/auto/tools/moc/namespace.h +++ b/tests/auto/tools/moc/namespace.h @@ -74,4 +74,8 @@ namespace FooNamespace { } } +#ifdef Q_MOC_RUN +namespace __identifier("") {} // QTBUG-56634 +#endif + #endif // NAMESPACE_H diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index ac7ba02700..d3bc83fe6d 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -339,7 +339,7 @@ void tst_QDialog::showFullScreen() QVERIFY(dialog.isFullScreen()); QVERIFY(!dialog.isVisible()); - dialog.show(); + dialog.setVisible(true); QVERIFY(dialog.isFullScreen()); QVERIFY(dialog.isVisible()); diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index 0ea9e0259f..4ea0de5ab9 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -349,11 +349,12 @@ void tst_QInputDialog::taskQTBUG_54693_crashWhenParentIsDeletedWhileDialogIsOpen } // getItem - for (int editable = false; editable <= true; ++editable) { + for (int editable = 0; editable < 2; ++editable) { QAutoPointer dialog(new SelfDestructParent); bool ok = true; const QString result = QInputDialog::getItem(dialog.get(), "Title", "Label", - QStringList() << "1" << "2", 1, editable, &ok); + QStringList() << "1" << "2", 1, + editable != 0, &ok); QVERIFY(!dialog); QVERIFY(!ok); QCOMPARE(result, QLatin1String("2")); diff --git a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST index a2670e8f36..1789f51507 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST @@ -1,2 +1,2 @@ -[autoShow:50_to_100_fast_0_compat] -osx +[autoShow] +osx ci diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index 4d289dcb02..a1cb729849 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -52,7 +52,6 @@ private slots: void boundingRect2(); void draw(); void opacity(); - void nestedOpaqueOpacity(); void grayscale(); void colorize(); void drawPixmapItem(); @@ -408,26 +407,6 @@ void tst_QGraphicsEffect::opacity() QCOMPARE(effect->m_opacity, qreal(0.5)); } -void tst_QGraphicsEffect::nestedOpaqueOpacity() -{ - // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with - // QGraphicsOpacityEffect caused crashes due to constructing several - // QPainter instances on a device in the fast path for - // QGraphicsOpacityEffect::opacity=1 - QWidget topLevel; - topLevel.setWindowTitle(QTest::currentTestFunction()); - topLevel.resize(QApplication::desktop()->screenGeometry(&topLevel).size() / 8); - QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect; - opacityEffect->setOpacity(1); - topLevel.setGraphicsEffect(opacityEffect); - QWidget *child = new QWidget(&topLevel); - child->resize(topLevel.size() / 2); - QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect; - child->setGraphicsEffect(childEffect); - topLevel.show(); - QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); -} - void tst_QGraphicsEffect::grayscale() { if (qApp->desktop()->depth() < 24) diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 65c9938f89..e49cd87941 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -112,7 +112,7 @@ private slots: void resizeEvent_data(); void resizeEvent(); void paintEvent(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif void sizeHint_data(); @@ -254,7 +254,7 @@ public: int focusOut; }; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class WheelWidget : public QWidget { public: @@ -264,7 +264,7 @@ public: bool wheelEventCalled; }; -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) // This will be called before the first test function is executed. // It is only called once. @@ -1297,7 +1297,7 @@ void tst_QGraphicsProxyWidget::paintEvent() } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QGraphicsProxyWidget::wheelEvent() { QGraphicsScene scene; @@ -1321,7 +1321,7 @@ void tst_QGraphicsProxyWidget::wheelEvent() QVERIFY(event.isAccepted()); QVERIFY(wheelWidget->wheelEventCalled); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) Q_DECLARE_METATYPE(Qt::SizeHint) void tst_QGraphicsProxyWidget::sizeHint_data() diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 6abd3f6366..1430911cf0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -199,7 +199,7 @@ private slots: void mapFromScenePoly(); void mapFromScenePath(); void sendEvent(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif #ifndef QT_NO_CURSOR @@ -2188,7 +2188,7 @@ void tst_QGraphicsView::sendEvent() QCOMPARE(item->events.last(), QEvent::KeyPress); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class MouseWheelScene : public QGraphicsScene { public: @@ -2245,7 +2245,7 @@ void tst_QGraphicsView::wheelEvent() QCOMPARE(spy.count(), 2); QVERIFY(widget->hasFocus()); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) #ifndef QT_NO_CURSOR void tst_QGraphicsView::cursor() diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index cf8ee310d3..c75c1dc87e 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -180,7 +180,7 @@ private slots: void task191545_dragSelectRows(); void taskQTBUG_5062_spansInconsistency(); void taskQTBUG_4516_clickOnRichTextLabel(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void taskQTBUG_5237_wheelEventOnHeader(); #endif void taskQTBUG_8585_crashForNoGoodReason(); @@ -190,7 +190,7 @@ private slots: void taskQTBUG_30653_doItemsLayout(); void taskQTBUG_50171_selectRowAfterSwapColumns(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void mouseWheel_data(); void mouseWheel(); #endif @@ -693,12 +693,14 @@ void tst_QTableView::keyboardNavigation() case Qt::Key_Backtab: if (!tabKeyNavigation) break; + Q_FALLTHROUGH(); case Qt::Key_Left: column = qMax(0, column - 1); break; case Qt::Key_Tab: if (!tabKeyNavigation) break; + Q_FALLTHROUGH(); case Qt::Key_Right: column = qMin(columnCount - 1, column + 1); break; @@ -3966,7 +3968,7 @@ void tst_QTableView::task248688_autoScrollNavigation() } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QTableView::mouseWheel_data() { QTest::addColumn("scrollMode"); @@ -4019,7 +4021,7 @@ void tst_QTableView::mouseWheel() QApplication::sendEvent(view.viewport(), &verticalEvent); QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 15); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QTableView::addColumnWhileEditing() { @@ -4283,7 +4285,7 @@ void tst_QTableView::changeHeaderData() QVERIFY(view.verticalHeader()->width() > textWidth); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader() { QTableView view; diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index f20805f97e..fa7f9596da 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1560,10 +1560,9 @@ void tst_QTreeWidget::scrollToItem() { // Check if all parent nodes of the item found are expanded. // Reported in task #78761 - QTreeWidgetItem *bar; - QTreeWidgetItem *search; + QTreeWidgetItem *search = nullptr; for (int i=0; i<2; ++i) { - bar = new QTreeWidgetItem(testWidget); + QTreeWidgetItem *bar = new QTreeWidgetItem(testWidget); bar->setText(0, QString::number(i)); for (int j=0; j<2; ++j) { @@ -1571,9 +1570,8 @@ void tst_QTreeWidget::scrollToItem() foo->setText(0, bar->text(0) + QString::number(j)); for (int k=0; k<2; ++k) { - QTreeWidgetItem *yo = new QTreeWidgetItem(foo); - yo->setText(0, foo->text(0) + QString::number(k)); - search = yo; + search = new QTreeWidgetItem(foo); + search->setText(0, foo->text(0) + QString::number(k)); } } } @@ -1582,10 +1580,10 @@ void tst_QTreeWidget::scrollToItem() testWidget->scrollToItem(search); QCOMPARE(search->text(0), QLatin1String("111")); - bar = search->parent(); - QVERIFY(testWidget->isItemExpanded(bar)); - bar = bar->parent(); - QVERIFY(testWidget->isItemExpanded(bar)); + QTreeWidgetItem *par = search->parent(); + QVERIFY(testWidget->isItemExpanded(par)); + par = par->parent(); + QVERIFY(testWidget->isItemExpanded(par)); } // From task #85413 @@ -2663,7 +2661,7 @@ void tst_QTreeWidget::expandAndCallapse() { QTreeWidget tw; QTreeWidgetItem *top = new QTreeWidgetItem(&tw, QStringList() << "top"); - QTreeWidgetItem *p; + QTreeWidgetItem *p = nullptr; for (int i = 0; i < 10; ++i) { p = new QTreeWidgetItem(top, QStringList(QString::number(i))); for (int j = 0; j < 10; ++j) diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index b98cc048c8..6ff38abdb8 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -140,7 +140,7 @@ private slots: void execAfterExit(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelScrollLines(); #endif @@ -1773,7 +1773,7 @@ void tst_QApplication::execAfterExit() QCOMPARE(exitCode, 0); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QApplication::wheelScrollLines() { int argc = 1; @@ -1781,7 +1781,7 @@ void tst_QApplication::wheelScrollLines() // If wheelScrollLines returns 0, the mose wheel will be disabled. QVERIFY(app.wheelScrollLines() > 0); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QApplication::style() { diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 01c8e783ad..ab45a342e3 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -47,6 +47,7 @@ osx osx [showMinimizedKeepsFocus] osx-10.10 +osx-10.11 ci [moveWindowInShowEvent:1] osx [moveWindowInShowEvent:2] diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index 937be944a1..f8095badb8 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -348,7 +348,7 @@ void tst_QCompleter::getSetCheck() completer.setWrapAround(false); QCOMPARE(completer.wrapAround(), false); -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) // QTBUG-54642, changing from QFileSystemModel to another model should restore role. completer.setCompletionRole(Qt::EditRole); QCOMPARE(completer.completionRole(), static_cast(Qt::EditRole)); // default value @@ -361,7 +361,7 @@ void tst_QCompleter::getSetCheck() QStandardItemModel standardItemModel2(2, 2); // Do not clobber a custom role when changing models completer.setModel(&standardItemModel2); QCOMPARE(completer.completionRole(), static_cast(Qt::ToolTipRole)); -#endif // QT_NO_FILESYSTEMMODEL +#endif // QT_CONFIG(filesystemmodel) } void tst_QCompleter::csMatchingOnCsSortedModel_data() diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp index 17a5320433..f0d74e7797 100644 --- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp @@ -74,7 +74,7 @@ private slots: void minimum_maximum(); void keyPressed_data(); void keyPressed(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent_data(); void wheelEvent(); void fineGrainedWheelEvent_data(); @@ -690,7 +690,7 @@ void tst_QAbstractSlider::keyPressed() QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QAbstractSlider::wheelEvent_data() { QTest::addColumn("initialSliderPosition"); @@ -941,7 +941,7 @@ void tst_QAbstractSlider::fineGrainedWheelEvent() QCOMPARE(slider->sliderPosition(), 1); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QAbstractSlider::sliderPressedReleased_data() { diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 75b75ad44c..2f4e1a32f3 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -120,11 +120,11 @@ private slots: void flaggedItems_data(); void flaggedItems(); void pixmapIcon(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void mouseWheel_data(); void mouseWheel(); void popupWheelHandling(); -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void layoutDirection(); void itemListPosition(); void separatorItem_data(); @@ -2037,7 +2037,7 @@ void tst_QComboBox::pixmapIcon() QCOMPARE( box.itemIcon(1).isNull(), false ); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) // defined to be 120 by the wheel mouse vendors according to the docs #define WHEEL_DELTA 120 @@ -2134,7 +2134,7 @@ void tst_QComboBox::popupWheelHandling() QVERIFY(comboBox->view()->isVisible()); QCOMPARE(comboBox->view()->pos(), popupPos); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QComboBox::layoutDirection() { diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 9ab755c5f1..94e4fc005c 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -205,7 +205,7 @@ private slots: void reverseTest(); void ddMMMMyyyy(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif @@ -2998,7 +2998,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy() QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200"); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QDateTimeEdit::wheelEvent() { testWidget->setDisplayFormat("dddd/MM"); @@ -3011,7 +3011,7 @@ void tst_QDateTimeEdit::wheelEvent() qApp->sendEvent(testWidget, &w); QCOMPARE(testWidget->date(), QDate(2000, 3, 22)); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QDateTimeEdit::specialValueCornerCase() { diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index de49d5ff45..ea468b378e 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -1,2 +1,4 @@ [task258920_mouseBorder] osx +[submenuTearOffDontClose] +osx-10.11 ci diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST index fa326a6ea5..7825c33a0a 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST +++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST @@ -1,5 +1,6 @@ [clearAndGrab] opensuse-13.1 +ubuntu #QTBUG-31611 [painter] diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index 009a607818..e10c7591d5 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -55,6 +55,7 @@ private slots: void painter(); void reparentToAlreadyCreated(); void reparentToNotYetCreated(); + void reparentHidden(); void asViewport(); void requestUpdate(); void fboRedirect(); @@ -283,6 +284,36 @@ void tst_QOpenGLWidget::reparentToNotYetCreated() QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255)); } +void tst_QOpenGLWidget::reparentHidden() +{ + // Tests QTBUG-60896 + QWidget topLevel1; + + QWidget *container = new QWidget(&topLevel1); + PainterWidget *glw = new PainterWidget(container); + topLevel1.resize(640, 480); + glw->resize(320, 200); + topLevel1.show(); + + glw->hide(); // Explicitly hidden + + QTest::qWaitForWindowExposed(&topLevel1); + + QWidget topLevel2; + topLevel2.resize(640, 480); + topLevel2.show(); + QTest::qWaitForWindowExposed(&topLevel2); + + QOpenGLContext *originalContext = glw->context(); + QVERIFY(originalContext); + + container->setParent(&topLevel2); + glw->show(); // Should get a new context now + + QOpenGLContext *newContext = glw->context(); + QVERIFY(originalContext != newContext); +} + class CountingGraphicsView : public QGraphicsView { public: diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index 08ef96bf1b..5238eea592 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -50,7 +50,7 @@ class tst_QScrollBar : public QObject private slots: void scrollSingleStep(); void task_209492(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QTBUG_27308(); #endif void QTBUG_42871(); @@ -143,7 +143,7 @@ void tst_QScrollBar::task_209492() QCOMPARE(spy.count(), 1); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) #define WHEEL_DELTA 120 // copied from tst_QAbstractSlider / tst_QComboBox void tst_QScrollBar::QTBUG_27308() { diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 808c7f9d3d..07a2fd859d 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -69,7 +69,7 @@ public: { return QSpinBox::valueFromText(text); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) { QSpinBox::wheelEvent(event); @@ -1218,7 +1218,7 @@ void tst_QSpinBox::setGroupSeparatorShown() void tst_QSpinBox::wheelEvents() { -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) SpinBox spinBox; spinBox.setRange(-20, 20); spinBox.setValue(0); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index bc94e2a05b..55ef44f4e0 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -199,7 +199,7 @@ private slots: void findWithRegExpReturnsFalseIfNoMoreResults(); #endif -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif @@ -2566,7 +2566,7 @@ void tst_QTextEdit::findWithRegExpReturnsFalseIfNoMoreResults() } #endif -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class TextEdit : public QTextEdit { diff --git a/tests/baselineserver/shared/lookup3.cpp b/tests/baselineserver/shared/lookup3.cpp index 03e5f96e22..3d8d763bb7 100644 --- a/tests/baselineserver/shared/lookup3.cpp +++ b/tests/baselineserver/shared/lookup3.cpp @@ -207,9 +207,12 @@ quint32 initval) /* the previous hash, or an arbitrary value */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; + Q_FALLTHROUGH(); case 2 : b+=k[1]; + Q_FALLTHROUGH(); case 1 : a+=k[0]; - final(a,b,c); + final(a,b,c); + Q_FALLTHROUGH(); case 0: /* case 0: nothing left to add */ break; } @@ -253,9 +256,12 @@ quint32 *pb) /* IN: more seed OUT: secondary hash value */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; + Q_FALLTHROUGH(); case 2 : b+=k[1]; + Q_FALLTHROUGH(); case 1 : a+=k[0]; final(a,b,c); + Q_FALLTHROUGH(); case 0: /* case 0: nothing left to add */ break; } @@ -349,16 +355,24 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ - case 10: c+=((quint32)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<8; + Q_FALLTHROUGH(); + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ - case 6 : b+=((quint32)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<8; + Q_FALLTHROUGH(); + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ - case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k8[0]; break; case 0 : return c; } @@ -388,23 +402,28 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); case 10: c+=k[4]; b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=k[2]; a+=k[0]+(((quint32)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]+(((quint32)k[1])<<16); break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -439,16 +458,27 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=((quint32)k[11])<<24; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<16; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<8; + Q_FALLTHROUGH(); case 9 : c+=k[8]; + Q_FALLTHROUGH(); case 8 : b+=((quint32)k[7])<<24; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<8; + Q_FALLTHROUGH(); case 5 : b+=k[4]; + Q_FALLTHROUGH(); case 4 : a+=((quint32)k[3])<<24; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k[0]; break; case 0 : return c; @@ -533,16 +563,24 @@ void hashlittle2( switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ - case 10: c+=((quint32)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<8; + Q_FALLTHROUGH(); + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ - case 6 : b+=((quint32)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<8; + Q_FALLTHROUGH(); + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ - case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k8[0]; break; case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ } @@ -572,23 +610,28 @@ void hashlittle2( b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); case 10: c+=k[4]; b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=k[2]; a+=k[0]+(((quint32)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]+(((quint32)k[1])<<16); break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -623,16 +666,27 @@ void hashlittle2( switch(length) /* all the case statements fall through */ { case 12: c+=((quint32)k[11])<<24; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<16; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<8; + Q_FALLTHROUGH(); case 9 : c+=k[8]; + Q_FALLTHROUGH(); case 8 : b+=((quint32)k[7])<<24; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<8; + Q_FALLTHROUGH(); case 5 : b+=k[4]; + Q_FALLTHROUGH(); case 4 : a+=((quint32)k[3])<<24; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k[0]; break; case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ @@ -709,16 +763,24 @@ quint32 hashbig( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<8; /* fall through */ - case 10: c+=((quint32)k8[9])<<16; /* fall through */ - case 9 : c+=((quint32)k8[8])<<24; /* fall through */ + case 11: c+=((quint32)k8[10])<<8; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<16; + Q_FALLTHROUGH(); + case 9 : c+=((quint32)k8[8])<<24; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<8; /* fall through */ - case 6 : b+=((quint32)k8[5])<<16; /* fall through */ - case 5 : b+=((quint32)k8[4])<<24; /* fall through */ + case 7 : b+=((quint32)k8[6])<<8; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<16; + Q_FALLTHROUGH(); + case 5 : b+=((quint32)k8[4])<<24; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<8; /* fall through */ - case 2 : a+=((quint32)k8[1])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<8; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<16; + Q_FALLTHROUGH(); case 1 : a+=((quint32)k8[0])<<24; break; case 0 : return c; } @@ -752,16 +814,27 @@ quint32 hashbig( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=k[11]; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<8; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<16; + Q_FALLTHROUGH(); case 9 : c+=((quint32)k[8])<<24; + Q_FALLTHROUGH(); case 8 : b+=k[7]; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<8; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<16; + Q_FALLTHROUGH(); case 5 : b+=((quint32)k[4])<<24; + Q_FALLTHROUGH(); case 4 : a+=k[3]; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<8; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<16; + Q_FALLTHROUGH(); case 1 : a+=((quint32)k[0])<<24; break; case 0 : return c; diff --git a/tests/manual/qtabbar/main.cpp b/tests/manual/qtabbar/main.cpp index b1ef0df100..5a1a558c10 100644 --- a/tests/manual/qtabbar/main.cpp +++ b/tests/manual/qtabbar/main.cpp @@ -56,12 +56,28 @@ #include #include #include +#include + +class MyProxyStyle : public QProxyStyle +{ +public: + int styleHint(StyleHint hint, const QStyleOption *option = 0, + const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const + { + if (hint == QStyle::SH_TabBar_Alignment) + return Qt::AlignLeft; +// return Qt::AlignRight; +// return Qt::AlignCenter; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } +}; const int TabCount = 5; int main(int argc, char *argv[]) { QApplication app(argc, argv); + app.setStyle(new MyProxyStyle); QWidget widget; QStackedWidget stackedWidget; @@ -69,7 +85,7 @@ int main(int argc, char *argv[]) tabBar.setDocumentMode(true); tabBar.setTabsClosable(true); tabBar.setMovable(true); - tabBar.setExpanding(true); + tabBar.setExpanding(false); // top tabBar.setShape(QTabBar::RoundedNorth);