diff options
813 files changed, 7381 insertions, 26600 deletions
diff --git a/.qmake.conf b/.qmake.conf index 7121ac2008..e6301f2d22 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -5,4 +5,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.7.0 +MODULE_VERSION = 5.8.0 diff --git a/config.tests/common/c++default/c++default.cpp b/config.tests/common/c++default/c++default.cpp deleted file mode 100644 index 018963beb3..0000000000 --- a/config.tests/common/c++default/c++default.cpp +++ /dev/null @@ -1 +0,0 @@ -__cplusplus diff --git a/config.tests/common/c++default/c++default.pro b/config.tests/common/c++default/c++default.pro deleted file mode 100644 index 7e6bcefe69..0000000000 --- a/config.tests/common/c++default/c++default.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = aux -CONFIG -= qt c++11 -PREPROCESSOR_SOURCES += c++default.cpp - -preprocessor.commands = $(CXX) $(CXXFLAGS) $(INCPATH) -o $@ -E $< -msvc:preprocessor.commands = $(CXX) $(CXXFLAGS) $(INCPATH) -E ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} -preprocessor.output = ${QMAKE_FILE_BASE}.ii -preprocessor.input = PREPROCESSOR_SOURCES -preprocessor.variable_out = GENERATED_FILES -QMAKE_EXTRA_COMPILERS += preprocessor - -all.target = all -all.depends += c++default.ii -QMAKE_EXTRA_TARGETS += all diff --git a/config.tests/unix/openvg/openvg.cpp b/config.tests/unix/openvg/openvg.cpp deleted file mode 100644 index a322db4824..0000000000 --- a/config.tests/unix/openvg/openvg.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// There is some variation in OpenVG engines as to what case -// the VG includes use. The Khronos reference implementation -// for OpenVG 1.1 uses upper case, so we treat that as canonical. -#if defined(QT_LOWER_CASE_VG_INCLUDES) -#include <vg/openvg.h> -#else -#include <VG/openvg.h> -#endif - -int main(int, char **) -{ - VGint i; - i = 2; - vgFlush(); - return 0; -} diff --git a/config.tests/unix/openvg/openvg.pro b/config.tests/unix/openvg/openvg.pro deleted file mode 100644 index 4bbde99230..0000000000 --- a/config.tests/unix/openvg/openvg.pro +++ /dev/null @@ -1,19 +0,0 @@ -SOURCES += openvg.cpp - -!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG -!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG -!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG - -# Some OpenVG engines (e.g. ShivaVG) are implemented on top of OpenGL. -# Add the extra includes and libraries for that case. -openvg_on_opengl { - !isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - !isEmpty(QMAKE_LIBDIR_OPENGL): LIBS += -L$$QMAKE_LIBDIR_OPENGL - !isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL -} - -lower_case_includes { - DEFINES += QT_LOWER_CASE_VG_INCLUDES -} - -CONFIG -= qt diff --git a/config.tests/unix/shivavg/shivavg.pro b/config.tests/unix/shivavg/shivavg.pro deleted file mode 100644 index 39d7bcc78a..0000000000 --- a/config.tests/unix/shivavg/shivavg.pro +++ /dev/null @@ -1,11 +0,0 @@ -SOURCES += shivavg.cpp - -!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG -!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG -!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG - -!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL -!isEmpty(QMAKE_LIBDIR_OPENGL): LIBS += -L$$QMAKE_LIBDIR_OPENGL -!isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL - -CONFIG -= qt diff --git a/config_help.txt b/config_help.txt new file mode 100644 index 0000000000..971e932657 --- /dev/null +++ b/config_help.txt @@ -0,0 +1,433 @@ +Usage: configure [options] + +Installation options: + + These are optional, but you may specify install directories. + + -prefix <dir> ...... The deployment directory, as seen on the target device. + (default /usr/local/Qt-$QT_VERSION, $PWD if -developer-build is active) + + -extprefix <dir> ... The installation directory, as seen on the host machine. + (default SYSROOT/PREFIX) + + -hostprefix [dir] .. The installation directory for build tools running on the + host machine. If [dir] is not given, the current build + directory will be used. (default EXTPREFIX) + + You may use these to change the layout of the install. Note that all directories + except -sysconfdir should be located under -prefix/-hostprefix: + + -bindir <dir> ......... User executables will be installed to <dir> + (default PREFIX/bin) + -headerdir <dir> ...... Headers will be installed to <dir> + (default PREFIX/include) + -libdir <dir> ......... Libraries will be installed to <dir> + (default PREFIX/lib) + -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir> + (default PREFIX) + -plugindir <dir> ...... Plugins will be installed to <dir> + (default ARCHDATADIR/plugins) + -libexecdir <dir> ..... Program executables will be installed to <dir> + (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) + -importdir <dir> ...... Imports for QML1 will be installed to <dir> + (default ARCHDATADIR/imports) + -qmldir <dir> ......... Imports for QML2 will be installed to <dir> + (default ARCHDATADIR/qml) + -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir> + (default PREFIX) + -docdir <dir> ......... Documentation will be installed to <dir> + (default DATADIR/doc) + -translationdir <dir> . Translations of Qt programs will be installed to <dir> + (default DATADIR/translations) + -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir> + (default PREFIX/etc/xdg) + -examplesdir <dir> .... Examples will be installed to <dir> + (default PREFIX/examples) + -testsdir <dir> ....... Tests will be installed to <dir> + (default PREFIX/tests) + + -hostbindir <dir> ..... Host executables will be installed to <dir> + (default HOSTPREFIX/bin) + -hostlibdir <dir> ..... Host libraries will be installed to <dir> + (default HOSTPREFIX/lib) + -hostdatadir <dir> .... Data used by qmake will be installed to <dir> + (default HOSTPREFIX) + +Configure options: + + The defaults (*) are usually acceptable. A plus (+) denotes a default value + that needs to be evaluated. If the evaluation succeeds, the feature is + included. Here is a short explanation of each option: + + * -release ............. Compile and link Qt with debugging turned off. + -debug ............... Compile and link Qt with debugging turned on. + -debug-and-release ... Compile and link two versions of Qt, with and without + debugging turned on (Apple platforms only). + + -force-debug-info .... Create symbol files for release builds. + + -developer-build ..... Compile and link Qt with Qt developer options (including auto-tests exporting) + + * -no-optimized-tools .. Do not build optimized host tools even in debug build. + -optimized-tools ..... Build optimized host tools even in debug build. + + -opensource .......... Compile and link the Open-Source Edition of Qt. + -commercial .......... Compile and link the Commercial Edition of Qt. + + -confirm-license ..... Automatically acknowledge the license (use with + either -opensource or -commercial) + + -c++std <edition> .... Compile Qt with C++ standard edition (c++11, c++14, c++1z) + Default: highest supported + + * -shared .............. Create and use shared Qt libraries. + -static .............. Create and use static Qt libraries. + + -no-accessibility .... Do not compile Accessibility support. + Disabling accessibility is not recommended, as it will break QStyle + and may break other internal parts of Qt. + With this switch you create a source incompatible version of Qt, + which is unsupported. + + -accessibility ....... Compile Accessibility support. + + -no-sql-<driver> ..... Disable SQL <driver>. + -sql-<driver> Enable SQL <driver> plugin. + + Possible values for <driver>: + [db2, ibase, mysql, oci, odbc, psql, sqlite, sqlite2, tds] + + -system-sqlite ....... Use sqlite from the operating system. + + -no-qml-debug ........ Do not build the in-process QML debugging support. + + -qml-debug ........... Build the QML debugging support. + + -platform target ..... The operating system and compiler you are building + on (default detected from host system). + + See the README file for a list of supported + operating systems and compilers. + + -no-sse2 ............. Do not compile with use of SSE2 instructions. + -no-sse3 ............. Do not compile with use of SSE3 instructions. + -no-ssse3 ............ Do not compile with use of SSSE3 instructions. + -no-sse4.1 ........... Do not compile with use of SSE4.1 instructions. + -no-sse4.2 ........... Do not compile with use of SSE4.2 instructions. + -no-avx .............. Do not compile with use of AVX instructions. + -no-avx2 ............. Do not compile with use of AVX2 instructions. + -no-avx512 ........... Do not compile with use of AVX512 instructions. + -no-mips_dsp ......... Do not compile with use of MIPS DSP instructions. + -no-mips_dspr2 ....... Do not compile with use of MIPS DSP rev2 instructions. + + -qtnamespace <name> .. Wraps all Qt library code in 'namespace <name> {...}'. + -qtlibinfix <infix> .. Renames all libQt*.so to libQt*<infix>.so. + + -testcocoon .......... Instrument Qt with the TestCocoon code coverage tool. + -gcov ................ Instrument Qt with the GCov code coverage tool. + + -D <string> .......... Add an explicit define to the preprocessor. + -I <string> .......... Add an explicit include path. + -L <string> .......... Add an explicit library path. + + + -pkg-config .......... Use pkg-config to detect include and library paths. By default, + configure determines whether to use pkg-config or not with + some heuristics such as checking the environment variables. + -no-pkg-config ....... Disable use of pkg-config. + -force-pkg-config .... Force usage of pkg-config (skips pkg-config usability + detection heuristic). + + -help, -h ............ Display this information. + +Third Party Libraries: + + -qt-zlib ............. Use the zlib bundled with Qt. + + -system-zlib ......... Use zlib from the operating system. + See http://www.gzip.org/zlib + + -no-mtdev ............ Do not compile mtdev support. + + -mtdev ............... Enable mtdev support. + + + -no-journald ......... Do not send logging output to journald. + -journald ............ Send logging output to journald. + + + -no-syslog ........... Do not send logging output to syslog. + -syslog .............. Send logging output to syslog. + + -no-gif .............. Do not compile GIF reading support. + + -no-libpng ........... Do not compile PNG support. + -qt-libpng ........... Use the libpng bundled with Qt. + + -system-libpng ....... Use libpng from the operating system. + See http://www.libpng.org/pub/png + + -no-libjpeg .......... Do not compile JPEG support. + -qt-libjpeg .......... Use the libjpeg bundled with Qt. + + -system-libjpeg ...... Use libjpeg from the operating system. + See http://www.ijg.org + + -no-doubleconversion ..... Use sscanf_l and snprintf_l for (imprecise) double conversion. + -qt-doubleconversion ..... Use the libdouble-conversion bundled with Qt. + + -system-doubleconversion . Use the libdouble-conversion provided by the system. + See https://github.com/google/double-conversion + + -no-freetype ......... Do not compile in Freetype2 support. + -qt-freetype ......... Use the libfreetype bundled with Qt. + + -system-freetype...... Use the libfreetype provided by the system (enabled if -fontconfig is active). + See http://www.freetype.org + + -no-harfbuzz ......... Do not compile HarfBuzz-NG support. + -qt-harfbuzz ......... Use HarfBuzz-NG bundled with Qt to do text shaping. + It can still be disabled by setting + the QT_HARFBUZZ environment variable to "old". + + -system-harfbuzz ..... Use HarfBuzz-NG from the operating system + to do text shaping. It can still be disabled + by setting the QT_HARFBUZZ environment variable to "old". + See http://www.harfbuzz.org + + -no-openssl .......... Do not compile support for OpenSSL. + + -openssl ............. Enable run-time OpenSSL support. + -openssl-linked ...... Enabled linked OpenSSL support. + + -no-libproxy ......... Do not compile support for libproxy + + -libproxy ............ Use libproxy from the operating system. + + -qt-pcre ............. Use the PCRE library bundled with Qt. + + -system-pcre ......... Use the PCRE library from the operating system. + + -qt-xcb .............. Use xcb- libraries bundled with Qt. + (libxcb.so will still be used from operating system). + + -system-xcb .......... Use xcb- libraries from the operating system. + + -xkb-config-root ..... Set default XKB config root. This option is used only together with -qt-xkbcommon-x11. + -qt-xkbcommon-x11 .... Use the xkbcommon library bundled with Qt in combination with xcb. + + -system-xkbcommon-x11 Use the xkbcommon library from the operating system in combination with xcb. + + -no-xkbcommon-evdev .. Do not use X-less xkbcommon when compiling libinput support. + * -xkbcommon-evdev ..... Use X-less xkbcommon when compiling libinput support. + + -no-xinput2 .......... Do not compile XInput2 support. + * -xinput2 ............. Compile XInput2 support. + + -no-xcb-xlib.......... Do not compile Xcb-Xlib support. + * -xcb-xlib............. Compile Xcb-Xlib support. + + -no-glib ............. Do not compile Glib support. + + -glib ................ Compile Glib support. + + -no-pulseaudio ....... Do not compile PulseAudio support. + + -pulseaudio .......... Compile PulseAudio support. + + -no-alsa ............. Do not compile ALSA support. + + -alsa ................ Compile ALSA support. + + -no-gtk .............. Do not compile GTK platform theme support. + + -gtk ................. Compile GTK platform theme support. + +Additional options: + + -make <part> ......... Add part to the list of parts to be built at make time. + (defaults to: libs tools examples) + -nomake <part> ....... Exclude part from the list of parts to be built. + + -skip <module> ....... Exclude an entire module from the build. + + -no-compile-examples . Install only the sources of examples. + + -no-gui .............. Don't build the Qt GUI module and dependencies. + + -gui ................. Build the Qt GUI module and dependencies. + + -no-widgets .......... Don't build the Qt Widgets module and dependencies. + + -widgets ............. Build the Qt Widgets module and dependencies. + + -R <string> .......... Add an explicit runtime library path to the Qt + libraries. + -l <string> .......... Add an explicit library. + + -no-rpath ............ Do not use the library install path as a runtime + library path. On Apple platforms, this implies using + absolute install names (based in -libdir) for dynamic + libraries and frameworks. + + -rpath ............... Link Qt libraries and executables using the library + install path as a runtime library path. Equivalent + to -R install_libpath + + -continue ............ Continue as far as possible if an error occurs. + + -verbose, -v ......... Print verbose information about each step of the + configure process. + + -silent .............. Reduce the build output so that warnings and errors + can be seen more easily. + + -no-nis .............. Do not compile NIS support. + * -nis ................. Compile NIS support. + + -no-cups ............. Do not compile CUPS support. + * -cups ................ Compile CUPS support. + Requires cups/cups.h and libcups.so.2. + + -no-iconv ............ Do not compile support for iconv(3). + * -iconv ............... Compile support for iconv(3). + + -no-evdev ............ Do not compile support for evdev. + * -evdev ............... Compile support for evdev. + + -no-tslib ............ Do not compile support for tslib. + * -tslib ............... Compile support for tslib. + + -no-icu .............. Do not compile support for ICU libraries. + + -icu ................. Compile support for ICU libraries. + + -no-fontconfig ....... Do not compile FontConfig support. + + -fontconfig .......... Compile FontConfig support. + + -no-strip ............ Do not strip binaries and libraries of unneeded symbols. + * -strip ............... Strip binaries and libraries of unneeded symbols when installing. + + * -no-pch .............. Do not use precompiled header support. + -pch ................. Use precompiled header support. + + * -no-ltcg Do not use Link Time Code Generation + -ltcg Use Link Time Code Generation. + + -no-dbus ............. Do not compile the Qt D-Bus module. + + -dbus-linked ......... Compile the Qt D-Bus module and link to libdbus-1. + -dbus-runtime ........ Compile the Qt D-Bus module and dynamically load libdbus-1. + + -reduce-relocations .. Reduce relocations in the libraries through extra + linker optimizations (Qt/X11 and Qt for Embedded Linux only; + experimental; needs GNU ld >= 2.18). + + -no-use-gold-linker .. Do not link using the GNU gold linker. + + -use-gold-linker ..... Link using the GNU gold linker if available. + + -force-asserts ....... Force Q_ASSERT to be enabled even in release builds. + + -sanitize [address|thread|memory|undefined] Enables the specified compiler sanitizer. + + -device <name> ............... Cross-compile for device <name> (experimental) + -device-option <key=value> ... Add device specific options for the device mkspec + (experimental) + + -host-option <key=value> ..... Add host specific options for the host mkspec + + * -no-separate-debug-info ...... Do not store debug information in a separate file. + -separate-debug-info ......... Strip debug information into a separate file. + + -no-xcb .............. Do not compile Xcb (X protocol C-language Binding) support. + * -xcb ................. Compile Xcb support. + + -no-eglfs ............ Do not compile EGLFS (EGL Full Screen/Single Surface) support. + * -eglfs ............... Compile EGLFS support. + + -no-kms .............. Do not compile backends for KMS. + * -kms ................. Compile backends for KMS. + + -no-gbm .............. Do not compile backends for GBM. + * -gbm ................. Compile backends for GBM. + + -no-directfb ......... Do not compile DirectFB support. + * -directfb ............ Compile DirectFB support. + + -no-linuxfb .......... Do not compile Linux Framebuffer support. + * -linuxfb ............. Compile Linux Framebuffer support. + + * -no-mirclient......... Do not compile Mir client support. + -mirclient............ Compile Mir client support. + + -qpa <name> .......... Sets the default QPA platform (e.g xcb, cocoa, windows). + + -xplatform target .... The target platform when cross-compiling. + + -sysroot <dir> ....... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths. + -no-gcc-sysroot ...... When using -sysroot, it disables the passing of --sysroot to the compiler + + -external-hostbindir <path> .. Path to Qt tools built for this machine. Use this when -platform + does not match the current system, i.e., to make a Canadian Cross Build. + + -no-feature-<feature> Do not compile in <feature>. + -feature-<feature> ... Compile in <feature>. The available features + are described in src/corelib/global/qfeatures.txt + + -qreal [double|float] typedef qreal to the specified type. The default is double. + Note that changing this flag affects binary compatibility. + + -no-opengl ........... Do not support OpenGL. + -opengl <api> ........ Enable OpenGL support + With no parameter, this will attempt to auto-detect + OpenGL ES 2.0 and higher, or regular desktop OpenGL. + Use es2 for <api> to override auto-detection. + + -no-libinput ......... Do not support libinput. + * -libinput ............ Enable libinput support. + + -no-gstreamer ........ Do not support GStreamer. + + -gstreamer <version> . Enable GStreamer support + With no parameter, this will attempt to auto-detect GStreamer 0.10 and + 1.0. GStreamer 1.0 is used by default when available. + Use 0.10 or 1.0 for <version> to override auto-detection. + + * -no-system-proxies ... Do not use system network proxies by default. + -system-proxies ...... Use system network proxies by default. + + -no-warnings-are-errors Make warnings be treated normally + -warnings-are-errors Make warnings be treated as errors + (enabled if -developer-build is active) + +QNX options: + + -no-slog2 ........... Do not compile with slog2 support. + -slog2 .............. Compile with slog2 support. + + -no-pps ............. Do not compile with pps support. + -pps ................ Compile with pps support. + + -no-imf ............. Do not compile with imf support. + -imf ................ Compile with imf support. + + -no-lgmon ........... Do not compile with lgmon support. + -lgmon .............. Compile with lgmon support. + +Apple platform options: + + -Fstring ............ Add an explicit framework path. + -fw string .......... Add an explicit framework. + + * -framework .......... Build Qt as a series of frameworks and + link tools against those frameworks. + -no-framework ....... Do not build Qt as a series of frameworks. + + * -securetransport .... Use SecureTransport instead of OpenSSL + + -no-securetransport . Do not use SecureTransport, either use OpenSSL or do not use any SSL backend + at all (if combined with -no-openssl). + + -sdk <sdk> .......... Build Qt using Apple provided SDK <sdk>. The argument should be + one of the available SDKs as listed by 'xcodebuild -showsdks'. + Note that the argument applies only to Qt libraries and applications built + using the target mkspec - not host tools such as qmake, moc, rcc, etc. + +Android options: + + -android-sdk path .............. The Android SDK root path. + (default $ANDROID_SDK_ROOT) + + -android-ndk path .............. The Android NDK root path. + (default $ANDROID_NDK_ROOT) + + -android-ndk-platform .......... Sets the android platform + + -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) + (default $ANDROID_NDK_HOST) + + -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips, + arm64-v8a, x86_64, mips64) + + -android-toolchain-version ..... Sets the android toolchain version + + -no-android-style-assets ....... Do not compile in the code which automatically extracts + style assets from the run-time device. Setting this will + make the Android style behave incorrectly, but will enable + compatibility with the LGPL2.1 license. + * -android-style-assets .......... Compile the code which automatically extracts style assets + from the run-time device. This option will make the + Android platform plugin incompatible with the LGPL2.1. @@ -610,7 +610,6 @@ CFG_PROFILE=no CFG_STRIP=yes CFG_GUI=auto # (yes|no|auto) CFG_WIDGETS=yes -CFG_QCONFIG=full CFG_DEBUG=auto CFG_MYSQL_CONFIG= CFG_PSQL_CONFIG= @@ -619,28 +618,18 @@ CFG_FORCEDEBUGINFO=no CFG_RELEASE_TOOLS=no CFG_SHARED=yes CFG_SM=auto -CFG_XSHAPE=auto -CFG_XSYNC=auto -CFG_XFIXES=runtime -CFG_ZLIB=auto +CFG_SYSTEM_ZLIB=auto CFG_MTDEV=auto CFG_JOURNALD=no CFG_SYSLOG=no CFG_SQLITE=qt -CFG_GIF=auto +CFG_GIF=yes CFG_PNG=yes CFG_LIBPNG=auto -CFG_JPEG=auto +CFG_JPEG=yes CFG_LIBJPEG=auto -CFG_XCURSOR=runtime -CFG_XRANDR=runtime CFG_XRENDER=auto -CFG_MITSHM=auto CFG_OPENGL=auto -CFG_OPENVG=auto -CFG_OPENVG_LC_INCLUDES=no -CFG_OPENVG_SHIVA=auto -CFG_OPENVG_ON_OPENGL=auto CFG_EGL=auto CFG_EGL_X=auto CFG_DOUBLECONVERSION=auto @@ -666,7 +655,7 @@ CFG_SYSTEM_PROXIES=no CFG_ANDROID_STYLE_ASSETS=yes CFG_GSTREAMER=auto CFG_GSTREAMER_VERSION="" -CFG_ATOMIC64=auto +CFG_STD_ATOMIC64=auto # Target architecture CFG_ARCH= @@ -674,8 +663,6 @@ CFG_CPUFEATURES= # Host architecture, same as CFG_ARCH when not cross-compiling CFG_HOST_ARCH= CFG_HOST_CPUFEATURES= -# Set when the -arch or -host-arch arguments are used -OPT_OBSOLETE_HOST_ARG=no CFG_USE_GNUMAKE=no CFG_XINPUT2=auto @@ -700,7 +687,6 @@ CFG_KMS=auto CFG_MIRCLIENT=auto CFG_LIBUDEV=auto CFG_LIBINPUT=auto -CFG_OBSOLETE_WAYLAND=no CFG_EVDEV=auto CFG_TSLIB=auto CFG_NIS=auto @@ -709,7 +695,7 @@ CFG_ICONV=auto CFG_DBUS=auto CFG_GLIB=auto CFG_GTK=auto -CFG_LARGEFILE=auto +CFG_LARGEFILE=yes CFG_OPENSSL=auto CFG_LIBPROXY=auto CFG_SECURETRANSPORT=auto @@ -780,7 +766,6 @@ CFG_SANITIZE_THREAD=no CFG_SANITIZE_MEMORY=no CFG_SANITIZE_UNDEFINED=no CFG_PCRE=auto -QPA_PLATFORM_GUARD=yes CFG_STDCXX=auto CFG_DIRECTWRITE=no CFG_DIRECTWRITE2=auto @@ -789,7 +774,6 @@ CFG_HEADERSCLEAN=auto CFG_QREAL=double OPT_MAC_SDK= COMMERCIAL_USER=ask -LICENSE_FILE= CFG_DEV=no # initalize variables used for installation @@ -817,23 +801,23 @@ QT_HOST_DATA= QT_EXT_PREFIX= #flags for SQL drivers -QT_CFLAGS_PSQL= -QT_LFLAGS_PSQL= -QT_CFLAGS_MYSQL= -QT_LFLAGS_MYSQL= -QT_LFLAGS_MYSQL_R= -QT_CFLAGS_SQLITE= -QT_LFLAGS_SQLITE= -QT_LFLAGS_ODBC="-lodbc" -QT_LFLAGS_TDS= +QMAKE_CFLAGS_PSQL= +QMAKE_LIBS_PSQL= +QMAKE_CFLAGS_MYSQL= +QMAKE_LIBS_MYSQL= +QMAKE_LIBS_MYSQL_R= +QMAKE_CFLAGS_SQLITE= +QMAKE_LIBS_SQLITE= +QMAKE_LIBS_ODBC="-lodbc" +QMAKE_LIBS_TDS= # flags for libdbus-1 -QT_CFLAGS_DBUS= -QT_LIBS_DBUS= +QMAKE_CFLAGS_DBUS= +QMAKE_LIBS_DBUS= # flags for Glib (X11 only) -QT_CFLAGS_GLIB= -QT_LIBS_GLIB= +QMAKE_CFLAGS_GLIB= +QMAKE_LIBS_GLIB= # default qpa platform QT_QPA_DEFAULT_PLATFORM= @@ -850,11 +834,6 @@ CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST # check SQL drivers available in this package #------------------------------------------------------------------------------- -# opensource version removes some drivers, so force them to be off -CFG_SQL_tds=no -CFG_SQL_oci=no -CFG_SQL_db2=no - CFG_SQL_AVAILABLE= if [ -d "$relpath/src/plugins/sqldrivers" ]; then for a in "$relpath/src/plugins/sqldrivers/"*; do @@ -866,16 +845,6 @@ if [ -d "$relpath/src/plugins/sqldrivers" ]; then done fi -CFG_IMAGEFORMAT_PLUGIN_AVAILABLE= -if [ -d "$relpath/src/plugins/imageformats" ]; then - for a in "$relpath/src/plugins/imageformats/"*; do - if [ -d "$a" ]; then - base_a=`basename "$a"` - CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}" - fi - done -fi - #------------------------------------------------------------------------------- # parse command line arguments #------------------------------------------------------------------------------- @@ -1001,16 +970,6 @@ while [ "$#" -gt 0 ]; do VAL=$1 fi ;; - -openvg) - VAR=openvg - # this option may or may not be followed by an argument - if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then - VAL=yes - else - shift; - VAL=$1 - fi - ;; -gstreamer) VAR=gstreamer # this option may or may not be followed by an argument @@ -1050,16 +1009,6 @@ while [ "$#" -gt 0 ]; do VAL=`echo $1 | sed 's,-D,,'` fi ;; - -fpu) - VAR="fpu" - # this option may or may not be followed by an argument - if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then - VAL=no - else - shift - VAL=$1 - fi - ;; -I?*|-I) VAR="add_ipath" if [ "$1" = "-I" ]; then @@ -1136,9 +1085,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - license) - LICENSE_FILE="$VAL" - ;; gnumake) CFG_USE_GNUMAKE="$VAL" ;; @@ -1218,9 +1164,6 @@ while [ "$#" -gt 0 ]; do testsdir) QT_INSTALL_TESTS="$VAL" ;; - qconfig) - CFG_QCONFIG="$VAL" - ;; qreal) CFG_QREAL="$VAL" if [ "$CFG_QREAL" = "float" ]; then @@ -1285,13 +1228,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - openvg) - if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_OPENVG="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; nomake) if [ -n "${QT_ALL_BUILD_PARTS%%* $VAL *}" ]; then echo "Unknown part $VAL passed to -nomake." >&2 @@ -1333,9 +1269,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - arch|host-arch) - OPT_OBSOLETE_HOST_ARG=yes - ;; harfbuzz) [ "$VAL" = "yes" ] && VAL=qt if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then @@ -1382,48 +1315,6 @@ while [ "$#" -gt 0 ]; do ;; platform) PLATFORM="$VAL" - # keep compatibility with old platform names - case $PLATFORM in - aix-64) - PLATFORM=aix-xlc-64 - ;; - hpux-o64) - PLATFORM=hpux-acc-o64 - ;; - hpux-n64) - PLATFORM=hpux-acc-64 - ;; - hpux-acc-n64) - PLATFORM=hpux-acc-64 - ;; - irix-n32) - PLATFORM=irix-cc - ;; - irix-64) - PLATFORM=irix-cc-64 - ;; - irix-cc-n64) - PLATFORM=irix-cc-64 - ;; - reliant-64) - PLATFORM=reliant-cds-64 - ;; - solaris-64) - PLATFORM=solaris-cc-64 - ;; - openunix-cc) - PLATFORM=unixware-cc - ;; - openunix-g++) - PLATFORM=unixware-g++ - ;; - unixware7-cc) - PLATFORM=unixware-cc - ;; - unixware7-g++) - PLATFORM=unixware-g++ - ;; - esac ;; xplatform) XPLATFORM="$VAL" @@ -1543,20 +1434,6 @@ while [ "$#" -gt 0 ]; do fi ;; - xshape) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_XSHAPE="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; - xsync) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_XSYNC="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; xinput2) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_XINPUT2="$VAL" @@ -1685,14 +1562,13 @@ while [ "$#" -gt 0 ]; do fi ;; zlib) - [ "$VAL" = "qt" ] && VAL=yes - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then - CFG_ZLIB="$VAL" + if [ "$VAL" = "system" ]; then + CFG_SYSTEM_ZLIB="yes" + elif [ "$VAL" = "qt" ]; then + CFG_SYSTEM_ZLIB="no" else UNKNOWN_OPT=yes fi - # No longer supported: - #[ "$VAL" = "no" ] && CFG_LIBPNG=no ;; mtdev) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then @@ -1738,27 +1614,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - xcursor) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then - CFG_XCURSOR="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; - xfixes) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then - CFG_XFIXES="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; - xrandr) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then - CFG_XRANDR="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; xrender) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_XRENDER="$VAL" @@ -1766,13 +1621,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - mitshm) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_MITSHM="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; doubleconversion) if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then CFG_DOUBLECONVERSION="$VAL" @@ -1833,9 +1681,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - wayland) - CFG_OBSOLETE_WAYLAND=yes - ;; eglfs) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_EGLFS="$VAL" @@ -2007,7 +1852,7 @@ while [ "$#" -gt 0 ]; do ;; qpa-platform-guard) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - QPA_PLATFORM_GUARD="$VAL" + echo "WARNING: The [-no]-qpa-platform-guard argument is deprecated and has no effect." else UNKNOWN_OPT=yes fi @@ -2043,13 +1888,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - largefile) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_LARGEFILE="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; openssl) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_OPENSSL="$VAL" @@ -2103,12 +1941,11 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - sql-*|imageformat-*) - # if Qt style options were used, $VAL can be "no", "qt", or "plugin" - # if autoconf style options were used, $VAL can be "yes" or "no" - [ "$VAL" = "yes" ] && VAL=qt - # now $VAL should be "no", "qt", or "plugin"... double-check - if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then + sql-*) + # if Qt style options were used, $VAL can be "no", "yes", or "plugin", plugin for backwards compatibility + [ "$VAL" = "plugin" ] && VAL=yes + # now $VAL should be "yes" or "no"... double-check + if [ "$VAL" != "no" ] && [ "$VAL" != "yes" ]; then UNKNOWN_OPT=yes fi # now $VAL is "no", "qt", or "plugin" @@ -2116,27 +1953,9 @@ while [ "$#" -gt 0 ]; do VAL=`echo $VAR | sed 's,^[^-]*-\([^-]*\).*,\1,'` VAR=`echo $VAR | sed 's,^\([^-]*\).*,\1,'` - # Grab the available values - case "$VAR" in - sql) - avail="$CFG_SQL_AVAILABLE" - ;; - imageformat) - avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE" - if [ "$OPT" != "plugin" ]; then - # png is always built in - avail="$avail png" - fi - ;; - *) - avail="" - echo "BUG: Unhandled type $VAR used in $CURRENT_OPT" - ;; - esac - # Check that that user's value is available. found=no - for d in $avail; do + for d in $CFG_SQL_AVAILABLE; do if [ "$VAL" = "$d" ]; then found=yes break @@ -2148,28 +1967,8 @@ while [ "$#" -gt 0 ]; do continue fi - if [ "$VAR" = "sql" ]; then - # set the CFG_SQL_driver - eval "CFG_SQL_$VAL=\$OPT" - continue - elif [ "$VAR" = "imageformat" ]; then - [ "$OPT" = "qt" ] && OPT=yes - VAL="`echo $VAL |tr a-z A-Z`" - eval "CFG_$VAL=$OPT" - continue - fi - - if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then - if [ "$OPT" = "plugin" ]; then - VAR="${VAR}-${OPT}" - fi - QMakeVar add "${VAR}s" "${VAL}" - elif [ "$OPT" = "no" ]; then - PLUG_VAR="${VAR}-plugin" - IN_VAR="${VAR}" - QMakeVar del "${IN_VAR}s" "$VAL" - QMakeVar del "${PLUG_VAR}s" "$VAL" - fi + # set the CFG_SQL_driver + eval "CFG_SQL_$VAL=\$OPT" ;; v|verbose) if [ "$VAL" = "yes" ]; then @@ -2372,456 +2171,9 @@ done #------------------------------------------------------------------------------- if [ "$OPT_HELP" = "yes" ]; then - cat <<EOF -Usage: $relconf [options] - -Installation options: - - These are optional, but you may specify install directories. - - -prefix <dir> ...... The deployment directory, as seen on the target device. - (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active) - - -extprefix <dir> ... The installation directory, as seen on the host machine. - (default SYSROOT/PREFIX) - - -hostprefix [dir] .. The installation directory for build tools running on the - host machine. If [dir] is not given, the current build - directory will be used. (default EXTPREFIX) - - You may use these to change the layout of the install. Note that all directories - except -sysconfdir should be located under -prefix/-hostprefix: - - -bindir <dir> ......... User executables will be installed to <dir> - (default PREFIX/bin) - -headerdir <dir> ...... Headers will be installed to <dir> - (default PREFIX/include) - -libdir <dir> ......... Libraries will be installed to <dir> - (default PREFIX/lib) - -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir> - (default PREFIX) - -plugindir <dir> ...... Plugins will be installed to <dir> - (default ARCHDATADIR/plugins) - -libexecdir <dir> ..... Program executables will be installed to <dir> - (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) - -importdir <dir> ...... Imports for QML1 will be installed to <dir> - (default ARCHDATADIR/imports) - -qmldir <dir> ......... Imports for QML2 will be installed to <dir> - (default ARCHDATADIR/qml) - -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir> - (default PREFIX) - -docdir <dir> ......... Documentation will be installed to <dir> - (default DATADIR/doc) - -translationdir <dir> . Translations of Qt programs will be installed to <dir> - (default DATADIR/translations) - -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir> - (default PREFIX/etc/xdg) - -examplesdir <dir> .... Examples will be installed to <dir> - (default PREFIX/examples) - -testsdir <dir> ....... Tests will be installed to <dir> - (default PREFIX/tests) - - -hostbindir <dir> .. Host executables will be installed to <dir> - (default HOSTPREFIX/bin) - -hostlibdir <dir> .. Host libraries will be installed to <dir> - (default HOSTPREFIX/lib) - -hostdatadir <dir> . Data used by qmake will be installed to <dir> - (default HOSTPREFIX) - -Configure options: - - The defaults (*) are usually acceptable. A plus (+) denotes a default value - that needs to be evaluated. If the evaluation succeeds, the feature is - included. Here is a short explanation of each option: - - * -release ........... Compile and link Qt with debugging turned off. - -debug ............. Compile and link Qt with debugging turned on. - -debug-and-release . Compile and link two versions of Qt, with and without - debugging turned on (Mac only). - - -force-debug-info .. Create symbol files for release builds. - - -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) - - * -no-optimized-tools ... Do not build optimized host tools even in debug build. - -optimized-tools ...... Build optimized host tools even in debug build. - - -opensource ........ Compile and link the Open-Source Edition of Qt. - -commercial ........ Compile and link the Commercial Edition of Qt. - - -confirm-license ... Automatically acknowledge the license (use with - either -opensource or -commercial) - - -c++std <edition> .. Compile Qt with C++ standard edition (c++11, c++14, c++1z) - Default: highest supported - - * -shared ............ Create and use shared Qt libraries. - -static ............ Create and use static Qt libraries. - - -no-largefile ...... Disables large file support. - + -largefile ......... Enables Qt to access files larger than 4 GB. - - -no-accessibility .. Do not compile Accessibility support. - Disabling accessibility is not recommended, as it will break QStyle - and may break other internal parts of Qt. - With this switch you create a source incompatible version of Qt, - which is unsupported. - + -accessibility ..... Compile Accessibility support. - - -no-sql-<driver> ... Disable SQL <driver> entirely. - -qt-sql-<driver> ... Enable a SQL <driver> in the Qt SQL module, by default - none are turned on. - -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to - at run time. - - Possible values for <driver>: - [$CFG_SQL_AVAILABLE ] - - -system-sqlite ..... Use sqlite from the operating system. - - -no-qml-debug ...... Do not build the in-process QML debugging support. - + -qml-debug ......... Build the QML debugging support. - - -platform target ... The operating system and compiler you are building - on (default detected from host system). - - See the README file for a list of supported - operating systems and compilers. - - -no-sse2 ........... Do not compile with use of SSE2 instructions. - -no-sse3 ........... Do not compile with use of SSE3 instructions. - -no-ssse3 .......... Do not compile with use of SSSE3 instructions. - -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions. - -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. - -no-avx ............ Do not compile with use of AVX instructions. - -no-avx2 ........... Do not compile with use of AVX2 instructions. - -no-avx512 ......... Do not compile with use of AVX512 instructions. - -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions. - -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions. - - -qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'. - -qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so. - - -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool. - -gcov .............. Instrument Qt with the GCov code coverage tool. - - -D <string> ........ Add an explicit define to the preprocessor. - -I <string> ........ Add an explicit include path. - -L <string> ........ Add an explicit library path. - - + -pkg-config ........ Use pkg-config to detect include and library paths. By default, - configure determines whether to use pkg-config or not with - some heuristics such as checking the environment variables. - -no-pkg-config ..... Disable use of pkg-config. - -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability - detection heuristic). - - -help, -h .......... Display this information. - -Third Party Libraries: - - -qt-zlib ............ Use the zlib bundled with Qt. - + -system-zlib ........ Use zlib from the operating system. - See http://www.gzip.org/zlib - - -no-mtdev ........... Do not compile mtdev support. - + -mtdev .............. Enable mtdev support. - - + -no-journald ........ Do not send logging output to journald. - -journald ........... Send logging output to journald. - - + -no-syslog .......... Do not send logging output to syslog. - -syslog ............. Send logging output to syslog. - - -no-gif ............. Do not compile GIF reading support. - - -no-libpng .......... Do not compile PNG support. - -qt-libpng .......... Use the libpng bundled with Qt. - + -system-libpng ...... Use libpng from the operating system. - See http://www.libpng.org/pub/png - - -no-libjpeg ......... Do not compile JPEG support. - -qt-libjpeg ......... Use the libjpeg bundled with Qt. - + -system-libjpeg ..... Use libjpeg from the operating system. - See http://www.ijg.org - - -no-doubleconversion ..... Use sscanf_l and snprintf_l for (imprecise) double conversion. - -qt-doubleconversion ..... Use the libdouble-conversion bundled with Qt. - + -system-doubleconversion . Use the libdouble-conversion provided by the system. - See https://github.com/google/double-conversion - - -no-freetype ........ Do not compile in Freetype2 support. - -qt-freetype ........ Use the libfreetype bundled with Qt. - + -system-freetype..... Use the libfreetype provided by the system (enabled if -fontconfig is active). - See http://www.freetype.org - - -no-harfbuzz ........ Do not compile HarfBuzz-NG support. - -qt-harfbuzz ........ Use HarfBuzz-NG bundled with Qt to do text shaping. - It can still be disabled by setting - the QT_HARFBUZZ environment variable to "old". - + -system-harfbuzz .... Use HarfBuzz-NG from the operating system - to do text shaping. It can still be disabled - by setting the QT_HARFBUZZ environment variable to "old". - See http://www.harfbuzz.org - - -no-openssl ......... Do not compile support for OpenSSL. - + -openssl ............ Enable run-time OpenSSL support. - -openssl-linked ..... Enabled linked OpenSSL support. - - -no-libproxy ....... Do not compile support for libproxy - + -libproxy .......... Use libproxy from the operating system. - - -qt-pcre ............ Use the PCRE library bundled with Qt. - + -system-pcre ........ Use the PCRE library from the operating system. - - -qt-xcb ............. Use xcb- libraries bundled with Qt. - (libxcb.so will still be used from operating system). - + -system-xcb ......... Use xcb- libraries from the operating system. - - -xkb-config-root .... Set default XKB config root. This option is used only together with -qt-xkbcommon-x11. - -qt-xkbcommon-x11 ... Use the xkbcommon library bundled with Qt in combination with xcb. - + -system-xkbcommon-x11 Use the xkbcommon library from the operating system in combination with xcb. - - -no-xkbcommon-evdev . Do not use X-less xkbcommon when compiling libinput support. - * -xkbcommon-evdev .... Use X-less xkbcommon when compiling libinput support. - - -no-xinput2 ......... Do not compile XInput2 support. - * -xinput2 ............ Compile XInput2 support. - - -no-xcb-xlib......... Do not compile Xcb-Xlib support. - * -xcb-xlib............ Compile Xcb-Xlib support. - - -no-glib ............ Do not compile Glib support. - + -glib ............... Compile Glib support. - - -no-pulseaudio ...... Do not compile PulseAudio support. - + -pulseaudio ......... Compile PulseAudio support. - - -no-alsa ............ Do not compile ALSA support. - + -alsa ............... Compile ALSA support. - - -no-gtk ............. Do not compile GTK platform theme support. - + -gtk ................ Compile GTK platform theme support. - -Additional options: - - -make <part> ....... Add part to the list of parts to be built at make time. - (defaults to: $QT_DEFAULT_BUILD_PARTS) - -nomake <part> ..... Exclude part from the list of parts to be built. - - -skip <module> ..... Exclude an entire module from the build. - - -no-compile-examples ... Install only the sources of examples. - - -no-gui ............ Don't build the Qt GUI module and dependencies. - + -gui ............... Build the Qt GUI module and dependencies. - - -no-widgets ........ Don't build the Qt Widgets module and dependencies. - + -widgets ........... Build the Qt Widgets module and dependencies. - - -R <string> ........ Add an explicit runtime library path to the Qt - libraries. - -l <string> ........ Add an explicit library. - - -no-rpath .......... Do not use the library install path as a runtime - library path. On Apple platforms, this implies using - absolute install names (based in -libdir) for dynamic - libraries and frameworks. - + -rpath ............. Link Qt libraries and executables using the library - install path as a runtime library path. Equivalent - to -R install_libpath - - -continue .......... Continue as far as possible if an error occurs. - - -verbose, -v ....... Print verbose information about each step of the - configure process. - - -silent ............ Reduce the build output so that warnings and errors - can be seen more easily. - - -no-nis ............ Do not compile NIS support. - * -nis ............... Compile NIS support. - - -no-cups ........... Do not compile CUPS support. - * -cups .............. Compile CUPS support. - Requires cups/cups.h and libcups.so.2. - - -no-iconv .......... Do not compile support for iconv(3). - * -iconv ............. Compile support for iconv(3). - - -no-evdev .......... Do not compile support for evdev. - * -evdev ............. Compile support for evdev. - - -no-tslib .......... Do not compile support for tslib. - * -tslib ............. Compile support for tslib. - - -no-icu ............ Do not compile support for ICU libraries. - + -icu ............... Compile support for ICU libraries. - - -no-fontconfig ..... Do not compile FontConfig support. - + -fontconfig ........ Compile FontConfig support. - - -no-strip .......... Do not strip binaries and libraries of unneeded symbols. - * -strip ............. Strip binaries and libraries of unneeded symbols when installing. - - * -no-pch ............ Do not use precompiled header support. - -pch ............... Use precompiled header support. - - * -no-ltcg Do not use Link Time Code Generation - -ltcg Use Link Time Code Generation. - - -no-dbus ........... Do not compile the Qt D-Bus module. - + -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1. - -dbus-runtime ...... Compile the Qt D-Bus module and dynamically load libdbus-1. - - -reduce-relocations ..... Reduce relocations in the libraries through extra - linker optimizations (Qt/X11 and Qt for Embedded Linux only; - experimental; needs GNU ld >= 2.18). - - -no-use-gold-linker ..... Do not link using the GNU gold linker. - + -use-gold-linker ........ Link using the GNU gold linker if available. - - -force-asserts ........ Force Q_ASSERT to be enabled even in release builds. - - -sanitize [address|thread|memory|undefined] Enables the specified compiler sanitizer. - - -device <name> ............... Cross-compile for device <name> (experimental) - -device-option <key=value> ... Add device specific options for the device mkspec - (experimental) - - -host-option <key=value> ..... Add host specific options for the host mkspec - - * -no-separate-debug-info . Do not store debug information in a separate file. - -separate-debug-info .... Strip debug information into a separate file. - - -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. - * -xcb ............... Compile Xcb support. - - -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. - * -eglfs ............. Compile EGLFS support. - - -no-kms ............ Do not compile backends for KMS. - * -kms ............... Compile backends for KMS. - - -no-gbm ............ Do not compile backends for GBM. - * -gbm ............... Compile backends for GBM. - - -no-directfb ....... Do not compile DirectFB support. - * -directfb .......... Compile DirectFB support. - - -no-linuxfb ........ Do not compile Linux Framebuffer support. - * -linuxfb ........... Compile Linux Framebuffer support. - - * -no-mirclient....... Do not compile Mir client support. - -mirclient.......... Compile Mir client support. - - -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows). - - -xplatform target ... The target platform when cross-compiling. - - -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths. - -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler - - -external-hostbindir <path> .. Path to Qt tools built for this machine. Use this when -platform - does not match the current system, i.e., to make a Canadian Cross Build. - - -no-feature-<feature> Do not compile in <feature>. - -feature-<feature> .. Compile in <feature>. The available features - are described in src/corelib/global/qfeatures.txt - - -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the - default ($CFG_QCONFIG). - - -qreal [double|float] typedef qreal to the specified type. The default is double. - Note that changing this flag affects binary compatibility. - - -no-opengl .......... Do not support OpenGL. - -opengl <api> ....... Enable OpenGL support - With no parameter, this will attempt to auto-detect - OpenGL ES 2.0 and higher, or regular desktop OpenGL. - Use es2 for <api> to override auto-detection. - - -no-libinput ........ Do not support libinput. - * -libinput ........... Enable libinput support. - - -no-gstreamer ....... Do not support GStreamer. - + -gstreamer <version> Enable GStreamer support - With no parameter, this will attempt to auto-detect GStreamer 0.10 and - 1.0. GStreamer 1.0 is used by default when available. - Use 0.10 or 1.0 for <version> to override auto-detection. - - * -no-system-proxies .. Do not use system network proxies by default. - -system-proxies ..... Use system network proxies by default. - - -no-warnings-are-errors Make warnings be treated normally - -warnings-are-errors Make warnings be treated as errors - (enabled if -developer-build is active) - -QNX options: - - -no-slog2 .......... Do not compile with slog2 support. - -slog2 ............. Compile with slog2 support. - - -no-pps ............ Do not compile with pps support. - -pps ............... Compile with pps support. - - -no-imf ............ Do not compile with imf support. - -imf ............... Compile with imf support. - - -no-lgmon .......... Do not compile with lgmon support. - -lgmon ............. Compile with lgmon support. - -MacOS/iOS options: - - -Fstring ........... Add an explicit framework path. - -fw string ......... Add an explicit framework. - - * -framework ......... Build Qt as a series of frameworks and - link tools against those frameworks. - -no-framework ...... Do not build Qt as a series of frameworks. - - * -securetransport ... Use SecureTransport instead of OpenSSL - - -no-securetransport Do not use SecureTransport, either use OpenSSL or do not use any SSL backend - at all (if combined with -no-openssl). - - -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be - one of the available SDKs as listed by 'xcodebuild -showsdks'. - Note that the argument applies only to Qt libraries and applications built - using the target mkspec - not host tools such as qmake, moc, rcc, etc. - -Android options: - - -android-sdk path .............. The Android SDK root path. - (default \$ANDROID_SDK_ROOT) - - -android-ndk path .............. The Android NDK root path. - (default \$ANDROID_NDK_ROOT) - - -android-ndk-platform .......... Sets the android platform - (default $CFG_DEFAULT_ANDROID_PLATFORM) - - -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) - (default \$ANDROID_NDK_HOST) - - -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips, - arm64-v8a, x86_64, mips64) - (default $CFG_DEFAULT_ANDROID_TARGET_ARCH) - - -android-toolchain-version ..... Sets the android toolchain version - (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION) - - -no-android-style-assets ....... Do not compile in the code which automatically extracts - style assets from the run-time device. Setting this will - make the Android style behave incorrectly, but will enable - compatibility with the LGPL2.1 license. - * -android-style-assets .......... Compile the code which automatically extracts style assets - from the run-time device. This option will make the - Android platform plugin incompatible with the LGPL2.1. -EOF - - exit 0 -fi # Help + cat $relpath/config_help.txt + exit 0 +fi #------------------------------------------------------------------------------- # platform detection @@ -2831,27 +2183,7 @@ if [ -z "$PLATFORM" ]; then PLATFORM_NOTES= case "$UNAME_SYSTEM:$UNAME_RELEASE" in Darwin:*) - # Select compiler. Use g++ unless we find a usable Clang version. Note that - # we are checking the "Apple" clang/LLVM version number, not the actual - # clang/LLVM version number that the Apple version was based on. We look - # for Apple clang version 3.0 or higher, which was branched off LLVM 3.0 - # from SVN, and first included in Xcode 4.2. Also note that we do not care - # about the OS version, since we're not using the clang version that comes - # with the system. We use 'xcrun' to check the clang version that's part of - # the Xcode installation. - XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1` - CLANGVERSION=`echo "$XCRUN" | sed -n 's/.*version \([0-9]\).*/\1/p'` - expr "$CLANGVERSION" : '[0-9]' > /dev/null || { echo "Unable to determine CLANG version from output of xcrun: $XCRUN" ; exit 2 ; } - if [ "$CLANGVERSION" -ge 3 ]; then - PLATFORM=macx-clang - - # Advertise g++ as an alternative on Lion and below - if [ "$(uname -r | cut -d. -f1)" -le 11 ]; then - PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n" - fi - else - PLATFORM=macx-g++ - fi + PLATFORM=macx-clang ;; AIX:*) #PLATFORM=aix-g++ @@ -3186,31 +2518,6 @@ fi # command line and environment validation #------------------------------------------------------------------------------- -# update QT_CONFIG to show our current predefined configuration -CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h -case "$CFG_QCONFIG" in -minimal|small|medium|large|full) - # these are a sequence of increasing functionality - for c in minimal small medium large full; do - QT_CONFIG="$QT_CONFIG $c-config" - [ "$CFG_QCONFIG" = $c ] && break - done - [ "$CFG_QCONFIG" = full ] && CFG_QCONFIG_PATH= - ;; -*) - # not known to be sufficient for anything - if [ ! -f "$CFG_QCONFIG_PATH" ]; then - CFG_QCONFIG_PATH=`makeabs "${CFG_QCONFIG}"` - if [ ! -f "$CFG_QCONFIG_PATH" ]; then - echo >&2 "Error: configuration file not found:" - echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" - echo >&2 " or" - echo >&2 " $CFG_QCONFIG_PATH" - exit 1 - fi - fi -esac - if [ "$XPLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then echo echo "WARNING: -debug-and-release is not supported outside of Mac OS X." @@ -4453,28 +3760,13 @@ if $stdcxx_error && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then exit 101 fi -# Detect which edition of the C++ standard the compiler defaults to -CFG_STDCXX_DEFAULT=199711 -if compileTest common/c++default "default C++ standard edition"; then - if [ -e "$outpath/config.tests/common/c++default/c++default.ii" ]; then - CFG_STDCXX_DEFAULT=`sed -n '/^[0-9]/s/L//p' "$outpath/config.tests/common/c++default/c++default.ii"` - else - if [ "$OPT_VERBOSE" = "yes" ]; then - echo "Failed to run the preprocessor, something is wrong with your compiler" - fi - if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - exit 101 - fi - fi -fi - # Detect whether 64-bit std::atomic works -- some 32-bit platforms require extra library support if compileTest common/atomic64 "64-bit std::atomic"; then - CFG_ATOMIC64=yes + CFG_STD_ATOMIC64=yes elif compileTest common/atomic64 "64-bit std::atomic in -latomic" -latomic; then - CFG_ATOMIC64=libatomic + CFG_STD_ATOMIC64=libatomic else - CFG_ATOMIC64=no + CFG_STD_ATOMIC64=no fi # detect sse2 support @@ -4664,21 +3956,6 @@ if ! compileTest unix/ipc_sysv "ipc_sysv" ; then fi fi -# detect zlib -if [ "$CFG_ZLIB" = "no" ]; then - # Note: Qt no longer support builds without zlib - # So we force a "no" to be "auto" here. - # If you REALLY really need no zlib support, you can still disable - # it by doing the following: - # add "no-zlib" to mkspecs/qconfig.pri - # #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h) - # - # There's no guarantee that Qt will build under those conditions - - CFG_ZLIB=auto - ZLIB_FORCED=yes -fi - if [ "$XPLATFORM_QNX" = "yes" ]; then if [ "$CFG_SLOG2" != "no" ]; then if compileTest unix/slog2 "slog2"; then @@ -4721,11 +3998,12 @@ if [ "$XPLATFORM_INTEGRITY" = "yes" ]; then CFG_LARGEFILE=no fi -if [ "$CFG_ZLIB" = "auto" ]; then +# detect zlib +if [ "$CFG_SYSTEM_ZLIB" = "auto" ]; then if compileTest unix/zlib "zlib"; then - CFG_ZLIB=system + CFG_SYSTEM_ZLIB=yes else - CFG_ZLIB=yes + CFG_SYSTEM_ZLIB=no fi fi @@ -4774,23 +4052,6 @@ if [ "$CFG_SYSLOG" != "no" ]; then fi fi -if [ "$CFG_LARGEFILE" = "auto" ]; then - #Large files should be enabled for all Linux systems - CFG_LARGEFILE=yes -fi - -if [ "$CFG_GUI" = "no" ]; then - QPA_PLATFORM_GUARD=no -fi - -# detect how jpeg should be built -if [ "$CFG_JPEG" = "auto" ]; then - if [ "$CFG_SHARED" = "yes" ]; then - CFG_JPEG=plugin - else - CFG_JPEG=yes - fi -fi # detect jpeg if [ "$CFG_LIBJPEG" = "auto" ]; then if compileTest unix/libjpeg "libjpeg"; then @@ -4800,15 +4061,6 @@ if [ "$CFG_LIBJPEG" = "auto" ]; then fi fi -# detect how gif should be built -if [ "$CFG_GIF" = "auto" ]; then - if [ "$CFG_SHARED" = "yes" ]; then - CFG_GIF=plugin - else - CFG_GIF=yes - fi -fi - # detect png if [ "$CFG_LIBPNG" = "auto" ]; then if compileTest unix/libpng "libpng"; then @@ -4839,10 +4091,10 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do if [ "$CFG_SQL_mysql" != "no" ]; then [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config` if [ -x "$CFG_MYSQL_CONFIG" ]; then - QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null | filterIncludeOptions` + QMAKE_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null | filterIncludeOptions` # -rdynamic should not be returned by mysql_config, but is on RHEL 6.6 - QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"` - QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"` + QMAKE_LIBS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"` + QMAKE_LIBS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"` QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null` QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1` fi @@ -4855,21 +4107,17 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do exit 101 else CFG_SQL_mysql="no" - QT_LFLAGS_MYSQL="" - QT_LFLAGS_MYSQL_R="" - QT_CFLAGS_MYSQL="" + QMAKE_LIBS_MYSQL="" + QMAKE_LIBS_MYSQL_R="" + QMAKE_CFLAGS_MYSQL="" fi else - if compileTest unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $QT_CFLAGS_MYSQL; then + if compileTest unix/mysql_r "MySQL (thread-safe)" $QMAKE_LIBS_MYSQL_R $QMAKE_CFLAGS_MYSQL; then QMakeVar add CONFIG use_libmysqlclient_r - if [ "$CFG_SQL_mysql" = "auto" ]; then - CFG_SQL_mysql=plugin - fi - QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R" - elif compileTest unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $QT_CFLAGS_MYSQL; then - if [ "$CFG_SQL_mysql" = "auto" ]; then - CFG_SQL_mysql=plugin - fi + CFG_SQL_mysql=yes + QMAKE_LIBS_MYSQL="$QMAKE_LIBS_MYSQL_R" + elif compileTest unix/mysql "MySQL (thread-unsafe)" $QMAKE_LIBS_MYSQL $QMAKE_CFLAGS_MYSQL; then + CFG_SQL_mysql=yes else if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "MySQL support cannot be enabled due to functionality tests!" @@ -4879,9 +4127,9 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do exit 101 else CFG_SQL_mysql=no - QT_LFLAGS_MYSQL="" - QT_LFLAGS_MYSQL_R="" - QT_CFLAGS_MYSQL="" + QMAKE_LIBS_MYSQL="" + QMAKE_LIBS_MYSQL_R="" + QMAKE_CFLAGS_MYSQL="" fi fi fi @@ -4892,17 +4140,15 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do [ -z "$CFG_PSQL_CONFIG" ] && CFG_PSQL_CONFIG=`"$WHICH" pg_config` # Be careful not to use native pg_config when cross building. if [ "$XPLATFORM_MINGW" != "yes" ] && [ -x "$CFG_PSQL_CONFIG" ]; then - QT_CFLAGS_PSQL=`$CFG_PSQL_CONFIG --includedir 2>/dev/null | filterIncludePath` - QT_LFLAGS_PSQL=`$CFG_PSQL_CONFIG --libdir 2>/dev/null | filterLibraryPath` + QMAKE_CFLAGS_PSQL=`$CFG_PSQL_CONFIG --includedir 2>/dev/null | filterIncludePath` + QMAKE_LIBS_PSQL=`$CFG_PSQL_CONFIG --libdir 2>/dev/null | filterLibraryPath` fi - [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL" - [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL" + [ -z "$QMAKE_CFLAGS_PSQL" ] || QMAKE_CFLAGS_PSQL="-I$QMAKE_CFLAGS_PSQL" + [ -z "$QMAKE_LIBS_PSQL" ] || QMAKE_LIBS_PSQL="-L$QMAKE_LIBS_PSQL" # But, respect PSQL_LIBS if set - [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS" - if compileTest unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $QT_CFLAGS_PSQL; then - if [ "$CFG_SQL_psql" = "auto" ]; then - CFG_SQL_psql=plugin - fi + [ -z "$PSQL_LIBS" ] || QMAKE_LIBS_PSQL="$PSQL_LIBS" + if compileTest unix/psql "PostgreSQL" $QMAKE_LIBS_PSQL $QMAKE_CFLAGS_PSQL; then + CFG_SQL_psql=yes else if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "PostgreSQL support cannot be enabled due to functionality tests!" @@ -4912,8 +4158,8 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do exit 101 else CFG_SQL_psql=no - QT_CFLAGS_PSQL="" - QT_LFLAGS_PSQL="" + QMAKE_CFLAGS_PSQL="" + QMAKE_LIBS_PSQL="" fi fi fi @@ -4921,15 +4167,11 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do odbc) if [ "$CFG_SQL_odbc" != "no" ]; then if [ "$XPLATFORM_MAC" != "yes" ] && compileTest unix/odbc "ODBC"; then - if [ "$CFG_SQL_odbc" = "auto" ]; then - CFG_SQL_odbc=plugin - fi + CFG_SQL_odbc=yes else if compileTest unix/iodbc "iODBC"; then - QT_LFLAGS_ODBC="-liodbc" - if [ "$CFG_SQL_odbc" = "auto" ]; then - CFG_SQL_odbc=plugin - fi + QMAKE_LIBS_ODBC="-liodbc" + CFG_SQL_odbc=yes else if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "ODBC support cannot be enabled due to functionality tests!" @@ -4947,9 +4189,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do oci) if [ "$CFG_SQL_oci" != "no" ]; then if compileTest unix/oci "OCI"; then - if [ "$CFG_SQL_oci" = "auto" ]; then - CFG_SQL_oci=plugin - fi + CFG_SQL_oci=yes else if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "Oracle (OCI) support cannot be enabled due to functionality tests!" @@ -4965,12 +4205,10 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; tds) if [ "$CFG_SQL_tds" != "no" ]; then - [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib" - [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS" - if compileTest unix/tds "TDS" $QT_LFLAGS_TDS; then - if [ "$CFG_SQL_tds" = "auto" ]; then - CFG_SQL_tds=plugin - fi + [ -z "$SYBASE" ] || QMAKE_LIBS_TDS="-L$SYBASE/lib" + [ -z "$SYBASE_LIBS" ] || QMAKE_LIBS_TDS="$QMAKE_LIBS_TDS $SYBASE_LIBS" + if compileTest unix/tds "TDS" $QMAKE_LIBS_TDS; then + CFG_SQL_tds=yes else if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "TDS support cannot be enabled due to functionality tests!" @@ -4987,9 +4225,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do db2) if [ "$CFG_SQL_db2" != "no" ]; then if compileTest unix/db2 "DB2"; then - if [ "$CFG_SQL_db2" = "auto" ]; then - CFG_SQL_db2=plugin - fi + CFG_SQL_db2=yes else if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "ODBC support cannot be enabled due to functionality tests!" @@ -5006,9 +4242,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ibase) if [ "$CFG_SQL_ibase" != "no" ]; then if compileTest unix/ibase "InterBase"; then - if [ "$CFG_SQL_ibase" = "auto" ]; then - CFG_SQL_ibase=plugin - fi + CFG_SQL_ibase=yes else if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "InterBase support cannot be enabled due to functionality tests!" @@ -5025,9 +4259,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do sqlite2) if [ "$CFG_SQL_sqlite2" != "no" ]; then if compileTest unix/sqlite2 "SQLite2"; then - if [ "$CFG_SQL_sqlite2" = "auto" ]; then - CFG_SQL_sqlite2=plugin - fi + CFG_SQL_sqlite2=yes else if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "SQLite2 support cannot be enabled due to functionality tests!" @@ -5046,25 +4278,21 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do SQLITE_AUTODETECT_FAILED="no" if [ "$CFG_SQLITE" = "system" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists sqlite3 2>/dev/null; then - QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null` - QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null` + QMAKE_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null` + QMAKE_LIBS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null` else - QT_CFLAGS_SQLITE= - QT_LFLAGS_SQLITE="-lsqlite3 -lz" + QMAKE_CFLAGS_SQLITE= + QMAKE_LIBS_SQLITE="-lsqlite3 -lz" fi - if compileTest unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $QT_CFLAGS_SQLITE; then - if [ "$CFG_SQL_sqlite" = "auto" ]; then - CFG_SQL_sqlite=plugin - fi + if compileTest unix/sqlite "SQLite" $QMAKE_LIBS_SQLITE $QMAKE_CFLAGS_SQLITE; then + CFG_SQL_sqlite=yes QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite" else SQLITE_AUTODETECT_FAILED="yes" CFG_SQL_sqlite=no fi elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then - if [ "$CFG_SQL_sqlite" = "auto" ]; then - CFG_SQL_sqlite=plugin - fi + CFG_SQL_sqlite=yes else SQLITE_AUTODETECT_FAILED="yes" CFG_SQL_sqlite=no @@ -5150,20 +4378,20 @@ fi # runtime: no detection (cannot fail), load libdbus-1 at runtime if [ "$CFG_DBUS" = "auto" ] || [ "$CFG_DBUS" = "linked" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then - QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null` - QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null` + QMAKE_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null` + QMAKE_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null` else - QT_LIBS_DBUS="-ldbus-1" + QMAKE_LIBS_DBUS="-ldbus-1" fi - if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then - QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS" - QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS" + if compileTest unix/dbus "D-Bus" $QMAKE_CFLAGS_DBUS $QMAKE_LIBS_DBUS; then + QMakeVar set QMAKE_LIBS_DBUS "$QMAKE_LIBS_DBUS" + QMakeVar set QMAKE_CFLAGS_DBUS "$QMAKE_CFLAGS_DBUS" # Try find correct host configuration for dbus tools when cross-compiling if [ "$QT_CROSS_COMPILE" = "yes" ] && env -i PATH="$PATH" \ pkg-config --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then - QT_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null` + QMAKE_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null` fi - QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS" + QMakeVar set QT_HOST_CFLAGS_DBUS "$QMAKE_CFLAGS_DBUS" CFG_DBUS=linked else # Failed to compile the test, so it's an error if CFG_DBUS is "linked" @@ -5202,13 +4430,13 @@ fi # auto-detect Glib support if [ "$CFG_GLIB" != "no" ]; then if [ -n "$PKG_CONFIG" ]; then - QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null` - QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null` + QMAKE_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null` + QMAKE_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null` fi - if compileTest unix/glib "Glib" $QT_CFLAGS_GLIB $QT_LIBS_GLIB; then + if compileTest unix/glib "Glib" $QMAKE_CFLAGS_GLIB $QMAKE_LIBS_GLIB; then CFG_GLIB=yes - QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB" - QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB" + QMakeVar set QMAKE_CFLAGS_GLIB "$QMAKE_CFLAGS_GLIB" + QMakeVar set QMAKE_LIBS_GLIB "$QMAKE_LIBS_GLIB" else if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "Glib support cannot be enabled due to functionality tests!" @@ -5226,15 +4454,14 @@ fi # auto-detect GTK style support if [ "$CFG_GLIB" = "yes" -a "$CFG_GTK" != "no" ]; then if [ -n "$PKG_CONFIG" ]; then - QT_CFLAGS_QGTK3=`$PKG_CONFIG --cflags gtk+-3.0 2>/dev/null` - QT_LIBS_QGTK3=`$PKG_CONFIG --libs gtk+-3.0 2>/dev/null` - QT_LIBS_QGOBJECT=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null` + QMAKE_CFLAGS_GTK3=`$PKG_CONFIG --cflags gtk+-3.0 2>/dev/null` + QMAKE_LIBS_GTK3=`$PKG_CONFIG --libs gtk+-3.0 2>/dev/null` fi - if [ -n "$QT_CFLAGS_QGTK3" ] ; then + if [ -n "$QMAKE_CFLAGS_GTK3" ] ; then CFG_GTK=yes QT_CONFIG="$QT_CONFIG gtk3" - QMakeVar set QT_CFLAGS_QGTK3 "$QT_CFLAGS_QGTK3" - QMakeVar set QT_LIBS_QGTK3 "$QT_LIBS_QGTK3" + QMakeVar set QMAKE_CFLAGS_GTK3 "$QMAKE_CFLAGS_GTK3" + QMakeVar set QMAKE_LIBS_GTK3 "$QMAKE_LIBS_GTK3" else if [ "$CFG_GTK" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "GTK theme support cannot be enabled due to functionality tests!" @@ -5273,13 +4500,13 @@ fi # Auto-detect PulseAudio support if [ "$CFG_PULSEAUDIO" != "no" ]; then if [ -n "$PKG_CONFIG" ]; then - QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null` - QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null` + QMAKE_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null` + QMAKE_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null` fi - if compileTest unix/pulseaudio "PulseAudio" $QT_CFLAGS_PULSEAUDIO $QT_LIBS_PULSEAUDIO; then + if compileTest unix/pulseaudio "PulseAudio" $QMAKE_CFLAGS_PULSEAUDIO $QMAKE_LIBS_PULSEAUDIO; then CFG_PULSEAUDIO=yes - QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO" - QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO" + QMakeVar set QMAKE_CFLAGS_PULSEAUDIO "$QMAKE_CFLAGS_PULSEAUDIO" + QMakeVar set QMAKE_LIBS_PULSEAUDIO "$QMAKE_LIBS_PULSEAUDIO" else if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "PulseAudio support cannot be enabled due to functionality tests!" @@ -5437,16 +4664,16 @@ fi # auto-detect FontConfig support if [ "$CFG_FONTCONFIG" != "no" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then - QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null` - QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null` + QMAKE_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null` + QMAKE_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null` else - QT_CFLAGS_FONTCONFIG= - QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig" + QMAKE_CFLAGS_FONTCONFIG= + QMAKE_LIBS_FONTCONFIG="-lfreetype -lfontconfig" fi - if compileTest unix/fontconfig "FontConfig" $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then + if compileTest unix/fontconfig "FontConfig" $QMAKE_CFLAGS_FONTCONFIG $QMAKE_LIBS_FONTCONFIG; then QT_CONFIG="$QT_CONFIG fontconfig" - QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG" - QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG" + QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QMAKE_CFLAGS_FONTCONFIG" + QMakeVar set QMAKE_LIBS_FONTCONFIG "$QMAKE_LIBS_FONTCONFIG" CFG_FONTCONFIG=yes CFG_FREETYPE=system else @@ -5455,13 +4682,6 @@ if [ "$CFG_FONTCONFIG" != "no" ]; then fi -# Save these for a check later -ORIG_CFG_XCB="$CFG_XCB" -ORIG_CFG_EGLFS="$CFG_EGLFS" -ORIG_CFG_DIRECTFB="$CFG_DIRECTFB" -ORIG_CFG_LINUXFB="$CFG_LINUXFB" -ORIG_CFG_MIRCLIENT="$CFG_MIRCLIENT" - if [ "$CFG_LIBUDEV" != "no" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'` @@ -5589,12 +4809,12 @@ fi if [ "$CFG_XINPUT2" != "no" ]; then if compileTest x11/xinput2 "XInput2"; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xi 2>/dev/null; then - QMAKE_LIBXI_VERSION_MAJOR=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 1` - QMAKE_LIBXI_VERSION_MINOR=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 2` - QMAKE_LIBXI_VERSION_PATCH=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 3` - QMakeVar set QMAKE_LIBXI_VERSION_MAJOR "$QMAKE_LIBXI_VERSION_MAJOR" - QMakeVar set QMAKE_LIBXI_VERSION_MINOR "$QMAKE_LIBXI_VERSION_MINOR" - QMakeVar set QMAKE_LIBXI_VERSION_PATCH "$QMAKE_LIBXI_VERSION_PATCH" + QMAKE_XINPUT2_VERSION_MAJOR=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 1` + QMAKE_XINPUT2_VERSION_MINOR=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 2` + QMAKE_XINPUT2_VERSION_PATCH=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 3` + QMakeVar set QMAKE_XINPUT2_VERSION_MAJOR "$QMAKE_XINPUT2_VERSION_MAJOR" + QMakeVar set QMAKE_XINPUT2_VERSION_MINOR "$QMAKE_XINPUT2_VERSION_MINOR" + QMakeVar set QMAKE_XINPUT2_VERSION_PATCH "$QMAKE_XINPUT2_VERSION_PATCH" fi CFG_XINPUT2=yes else @@ -5955,21 +5175,6 @@ if [ "$CFG_MIRCLIENT" = "yes" ]; then QT_CONFIG="$QT_CONFIG mirclient" fi -if [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_HAIKU" = "no" ] && [ "$XPLATFORM_INTEGRITY" = "no" ]; then - if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_MIRCLIENT" = "no" ]; then - if [ "$QPA_PLATFORM_GUARD" = "yes" ] && - ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_MIRCLIENT" = "auto" ] ); then - echo "No QPA platform plugin enabled!" - echo " If you really want to build without a QPA platform plugin you must pass" - echo " -no-qpa-platform-guard to configure. Doing this will" - echo " produce a Qt that can not run GUI applications." - echo " The dependencies needed for xcb to build are listed in" - echo " src/plugins/platforms/xcb/README" - exit 1 - fi -fi - fi - # double-conversion support if [ "$CFG_DOUBLECONVERSION" = "no" ]; then if ! compileTest common/xlocalescanprint "XLocaleScanPrint"; then @@ -6211,44 +5416,6 @@ if [ "$CFG_PCRE" != "qt" ]; then fi fi -# detect OpenVG support -if [ "$CFG_OPENVG" != "no" ]; then - if compileTest unix/openvg "OpenVG"; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - elif compileTest unix/openvg "OpenVG" -config openvg_on_opengl; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - CFG_OPENVG_ON_OPENGL=yes - elif compileTest unix/openvg "OpenVG (lc includes)" -config lower_case_includes; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - CFG_OPENVG_LC_INCLUDES=yes - elif compileTest unix/openvg "OpenVG (lc includes)" -config "openvg_on_opengl lower_case_includes"; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - CFG_OPENVG_LC_INCLUDES=yes - CFG_OPENVG_ON_OPENGL=yes - else - if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!" - echo " Turn on verbose messaging (-v) to $0 to see the final report." - echo " If you believe this message is in error you may use the continue" - echo " switch (-continue) to $0 to continue." - exit 101 - else - CFG_OPENVG=no - fi - fi - if [ "$CFG_OPENVG" = "yes" ] && compileTest unix/shivavg "ShivaVG"; then - CFG_OPENVG_SHIVA=yes - fi -fi - if [ "$CFG_ALSA" = "auto" ]; then if compileTest unix/alsa "alsa"; then CFG_ALSA=yes @@ -6297,11 +5464,6 @@ elif [ "$CFG_GSTREAMER" = "1.0" ]; then fi fi -if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then - echo "Warning: largefile support cannot be disabled for win32." - CFG_LARGEFILE="yes" -fi - # Detect DirectWrite 2 support on Windows if [ "$CFG_DIRECTWRITE" = "no" ]; then CFG_DIRECTWRITE2=no @@ -6327,7 +5489,7 @@ if [ "$CFG_STDCXX" != "c++11" ]; then fi fi -if [ "$CFG_ATOMIC64" = "libatomic" ]; then +if [ "$CFG_STD_ATOMIC64" = "libatomic" ]; then QMAKE_CONFIG="$QMAKE_CONFIG atomic64-libatomic" fi @@ -6385,23 +5547,6 @@ if [ "$CFG_EGLFS_VIV" = "yes" ]; then fi fi -# enable openvg -if [ "$CFG_OPENVG" = "no" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG" -else - QT_CONFIG="$QT_CONFIG openvg" - if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES" - fi - if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then - QT_CONFIG="$QT_CONFIG openvg_on_opengl" - fi - if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then - QT_CONFIG="$QT_CONFIG shivavg" - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG" - fi -fi - # enable opengl if [ "$CFG_OPENGL" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL" @@ -6497,9 +5642,7 @@ if [ "$CFG_LIBJPEG" = "no" ]; then elif [ "$CFG_LIBJPEG" = "system" ]; then QT_CONFIG="$QT_CONFIG system-jpeg" fi -if [ "$CFG_JPEG" = "no" ]; then - QT_CONFIG="$QT_CONFIG no-jpeg" -elif [ "$CFG_JPEG" = "yes" ]; then +if [ "$CFG_JPEG" = "yes" ]; then QT_CONFIG="$QT_CONFIG jpeg" fi if [ "$CFG_LIBPNG" = "no" ]; then @@ -6508,36 +5651,28 @@ fi if [ "$CFG_LIBPNG" = "system" ]; then QT_CONFIG="$QT_CONFIG system-png" fi -if [ "$CFG_PNG" = "no" ]; then - QT_CONFIG="$QT_CONFIG no-png" -elif [ "$CFG_PNG" = "yes" ]; then +if [ "$CFG_PNG" = "yes" ]; then QT_CONFIG="$QT_CONFIG png" fi -if [ "$CFG_GIF" = "no" ]; then - QT_CONFIG="$QT_CONFIG no-gif" -elif [ "$CFG_GIF" = "yes" ]; then +if [ "$CFG_GIF" = "yes" ]; then QT_CONFIG="$QT_CONFIG gif" fi -if [ "$CFG_DOUBLECONVERSION" = "no" ]; then - QT_CONFIG="$QT_CONFIG no-doubleconversion" -elif [ "$CFG_DOUBLECONVERSION" = "system" ]; then - QT_CONFIG="$QT_CONFIG system-doubleconversion" +if [ "$CFG_DOUBLECONVERSION" = "system" ]; then + QT_CONFIG="$QT_CONFIG doubleconversion system-doubleconversion" else QT_CONFIG="$QT_CONFIG doubleconversion" fi if [ "$CFG_FREETYPE" = "no" ]; then - QT_CONFIG="$QT_CONFIG no-freetype" QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE" elif [ "$CFG_FREETYPE" = "system" ]; then - QT_CONFIG="$QT_CONFIG system-freetype" + QT_CONFIG="$QT_CONFIG freetype system-freetype" else QT_CONFIG="$QT_CONFIG freetype" fi if [ "$CFG_HARFBUZZ" = "no" ]; then - QT_CONFIG="$QT_CONFIG no-harfbuzz" QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_HARFBUZZ" elif [ "$CFG_HARFBUZZ" = "system" ]; then - QT_CONFIG="$QT_CONFIG system-harfbuzz" + QT_CONFIG="$QT_CONFIG harfbuzz system-harfbuzz" else QT_CONFIG="$QT_CONFIG harfbuzz" fi @@ -6556,18 +5691,16 @@ fi if [ "$XPLATFORM_MAC" = "yes" ]; then #On Mac we implicitly link against libz, so we #never use the 3rdparty stuff. - [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" + CFG_SYSTEM_ZLIB=yes fi -if [ "$CFG_ZLIB" = "yes" ]; then - QT_CONFIG="$QT_CONFIG zlib" -elif [ "$CFG_ZLIB" = "system" ]; then +if [ "$CFG_SYSTEM_ZLIB" = "yes" ]; then QT_CONFIG="$QT_CONFIG system-zlib" fi [ "$CFG_MTDEV" = "yes" ] && QT_CONFIG="$QT_CONFIG mtdev" [ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis" [ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups" -[ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv" +[ "$CFG_ICONV" != "no" ] && QT_CONFIG="$QT_CONFIG iconv" [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv" [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv" [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib" @@ -6672,137 +5805,8 @@ if [ "$CFG_PCRE" = "qt" ]; then QMAKE_CONFIG="$QMAKE_CONFIG pcre" fi -# -# Some Qt modules are too advanced in C++ for some old compilers -# Detect here the platforms where they are known to work. -# -# See Qt documentation for more information on which features are -# supported and on which compilers. -# -canBuildQtConcurrent="yes" - -case "$XPLATFORM" in - hpux-g++*) - # PA-RISC's assembly is too limited - # gcc 3.4 on that platform can't build QtXmlPatterns - # the assembly it generates cannot be compiled - - # Check gcc's version - case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in - 4*) - ;; - 3.4*) - canBuildQtXmlPatterns="no" - ;; - *) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - ;; - esac - ;; - unsupported/vxworks-*-g++*) - canBuildWebKit="no" - ;; - unsupported/vxworks-*-dcc*) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - ;; - *-g++*) - # Check gcc's version - case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in - 4*|3.4*) - ;; - 3.3*) - canBuildWebKit="no" - ;; - *) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - ;; - esac - ;; - solaris-cc*) - # Check the compiler version - case `${QMAKE_CONF_COMPILER} -V 2>&1 | $AWK '{print $4}'` in - 5.[012345678]) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - canBuildQtConcurrent="no" - ;; - 5.*) - canBuildWebKit="no" - canBuildQtConcurrent="no" - ;; - esac - ;; - hpux-acc*) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - canBuildQtConcurrent="no" - ;; - hpuxi-acc*) - canBuildWebKit="no" - ;; - aix-xlc*) - # Get the xlC version - cat > xlcver.c <<EOF -#include <stdio.h> -int main() -{ - printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF); - return 0; -} -EOF - xlcver= - if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then - xlcver=`./xlcver 2>/dev/null` - rm -f ./xlcver - fi - if [ "$OPT_VERBOSE" = "yes" ]; then - if [ -n "$xlcver" ]; then - echo Found IBM xlC version: $xlcver. - else - echo Could not determine IBM xlC version, assuming oldest supported. - fi - fi - - case "$xlcver" in - [123456].*) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - canBuildQtConcurrent="no" - ;; - *) - canBuildWebKit="no" - canBuildQtConcurrent="no" - ;; - esac - ;; - irix-cc*) - canBuildWebKit="no" - canBuildQtConcurrent="no" - ;; -esac - -if [ "$CFG_GUI" = "no" ]; then - # WebKit requires Qt GUI - canBuildWebKit="no" -fi - -if [ "$CFG_SHARED" = "no" ]; then - echo - echo "WARNING: Using static linking will disable the WebKit module." - echo - canBuildWebKit="no" -fi - CFG_CONCURRENT="yes" -if [ "$canBuildQtConcurrent" = "no" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT" - CFG_CONCURRENT="no" -else - QT_CONFIG="$QT_CONFIG concurrent" -fi +QT_CONFIG="$QT_CONFIG concurrent" # ### Vestige if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then @@ -6881,17 +5885,6 @@ cat <<EOF EOF -case "$CFG_QCONFIG" in -full) - echo "/* Everything */" - ;; -*) - echo "#ifndef QT_BOOTSTRAPPED" - cat "$CFG_QCONFIG_PATH" - echo "#endif" - ;; -esac - echo '/* Compile time features */' [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" @@ -6918,7 +5911,7 @@ if [ "$CFG_FRAMEWORK" = "yes" ]; then echo "#define QT_MAC_FRAMEWORK_BUILD" fi -if [ "$CFG_ATOMIC64" = "no" ]; then +if [ "$CFG_STD_ATOMIC64" = "no" ]; then echo "#define QT_NO_STD_ATOMIC64" fi @@ -6956,26 +5949,17 @@ QCONFIG_FLAGS="$QCONFIG_FLAGS" # Add turned on SQL drivers for DRIVER in $CFG_SQL_AVAILABLE; do eval "VAL=\$CFG_SQL_$DRIVER" - case "$VAL" in - qt) - ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER" + if [ "$VAL" = "yes" ]; then SQL_DRIVERS="$SQL_DRIVERS $DRIVER" - ;; - plugin) - SQL_PLUGINS="$SQL_PLUGINS $DRIVER" - ;; - esac + fi done QMakeVar set sql-drivers "$SQL_DRIVERS" -QMakeVar set sql-plugins "$SQL_PLUGINS" # Add other configuration options to the qconfig.h file -[ "$CFG_GIF" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1" +[ "$CFG_GIF" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_GIF" [ "$CFG_PNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG" [ "$CFG_JPEG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG" -[ "$CFG_ZLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB" [ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS" [ "$CFG_LIBPROXY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_LIBPROXY" @@ -7001,19 +5985,10 @@ QMakeVar set sql-plugins "$SQL_PLUGINS" [ "$CFG_SM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER" [ "$CFG_TSLIB" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_TSLIB" -[ "$CFG_XCURSOR" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR" -[ "$CFG_XFIXES" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES" [ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG" [ "$CFG_XKB" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB" -[ "$CFG_XRANDR" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR" [ "$CFG_XRENDER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER" -[ "$CFG_MITSHM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM" -[ "$CFG_XSHAPE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE" -[ "$CFG_XSYNC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC" -[ "$CFG_XCURSOR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR" -[ "$CFG_XFIXES" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES" -[ "$CFG_XRANDR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR" [ "$CFG_ALSA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA" [ "$CFG_PULSEAUDIO" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO" [ "$CFG_COREWLAN" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN" @@ -7189,7 +6164,6 @@ if [ -n "$CFG_SYSROOT" ] && [ "$CFG_GCC_SYSROOT" = "yes" ]; then echo "}" echo fi -echo "QT_COMPILER_STDCXX = $CFG_STDCXX_DEFAULT" if [ -n "$QT_GCC_MAJOR_VERSION" ]; then echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" @@ -7247,7 +6221,6 @@ done if [ -n "$DISABLED_FEATURES" ]; then echo "QT_NO_DEFINES = $DISABLED_FEATURES" fi -echo "QT_QCONFIG_PATH = ${CFG_QCONFIG_PATH#$relpath/src/corelib/global/}" cat <<EOF host_build { @@ -7258,29 +6231,29 @@ host_build { EOF echo "QT_COORD_TYPE = $CFG_QREAL" -if [ -n "$QT_CFLAGS_PSQL" ]; then - echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" +if [ -n "$QMAKE_CFLAGS_PSQL" ]; then + echo "QMAKE_CFLAGS_PSQL = $QMAKE_CFLAGS_PSQL" fi -if [ -n "$QT_LFLAGS_PSQL" ]; then - echo "QT_LFLAGS_PSQL = $QT_LFLAGS_PSQL" +if [ -n "$QMAKE_LIBS_PSQL" ]; then + echo "QMAKE_LIBS_PSQL = $QMAKE_LIBS_PSQL" fi -if [ -n "$QT_CFLAGS_MYSQL" ]; then - echo "QT_CFLAGS_MYSQL = $QT_CFLAGS_MYSQL" +if [ -n "$QMAKE_CFLAGS_MYSQL" ]; then + echo "QMAKE_CFLAGS_MYSQL = $QMAKE_CFLAGS_MYSQL" fi -if [ -n "$QT_LFLAGS_MYSQL" ]; then - echo "QT_LFLAGS_MYSQL = $QT_LFLAGS_MYSQL" +if [ -n "$QMAKE_LIBS_MYSQL" ]; then + echo "QMAKE_LIBS_MYSQL = $QMAKE_LIBS_MYSQL" fi -if [ -n "$QT_CFLAGS_SQLITE" ]; then - echo "QT_CFLAGS_SQLITE = $QT_CFLAGS_SQLITE" +if [ -n "$QMAKE_CFLAGS_SQLITE" ]; then + echo "QMAKE_CFLAGS_SQLITE = $QMAKE_CFLAGS_SQLITE" fi -if [ -n "$QT_LFLAGS_SQLITE" ]; then - echo "QT_LFLAGS_SQLITE = $QT_LFLAGS_SQLITE" +if [ -n "$QMAKE_LIBS_SQLITE" ]; then + echo "QMAKE_LIBS_SQLITE = $QMAKE_LIBS_SQLITE" fi -if [ -n "$QT_LFLAGS_ODBC" ]; then - echo "QT_LFLAGS_ODBC = $QT_LFLAGS_ODBC" +if [ -n "$QMAKE_LIBS_ODBC" ]; then + echo "QMAKE_LIBS_ODBC = $QMAKE_LIBS_ODBC" fi -if [ -n "$QT_LFLAGS_TDS" ]; then - echo "QT_LFLAGS_TDS = $QT_LFLAGS_TDS" +if [ -n "$QMAKE_LIBS_TDS" ]; then + echo "QMAKE_LIBS_TDS = $QMAKE_LIBS_TDS" fi #dump in the OPENSSL_LIBS info @@ -7418,7 +6391,6 @@ report_support " Qt D-Bus ..............." "$CFG_DBUS" runtime "loading dbus-1 report_support " Qt Concurrent .........." "$CFG_CONCURRENT" report_support " Qt GUI ................." "$CFG_GUI" report_support " Qt Widgets ............." "$CFG_WIDGETS" -report_support " Large File ............." "$CFG_LARGEFILE" report_support " QML debugging .........." "$CFG_QML_DEBUG" report_support " Use system proxies ....." "$CFG_SYSTEM_PROXIES" @@ -7465,7 +6437,6 @@ report_support " NIS ...................." "$CFG_NIS" report_support " OpenGL / OpenVG:" report_support " EGL .................." "$CFG_EGL" report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.0+" -report_support " OpenVG ..............." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native" report_support " PCRE ..................." "$CFG_PCRE" yes "system library" qt "bundled copy" if [ -n "$PKG_CONFIG" ]; then report_support " pkg-config ............. yes" @@ -7492,16 +6463,10 @@ report_support " XCB .................." "$CFG_XCB" system "system library" q if [ "$CFG_XCB" != "no" ]; then report_support " EGL on X ..........." "$CFG_EGL_X" report_support " GLX ................" "$CFG_XCB_GLX" - report_support " MIT-SHM ............" "$CFG_MITSHM" report_support " Xcb-Xlib ..........." "$CFG_XCB_XLIB" - report_support " Xcursor ............" "$CFG_XCURSOR" runtime "loaded at runtime" - report_support " Xfixes ............." "$CFG_XFIXES" runtime "loaded at runtime" report_support " Xi2 ................" "$CFG_XINPUT2" runtime "loaded at runtime" - report_support " Xrandr ............." "$CFG_XRANDR" runtime "loaded at runtime" report_support " Xrender ............" "$CFG_XRENDER" report_support " XKB ................" "$CFG_XKB" - report_support " XShape ............." "$CFG_XSHAPE" - report_support " XSync .............." "$CFG_XSYNC" fi report_support " Session management ....." "$CFG_SM" if [ "$XPLATFORM_QNX" = "yes" ]; then @@ -7511,20 +6476,20 @@ if [ "$XPLATFORM_QNX" = "yes" ]; then report_support " LGMON .................." "$CFG_LGMON" fi report_support " SQL drivers:" -report_support " DB2 .................." "$CFG_SQL_db2" plugin "plugin" yes "built into QtSql" -report_support " InterBase ............" "$CFG_SQL_ibase" plugin "plugin" yes "built into QtSql" -report_support " MySQL ................" "$CFG_SQL_mysql" plugin "plugin" yes "built into QtSql" -report_support " OCI .................." "$CFG_SQL_oci" plugin "plugin" yes "built into QtSql" -report_support " ODBC ................." "$CFG_SQL_odbc" plugin "plugin" yes "built into QtSql" -report_support " PostgreSQL ..........." "$CFG_SQL_psql" plugin "plugin" yes "built into QtSql" -report_support " SQLite 2 ............." "$CFG_SQL_sqlite2" plugin "plugin" yes "built into QtSql" +report_support " DB2 .................." "$CFG_SQL_db2" +report_support " InterBase ............" "$CFG_SQL_ibase" +report_support " MySQL ................" "$CFG_SQL_mysql" +report_support " OCI .................." "$CFG_SQL_oci" +report_support " ODBC ................." "$CFG_SQL_odbc" +report_support " PostgreSQL ..........." "$CFG_SQL_psql" +report_support " SQLite 2 ............." "$CFG_SQL_sqlite2" report_support_plugin " SQLite ..............." "$CFG_SQL_sqlite" "$CFG_SQLITE" QtSql -report_support " TDS .................." "$CFG_SQL_tds" plugin "plugin" yes "built into QtSql" +report_support " TDS .................." "$CFG_SQL_tds" report_support " tslib .................." "$CFG_TSLIB" report_support " udev ..................." "$CFG_LIBUDEV" report_support " xkbcommon-x11..........." "$CFG_XKBCOMMON" system "system library" qt "bundled copy, XKB config root: $CFG_XKB_CONFIG_ROOT" report_support " xkbcommon-evdev........." "$CFG_XKBCOMMON_EVDEV" -report_support " zlib ..................." "$CFG_ZLIB" system "system library" yes "bundled copy" +report_support " zlib ..................." "$CFG_SYSTEM_ZLIB" yes "system library" no "bundled copy" echo @@ -7564,6 +6529,14 @@ if [ "$CFG_RELEASE_TOOLS" = "yes" -a \( "$CFG_DEBUG" = "no" -o "$CFG_DEBUG_RELEA echo "NOTE: -optimized-tools is not useful in -release mode." echo fi +if [ "$CFG_GUI" = "yes" ] && [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_HAIKU" = "no" ] && [ "$XPLATFORM_INTEGRITY" = "no" ]; then + if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_MIRCLIENT" = "no" ]; then + echo + echo "No QPA platform plugin enabled! This will" + echo "produce a Qt that cannot run GUI applications." + echo + fi +fi exec 1>&3 3>&- # restore stdout cat $outpath/config.summary # display config feedback to user @@ -7599,76 +6572,6 @@ rm -f "$QMAKE_VARS_FILE" 2>/dev/null ) || exit #------------------------------------------------------------------------------- -# check for platforms that we don't yet know about -#------------------------------------------------------------------------------- -if [ "$CFG_ARCH" = "unknown" ]; then -cat <<EOF - - NOTICE: configure was unable to determine the architecture - for the $XQMAKESPEC target. - - Qt will not use a specialized implementation for any atomic - operations. Instead a generic implemention based on either GCC - intrinsics or C++11 std::atomic<T> will be used (when - available). The generic implementations are generally as fast - as and always as safe as a specialized implementation. - - If no generic implementation is available, Qt will use a - fallback UNIX implementation which uses a single - pthread_mutex_t to protect all atomic operations. This - implementation is the slow (but safe) fallback implementation - for architectures Qt does not yet support. -EOF -fi - -#------------------------------------------------------------------------------- -# check if the user passed the -no-zlib option, which is no longer supported -#------------------------------------------------------------------------------- -if [ -n "$ZLIB_FORCED" ]; then - which_zlib="supplied" - if [ "$CFG_ZLIB" = "system" ]; then - which_zlib="system" - fi - -cat <<EOF - - NOTICE: The -no-zlib option was supplied but is no longer - supported. - - Qt now requires zlib support in all builds, so the -no-zlib - option was ignored. Qt will be built using the $which_zlib - zlib. -EOF -fi - -#------------------------------------------------------------------------------- -# check if the user passed the obsoleted -wayland or -no-wayland flag -#------------------------------------------------------------------------------- -if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then -cat <<EOF - - NOTICE: The -wayland and -no-wayland flags are now obsolete - - All configuring of QtWayland plugin and QtCompositor happens in the module -EOF -fi - -#------------------------------------------------------------------------------- -# check if the user passed the obsoleted -arch or -host-arch options -#------------------------------------------------------------------------------- -if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then -cat <<EOF - - NOTICE: The -arch and -host-arch options are obsolete. - - Qt now detects the target and host architectures based on compiler - output. Qt will be built using $CFG_ARCH for the target architecture - and $CFG_HOST_ARCH for the host architecture (note that these two - will be the same unless you are cross-compiling). -EOF -fi - -#------------------------------------------------------------------------------- # finally save the executed command to another script #------------------------------------------------------------------------------- if [ `basename $0` != "config.status" ]; then diff --git a/examples/corelib/ipc/ipc.pro b/examples/corelib/ipc/ipc.pro index 65ee98a2cf..4cc5f3be56 100644 --- a/examples/corelib/ipc/ipc.pro +++ b/examples/corelib/ipc/ipc.pro @@ -3,4 +3,4 @@ requires(qtHaveModule(widgets)) TEMPLATE = subdirs # no QSharedMemory !vxworks:!integrity: SUBDIRS = sharedmemory -!wince:qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient +qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index f364fabf2d..d75e021834 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -12,8 +12,7 @@ FORMS = bearermonitor_240_320.ui \ bearermonitor_640_480.ui \ sessionwidget.ui -win32:!wince: LIBS += -lws2_32 -wince: LIBS += -lws2 +win32:LIBS += -lws2_32 CONFIG += console diff --git a/examples/widgets/draganddrop/draganddrop.pro b/examples/widgets/draganddrop/draganddrop.pro index eb678eecd8..1ecafd33a1 100644 --- a/examples/widgets/draganddrop/draganddrop.pro +++ b/examples/widgets/draganddrop/draganddrop.pro @@ -4,5 +4,3 @@ SUBDIRS = draggableicons \ dropsite \ fridgemagnets \ puzzle - -wince: SUBDIRS -= dropsite diff --git a/examples/widgets/draganddrop/puzzle/puzzle.pro b/examples/widgets/draganddrop/puzzle/puzzle.pro index 404b75187d..97e7206682 100644 --- a/examples/widgets/draganddrop/puzzle/puzzle.pro +++ b/examples/widgets/draganddrop/puzzle/puzzle.pro @@ -14,9 +14,3 @@ QMAKE_PROJECT_NAME = dndpuzzle # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/draganddrop/puzzle INSTALLS += target - -wince { - addFile.files = example.jpg - addFile.path = . - INSTALLS += addFile -} diff --git a/examples/widgets/graphicsview/boxes/boxes.pro b/examples/widgets/graphicsview/boxes/boxes.pro index 38aae1c2c4..14d22537e8 100644 --- a/examples/widgets/graphicsview/boxes/boxes.pro +++ b/examples/widgets/graphicsview/boxes/boxes.pro @@ -24,7 +24,3 @@ RESOURCES += boxes.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/boxes INSTALLS += target - -wince { - DEPLOYMENT_PLUGIN += qjpeg -} diff --git a/examples/widgets/graphicsview/embeddeddialogs/main.cpp b/examples/widgets/graphicsview/embeddeddialogs/main.cpp index dcab0ee3a8..cbd5dd5890 100644 --- a/examples/widgets/graphicsview/embeddeddialogs/main.cpp +++ b/examples/widgets/graphicsview/embeddeddialogs/main.cpp @@ -62,11 +62,7 @@ int main(int argc, char *argv[]) QGraphicsScene scene; scene.setStickyFocus(true); -#ifndef Q_OS_WINCE const int gridSize = 10; -#else - const int gridSize = 5; -#endif for (int y = 0; y < gridSize; ++y) { for (int x = 0; x < gridSize; ++x) { diff --git a/examples/widgets/itemviews/puzzle/puzzle.pro b/examples/widgets/itemviews/puzzle/puzzle.pro index a5379293ff..55f1d7e709 100644 --- a/examples/widgets/itemviews/puzzle/puzzle.pro +++ b/examples/widgets/itemviews/puzzle/puzzle.pro @@ -12,8 +12,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/puzzle INSTALLS += target - - -wince* { - DEPLOYMENT_PLUGIN += qjpeg qgif -} diff --git a/examples/widgets/painting/affine/affine.pro b/examples/widgets/painting/affine/affine.pro index be6a83960d..0ad869183c 100644 --- a/examples/widgets/painting/affine/affine.pro +++ b/examples/widgets/painting/affine/affine.pro @@ -16,7 +16,3 @@ RESOURCES += affine.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/affine INSTALLS += target - -wince { - DEPLOYMENT_PLUGIN += qjpeg -} diff --git a/examples/widgets/painting/composition/composition.pro b/examples/widgets/painting/composition/composition.pro index 3b64714ba2..7d174ca2bc 100644 --- a/examples/widgets/painting/composition/composition.pro +++ b/examples/widgets/painting/composition/composition.pro @@ -15,7 +15,3 @@ QT += widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/composition INSTALLS += target - -wince* { - DEPLOYMENT_PLUGIN += qjpeg -} diff --git a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro index 93cd950b0b..ae51662341 100644 --- a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro +++ b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro @@ -9,10 +9,3 @@ SOURCES = highlighter.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/richtext/syntaxhighlighter INSTALLS += target - - -wince { - addFiles.files = main.cpp mainwindow.cpp - addFiles.path = . - INSTALLS += addFiles -} diff --git a/examples/widgets/widgets/icons/icons.pro b/examples/widgets/widgets/icons/icons.pro index 4ee95592c8..450bdf9f8a 100644 --- a/examples/widgets/widgets/icons/icons.pro +++ b/examples/widgets/widgets/icons/icons.pro @@ -17,14 +17,3 @@ EXAMPLE_FILES = images/* # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/icons INSTALLS += target - - -wince { - imageFiles.files = images/* - wincewm*: { - imageFiles.path = "/My Documents/My Pictures" - } else { - imageFiles.path = images - } - INSTALLS += imageFiles -} diff --git a/examples/widgets/widgets/imageviewer/imageviewer.pro b/examples/widgets/widgets/imageviewer/imageviewer.pro index 2853f1699f..4903a68537 100644 --- a/examples/widgets/widgets/imageviewer/imageviewer.pro +++ b/examples/widgets/widgets/imageviewer/imageviewer.pro @@ -8,8 +8,3 @@ SOURCES = imageviewer.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/imageviewer INSTALLS += target - - -wince { - DEPLOYMENT_PLUGIN += qjpeg qgif -} diff --git a/examples/widgets/widgets/movie/movie.pro b/examples/widgets/widgets/movie/movie.pro index 94d86454d8..e3b9b5129c 100644 --- a/examples/widgets/widgets/movie/movie.pro +++ b/examples/widgets/widgets/movie/movie.pro @@ -9,10 +9,3 @@ EXAMPLE_FILES = animation.gif # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/movie INSTALLS += target - - -wince { - addFiles.files += *.gif - addFiles.path = . - INSTALLS += addFiles -} diff --git a/mkspecs/common/ios.conf b/mkspecs/common/ios.conf index f8f810d4f0..a40ab48ac5 100644 --- a/mkspecs/common/ios.conf +++ b/mkspecs/common/ios.conf @@ -6,13 +6,13 @@ QMAKE_PLATFORM += ios QMAKE_MAC_SDK = iphoneos simulator.sdk = iphonesimulator -simulator.target = $${simulator.sdk} +simulator.target = simulator simulator.dir_affix = $${simulator.sdk} simulator.CONFIG = $${simulator.sdk} simulator.deployment_identifier = ios-simulator device.sdk = iphoneos -device.target = $${device.sdk} +device.target = device device.dir_affix = $${device.sdk} device.CONFIG = $${device.sdk} device.deployment_identifier = $${device.sdk} diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index ad3c638a6f..d0bb9561cc 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -6,6 +6,10 @@ QMAKE_PLATFORM += mac darwin +MAKEFILE_GENERATOR = UNIX +CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname sdk +QMAKE_INCREMENTAL_STYLE = sublib + include(unix.conf) QMAKE_RESOURCE = /Developer/Tools/Rez diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf deleted file mode 100644 index fa1a72a1b9..0000000000 --- a/mkspecs/common/wince/qmake.conf +++ /dev/null @@ -1,84 +0,0 @@ -# -# qmake configuration for common Windows CE -# - -include(../angle.conf) - -MAKEFILE_GENERATOR = MSVC.NET -QMAKE_PLATFORM += wince win32 -CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target - -DEFINES += UNDER_CE WINCE _WINDOWS _UNICODE UNICODE _WIN32 QT_NO_PRINTER QT_NO_PRINTDIALOG - -QMAKE_COMPILER_DEFINES += _MSC_VER=1400 - -QMAKE_COMPILER = msvc - -QMAKE_CC = cl -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = bison -y -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- -QMAKE_CFLAGS_WARN_ON = -W3 -QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O2 -MD -QMAKE_CFLAGS_LTCG = -GL -QMAKE_CFLAGS_DEBUG = -DDEBUG -D_DEBUG -Zi -MDd -QMAKE_CFLAGS_YACC = - -# Uncomment the following lines to reduce library sizes -# with potential cost of performance -# QMAKE_CFLAGS += -Os -# QMAKE_CFLAGS_RELEASE += -Os - -QMAKE_CXX = $$QMAKE_CC -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_STL_ON = -EHsc -QMAKE_CXXFLAGS_STL_OFF = -QMAKE_CXXFLAGS_RTTI_ON = -GR -QMAKE_CXXFLAGS_RTTI_OFF = -QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -EHs-c- - -QMAKE_INCDIR = - -QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<< -QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< - -QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO /NODEFAULTLIB:OLDNAMES.LIB -QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO -QMAKE_LFLAGS_DEBUG = /DEBUG -QMAKE_LFLAGS_LTCG = /LTCG -QMAKE_LIBS_NETWORK = ws2.lib -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = -QMAKE_PREFIX_SHLIB = -QMAKE_EXTENSION_SHLIB = dll -QMAKE_PREFIX_STATICLIB = -QMAKE_EXTENSION_STATICLIB = lib - -QMAKE_LIBS_EGL = $${LIBEGL_NAME}.lib -QMAKE_LIBS_OPENGL_ES2 = $${LIBGLESV2_NAME}.lib - -QMAKE_LIBS_QT_ENTRY = -lqtmain - -QMAKE_IDL = midl -QMAKE_LIB = lib -QMAKE_RC = rc - -VCPROJ_EXTENSION = .vcproj -VCSOLUTION_EXTENSION = .sln -VCPROJ_KEYWORD = Qt4VSv1.0 -load(qt_config) diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h deleted file mode 100644 index 92f5013231..0000000000 --- a/mkspecs/common/wince/qplatformdefs.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif -#endif - -// Get Qt defines/settings - -#include "qglobal.h" -#include "qfunctions_wince.h" - -#define _POSIX_ -#include <limits.h> -#undef _POSIX_ - -#include <tchar.h> -#include <stdio.h> -#include <stdlib.h> - -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct _stati64 // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs -#define QT_STAT ::_stati64 -#define QT_FSTAT ::_fstati64 -#else -#define QT_STATBUF struct stat // non-ANSI defs -#define QT_STATBUF4TSTAT struct stat // non-ANSI defs -#define QT_STAT ::qt_wince_stat -#define QT_FSTAT ::qt_wince__fstat -#endif -#define QT_STAT_REG _S_IFREG -#define QT_STAT_DIR _S_IFDIR -#define QT_STAT_MASK _S_IFMT -#if defined(_S_IFLNK) -# define QT_STAT_LNK _S_IFLNK -#endif -#define QT_FILENO ::qt_wince___fileno -#define QT_OPEN ::qt_wince_open -#define QT_CLOSE ::qt_wince__close -#ifdef QT_LARGEFILE_SUPPORT -#define QT_LSEEK ::_lseeki64 -#define QT_TSTAT ::_tstati64 -#else -#define QT_LSEEK ::qt_wince__lseek -#define QT_TSTAT ::_tstat -#endif -#define QT_READ ::qt_wince__read -#define QT_WRITE ::qt_wince__write -#define QT_ACCESS ::qt_wince__access -#define QT_GETCWD ::_getcwd -#define QT_CHDIR ::_chdir -#define QT_MKDIR ::qt_wince__mkdir -#define QT_RMDIR ::qt_wince__rmdir -#define QT_OPEN_LARGEFILE 0 -#define QT_OPEN_RDONLY _O_RDONLY -#define QT_OPEN_WRONLY _O_WRONLY -#define QT_OPEN_RDWR _O_RDWR -#define QT_OPEN_CREAT _O_CREAT -#define QT_OPEN_TRUNC _O_TRUNC -#define QT_OPEN_APPEND _O_APPEND -# define QT_OPEN_TEXT _O_TEXT -# define QT_OPEN_BINARY _O_BINARY - -#define QT_FOPEN ::fopen -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell -#define QT_FGETPOS ::fgetpos -#define QT_FSETPOS ::fsetpos -#define QT_MMAP ::mmap -#define QT_FPOS_T fpos_t -#define QT_OFF_T long - -#define QT_SIGNAL_ARGS int - -#define QT_VSNPRINTF(buffer, count, format, arg) \ - _vsnprintf(buffer, count, format, arg) - -#define QT_SNPRINTF ::_snprintf - -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 - -typedef int mode_t; - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 11fb52a0b1..78356b4437 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -78,7 +78,7 @@ contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") { CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True } -win32:!wince:!static:!staticlib { +win32:!static:!staticlib { CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX]) contains(CMAKE_DLL_DIR, "^\\.\\./.*") { CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/ diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index a247b46a72..cb348a1036 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -8,7 +8,7 @@ CONFIG = \ testcase_targets import_plugins import_qpa_plugin \ $$CONFIG -contains(QT_CONFIG, c++11):lessThan(QT_COMPILER_STDCXX, 201103): CONFIG += c++11 +CONFIG += c++11 !build_pass:defined(QT_EDITION, var):!equals(QT_EDITION, "OpenSource"):!equals(QT_EDITION, "Preview") { # diff --git a/mkspecs/features/no_debug_info.prf b/mkspecs/features/no_debug_info.prf index 1307679a39..da14b7bb27 100644 --- a/mkspecs/features/no_debug_info.prf +++ b/mkspecs/features/no_debug_info.prf @@ -1,5 +1,4 @@ - -win32-msvc2*|wince*msvc* { +msvc { QMAKE_CFLAGS -= -Zi QMAKE_CFLAGS_DEBUG -= -Zi QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zi diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 03ec36ae3f..10b20be0b0 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -365,7 +365,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { # The following block is currently broken, because qt_plugin_XXX.prf files # are not generated for dynamic builds. - false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:if(wince*|winrt) { + false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:winrt { QT_ITEM = debug: QT_ITEM = $${QTPLUG}d4.dll else: QT_ITEM = $${QTPLUG}4.dll diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index aefd3aee1c..d14e1b8dde 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -74,7 +74,7 @@ header_module { TEMPLATE = lib } DESTDIR = $$MODULE_BASE_OUTDIR/lib -win32:!wince:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin +win32:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin CONFIG += qmake_cache target_qt @@ -113,10 +113,13 @@ lib_bundle { CONFIG += sliced_bundle header_module { CONFIG += bundle + QMAKE_BUNDLE_NAME = $$TARGET QMAKE_BUNDLE_EXTENSION = .framework QMAKE_INFO_PLIST = $$QMAKESPEC/Info.plist.lib } - !debug_and_release|!build_all|CONFIG(release, debug|release) { + !build_all| \ + if(if(!debug_and_release|CONFIG(release, debug|release)): \ + if(!simulator_and_device|CONFIG(device, simulator|device))) { FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES FRAMEWORK_HEADERS.path = Headers diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 220f11bd75..ccd66f4510 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -91,5 +91,4 @@ CONFIG += create_cmake load(qt_targets) load(qt_common) -wince: LIBS += $$QMAKE_LIBS_GUI QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/mkspecs/features/win32/console.prf b/mkspecs/features/win32/console.prf index 629f3af59b..e04367e20b 100644 --- a/mkspecs/features/win32/console.prf +++ b/mkspecs/features/win32/console.prf @@ -1,6 +1,5 @@ CONFIG -= windows QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) contains(TEMPLATE, ".*app") { - wince: QMAKE_LFLAGS += /ENTRY:mainACRTStartup QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE } diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf index 8173348bc4..c26ab62f50 100644 --- a/mkspecs/features/win32/opengl.prf +++ b/mkspecs/features/win32/opengl.prf @@ -1,32 +1,23 @@ -# WinCE does not have a platform directory for .prf files, and the -# win32 directory is searched for .prfs by qmake on WinCE. Ideally -# there should be a features/wince/opengl.prf which contains the wince -# block below. - -wince* { - include(../unix/opengl.prf) -} else { - contains(QT_CONFIG, opengles2) { -# For Desktop, use the ANGLE library location passed on from configure. - INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 - CONFIG(debug, debug|release) { - QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_DEBUG - contains(QT_CONFIG, angle) { - LIBS += $$QMAKE_LIBS_OPENGL_ES2_DEBUG - } else { - LIBS += $$QMAKE_LIBS_OPENGL_ES2 - } +contains(QT_CONFIG, opengles2) { +# For Desktop, use the ANGLE library location passed on from configure. + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 + CONFIG(debug, debug|release) { + QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_DEBUG + contains(QT_CONFIG, angle) { + LIBS += $$QMAKE_LIBS_OPENGL_ES2_DEBUG } else { LIBS += $$QMAKE_LIBS_OPENGL_ES2 - QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_RELEASE } - DEFINES += QT_OPENGL_ES_2 QT_OPENGL_ES_2_ANGLE - contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC GL_APICALL= EGLAPI= - QT_CONFIG -= opengl } else { - !contains(QT_CONFIG, dynamicgl) { - QMAKE_LIBS += $$QMAKE_LIBS_OPENGL - QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL - } + LIBS += $$QMAKE_LIBS_OPENGL_ES2 + QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_RELEASE + } + DEFINES += QT_OPENGL_ES_2 QT_OPENGL_ES_2_ANGLE + contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC GL_APICALL= EGLAPI= + QT_CONFIG -= opengl +} else { + !contains(QT_CONFIG, dynamicgl) { + QMAKE_LIBS += $$QMAKE_LIBS_OPENGL + QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL } } diff --git a/mkspecs/macx-clang-32/qmake.conf b/mkspecs/macx-clang-32/qmake.conf index b4fbc5e1fd..ba3c7cab6c 100644 --- a/mkspecs/macx-clang-32/qmake.conf +++ b/mkspecs/macx-clang-32/qmake.conf @@ -2,16 +2,12 @@ # qmake configuration for 32-bit Clang on OS X # -MAKEFILE_GENERATOR = UNIX -CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname -QMAKE_INCREMENTAL_STYLE = sublib - include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/clang.conf) include(../common/clang-mac.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 QMAKE_CFLAGS += -arch i386 QMAKE_CXXFLAGS += -arch i386 diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf index 13facaa5f6..4d56d771a1 100644 --- a/mkspecs/macx-clang/qmake.conf +++ b/mkspecs/macx-clang/qmake.conf @@ -2,15 +2,11 @@ # qmake configuration for Clang on OS X # -MAKEFILE_GENERATOR = UNIX -CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname -QMAKE_INCREMENTAL_STYLE = sublib - include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/clang.conf) include(../common/clang-mac.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 load(qt_config) diff --git a/mkspecs/macx-g++-32/qmake.conf b/mkspecs/macx-g++-32/qmake.conf index 5871bbadb6..4d76472456 100644 --- a/mkspecs/macx-g++-32/qmake.conf +++ b/mkspecs/macx-g++-32/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 QMAKE_CFLAGS += -arch i386 QMAKE_CXXFLAGS += -arch i386 diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf index dcc023e6c5..65c53b20f6 100644 --- a/mkspecs/macx-g++/qmake.conf +++ b/mkspecs/macx-g++/qmake.conf @@ -14,6 +14,6 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 load(qt_config) diff --git a/mkspecs/macx-g++40/qmake.conf b/mkspecs/macx-g++40/qmake.conf index f0583222cd..a60261d0dc 100644 --- a/mkspecs/macx-g++40/qmake.conf +++ b/mkspecs/macx-g++40/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 QMAKE_CC = gcc-4.0 QMAKE_CXX = g++-4.0 diff --git a/mkspecs/macx-g++42/qmake.conf b/mkspecs/macx-g++42/qmake.conf index 3244a9c94a..afbe658dfa 100644 --- a/mkspecs/macx-g++42/qmake.conf +++ b/mkspecs/macx-g++42/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 QMAKE_CC = gcc-4.2 QMAKE_CXX = g++-4.2 diff --git a/mkspecs/macx-ios-clang/Info.plist.lib b/mkspecs/macx-ios-clang/Info.plist.lib index 2a44d1721e..7cbdb9af12 100644 --- a/mkspecs/macx-ios-clang/Info.plist.lib +++ b/mkspecs/macx-ios-clang/Info.plist.lib @@ -14,6 +14,8 @@ <string>@TYPEINFO@</string> <key>CFBundleExecutable</key> <string>@LIBRARY@</string> + <key>CFBundleIdentifier</key> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index d5e5840902..595b11e7c1 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -2,12 +2,8 @@ # qmake configuration for macx-ios-clang # -MAKEFILE_GENERATOR = UNIX -CONFIG += app_bundle reduce_exports incremental global_init_link_order lib_version_first plugin_no_soname sdk -QMAKE_INCREMENTAL_STYLE = sublib - QMAKE_MACOSX_DEPLOYMENT_TARGET = -QMAKE_IOS_DEPLOYMENT_TARGET = 6.0 +QMAKE_IOS_DEPLOYMENT_TARGET = 7.0 INCLUDEPATH += $$PWD/ios DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG diff --git a/mkspecs/macx-ios-clang/xcodebuild.mk b/mkspecs/macx-ios-clang/xcodebuild.mk index 1bd18430df..4ff9c5a9c1 100644 --- a/mkspecs/macx-ios-clang/xcodebuild.mk +++ b/mkspecs/macx-ios-clang/xcodebuild.mk @@ -40,17 +40,17 @@ $(EXPORT_SUBTARGETS): % : %-build %-install: ACTION = install %-install: xcodebuild-% ; -# iOS Simulator doesn't support archiving -%-iphonesimulator-install: ACTION = build -iphonesimulator-install: ACTION = build +# Simulator doesn't support archiving +%-simulator-install: ACTION = build +simulator-install: ACTION = build # Limit check to a single configuration -%-iphoneos-check: check-iphoneos ; -%-iphonesimulator-check: check-iphonesimulator ; +%-device-check: check-device ; +%-simulator-check: check-simulator ; # SDK -%-iphoneos: SDK = iphoneos -%-iphonesimulator: SDK = iphonesimulator +%-device: SDK = iphoneos +%-simulator: SDK = iphonesimulator # Configuration release-%: CONFIGURATION = Release @@ -67,8 +67,8 @@ ifneq ($(filter check%,$(MAKECMDGOALS)),) endif endif -%-iphonesimulator: DEVICES = $(firstword $(IPHONESIMULATOR_DEVICES)) -%-iphoneos: DEVICES = $(IPHONEOS_DEVICES) +%-simulator: DEVICES = $(firstword $(IPHONESIMULATOR_DEVICES)) +%-device: DEVICES = $(IPHONEOS_DEVICES) IPHONEOS_GENERIC_DESTINATION := "generic/platform=iOS" IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /\((.*?)\)/' | tail -n 1)" diff --git a/mkspecs/macx-llvm/qmake.conf b/mkspecs/macx-llvm/qmake.conf index b4dd97f024..a22d2dfef3 100644 --- a/mkspecs/macx-llvm/qmake.conf +++ b/mkspecs/macx-llvm/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/llvm.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42 diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf b/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf deleted file mode 100644 index fb16348487..0000000000 --- a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -# qmake configuration for wince-msvc2005 -# -# Written for Microsoft VS 2005 for WindowsCE 6.0 (ARMV4I) -# This is just a template for creating Windows CE 6 mkspecs. -# - -include(../common/wince/qmake.conf) - -CE_SDK = STANDARDSDK_600 # replace with actual SDK name -CE_ARCH = ARMV4I - -DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _ARMV4I_ armv4i _ARM_ ARM _M_ARM ARM _WIN32 __arm__ - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = - -QMAKE_RC = rc /DUNDER_CE=600 /D_WIN32_WCE=0x600 - diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h b/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince60standard-x86-msvc2005/qmake.conf b/mkspecs/wince60standard-x86-msvc2005/qmake.conf deleted file mode 100644 index 417de0d688..0000000000 --- a/mkspecs/wince60standard-x86-msvc2005/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -# qmake configuration for wince-msvc2005 -# -# Written for Microsoft VS 2005 for WindowsCE 6.0 (x86) -# This is just a template for creating Windows CE 6 mkspecs. -# - -include(../common/wince/qmake.conf) - -CE_SDK = STANDARDSDK_600 # replace with actual SDK name -CE_ARCH = x86 - -DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _X86_ _M_IX86 - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = - -QMAKE_RC = rc /DUNDER_CE=600 /D_WIN32_WCE=0x600 - diff --git a/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h b/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf deleted file mode 100644 index 860fbc0e6a..0000000000 --- a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf +++ /dev/null @@ -1,29 +0,0 @@ -# qmake configuration for Windows Embedded Compact 7 with VS2008 on ARM targets -# -# This is just a template for creating WEC7 mkspecs for ARM targets -# Replace the SDK name with actual SDK name. - -include(../common/wince/qmake.conf) - -CE_SDK = WEC7_SDK_NAME # replace with actual SDK name -CE_ARCH = armv4i - -DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _AMRV7_ armv7 _ARM_ - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = -QMAKE_LIBS_OPENVG = libopenvg.lib -QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib - -QMAKE_RC = rc - -QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 -QMAKE_COMPILER_DEFINES += _MSC_VER=1500 diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h b/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf b/mkspecs/wince70embedded-x86-msvc2008/qmake.conf deleted file mode 100644 index 4d995db332..0000000000 --- a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# qmake configuration for Windows Embedded Compact 7 with VS2008 platform builder target -# -# - -include(../common/wince/qmake.conf) - -CE_SDK = Platform Builder -CE_ARCH = _TGTCPU - -DEFINES += QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _X86_ _M_IX86 - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = -QMAKE_LIBS_OPENVG = libopenvg.lib - -QMAKE_RC = rc - -QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 -QMAKE_COMPILER_DEFINES += _MSC_VER=1500 diff --git a/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h b/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf deleted file mode 100644 index 3712c94778..0000000000 --- a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf +++ /dev/null @@ -1,44 +0,0 @@ -# qmake configuration for Windows Embedded Compact 2013 with VS2012 on ARM targets -# -# This is just a template for creating WEC2013 mkspecs for ARM targets -# Replace the SDK name with actual SDK name. - -include(../common/wince/qmake.conf) - -CE_SDK = Toradex_CE800 # replace with actual SDK name -CE_ARCH = ARMV7 -QT_CONFIG -= accessibility - -DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM QT_NO_WINCE_SHELLSDK QT_NO_WINCE_NUIOUSER - -#QMAKE_CXXFLAGS += /P -QMAKE_CFLAGS_RELEASE += -O2 -MT -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi -QMAKE_CFLAGS_DEBUG += -Zi -MTd -QMAKE_CFLAGS_RELEASE -= -MD -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -MD -QMAKE_CFLAGS_DEBUG -= -MDd -QMAKE_CXXFLAGS_RELEASE -= -MD -QMAKE_CXXFLAGS_RELEASE += -MT -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -MT -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -MD -QMAKE_CXXFLAGS_DEBUG -= -MDd -QMAKE_CXXFLAGS_DEBUG += -MTd -QMAKE_INCDIR_OPENGL_ES2 += $$(NV_WINCE_T2_PLAT)/include -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = coredll.lib -QMAKE_LIBS_CORE = ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib - -MAKEFILE_GENERATOR = MSBUILD -VCPROJ_EXTENSION = .vcxproj - -QMAKE_RC = rc - -QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 -QMAKE_COMPILER_DEFINES += _MSC_VER=1700 diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h b/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 405bbf9212..4ce6b7a59e 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -8,8 +8,7 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \ makefile.o unixmake2.o unixmake.o \ mingw_make.o winmakefile.o projectgenerator.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ - msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o \ - cesdkhandler.o + msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o \ @@ -36,7 +35,7 @@ DEPEND_SRC = \ $(QMKGENSRC)/mac/pbuilder_pbx.cpp \ $(QMKGENSRC)/win32/winmakefile.cpp \ $(QMKGENSRC)/win32/mingw_make.cpp $(QMKGENSRC)/win32/msvc_nmake.cpp \ - $(QMKGENSRC)/win32/cesdkhandler.cpp $(QMKGENSRC)/mac/xmloutput.cpp \ + $(QMKGENSRC)/mac/xmloutput.cpp \ $(QMKGENSRC)/win32/msvc_vcproj.cpp $(QMKGENSRC)/win32/msvc_vcxproj.cpp \ $(QMKGENSRC)/win32/msvc_objectmodel.cpp $(QMKGENSRC)/win32/msbuild_objectmodel.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ @@ -207,9 +206,6 @@ msvc_vcxproj.o: $(QMKSRC)/generators/win32/msvc_vcxproj.cpp msvc_nmake.o: $(QMKSRC)/generators/win32/msvc_nmake.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -cesdkhandler.o: $(QMKSRC)/generators/win32/cesdkhandler.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - pbuilder_pbx.o: $(QMKSRC)/generators/mac/pbuilder_pbx.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 1d50f872d9..432d6eb5e8 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -67,8 +67,7 @@ OBJS = project.obj main.obj ioutils.obj proitems.obj qmakevfs.obj \ option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj \ makefiledeps.obj metamakefile.obj xmloutput.obj \ msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj \ - msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj \ - cesdkhandler.obj + msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj #qt code QTOBJS= \ diff --git a/qmake/generators/win32/cesdkhandler.cpp b/qmake/generators/win32/cesdkhandler.cpp deleted file mode 100644 index f45cbf74a9..0000000000 --- a/qmake/generators/win32/cesdkhandler.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "cesdkhandler.h" - -#include <qfile.h> -#include <qfileinfo.h> -#include <qdebug.h> -#include <qxmlstream.h> -#include <qsettings.h> -#include <qtextstream.h> - -QT_BEGIN_NAMESPACE - -struct PropertyContainer -{ - void clear() { name.clear(); value.clear(); properties.clear(); } - QString name; - QString value; - QMap<QString, PropertyContainer> properties; -}; -Q_DECLARE_TYPEINFO(PropertyContainer, Q_MOVABLE_TYPE); - -CeSdkInfo::CeSdkInfo() : m_major(0) , m_minor(0) -{ -} - -CeSdkHandler::CeSdkHandler() -{ -} - -struct ContainsPathKey -{ - bool operator()(const QString &val) const - { - return !(val.endsWith(QLatin1String("MSBuildToolsPath")) - || val.endsWith(QLatin1String("MSBuildToolsRoot"))); - } -}; - -struct ValueFromKey -{ - explicit ValueFromKey(const QSettings *settings) : settings(settings) {} - QString operator()(const QString &key) const - { - return settings->value(key).toString(); - } - - const QSettings *settings; -}; - -bool CeSdkHandler::parseMsBuildFile(QFile *file, CeSdkInfo *info) -{ - bool result = file->open(QFile::ReadOnly | QFile::Text); - const QString IncludePath = QStringLiteral("IncludePath"); - const QString LibraryPath = QStringLiteral("LibraryPath"); - const QString PreprocessorDefinitions = QStringLiteral("PreprocessorDefinitions"); - const QString SdkRootPathString = QStringLiteral("SdkRootPath"); - const QString ExecutablePath = QStringLiteral("ExecutablePath"); - enum ParserState{Not, Include, Lib, Define, BinDir, SdkRootPath}; - QString includePath; - QString libraryPath; - QString defines; - QString binDirs; - QString sdkRootPath; - ParserState state = Not; - if (result) { - QXmlStreamReader xml(file); - while (!xml.atEnd()) { - if (xml.isStartElement()) { - if (xml.name() == IncludePath) - state = Include; - else if (xml.name() == LibraryPath) - state = Lib; - else if (xml.name() == PreprocessorDefinitions) - state = Define; - else if (xml.name() == SdkRootPathString) - state = SdkRootPath; - else if (xml.name() == ExecutablePath) - state = BinDir; - else - state = Not; - } else if (xml.isEndElement()) { - state = Not; - } else if (xml.isCharacters()) { - switch (state) { - case Include: - includePath += xml.text(); - break; - case Lib: - libraryPath += xml.text(); - break; - case Define: - defines += xml.text(); - break; - case SdkRootPath: - sdkRootPath = xml.text().toString(); - break; - case BinDir: - binDirs += xml.text(); - case(Not): - break; - } - } - xml.readNext(); - } - } - file->close(); - const bool success = result && !includePath.isEmpty() && !libraryPath.isEmpty() && - !defines.isEmpty() && !sdkRootPath.isEmpty(); - if (success) { - const QString startPattern = QStringLiteral("$(Registry:"); - const int startIndex = sdkRootPath.indexOf(startPattern); - const int endIndex = sdkRootPath.lastIndexOf(QLatin1Char(')')); - const QString regString = sdkRootPath.mid(startIndex + startPattern.size(), - endIndex - startIndex - startPattern.size()); - QSettings sdkRootPathRegistry(regString, QSettings::NativeFormat); - const QString erg = sdkRootPathRegistry.value(QStringLiteral(".")).toString(); - const QString fullSdkRootPath = erg + sdkRootPath.mid(endIndex + 1); - const QLatin1String rootString("$(SdkRootPath)"); - - includePath = includePath.replace(rootString, fullSdkRootPath); - libraryPath = libraryPath.replace(rootString, fullSdkRootPath); - binDirs = binDirs.replace(rootString, fullSdkRootPath); - info->m_include = includePath + ";$(INCLUDE)"; - info->m_lib = libraryPath; - info->m_bin = binDirs; - } - return success; -} - -QStringList CeSdkHandler::getMsBuildToolPaths() const -{ - QSettings msbuildEntries("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\MSBuild\\ToolsVersions", - QSettings::NativeFormat); - const QStringList allKeys = msbuildEntries.allKeys(); - QStringList toolVersionKeys; - toolVersionKeys.push_back(QStringLiteral("c:\\Program Files\\MSBuild\\")); - std::remove_copy_if(allKeys.cbegin(), allKeys.cend(), - std::back_inserter(toolVersionKeys), ContainsPathKey()); - QStringList toolVersionValues; - std::transform(toolVersionKeys.constBegin(), toolVersionKeys.constEnd(), - std::back_inserter(toolVersionValues), - ValueFromKey(&msbuildEntries)); - return toolVersionValues; -} - -QStringList CeSdkHandler::filterMsBuildToolPaths(const QStringList &paths) const -{ - QStringList result; - for (const QString &path : paths) { - QDir dirVC110(path); - if (path.endsWith(QLatin1String("bin"))) - dirVC110.cdUp(); - QDir dirVC120 = dirVC110; - if (dirVC110.cd(QStringLiteral("Microsoft.Cpp\\v4.0\\V110\\Platforms"))) - result << dirVC110.absolutePath(); - if (dirVC120.cd(QStringLiteral("Microsoft.Cpp\\v4.0\\V120\\Platforms"))) - result << dirVC120.absolutePath(); - } - return result; -} - -bool CeSdkHandler::retrieveEnvironment(const QStringList &relativePaths, - const QStringList &toolPaths, - CeSdkInfo *info) -{ - bool result = false; - for (const QString &path : toolPaths) { - const QDir dir(path); - for (const QString &filePath : relativePaths) { - QFile file(dir.absoluteFilePath(filePath)); - if (file.exists()) - result = parseMsBuildFile(&file, info) || result; - } - } - - return result; -} - -void CeSdkHandler::retrieveWEC2013SDKs() -{ - const QStringList toolPaths = getMsBuildToolPaths(); - const QStringList filteredToolPaths = filterMsBuildToolPaths(toolPaths); - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows CE Tools\\SDKs", QSettings::NativeFormat); - const QStringList keys = settings.allKeys(); - for (const QString &key : keys) { - if (key.contains(QLatin1String("SDKInformation")) || key.contains(QLatin1Char('.'))) { - QFile sdkPropertyFile(settings.value(key).toString()); - if (!sdkPropertyFile.exists()) - continue; - QFileInfo info(sdkPropertyFile); - if (info.isDir()) { - const QDir dir = info.absoluteFilePath(); - QFileInfo fInfo(dir.filePath(QLatin1String("Properties.xml"))); - if (fInfo.exists()) - sdkPropertyFile.setFileName(fInfo.absoluteFilePath()); - } - if (!sdkPropertyFile.open(QFile::ReadOnly)) - continue; - QXmlStreamReader xml(&sdkPropertyFile); - QString currentElement; - QString curName; - PropertyContainer currentProperty; - QVector<PropertyContainer> propStack; - propStack.push_back(currentProperty); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement()) { - currentElement = xml.name().toString(); - if (currentElement == QLatin1String("Property")) { - QXmlStreamAttributes attributes = xml.attributes(); - if (attributes.hasAttribute(QLatin1String("NAME"))) - curName = attributes.value(QLatin1String("NAME")).toString(); - Q_ASSERT(!curName.isEmpty()); - currentProperty.clear(); - currentProperty.name = curName; - propStack.push_back(currentProperty); - } else if (currentElement == QLatin1String("PropertyBag")) { - QXmlStreamAttributes attributes = xml.attributes(); - if (attributes.hasAttribute(QLatin1String("NAME"))) - curName = attributes.value(QLatin1String("NAME")).toString(); - Q_ASSERT(!curName.isEmpty()); - currentProperty.clear(); - currentProperty.name = curName; - propStack.push_back(currentProperty); - } - } else if (xml.isEndElement()) { - currentElement = xml.name().toString(); - PropertyContainer self = propStack.takeLast(); - if (currentElement != QLatin1String("Root")) { - PropertyContainer &last = propStack.last(); - last.properties[self.name] = self; - } else { - currentProperty = self; - } - } else if (xml.isCharacters()) { - PropertyContainer &self = propStack.last(); - self.value = xml.text().toString(); - } - } - - if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { - qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); - return; - } - CeSdkInfo currentSdk; - const PropertyContainer &cpuInfo = currentProperty.properties.value(QLatin1String("CPU info")); - if (cpuInfo.properties.isEmpty()) - continue; - const PropertyContainer &cpuInfoVal = cpuInfo.properties.first().properties.value(QLatin1String("CpuName")); - if (cpuInfoVal.name != QLatin1String("CpuName")) - continue; - const QString SDKName = QStringLiteral("SDK name"); - currentSdk.m_name = currentProperty.properties.value(SDKName).value+ - QStringLiteral(" (") + cpuInfoVal.value + ")"; - currentSdk.m_major = currentProperty.properties.value(QLatin1String("OSMajor")).value.toInt(); - currentSdk.m_minor = currentProperty.properties.value(QLatin1String("OSMinor")).value.toInt(); - retrieveEnvironment(currentProperty.properties.value(QLatin1String("MSBuild Files110")).value.split(';'), - filteredToolPaths, ¤tSdk); - retrieveEnvironment(currentProperty.properties.value(QLatin1String("MSBuild Files120")).value.split(';'), - filteredToolPaths, ¤tSdk); - if (!currentSdk.m_include.isEmpty()) - m_list.append(currentSdk); - } - } -} - -void CeSdkHandler::retrieveWEC6n7SDKs() -{ - // look at the file at %VCInstallDir%/vcpackages/WCE.VCPlatform.config - // and scan through all installed sdks... - m_vcInstallDir = QString::fromLatin1(qgetenv("VCInstallDir")); - if (m_vcInstallDir.isEmpty()) - return; - - QDir vStudioDir(m_vcInstallDir); - if (!vStudioDir.cd(QLatin1String("vcpackages"))) - return; - - QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config"))); - if (!configFile.open(QIODevice::ReadOnly)) - return; - - QString currentElement; - CeSdkInfo currentItem; - QXmlStreamReader xml(&configFile); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement()) { - currentElement = xml.name().toString(); - if (currentElement == QLatin1String("Platform")) { - currentItem = CeSdkInfo(); - } else if (currentElement == QLatin1String("Directories")) { - QXmlStreamAttributes attr = xml.attributes(); - currentItem.m_include = fixPaths(attr.value(QLatin1String("Include")).toString()); - currentItem.m_lib = fixPaths(attr.value(QLatin1String("Library")).toString()); - currentItem.m_bin = fixPaths(attr.value(QLatin1String("Path")).toString()); - } - } else if (xml.isEndElement()) { - if (xml.name().toString() == QLatin1String("Platform")) - m_list.append(currentItem); - } else if (xml.isCharacters() && !xml.isWhitespace()) { - if (currentElement == QLatin1String("PlatformName")) - currentItem.m_name = xml.text().toString(); - else if (currentElement == QLatin1String("OSMajorVersion")) - currentItem.m_major = xml.text().toString().toInt(); - else if (currentElement == QLatin1String("OSMinorVersion")) - currentItem.m_minor = xml.text().toString().toInt(); - } - } - - if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { - qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); - return; - } -} - -bool CeSdkHandler::retrieveAvailableSDKs() -{ - m_list.clear(); - retrieveWEC2013SDKs(); - retrieveWEC6n7SDKs(); - return !m_list.empty(); -} - -QString CeSdkHandler::fixPaths(const QString &path) const -{ - QRegExp searchStr(QLatin1String("(\\$\\(\\w+\\))")); - QString fixedString = path; - for (int index = fixedString.indexOf(searchStr, 0); - index >= 0; - index = fixedString.indexOf(searchStr, index)) { - const QString capture = searchStr.cap(0); - fixedString.replace(index, capture.length(), capture.toUpper()); - index += capture.length(); // don't count the zero terminator - fixedString.insert(index, '\\'); // the configuration file lacks a directory separator for env vars - ++index; - } - return fixedString; -} - -QT_END_NAMESPACE diff --git a/qmake/generators/win32/cesdkhandler.h b/qmake/generators/win32/cesdkhandler.h deleted file mode 100644 index 3bb8d2adcb..0000000000 --- a/qmake/generators/win32/cesdkhandler.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CE_SDK_HANDLER_INCL -#define CE_SDK_HANDLER_INCL - -#include <qstringlist.h> -#include <qdir.h> - -QT_BEGIN_NAMESPACE - -class CeSdkInfo -{ -public: - CeSdkInfo(); - inline QString name() const { return m_name; } - inline QString binPath() const { return m_bin; } - inline QString includePath() const { return m_include; } - inline QString libPath() const { return m_lib; } - inline bool isValid() const; - inline int majorVersion() const { return m_major; } - inline int minorVersion() const { return m_minor; } - inline bool isSupported() const { return m_major >= 5; } -private: - friend class CeSdkHandler; - QString m_name; - QString m_bin; - QString m_include; - QString m_lib; - int m_major; - int m_minor; -}; - -bool CeSdkInfo::isValid() const -{ - return !m_name.isEmpty() && - !m_bin.isEmpty() && - !m_include.isEmpty() && - !m_lib.isEmpty(); -} - -class CeSdkHandler -{ -public: - CeSdkHandler(); - bool retrieveAvailableSDKs(); - inline QList<CeSdkInfo> listAll() const { return m_list; } -private: - void retrieveWEC6n7SDKs(); - void retrieveWEC2013SDKs(); - inline QString fixPaths(const QString &path) const; - QStringList getMsBuildToolPaths() const; - QStringList filterMsBuildToolPaths(const QStringList &paths) const; - bool parseMsBuildFile(QFile *file, CeSdkInfo *info); - bool retrieveEnvironment(const QStringList &relativePaths, - const QStringList &toolPaths, - CeSdkInfo *info); - QList<CeSdkInfo> m_list; - QString m_vcInstallDir; -}; - -QT_END_NAMESPACE - -#endif diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index d8ac80f99d..9e1af05414 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -28,7 +28,6 @@ #include "msvc_nmake.h" #include "option.h" -#include "cesdkhandler.h" #include <qregexp.h> #include <qdir.h> @@ -72,38 +71,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return MakefileGenerator::writeStubMakefile(t); #endif if (!project->isHostBuild()) { - const ProValueMap &variables = project->variables(); - if (project->isActiveConfig("wince")) { - CeSdkHandler sdkhandler; - sdkhandler.retrieveAvailableSDKs(); - const QString sdkName = variables["CE_SDK"].join(' ') - + " (" + variables["CE_ARCH"].join(' ') + ")"; - const QList<CeSdkInfo> sdkList = sdkhandler.listAll(); - CeSdkInfo sdk; - for (const CeSdkInfo &info : sdkList) { - if (info.name().compare(sdkName, Qt::CaseInsensitive ) == 0) { - sdk = info; - break; - } - } - if (sdk.isValid()) { - t << "\nINCLUDE = " << sdk.includePath(); - t << "\nLIB = " << sdk.libPath(); - t << "\nPATH = " << sdk.binPath() << "\n"; - } else { - QStringList sdkStringList; - sdkStringList.reserve(sdkList.size()); - for (const CeSdkInfo &info : sdkList) - sdkStringList << info.name(); - - fprintf(stderr, "Failed to find Windows CE SDK matching %s, found: %s\n" - "SDK needs to be specified in mkspec (using: %s/qmake.conf)\n" - "SDK name needs to match the following format: CE_SDK (CE_ARCH)\n", - qPrintable(sdkName), qPrintable(sdkStringList.join(", ")), - qPrintable(variables["QMAKESPEC"].first().toQString())); - return false; - } - } else if (project->isActiveConfig(QStringLiteral("winrt"))) { + if (project->isActiveConfig(QStringLiteral("winrt"))) { QString arch = project->first("VCPROJ_ARCH").toQString().toLower(); QString compiler; QString compilerArch; @@ -614,12 +582,6 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) writeLinkCommand(t); } } - QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE"); - bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && - !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); - if(useSignature) { - t << "\n\tsigntool sign /F " << escapeFilePath(signature) << " $(DESTDIR_TARGET)"; - } if(!project->isEmpty("QMAKE_POST_LINK")) { t << "\n\t" << var("QMAKE_POST_LINK"); } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index a972316972..ef957b6dbf 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -700,9 +700,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString slnConf = _slnSolutionConf; if (!project->isEmpty("VCPROJ_ARCH")) { slnConf.replace(QLatin1String("|Win32"), "|" + project->first("VCPROJ_ARCH")); - } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { - QString slnPlatform = QString("|") + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; - slnConf.replace(QLatin1String("|Win32"), slnPlatform); } else if (is64Bit) { slnConf.replace(QLatin1String("|Win32"), QLatin1String("|x64")); } @@ -717,8 +714,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString xplatform = platform; if (!project->isEmpty("VCPROJ_ARCH")) { xplatform = project->first("VCPROJ_ARCH").toQString(); - } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { - xplatform = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } if (!project->isHostBuild()) platform = xplatform; @@ -976,10 +971,8 @@ void VcprojGenerator::initProject() vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString(); if (!project->isEmpty("VCPROJ_ARCH")) { vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString(); - } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { + } else if (project->isHostBuild()) { vcProject.PlatformName = (is64Bit ? "x64" : "Win32"); - } else { - vcProject.PlatformName = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } vcProject.SdkVersion = project->first("WINSDK_VER").toQString(); // These are not used by Qt, but may be used by customers @@ -1060,10 +1053,8 @@ void VcprojGenerator::initConfiguration() conf.ConfigurationName = conf.Name; if (!project->isEmpty("VCPROJ_ARCH")) { conf.Name += "|" + project->first("VCPROJ_ARCH"); - } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { + } else if (project->isHostBuild()) { conf.Name += (is64Bit ? "|x64" : "|Win32"); - } else { - conf.Name += "|" + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True); conf.BuildBrowserInformation = triState(temp.isEmpty() ? (short)unset : temp.toShort()); @@ -1086,8 +1077,7 @@ void VcprojGenerator::initConfiguration() initPreBuildEventTools(); initPostBuildEventTools(); // Only deploy for CE and WinRT projects - if ((!project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) - || conf.WinRT) + if (!project->isHostBuild() || conf.WinRT) initDeploymentTool(); initWinDeployQtTool(); initPreLinkEventTools(); @@ -1235,16 +1225,6 @@ void VcprojGenerator::initPostBuildEventTools() conf.postBuild.Description = cmdline.join(QLatin1String("\r\n")); conf.postBuild.ExcludedFromBuild = _False; } - - QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE"); - bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && - !project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); - if (useSignature) { - conf.postBuild.CommandLine.prepend( - QLatin1String("signtool sign /F ") + escapeFilePath(signature) + QLatin1String(" \"$(TargetPath)\"")); - conf.postBuild.ExcludedFromBuild = _False; - } - if (!project->values("MSVCPROJ_COPY_DLL").isEmpty()) { conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); @@ -1338,45 +1318,6 @@ void VcprojGenerator::initDeploymentTool() } } - if (!conf.WinRT) { - // C-runtime deployment - QString runtime = project->values("QT_CE_C_RUNTIME").join(QLatin1Char(' ')); - if (!runtime.isEmpty() && (runtime != QLatin1String("no"))) { - QString runtimeVersion = QLatin1String("msvcr"); - ProString mkspec = project->first("QMAKESPEC"); - - if (!mkspec.isEmpty()) { - if (mkspec.endsWith("2008")) - runtimeVersion.append("90"); - else - runtimeVersion.append("80"); - if (project->isActiveConfig("debug")) - runtimeVersion.append("d"); - runtimeVersion.append(".dll"); - - if (runtime == "yes") { - // Auto-find C-runtime - QString vcInstallDir = qgetenv("VCINSTALLDIR"); - if (!vcInstallDir.isEmpty()) { - vcInstallDir += "\\ce\\dll\\"; - vcInstallDir += project->values("CE_ARCH").join(QLatin1Char(' ')); - if (!QFileInfo::exists(vcInstallDir + QDir::separator() + runtimeVersion)) - runtime.clear(); - else - runtime = vcInstallDir; - } - } - } - - if (!runtime.isEmpty() && runtime != QLatin1String("yes")) { - conf.deployment.AdditionalFiles += runtimeVersion - + "|" + QDir::toNativeSeparators(runtime) - + "|" + targetPath - + "|0;"; - } - } - } - for (const ProString &item : project->values("INSTALLS")) { // get item.path QString devicePath = project->first(ProKey(item + ".path")).toQString(); diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 782151d763..7f49bb9adb 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -11,8 +11,7 @@ SOURCES += project.cpp property.cpp main.cpp \ generators/win32/msvc_nmake.cpp generators/projectgenerator.cpp \ generators/win32/msvc_vcproj.cpp \ generators/win32/msvc_vcxproj.cpp \ - generators/win32/msvc_objectmodel.cpp generators/win32/msbuild_objectmodel.cpp \ - generators/win32/cesdkhandler.cpp + generators/win32/msvc_objectmodel.cpp generators/win32/msbuild_objectmodel.cpp HEADERS += project.h property.h \ library/qmake_global.h library/ioutils.h library/proitems.h library/qmakevfs.h library/qmakeglobals.h \ @@ -24,8 +23,7 @@ HEADERS += project.h property.h \ generators/xmloutput.h generators/win32/msvc_nmake.h \ generators/win32/msvc_vcproj.h \ generators/win32/msvc_vcxproj.h \ - generators/win32/msvc_objectmodel.h generators/win32/msbuild_objectmodel.h \ - generators/win32/cesdkhandler.h + generators/win32/msvc_objectmodel.h generators/win32/msbuild_objectmodel.h bootstrap { #Qt code SOURCES+= \ diff --git a/qtbase.pro b/qtbase.pro index 11cff9e8bf..34f6704752 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -121,14 +121,14 @@ FWD_FEATURES_H = \ write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.") no_features = -lines = $$cat($$absolute_path($$QT_QCONFIG_PATH, $$PWD/src/corelib/global), lines) +lines = $$cat($$OUT_PWD/src/corelib/global/qconfig.h, lines) for (line, lines) { # We ignore all defines that don't follow the #ifndef + indent pattern. # This makes it possible to have unchecked defines which are no features. t = $$replace(line, "^$${LITERAL_HASH} define QT_NO_(\\S+)\\s*$", "\\1") !isEqual(t, $$line) { isEmpty(features.$${t}.name): \ - error("$$QT_QCONFIG_PATH disables unknown feature $$t") + error("qconfig.h disables unknown feature $$t") no_features += $$t } } diff --git a/src/3rdparty/double-conversion/include/double-conversion/utils.h b/src/3rdparty/double-conversion/include/double-conversion/utils.h index a89b284eda..20bfd36c84 100644 --- a/src/3rdparty/double-conversion/include/double-conversion/utils.h +++ b/src/3rdparty/double-conversion/include/double-conversion/utils.h @@ -74,8 +74,6 @@ #else #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS #endif // _WIN32 -#elif defined(WINCE) || defined(_WIN32_WCE) -#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 #elif defined(__ghs) // Green Hills toolchain uses a 64bit wide floating point stack #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 diff --git a/src/3rdparty/freetype_dependency.pri b/src/3rdparty/freetype_dependency.pri index 39280deb2f..7513e40bfd 100644 --- a/src/3rdparty/freetype_dependency.pri +++ b/src/3rdparty/freetype_dependency.pri @@ -1,7 +1,7 @@ -contains(QT_CONFIG, freetype) { - INCLUDEPATH += $$PWD/freetype/include - LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix() -} else:contains(QT_CONFIG, system-freetype) { +contains(QT_CONFIG, system-freetype) { # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) +} else: contains(QT_CONFIG, freetype) { + INCLUDEPATH += $$PWD/freetype/include + LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix() } diff --git a/src/3rdparty/harfbuzz_dependency.pri b/src/3rdparty/harfbuzz_dependency.pri index 74433688f6..36abbfbe35 100644 --- a/src/3rdparty/harfbuzz_dependency.pri +++ b/src/3rdparty/harfbuzz_dependency.pri @@ -1,6 +1,6 @@ -contains(QT_CONFIG, harfbuzz) { +contains(QT_CONFIG, system-harfbuzz) { + LIBS_PRIVATE += -lharfbuzz +} else: contains(QT_CONFIG, harfbuzz) { INCLUDEPATH += $$PWD/harfbuzz-ng/include LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtharfbuzzng$$qtPlatformTargetSuffix() -} else:contains(QT_CONFIG, system-harfbuzz) { - LIBS_PRIVATE += -lharfbuzz } diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index ec617386a4..0f7c2b887b 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -1,4 +1,4 @@ -win32|wince:HEADERS += arch/qatomic_msvc.h +win32:HEADERS += arch/qatomic_msvc.h HEADERS += \ arch/qatomic_bootstrap.h \ diff --git a/src/corelib/arch/qatomic_msvc.h b/src/corelib/arch/qatomic_msvc.h index 62d54ded55..5eae2bdc48 100644 --- a/src/corelib/arch/qatomic_msvc.h +++ b/src/corelib/arch/qatomic_msvc.h @@ -45,8 +45,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// -#ifndef Q_OS_WINCE - // use compiler intrinsics for all atomic functions # define QT_INTERLOCKED_PREFIX _ # define QT_INTERLOCKED_PROTOTYPE @@ -58,36 +56,6 @@ # define Q_ATOMIC_INT64_IS_SUPPORTED # endif -#else // Q_OS_WINCE - -# if _WIN32_WCE < 0x600 && defined(_X86_) -// For X86 Windows CE, include winbase.h to catch inline functions which -// override the regular definitions inside of coredll.dll. -// Though one could use the original version of Increment/Decrement, others are -// not exported at all. -# include <winbase.h> - -// It's safer to remove the volatile and let the compiler add it as needed. -# define QT_INTERLOCKED_VOLATILE - -# else // _WIN32_WCE >= 0x600 || !_X86_ - -# define QT_INTERLOCKED_PROTOTYPE __cdecl -# define QT_INTERLOCKED_DECLARE_PROTOTYPES - -# if _WIN32_WCE >= 0x600 -# if defined(_X86_) -# define QT_INTERLOCKED_PREFIX _ -# define QT_INTERLOCKED_INTRINSIC -# endif -# else -# define QT_INTERLOCKED_VOLATILE -# endif - -# endif // _WIN32_WCE >= 0x600 || !_X86_ - -#endif // Q_OS_WINCE - //////////////////////////////////////////////////////////////////////////////////////////////////// // Prototype declaration @@ -128,7 +96,7 @@ extern "C" { long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long); long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); -# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +# if !defined(__i386__) && !defined(_M_IX86) void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); @@ -165,7 +133,7 @@ extern "C" { # pragma intrinsic (_InterlockedCompareExchange) # pragma intrinsic (_InterlockedExchangeAdd) -# if !defined(Q_OS_WINCE) && !defined(_M_IX86) +# if !defined(_M_IX86) # pragma intrinsic (_InterlockedCompareExchangePointer) # pragma intrinsic (_InterlockedExchangePointer) # pragma intrinsic (_InterlockedExchangeAdd64) @@ -176,7 +144,7 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////////////////////////// // Interlocked* replacement macros -#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86) +#if defined(__i386__) || defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ reinterpret_cast<void *>( \ @@ -195,7 +163,7 @@ extern "C" { reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \ (valueToAdd)) -#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +#else // !defined(__i386__) && !defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ QT_INTERLOCKED_FUNCTION(CompareExchangePointer)( \ @@ -213,7 +181,7 @@ extern "C" { reinterpret_cast<qint64 QT_INTERLOCKED_VOLATILE *>(value), \ (valueToAdd)) -#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +#endif // !defined(__i386__) && !defined(_M_IX86) //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index bfb677e6fb..b87d5f4e5d 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -41,19 +41,16 @@ contains(QT_CONFIG,icu) { codecs/qbig5codec.cpp unix:!qnx:!mac:!ios:!linux-android-* { - contains(QT_CONFIG,iconv) { - HEADERS += codecs/qiconvcodec_p.h - SOURCES += codecs/qiconvcodec.cpp - } else:contains(QT_CONFIG,gnu-libiconv) { - HEADERS += codecs/qiconvcodec_p.h - SOURCES += codecs/qiconvcodec.cpp - DEFINES += GNU_LIBICONV - LIBS_PRIVATE *= -liconv - } else:contains(QT_CONFIG,sun-libiconv) { - HEADERS += codecs/qiconvcodec_p.h - SOURCES += codecs/qiconvcodec.cpp - DEFINES += GNU_LIBICONV + contains(QT_CONFIG, iconv) { + HEADERS += codecs/qiconvcodec_p.h + SOURCES += codecs/qiconvcodec.cpp + contains(QT_CONFIG, gnu-libiconv) { + DEFINES += GNU_LIBICONV + LIBS_PRIVATE *= -liconv + } else: contains(QT_CONFIG, sun-libiconv) { + DEFINES += GNU_LIBICONV } + } } else:!win32-msvc* { DEFINES += QT_NO_ICONV } diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp index aa2095d9da..ee9f1d0048 100644 --- a/src/corelib/codecs/qicucodec.cpp +++ b/src/corelib/codecs/qicucodec.cpp @@ -527,7 +527,7 @@ QTextCodec *QIcuCodec::codecForNameUnlocked(const char *name) // check whether there is really a converter for the name available. UConverter *conv = ucnv_open(standardName, &error); if (!conv) { - qDebug() << "codecForName: ucnv_open failed" << standardName << u_errorName(error); + qDebug("codecForName: ucnv_open failed %s %s", standardName, u_errorName(error)); return 0; } //qDebug() << "QIcuCodec: Standard name for " << name << "is" << standardName; @@ -577,7 +577,7 @@ UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const ucnv_setSubstChars(static_cast<UConverter *>(state->d), state->flags & QTextCodec::ConvertInvalidToNull ? "\0" : "?", 1, &error); if (U_FAILURE(error)) - qDebug() << "getConverter(state) ucnv_open failed" << m_name << u_errorName(error); + qDebug("getConverter(state) ucnv_open failed %s %s", m_name, u_errorName(error)); } conv = static_cast<UConverter *>(state->d); } @@ -587,7 +587,7 @@ UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const conv = ucnv_open(m_name, &error); ucnv_setSubstChars(conv, "?", 1, &error); if (U_FAILURE(error)) - qDebug() << "getConverter(no state) ucnv_open failed" << m_name << u_errorName(error); + qDebug("getConverter(no state) ucnv_open failed %s %s", m_name, u_errorName(error)); } return conv; } @@ -610,7 +610,7 @@ QString QIcuCodec::convertToUnicode(const char *chars, int length, QTextCodec::C &chars, end, 0, false, &error); if (!U_SUCCESS(error) && error != U_BUFFER_OVERFLOW_ERROR) { - qDebug() << "convertToUnicode failed:" << u_errorName(error); + qDebug("convertToUnicode failed: %s", u_errorName(error)); break; } @@ -647,7 +647,7 @@ QByteArray QIcuCodec::convertFromUnicode(const QChar *unicode, int length, QText &uc, end, 0, false, &error); if (!U_SUCCESS(error)) - qDebug() << "convertFromUnicode failed:" << u_errorName(error); + qDebug("convertFromUnicode failed: %s", u_errorName(error)); convertedChars = ch - string.data(); if (uc >= end) break; diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index edb03af447..5098ac4242 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -132,7 +132,7 @@ bool qTextCodecNameMatch(const char *n, const char *h) } -#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined(QT_LOCALE_IS_UTF8) +#if !defined(Q_OS_WIN32) && !defined(QT_LOCALE_IS_UTF8) static QTextCodec *checkForCodec(const QByteArray &name) { QTextCodec *c = QTextCodec::codecForName(name); if (!c) { @@ -169,7 +169,7 @@ static QTextCodec *setupLocaleMapper() #if defined(QT_LOCALE_IS_UTF8) locale = QTextCodec::codecForName("UTF-8"); -#elif defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) locale = QTextCodec::codecForName("System"); #else @@ -289,7 +289,7 @@ static void setup() #if !defined(QT_NO_ICONV) (void) new QIconvCodec; #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) (void) new QWindowsLocalCodec; #endif // Q_OS_WIN32 #endif // !QT_NO_CODECS && !QT_BOOTSTRAPPED diff --git a/src/corelib/codecs/qwindowscodec.cpp b/src/corelib/codecs/qwindowscodec.cpp index 74c2f75d2b..e8f7e6f156 100644 --- a/src/corelib/codecs/qwindowscodec.cpp +++ b/src/corelib/codecs/qwindowscodec.cpp @@ -157,7 +157,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le state->remainingChars = 0; } const char *mb = mbcs; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) const char *next = 0; QString s; while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) { diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 362ac37a59..46887b7188 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -47,8 +47,16 @@ include(statemachine/statemachine.pri) include(mimetypes/mimetypes.pri) include(xml/xml.pri) -# otherwise mingw headers do not declare common functions like putenv -mingw: CONFIG -= strict_c++ +win32 { + mingw { + # otherwise mingw headers do not declare common functions like putenv + CONFIG -= strict_c++ + # Override MinGW's definition in _mingw.h + DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 + } + + !winrt: LIBS_PRIVATE += -lwinmm +} mac|darwin { !ios { diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index a022187c21..ae969ca269 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -131,26 +131,46 @@ absoluteValue = qAbs(myValue); //! [10] -//! [11] -qreal valueA = 2.3; -qreal valueB = 2.7; +//! [11A] +double valueA = 2.3; +double valueB = 2.7; int roundedValueA = qRound(valueA); // roundedValueA = 2 int roundedValueB = qRound(valueB); // roundedValueB = 3 -//! [11] +//! [11A] +//! [11B] +float valueA = 2.3; +float valueB = 2.7; -//! [12] -qreal valueA = 42949672960.3; -qreal valueB = 42949672960.7; +int roundedValueA = qRound(valueA); +// roundedValueA = 2 +int roundedValueB = qRound(valueB); +// roundedValueB = 3 +//! [11B] + + +//! [12A] +double valueA = 42949672960.3; +double valueB = 42949672960.7; + +qint64 roundedValueA = qRound64(valueA); +// roundedValueA = 42949672960 +qint64 roundedValueB = qRound64(valueB); +// roundedValueB = 42949672961 +//! [12A] + +//! [12B] +float valueA = 42949672960.3; +float valueB = 42949672960.7; qint64 roundedValueA = qRound64(valueA); // roundedValueA = 42949672960 qint64 roundedValueB = qRound64(valueB); // roundedValueB = 42949672961 -//! [12] +//! [12B] //! [13] diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 86d027eb35..9a61efd1b2 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1059,16 +1059,18 @@ # define Q_COMPILER_DEFAULT_DELETE_MEMBERS #endif -#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 -# define Q_DECL_CONSTEXPR constexpr -# define Q_DECL_RELAXED_CONSTEXPR constexpr -# define Q_CONSTEXPR constexpr -# define Q_RELAXED_CONSTEXPR constexpr -#elif defined Q_COMPILER_CONSTEXPR -# define Q_DECL_CONSTEXPR constexpr -# define Q_DECL_RELAXED_CONSTEXPR -# define Q_CONSTEXPR constexpr -# define Q_RELAXED_CONSTEXPR const +#if defined Q_COMPILER_CONSTEXPR +# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR constexpr +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR constexpr +# else +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR const +# endif #else # define Q_DECL_CONSTEXPR # define Q_DECL_RELAXED_CONSTEXPR diff --git a/src/corelib/global/qconfig-dist.h b/src/corelib/global/qconfig-dist.h deleted file mode 100644 index c9739db990..0000000000 --- a/src/corelib/global/qconfig-dist.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -/* - Empty leaves all features enabled. See doc/html/emb-features.html for choices. - - Note that disabling some features will produce a libqt that is not - compatible with other libqt builds. Such modifications are only - supported on Qt for Embedded Linux where reducing the library size is - important and where the application suite is often a fixed set. -*/ diff --git a/src/corelib/global/qconfig-large.h b/src/corelib/global/qconfig-large.h deleted file mode 100644 index 270858e65b..0000000000 --- a/src/corelib/global/qconfig-large.h +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Dialogs */ -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_FONTDIALOG -# define QT_NO_FONTDIALOG -#endif -#ifndef QT_NO_INPUTDIALOG -# define QT_NO_INPUTDIALOG -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PROGRESSDIALOG -# define QT_NO_PROGRESSDIALOG -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMAT_BMP -# define QT_NO_IMAGEFORMAT_BMP -#endif -#ifndef QT_NO_IMAGEFORMAT_PPM -# define QT_NO_IMAGEFORMAT_PPM -#endif - -/* Internationalization */ -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif - -/* ItemViews */ -#ifndef QT_NO_TABLEVIEW -# define QT_NO_TABLEVIEW -#endif -#ifndef QT_NO_TREEVIEW -# define QT_NO_TREEVIEW -#endif - -/* Kernel */ -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_PROPERTIES -# define QT_NO_PROPERTIES -#endif - -/* Networking */ -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif -#ifndef QT_NO_UDPSOCKET -# define QT_NO_UDPSOCKET -#endif -#ifndef QT_NO_FTP -# define QT_NO_FTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif - -/* Widgets */ -#ifndef QT_NO_CALENDARWIDGET -# define QT_NO_CALENDARWIDGET -#endif -#ifndef QT_NO_DATETIMEEDIT -# define QT_NO_DATETIMEEDIT -#endif -#ifndef QT_NO_DIAL -# define QT_NO_DIAL -#endif -#ifndef QT_NO_TABLEWIDGET -# define QT_NO_TABLEWIDGET -#endif -#ifndef QT_NO_TREEWIDGET -# define QT_NO_TREEWIDGET -#endif diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h deleted file mode 100644 index 830e936924..0000000000 --- a/src/corelib/global/qconfig-medium.h +++ /dev/null @@ -1,241 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Dialogs */ -#ifndef QT_NO_COLORDIALOG -# define QT_NO_COLORDIALOG -#endif -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_FONTDIALOG -# define QT_NO_FONTDIALOG -#endif -#ifndef QT_NO_INPUTDIALOG -# define QT_NO_INPUTDIALOG -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PROGRESSDIALOG -# define QT_NO_PROGRESSDIALOG -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMAT_BMP -# define QT_NO_IMAGEFORMAT_BMP -#endif -#ifndef QT_NO_IMAGEFORMAT_PPM -# define QT_NO_IMAGEFORMAT_PPM -#endif -#ifndef QT_NO_MOVIE -# define QT_NO_MOVIE -#endif - -/* Internationalization */ -#ifndef QT_NO_BIG_CODECS -# define QT_NO_BIG_CODECS -#endif -#ifndef QT_NO_TEXTCODEC -# define QT_NO_TEXTCODEC -#endif -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif - -/* ItemViews */ -#ifndef QT_NO_TABLEVIEW -# define QT_NO_TABLEVIEW -#endif -#ifndef QT_NO_TREEVIEW -# define QT_NO_TREEVIEW -#endif - -/* Kernel */ -#ifndef QT_NO_ACTION -# define QT_NO_ACTION -#endif -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_PROPERTIES -# define QT_NO_PROPERTIES -#endif -#ifndef QT_NO_SESSIONMANAGER -# define QT_NO_SESSIONMANAGER -#endif -#ifndef QT_NO_SHORTCUT -# define QT_NO_SHORTCUT -#endif -#ifndef QT_NO_WHEELEVENT -# define QT_NO_WHEELEVENT -#endif - -/* Networking */ -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif -#ifndef QT_NO_NETWORKPROXY -# define QT_NO_NETWORKPROXY -#endif -#ifndef QT_NO_SOCKS5 -# define QT_NO_SOCKS5 -#endif -#ifndef QT_NO_UDPSOCKET -# define QT_NO_UDPSOCKET -#endif -#ifndef QT_NO_FTP -# define QT_NO_FTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif - -/* Utilities */ -#ifndef QT_NO_UNDOCOMMAND -# define QT_NO_UNDOCOMMAND -#endif -#ifndef QT_NO_UNDOGROUP -# define QT_NO_UNDOGROUP -#endif -#ifndef QT_NO_UNDOSTACK -# define QT_NO_UNDOSTACK -#endif -#ifndef QT_NO_UNDOVIEW -# define QT_NO_UNDOVIEW -#endif -#ifndef QT_NO_GESTURES -# define QT_NO_GESTURES -#endif - -/* Widgets */ -#ifndef QT_NO_LCDNUMBER -# define QT_NO_LCDNUMBER -#endif -#ifndef QT_NO_CALENDARWIDGET -# define QT_NO_CALENDARWIDGET -#endif -#ifndef QT_NO_DATETIMEEDIT -# define QT_NO_DATETIMEEDIT -#endif -#ifndef QT_NO_MENU -# define QT_NO_MENU -#endif -#ifndef QT_NO_CONTEXTMENU -# define QT_NO_CONTEXTMENU -#endif -#ifndef QT_NO_MAINWINDOW -# define QT_NO_MAINWINDOW -#endif -#ifndef QT_NO_DOCKWIDGET -# define QT_NO_DOCKWIDGET -#endif -#ifndef QT_NO_TOOLBAR -# define QT_NO_TOOLBAR -#endif -#ifndef QT_NO_MENUBAR -# define QT_NO_MENUBAR -#endif -#ifndef QT_NO_PROGRESSBAR -# define QT_NO_PROGRESSBAR -#endif -#ifndef QT_NO_SIZEGRIP -# define QT_NO_SIZEGRIP -#endif -#ifndef QT_NO_DIAL -# define QT_NO_DIAL -#endif -#ifndef QT_NO_STACKEDWIDGET -# define QT_NO_STACKEDWIDGET -#endif -#ifndef QT_NO_TABWIDGET -# define QT_NO_TABWIDGET -#endif -#ifndef QT_NO_STATUSBAR -# define QT_NO_STATUSBAR -#endif -#ifndef QT_NO_STATUSTIP -# define QT_NO_STATUSTIP -#endif -#ifndef QT_NO_TABLEWIDGET -# define QT_NO_TABLEWIDGET -#endif -#ifndef QT_NO_TOOLBUTTON -# define QT_NO_TOOLBUTTON -#endif -#ifndef QT_NO_TABBAR -# define QT_NO_TABBAR -#endif -#ifndef QT_NO_TOOLBOX -# define QT_NO_TOOLBOX -#endif -#ifndef QT_NO_WHATSTHIS -# define QT_NO_WHATSTHIS -#endif -#ifndef QT_NO_TOOLTIP -# define QT_NO_TOOLTIP -#endif -#ifndef QT_NO_TREEWIDGET -# define QT_NO_TREEWIDGET -#endif diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h deleted file mode 100644 index 305655b1c9..0000000000 --- a/src/corelib/global/qconfig-minimal.h +++ /dev/null @@ -1,463 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Data structures */ -#ifndef QT_NO_TEXTDATE -# define QT_NO_TEXTDATE -#endif -#ifndef QT_NO_DATESTRING -# define QT_NO_DATESTRING -#endif - -/* Dialogs */ -#ifndef QT_NO_COLORDIALOG -# define QT_NO_COLORDIALOG -#endif -#ifndef QT_NO_ERRORMESSAGE -# define QT_NO_ERRORMESSAGE -#endif -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_FONTDIALOG -# define QT_NO_FONTDIALOG -#endif -#ifndef QT_NO_INPUTDIALOG -# define QT_NO_INPUTDIALOG -#endif -#ifndef QT_NO_MESSAGEBOX -# define QT_NO_MESSAGEBOX -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PRINTPREVIEWDIALOG -# define QT_NO_PRINTPREVIEWDIALOG -#endif -#ifndef QT_NO_PROGRESSDIALOG -# define QT_NO_PROGRESSDIALOG -#endif -#ifndef QT_NO_WIZARD -# define QT_NO_WIZARD -#endif - -/* File I/O */ -#ifndef QT_NO_DOM -# define QT_NO_DOM -#endif -#ifndef QT_NO_FILESYSTEMWATCHER -# define QT_NO_FILESYSTEMWATCHER -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_PROCESS -# define QT_NO_PROCESS -#endif -#ifndef QT_NO_TEMPORARYFILE -# define QT_NO_TEMPORARYFILE -#endif -#ifndef QT_NO_SETTINGS -# define QT_NO_SETTINGS -#endif -#ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY -#endif - -/* Fonts */ -#ifndef QT_NO_FREETYPE -# define QT_NO_FREETYPE -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMATPLUGIN -# define QT_NO_IMAGEFORMATPLUGIN -#endif -#ifndef QT_NO_IMAGEFORMAT_BMP -# define QT_NO_IMAGEFORMAT_BMP -#endif -#ifndef QT_NO_IMAGEFORMAT_JPEG -# define QT_NO_IMAGEFORMAT_JPEG -#endif -#ifndef QT_NO_IMAGEFORMAT_PNG -# define QT_NO_IMAGEFORMAT_PNG -#endif -#ifndef QT_NO_IMAGEFORMAT_PPM -# define QT_NO_IMAGEFORMAT_PPM -#endif -#ifndef QT_NO_IMAGEFORMAT_XBM -# define QT_NO_IMAGEFORMAT_XBM -#endif -#ifndef QT_NO_IMAGEFORMAT_XPM -# define QT_NO_IMAGEFORMAT_XPM -#endif -#ifndef QT_NO_IMAGE_HEURISTIC_MASK -# define QT_NO_IMAGE_HEURISTIC_MASK -#endif -#ifndef QT_NO_MOVIE -# define QT_NO_MOVIE -#endif - -/* Internationalization */ -#ifndef QT_NO_BIG_CODECS -# define QT_NO_BIG_CODECS -#endif -#ifndef QT_NO_TEXTCODEC -# define QT_NO_TEXTCODEC -#endif -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif - -/* ItemViews */ -#ifndef QT_NO_ITEMVIEWS -# define QT_NO_ITEMVIEWS -#endif -#ifndef QT_NO_DATAWIDGETMAPPER -# define QT_NO_DATAWIDGETMAPPER -#endif -#ifndef QT_NO_DIRMODEL -# define QT_NO_DIRMODEL -#endif -#ifndef QT_NO_LISTVIEW -# define QT_NO_LISTVIEW -#endif -#ifndef QT_NO_COLUMNVIEW -# define QT_NO_COLUMNVIEW -#endif -#ifndef QT_NO_PROXYMODEL -# define QT_NO_PROXYMODEL -#endif -#ifndef QT_NO_SORTFILTERPROXYMODEL -# define QT_NO_SORTFILTERPROXYMODEL -#endif -#ifndef QT_NO_STANDARDITEMMODEL -# define QT_NO_STANDARDITEMMODEL -#endif -#ifndef QT_NO_STRINGLISTMODEL -# define QT_NO_STRINGLISTMODEL -#endif -#ifndef QT_NO_TABLEVIEW -# define QT_NO_TABLEVIEW -#endif -#ifndef QT_NO_TREEVIEW -# define QT_NO_TREEVIEW -#endif - -/* Kernel */ -#ifndef QT_NO_ACTION -# define QT_NO_ACTION -#endif -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_CSSPARSER -# define QT_NO_CSSPARSER -#endif -#ifndef QT_NO_CURSOR -# define QT_NO_CURSOR -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_PROPERTIES -# define QT_NO_PROPERTIES -#endif -#ifndef QT_NO_SESSIONMANAGER -# define QT_NO_SESSIONMANAGER -#endif -#ifndef QT_NO_SHAREDMEMORY -# define QT_NO_SHAREDMEMORY -#endif -#ifndef QT_NO_SHORTCUT -# define QT_NO_SHORTCUT -#endif -#ifndef QT_NO_SYSTEMSEMAPHORE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_TABLETEVENT -# define QT_NO_TABLETEVENT -#endif -#ifndef QT_NO_TEXTHTMLPARSER -# define QT_NO_TEXTHTMLPARSER -#endif -#ifndef QT_NO_CONCURRENT -# define QT_NO_CONCURRENT -#endif -#ifndef QT_NO_WHEELEVENT -# define QT_NO_WHEELEVENT -#endif -#ifndef QT_NO_XMLSTREAM -# define QT_NO_XMLSTREAM -#endif -#ifndef QT_NO_XMLSTREAMREADER -# define QT_NO_XMLSTREAMREADER -#endif -#ifndef QT_NO_XMLSTREAMWRITER -# define QT_NO_XMLSTREAMWRITER -#endif - -/* Networking */ -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif -#ifndef QT_NO_NETWORKPROXY -# define QT_NO_NETWORKPROXY -#endif -#ifndef QT_NO_SOCKS5 -# define QT_NO_SOCKS5 -#endif -#ifndef QT_NO_UDPSOCKET -# define QT_NO_UDPSOCKET -#endif -#ifndef QT_NO_FTP -# define QT_NO_FTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_PAINT_DEBUG -# define QT_NO_PAINT_DEBUG -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_FUSION -# define QT_NO_STYLE_FUSION -#endif -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif -#ifndef QT_NO_STYLE_WINDOWSCE -# define QT_NO_STYLE_WINDOWSCE -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE -# define QT_NO_STYLE_WINDOWSMOBILE -#endif -#ifndef QT_NO_STYLE_WINDOWSVISTA -# define QT_NO_STYLE_WINDOWSVISTA -#endif -#ifndef QT_NO_STYLE_WINDOWSXP -# define QT_NO_STYLE_WINDOWSXP -#endif - -/* Utilities */ -#ifndef QT_NO_ACCESSIBILITY -# define QT_NO_ACCESSIBILITY -#endif -#ifndef QT_NO_COMPLETER -# define QT_NO_COMPLETER -#endif -#ifndef QT_NO_DESKTOPSERVICES -# define QT_NO_DESKTOPSERVICES -#endif -#ifndef QT_NO_MIMETYPE -# define QT_NO_MIMETYPE -#endif -#ifndef QT_NO_SYSTEMTRAYICON -# define QT_NO_SYSTEMTRAYICON -#endif -#ifndef QT_NO_UNDOCOMMAND -# define QT_NO_UNDOCOMMAND -#endif -#ifndef QT_NO_UNDOGROUP -# define QT_NO_UNDOGROUP -#endif -#ifndef QT_NO_UNDOSTACK -# define QT_NO_UNDOSTACK -#endif -#ifndef QT_NO_UNDOVIEW -# define QT_NO_UNDOVIEW -#endif -#ifndef QT_NO_GESTURES -# define QT_NO_GESTURES -#endif - -/* Widgets */ -#ifndef QT_NO_GROUPBOX -# define QT_NO_GROUPBOX -#endif -#ifndef QT_NO_BUTTONGROUP -# define QT_NO_BUTTONGROUP -#endif -#ifndef QT_NO_LCDNUMBER -# define QT_NO_LCDNUMBER -#endif -#ifndef QT_NO_LINEEDIT -# define QT_NO_LINEEDIT -#endif -#ifndef QT_NO_COMBOBOX -# define QT_NO_COMBOBOX -#endif -#ifndef QT_NO_FONTCOMBOBOX -# define QT_NO_FONTCOMBOBOX -#endif -#ifndef QT_NO_SPINBOX -# define QT_NO_SPINBOX -#endif -#ifndef QT_NO_CALENDARWIDGET -# define QT_NO_CALENDARWIDGET -#endif -#ifndef QT_NO_DATETIMEEDIT -# define QT_NO_DATETIMEEDIT -#endif -#ifndef QT_NO_LISTWIDGET -# define QT_NO_LISTWIDGET -#endif -#ifndef QT_NO_MENU -# define QT_NO_MENU -#endif -#ifndef QT_NO_CONTEXTMENU -# define QT_NO_CONTEXTMENU -#endif -#ifndef QT_NO_MAINWINDOW -# define QT_NO_MAINWINDOW -#endif -#ifndef QT_NO_DOCKWIDGET -# define QT_NO_DOCKWIDGET -#endif -#ifndef QT_NO_TOOLBAR -# define QT_NO_TOOLBAR -#endif -#ifndef QT_NO_MENUBAR -# define QT_NO_MENUBAR -#endif -#ifndef QT_NO_PROGRESSBAR -# define QT_NO_PROGRESSBAR -#endif -#ifndef QT_NO_RESIZEHANDLER -# define QT_NO_RESIZEHANDLER -#endif -#ifndef QT_NO_RUBBERBAND -# define QT_NO_RUBBERBAND -#endif -#ifndef QT_NO_SPLITTER -# define QT_NO_SPLITTER -#endif -#ifndef QT_NO_SIZEGRIP -# define QT_NO_SIZEGRIP -#endif -#ifndef QT_NO_SLIDER -# define QT_NO_SLIDER -#endif -#ifndef QT_NO_DIAL -# define QT_NO_DIAL -#endif -#ifndef QT_NO_SCROLLBAR -# define QT_NO_SCROLLBAR -#endif -#ifndef QT_NO_SCROLLAREA -# define QT_NO_SCROLLAREA -#endif -#ifndef QT_NO_GRAPHICSVIEW -# define QT_NO_GRAPHICSVIEW -#endif -#ifndef QT_NO_PRINTPREVIEWWIDGET -# define QT_NO_PRINTPREVIEWWIDGET -#endif -#ifndef QT_NO_MDIAREA -# define QT_NO_MDIAREA -#endif -#ifndef QT_NO_TEXTEDIT -# define QT_NO_TEXTEDIT -#endif -#ifndef QT_NO_SYNTAXHIGHLIGHTER -# define QT_NO_SYNTAXHIGHLIGHTER -#endif -#ifndef QT_NO_TEXTBROWSER -# define QT_NO_TEXTBROWSER -#endif -#ifndef QT_NO_SPINWIDGET -# define QT_NO_SPINWIDGET -#endif -#ifndef QT_NO_SPLASHSCREEN -# define QT_NO_SPLASHSCREEN -#endif -#ifndef QT_NO_STACKEDWIDGET -# define QT_NO_STACKEDWIDGET -#endif -#ifndef QT_NO_TABWIDGET -# define QT_NO_TABWIDGET -#endif -#ifndef QT_NO_STATUSBAR -# define QT_NO_STATUSBAR -#endif -#ifndef QT_NO_STATUSTIP -# define QT_NO_STATUSTIP -#endif -#ifndef QT_NO_TABLEWIDGET -# define QT_NO_TABLEWIDGET -#endif -#ifndef QT_NO_TOOLBUTTON -# define QT_NO_TOOLBUTTON -#endif -#ifndef QT_NO_TABBAR -# define QT_NO_TABBAR -#endif -#ifndef QT_NO_TOOLBOX -# define QT_NO_TOOLBOX -#endif -#ifndef QT_NO_WHATSTHIS -# define QT_NO_WHATSTHIS -#endif -#ifndef QT_NO_TOOLTIP -# define QT_NO_TOOLTIP -#endif -#ifndef QT_NO_TREEWIDGET -# define QT_NO_TREEWIDGET -#endif -#ifndef QT_NO_VALIDATOR -# define QT_NO_VALIDATOR -#endif diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h deleted file mode 100644 index 10292c05c3..0000000000 --- a/src/corelib/global/qconfig-nacl.h +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if 0 -#pragma qt_sync_stop_processing -#endif - -#define QT_FONTS_ARE_RESOURCES - -/* Data structures */ -#ifndef QT_NO_TEXTDATE -# define QT_NO_TEXTDATE -#endif -#ifndef QT_NO_DATESTRING -# define QT_NO_DATESTRING -#endif - -/* Dialogs */ -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PRINTPREVIEWDIALOG -# define QT_NO_PRINTPREVIEWDIALOG -#endif - - -/* File I/O */ -#ifndef QT_NO_DOM -# define QT_NO_DOM -#endif -#ifndef QT_NO_FILESYSTEMWATCHER -# define QT_NO_FILESYSTEMWATCHER -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_PROCESS -# define QT_NO_PROCESS -#endif -#ifndef QT_NO_TEMPORARYFILE -# define QT_NO_TEMPORARYFILE -#endif -#ifndef QT_NO_SETTINGS -# define QT_NO_SETTINGS -#endif -#ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMATPLUGIN -# define QT_NO_IMAGEFORMATPLUGIN -#endif -#ifndef QT_NO_IMAGE_HEURISTIC_MASK -# define QT_NO_IMAGE_HEURISTIC_MASK -#endif -#ifndef QT_NO_MOVIE -# define QT_NO_MOVIE -#endif - -/* Internationalization */ -#ifndef QT_NO_BIG_CODECS -# define QT_NO_BIG_CODECS -#endif -#ifndef QT_NO_TEXTCODEC -# define QT_NO_TEXTCODEC -#endif -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif - -/* ItemViews */ - -#ifndef QT_NO_DIRMODEL -# define QT_NO_DIRMODEL -#endif - -/* Kernel */ -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_CSSPARSER -# define QT_NO_CSSPARSER -#endif -#ifndef QT_NO_CURSOR -# define QT_NO_CURSOR -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_SESSIONMANAGER -# define QT_NO_SESSIONMANAGER -#endif -#ifndef QT_NO_SHAREDMEMORY -# define QT_NO_SHAREDMEMORY -#endif -#ifndef QT_NO_SYSTEMLOCALE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_SYSTEMSEMAPHORE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_TABLETEVENT -# define QT_NO_TABLETEVENT -#endif -#ifndef QT_NO_CRASHHANDLER -# define QT_NO_CRASHHANDLER -#endif -#ifndef QT_NO_CONCURRENT -# define QT_NO_CONCURRENT -#endif -#ifndef QT_NO_XMLSTREAM -# define QT_NO_XMLSTREAM -#endif -#ifndef QT_NO_XMLSTREAMREADER -# define QT_NO_XMLSTREAMREADER -#endif -#ifndef QT_NO_XMLSTREAMWRITER -# define QT_NO_XMLSTREAMWRITER -#endif - -/* Networking */ -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif -#ifndef QT_NO_NETWORKPROXY -# define QT_NO_NETWORKPROXY -#endif -#ifndef QT_NO_SOCKS5 -# define QT_NO_SOCKS5 -#endif -#ifndef QT_NO_UDPSOCKET -# define QT_NO_UDPSOCKET -#endif -#ifndef QT_NO_FTP -# define QT_NO_FTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_PAINT_DEBUG -# define QT_NO_PAINT_DEBUG -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif -#ifndef QT_NO_STYLE_WINDOWSCE -# define QT_NO_STYLE_WINDOWSCE -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE -# define QT_NO_STYLE_WINDOWSMOBILE -#endif -#ifndef QT_NO_STYLE_WINDOWSVISTA -# define QT_NO_STYLE_WINDOWSVISTA -#endif -#ifndef QT_NO_STYLE_WINDOWSXP -# define QT_NO_STYLE_WINDOWSXP -#endif - -/* Utilities */ -#ifndef QT_NO_ACCESSIBILITY -# define QT_NO_ACCESSIBILITY -#endif -#ifndef QT_NO_COMPLETER -# define QT_NO_COMPLETER -#endif -#ifndef QT_NO_DESKTOPSERVICES -# define QT_NO_DESKTOPSERVICES -#endif -#ifndef QT_NO_SYSTEMTRAYICON -# define QT_NO_SYSTEMTRAYICON -#endif diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h deleted file mode 100644 index 1f1bff91a3..0000000000 --- a/src/corelib/global/qconfig-small.h +++ /dev/null @@ -1,281 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Dialogs */ -#ifndef QT_NO_COLORDIALOG -# define QT_NO_COLORDIALOG -#endif -#ifndef QT_NO_ERRORMESSAGE -# define QT_NO_ERRORMESSAGE -#endif -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_FONTDIALOG -# define QT_NO_FONTDIALOG -#endif -#ifndef QT_NO_INPUTDIALOG -# define QT_NO_INPUTDIALOG -#endif -#ifndef QT_NO_MESSAGEBOX -# define QT_NO_MESSAGEBOX -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PROGRESSDIALOG -# define QT_NO_PROGRESSDIALOG -#endif - -/* File I/O */ -#ifndef QT_NO_SETTINGS -# define QT_NO_SETTINGS -#endif -#ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY -#endif - -/* Fonts */ -#ifndef QT_NO_FREETYPE -# define QT_NO_FREETYPE -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMATPLUGIN -# define QT_NO_IMAGEFORMATPLUGIN -#endif -#ifndef QT_NO_IMAGEFORMAT_BMP -# define QT_NO_IMAGEFORMAT_BMP -#endif -#ifndef QT_NO_IMAGEFORMAT_JPEG -# define QT_NO_IMAGEFORMAT_JPEG -#endif -#ifndef QT_NO_IMAGEFORMAT_PPM -# define QT_NO_IMAGEFORMAT_PPM -#endif -#ifndef QT_NO_IMAGEFORMAT_XBM -# define QT_NO_IMAGEFORMAT_XBM -#endif -#ifndef QT_NO_IMAGEFORMAT_XPM -# define QT_NO_IMAGEFORMAT_XPM -#endif -#ifndef QT_NO_MOVIE -# define QT_NO_MOVIE -#endif - -/* Internationalization */ -#ifndef QT_NO_TEXTCODEC -# define QT_NO_TEXTCODEC -#endif -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif - -/* ItemViews */ -#ifndef QT_NO_DIRMODEL -# define QT_NO_DIRMODEL -#endif -#ifndef QT_NO_PROXYMODEL -# define QT_NO_PROXYMODEL -#endif -#ifndef QT_NO_SORTFILTERPROXYMODEL -# define QT_NO_SORTFILTERPROXYMODEL -#endif -#ifndef QT_NO_STRINGLISTMODEL -# define QT_NO_STRINGLISTMODEL -#endif -#ifndef QT_NO_TABLEVIEW -# define QT_NO_TABLEVIEW -#endif -#ifndef QT_NO_TREEVIEW -# define QT_NO_TREEVIEW -#endif - -/* Kernel */ -#ifndef QT_NO_ACTION -# define QT_NO_ACTION -#endif -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_PROPERTIES -# define QT_NO_PROPERTIES -#endif -#ifndef QT_NO_SESSIONMANAGER -# define QT_NO_SESSIONMANAGER -#endif -#ifndef QT_NO_SHORTCUT -# define QT_NO_SHORTCUT -#endif -#ifndef QT_NO_WHEELEVENT -# define QT_NO_WHEELEVENT -#endif - -/* Networking */ -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_FUSION -# define QT_NO_STYLE_FUSION -#endif -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif -#ifndef QT_NO_STYLE_WINDOWSVISTA -# define QT_NO_STYLE_WINDOWSVISTA -#endif - -/* Utilities */ -#ifndef QT_NO_COMPLETER -# define QT_NO_COMPLETER -#endif -#ifndef QT_NO_DESKTOPSERVICES -# define QT_NO_DESKTOPSERVICES -#endif -#ifndef QT_NO_MIMETYPE -# define QT_NO_MIMETYPE -#endif -#ifndef QT_NO_SYSTEMTRAYICON -# define QT_NO_SYSTEMTRAYICON -#endif -#ifndef QT_NO_GESTURES -# define QT_NO_GESTURES -#endif - -/* Widgets */ -#ifndef QT_NO_LCDNUMBER -# define QT_NO_LCDNUMBER -#endif -#ifndef QT_NO_FONTCOMBOBOX -# define QT_NO_FONTCOMBOBOX -#endif -#ifndef QT_NO_SPINBOX -# define QT_NO_SPINBOX -#endif -#ifndef QT_NO_CALENDARWIDGET -# define QT_NO_CALENDARWIDGET -#endif -#ifndef QT_NO_DATETIMEEDIT -# define QT_NO_DATETIMEEDIT -#endif -#ifndef QT_NO_MENU -# define QT_NO_MENU -#endif -#ifndef QT_NO_CONTEXTMENU -# define QT_NO_CONTEXTMENU -#endif -#ifndef QT_NO_MAINWINDOW -# define QT_NO_MAINWINDOW -#endif -#ifndef QT_NO_DOCKWIDGET -# define QT_NO_DOCKWIDGET -#endif -#ifndef QT_NO_TOOLBAR -# define QT_NO_TOOLBAR -#endif -#ifndef QT_NO_MENUBAR -# define QT_NO_MENUBAR -#endif -#ifndef QT_NO_PROGRESSBAR -# define QT_NO_PROGRESSBAR -#endif -#ifndef QT_NO_SPLITTER -# define QT_NO_SPLITTER -#endif -#ifndef QT_NO_SIZEGRIP -# define QT_NO_SIZEGRIP -#endif -#ifndef QT_NO_STACKEDWIDGET -# define QT_NO_STACKEDWIDGET -#endif -#ifndef QT_NO_TABWIDGET -# define QT_NO_TABWIDGET -#endif -#ifndef QT_NO_STATUSBAR -# define QT_NO_STATUSBAR -#endif -#ifndef QT_NO_TABLEWIDGET -# define QT_NO_TABLEWIDGET -#endif -#ifndef QT_NO_TOOLBUTTON -# define QT_NO_TOOLBUTTON -#endif -#ifndef QT_NO_TABBAR -# define QT_NO_TABBAR -#endif -#ifndef QT_NO_TOOLBOX -# define QT_NO_TOOLBOX -#endif -#ifndef QT_NO_WHATSTHIS -# define QT_NO_WHATSTHIS -#endif -#ifndef QT_NO_TOOLTIP -# define QT_NO_TOOLTIP -#endif -#ifndef QT_NO_TREEWIDGET -# define QT_NO_TREEWIDGET -#endif -#ifndef QT_NO_VALIDATOR -# define QT_NO_VALIDATOR -#endif diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index b907caa9b6..f3082a1e39 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -111,8 +111,8 @@ public: typedef Enum enum_type; // compiler-generated copy/move ctor/assignment operators are fine! #ifdef Q_QDOC - inline QFlags(const QFlags &other); - inline QFlags &operator=(const QFlags &other); + Q_DECL_CONSTEXPR inline QFlags(const QFlags &other); + Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); #endif Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {} Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5e2d7b7c1a..7e4e09c6c7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -47,7 +47,6 @@ #include "qdatetime.h" #include <private/qlocale_tools_p.h> -#include <private/qsystemlibrary_p.h> #include <qmutex.h> #ifndef QT_NO_QOBJECT @@ -64,11 +63,9 @@ # include <exception> #endif -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WINRT @@ -573,11 +570,11 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in \snippet code/src_corelib_global_qglobal.cpp 4 The remaining functions are qRound() and qRound64(), which both - accept a \l qreal value as their argument returning the value - rounded up to the nearest integer and 64-bit integer respectively, - the qInstallMessageHandler() function which installs the given - QtMessageHandler, and the qVersion() function which returns the - version number of Qt at run-time as a string. + accept a \c double or \c float value as their argument returning + the value rounded up to the nearest integer and 64-bit integer + respectively, the qInstallMessageHandler() function which installs + the given QtMessageHandler, and the qVersion() function which + returns the version number of Qt at run-time as a string. \section1 Macros @@ -864,24 +861,44 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in \snippet code/src_corelib_global_qglobal.cpp 10 */ -/*! \fn int qRound(qreal value) +/*! \fn int qRound(double value) + \relates <QtGlobal> + + Rounds \a value to the nearest integer. + + Example: + + \snippet code/src_corelib_global_qglobal.cpp 11A +*/ + +/*! \fn int qRound(float value) \relates <QtGlobal> Rounds \a value to the nearest integer. Example: - \snippet code/src_corelib_global_qglobal.cpp 11 + \snippet code/src_corelib_global_qglobal.cpp 11B +*/ + +/*! \fn qint64 qRound64(double value) + \relates <QtGlobal> + + Rounds \a value to the nearest 64-bit integer. + + Example: + + \snippet code/src_corelib_global_qglobal.cpp 12A */ -/*! \fn qint64 qRound64(qreal value) +/*! \fn qint64 qRound64(float value) \relates <QtGlobal> Rounds \a value to the nearest 64-bit integer. Example: - \snippet code/src_corelib_global_qglobal.cpp 12 + \snippet code/src_corelib_global_qglobal.cpp 12B */ /*! \fn const T &qMin(const T &value1, const T &value2) @@ -1016,7 +1033,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in example, "4.1.2"). This may be a different version than the version the application was compiled against. - \sa QT_VERSION_STR + \sa QT_VERSION_STR, QLibraryInfo::version() */ const char *qVersion() Q_DECL_NOTHROW @@ -1147,19 +1164,11 @@ bool qSharedBuild() Q_DECL_NOTHROW \value WV_6_3 Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2 \value WV_10_0 Operating system version 10.0, corresponds to Windows 10, introduced in Qt 5.5 - CE-based versions: - - \value WV_CE Windows CE - \value WV_CENET Windows CE .NET - \value WV_CE_5 Windows CE 5.x - \value WV_CE_6 Windows CE 6.x - The following masks can be used for testing whether a Windows version is MS-DOS-based, NT-based, or CE-based: \value WV_DOS_based MS-DOS-based version of Windows \value WV_NT_based NT-based version of Windows - \value WV_CE_based CE-based version of Windows \value WV_None Operating system other than Windows. @@ -1262,7 +1271,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \relates <QtGlobal> Defined on all supported versions of Windows. That is, if - \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined. + \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINRT is defined. */ /*! @@ -1280,13 +1289,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_WINCE - \relates <QtGlobal> - - Defined on Windows CE. -*/ - -/*! \macro Q_OS_WINRT \relates <QtGlobal> @@ -1922,7 +1924,7 @@ QSysInfo::MacVersion QSysInfo::macVersion() } const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion(); -#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT) QT_BEGIN_INCLUDE_NAMESPACE #include "qt_windows.h" @@ -1975,9 +1977,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() { OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0}; -#ifndef Q_OS_WINCE #define GetProcAddressA GetProcAddress -#endif // GetModuleHandle is not supported in WinRT and linking to it at load time // will not pass the Windows App Certification Kit... but it exists and is functional, @@ -2048,11 +2048,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() const OSVERSIONINFOEX osver = winOsVersion(); if (osver.dwMajorVersion == 0) return QSysInfo::WV_None; -#ifdef Q_OS_WINCE - DWORD qt_cever = 0; - qt_cever = osver.dwMajorVersion * 100; - qt_cever += osver.dwMinorVersion * 10; -#endif switch (osver.dwPlatformId) { case VER_PLATFORM_WIN32s: winver = QSysInfo::WV_32s; @@ -2066,18 +2061,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() else winver = QSysInfo::WV_95; break; -#ifdef Q_OS_WINCE - case VER_PLATFORM_WIN32_CE: - if (qt_cever >= 600) - winver = QSysInfo::WV_CE_6; - if (qt_cever >= 500) - winver = QSysInfo::WV_CE_5; - else if (qt_cever >= 400) - winver = QSysInfo::WV_CENET; - else - winver = QSysInfo::WV_CE; - break; -#endif default: // VER_PLATFORM_WIN32_NT if (osver.dwMajorVersion < 5) { winver = QSysInfo::WV_NT; @@ -2168,15 +2151,6 @@ static const char *winVer_helper() return workstation ? "8.1" : "Server 2012 R2"; case QSysInfo::WV_WINDOWS10: return workstation ? "10" : "Server 2016"; - - case QSysInfo::WV_CE: - return "CE"; - case QSysInfo::WV_CENET: - return "CENET"; - case QSysInfo::WV_CE_5: - return "CE5"; - case QSysInfo::WV_CE_6: - return "CE6"; } // unknown, future version return 0; @@ -2434,7 +2408,7 @@ QString QSysInfo::buildCpuArchitecture() */ QString QSysInfo::currentCpuArchitecture() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // We don't need to catch all the CPU architectures in this function; // only those where the host CPU might be different than the build target // (usually, 64-bit platforms). @@ -2586,9 +2560,7 @@ static QString unknownText() */ QString QSysInfo::kernelType() { -#if defined(Q_OS_WINCE) - return QStringLiteral("wince"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) return QStringLiteral("winnt"); #elif defined(Q_OS_UNIX) struct utsname u; @@ -2652,8 +2624,7 @@ QString QSysInfo::kernelVersion() "unknown" otherwise. \b{Windows note}: this function returns "winphone" for builds for Windows - Phone, "winrt" for WinRT builds, "wince" for Windows CE and Embedded - Compact builds, and "windows" for normal desktop builds. + Phone, "winrt" for WinRT builds and "windows" for normal desktop builds. For other Unix-type systems, this function usually returns "unknown". @@ -2666,8 +2637,6 @@ QString QSysInfo::productType() return QStringLiteral("winphone"); #elif defined(Q_OS_WINRT) return QStringLiteral("winrt"); -#elif defined(Q_OS_WINCE) - return QStringLiteral("wince"); #elif defined(Q_OS_WIN) return QStringLiteral("windows"); @@ -2805,7 +2774,17 @@ QString QSysInfo::prettyProductName() #elif defined(Q_OS_WINPHONE) return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper()); #elif defined(Q_OS_WIN) - return QLatin1String("Windows ") + QLatin1String(winVer_helper()) + winSp_helper(); + const char *name = winVer_helper(); + const OSVERSIONINFOEX osver = winOsVersion(); + if (name) + return QLatin1String("Windows ") + QLatin1String(name) + winSp_helper() + + QLatin1String(" (") + QString::number(osver.dwMajorVersion) + + QLatin1Char('.') + QString::number(osver.dwMinorVersion) + + QLatin1Char(')'); + else + return QLatin1String("Windows ") + + QString::number(osver.dwMajorVersion) + QLatin1Char('.') + + QString::number(osver.dwMinorVersion); #elif defined(Q_OS_ANDROID) return QLatin1String("Android ") + productVersion(); #elif defined(Q_OS_HAIKU) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 235bae89af..0d83bc04fe 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -526,23 +526,11 @@ Q_DECL_CONSTEXPR inline int qRound(double d) { return d >= 0.0 ? int(d + 0.5) : int(d - double(int(d-1)) + 0.5) + int(d-1); } Q_DECL_CONSTEXPR inline int qRound(float d) { return d >= 0.0f ? int(d + 0.5f) : int(d - float(int(d-1)) + 0.5f) + int(d-1); } -#ifdef Q_QDOC -/* - Just for documentation generation -*/ -int qRound(qreal d); -#endif Q_DECL_CONSTEXPR inline qint64 qRound64(double d) { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - double(qint64(d-1)) + 0.5) + qint64(d-1); } Q_DECL_CONSTEXPR inline qint64 qRound64(float d) { return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); } -#ifdef Q_QDOC -/* - Just for documentation generation -*/ -qint64 qRound64(qreal d); -#endif template <typename T> Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; } @@ -1027,8 +1015,11 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); #ifdef Q_QDOC // Just for documentation generation +template<typename T> auto qOverload(T functionPointer); +template<typename T> auto qConstOverload(T memberFunctionPointer); +template<typename T> auto qNonConstOverload(T memberFunctionPointer); #elif defined(Q_COMPILER_VARIADIC_TEMPLATES) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 458200180e..70e19d1f86 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -366,6 +366,19 @@ QLibraryInfo::isDebugBuild() #endif } +#ifndef QT_BOOTSTRAPPED +/*! + \since 5.8 + Returns the version of the Qt library. + + \sa qVersion() +*/ +QVersionNumber QLibraryInfo::version() Q_DECL_NOTHROW +{ + return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH); +} +#endif // QT_BOOTSTRAPPED + #endif // QT_BUILD_QMAKE /* diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 362d47dea3..a1c146923e 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -42,6 +42,7 @@ #include <QtCore/qstring.h> #include <QtCore/qdatetime.h> +#include <QtCore/qversionnumber.h> QT_BEGIN_NAMESPACE @@ -63,6 +64,10 @@ public: static bool isDebugBuild(); +#ifndef QT_BOOTSTRAPPED + static QVersionNumber version() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; +#endif + enum LibraryLocation { PrefixPath = 0, diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index de37731b1a..295de9485a 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -169,7 +169,7 @@ static bool isFatal(QtMsgType msgType) static bool willLogToConsole() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) // these systems have no stderr, so always log to the system log return false; #elif defined(QT_BOOTSTRAPPED) @@ -1172,7 +1172,7 @@ void QMessagePattern::setPattern(const QString &pattern) else if (inIf) error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n"); if (!error.isEmpty()) { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16())); if (0) #elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 5a4f499a87..c8699c15fe 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -301,12 +301,7 @@ public: MacWindowToolBarButtonHint = 0x10000000, BypassGraphicsProxyWidget = 0x20000000, NoDropShadowWindowHint = 0x40000000, - WindowFullscreenButtonHint = 0x80000000, - - // The following enums have overlapping values with other enums. - // This was not intentional, but it's too late to change now. - WindowOkButtonHint = 0x00080000, // WindowTransparentForInput - WindowCancelButtonHint = 0x00100000 // WindowOverridesSystemGestures + WindowFullscreenButtonHint = 0x80000000 }; Q_DECLARE_FLAGS(WindowFlags, WindowType) @@ -508,6 +503,7 @@ public: AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me AA_DontUseNativeDialogs = 23, AA_SynthesizeMouseForUnhandledTabletEvents = 24, + AA_DontCheckOpenGLContextThreadAffinity = 25, // Add new attributes before this line AA_AttributeCount diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 0cc9467921..13e2b55e2a 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -239,6 +239,13 @@ to mouse events instead. This attribute is enabled by default. This value has been added in Qt 5.7. + \value AA_DontCheckOpenGLContextThreadAffinity When making a context + current using QOpenGLContext, do not check that the + \l{QObject#Thread Affinity}{QObject thread affinity} + of the QOpenGLContext object is the same thread calling + \l{QOpenGLContext::makeCurrent}{makeCurrent()}. This value has been + added in Qt 5.8. + The following values are obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully @@ -742,27 +749,25 @@ \value MonoOnly The pixmap becomes monochrome. If necessary, it is dithered using the chosen dithering algorithm. - Dithering mode preference for RGB channels: + Dithering mode preference: - \value DiffuseDither (default) - A high-quality dither. - \value OrderedDither A faster, more ordered dither. + \value DiffuseDither (default) - A high-quality dither using error diffusion. + \value OrderedDither A faster, ordered dither. \value ThresholdDither No dithering; closest color is used. - Dithering mode preference for alpha channel: + Dithering mode preference for 1-bit alpha masks: \value ThresholdAlphaDither (default) - No dithering. - \value OrderedAlphaDither A faster, more ordered dither. - \value DiffuseAlphaDither A high-quality dither. + \value OrderedAlphaDither A faster, ordered dither. + \value DiffuseAlphaDither A high-quality dither using error diffusion. \omitvalue NoAlpha Color matching versus dithering preference: - \value PreferDither (default when converting to a pixmap) - Always dither - 32-bit images when the image is converted to 8 bits. - \value AvoidDither (default when converting for the purpose of saving to - file) - Dither 32-bit images only if the image has more than 256 - colors and it is being converted to 8 bits. - \omitvalue AutoDither + \value PreferDither Always dither images when converting to smaller color-spaces. + \value AvoidDither Only dither to indexed formats if the source image uses more + different colors than the size of the color table of the destination format. + \value AutoDither (default) - Only dither when down-converting to 1 or 8-bit indexed formats. \omitvalue ColorMode_Mask \omitvalue Dither_Mask @@ -2210,12 +2215,6 @@ the bottom. This window hint is currently not implemented for OS X. - \value WindowOkButtonHint Adds an OK button to the window decoration of a dialog. - Only supported for Windows CE. - - \value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog. - Only supported for Windows CE. - \value WindowTransparentForInput Informs the window system that this window is used only for output (displaying something) and does not take input. Therefore input events should pass through as if it wasn't there. diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 5705bc29c8..b7f7d5187c 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -56,7 +56,7 @@ #include <cmath> #include <limits> -#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) +#if defined(Q_CC_MSVC) # include <intrin.h> #elif defined(Q_CC_INTEL) # include <immintrin.h> // for _addcarry_u<nn> diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index b74fc80468..141d45e0db 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -69,7 +69,7 @@ public: LittleEndian # ifdef Q_QDOC - , ByteOrder = <platform-dependent> + , ByteOrder = BigEndian or LittleEndian # elif Q_BYTE_ORDER == Q_BIG_ENDIAN , ByteOrder = BigEndian # elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN @@ -109,13 +109,7 @@ public: WV_6_1 = WV_WINDOWS7, WV_6_2 = WV_WINDOWS8, WV_6_3 = WV_WINDOWS8_1, - WV_10_0 = WV_WINDOWS10, - - WV_CE = 0x0100, - WV_CENET = 0x0200, - WV_CE_5 = 0x0300, - WV_CE_6 = 0x0400, - WV_CE_based = 0x0f00 + WV_10_0 = WV_WINDOWS10 }; #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) static const WinVersion WindowsVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 97f750a3a6..ee4b88cdbb 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -56,7 +56,6 @@ OS2 - OS/2 OS2EMX - XFree86 on OS/2 (not PM) WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - WINCE - WinCE (Windows CE 5.0) WINRT - WinRT (Windows 8 Runtime) CYGWIN - Cygwin SOLARIS - Sun Solaris @@ -128,9 +127,7 @@ # define Q_OS_WIN32 # define Q_OS_WIN64 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) -# if defined(WINCE) || defined(_WIN32_WCE) -# define Q_OS_WINCE -# elif defined(WINAPI_FAMILY) +# if defined(WINAPI_FAMILY) # ifndef WINAPI_FAMILY_PC_APP # define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP # endif @@ -205,7 +202,7 @@ # error "Qt has not been ported to this OS - see http://www.qt-project.org/" #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT) # define Q_OS_WIN #endif diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 8ac3c2135d..6d4c56d7d6 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -48,10 +48,10 @@ #if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation # ifndef WINVER -# define WINVER 0x501 +# define WINVER 0x600 # endif # ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 +# define _WIN32_WINNT 0x600 # endif #endif @@ -144,13 +144,4 @@ #define CLEARTYPE_QUALITY 5 #endif -#ifdef Q_OS_WINCE -#ifndef LR_DEFAULTSIZE -#define LR_DEFAULTSIZE 0 -#endif -#ifndef LR_SHARED -#define LR_SHARED 0 -#endif -#endif // Q_OS_WINCE - #endif // QT_WINDOWS_H diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 06674e9a3f..052dc8408b 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -106,25 +106,21 @@ win32 { SOURCES += io/qfilesystemiterator_win.cpp !winrt { - SOURCES += io/qsettings_win.cpp - SOURCES += io/qstandardpaths_win.cpp + HEADERS += \ + io/qwindowspipereader_p.h \ + io/qwindowspipewriter_p.h \ + io/qwinoverlappedionotifier_p.h - wince* { - SOURCES += io/qprocess_wince.cpp \ - io/qstorageinfo_stub.cpp - } else { - HEADERS += \ - io/qwinoverlappedionotifier_p.h \ - io/qwindowspipereader_p.h \ - io/qwindowspipewriter_p.h - SOURCES += \ - io/qprocess_win.cpp \ - io/qwinoverlappedionotifier.cpp \ - io/qwindowspipereader.cpp \ - io/qwindowspipewriter.cpp \ - io/qstorageinfo_win.cpp - LIBS += -lmpr - } + SOURCES += \ + io/qprocess_win.cpp \ + io/qsettings_win.cpp \ + io/qstandardpaths_win.cpp \ + io/qstorageinfo_win.cpp \ + io/qwindowspipereader.cpp \ + io/qwindowspipewriter.cpp \ + io/qwinoverlappedionotifier.cpp + + LIBS += -lmpr } else { SOURCES += \ io/qstandardpaths_winrt.cpp \ diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index e4cd3b3509..76d173bb3e 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -91,10 +91,11 @@ public: Qt_5_5 = Qt_5_4, Qt_5_6 = 17, Qt_5_7 = Qt_5_6, -#if QT_VERSION >= 0x050800 + Qt_5_8 = Qt_5_7, +#if QT_VERSION >= 0x050900 #error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion #endif - Qt_DefaultCompiledVersion = Qt_5_7 + Qt_DefaultCompiledVersion = Qt_5_8 }; enum ByteOrder { diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9efe2fb90e..af07b52cdb 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2187,7 +2187,7 @@ QString QDir::cleanPath(const QString &path) name.replace(dir_separator, QLatin1Char('/')); bool allowUncPaths = false; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //allow unc paths +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //allow unc paths allowUncPaths = true; #endif diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 4ac12fc9ea..7026d3403b 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -369,7 +369,7 @@ QStringList QFileSelectorPrivate::platformSelectors() #if defined(Q_OS_WIN) // can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case ret << QStringLiteral("windows"); - ret << QSysInfo::kernelType(); // "wince" and "winnt" + ret << QSysInfo::kernelType(); // "winnt" # if defined(Q_OS_WINRT) ret << QStringLiteral("winrt"); # if defined(Q_OS_WINPHONE) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 0829bbc6e8..329dfa9fdd 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -53,13 +53,9 @@ #include "qdatetime.h" #include "qt_windows.h" -#if !defined(Q_OS_WINCE) -# include <sys/types.h> -# include <direct.h> -# include <winioctl.h> -#else -# include <types.h> -#endif +#include <sys/types.h> +#include <direct.h> +#include <winioctl.h> #include <objbase.h> #ifndef Q_OS_WINRT # include <shlobj.h> @@ -116,8 +112,7 @@ typedef INT_PTR intptr_t; # define INVALID_FILE_ATTRIBUTES (DWORD (-1)) #endif -#if !defined(Q_OS_WINCE) -# if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) +#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; USHORT ReparseDataLength; @@ -143,32 +138,31 @@ typedef struct _REPARSE_DATA_BUFFER { } GenericReparseBuffer; }; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; -# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) -# endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) +# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) +#endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) -# ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE -# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 -# endif -# ifndef IO_REPARSE_TAG_SYMLINK -# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) -# endif -# ifndef FSCTL_GET_REPARSE_POINT -# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) -# endif -#endif // !defined(Q_OS_WINCE) +#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE +# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 +#endif +#ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +#endif +#ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif QT_BEGIN_NAMESPACE Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0; -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) static QString qfsPrivateCurrentDir = QLatin1String(""); -// As none of the functions we try to resolve do exist on Windows CE +// As none of the functions we try to resolve do exist on WinRT // we use QT_NO_LIBRARY to shorten everything up a little bit. -#ifndef QT_NO_LIBRARY -#define QT_NO_LIBRARY 1 -#endif -#endif +# ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY 1 +# endif +#endif // Q_OS_WINRT #if !defined(QT_NO_LIBRARY) QT_BEGIN_INCLUDE_NAMESPACE @@ -182,8 +176,6 @@ typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACC static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0; typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD); static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0; -typedef BOOL (WINAPI *PtrGetVolumePathNamesForVolumeNameW)(LPCWSTR,LPWSTR,DWORD,PDWORD); -static PtrGetVolumePathNamesForVolumeNameW ptrGetVolumePathNamesForVolumeNameW = 0; QT_END_INCLUDE_NAMESPACE static TRUSTEE_W currentUserTrusteeW; @@ -233,7 +225,6 @@ static void resolveLibs() #endif triedResolve = true; -#if !defined(Q_OS_WINCE) HINSTANCE advapiHnd = QSystemLibrary::load(L"advapi32"); if (advapiHnd) { ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW"); @@ -279,10 +270,6 @@ static void resolveLibs() HINSTANCE userenvHnd = QSystemLibrary::load(L"userenv"); if (userenvHnd) ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW"); - HINSTANCE kernel32 = LoadLibrary(L"kernel32"); - if(kernel32) - ptrGetVolumePathNamesForVolumeNameW = (PtrGetVolumePathNamesForVolumeNameW)GetProcAddress(kernel32, "GetVolumePathNamesForVolumeNameW"); -#endif } } #endif // QT_NO_LIBRARY @@ -309,14 +296,14 @@ static bool resolveUNCLibs() } #endif triedResolve = true; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) HINSTANCE hLib = QSystemLibrary::load(L"Netapi32"); if (hLib) { ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum"); if (ptrNetShareEnum) ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree"); } -#endif // !Q_OS_WINCE && !Q_OS_WINRT +#endif // !Q_OS_WINRT } return ptrNetShareEnum && ptrNetApiBufferFree; } @@ -324,7 +311,7 @@ static bool resolveUNCLibs() static QString readSymLink(const QFileSystemEntry &link) { QString result; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) HANDLE handle = CreateFile((wchar_t*)link.nativeFilePath().utf16(), FILE_READ_EA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -357,27 +344,24 @@ static QString readSymLink(const QFileSystemEntry &link) #if !defined(QT_NO_LIBRARY) resolveLibs(); - if (ptrGetVolumePathNamesForVolumeNameW) { - QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive); - if(matchVolName.indexIn(result) == 0) { - DWORD len; - wchar_t buffer[MAX_PATH]; - QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\")); - if(ptrGetVolumePathNamesForVolumeNameW((wchar_t*)volumeName.utf16(), buffer, MAX_PATH, &len) != 0) - result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer)); - } + QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive); + if (matchVolName.indexIn(result) == 0) { + DWORD len; + wchar_t buffer[MAX_PATH]; + QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\")); + if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0) + result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer)); } -#endif // !Q_OS_WINCE && !Q_OS_WINRT +#endif // !Q_OS_WINRT } #else Q_UNUSED(link); -#endif // Q_OS_WINCE || Q_OS_WINRT +#endif // Q_OS_WINRT return result; } static QString readLink(const QFileSystemEntry &link) { -#if !defined(Q_OS_WINCE) #if !defined(QT_NO_LIBRARY) QString ret; @@ -418,21 +402,6 @@ static QString readLink(const QFileSystemEntry &link) Q_UNUSED(link); return QString(); #endif // QT_NO_LIBRARY -#elif !defined(QT_NO_WINCE_SHELLSDK) - wchar_t target[MAX_PATH]; - QString result; - if (SHGetShortcutTarget((wchar_t*)QFileInfo(link.filePath()).absoluteFilePath().replace(QLatin1Char('/'),QLatin1Char('\\')).utf16(), target, MAX_PATH)) { - result = QString::fromWCharArray(target); - if (result.startsWith(QLatin1Char('"'))) - result.remove(0,1); - if (result.endsWith(QLatin1Char('"'))) - result.remove(result.size()-1,1); - } - return result; -#else // QT_NO_WINCE_SHELLSDK - Q_UNUSED(link); - return QString(); -#endif // Q_OS_WINCE } static bool uncShareExists(const QString &server) @@ -533,7 +502,7 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path) { // can be //server or //server/share QString absPath; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81) +#if !defined(Q_OS_WINRT_WIN81) QVarLengthArray<wchar_t, MAX_PATH> buf(qMax(MAX_PATH, path.size() + 1)); wchar_t *fileName = 0; DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName); @@ -553,17 +522,12 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path) if (absPath.size() < rootPath.size() && rootPath.startsWith(absPath)) absPath = rootPath; # endif // Q_OS_WINRT -#elif !defined(Q_OS_WINCE) +#else // !Q_OS_WINRT_WIN81 if (QDir::isRelativePath(path)) absPath = QDir::toNativeSeparators(QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + path)); else absPath = QDir::toNativeSeparators(QDir::cleanPath(path)); -#else // Q_OS_WINRT - if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\'))) - absPath = QDir::toNativeSeparators(path); - else - absPath = QDir::toNativeSeparators(QDir::cleanPath(qfsPrivateCurrentDir + QLatin1Char('/') + path)); -#endif // Q_OS_WINCE +#endif // Q_OS_WINRT_WIN81 // This is really ugly, but GetFullPathName strips off whitespace at the end. // If you for instance write ". " in the lineedit of QFileDialog, // (which is an invalid filename) this function will strip the space off and viola, @@ -580,15 +544,10 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) QString ret; if (!entry.isRelative()) { -#if !defined(Q_OS_WINCE) - if (entry.isAbsolute() && entry.isClean()) { + if (entry.isAbsolute() && entry.isClean()) ret = entry.filePath(); - } else { + else ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath())); - } -#else - ret = entry.filePath(); -#endif } else { #ifndef Q_OS_WINRT_WIN81 ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + entry.filePath()); @@ -617,25 +576,14 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath()); } -#ifndef Q_OS_WINCE - -// FILE_INFO_BY_HANDLE_CLASS has been extended by FileIdInfo = 18 as of VS2012. -typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS; - -# if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601)) - -// MinGW-64 defines FILE_ID_128 as of gcc-4.8.1 along with FILE_SUPPORTS_INTEGRITY_STREAMS -# if !(defined(Q_CC_MINGW) && defined(FILE_SUPPORTS_INTEGRITY_STREAMS)) -typedef struct _FILE_ID_128 { - BYTE Identifier[16]; -} FILE_ID_128, *PFILE_ID_128; -# endif // !(Q_CC_MINGW && FILE_SUPPORTS_INTEGRITY_STREAMS) +#if defined(Q_CC_MINGW) && WINVER < 0x0602 // Windows 8 onwards typedef struct _FILE_ID_INFO { ULONGLONG VolumeSerialNumber; FILE_ID_128 FileId; } FILE_ID_INFO, *PFILE_ID_INFO; -# endif // if defined (Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601)) + +#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602 // File ID for Windows up to version 7. static inline QByteArray fileId(HANDLE handle) @@ -658,44 +606,26 @@ static inline QByteArray fileId(HANDLE handle) // File ID for Windows starting from version 8. QByteArray fileIdWin8(HANDLE handle) { -#ifndef Q_OS_WINRT - typedef BOOL (WINAPI* GetFileInformationByHandleExType)(HANDLE, Q_FILE_INFO_BY_HANDLE_CLASS, void *, DWORD); - - // Dynamically resolve GetFileInformationByHandleEx (Vista onwards). - static GetFileInformationByHandleExType getFileInformationByHandleEx = 0; - if (!getFileInformationByHandleEx) { - QSystemLibrary library(QLatin1String("kernel32")); - getFileInformationByHandleEx = (GetFileInformationByHandleExType)library.resolve("GetFileInformationByHandleEx"); - } - QByteArray result; - if (getFileInformationByHandleEx) { - FILE_ID_INFO infoEx; - if (getFileInformationByHandleEx(handle, Q_FileIdInfo, - &infoEx, sizeof(FILE_ID_INFO))) { - result = QByteArray::number(infoEx.VolumeSerialNumber, 16); - result += ':'; - // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one. - result += QByteArray((char *)&infoEx.FileId, sizeof(infoEx.FileId)).toHex(); - } - } -#else // !Q_OS_WINRT +#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE) QByteArray result; FILE_ID_INFO infoEx; - if (GetFileInformationByHandleEx(handle, FileIdInfo, + if (GetFileInformationByHandleEx(handle, + static_cast<FILE_INFO_BY_HANDLE_CLASS>(18), // FileIdInfo in Windows 8 &infoEx, sizeof(FILE_ID_INFO))) { result = QByteArray::number(infoEx.VolumeSerialNumber, 16); result += ':'; - result += QByteArray((char *)infoEx.FileId.Identifier, sizeof(infoEx.FileId.Identifier)).toHex(); + // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one. + result += QByteArray(reinterpret_cast<const char *>(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex(); } -#endif // Q_OS_WINRT return result; +#else // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE + return fileId(handle); +#endif } -#endif // !Q_OS_WINCE //static QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) { -#ifndef Q_OS_WINCE QByteArray result; const HANDLE handle = #ifndef Q_OS_WINRT @@ -711,9 +641,6 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) CloseHandle(handle); } return result; -#else // !Q_OS_WINCE - return entry.nativeFilePath().toLower().toLatin1(); -#endif } //static @@ -882,7 +809,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa { bool entryExists = false; DWORD fileAttrib = 0; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) if (fname.isDriveRoot()) { // a valid drive ?? DWORD drivesBitmask = ::GetLogicalDrives(); @@ -923,7 +850,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa fileAttrib = FILE_ATTRIBUTE_DIRECTORY; entryExists = true; } -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) } #endif if (entryExists) @@ -947,7 +874,6 @@ static bool tryFindFallback(const QFileSystemEntry &fname, QFileSystemMetaData & return filledData; } -#if !defined(Q_OS_WINCE) //static bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what) @@ -958,7 +884,6 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data, } return false; } -#endif //static bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data, @@ -1067,25 +992,6 @@ static inline bool mkDir(const QString &path, DWORD *lastError = 0) { if (lastError) *lastError = 0; -#if defined(Q_OS_WINCE) - // Unfortunately CreateDirectory returns true for paths longer than - // 256, but does not create a directory. It starts to fail, when - // path length > MAX_PATH, which is 260 usually on CE. - // This only happens on a Windows Mobile device. Windows CE seems - // not to be affected by this. - static int platformId = 0; - if (platformId == 0) { - wchar_t platformString[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(platformString)/sizeof(*platformString),platformString,0)) { - if (0 == wcscmp(platformString, L"PocketPC") || 0 == wcscmp(platformString, L"Smartphone")) - platformId = 1; - else - platformId = 2; - } - } - if (platformId == 1 && QFSFileEnginePrivate::longFileName(path).size() > 256) - return false; -#endif const QString longPath = QFSFileEnginePrivate::longFileName(path); const bool result = ::CreateDirectory((wchar_t*)longPath.utf16(), 0); if (lastError) // Capture lastError before any QString is freed since custom allocators might change it. @@ -1215,9 +1121,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo //static QString QFileSystemEngine::rootPath() { -#if defined(Q_OS_WINCE) - QString ret = QLatin1String("/"); -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) // We specify the package root as root directory QString ret = QLatin1String("/"); // Get package location @@ -1283,13 +1187,8 @@ QString QFileSystemEngine::homePath() + QString::fromLocal8Bit(qgetenv("HOMEPATH")); if (ret.isEmpty() || !QFile::exists(ret)) { ret = QString::fromLocal8Bit(qgetenv("HOME")); - if (ret.isEmpty() || !QFile::exists(ret)) { -#if defined(Q_OS_WINCE) - ret = QLatin1String("\\My Documents"); - if (!QFile::exists(ret)) -#endif - ret = rootPath(); - } + if (ret.isEmpty() || !QFile::exists(ret)) + ret = rootPath(); } } } @@ -1302,10 +1201,6 @@ QString QFileSystemEngine::tempPath() #ifndef Q_OS_WINRT wchar_t tempPath[MAX_PATH]; const DWORD len = GetTempPath(MAX_PATH, tempPath); -#ifdef Q_OS_WINCE - if (len) - ret = QString::fromWCharArray(tempPath, len); -#else // Q_OS_WINCE if (len) { // GetTempPath() can return short names, expand. wchar_t longTempPath[MAX_PATH]; const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH); @@ -1313,7 +1208,6 @@ QString QFileSystemEngine::tempPath() QString::fromWCharArray(longTempPath, longLen) : QString::fromWCharArray(tempPath, len); } -#endif // !Q_OS_WINCE if (!ret.isEmpty()) { while (ret.endsWith(QLatin1Char('\\'))) ret.chop(1); @@ -1341,11 +1235,7 @@ QString QFileSystemEngine::tempPath() ret = QDir::fromNativeSeparators(QString::fromWCharArray(path.GetRawBuffer(nullptr))); #endif // Q_OS_WINRT if (ret.isEmpty()) { -#if !defined(Q_OS_WINCE) ret = QLatin1String("C:/tmp"); -#else - ret = QLatin1String("/Temp"); -#endif } else if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. return ret; @@ -1358,7 +1248,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry) if(!(meta.exists() && meta.isDirectory())) return false; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81) +#if !defined(Q_OS_WINRT_WIN81) //TODO: this should really be using nativeFilePath(), but that returns a path in long format \\?\c:\foo //which causes many problems later on when it's returned through currentPath() return ::SetCurrentDirectory(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(entry.filePath()).utf16())) != 0; @@ -1371,7 +1261,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry) QFileSystemEntry QFileSystemEngine::currentPath() { QString ret; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81) +#if !defined(Q_OS_WINRT_WIN81) DWORD size = 0; wchar_t currentName[PATH_MAX]; size = ::GetCurrentDirectory(PATH_MAX, currentName); @@ -1387,17 +1277,13 @@ QFileSystemEntry QFileSystemEngine::currentPath() } if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. -#else // !Q_OS_WINCE && !Q_OS_WINRT_WIN81 +#else // !Q_OS_WINRT_WIN81 //TODO - a race condition exists when using currentPath / setCurrentPath from multiple threads if (qfsPrivateCurrentDir.isEmpty()) -#ifndef Q_OS_WINRT_WIN81 - qfsPrivateCurrentDir = QCoreApplication::applicationDirPath(); -#else qfsPrivateCurrentDir = QDir::rootPath(); -#endif ret = qfsPrivateCurrentDir; -#endif // Q_OS_WINCE || Q_OS_WINRT_WIN81 +#endif // Q_OS_WINRT_WIN81 return QFileSystemEntry(ret, QFileSystemEntry::FromNativePath()); } @@ -1479,31 +1365,11 @@ static inline QDateTime fileTimeToQDateTime(const FILETIME *time) { QDateTime ret; -#if defined(Q_OS_WINCE) - SYSTEMTIME systime; - FILETIME ftime; - systime.wYear = 1970; - systime.wMonth = 1; - systime.wDay = 1; - systime.wHour = 0; - systime.wMinute = 0; - systime.wSecond = 0; - systime.wMilliseconds = 0; - systime.wDayOfWeek = 4; - SystemTimeToFileTime(&systime, &ftime); - unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime; - FileTimeToSystemTime(time, &systime); - unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime; - unsigned __int64 difftime = acttime - time1970; - difftime /= 10000000; - ret.setTime_t((unsigned int)difftime); -#else SYSTEMTIME sTime, lTime; FileTimeToSystemTime(time, &sTime); SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime); ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay)); ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds)); -#endif return ret; } diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index ba195b2330..9e40a41b4c 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -92,12 +92,10 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa haveData = true; int infoLevel = 0 ; // FindExInfoStandard; DWORD dwAdditionalFlags = 0; -#ifndef Q_OS_WINCE if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { dwAdditionalFlags = 2; // FIND_FIRST_EX_LARGE_FETCH infoLevel = 1 ; // FindExInfoBasic; } -#endif int searchOps = 0; // FindExSearchNameMatch if (onlyDirs) searchOps = 1 ; // FindExSearchLimitToDirectories diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 7135c9b19b..b38188d357 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -331,13 +331,10 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo if (setLinkType) { knownFlagsMask |= LinkType; entryFlags &= ~LinkType; -#if !defined(Q_OS_WINCE) if ((fileAttribute_ & FILE_ATTRIBUTE_REPARSE_POINT) && (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { entryFlags |= LinkType; } -#endif - } } diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index e8b49db9f3..be56d8dd1d 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -86,13 +86,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, QString path = it.next(); QString normalPath = path; if ((normalPath.endsWith(QLatin1Char('/')) && !normalPath.endsWith(QLatin1String(":/"))) - || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\"))) -#ifdef Q_OS_WINCE - && normalPath.size() > 1) -#else - ) -#endif - normalPath.chop(1); + || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))) { + normalPath.chop(1); + } QFileInfo fileInfo(normalPath); if (!fileInfo.exists()) continue; diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2cda4d6bda..098bc49468 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -48,9 +48,7 @@ #ifndef QT_NO_FSFILEENGINE -#if !defined(Q_OS_WINCE) #include <errno.h> -#endif #if defined(Q_OS_UNIX) #include "private/qcore_unix_p.h" #endif @@ -125,10 +123,8 @@ void QFSFileEnginePrivate::init() { is_sequential = 0; tried_stat = 0; -#if !defined(Q_OS_WINCE) need_lstat = 1; is_link = 0; -#endif openMode = QIODevice::NotOpen; fd = -1; fh = 0; @@ -139,10 +135,8 @@ void QFSFileEnginePrivate::init() fileAttrib = INVALID_FILE_ATTRIBUTES; fileHandle = INVALID_HANDLE_VALUE; mapHandle = NULL; -#ifndef Q_OS_WINCE cachedFd = -1; #endif -#endif } /*! @@ -551,7 +545,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos) } else { // Unbuffered stdio mode. if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) { - qWarning() << "QFile::at: Cannot set file position" << pos; + qWarning("QFile::at: Cannot set file position %lld", pos); q->setError(QFile::PositionError, qt_error_string(errno)); return false; } diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index dd498a5bc5..593ecc2687 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -61,10 +61,6 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE_STD) && _WIN32_WCE < 0x600 -#define Q_USE_DEPRECATED_MAP_API 1 -#endif - class QFSFileEnginePrivate; class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine @@ -184,10 +180,7 @@ public: HANDLE mapHandle; QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps; -#ifndef Q_OS_WINCE mutable int cachedFd; -#endif - mutable DWORD fileAttrib; #else QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps; @@ -206,10 +199,8 @@ public: mutable uint is_sequential : 2; mutable uint tried_stat : 1; -#if !defined(Q_OS_WINCE) mutable uint need_lstat : 1; mutable uint is_link : 1; -#endif #if defined(Q_OS_WIN) bool doStat(QFileSystemMetaData::MetaDataFlags flags) const; diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index d94a8433a9..1e041ab837 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -50,13 +50,9 @@ #include "qdatetime.h" #include "qt_windows.h" -#if !defined(Q_OS_WINCE) -# include <sys/types.h> -# include <direct.h> -# include <winioctl.h> -#else -# include <types.h> -#endif +#include <sys/types.h> +#include <direct.h> +#include <winioctl.h> #include <objbase.h> #ifndef Q_OS_WINRT # include <shlobj.h> @@ -77,14 +73,12 @@ QT_BEGIN_NAMESPACE -#if !defined(Q_OS_WINCE) static inline bool isUncPath(const QString &path) { // Starts with \\, but not \\. return (path.startsWith(QLatin1String("\\\\")) && path.size() > 2 && path.at(2) != QLatin1Char('.')); } -#endif /*! \internal @@ -95,7 +89,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path) return path; QString absPath = QFileSystemEngine::nativeAbsoluteFilePath(path); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QString prefix = QLatin1String("\\\\?\\"); if (isUncPath(absPath)) { prefix.append(QLatin1String("UNC\\")); // "\\\\?\\UNC\\" @@ -171,7 +165,6 @@ bool QFSFileEnginePrivate::nativeClose() // Windows native mode. bool ok = true; -#ifndef Q_OS_WINCE if (cachedFd != -1) { if (::_close(cachedFd) && !::CloseHandle(fileHandle)) { q->setError(QFile::UnspecifiedError, qt_error_string()); @@ -184,7 +177,6 @@ bool QFSFileEnginePrivate::nativeClose() return ok; } -#endif if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) { q->setError(QFile::UnspecifiedError, qt_error_string()); @@ -238,24 +230,6 @@ qint64 QFSFileEnginePrivate::nativeSize() const // Always retrive the current information metaData.clearFlags(QFileSystemMetaData::SizeAttribute); -#if defined(Q_OS_WINCE) - // Buffered stdlib mode. - if (fh) { - QT_OFF_T oldPos = QT_FTELL(fh); - QT_FSEEK(fh, 0, SEEK_END); - qint64 fileSize = (qint64)QT_FTELL(fh); - QT_FSEEK(fh, oldPos, SEEK_SET); - if (fileSize == -1) { - fileSize = 0; - thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); - } - return fileSize; - } - if (fd != -1) { - thatQ->setError(QFile::UnspecifiedError, QLatin1String("Not implemented!")); - return 0; - } -#endif bool filled = false; if (fileHandle != INVALID_HANDLE_VALUE && openMode != QIODevice::NotOpen ) filled = QFileSystemEngine::fillMetaData(fileHandle, metaData, @@ -287,7 +261,6 @@ qint64 QFSFileEnginePrivate::nativePos() const if (fileHandle == INVALID_HANDLE_VALUE) return 0; -#if !defined(Q_OS_WINCE) LARGE_INTEGER currentFilePos; LARGE_INTEGER offset; offset.QuadPart = 0; @@ -297,18 +270,6 @@ qint64 QFSFileEnginePrivate::nativePos() const } return qint64(currentFilePos.QuadPart); -#else - LARGE_INTEGER filepos; - filepos.HighPart = 0; - DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT); - if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) { - thatQ->setError(QFile::UnspecifiedError, qt_error_string()); - return 0; - } - - filepos.LowPart = newFilePointer; - return filepos.QuadPart; -#endif } /* @@ -323,7 +284,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos) return seekFdFh(pos); } -#if !defined(Q_OS_WINCE) LARGE_INTEGER currentFilePos; LARGE_INTEGER offset; offset.QuadPart = pos; @@ -333,17 +293,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos) } return true; -#else - DWORD newFilePointer; - LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos); - newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN); - if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) { - q->setError(QFile::PositionError, qt_error_string()); - return false; - } - - return true; -#endif } /* @@ -462,7 +411,6 @@ int QFSFileEnginePrivate::nativeHandle() const { if (fh || fd != -1) return fh ? QT_FILENO(fh) : fd; -#ifndef Q_OS_WINCE if (cachedFd != -1) return cachedFd; @@ -473,9 +421,6 @@ int QFSFileEnginePrivate::nativeHandle() const flags |= _O_RDONLY; cachedFd = _open_osfhandle((intptr_t) fileHandle, flags); return cachedFd; -#else - return -1; -#endif } /* @@ -483,7 +428,7 @@ int QFSFileEnginePrivate::nativeHandle() const */ bool QFSFileEnginePrivate::nativeIsSequential() const { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) HANDLE handle = fileHandle; if (fh || fd != -1) handle = (HANDLE)_get_osfhandle(fh ? QT_FILENO(fh) : fd); @@ -531,35 +476,9 @@ bool QFSFileEngine::rename(const QString &newName) bool QFSFileEngine::renameOverwrite(const QString &newName) { Q_D(QFSFileEngine); -#if defined(Q_OS_WINCE) - // Windows Embedded Compact 7 does not have MoveFileEx, simulate it with the following sequence: - // 1. DeleteAndRenameFile (Should work on RAM FS when both files exist) - // 2. DeleteFile/MoveFile (Should work on all file systems) - // - // DeleteFile/MoveFile fallback implementation violates atomicity, but it is more acceptable than - // alternative CopyFile/DeleteFile sequence for the following reasons: - // - // 1. DeleteFile/MoveFile is way faster than CopyFile/DeleteFile and thus more atomic. - // 2. Given the intended use case of this function in QSaveFile, DeleteFile/MoveFile sequence will - // delete the old content, but leave a file "filename.ext.XXXXXX" in the same directory if MoveFile fails. - // With CopyFile/DeleteFile sequence, it can happen that new data is partially copied to target file - // (because CopyFile is not atomic either), thus leaving *some* content to target file. - // This makes the need for application level recovery harder to detect than in DeleteFile/MoveFile - // sequence where target file simply does not exist. - // - bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), - (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; - if (!ret) { - ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; - if (ret || ::GetLastError() == ERROR_FILE_NOT_FOUND) - ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(), - (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; - } -#else bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(), (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), MOVEFILE_REPLACE_EXISTING) != 0; -#endif if (!ret) setError(QFile::RenameError, QSystemError(::GetLastError(), QSystemError::NativeError).toString()); return ret; @@ -587,7 +506,7 @@ bool QFSFileEngine::setCurrentPath(const QString &path) QString QFSFileEngine::currentPath(const QString &fileName) { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QString ret; //if filename is a drive: then get the pwd of that drive if (fileName.length() >= 2 && @@ -606,10 +525,10 @@ QString QFSFileEngine::currentPath(const QString &fileName) if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. return ret; -#else // !Q_OS_WINCE && !Q_OS_WINRT +#else // !Q_OS_WINRT Q_UNUSED(fileName); return QFileSystemEngine::currentPath().filePath(); -#endif // Q_OS_WINCE || Q_OS_WINRT +#endif // Q_OS_WINRT } QString QFSFileEngine::homePath() @@ -630,10 +549,10 @@ QString QFSFileEngine::tempPath() QFileInfoList QFSFileEngine::drives() { QFileInfoList ret; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -#if defined(Q_OS_WIN32) +#if !defined(Q_OS_WINRT) +# if defined(Q_OS_WIN32) quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; -#endif +# endif char driveName[] = "A:/"; while (driveBits) { @@ -643,10 +562,10 @@ QFileInfoList QFSFileEngine::drives() driveBits = driveBits >> 1; } return ret; -#else // !Q_OS_WINCE && !Q_OS_WINRT +#else // !Q_OS_WINRT ret.append(QFileInfo(QLatin1String("/"))); return ret; -#endif // Q_OS_WINCE || Q_OS_WINRT +#endif // Q_OS_WINRT } bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const @@ -654,13 +573,11 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons if (!tried_stat || !metaData.hasFlags(flags)) { tried_stat = true; -#if !defined(Q_OS_WINCE) int localFd = fd; if (fh && fileEntry.isEmpty()) localFd = QT_FILENO(fh); if (localFd != -1) QFileSystemEngine::fillMetaData(localFd, metaData, flags); -#endif if (metaData.missingFlags(flags) && !fileEntry.isEmpty()) QFileSystemEngine::fillMetaData(fileEntry, metaData, metaData.missingFlags(flags)); } @@ -671,8 +588,8 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons bool QFSFileEngine::link(const QString &newName) { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -#if !defined(QT_NO_LIBRARY) +#if !defined(Q_OS_WINRT) +# if !defined(QT_NO_LIBRARY) bool ret = false; QString linkName = newName; @@ -713,24 +630,11 @@ bool QFSFileEngine::link(const QString &newName) CoUninitialize(); return ret; -#else +# else // QT_NO_LIBRARY Q_UNUSED(newName); return false; -#endif // QT_NO_LIBRARY -#elif defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_SHELLSDK) - QString linkName = newName; - linkName.replace(QLatin1Char('/'), QLatin1Char('\\')); - if (!linkName.endsWith(QLatin1String(".lnk"))) - linkName += QLatin1String(".lnk"); - QString orgName = fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\')); - // Need to append on our own - orgName.prepend(QLatin1Char('"')); - orgName.append(QLatin1Char('"')); - bool ret = SUCCEEDED(SHCreateShortcut((wchar_t*)linkName.utf16(), (wchar_t*)orgName.utf16())); - if (!ret) - setError(QFile::RenameError, qt_error_string()); - return ret; -#else // Q_OS_WINCE && !QT_NO_WINCE_SHELLSDK +# endif // QT_NO_LIBRARY +#else // !Q_OS_WINRT Q_UNUSED(newName); Q_UNIMPLEMENTED(); return false; @@ -811,7 +715,6 @@ QString QFSFileEngine::fileName(FileName file) const QString ret; if (!isRelativePath()) { -#if !defined(Q_OS_WINCE) if (d->fileEntry.filePath().startsWith(QLatin1Char('/')) || // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt d->fileEntry.filePath().size() == 2 || // It's a drive letter that needs to get a working dir appended (d->fileEntry.filePath().size() > 2 && d->fileEntry.filePath().at(2) != QLatin1Char('/')) || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt @@ -819,9 +722,7 @@ QString QFSFileEngine::fileName(FileName file) const d->fileEntry.filePath().endsWith(QLatin1String("/..")) || d->fileEntry.filePath().endsWith(QLatin1String("/."))) { ret = QDir::fromNativeSeparators(QFileSystemEngine::nativeAbsoluteFilePath(d->fileEntry.filePath())); - } else -#endif - { + } else { ret = d->fileEntry.filePath(); } } else { @@ -903,14 +804,12 @@ bool QFSFileEngine::setSize(qint64 size) if (d->fileHandle != INVALID_HANDLE_VALUE || d->fd != -1 || d->fh) { // resize open file HANDLE fh = d->fileHandle; -#if !defined(Q_OS_WINCE) if (fh == INVALID_HANDLE_VALUE) { if (d->fh) fh = (HANDLE)_get_osfhandle(QT_FILENO(d->fh)); else fh = (HANDLE)_get_osfhandle(d->fd); } -#endif if (fh == INVALID_HANDLE_VALUE) return false; qint64 currentPos = pos(); @@ -982,10 +881,8 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, // get handle to the file HANDLE handle = fileHandle; -#ifndef Q_OS_WINCE if (handle == INVALID_HANDLE_VALUE && fh) handle = (HANDLE)::_get_osfhandle(QT_FILENO(fh)); -#endif #ifdef Q_USE_DEPRECATED_MAP_API nativeClose(); diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index fd204b00de..36616a5236 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1148,34 +1148,31 @@ QByteArray QIODevice::read(qint64 maxSize) Q_D(QIODevice); QByteArray result; - CHECK_MAXLEN(read, result); - #if defined QIODEVICE_DEBUG printf("%p QIODevice::read(%lld), d->pos = %lld, d->buffer.size() = %lld\n", this, maxSize, d->pos, d->buffer.size()); #endif + // Try to prevent the data from being copied, if we have a chunk + // with the same size in the read buffer. + if (maxSize == d->buffer.nextDataBlockSize() && !d->transactionStarted + && (d->openMode & (QIODevice::ReadOnly | QIODevice::Text)) == QIODevice::ReadOnly) { + result = d->buffer.read(); + if (!d->isSequential()) + d->pos += maxSize; + if (d->buffer.isEmpty()) + readData(nullptr, 0); + return result; + } + + CHECK_MAXLEN(read, result); if (maxSize >= MaxByteArraySize) { checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit"); maxSize = MaxByteArraySize - 1; } - qint64 readBytes = 0; - if (maxSize) { - result.resize(int(maxSize)); - if (!result.size()) { - // If resize fails, read incrementally. - qint64 readResult; - do { - result.resize(int(qMin(maxSize, qint64(result.size() + d->readBufferChunkSize)))); - readResult = read(result.data() + readBytes, result.size() - readBytes); - if (readResult > 0 || readBytes == 0) - readBytes += readResult; - } while (readResult == d->readBufferChunkSize); - } else { - readBytes = read(result.data(), result.size()); - } - } + result.resize(int(maxSize)); + qint64 readBytes = read(result.data(), result.size()); if (readBytes <= 0) result.clear(); diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 9062df37da..ba4a091965 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -100,7 +100,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() ? QLockFile::LockFailedError : QLockFile::PermissionError; default: - qWarning() << "Got unexpected locking error" << lastError; + qWarning("Got unexpected locking error %llu", quint64(lastError)); return QLockFile::UnknownError; } } @@ -163,7 +163,7 @@ bool QLockFilePrivate::isApparentlyStale() const QString QLockFilePrivate::processNameByPid(qint64 pid) { -#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINRT) typedef DWORD (WINAPI *GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD); HMODULE hPsapi = LoadLibraryA("psapi"); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 0a0fef4cd8..439f9fce5a 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -48,9 +48,6 @@ #if defined QPROCESS_DEBUG #include <qstring.h> #include <ctype.h> -#if !defined(Q_OS_WINCE) -#include <errno.h> -#endif QT_BEGIN_NAMESPACE /* @@ -2005,13 +2002,6 @@ qint64 QProcess::writeData(const char *data, qint64 len) { Q_D(QProcess); -#if defined(Q_OS_WINCE) - Q_UNUSED(data); - Q_UNUSED(len); - d->setErrorAndEmit(QProcess::WriteError); - return -1; -#endif - if (d->stdinChannel.closed) { #if defined QPROCESS_DEBUG qDebug("QProcess::writeData(%p \"%s\", %lld) == 0 (write channel closing)", @@ -2194,7 +2184,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode) mode &= ~QIODevice::ReadOnly; // not open for reading if (mode == 0) mode = QIODevice::Unbuffered; -#ifndef Q_OS_WINCE if ((mode & QIODevice::ReadOnly) == 0) { if (stdoutChannel.type == QProcessPrivate::Channel::Normal) q->setStandardOutputFile(q->nullDevice()); @@ -2202,7 +2191,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode) && processChannelMode != QProcess::MergedChannels) q->setStandardErrorFile(q->nullDevice()); } -#endif q->QIODevice::open(mode); @@ -2560,7 +2548,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #if defined(Q_OS_MACX) # include <crt_externs.h> # define environ (*_NSGetEnviron()) -#elif defined(Q_OS_WINCE) || defined(Q_OS_IOS) +#elif defined(Q_OS_IOS) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp deleted file mode 100644 index 564b3f520d..0000000000 --- a/src/corelib/io/qprocess_wince.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qprocess.h" -#include "qprocess_p.h" - -#include <qdir.h> -#include <qfileinfo.h> -#include <qregexp.h> -#include <qtimer.h> -#include <qwineventnotifier.h> -#include <qdebug.h> -#include <private/qthread_p.h> - -#ifndef QT_NO_PROCESS - -QT_BEGIN_NAMESPACE - -//#define QPROCESS_DEBUG - -void QProcessPrivate::destroyPipe(Q_PIPE pipe[2]) -{ - Q_UNUSED(pipe); -} - -void QProcessPrivate::closeChannel(Channel *channel) -{ - Q_UNUSED(channel); -} - -static QString qt_create_commandline(const QString &program, const QStringList &arguments) -{ - QString args; - if (!program.isEmpty()) { - QString programName = program; - if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1Char(' '))) - programName = QLatin1Char('\"') + programName + QLatin1Char('\"'); - programName.replace(QLatin1Char('/'), QLatin1Char('\\')); - - // add the prgram as the first arg ... it works better - args = programName + QLatin1Char(' '); - } - - for (int i=0; i<arguments.size(); ++i) { - QString tmp = arguments.at(i); - // Quotes are escaped and their preceding backslashes are doubled. - tmp.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\"")); - if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) { - // The argument must not end with a \ since this would be interpreted - // as escaping the quote -- rather put the \ behind the quote: e.g. - // rather use "foo"\ than "foo\" - int i = tmp.length(); - while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) - --i; - tmp.insert(i, QLatin1Char('"')); - tmp.prepend(QLatin1Char('"')); - } - args += QLatin1Char(' ') + tmp; - } - return args; -} - -QProcessEnvironment QProcessEnvironment::systemEnvironment() -{ - QProcessEnvironment env; - return env; -} - -void QProcessPrivate::startProcess() -{ - Q_Q(QProcess); - - bool success = false; - - if (pid) { - CloseHandle(pid->hThread); - CloseHandle(pid->hProcess); - delete pid; - pid = 0; - } - pid = new PROCESS_INFORMATION; - memset(pid, 0, sizeof(PROCESS_INFORMATION)); - - q->setProcessState(QProcess::Starting); - - QString args = qt_create_commandline(QString(), arguments); - if (!nativeArguments.isEmpty()) { - if (!args.isEmpty()) - args += QLatin1Char(' '); - args += nativeArguments; - } - -#if defined QPROCESS_DEBUG - qDebug("Creating process"); - qDebug(" program : [%s]", program.toLatin1().constData()); - qDebug(" args : %s", args.toLatin1().constData()); - qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes"); -#endif - - QString fullPathProgram = program; - if (!QDir::isAbsolutePath(fullPathProgram)) - fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath(); - fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcess((wchar_t*)fullPathProgram.utf16(), - (wchar_t*)args.utf16(), - 0, 0, false, 0, 0, 0, 0, pid); - - if (!success) { - cleanup(); - setErrorAndEmit(QProcess::FailedToStart); - q->setProcessState(QProcess::NotRunning); - return; - } - - q->setProcessState(QProcess::Running); - // User can call kill()/terminate() from the stateChanged() slot - // so check before proceeding - if (!pid) - return; - - if (threadData->hasEventDispatcher()) { - processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q); - QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied())); - processFinishedNotifier->setEnabled(true); - } - - // give the process a chance to start ... - Sleep(20); - _q_startupNotification(); -} - -bool QProcessPrivate::processStarted(QString * /*errorMessage*/) -{ - return processState == QProcess::Running; -} - -qint64 QProcessPrivate::bytesAvailableInChannel(const Channel *) const -{ - return 0; -} - -qint64 QProcessPrivate::readFromChannel(const Channel *, char *data, qint64 maxlen) -{ - return -1; -} - -static BOOL QT_WIN_CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId) -{ - DWORD currentProcId = 0; - GetWindowThreadProcessId(hwnd, ¤tProcId); - if (currentProcId == (DWORD)procId) - PostMessage(hwnd, WM_CLOSE, 0, 0); - - return TRUE; -} - -void QProcessPrivate::terminateProcess() -{ - if (pid) { - EnumWindows(qt_terminateApp, (LPARAM)pid->dwProcessId); - PostThreadMessage(pid->dwThreadId, WM_CLOSE, 0, 0); - } -} - -void QProcessPrivate::killProcess() -{ - if (pid) - TerminateProcess(pid->hProcess, 0xf291); -} - -bool QProcessPrivate::waitForStarted(int) -{ - Q_Q(QProcess); - - if (processStarted()) - return true; - - if (processError == QProcess::FailedToStart) - return false; - - setError(QProcess::Timedout); - return false; -} - -bool QProcessPrivate::drainOutputPipes() -{ - return true; -} - -bool QProcessPrivate::waitForReadyRead(int msecs) -{ - return false; -} - -bool QProcessPrivate::waitForBytesWritten(int msecs) -{ - return false; -} - -bool QProcessPrivate::waitForFinished(int msecs) -{ - Q_Q(QProcess); -#if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::waitForFinished(%d)", msecs); -#endif - - if (!pid) - return true; - - if (WaitForSingleObject(pid->hProcess, msecs == -1 ? INFINITE : msecs) == WAIT_OBJECT_0) { - _q_processDied(); - return true; - } - - setError(QProcess::Timedout); - return false; -} - -void QProcessPrivate::findExitCode() -{ - DWORD theExitCode; - if (GetExitCodeProcess(pid->hProcess, &theExitCode)) { - exitCode = theExitCode; - //### for now we assume a crash if exit code is less than -1 or the magic number - crashed = (exitCode == 0xf291 || (int)exitCode < 0); - } -} - -void QProcessPrivate::flushPipeWriter() -{ -} - -qint64 QProcessPrivate::pipeWriterBytesToWrite() const -{ - return 0; -} - -qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) -{ - Q_UNUSED(data); - Q_UNUSED(maxlen); - return -1; -} - -bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid) -{ - Q_UNUSED(workingDir); - QString args = qt_create_commandline(QString(), arguments); - - bool success = false; - - PROCESS_INFORMATION pinfo; - - QString fullPathProgram = program; - if (!QDir::isAbsolutePath(fullPathProgram)) - fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/'))); - fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcess((wchar_t*)fullPathProgram.utf16(), - (wchar_t*)args.utf16(), - 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo); - - if (success) { - CloseHandle(pinfo.hThread); - CloseHandle(pinfo.hProcess); - if (pid) - *pid = pinfo.dwProcessId; - } - - return success; -} - -QT_END_NAMESPACE - -#endif // QT_NO_PROCESS diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 6e788d28f4..831658befc 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -81,7 +81,6 @@ #include <stdlib.h> #ifdef Q_OS_WIN // for homedirpath reading from registry -# include <private/qsystemlibrary_p.h> # include <qt_windows.h> # ifndef Q_OS_WINRT # include <shlobj.h> @@ -986,21 +985,12 @@ static QString windowsConfigPath(int type) if (result.isEmpty()) { switch (type) { -#ifndef Q_OS_WINCE case CSIDL_COMMON_APPDATA: result = QLatin1String("C:\\temp\\qt-common"); break; case CSIDL_APPDATA: result = QLatin1String("C:\\temp\\qt-user"); break; -#else - case CSIDL_COMMON_APPDATA: - result = QLatin1String("\\Temp\\qt-common"); - break; - case CSIDL_APPDATA: - result = QLatin1String("\\Temp\\qt-user"); - break; -#endif default: ; } diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 05ed51e999..7c6b782acd 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -609,16 +609,12 @@ HKEY QWinSettingsPrivate::writeHandle() const QWinSettingsPrivate::~QWinSettingsPrivate() { if (deleteWriteHandleOnExit && writeHandle() != 0) { -#if defined(Q_OS_WINCE) - remove(regList.at(0).key()); -#else QString emptyKey; DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16())); if (res != ERROR_SUCCESS) { qWarning("QSettings: Failed to delete key \"%s\": %s", regList.at(0).key().toLatin1().data(), errorCodeToString(res).toLatin1().data()); } -#endif } for (int i = 0; i < regList.size(); ++i) @@ -660,10 +656,6 @@ void QWinSettingsPrivate::remove(const QString &uKey) } } } else { -#if defined(Q_OS_WINCE) - // For WinCE always Close the handle first. - RegCloseKey(handle); -#endif res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16())); if (res != ERROR_SUCCESS) { diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 9bd5a9e3b6..38c63553ea 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -51,13 +51,7 @@ const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x6 #include <qt_windows.h> #include <shlobj.h> -#if !defined(Q_OS_WINCE) -# include <intshcut.h> -#else -# if !defined(STANDARDSHELL_UI_MODEL) -# include <winx.h> -# endif -#endif +#include <intshcut.h> #ifndef CSIDL_MYMUSIC #define CSIDL_MYMUSIC 13 @@ -117,7 +111,6 @@ static inline void appendTestMode(QString &path) // Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath() static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type) { -#ifndef Q_OS_WINCE static const int clsids[] = { CSIDL_DESKTOPDIRECTORY, // DesktopLocation CSIDL_PERSONAL, // DocumentsLocation @@ -137,27 +130,6 @@ static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type) CSIDL_APPDATA, // AppDataLocation ("Roaming" path) CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path) }; -#else // !Q_OS_WINCE - static const int clsids[] = { - CSIDL_DESKTOPDIRECTORY, // DesktopLocation - CSIDL_PERSONAL, // DocumentsLocation - CSIDL_FONTS, // FontsLocation - CSIDL_PROGRAMS, // ApplicationsLocation - CSIDL_MYMUSIC, // MusicLocation - CSIDL_MYVIDEO, // MoviesLocation - CSIDL_MYPICTURES, // PicturesLocation - -1, -1, // TempLocation/HomeLocation - CSIDL_APPDATA, // AppLocalDataLocation, AppLocalDataLocation = DataLocation - -1, // CacheLocation - CSIDL_APPDATA, // GenericDataLocation - -1, // RuntimeLocation - CSIDL_APPDATA, // ConfigLocation - -1, -1, // DownloadLocation/GenericCacheLocation - CSIDL_APPDATA, // GenericConfigLocation - CSIDL_APPDATA, // AppDataLocation - CSIDL_APPDATA, // AppConfigLocation - }; -#endif // Q_OS_WINCE Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1)); return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1; @@ -183,7 +155,6 @@ static QString sHGetSpecialFolderPath(int clsid, QStandardPaths::StandardLocatio static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardLocation type, bool warn = false) { QString result; -#ifndef Q_OS_WINCE typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*); static const GetKnownFolderPath sHGetKnownFolderPath = // Vista onwards. @@ -199,11 +170,6 @@ static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardL qPrintable(displayName(type))); } } -#else // !Q_OS_WINCE - Q_UNUSED(clsid) - Q_UNUSED(type) - Q_UNUSED(warn) -#endif return result; } @@ -266,7 +232,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) dirs.append(localDir); // type-specific handling goes here -#ifndef Q_OS_WINCE if (isConfigLocation(type)) { QString programData = sHGetSpecialFolderPath(CSIDL_COMMON_APPDATA, type); if (!programData.isEmpty()) { @@ -274,12 +239,11 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) appendOrganizationAndApp(programData); dirs.append(programData); } -# ifndef QT_BOOTSTRAPPED +#ifndef QT_BOOTSTRAPPED dirs.append(QCoreApplication::applicationDirPath()); dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data")); -# endif // !QT_BOOTSTRAPPED +#endif // !QT_BOOTSTRAPPED } // isConfigLocation() -#endif // !Q_OS_WINCE return dirs; } diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h index 744653ea42..9dc66f2d69 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -70,7 +70,7 @@ public: static QStorageInfo root(); protected: -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void retrieveVolumeInfo(); void retrieveDiskFreeSpace(); #elif defined(Q_OS_MAC) diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 27b7570226..b8db23329a 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -231,9 +231,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384; #include "qnumeric.h" #include "qvarlengtharray.h" -#ifndef Q_OS_WINCE #include <locale.h> -#endif #include "private/qlocale_p.h" #include <stdlib.h> diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 18eaea7e21..1e409c105c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -413,9 +413,6 @@ #include "qtldurl_p.h" #include "private/qipaddress_p.h" #include "qurlquery.h" -#if defined(Q_OS_WINCE_WM) -#pragma optimize("g", off) -#endif QT_BEGIN_NAMESPACE extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 947b3bbb55..a6dc66d457 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -48,9 +48,9 @@ #include <QtCore/qpair.h> #include <QtCore/qglobal.h> -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFURL); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSURL); # endif #endif @@ -164,6 +164,12 @@ public: }; Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption) #ifdef Q_QDOC +private: + // We need to let qdoc think that FormattingOptions is a normal QFlags, but + // it needs to be a QUrlTwoFlags for compiling default arguments of somme functions. + template<typename T> struct QFlags : QUrlTwoFlags<T, ComponentFormattingOption> + { using QUrlTwoFlags<T, ComponentFormattingOption>::QUrlTwoFlags; }; +public: Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption) #else typedef QUrlTwoFlags<UrlFormattingOption, ComponentFormattingOption> FormattingOptions; @@ -372,6 +378,7 @@ Q_DECLARE_SHARED(QUrl) Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions) //Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions) +#ifndef Q_QDOC Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2) { return QUrl::FormattingOptions(f1) | f2; } Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2) @@ -399,6 +406,7 @@ Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormatt //inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f) //{ i = int(f); f; } +#endif // Q_QDOC #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &); diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 8c16e10c27..aa60e1686c 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -84,14 +84,6 @@ win32 { } } -wince { - SOURCES += \ - kernel/qfunctions_wince.cpp - HEADERS += \ - kernel/qfunctions_fake_env_p.h \ - kernel/qfunctions_wince.h -} - winrt { SOURCES += \ kernel/qfunctions_winrt.cpp @@ -156,8 +148,8 @@ unix|integrity { kernel/qeventdispatcher_glib.cpp HEADERS += \ kernel/qeventdispatcher_glib_p.h - QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS_PRIVATE +=$$QT_LIBS_GLIB + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GLIB + LIBS_PRIVATE +=$$QMAKE_LIBS_GLIB } contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0c1c37c89d..e319008292 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2261,14 +2261,6 @@ QStringList QCoreApplication::arguments() // classes by index. QString cmdline = QString::fromWCharArray(GetCommandLine()); -#if defined(Q_OS_WINCE) - wchar_t tempFilename[MAX_PATH+1]; - if (GetModuleFileName(0, tempFilename, MAX_PATH)) { - tempFilename[MAX_PATH] = 0; - cmdline.prepend(QLatin1Char('\"') + QString::fromWCharArray(tempFilename) + QLatin1String("\" ")); - } -#endif // Q_OS_WINCE - const QCoreApplicationPrivate *d = self->d_func(); if (d->origArgv) { const QStringList allArguments = qWinCmdArgs(cmdline); @@ -2499,6 +2491,26 @@ QStringList QCoreApplication::libraryPaths() } } +#ifdef Q_OS_DARWIN + // Check the main bundle's PlugIns directory as this is a standard location for Apple OSes. + // Note that the QLibraryInfo::PluginsPath below will coincidentally be the same as this value + // but with a different casing, so it can't be relied upon when the underlying filesystem + // is case sensitive (and this is always the case on newer OSes like iOS). + if (CFBundleRef bundleRef = CFBundleGetMainBundle()) { + if (QCFType<CFURLRef> urlRef = CFBundleCopyBuiltInPlugInsURL(bundleRef)) { + if (QCFType<CFURLRef> absoluteUrlRef = CFURLCopyAbsoluteURL(urlRef)) { + if (QCFString path = CFURLCopyFileSystemPath(absoluteUrlRef, kCFURLPOSIXPathStyle)) { + if (QFile::exists(path)) { + path = QDir(path).canonicalPath(); + if (!app_libpaths->contains(path)) + app_libpaths->append(path); + } + } + } + } + } +#endif // Q_OS_DARWIN + QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); if (QFile::exists(installPathPlugins)) { // Make sure we convert from backslashes to slashes. diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 601733b939..8ad4ba273c 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -81,16 +81,12 @@ Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command { -#if defined(Q_OS_WINCE) - return appCmdShow; -#else STARTUPINFO startupInfo; GetStartupInfo(&startupInfo); return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) ? startupInfo.wShowWindow : SW_SHOWDEFAULT; -#endif } Q_CORE_EXPORT QString qAppFileName() // get application file name @@ -143,7 +139,7 @@ QString QCoreApplicationPrivate::appName() const qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp *****************************************************************************/ -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) // ### Qt6: FIXME: Consider removing this function. It is here for Active Qt // servers and for binary for compatibility to applications built with Qt 5.3 @@ -164,30 +160,7 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, argv.append(_strdup(wArg.toLocal8Bit().constData())); } -#elif defined(Q_OS_WINCE) - -Q_CORE_EXPORT void __cdecl qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, - int cmdShow, int &argc, QVector<char *> &argv) -{ - static bool already_called = false; - - if (already_called) { - qWarning("Qt: Internal error: qWinMain should be called only once"); - return; - } - already_called = true; - - // Create command line - argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc); - - appCmdShow = cmdShow; - - // Ignore Windows parameters - Q_UNUSED(instance); - Q_UNUSED(prevInstance); -} - -#endif // Q_OS_WINCE +#endif // !Q_OS_WINRT #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index 2d8de08f2d..c5d9d130f0 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -81,93 +81,7 @@ static inline QStringList qWinCmdArgs(const QString &cmdLine) return result; } -#elif defined(Q_OS_WINCE) // Q_OS_WIN32 - -// template implementation of the parsing algorithm -// this is used from qcoreapplication_win.cpp and the tools (rcc, uic...) - -template<typename Char> -static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc) -{ - QVector<Char*> argv(8); - Char *p = cmdParam; - Char *p_end = p + length; - - argc = 0; - - while (*p && p < p_end) { // parse cmd line arguments - while (QChar((short)(*p)).isSpace()) // skip white space - p++; - if (*p && p < p_end) { // arg starts - int quote; - Char *start, *r; - if (*p == Char('\"')) { - quote = *p; - start = ++p; - } else { - quote = 0; - start = p; - } - r = start; - while (*p && p < p_end) { - if (quote) { - if (*p == quote) { - p++; - if (QChar((short)(*p)).isSpace()) - break; - quote = 0; - } - } - if (*p == '\\') { // escape char? - // testing by looking at argc, argv shows that it only escapes quotes - if (p < p_end && (*(p+1) == Char('\"'))) - p++; - } else { - if (!quote && (*p == Char('\"'))) { - quote = *p++; - continue; - } else if (QChar((short)(*p)).isSpace() && !quote) - break; - } - if (*p) - *r++ = *p++; - } - if (*p && p < p_end) - p++; - *r = Char('\0'); - - if (argc >= (int)argv.size()-1) // expand array - argv.resize(argv.size()*2); - argv[argc++] = start; - } - } - argv[argc] = 0; - - return argv; -} - -static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified -{ - QStringList args; - - int argc = 0; - QVector<wchar_t*> argv = qWinCmdLine<wchar_t>((wchar_t *)cmdLine.utf16(), cmdLine.length(), argc); - for (int a = 0; a < argc; ++a) { - args << QString::fromWCharArray(argv[a]); - } - - return args; -} - -static inline QStringList qCmdLineArgs(int argc, char *argv[]) -{ - Q_UNUSED(argc) - Q_UNUSED(argv) - QString cmdLine = QString::fromWCharArray(GetCommandLine()); - return qWinCmdArgs(cmdLine); -} - -#elif defined(Q_OS_WINRT) // Q_OS_WINCE +#elif defined(Q_OS_WINRT) // Q_OS_WIN32 static inline QStringList qCmdLineArgs(int argc, char *argv[]) { diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm index 55f27a5b60..437e4062ad 100644 --- a/src/corelib/kernel/qeventdispatcher_cf.mm +++ b/src/corelib/kernel/qeventdispatcher_cf.mm @@ -210,6 +210,13 @@ QEventDispatcherCoreFoundation::~QEventDispatcherCoreFoundation() m_cfSocketNotifier.removeSocketNotifiers(); } +QEventLoop *QEventDispatcherCoreFoundation::currentEventLoop() const +{ + QEventLoop *eventLoop = QThreadData::current()->eventLoops.top(); + Q_ASSERT(eventLoop); + return eventLoop; +} + /*! Processes all pending events that match \a flags until there are no more events to process. Returns \c true if pending events were handled; @@ -302,10 +309,7 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag // to exit, and then unwind back to the previous event loop which will break // immediately, since it has already been exited. - QEventLoop *currentEventLoop = QThreadData::current()->eventLoops.top(); - Q_ASSERT(currentEventLoop); - - if (!currentEventLoop->isRunning()) { + if (!currentEventLoop()->isRunning()) { qEventDispatcherDebug() << "Top level event loop was exited"; break; } else { diff --git a/src/corelib/kernel/qeventdispatcher_cf_p.h b/src/corelib/kernel/qeventdispatcher_cf_p.h index c2592cacc8..e6581e2bac 100644 --- a/src/corelib/kernel/qeventdispatcher_cf_p.h +++ b/src/corelib/kernel/qeventdispatcher_cf_p.h @@ -228,6 +228,8 @@ public: void flush(); protected: + QEventLoop *currentEventLoop() const; + virtual bool processPostedEvents(); struct ProcessEventsState diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 4d7aa83c43..b222cf491d 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -63,11 +63,7 @@ extern uint qGlobalPostedEventsCount(); #endif #ifndef QS_RAWINPUT -# ifdef Q_OS_WINCE -# define QS_RAWINPUT 0x0000 -# else # define QS_RAWINPUT 0x0400 -# endif #endif #ifndef WM_TOUCH @@ -89,236 +85,19 @@ enum { SendPostedEventsWindowsTimerId = ~1u }; -#if defined(Q_OS_WINCE) -QT_BEGIN_INCLUDE_NAMESPACE -#include <winsock.h> -QT_END_INCLUDE_NAMESPACE -// Asynchronous Winsocks ------------------------------------------ -#ifndef QT_NO_THREAD -QT_BEGIN_INCLUDE_NAMESPACE -#include <qthread.h> -#include <qmap.h> -#include <qmutex.h> -QT_END_INCLUDE_NAMESPACE - -//#define QCE_ASYNC_DEBUG - -namespace { - class SocketAsyncHandler; - - class SocketAsyncHandler : public QThread - { - public: - SocketAsyncHandler(); - ~SocketAsyncHandler(); - void run(); - void select(SOCKET sock, HWND handle, unsigned int msg, long ev); - void removeSelect(SOCKET sock); - void safeRemove(SOCKET sock); - private: - struct SockInfo { - HWND handle; - unsigned int msg; - long ev; - }; - QMap<SOCKET, SockInfo> sockets; - QMutex mutex; - QWaitCondition cond; - bool supposedToDie; - }; - - SocketAsyncHandler::SocketAsyncHandler() - : supposedToDie(false) - { - } - - SocketAsyncHandler::~SocketAsyncHandler() - { - mutex.lock(); - supposedToDie = true; - mutex.unlock(); - cond.wakeOne(); - wait(); - while (sockets.size() > 0) - removeSelect(sockets.begin().key()); - } - - void SocketAsyncHandler::removeSelect(SOCKET sock) - { - if (!sockets.contains(sock)) - return; - sockets.remove(sock); - return; - } - - void SocketAsyncHandler::safeRemove(SOCKET sock) - { - QMutexLocker locker(&mutex); - removeSelect(sock); - } - - void SocketAsyncHandler::select(SOCKET sock, HWND handle, unsigned int msg, long ev) - { - QMutexLocker locker(&mutex); - - if (sockets.contains(sock)) - sockets.remove(sock); - - SockInfo info; - info.handle = handle; - info.msg = msg; - info.ev = ev; - sockets.insert(sock, info); - cond.wakeOne(); - } - - void SocketAsyncHandler::run() - { - do { - mutex.lock(); - - while (!supposedToDie && sockets.isEmpty()) { - cond.wait(&mutex); - } - - if (supposedToDie) { - mutex.unlock(); - break; - } - - // Copy current items to reduce lock time - // and to be able to use SendMessage - QMap<SOCKET, SockInfo> currentSockets = sockets; - mutex.unlock(); - - fd_set readS, writeS, exS; - FD_ZERO(&readS); - FD_ZERO(&writeS); - FD_ZERO(&exS); - - int maxFd = 0; - - for (QMap<SOCKET, SockInfo>::iterator it = currentSockets.begin(); it != currentSockets.end(); ++it) { - const SockInfo &info = it.value(); - int socket = it.key(); - maxFd = qMax(maxFd, socket); - - if ((info.ev & FD_READ) || (info.ev & FD_CLOSE) || (info.ev & FD_ACCEPT)) - FD_SET(socket, &readS); - if ((info.ev & FD_WRITE)|| (info.ev & FD_CONNECT)) - FD_SET(socket, &writeS); - if (info.ev & FD_OOB) - FD_SET(socket, &exS); - } - - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 50000; - int result = ::select(maxFd + 1, &readS, &writeS, &exS, &timeout); - if (result > 0) { - HWND handle; - unsigned int tmpMsg; - SOCKET sock; - HRESULT ret; - for (QMap<SOCKET, SockInfo>::const_iterator it = currentSockets.constBegin(); - it != currentSockets.constEnd(); ++it) { - handle = (*it).handle; - tmpMsg = (*it).msg; - sock = it.key(); - if (FD_ISSET(sock, &readS)) - ret = SendMessage(handle, tmpMsg, sock, FD_READ); - - if (FD_ISSET(sock, &writeS)) - ret = SendMessage(handle, tmpMsg, sock, FD_WRITE); - - if (FD_ISSET(sock, &exS)) - ret = SendMessage(handle, tmpMsg, sock, FD_OOB); - } - } - -#ifdef QCE_ASYNC_DEBUG - else if (result == 0) { //timeout - qDebug(" WSAAsync select timeout"); - } else if (result < 0) { // SocketError - // This might happen because of two reasons - // 1. We already closed a socket in between the copy and the select - // and thus select() returns an error - // 2. Something is really wrong, then - // ### Loop on all descriptors, try to select and remove the - // ### broken one. - qWarning("WSAAsync select error %d", WSAGetLastError()); - } -#endif - } while(true); - } -} // namespace - -Q_GLOBAL_STATIC(SocketAsyncHandler, qt_async_handler) - -int WSAAsyncSelect(SOCKET sock, HWND handle, unsigned int msg, long ev) -{ - if (sock == 0 || handle == 0 || handle == INVALID_HANDLE_VALUE) { - WSASetLastError(WSAEINVAL); - return SOCKET_ERROR; - } - - if (msg == 0 && ev == 0) - qt_async_handler()->safeRemove(sock); - else - qt_async_handler()->select(sock, handle, msg, ev); - - qt_async_handler()->start(QThread::LowPriority); - WSASetLastError(0); - return 0; -} -#else // QT_NO_THREAD -int WSAAsyncSelect(SOCKET, HWND, unsigned int, long) -{ - return SOCKET_ERROR; -} -#endif -#endif // Q_OS_WINCE - class QEventDispatcherWin32Private; #if !defined(DWORD_PTR) && !defined(Q_OS_WIN64) #define DWORD_PTR DWORD #endif -typedef MMRESULT(WINAPI *ptimeSetEvent)(UINT, UINT, LPTIMECALLBACK, DWORD_PTR, UINT); -typedef MMRESULT(WINAPI *ptimeKillEvent)(UINT); - -static ptimeSetEvent qtimeSetEvent = 0; -static ptimeKillEvent qtimeKillEvent = 0; - LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); -static void resolveTimerAPI() -{ - static bool triedResolve = false; - if (!triedResolve) { -#ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve)); - if (triedResolve) - return; -#endif - triedResolve = true; -#if !defined(Q_OS_WINCE) - qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent"); - qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent"); -#else - qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent"); - qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent"); -#endif - } -} - QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0), activateNotifiersPosted(false) { - resolveTimerAPI(); } QEventDispatcherWin32Private::~QEventDispatcherWin32Private() @@ -495,11 +274,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) } } } -#ifdef Q_OS_WINCE - return 0; -#else return q->d_func()->getMessageHook ? CallNextHookEx(0, code, wp, lp) : 0; -#endif } // Provide class name and atom for the message window used by @@ -557,16 +332,11 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch QWindowsMessageWindowClassContext *ctx = qWindowsMessageWindowClassContext(); if (!ctx->atom) return 0; -#ifdef Q_OS_WINCE - HWND parent = 0; -#else - HWND parent = HWND_MESSAGE; -#endif HWND wnd = CreateWindow(ctx->className, // classname ctx->className, // window name 0, // style 0, 0, 0, 0, // geometry - parent, // parent + HWND_MESSAGE, // parent 0, // menu handle qWinAppInst(), // application 0); // windows creation data. @@ -602,24 +372,27 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) Q_Q(QEventDispatcherWin32); - int ok = 0; + bool ok = false; calculateNextTimeout(t, qt_msectime()); uint interval = t->interval; if (interval == 0u) { // optimization for single-shot-zero-timer QCoreApplication::postEvent(q, new QZeroTimerEvent(t->timerId)); - ok = 1; - } else if ((interval < 20u || t->timerType == Qt::PreciseTimer) && qtimeSetEvent) { - ok = t->fastTimerId = qtimeSetEvent(interval, 1, qt_fast_timer_proc, (DWORD_PTR)t, - TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS); + ok = true; + } else if (interval < 20u || t->timerType == Qt::PreciseTimer) { + // 3/2016: Although MSDN states timeSetEvent() is deprecated, the function + // is still deemed to be the most reliable precision timer. + t->fastTimerId = timeSetEvent(interval, 1, qt_fast_timer_proc, DWORD_PTR(t), + TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS); + ok = t->fastTimerId; } - if (ok == 0) { + if (!ok) { // user normal timers for (Very)CoarseTimers, or if no more multimedia timers available ok = SetTimer(internalHwnd, t->timerId, interval, 0); } - if (ok == 0) + if (!ok) qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer"); } @@ -628,7 +401,7 @@ void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t) if (t->interval == 0) { QCoreApplicationPrivate::removePostedTimerEvent(t->dispatcher, t->timerId); } else if (t->fastTimerId != 0) { - qtimeKillEvent(t->fastTimerId); + timeKillEvent(t->fastTimerId); QCoreApplicationPrivate::removePostedTimerEvent(t->dispatcher, t->timerId); } else if (internalHwnd) { KillTimer(internalHwnd, t->timerId); @@ -693,7 +466,6 @@ void QEventDispatcherWin32::installMessageHook() if (d->getMessageHook) return; -#ifndef Q_OS_WINCE // setup GetMessage hook needed to drive our posted events d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId()); if (Q_UNLIKELY(!d->getMessageHook)) { @@ -701,17 +473,14 @@ void QEventDispatcherWin32::installMessageHook() qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %s", errorCode, qPrintable(qt_error_string(errorCode))); } -#endif } void QEventDispatcherWin32::uninstallMessageHook() { Q_D(QEventDispatcherWin32); -#ifndef Q_OS_WINCE if (d->getMessageHook) UnhookWindowsHookEx(d->getMessageHook); -#endif d->getMessageHook = 0; } @@ -1143,11 +912,7 @@ void QEventDispatcherWin32::activateEventNotifiers() Q_D(QEventDispatcherWin32); //### this could break if events are removed/added in the activation for (int i=0; i<d->winEventNotifierList.count(); i++) { -#if !defined(Q_OS_WINCE) if (WaitForSingleObjectEx(d->winEventNotifierList.at(i)->handle(), 0, TRUE) == WAIT_OBJECT_0) -#else - if (WaitForSingleObject(d->winEventNotifierList.at(i)->handle(), 0) == WAIT_OBJECT_0) -#endif d->activateEventNotifier(d->winEventNotifierList.at(i)); } } diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index d745f16975..16a74432df 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -138,7 +138,7 @@ struct WinTimerInfo { // internal timer info quint64 timeout; // - when to actually fire QObject *obj; // - object to receive events bool inTimerEvent; - int fastTimerId; + UINT fastTimerId; }; class QZeroTimerEvent : public QTimerEvent diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index 06f5ea09da..ff035fcb11 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -53,9 +53,7 @@ #include <QtCore/qglobal.h> -#if defined(Q_OS_WINCE) -# include "QtCore/qfunctions_wince.h" -#elif defined(Q_OS_VXWORKS) +#if defined(Q_OS_VXWORKS) # include "QtCore/qfunctions_vxworks.h" #elif defined(Q_OS_NACL) # include "QtCore/qfunctions_nacl.h" diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp deleted file mode 100644 index 104c6fb27c..0000000000 --- a/src/corelib/kernel/qfunctions_wince.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifdef _WIN32_WCE //Q_OS_WINCE - -#include <windows.h> -#include <winbase.h> -#include <kfuncs.h> -#include <stdio.h> -#if _WIN32_WCE < 0x800 -# include <altcecrt.h> -#else -# include <fcntl.h> -#endif - -#include "qplatformdefs.h" -#include "qfunctions_wince.h" -#include "qfunctions_fake_env_p.h" -#include "qstring.h" - -QT_USE_NAMESPACE - -#ifdef __cplusplus -extern "C" { -#endif - -wchar_t* CEPrivConvCharToWide(const char* string) -{ - size_t length = strlen(string); - wchar_t* wString = new wchar_t[length +1]; - for (unsigned int i = 0; i < (length +1); i++) - wString[i] = string[i]; - return wString; -} - -// Time ------------------------------------------------------------- -time_t qt_wince_ftToTime_t( const FILETIME ft ) -{ - ULARGE_INTEGER li; - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - - // 100-nanosec to seconds - li.QuadPart /= 10000000; - - // FILETIME is from 1601-01-01 T 00:00:00 - // time_t is from 1970-01-01 T 00:00:00 - // 1970 - 1601 = 369 year (89 leap years) - // - // ((369y*365d) + 89d) *24h *60min *60sec - // = 11644473600 seconds - li.QuadPart -= 11644473600; - return li.LowPart; -} - -FILETIME qt_wince_time_tToFt( time_t tt ) -{ - ULARGE_INTEGER li; - li.QuadPart = tt; - li.QuadPart += 11644473600; - li.QuadPart *= 10000000; - - FILETIME ft; - ft.dwLowDateTime = li.LowPart; - ft.dwHighDateTime = li.HighPart; - return ft; -} - -// File I/O --------------------------------------------------------- -#if _WIN32_WCE < 0x800 -int errno = 0; -#endif - -int qt_wince__getdrive( void ) -{ - return 1; -} - -int qt_wince__waccess( const wchar_t *path, int pmode ) -{ - DWORD res = GetFileAttributes( path ); - if ( 0xFFFFFFFF == res ) - return -1; - - if ( (pmode & W_OK) && (res & FILE_ATTRIBUTE_READONLY) ) - return -1; - - if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) { - QString file = QString::fromWCharArray(path); - if ( !(file.endsWith(QString::fromLatin1(".exe")) || - file.endsWith(QString::fromLatin1(".com"))) ) - return -1; - } - - return 0; -} - -int qt_wince_open( const char *filename, int oflag, int pmode ) -{ - QString fn( QString::fromLatin1(filename) ); - return _wopen( (wchar_t*)fn.utf16(), oflag, pmode ); -} - -int qt_wince__wopen( const wchar_t *filename, int oflag, int /*pmode*/ ) -{ - wchar_t *flag; - - if ( oflag & _O_APPEND ) { - if ( oflag & _O_WRONLY ) { - flag = L"a"; - } else if ( oflag & _O_RDWR ) { - flag = L"a+"; - } - } else if (oflag & _O_BINARY) { - if ( oflag & _O_WRONLY ) { - flag = L"wb"; - } else if ( oflag & _O_RDWR ) { - flag = L"w+b"; // slightly different from "r+" where the file must exist - } else if ( oflag & _O_RDONLY ) { - flag = L"rb"; - } else { - flag = L"b"; - } - } else { - if ( oflag & _O_WRONLY ) { - flag = L"wt"; - } else if ( oflag & _O_RDWR ) { - flag = L"w+t"; // slightly different from "r+" where the file must exist - } else if ( oflag & _O_RDONLY ) { - flag = L"rt"; - } else { - flag = L"t"; - } - } - - int retval = (int)_wfopen( filename, flag ); - return (retval == NULL) ? -1 : retval; -} - -long qt_wince__lseek( int handle, long offset, int origin ) -{ - return fseek( (FILE*)handle, offset, origin ); -} - -int qt_wince__read( int handle, void *buffer, unsigned int count ) -{ - return fread( buffer, 1, count, (FILE*)handle ); -} - -int qt_wince__write( int handle, const void *buffer, unsigned int count ) -{ - return fwrite( buffer, 1, count, (FILE*)handle ); -} - -int qt_wince__close( int handle ) -{ - if (!handle) - return 0; - return fclose( (FILE*)handle ); -} - -FILE *qt_wince__fdopen(int handle, const char* /*mode*/) -{ - return (FILE*)handle; -} - -FILE *qt_wince_fdopen( int handle, const char* /*mode*/ ) -{ - return (FILE*)handle; -} - -void qt_wince_rewind( FILE *stream ) -{ - fseek( stream, 0L, SEEK_SET ); -} - -int qt_wince___fileno(FILE *f) -{ - return (int) _fileno(f); -} - -FILE *qt_wince_tmpfile( void ) -{ - static long i = 0; - char name[16]; - sprintf( name, "tmp%i", i++ ); - return fopen( name, "r+" ); -} - -int qt_wince__mkdir(const char *dirname) -{ - return CreateDirectory(reinterpret_cast<const wchar_t *> (QString(QString::fromLatin1(dirname)).utf16()), 0) ? 0 : -1; -} - -int qt_wince__rmdir(const char *dirname) -{ - return RemoveDirectory(reinterpret_cast<const wchar_t *> (QString::fromLatin1(dirname).utf16())) ? 0 : -1; -} - -int qt_wince__access( const char *path, int pmode ) -{ - return _waccess(reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()),pmode); -} - -int qt_wince__rename( const char *oldname, const char *newname ) -{ - return !MoveFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(oldname).utf16()), reinterpret_cast<const wchar_t *> (QString::fromLatin1(newname).utf16())); -} - -int qt_wince__remove( const char *name ) -{ - return !DeleteFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(name).utf16())); -} - -int qt_wince_stat( const char *path, struct stat *buffer ) -{ - WIN32_FIND_DATA finfo; - HANDLE ff = FindFirstFile( reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()), &finfo ); - - if ( ff == INVALID_HANDLE_VALUE ) - return -1; - - buffer->st_ctime = qt_wince_ftToTime_t( finfo.ftCreationTime ); - buffer->st_atime = qt_wince_ftToTime_t( finfo.ftLastAccessTime ); - buffer->st_mtime = qt_wince_ftToTime_t( finfo.ftLastWriteTime ); - buffer->st_nlink = 0; - buffer->st_size = finfo.nFileSizeLow; // ### missing high! - buffer->st_mode = (finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG; - buffer->st_mode |= (finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR; - return (FindClose(ff) == 0); -} - -int qt_wince__fstat( int handle, struct stat *buffer) -{ - BY_HANDLE_FILE_INFORMATION fInfo; - BOOL res = GetFileInformationByHandle((HANDLE)handle, &fInfo); - - buffer->st_ctime = qt_wince_ftToTime_t( fInfo.ftCreationTime ); - buffer->st_atime = qt_wince_ftToTime_t( fInfo.ftLastAccessTime ); - buffer->st_mtime = qt_wince_ftToTime_t( fInfo.ftLastWriteTime ); - buffer->st_nlink = 0; - buffer->st_size = fInfo.nFileSizeLow; // ### missing high! - buffer->st_mode = (fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG; - buffer->st_mode |= (fInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR; - return (res == 0); -} - -int qt_wince_SetErrorMode(int newValue) -{ - static int oldValue; - int result = oldValue; - oldValue = newValue; - return result; -} - -bool qt_wince__chmod(const char *file, int mode) -{ - return _wchmod( reinterpret_cast<const wchar_t *> (QString::fromLatin1(file).utf16()), mode); -} - -bool qt_wince__wchmod(const wchar_t *file, int mode) -{ - BOOL success = FALSE; - // ### Does not work properly, what about just adding one property? - if(mode&_S_IWRITE) { - success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL); - } else if((mode&_S_IREAD) && !(mode&_S_IWRITE)) { - success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY); - } - return success ? 0 : -1; -} - -HANDLE qt_wince_CreateFileA(LPCSTR filename, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attr, DWORD dispo, DWORD flags, HANDLE tempFile) -{ - return CreateFileW( reinterpret_cast<const wchar_t *>(QString::fromLatin1(filename).utf16()), access, share, attr, dispo, flags, tempFile); -} - -// Graphics --------------------------------------------------------- -BOOL qt_wince_SetWindowOrgEx( HDC /*hdc*/, int /*X*/, int /*Y*/, LPPOINT /*lpPoint*/) { - return TRUE; -} - -// Threading -------------------------------------------------------- -HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist) -{ - unsigned initflag = 0; - if (stack_size > 0) - initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION; - return CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, initflag, NULL); -} - -unsigned long qt_wince__beginthreadex( void *security, - unsigned stack_size, - unsigned (__stdcall *start_address)(void *), - void *arglist, - unsigned initflag, - unsigned *thrdaddr) -{ - if (stack_size > 0) - initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION; - return (unsigned long) - CreateThread( (LPSECURITY_ATTRIBUTES)security, - (DWORD)stack_size, - (LPTHREAD_START_ROUTINE)start_address, - (LPVOID)arglist, - (DWORD)initflag | CREATE_SUSPENDED, - (LPDWORD)thrdaddr); -} - -void qt_wince__endthreadex(unsigned nExitCode) { - ExitThread((DWORD)nExitCode); -} - -void *qt_wince_bsearch(const void *key, - const void *base, - size_t num, - size_t size, - int (__cdecl *compare)(const void *, const void *)) -{ - size_t low = 0; - size_t high = num - 1; - while (low <= high) { - size_t mid = (low + high) >> 1; - int c = compare(key, (char*)base + mid * size); - if (c < 0) { - if (!mid) - break; - high = mid - 1; - } else if (c > 0) - low = mid + 1; - else - return (char*) base + mid * size; - } - return 0; -} - -void *lfind(const void* key, const void* base, size_t* elements, size_t size, - int (__cdecl *compare)(const void*, const void*)) -{ - const char* current = (char*) base; - const char* const end = (char*) (current + (*elements) * size); - while (current != end) { - if (compare(current, key) == 0) - return (void*)current; - current += size; - } - return 0; -} - -DWORD qt_wince_GetThreadLocale(void) -{ - return GetUserDefaultLCID(); -} - -void *qt_wince_calloc( size_t num, size_t size ) -{ - void *ptr = malloc( num * size ); - if( ptr ) - memset( ptr, 0, num * size ); - return ptr; -} - -// _getpid is currently only used for creating a temporary filename -int qt_wince__getpid() -{ - return qAbs((int)GetCurrentProcessId()); -} - -#ifdef __cplusplus -} // extern "C" -#endif -#endif // Q_OS_WINCE diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h deleted file mode 100644 index 030950e1bd..0000000000 --- a/src/corelib/kernel/qfunctions_wince.h +++ /dev/null @@ -1,473 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFUNCTIONS_WINCE_H -#define QFUNCTIONS_WINCE_H - -#include <QtCore/qglobal.h> - -#ifdef Q_OS_WINCE -# ifndef NOMINMAX -# define NOMINMAX -# endif -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <winuser.h> -#include <winbase.h> -#include <objbase.h> -#include <kfuncs.h> -#include <ctype.h> -#include <time.h> -#include <crtdefs.h> -#if _WIN32_WCE < 0x800 -# include <altcecrt.h> -#else -# include <fcntl.h> -# include <stat.h> -#endif -#include <winsock.h> -#include <ceconfig.h> - -QT_BEGIN_NAMESPACE - -#ifdef QT_BUILD_CORE_LIB -#endif - -QT_END_NAMESPACE - -// The standard SDK misses this define... -#define _control87 _controlfp - -#if !defined __cplusplus -#define bool int -#define true 1 -#define false 0 -#endif - -// Environment ------------------------------------------------------ -errno_t qt_fake_getenv_s(size_t*, char*, size_t, const char*); -errno_t qt_fake__putenv_s(const char*, const char*); - -#ifdef __cplusplus // have this as tiff plugin is written in C -extern "C" { -#endif - -#if !defined(NO_ERRNO_H) -#define NO_ERRNO_H -#endif - -// Environment ------------------------------------------------------ -int qt_wince__getpid(void); - - -// Time ------------------------------------------------------------- -#ifndef _TM_DEFINED -#define _TM_DEFINED -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight-saving time flag */ -}; -#endif // _TM_DEFINED - -FILETIME qt_wince_time_tToFt( time_t tt ); -time_t qt_wince_ftToTime_t( const FILETIME ft ); - -#if _WIN32_WCE < 0x800 - -// File I/O --------------------------------------------------------- -#define _O_RDONLY 0x0001 -#define _O_RDWR 0x0002 -#define _O_WRONLY 0x0004 -#define _O_CREAT 0x0008 -#define _O_TRUNC 0x0010 -#define _O_APPEND 0x0020 -#define _O_EXCL 0x0040 - -#define O_RDONLY _O_RDONLY -#define O_RDWR _O_RDWR -#define O_WRONLY _O_WRONLY -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_APPEND _O_APPEND -#define O_EXCL _O_EXCL - -#define _S_IFMT 0x0600 -#define _S_IFDIR 0x0200 -#define _S_IFCHR 0x0100 -#define _S_IFREG 0x0400 -#define _S_IREAD 0x0010 -#define _S_IWRITE 0x0008 - -#define S_IFMT _S_IFMT -#define S_IFDIR _S_IFDIR -#define S_IFCHR _S_IFCHR -#define S_IFREG _S_IFREG -#define S_IREAD _S_IREAD -#define S_IWRITE _S_IWRITE - -#ifndef _IOFBF -#define _IOFBF 0x0000 -#endif - -#ifndef _IOLBF -#define _IOLBF 0x0040 -#endif - -#ifndef _IONBF -#define _IONBF 0x0004 -#endif - -// Regular Berkeley error constants -#ifndef _STAT_DEFINED -#define _STAT_DEFINED -struct stat -{ - int st_mode; - int st_size; - int st_nlink; - time_t st_mtime; - time_t st_atime; - time_t st_ctime; -}; -#endif - -typedef int mode_t; -extern int errno; -#endif // _WIN32_WCE < 0x800 - -int qt_wince__getdrive( void ); -int qt_wince__waccess( const wchar_t *path, int pmode ); -int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode ); -long qt_wince__lseek( int handle, long offset, int origin ); -int qt_wince__read( int handle, void *buffer, unsigned int count ); -int qt_wince__write( int handle, const void *buffer, unsigned int count ); -int qt_wince__close( int handle ); -FILE *qt_wince__fdopen(int handle, const char *mode); -FILE *qt_wince_fdopen(int handle, const char *mode); -void qt_wince_rewind( FILE *stream ); -int qt_wince___fileno(FILE *); -FILE *qt_wince_tmpfile( void ); - -//For zlib we need these helper functions, but they break the build when -//set globally, so just set them for zlib use -#ifdef ZLIB_H -#define open qt_wince_open -#define close qt_wince__close -#define lseek qt_wince__lseek -#define read qt_wince__read -#define write qt_wince__write -#endif - -int qt_wince__mkdir(const char *dirname); -int qt_wince__rmdir(const char *dirname); -int qt_wince__access( const char *path, int pmode ); -int qt_wince__rename( const char *oldname, const char *newname ); -int qt_wince__remove( const char *name ); -#ifdef __cplusplus -int qt_wince_open( const char *filename, int oflag, int pmode = 0 ); -#else -int qt_wince_open( const char *filename, int oflag, int pmode ); -#endif -int qt_wince_stat( const char *path, struct stat *buffer ); -int qt_wince__fstat( int handle, struct stat *buffer); - -#define SEM_FAILCRITICALERRORS 0x0001 -#define SEM_NOOPENFILEERRORBOX 0x0002 -int qt_wince_SetErrorMode(int); -#ifndef CoInitialize -#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED) -#endif - -bool qt_wince__chmod(const char *file, int mode); -bool qt_wince__wchmod(const wchar_t *file, int mode); - -QT_WARNING_DISABLE_MSVC(4273) -HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); - -// Printer ---------------------------------------------------------- -#define ETO_GLYPH_INDEX 0x0010 - -// Graphics --------------------------------------------------------- -#ifndef SM_CXCURSOR -# define SM_CXCURSOR 13 -#endif -#ifndef SM_CYCURSOR -# define SM_CYCURSOR 14 -#endif -BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint ); - -// Other stuff ------------------------------------------------------ -#define MWMO_ALERTABLE 0x0002 -// ### not the real values -#define CREATE_NO_WINDOW 2 -#define CF_HDROP 15 - -void *qt_wince_calloc(size_t num, size_t size); -#if !defined(TLS_OUT_OF_INDEXES) -# define TLS_OUT_OF_INDEXES 0xffffffff -#endif -DWORD qt_wince_GetThreadLocale(void); - -HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist); - -unsigned long qt_wince__beginthreadex( void *security, - unsigned stack_size, - unsigned (__stdcall *start_address)(void *), - void *arglist, - unsigned initflag, - unsigned *thrdaddr ); -void qt_wince__endthreadex(unsigned nExitCode); - - -// bsearch is needed for building the tiff plugin -// otherwise it could go into qguifunctions_wce -void *qt_wince_bsearch(const void *key, - const void *base, - size_t num, - size_t size, - int (__cdecl *compare)(const void *, const void *)); - -// Missing typedefs -#ifndef _TIME_T_DEFINED -typedef unsigned long time_t; -#define _TIME_T_DEFINED -#endif -typedef HANDLE HDROP; - -#ifndef WS_THICKFRAME -#define WS_THICKFRAME WS_DLGFRAME -#endif - -typedef UINT UWORD; - -// Missing definitions: not necessary equal to their Win32 values -// (the goal is to just have a clean compilation of MFC) -#define WS_MAXIMIZE 0 -#define WS_MINIMIZE 0 -#ifndef WS_EX_TOOLWINDOW -#define WS_EX_TOOLWINDOW 0 -#endif -#define WS_EX_NOPARENTNOTIFY 0 -#define WM_ENTERIDLE 0x0121 -#define WM_PRINT WM_PAINT -#define WM_NCCREATE (0x0081) -#define WM_PARENTNOTIFY 0 -#define WM_NCDESTROY (WM_APP-1) -#ifndef SW_RESTORE -#define SW_RESTORE (SW_SHOWNORMAL) -#endif -#define SW_NORMAL (SW_SHOWNORMAL) -#define WAIT_OBJECT_0 0x00000000L -#define DEFAULT_GUI_FONT SYSTEM_FONT -#ifndef SWP_NOREDRAW -#define SWP_NOREDRAW 0 -#endif -#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) -#define HWND_TOPMOST ((HWND)-1) -#define HWND_NOTOPMOST ((HWND)-2) -#define PS_DOT 2 -#define PD_ALLPAGES 0 -#define PD_USEDEVMODECOPIES 0 -#define PD_NOSELECTION 0 -#define PD_HIDEPRINTTOFILE 0 -#define PD_NOPAGENUMS 0 -#define CF_METAFILEPICT 3 -#define MM_ANISOTROPIC 8 -#define KF_ALTDOWN 0x2000 -#define SPI_GETWORKAREA 48 - -#ifndef WM_SETCURSOR - #define WM_SETCURSOR 0x0020 - #define IDC_ARROW MAKEINTRESOURCE(32512) - #define IDC_IBEAM MAKEINTRESOURCE(32513) - #define IDC_WAIT MAKEINTRESOURCE(32514) - #define IDC_CROSS MAKEINTRESOURCE(32515) - #define IDC_UPARROW MAKEINTRESOURCE(32516) - #define IDC_SIZE MAKEINTRESOURCE(32646) - #define IDC_ICON MAKEINTRESOURCE(32512) - #define IDC_SIZENWSE MAKEINTRESOURCE(32642) - #define IDC_SIZENESW MAKEINTRESOURCE(32643) - #define IDC_SIZEWE MAKEINTRESOURCE(32644) - #define IDC_SIZENS MAKEINTRESOURCE(32645) - #define IDC_SIZEALL MAKEINTRESOURCE(32646) - #define IDC_NO MAKEINTRESOURCE(32648) - #define IDC_APPSTARTING MAKEINTRESOURCE(32650) - #define IDC_HELP MAKEINTRESOURCE(32651) - #define IDC_HAND MAKEINTRESOURCE(32649) -#endif - -#define GMEM_MOVEABLE LMEM_MOVEABLE -#define GPTR LPTR - -// WinCE: CESYSGEN prunes the following FRP defines, -// and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h -#undef FTP_TRANSFER_TYPE_ASCII -#define FTP_TRANSFER_TYPE_ASCII 0x00000001 -#undef FTP_TRANSFER_TYPE_BINARY -#define FTP_TRANSFER_TYPE_BINARY 0x00000002 - -typedef DWORD OLE_COLOR; - -// Define the Windows Styles which are not defined by MS -#ifndef WS_POPUPWINDOW -#define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION -#endif - -#ifndef WS_OVERLAPPEDWINDOW -#define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX -#endif - -#ifndef WS_TILED -#define WS_TILED WS_OVERLAPPED -#endif - -#ifndef WS_TILEDWINDOW -#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW -#endif - -#ifndef WS_EX_CAPTIONOKBTN -#define WS_EX_CAPTIONOKBTN 0x80000000L -#endif - -#ifndef WS_EX_NODRAG -#define WS_EX_NODRAG 0x40000000L -#endif - -#ifdef __cplusplus -} // Extern C. -#endif - -#ifdef __cplusplus - - -// As Windows CE lacks some standard functions used in Qt, these got -// reimplemented. Other projects do this as well. Inline functions are used -// that there is a central place to disable functions for newer versions if -// they get available. There are no defines used anymore, because this -// will break member functions of classes which are called like these -// functions. Also inline functions are only supported by C++, so just define -// them for C++, as only 3rd party dependencies are C, this is no issue. -// The other declarations available in this file are being used per -// define inside qplatformdefs.h of the corresponding WinCE mkspec. - -#define generate_inline_return_func0(funcname, returntype) \ - inline returntype funcname() \ - { \ - return qt_wince_##funcname(); \ - } -#define generate_inline_return_func1(funcname, returntype, param1) \ - inline returntype funcname(param1 p1) \ - { \ - return qt_wince_##funcname(p1); \ - } -#define generate_inline_return_func2(funcname, returntype, prependnamespace, param1, param2) \ - inline returntype funcname(param1 p1, param2 p2) \ - { \ - return prependnamespace##funcname(p1, p2); \ - } -#define generate_inline_return_func3(funcname, returntype, param1, param2, param3) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3) \ - { \ - return qt_wince_##funcname(p1, p2, p3); \ - } -#define generate_inline_return_func4(funcname, returntype, prependnamespace, param1, param2, param3, param4) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4) \ - { \ - return prependnamespace##funcname(p1, p2, p3, p4); \ - } -#define generate_inline_return_func5(funcname, returntype, param1, param2, param3, param4, param5) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5); \ - } -#define generate_inline_return_func6(funcname, returntype, param1, param2, param3, param4, param5, param6) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5, p6); \ - } -#define generate_inline_return_func7(funcname, returntype, param1, param2, param3, param4, param5, param6, param7) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5, p6, p7); \ - } - -typedef unsigned (__stdcall *StartAdressExFunc)(void *); -typedef void(*StartAdressFunc)(void *); -typedef int ( __cdecl *CompareFunc ) (const void *, const void *) ; - -generate_inline_return_func4(getenv_s, errno_t, qt_fake_, size_t *, char *, size_t, const char *) -generate_inline_return_func2(_putenv_s, errno_t, qt_fake_, const char *, const char *) -generate_inline_return_func0(_getpid, int) -generate_inline_return_func1(time_tToFt, FILETIME, time_t) -generate_inline_return_func1(ftToTime_t, time_t, FILETIME) -generate_inline_return_func0(_getdrive, int) -generate_inline_return_func2(_waccess, int, qt_wince_, const wchar_t *, int) -generate_inline_return_func3(_wopen, int, const wchar_t *, int, int) -generate_inline_return_func2(_fdopen, FILE *, qt_wince_, int, const char *) -generate_inline_return_func2(fdopen, FILE *, qt_wince_, int, const char *) -generate_inline_return_func1(rewind, void, FILE *) -generate_inline_return_func0(tmpfile, FILE *) -generate_inline_return_func2(_rename, int, qt_wince_, const char *, const char *) -generate_inline_return_func1(_remove, int, const char *) -generate_inline_return_func1(SetErrorMode, int, int) -#if _WIN32_WCE < 0x800 -generate_inline_return_func2(_chmod, bool, qt_wince_, const char *, int) -generate_inline_return_func2(_wchmod, bool, qt_wince_, const wchar_t *, int) -#endif -generate_inline_return_func7(CreateFileA, HANDLE, LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE) -generate_inline_return_func4(SetWindowOrgEx, BOOL, qt_wince_, HDC, int, int, LPPOINT) -generate_inline_return_func2(calloc, void *, qt_wince_, size_t, size_t) -generate_inline_return_func0(GetThreadLocale, DWORD) -generate_inline_return_func3(_beginthread, HANDLE, StartAdressFunc, unsigned, void *) -generate_inline_return_func6(_beginthreadex, unsigned long, void *, unsigned, StartAdressExFunc, void *, unsigned, unsigned *) -generate_inline_return_func1(_endthreadex, void, unsigned) -generate_inline_return_func5(bsearch, void *, const void *, const void *, size_t, size_t, CompareFunc) - -#endif //__cplusplus - -#endif // Q_OS_WINCE -#endif // QFUNCTIONS_WINCE_H diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index f7c60cc309..4d114a5616 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -168,19 +168,15 @@ public: inline bool isValid() const { return mobj != Q_NULLPTR; } -#ifdef Q_QDOC - static QMetaMethod fromSignal(PointerToMemberFunction signal); -#else - template <typename Func> - static inline QMetaMethod fromSignal(Func signal) + template <typename PointerToMemberFunction> + static inline QMetaMethod fromSignal(PointerToMemberFunction signal) { - typedef QtPrivate::FunctionPointer<Func> SignalType; + typedef QtPrivate::FunctionPointer<PointerToMemberFunction> SignalType; Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value, "No Q_OBJECT in the class with the signal"); return fromSignalImpl(&SignalType::Object::staticMetaObject, reinterpret_cast<void **>(&signal)); } -#endif private: #if QT_DEPRECATED_SINCE(5,0) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 69f884f4ed..54cc9d33c3 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -167,6 +167,7 @@ class QMutex; struct QMetaObjectPrivate { + // revision 7 is Qt 5.0 everything lower is not supported enum { OutputRevision = 7 }; // Used by moc, qmetaobjectbuilder and qdbus int revision; @@ -175,12 +176,9 @@ struct QMetaObjectPrivate int methodCount, methodData; int propertyCount, propertyData; int enumeratorCount, enumeratorData; - int constructorCount, constructorData; //since revision 2 - int flags; //since revision 3 - int signalCount; //since revision 4 - // revision 5 introduces changes in normalized signatures, no new members - // revision 6 added qt_static_metacall as a member of each Q_OBJECT and inside QMetaObject itself - // revision 7 is Qt 5 + int constructorCount, constructorData; + int flags; + int signalCount; static inline const QMetaObjectPrivate *get(const QMetaObject *metaobject) { return reinterpret_cast<const QMetaObjectPrivate*>(metaobject->d.data); } diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 3ac1f28638..cf0e88c7cd 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -870,8 +870,7 @@ const char *QMetaType::typeName(int typeId) return result; } -/*! - \internal +/* Similar to QMetaType::type(), but only looks in the static set of types. */ static inline int qMetaTypeStaticType(const char *typeName, int length) @@ -884,8 +883,7 @@ static inline int qMetaTypeStaticType(const char *typeName, int length) return types[i].type; } -/*! - \internal +/* Similar to QMetaType::type(), but only looks in the custom set of types, and doesn't lock the mutex. The extra \a firstInvalidIndex parameter is an easy way to avoid diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index ebe118dce4..60a260f4e7 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -506,11 +506,8 @@ public: static int registerTypedef(const char *typeName, int aliasId); static int registerNormalizedTypedef(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName, int aliasId); static int type(const char *typeName); -#ifndef Q_QDOC + static int type(const QT_PREPEND_NAMESPACE(QByteArray) &typeName); -#else - static int type(const QByteArray &typeName); -#endif static const char *typeName(int type); static int sizeOf(int type); static TypeFlags typeFlags(int type); @@ -600,8 +597,11 @@ public: } #ifdef Q_QDOC + template<typename MemberFunction, int> static bool registerConverter(MemberFunction function); + template<typename MemberFunctionOk, char> static bool registerConverter(MemberFunctionOk function); + template<typename UnaryFunction> static bool registerConverter(UnaryFunction function); #else // member function as in "QString QFont::toString() const" @@ -1897,7 +1897,9 @@ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) typedef QList<QVariant> QVariantList; typedef QMap<QString, QVariant> QVariantMap; typedef QHash<QString, QVariant> QVariantHash; +#ifndef Q_QDOC typedef QList<QByteArray> QByteArrayList; +#endif #define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \ QT_BEGIN_NAMESPACE \ diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 1f3d3dcfc7..87d006bdc6 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -210,8 +210,11 @@ public: const char *member, Qt::ConnectionType type = Qt::AutoConnection) const; #ifdef Q_QDOC + template<typename PointerToMemberFunction> static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection); + template<typename PointerToMemberFunction, typename Functor> static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor); + template<typename PointerToMemberFunction, typename Functor> static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection); #else //Connect a signal to a pointer to qobject member function @@ -360,6 +363,7 @@ public: static bool disconnect(const QMetaObject::Connection &); #ifdef Q_QDOC + template<typename PointerToMemberFunction> static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method); #else template <typename Func1, typename Func2> diff --git a/src/corelib/kernel/qppsobject.cpp b/src/corelib/kernel/qppsobject.cpp index dbff997c88..f716c1a92e 100644 --- a/src/corelib/kernel/qppsobject.cpp +++ b/src/corelib/kernel/qppsobject.cpp @@ -397,12 +397,12 @@ QByteArray QPpsObjectPrivate::encode(const QVariantMap &ppsData, bool *ok) void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, const QVariant &data, bool *ok) { - QString errorFunction; + const char *errorFunction; pps_encoder_error_t error = PPS_ENCODER_OK; switch (data.type()) { case QVariant::Bool: error = pps_encoder_add_bool(encoder, name, data.toBool()); - errorFunction = QStringLiteral("pps_encoder_add_bool"); + errorFunction = "pps_encoder_add_bool"; break; // We want to support encoding uint even though libpps doesn't support it directly. // We can't encode uint as an int since that will lose precision (e.g. 2^31+1 can't be @@ -411,41 +411,41 @@ void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, con case QVariant::UInt: case QVariant::Double: error = pps_encoder_add_double(encoder, name, data.toDouble()); - errorFunction = QStringLiteral("pps_encoder_add_double"); + errorFunction = "pps_encoder_add_double"; break; case QVariant::Int: error = pps_encoder_add_int(encoder, name, data.toInt()); - errorFunction = QStringLiteral("pps_encoder_add_int"); + errorFunction = "pps_encoder_add_int"; break; case QVariant::LongLong: error = pps_encoder_add_int64(encoder, name, data.toLongLong()); - errorFunction = QStringLiteral("pps_encoder_add_int64"); + errorFunction = "pps_encoder_add_int64"; break; case QVariant::String: error = pps_encoder_add_string(encoder, name, data.toString().toUtf8().constData()); - errorFunction = QStringLiteral("pps_encoder_add_string"); + errorFunction = "pps_encoder_add_string"; break; case QVariant::List: error = pps_encoder_start_array(encoder, name); - errorFunction = QStringLiteral("pps_encoder_start_array"); + errorFunction = "pps_encoder_start_array"; if (error == PPS_ENCODER_OK) { encodeArray(encoder, data.toList(), ok); error = pps_encoder_end_array(encoder); - errorFunction = QStringLiteral("pps_encoder_end_array"); + errorFunction = "pps_encoder_end_array"; } break; case QVariant::Map: error = pps_encoder_start_object(encoder, name); - errorFunction = QStringLiteral("pps_encoder_start_object"); + errorFunction = "pps_encoder_start_object"; if (error == PPS_ENCODER_OK) { encodeObject(encoder, data.toMap(), ok); error = pps_encoder_end_object(encoder); - errorFunction = QStringLiteral("pps_encoder_end_object"); + errorFunction = "pps_encoder_end_object"; } break; case QVariant::Invalid: error = pps_encoder_add_null(encoder, name); - errorFunction = QStringLiteral("pps_encoder_add_null"); + errorFunction = "pps_encoder_add_null"; break; default: qWarning("QPpsObjectPrivate::encodeData: the type of the parameter data is invalid"); @@ -454,7 +454,7 @@ void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, con } if (error != PPS_ENCODER_OK) { - qWarning() << "QPpsObjectPrivate::encodeData: " << errorFunction << " failed"; + qWarning("QPpsObjectPrivate::encodeData: %s failed", errorFunction); *ok = false; } else { *ok = true; diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index e998b938c7..07d4930332 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -64,8 +64,8 @@ void QSharedMemoryPrivate::setErrorString(QLatin1String function) errorString = QSharedMemory::tr("%1: already exists").arg(function); break; case ERROR_FILE_NOT_FOUND: -#if defined(Q_OS_WINCE) || (defined(Q_OS_WINRT) && _MSC_VER < 1900) - // This happens on CE only if no file is present as CreateFileMappingW +#if defined(Q_OS_WINRT) && _MSC_VER < 1900 + // This happens on WinRT only if no file is present as CreateFileMappingW // bails out with this error code case ERROR_INVALID_PARAMETER: #endif @@ -112,10 +112,6 @@ HANDLE QSharedMemoryPrivate::handle() #else hand = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, (PCWSTR)nativeKey.utf16()); #endif -#elif defined(Q_OS_WINCE) - // This works for opening a mapping too, but always opens it with read/write access in - // attach as it seems. - hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)nativeKey.utf16()); #else hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, (wchar_t*)nativeKey.utf16()); #endif diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index 12fd5404da..f38daec4f8 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -39,15 +39,9 @@ #include <qglobal.h> #include "qsystemerror_p.h" -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif -#else -# if (_WIN32_WCE >= 0x700) -# include <errno.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WIN # include <qt_windows.h> @@ -131,16 +125,12 @@ static QString standardLibraryErrorString(int errorCode) s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device"); break; default: { - #ifdef Q_OS_WINCE - ret = windowsErrorString(errorCode); - #else - #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) + #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) QByteArray buf(1024, '\0'); ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf); - #else + #else ret = QString::fromLocal8Bit(strerror(errorCode)); - #endif - #endif + #endif break; } } if (s) { diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index 26647db2e1..3b55d80276 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -56,9 +56,7 @@ #ifndef QT_NO_SYSTEMSEMAPHORE #include "qsharedmemory_p.h" -#ifndef Q_OS_WINCE -# include <sys/types.h> -#endif +#include <sys/types.h> #ifdef QT_POSIX_IPC # include <semaphore.h> #endif diff --git a/src/corelib/kernel/qsystemsemaphore_posix.cpp b/src/corelib/kernel/qsystemsemaphore_posix.cpp index 6137239467..9fbf5779b8 100644 --- a/src/corelib/kernel/qsystemsemaphore_posix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_posix.cpp @@ -147,7 +147,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) if (::sem_post(semaphore) == -1) { setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore (sem_post)")); #if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphore::modify sem_post failed") << count << errno; + qDebug("QSystemSemaphore::modify sem_post failed %d %d", count, errno); #endif // rollback changes to preserve the SysV semaphore behavior for ( ; cnt < count; ++cnt) { @@ -169,7 +169,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) } setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore (sem_wait)")); #if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphore::modify sem_wait failed") << count << errno; + qDebug("QSystemSemaphore::modify sem_wait failed %d %d", count, errno); #endif return false; } diff --git a/src/corelib/kernel/qsystemsemaphore_systemv.cpp b/src/corelib/kernel/qsystemsemaphore_systemv.cpp index f4fdfa5f58..1967899a58 100644 --- a/src/corelib/kernel/qsystemsemaphore_systemv.cpp +++ b/src/corelib/kernel/qsystemsemaphore_systemv.cpp @@ -187,7 +187,8 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) } setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphore::modify failed") << count << semctl(semaphore, 0, GETVAL) << errno << EIDRM << EINVAL; + qDebug("QSystemSemaphore::modify failed %d %d %d %d %d", + count, int(semctl(semaphore, 0, GETVAL)), int(errno), int(EIDRM), int(EINVAL); #endif return false; } diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 236e346afe..3395f5641e 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -121,11 +121,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return false; } } else { -#if !defined(Q_OS_WINCE) if (WAIT_OBJECT_0 != WaitForSingleObjectEx(semaphore, INFINITE, FALSE)) { -#else - if (WAIT_OBJECT_0 != WaitForSingleObject(semaphore, INFINITE)) { -#endif setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG qDebug("QSystemSemaphore::modifySemaphore WaitForSingleObject failed"); diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index dd52d52a1c..d97fe933b9 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -80,11 +80,17 @@ public: static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member); #ifdef Q_QDOC + template<typename PointerToMemberFunction> static void singleShot(int msec, const QObject *receiver, PointerToMemberFunction method); + template<typename PointerToMemberFunction> static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> static void singleShot(int msec, Functor functor); + template<typename Functor> static void singleShot(int msec, Qt::TimerType timerType, Functor functor); + template<typename Functor, int> static void singleShot(int msec, const QObject *context, Functor functor); + template<typename Functor, int> static void singleShot(int msec, Qt::TimerType timerType, const QObject *context, Functor functor); #else // singleShot to a QObject slot diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index dce750b5ad..53b38c3be2 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -120,7 +120,11 @@ void QFactoryLoader::update() if (!QDir(path).exists(QLatin1String("."))) continue; - QStringList plugins = QDir(path).entryList(QDir::Files); + QStringList plugins = QDir(path).entryList( +#ifdef Q_OS_WIN + QStringList(QStringLiteral("*.dll")), +#endif + QDir::Files); QLibraryPrivate *library = 0; #ifdef Q_OS_MAC diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index deec54db0a..982035b49b 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -71,15 +71,6 @@ bool QLibraryPrivate::load_sys() #endif // We make the following attempts at locating the library: // - // WinCE - // if (absolute) - // fileName - // fileName + ".dll" - // else - // fileName + ".dll" - // fileName - // QFileInfo(fileName).absoluteFilePath() - // // Windows // if (absolute) // fileName @@ -97,14 +88,10 @@ bool QLibraryPrivate::load_sys() // If the fileName is an absolute path we try that first, otherwise we // use the system-specific suffix first QFileSystemEntry fsEntry(fileName); - if (fsEntry.isAbsolute()) { + if (fsEntry.isAbsolute()) attempts.prepend(fileName); - } else { + else attempts.append(fileName); -#if defined(Q_OS_WINCE) - attempts.append(QFileInfo(fileName).absoluteFilePath()); -#endif - } #ifdef Q_OS_WINRT if (fileName.startsWith(QLatin1Char('/'))) attempts.prepend(QDir::rootPath() + fileName); @@ -165,11 +152,7 @@ bool QLibraryPrivate::unload_sys() QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) { -#ifdef Q_OS_WINCE - FARPROC address = GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16()); -#else FARPROC address = GetProcAddress(pHnd, symbol); -#endif if (!address) { errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg( QString::fromLatin1(symbol)).arg( diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index 178a33f987..7c80fbbd42 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -68,23 +68,11 @@ DLL Safe search mode is documented in the "Dynamic-Link Library Search Order" document on MSDN. - - Since library loading code is sometimes shared between Windows and WinCE, - this class can also be used on WinCE. However, its implementation just - calls the LoadLibrary() function. This is ok since it is documented as not - loading from the current directory on WinCE. This behaviour is documented - in the documentation for LoadLibrary for Windows CE at MSDN. - (http://msdn.microsoft.com/en-us/library/ms886736.aspx) */ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) -HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) -{ - return ::LoadLibrary(libraryName); -} -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) { Q_UNUSED(onlySystemDirectory); @@ -141,6 +129,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } -#endif //Q_OS_WINCE +#endif // Q_OS_WINRT QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 469376d81b..7b6d180df9 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -93,11 +93,7 @@ public: load(); if (!m_handle) return 0; -#ifdef Q_OS_WINCE - return QFunctionPointer(GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16())); -#else return QFunctionPointer(GetProcAddress(m_handle, symbol)); -#endif } static QFunctionPointer resolve(const QString &libraryName, const char *symbol) diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index a1d16b449e..409eec1989 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -55,9 +55,9 @@ typedef struct _GUID #endif #endif -#ifdef Q_OS_DARWIN +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFUUID); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID); # endif #endif diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index e8d413cd8a..d7cf8584da 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -60,6 +60,7 @@ public: QSignalTransition(const QObject *sender, const char *signal, QState *sourceState = Q_NULLPTR); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QSignalTransition(const QObject *object, PointerToMemberFunction signal, QState *sourceState = Q_NULLPTR); #elif defined(Q_COMPILER_DELEGATING_CONSTRUCTORS) diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index ee1ff3fea3..7a9dc9c132 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -82,6 +82,7 @@ public: void addTransition(QAbstractTransition *transition); QSignalTransition *addTransition(const QObject *sender, const char *signal, QAbstractState *target); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QSignalTransition *addTransition(const QObject *sender, PointerToMemberFunction signal, QAbstractState *target); #else diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp index acb0f9dc61..3c314a4c0c 100644 --- a/src/corelib/thread/qmutex_win.cpp +++ b/src/corelib/thread/qmutex_win.cpp @@ -61,11 +61,7 @@ QMutexPrivate::~QMutexPrivate() bool QMutexPrivate::wait(int timeout) { -#ifndef Q_OS_WINCE return (WaitForSingleObjectEx(event, timeout < 0 ? INFINITE : timeout, FALSE) == WAIT_OBJECT_0); -#else - return (WaitForSingleObject(event, timeout < 0 ? INFINITE : timeout) == WAIT_OBJECT_0); -#endif } void QMutexPrivate::wakeUp() Q_DECL_NOTHROW diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index ef1799a021..74e191f889 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -55,15 +55,10 @@ #include <qt_windows.h> #ifndef Q_OS_WINRT -#ifndef Q_OS_WINCE -#ifndef _MT -#define _MT -#endif // _MT -#include <process.h> -#else // !Q_OS_WINCE -#include "qfunctions_wince.h" -#endif // Q_OS_WINCE -#else // !Q_OS_WINRT +# ifndef _MT +# define _MT +# endif // _MT +# include <process.h> #endif // Q_OS_WINRT #ifndef QT_NO_THREAD @@ -150,7 +145,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) // WinRT API? } else { HANDLE realHandle = INVALID_HANDLE_VALUE; -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), @@ -158,9 +152,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) 0, FALSE, DUPLICATE_SAME_ACCESS); -#else - realHandle = reinterpret_cast<HANDLE>(GetCurrentThreadId()); -#endif qt_watch_adopted_thread(realHandle, threadData->thread); } } @@ -190,9 +181,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread) QMutexLocker lock(&qt_adopted_thread_watcher_mutex); if (GetCurrentThreadId() == qt_adopted_thread_watcher_id) { -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) CloseHandle(adoptedThreadHandle); -#endif return; } @@ -291,9 +280,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) data->deref(); QMutexLocker lock(&qt_adopted_thread_watcher_mutex); -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) CloseHandle(qt_adopted_thread_handles.at(handleIndex)); -#endif qt_adopted_thread_handles.remove(handleIndex); qt_adopted_qthreads.remove(qthreadIndex); } @@ -306,7 +293,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) return 0; } -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) #ifndef Q_OS_WIN64 # define ULONG_PTR DWORD @@ -336,7 +323,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) { } } -#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINCE && !Q_OS_WINRT +#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINRT /************************************************************************** ** QThreadPrivate @@ -378,7 +365,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi else createEventDispatcher(data); -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) // sets the name of the current thread. QByteArray objectName = thr->objectName().toLocal8Bit(); qt_set_thread_name((HANDLE)-1, @@ -453,7 +440,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW void QThread::yieldCurrentThread() { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) SwitchToThread(); #else ::Sleep(0); diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index a95ca0b8fd..e6610f18c8 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -115,12 +115,7 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time) { // wait for the event bool ret = false; -#ifndef Q_OS_WINCE switch (WaitForSingleObjectEx(wce->event, time, FALSE)) { -#else - switch (WaitForSingleObject(wce->event, time)) { -#endif - default: break; case WAIT_OBJECT_0: diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 14465240b4..854276d150 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -142,15 +142,9 @@ QT_DEPRECATED_X("Use std::count") inline void qCount(const Container &container, } #ifdef Q_QDOC -template <typename T> -LessThan qLess() -{ -} - -template <typename T> -LessThan qGreater() -{ -} +typedef void* LessThan; +template <typename T> LessThan qLess(); +template <typename T> LessThan qGreater(); #else template <typename T> class QT_DEPRECATED_X("Use std::less") qLess diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index d334bb43c5..6ecfcf96ad 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -56,9 +56,9 @@ #error qbytearray.h must be included before any header file that defines truncate #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFData); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSData); # endif #endif diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index bc8b08b380..501bb2e0d5 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -50,11 +50,13 @@ QT_BEGIN_NAMESPACE typedef QListIterator<QByteArray> QByteArrayListIterator; typedef QMutableListIterator<QByteArray> QMutableByteArrayListIterator; +#ifndef Q_QDOC typedef QList<QByteArray> QByteArrayList; namespace QtPrivate { QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *separator, int separatorLength); } +#endif #ifdef Q_QDOC class QByteArrayList : public QList<QByteArray> diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index f01fbc109c..a83e5e6f98 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -578,6 +578,18 @@ Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) Q_DECL_NOTHROW { ret Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) Q_DECL_NOTHROW { return operator< (c2, c1); } Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c2, c1); } +// disambiguate QChar == int (but only that, so constrain template to exactly 'int'): +template <typename T> +Q_DECL_DEPRECATED_X("don't compare ints to QChars, compare them to QChar::unicode() instead") +Q_DECL_CONSTEXPR inline +typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, int>::value, bool>::type +operator==(QChar lhs, T rhs) Q_DECL_NOEXCEPT { return lhs == QChar(rhs); } +template <typename T> +Q_DECL_DEPRECATED_X("don't compare ints to QChars, compare them to QChar::unicode() instead") +Q_DECL_CONSTEXPR inline +typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, int>::value, bool>::type +operator!=(QChar lhs, T rhs) Q_DECL_NOEXCEPT { return lhs != QChar(rhs); } + #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QChar &); diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index 64cabcc304..1f7f9cc33b 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -49,14 +49,12 @@ class QCommandLineOptionPrivate : public QSharedData public: Q_NEVER_INLINE explicit QCommandLineOptionPrivate(const QString &name) - : names(removeInvalidNames(QStringList(name))), - hidden(false) + : names(removeInvalidNames(QStringList(name))) { } Q_NEVER_INLINE explicit QCommandLineOptionPrivate(const QStringList &names) - : names(removeInvalidNames(names)), - hidden(false) + : names(removeInvalidNames(names)) { } static QStringList removeInvalidNames(QStringList nameList); @@ -74,8 +72,7 @@ public: //! The list of default values used for this option. QStringList defaultValues; - //! Show or hide in --help - bool hidden; + QCommandLineOption::Flags flags; }; /*! @@ -394,6 +391,7 @@ QStringList QCommandLineOption::defaultValues() const return d->defaultValues; } +#if QT_DEPRECATED_SINCE(5, 8) /*! Sets whether to hide this option in the user-visible help output. @@ -401,11 +399,12 @@ QStringList QCommandLineOption::defaultValues() const a particular option makes it internal, i.e. not listed in the help output. \since 5.6 + \obsolete Use setFlags(QCommandLineOption::HiddenFromHelp), QCommandLineOption::HiddenFromHelp \sa isHidden */ void QCommandLineOption::setHidden(bool hide) { - d->hidden = hide; + d->flags.setFlag(HiddenFromHelp, hide); } /*! @@ -413,11 +412,52 @@ void QCommandLineOption::setHidden(bool hide) false if the option is listed. \since 5.6 - \sa setHidden() + \obsolete Use flags() & QCommandLineOption::HiddenFromHelp + \sa setHidden(), QCommandLineOption::HiddenFromHelp */ bool QCommandLineOption::isHidden() const { - return d->hidden; + return d->flags & HiddenFromHelp; } +#endif + +/*! + Returns a set of flags that affect this command-line option. + + \since 5.8 + \sa setFlags(), QCommandLineOption::Flags + */ +QCommandLineOption::Flags QCommandLineOption::flags() const +{ + return d->flags; +} + +/*! + Set the set of flags that affect this command-line option. + + \since 5.8 + \sa flags(), QCommandLineOption::Flags + */ +void QCommandLineOption::setFlags(Flags flags) +{ + d->flags = flags; +} + +/*! + \enum QCommandLineOption::Flag + + \value HiddenFromHelp Hide this option in the user-visible help output. All + options are visible by default. Setting this flag for a particular + option makes it internal, i.e. not listed in the help output. + + \value ShortOptionStyle The option will always be understood as a short + option, regardless of what was set by + QCommandLineParser::setSingleDashWordOptionMode. + This allows flags such as \c{-DDEFINE=VALUE} or \c{-I/include/path} to be + interpreted as short flags even when the parser is in + QCommandLineParser::ParseAsLongOptions mode. + + \sa QCommandLineOption::setFlags(), QCommandLineOption::flags() +*/ QT_END_NAMESPACE diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h index a7747f9fb2..6ebaab3d48 100644 --- a/src/corelib/tools/qcommandlineoption.h +++ b/src/corelib/tools/qcommandlineoption.h @@ -50,6 +50,12 @@ class QCommandLineOptionPrivate; class Q_CORE_EXPORT QCommandLineOption { public: + enum Flag { + HiddenFromHelp = 0x1, + ShortOptionStyle = 0x2 + }; + Q_DECLARE_FLAGS(Flags, Flag) + explicit QCommandLineOption(const QString &name); explicit QCommandLineOption(const QStringList &names); /*implicit*/ QCommandLineOption(const QString &name, const QString &description, @@ -82,14 +88,24 @@ public: void setDefaultValues(const QStringList &defaultValues); QStringList defaultValues() const; + Flags flags() const; + void setFlags(Flags aflags); + +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp)") void setHidden(bool hidden); + QT_DEPRECATED_X("Use flags() and HiddenFromHelp") bool isHidden() const; +#endif + private: QSharedDataPointer<QCommandLineOptionPrivate> d; }; Q_DECLARE_SHARED(QCommandLineOption) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags) + QT_END_NAMESPACE diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index a7ab8b9e70..2450484ce9 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -44,7 +44,7 @@ #include <qhash.h> #include <qvector.h> #include <qdebug.h> -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) # include <qt_windows.h> #endif #include <stdio.h> @@ -295,7 +295,9 @@ QCommandLineParser::~QCommandLineParser() i.e. as the long option named \c{abc}. This is how Qt's own tools (uic, rcc...) have always been parsing arguments. This mode should be used for preserving compatibility in applications that were parsing - arguments in such a way. + arguments in such a way. There is an exception if the \c{a} option has the + QCommandLineOption::ShortOptionStyle flag set, in which case it is still + interpreted as \c{-a bc}. \sa setSingleDashWordOptionMode() */ @@ -530,7 +532,7 @@ QString QCommandLineParser::errorText() const enum MessageType { UsageMessage, ErrorMessage }; -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) // Return whether to use a message box. Use handles if a console can be obtained // or we are run with redirected handles (for example, by QProcess). static inline bool displayMessageBox() @@ -552,7 +554,7 @@ static void showParserMessage(const QString &message, MessageType type) else qCritical(qPrintable(message)); return; -#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) if (displayMessageBox()) { const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR); @@ -565,7 +567,7 @@ static void showParserMessage(const QString &message, MessageType type) reinterpret_cast<const wchar_t *>(title.utf16()), flags); return; } -#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WINCE +#endif // Q_OS_WIN && !QT_BOOTSTRAPPED fputs(qPrintable(message), type == UsageMessage ? stdout : stderr); } @@ -762,6 +764,18 @@ bool QCommandLineParserPrivate::parse(const QStringList &args) } case QCommandLineParser::ParseAsLongOptions: { + if (argument.size() > 2) { + const QString possibleShortOptionStyleName = argument.mid(1, 1); + const auto shortOptionIt = nameHash.constFind(possibleShortOptionStyleName); + if (shortOptionIt != nameHash.constEnd()) { + const auto &arg = commandLineOptionList.at(*shortOptionIt); + if (arg.flags() & QCommandLineOption::ShortOptionStyle) { + registerFoundOption(possibleShortOptionStyleName); + optionValuesHash[*shortOptionIt].append(argument.mid(2)); + break; + } + } + } const QString optionName = argument.mid(1).section(assignChar, 0, 0); if (registerFoundOption(optionName)) { if (!parseOptionValue(optionName, argument, &argumentIterator, args.end())) @@ -1098,7 +1112,7 @@ QString QCommandLineParserPrivate::helpText() const optionNameList.reserve(commandLineOptionList.size()); int longestOptionNameString = 0; for (const QCommandLineOption &option : commandLineOptionList) { - if (option.isHidden()) + if (option.flags() & QCommandLineOption::HiddenFromHelp) continue; const QStringList optionNames = option.names(); QString optionNamesString; @@ -1117,7 +1131,7 @@ QString QCommandLineParserPrivate::helpText() const ++longestOptionNameString; auto optionNameIterator = optionNameList.cbegin(); for (const QCommandLineOption &option : commandLineOptionList) { - if (option.isHidden()) + if (option.flags() & QCommandLineOption::HiddenFromHelp) continue; text += wrapText(*optionNameIterator, longestOptionNameString, option.description()); ++optionNameIterator; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 7cc86eb3f1..9aba68eef3 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -57,9 +57,6 @@ #include <time.h> #ifdef Q_OS_WIN # include <qt_windows.h> -# ifdef Q_OS_WINCE -# include "qfunctions_wince.h" -# endif # ifdef Q_OS_WINRT # include "qfunctions_winrt.h" # endif @@ -1685,9 +1682,6 @@ QString QTime::toString(const QString& format) const bool QTime::setHMS(int h, int m, int s, int ms) { -#if defined(Q_OS_WINCE) - startTick = NullTime; -#endif if (!isValid(h,m,s,ms)) { mds = NullTime; // make this invalid return false; @@ -1767,10 +1761,6 @@ QTime QTime::addMSecs(int ms) const t.mds = (ds() + ms) % MSECS_PER_DAY; } } -#if defined(Q_OS_WINCE) - if (startTick > NullTime) - t.startTick = (startTick + ms) % MSECS_PER_DAY; -#endif return t; } @@ -1792,13 +1782,7 @@ int QTime::msecsTo(const QTime &t) const { if (!isValid() || !t.isValid()) return 0; -#if defined(Q_OS_WINCE) - // GetLocalTime() for Windows CE has no milliseconds resolution - if (t.startTick > NullTime && startTick > NullTime) - return t.startTick - startTick; - else -#endif - return t.ds() - ds(); + return t.ds() - ds(); } @@ -2140,10 +2124,7 @@ int QTime::elapsed() const // Calls the platform variant of tzset static void qt_tzset() { -#if defined(Q_OS_WINCE) - // WinCE doesn't use tzset - return; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) _tzset(); #else tzset(); @@ -2157,12 +2138,7 @@ static void qt_tzset() // Relies on tzset, mktime, or localtime having been called to populate timezone static int qt_timezone() { -#if defined(Q_OS_WINCE) - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - // Expressed in minutes, convert to seconds - return (tzi.Bias + tzi.StandardBias) * 60; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 +#if defined(_MSC_VER) long offset; _get_timezone(&offset); return offset; @@ -2191,16 +2167,6 @@ static int qt_timezone() // Returns the tzname, assume tzset has been called already static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) { -#if defined(Q_OS_WINCE) - TIME_ZONE_INFORMATION tzi; - DWORD res = GetTimeZoneInformation(&tzi); - if (res == TIME_ZONE_ID_UNKNOWN) - return QString(); - else if (daylightStatus == QDateTimePrivate::DaylightTime) - return QString::fromWCharArray(tzi.DaylightName); - else - return QString::fromWCharArray(tzi.StandardName); -#else int isDst = (daylightStatus == QDateTimePrivate::DaylightTime) ? 1 : 0; #if defined(_MSC_VER) && _MSC_VER >= 1400 size_t s = 0; @@ -2211,7 +2177,6 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) #else return QString::fromLocal8Bit(tzname[isDst]); #endif // Q_OS_WIN -#endif // Q_OS_WINCE } // Calls the platform variant of mktime for the given date, time and daylightStatus, @@ -2226,48 +2191,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat int yy, mm, dd; date->getDate(&yy, &mm, &dd); -#if defined(Q_OS_WINCE) - // WinCE doesn't provide standard C library time functions - SYSTEMTIME st; - memset(&st, 0, sizeof(SYSTEMTIME)); - st.wSecond = time->second(); - st.wMinute = time->minute(); - st.wHour = time->hour(); - st.wDay = dd; - st.wMonth = mm; - st.wYear = yy; - FILETIME lft; - bool valid = SystemTimeToFileTime(&st, &lft); - FILETIME ft; - if (valid) - valid = LocalFileTimeToFileTime(&lft, &ft); - const time_t secsSinceEpoch = ftToTime_t(ft); - const time_t localSecs = ftToTime_t(lft); - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - bool isDaylight = false; - // Check for overflow - qint64 localDiff = qAbs(localSecs - secsSinceEpoch); - int daylightOffset = qAbs(tzi.Bias + tzi.DaylightBias) * 60; - if (localDiff > daylightOffset) - valid = false; - else - isDaylight = (localDiff == daylightOffset); - if (daylightStatus) { - if (isDaylight) - *daylightStatus = QDateTimePrivate::DaylightTime; - else - *daylightStatus = QDateTimePrivate::StandardTime; - } - if (abbreviation) { - if (isDaylight) - *abbreviation = QString::fromWCharArray(tzi.DaylightName); - else - *abbreviation = QString::fromWCharArray(tzi.StandardName); - } - if (ok) - *ok = valid; -#else // All other platforms provide standard C library time functions tm local; memset(&local, 0, sizeof(local)); // tm_[wy]day plus any non-standard fields @@ -2329,7 +2252,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat if (ok) *ok = false; } -#endif // Q_OS_WINCE return ((qint64)secsSinceEpoch * 1000) + msec; } @@ -2345,23 +2267,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT tm local; bool valid = false; -#if defined(Q_OS_WINCE) - FILETIME utcTime = time_tToFt(secsSinceEpoch); - FILETIME resultTime; - valid = FileTimeToLocalFileTime(&utcTime , &resultTime); - SYSTEMTIME sysTime; - if (valid) - valid = FileTimeToSystemTime(&resultTime , &sysTime); - - if (valid) { - local.tm_sec = sysTime.wSecond; - local.tm_min = sysTime.wMinute; - local.tm_hour = sysTime.wHour; - local.tm_mday = sysTime.wDay; - local.tm_mon = sysTime.wMonth - 1; - local.tm_year = sysTime.wYear - 1900; - } -#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // localtime() is required to work as if tzset() was called before it. // localtime_r() does not have this requirement, so make an explicit call. qt_tzset(); @@ -4109,9 +4015,6 @@ QTime QTime::currentTime() memset(&st, 0, sizeof(SYSTEMTIME)); GetLocalTime(&st); ct.setHMS(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); -#if defined(Q_OS_WINCE) - ct.startTick = GetTickCount() % MSECS_PER_DAY; -#endif return ct; } diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index ee3be5553b..a9271ef177 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -46,9 +46,9 @@ #include <limits> -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFDate); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSDate); # endif #endif @@ -148,15 +148,9 @@ Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE); class Q_CORE_EXPORT QTime { explicit Q_DECL_CONSTEXPR QTime(int ms) : mds(ms) -#if defined(Q_OS_WINCE) - , startTick(NullTime) -#endif {} public: Q_DECL_CONSTEXPR QTime(): mds(NullTime) -#if defined(Q_OS_WINCE) - , startTick(NullTime) -#endif {} QTime(int h, int m, int s = 0, int ms = 0); @@ -202,9 +196,6 @@ private: enum TimeFlag { NullTime = -1 }; Q_DECL_CONSTEXPR inline int ds() const { return mds == -1 ? 0 : mds; } int mds; -#if defined(Q_OS_WINCE) - int startTick; -#endif friend class QDateTime; friend class QDateTimePrivate; diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index 734aaf80f2..532d61d504 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -58,13 +58,13 @@ static void resolveLibs() if (done) return; -#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINRT) // try to get GetTickCount64 from the system HMODULE kernel32 = GetModuleHandleW(L"kernel32"); if (!kernel32) return; ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); -#endif // !Q_OS_WINRT && !Q_OS_WINCE +#endif // !Q_OS_WINRT // Retrieve the number of high-resolution performance counter ticks per second LARGE_INTEGER frequency; diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 5509c3adce..8149238a50 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -118,7 +118,10 @@ struct Q_CORE_EXPORT QListData { }; template <typename T> -class QList : public QListSpecialMethods<T> +class QList +#ifndef Q_QDOC + : public QListSpecialMethods<T> +#endif { public: struct MemoryLayout diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index eccedca4c8..52f82827f2 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -62,7 +62,6 @@ #include "qvariant.h" #include "qstringbuilder.h" #include "private/qnumeric_p.h" -#include "private/qsystemlibrary_p.h" #ifdef Q_OS_WIN # include <qt_windows.h> # include <time.h> diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index 88bfada515..f8b9f86ac6 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -44,9 +44,6 @@ #include "qstringlist.h" #include "qvariant.h" #include "qdatetime.h" - -#include "private/qsystemlibrary_p.h" - #include "qdebug.h" #ifdef Q_OS_WIN @@ -67,7 +64,6 @@ QT_BEGIN_NAMESPACE #ifndef Q_OS_WINRT static QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT); -static const char *winLangCodeToIsoName(int code); static QString winIso639LangName(LCID id = LOCALE_USER_DEFAULT); static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT); #else // !Q_OS_WINRT @@ -600,50 +596,32 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS QVariant QSystemLocalePrivate::uiLanguages() { - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { - typedef BOOL (WINAPI *GetUserPreferredUILanguagesFunc) ( - DWORD dwFlags, - PULONG pulNumLanguages, - PWSTR pwszLanguagesBuffer, - PULONG pcchLanguagesBuffer); - static GetUserPreferredUILanguagesFunc GetUserPreferredUILanguages_ptr = 0; #ifndef Q_OS_WINRT - if (!GetUserPreferredUILanguages_ptr) { - QSystemLibrary lib(QLatin1String("kernel32")); - if (lib.load()) - GetUserPreferredUILanguages_ptr = (GetUserPreferredUILanguagesFunc)lib.resolve("GetUserPreferredUILanguages"); - } -#endif // !Q_OS_WINRT - if (GetUserPreferredUILanguages_ptr) { - unsigned long cnt = 0; - QVarLengthArray<wchar_t, 64> buf(64); - unsigned long size = buf.size(); - if (!GetUserPreferredUILanguages_ptr(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size)) { - size = 0; - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER && - GetUserPreferredUILanguages_ptr(MUI_LANGUAGE_NAME, &cnt, NULL, &size)) { - buf.resize(size); - if (!GetUserPreferredUILanguages_ptr(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size)) - return QStringList(); - } - } - QStringList result; - result.reserve(cnt); - const wchar_t *str = buf.constData(); - for (; cnt > 0; --cnt) { - QString s = QString::fromWCharArray(str); - if (s.isEmpty()) - break; // something is wrong - result.append(s); - str += s.size()+1; - } - return result; + unsigned long cnt = 0; + QVarLengthArray<wchar_t, 64> buf(64); +# if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE) // Not present in MinGW 4.9/bootstrap builds. + unsigned long size = buf.size(); + if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size)) { + size = 0; + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER && + GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &cnt, NULL, &size)) { + buf.resize(size); + if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size)) + return QStringList(); } } - -#ifndef Q_OS_WINRT - // old Windows before Vista - return QStringList(QString::fromLatin1(winLangCodeToIsoName(GetUserDefaultUILanguage()))); +# endif // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE + QStringList result; + result.reserve(cnt); + const wchar_t *str = buf.constData(); + for (; cnt > 0; --cnt) { + QString s = QString::fromWCharArray(str); + if (s.isEmpty()) + break; // something is wrong + result.append(s); + str += s.size() + 1; + } + return result; #else // !Q_OS_WINRT QStringList result; ComPtr<ABI::Windows::Globalization::IApplicationLanguagesStatics> appLanguagesStatics; @@ -1161,19 +1139,16 @@ static QByteArray getWinLocaleName(LPWSTR id) } } -#if defined(Q_OS_WINCE) - result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID()); -#else // !Q_OS_WINCE -# ifndef Q_OS_WINRT +#ifndef Q_OS_WINRT if (id == LOCALE_USER_DEFAULT) id = GetUserDefaultLCID(); -# else // !Q_OS_WINRT +#else // !Q_OS_WINRT WCHAR lcName[LOCALE_NAME_MAX_LENGTH]; if (QString::fromWCharArray(id) == QString::fromWCharArray(LOCALE_NAME_USER_DEFAULT)) { GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH); id = lcName; } -# endif // Q_OS_WINRT +#endif // Q_OS_WINRT QString resultuage = winIso639LangName(id); QString country = winIso3116CtryName(id); result = resultuage.toLatin1(); @@ -1181,7 +1156,6 @@ static QByteArray getWinLocaleName(LPWSTR id) result += '_'; result += country.toLatin1(); } -#endif // !Q_OS_WINCE return result; } diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index d03e3129aa..c369ff8697 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -442,15 +442,20 @@ */ /*! - \fn QSharedPointer::QSharedPointer(T *ptr) + \fn QSharedPointer::QSharedPointer(X *ptr) Creates a QSharedPointer that points to \a ptr. The pointer \a ptr becomes managed by this QSharedPointer and must not be passed to another QSharedPointer object or deleted outside this object. + + Since Qt 5.8, when the last reference to this QSharedPointer gets + destroyed, \a ptr will be deleted by calling \c X's destructor (even if \c + X is not the same as QSharedPointer's template parameter \c T). Previously, + the destructor for \c T was called. */ /*! - \fn QSharedPointer::QSharedPointer(T *ptr, Deleter deleter) + \fn QSharedPointer::QSharedPointer(X *ptr, Deleter deleter) Creates a QSharedPointer that points to \a ptr. The pointer \a ptr becomes managed by this QSharedPointer and must not be passed to @@ -477,6 +482,9 @@ } \endcode + Note that the custom deleter function will be called with a pointer to type + \c X, even if the QSharedPointer template parameter \c T is not the same. + It is also possible to specify a member function directly, as in: \code QSharedPointer<MyObject> obj = @@ -487,6 +495,22 @@ */ /*! + \fn QSharedPointer::QSharedPointer(std::nullptr_t) + \since 5.8 + + Creates a QSharedPointer that is null. This is equivalent to the + QSharedPointer default constructor. +*/ + +/*! + \fn QSharedPointer::QSharedPointer(std::nullptr_t, Deleter) + \since 5.8 + + Creates a QSharedPointer that is null. This is equivalent to the + QSharedPointer default constructor. +*/ + +/*! \fn QSharedPointer::QSharedPointer(const QSharedPointer<T> &other) Creates a QSharedPointer object that shares \a other's pointer. diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h index 901862e7a2..3e05bf1ece 100644 --- a/src/corelib/tools/qsharedpointer.h +++ b/src/corelib/tools/qsharedpointer.h @@ -67,8 +67,10 @@ public: // constructors QSharedPointer(); - explicit QSharedPointer(T *ptr); - QSharedPointer(T *ptr, Deleter d); + template <typename X> explicit QSharedPointer(X *ptr); + template <typename X, typename Deleter> QSharedPointer(X *ptr, Deleter d); + QSharedPointer(std::nullptr_t); + template <typename Deleter> QSharedPointer(std::nullptr_t, Deleter d); QSharedPointer(const QSharedPointer<T> &other); QSharedPointer(const QWeakPointer<T> &other); diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 6a5c8f4fe5..bbac2d0327 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -313,16 +313,22 @@ public: inline T &operator*() const { return *data(); } inline T *operator->() const { return data(); } - QSharedPointer() Q_DECL_NOTHROW : value(Q_NULLPTR), d(Q_NULLPTR) {} + Q_DECL_CONSTEXPR QSharedPointer() Q_DECL_NOTHROW : value(nullptr), d(nullptr) { } ~QSharedPointer() { deref(); } - inline explicit QSharedPointer(T *ptr) : value(ptr) // noexcept + Q_DECL_CONSTEXPR QSharedPointer(std::nullptr_t) Q_DECL_NOTHROW : value(nullptr), d(nullptr) { } + + template <class X> + inline explicit QSharedPointer(X *ptr) : value(ptr) // noexcept { internalConstruct(ptr, QtSharedPointer::NormalDeleter()); } - template <typename Deleter> - inline QSharedPointer(T *ptr, Deleter deleter) : value(ptr) // throws + template <class X, typename Deleter> + inline QSharedPointer(X *ptr, Deleter deleter) : value(ptr) // throws { internalConstruct(ptr, deleter); } + template <typename Deleter> + QSharedPointer(std::nullptr_t, Deleter) : value(nullptr), d(nullptr) { } + QSharedPointer(const QSharedPointer &other) Q_DECL_NOTHROW : value(other.value), d(other.d) { if (d) ref(); } QSharedPointer &operator=(const QSharedPointer &other) Q_DECL_NOTHROW @@ -512,15 +518,15 @@ private: inline void enableSharedFromThis(...) {} - template <typename Deleter> - inline void internalConstruct(T *ptr, Deleter deleter) + template <typename X, typename Deleter> + inline void internalConstruct(X *ptr, Deleter deleter) { if (!ptr) { d = Q_NULLPTR; return; } - typedef QtSharedPointer::ExternalRefCountWithCustomDeleter<T, Deleter> Private; + typedef QtSharedPointer::ExternalRefCountWithCustomDeleter<X, Deleter> Private; # ifdef QT_SHAREDPOINTER_TRACK_POINTERS typename Private::DestroyerFn actualDeleter = &Private::safetyCheckDeleter; # else diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 9037442d9d..698189f9c6 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -48,16 +48,8 @@ #endif #if defined(Q_OS_WIN) -# if defined(Q_OS_WINCE) -# include <qt_windows.h> -# if _WIN32_WCE < 0x800 -# include <cmnintrin.h> -# endif -# endif # if !defined(Q_CC_GNU) -# ifndef Q_OS_WINCE -# include <intrin.h> -# endif +# include <intrin.h> # endif #elif defined(Q_OS_LINUX) && (defined(Q_PROCESSOR_ARM) || defined(Q_PROCESSOR_MIPS_32)) #include "private/qcore_unix_p.h" @@ -93,25 +85,6 @@ static inline uint detectProcessorFeatures() { return 0; } -#elif defined (Q_OS_WINCE) -static inline quint64 detectProcessorFeatures() -{ - quint64 features = 0; - -#if defined (ARM) -# ifdef PF_ARM_NEON - if (IsProcessorFeaturePresent(PF_ARM_NEON)) - features |= Q_UINT64_C(1) << CpuFeatureNEON; -# endif -#elif defined(_X86_) - if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) - features |= Q_UINT64_C(1) << CpuFeatureSSE2; - if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) - features |= Q_UINT64_C(1) << CpuFeatureSSE3; -#endif - return features; -} - #elif defined(Q_PROCESSOR_ARM) static inline quint64 detectProcessorFeatures() { diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 8ddaed8032..48ef686bbd 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -139,7 +139,7 @@ * } */ -#if defined(__MINGW64_VERSION_MAJOR) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)) +#if defined(__MINGW64_VERSION_MAJOR) || defined(Q_CC_MSVC) #include <intrin.h> #endif @@ -484,12 +484,6 @@ static Q_ALWAYS_INLINE unsigned _bit_scan_forward(unsigned val) #elif defined(Q_PROCESSOR_X86) // Bit scan functions for x86 # if defined(Q_CC_MSVC) -# if defined _WIN32_WCE && _WIN32_WCE < 0x800 -extern "C" unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask); -extern "C" unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask); -# pragma intrinsic(_BitScanForward) -# pragma intrinsic(_BitScanReverse) -# endif // MSVC calls it _BitScanReverse and returns the carry flag, which we don't need static __forceinline unsigned long _bit_scan_reverse(uint val) { diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 9bfc46f32e..43ef67b3b5 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -81,9 +81,6 @@ #ifdef Q_OS_WIN # include <qt_windows.h> -# ifdef Q_OS_WINCE -# include <winnls.h> -# endif #endif #ifdef truncate @@ -5518,7 +5515,7 @@ int QString::localeAwareCompare(const QString &other) const return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); } -#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined (Q_OS_MAC) +#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN) Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator) #endif @@ -5533,12 +5530,12 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, if (length1 == 0 || length2 == 0) return ucstrcmp(data1, length1, data2, length2); -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) -#ifndef Q_OS_WINRT +#if defined(Q_OS_WIN) +# ifndef Q_OS_WINRT int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2); -#else +# else int res = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, (LPCWSTR)data1, length1, (LPCWSTR)data2, length2, NULL, NULL, 0); -#endif +# endif switch (res) { case CSTR_LESS_THAN: @@ -8328,6 +8325,78 @@ QString &QString::setRawData(const QChar *unicode, int size) Returns the size of the Latin-1 string stored in this object. */ +/*! \fn QLatin1Char QLatin1String::at(int pos) const + \since 5.8 + + Returns the character at position \a pos in this object. + + \note This function performs no error checking. + The behavior is undefined when \a pos < 0 or \a pos ≥ size(). + + \sa operator[]() +*/ + +/*! \fn QLatin1Char QLatin1String::operator[](int pos) const + \since 5.8 + + Returns the character at position \a pos in this object. + + \note This function performs no error checking. + The behavior is undefined when \a pos < 0 or \a pos ≥ size(). + + \sa at() +*/ + +/*! \fn QLatin1String QLatin1String::mid(int start) const + \since 5.8 + + Returns the substring starting at position \a start in this object, + and extending to the end of the string. + + \note This function performs no error checking. + The behavior is undefined when \a start < 0 or \a start > size(). + + \sa left(), right() +*/ + +/*! \fn QLatin1String QLatin1String::mid(int start, int length) const + \since 5.8 + \overload + + Returns the substring of length \a length starting at position + \a start in this object. + + \note This function performs no error checking. + The behavior is undefined when \a start < 0, \length < 0, + or \a start + \a length > size(). + + \sa left(), right() +*/ + +/*! \fn QLatin1String QLatin1String::left(int length) const + \since 5.8 + + Returns the substring of length \a length starting at position + 0 in this object. + + \note This function performs no error checking. + The behavior is undefined when \length < 0 or \a length > size(). + + \sa mid(), right() +*/ + +/*! \fn QLatin1String QLatin1String::right(int length) const + \since 5.8 + + Returns the substring of length \a length starting at position + size() - \a length in this object. + + \note This function performs no error checking. + The behavior is undefined when \length < 0 or \a length > size(). + + \sa mid(), left() +*/ + /*! \fn bool QLatin1String::operator==(const QString &other) const Returns \c true if this string is equal to string \a other; diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 793a859228..71d6e6c762 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -68,9 +68,9 @@ namespace std #error qstring.h must be included before any header file that defines truncate #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFString); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSString); # endif #endif @@ -99,6 +99,18 @@ public: Q_DECL_CONSTEXPR int size() const Q_DECL_NOTHROW { return m_size; } Q_DECL_CONSTEXPR const char *data() const Q_DECL_NOTHROW { return m_data; } + Q_DECL_CONSTEXPR QLatin1Char at(int i) const { return QLatin1Char(m_data[i]); } + Q_DECL_CONSTEXPR QLatin1Char operator[](int i) const { return at(i); } + + Q_DECL_CONSTEXPR QLatin1String mid(int pos) const + { return QLatin1String(m_data + pos, m_size - pos); } + Q_DECL_CONSTEXPR QLatin1String mid(int pos, int n) const + { return QLatin1String(m_data + pos, n); } + Q_DECL_CONSTEXPR QLatin1String left(int n) const + { return QLatin1String(m_data, n); } + Q_DECL_CONSTEXPR QLatin1String right(int n) const + { return QLatin1String(m_data + m_size - n, n); } + inline bool operator==(const QString &s) const Q_DECL_NOTHROW; inline bool operator!=(const QString &s) const Q_DECL_NOTHROW; inline bool operator>(const QString &s) const Q_DECL_NOTHROW; @@ -593,7 +605,7 @@ public: Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW { return -s2.compare(s1, cs); } - int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; + inline int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; static int compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW; @@ -802,6 +814,16 @@ private: Data *d; + friend inline bool operator==(QChar, const QString &) Q_DECL_NOTHROW; + friend inline bool operator< (QChar, const QString &) Q_DECL_NOTHROW; + friend inline bool operator> (QChar, const QString &) Q_DECL_NOTHROW; + friend inline bool operator==(QChar, const QStringRef &) Q_DECL_NOTHROW; + friend inline bool operator< (QChar, const QStringRef &) Q_DECL_NOTHROW; + friend inline bool operator> (QChar, const QStringRef &) Q_DECL_NOTHROW; + friend inline bool operator==(QChar, QLatin1String) Q_DECL_NOTHROW; + friend inline bool operator< (QChar, QLatin1String) Q_DECL_NOTHROW; + friend inline bool operator> (QChar, QLatin1String) Q_DECL_NOTHROW; + void reallocData(uint alloc, bool grow = false); void expand(int i); QString multiArg(int numArgs, const QString **args) const; @@ -1518,24 +1540,10 @@ inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize) inline QStringRef::QStringRef(const QString *aString) :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){} +// QStringRef <> QStringRef Q_CORE_EXPORT bool operator==(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW; inline bool operator!=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW { return !(s1 == s2); } -Q_CORE_EXPORT bool operator==(const QString &s1, const QStringRef &s2) Q_DECL_NOTHROW; -inline bool operator!=(const QString &s1, const QStringRef &s2) Q_DECL_NOTHROW -{ return !(s1 == s2); } -inline bool operator==(const QStringRef &s1, const QString &s2) Q_DECL_NOTHROW -{ return s2 == s1; } -inline bool operator!=(const QStringRef &s1, const QString &s2) Q_DECL_NOTHROW -{ return s2 != s1; } -Q_CORE_EXPORT bool operator==(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW; -inline bool operator!=(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW -{ return !(s1 == s2); } -inline bool operator==(const QStringRef &s1, QLatin1String s2) Q_DECL_NOTHROW -{ return s2 == s1; } -inline bool operator!=(const QStringRef &s1, QLatin1String s2) Q_DECL_NOTHROW -{ return s2 != s1; } - Q_CORE_EXPORT bool operator<(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW; inline bool operator>(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW { return s2 < s1; } @@ -1544,6 +1552,110 @@ inline bool operator<=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHRO inline bool operator>=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW { return !(s1 < s2); } +// QString <> QStringRef +Q_CORE_EXPORT bool operator==(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW; +inline bool operator!=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) != 0; } +inline bool operator< (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) < 0; } +inline bool operator> (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) > 0; } +inline bool operator<=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) <= 0; } +inline bool operator>=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) >= 0; } + +inline bool operator==(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs != lhs; } +inline bool operator< (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs >= lhs; } +inline bool operator>=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs <= lhs; } + +inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s, cs); } +inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } + +// QLatin1String <> QStringRef +Q_CORE_EXPORT bool operator==(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW; +inline bool operator!=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) != 0; } +inline bool operator< (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) > 0; } +inline bool operator> (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) < 0; } +inline bool operator<=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) >= 0; } +inline bool operator>=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) <= 0; } + +inline bool operator==(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs != lhs; } +inline bool operator< (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs >= lhs; } +inline bool operator>=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs <= lhs; } + +// QChar <> QString +inline bool operator==(QChar lhs, const QString &rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) == 0; } +inline bool operator< (QChar lhs, const QString &rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; } +inline bool operator> (QChar lhs, const QString &rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; } + +inline bool operator!=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } +inline bool operator<=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs > rhs); } +inline bool operator>=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs < rhs); } + +inline bool operator==(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); } +inline bool operator< (const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); } +inline bool operator>=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); } + +// QChar <> QStringRef +inline bool operator==(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) == 0; } +inline bool operator< (QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; } +inline bool operator> (QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; } + +inline bool operator!=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } +inline bool operator<=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs > rhs); } +inline bool operator>=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs < rhs); } + +inline bool operator==(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); } +inline bool operator< (const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); } +inline bool operator>=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); } + +// QChar <> QLatin1String +inline bool operator==(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.latin1(), rhs.size()) == 0; } +inline bool operator< (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.latin1(), rhs.size()) < 0; } +inline bool operator> (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW +{ return QString::compare_helper(&lhs, 1, rhs.latin1(), rhs.size()) > 0; } + +inline bool operator!=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } +inline bool operator<=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs > rhs); } +inline bool operator>=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs < rhs); } + +inline bool operator==(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); } +inline bool operator< (QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); } +inline bool operator>=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); } + #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) inline QT_ASCII_CAST_WARN bool QStringRef::operator==(const char *s) const { return QString::compare_helper(constData(), size(), s, -1) == 0; } @@ -1572,23 +1684,6 @@ inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2) { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; } #endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s, cs); } -inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } - inline int QString::localeAwareCompare(const QStringRef &s) const { return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2) diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index e01f9e16e8..87f15528bf 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -149,6 +149,7 @@ public: Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE); +#ifndef Q_QDOC inline QStringList *QListSpecialMethods<QString>::self() { return static_cast<QStringList *>(this); } inline const QStringList *QListSpecialMethods<QString>::self() const @@ -284,6 +285,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons } #endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED +#endif // Q_QDOC QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index 8e32db48de..4febeda537 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -383,17 +383,11 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio static QLocale::Country userCountry() { -#if defined(Q_OS_WINCE) - // Guess that the syslem locale country is the right one to use - // TODO Find if WinCE has equivalent api - return QLocale::system().country(); -#else const GEOID id = GetUserGeoID(GEOCLASS_NATION); wchar_t code[3]; const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0); return (size == 3) ? QLocalePrivate::codeToCountry(reinterpret_cast<const QChar*>(code), size) : QLocale::AnyCountry; -#endif // Q_OS_WINCE } // Create the system default time zone diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 93dc71c3d8..07200b1249 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -152,10 +152,10 @@ else:win32 { } else:integrity:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp -contains(QT_CONFIG, zlib) { - include($$PWD/../../3rdparty/zlib.pri) -} else { +contains(QT_CONFIG, system-zlib) { include($$PWD/../../3rdparty/zlib_dependency.pri) +} else { + include($$PWD/../../3rdparty/zlib.pri) } contains(QT_CONFIG,icu) { @@ -197,12 +197,10 @@ INCLUDEPATH += ../3rdparty/md5 \ ../3rdparty/md4 \ ../3rdparty/sha3 -contains(QT_CONFIG, doubleconversion) { - include($$PWD/../../3rdparty/double-conversion/double-conversion.pri) -} else:contains(QT_CONFIG, system-doubleconversion) { +contains(QT_CONFIG, system-doubleconversion) { LIBS_PRIVATE += -ldouble-conversion -} else { - DEFINES += QT_NO_DOUBLECONVERSION +} else: contains(QT_CONFIG, doubleconversion) { + include($$PWD/../../3rdparty/double-conversion/double-conversion.pri) } # Note: libm should be present by default becaue this is C++ diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index 4c1aec7bb3..445ff48482 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -3,15 +3,15 @@ QT = core-private CONFIG += link_pkgconfig MODULE_CONFIG = dbusadaptors dbusinterfaces -!contains(QT_LIBS_DBUS, .*dbus-1.*) { - win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d - else:QT_LIBS_DBUS += -ldbus-1 +!contains(QMAKE_LIBS_DBUS, .*dbus-1.*) { + win32:CONFIG(debug, debug|release):QMAKE_LIBS_DBUS += -ldbus-1d + else:QMAKE_LIBS_DBUS += -ldbus-1 } DEFINES += DBUS_API_SUBJECT_TO_CHANGE -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS contains(QT_CONFIG, dbus-linked) { - LIBS_PRIVATE += $$QT_LIBS_DBUS + LIBS_PRIVATE += $$QMAKE_LIBS_DBUS DEFINES += QT_LINKED_LIBDBUS } diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 8db944e5e3..657b57c0cd 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -71,11 +71,11 @@ SOURCES += \ image/qxbmhandler.cpp \ image/qxpmhandler.cpp -!contains(QT_CONFIG, no-png):include($$PWD/qpnghandler.pri) -else:DEFINES *= QT_NO_IMAGEFORMAT_PNG - -contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri) -contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri) +contains(QT_CONFIG, png) { + HEADERS += image/qpnghandler_p.h + SOURCES += image/qpnghandler.cpp + include($$PWD/../../3rdparty/png_dependency.pri) +} # SIMD SSE2_SOURCES += image/qimage_sse2.cpp diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri deleted file mode 100644 index ec33101451..0000000000 --- a/src/gui/image/qgifhandler.pri +++ /dev/null @@ -1,3 +0,0 @@ -# common to plugin and built-in forms -HEADERS += $$PWD/qgifhandler_p.h -SOURCES += $$PWD/qgifhandler.cpp diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 64a53b4c0e..68e2847f02 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2275,7 +2275,7 @@ QRgb QImage::pixel(int x, int y) const const QPixelLayout *layout = &qPixelLayouts[d->format]; uint result; const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1); - return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0); + return *layout->convertToARGB32PM(&result, ptr, 1, 0, 0); } /*! @@ -2377,7 +2377,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb) const QPixelLayout *layout = &qPixelLayouts[d->format]; uint result; - const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, layout, 0); + const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, 0, 0); qStorePixels[layout->bpp](s, ptr, x, 1); } @@ -2557,7 +2557,7 @@ bool QImage::allGray() const while (x < d->width) { int l = qMin(d->width - x, buffer_size); const uint *ptr = fetch(buffer, b, x, l); - ptr = layout->convertToARGB32PM(buffer, ptr, l, layout, 0); + ptr = layout->convertToARGB32PM(buffer, ptr, l, 0, 0); for (int i = 0; i < l; ++i) { if (!qIsGray(ptr[i])) return false; diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 4f8e88adda..41b4807671 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -108,7 +108,7 @@ void qGamma_correct_back_to_linear_cs(QImage *image) // The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion. static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = 0xff000000 | qUnpremultiply(src[i]); @@ -116,7 +116,7 @@ static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint } static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = 0xff000000 |src[i]; @@ -124,10 +124,11 @@ static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint * } #ifdef QT_COMPILER_SUPPORTS_SSE4_1 -extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); +extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); #endif -void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags flags) { // Cannot be used with indexed formats. Q_ASSERT(dest->format > QImage::Format_Indexed8); @@ -158,14 +159,20 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio convertFromARGB32PM = convertRGB32FromARGB32PM; } } + QDitherInfo dither; + QDitherInfo *ditherPtr = 0; + if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither) + ditherPtr = &dither; for (int y = 0; y < src->height; ++y) { + dither.y = y; int x = 0; while (x < src->width) { + dither.x = x; int l = qMin(src->width - x, buffer_size); const uint *ptr = fetch(buffer, srcData, x, l); - ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0); - ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0); + ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr); + ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr); store(destData, ptr, x, l); x += l; } @@ -174,7 +181,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio } } -bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags) +bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags flags) { // Cannot be used with indexed formats or between formats with different pixel depths. Q_ASSERT(dst_format > QImage::Format_Indexed8); @@ -207,14 +214,20 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im convertFromARGB32PM = convertRGB32FromARGB32PM; } } + QDitherInfo dither; + QDitherInfo *ditherPtr = 0; + if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither) + ditherPtr = &dither; for (int y = 0; y < data->height; ++y) { + dither.y = y; int x = 0; while (x < data->width) { + dither.x = x; int l = qMin(data->width - x, buffer_size); const uint *ptr = fetch(buffer, srcData, x, l); - ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0); - ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0); + ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr); + ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr); // The conversions might be passthrough and not use the buffer, in that case we are already done. if (srcData != (const uchar*)ptr) store(srcData, ptr, x, l); diff --git a/src/gui/image/qimage_sse4.cpp b/src/gui/image/qimage_sse4.cpp index 1f3f8f0d3f..0e2c2f492e 100644 --- a/src/gui/image/qimage_sse4.cpp +++ b/src/gui/image/qimage_sse4.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]); diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 4dada4ca82..dd1f0c8943 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -155,12 +155,6 @@ #ifndef QT_NO_IMAGEFORMAT_PNG #include <private/qpnghandler_p.h> #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG -#include <private/qjpeghandler_p.h> -#endif -#ifdef QT_BUILTIN_GIF_READER -#include <private/qgifhandler_p.h> -#endif #include <algorithm> @@ -175,13 +169,6 @@ enum _qt_BuiltInFormatType { #ifndef QT_NO_IMAGEFORMAT_PNG _qt_PngFormat, #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - _qt_JpgFormat, - _qt_JpegFormat, -#endif -#ifdef QT_BUILTIN_GIF_READER - _qt_GifFormat, -#endif #ifndef QT_NO_IMAGEFORMAT_BMP _qt_BmpFormat, #endif @@ -210,13 +197,6 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { #ifndef QT_NO_IMAGEFORMAT_PNG {"png", "image/png"}, #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - {"jpg", "image/jpeg"}, - {"jpeg", "image/jpeg"}, -#endif -#ifdef QT_BUILTIN_GIF_READER - {"gif", "image/gif"}, -#endif #ifndef QT_NO_IMAGEFORMAT_BMP {"bmp", "image/bmp"}, #endif @@ -357,14 +337,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, } else if (testFormat == "png") { handler = new QPngHandler; #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - } else if (testFormat == "jpg" || testFormat == "jpeg") { - handler = new QJpegHandler; -#endif -#ifdef QT_BUILTIN_GIF_READER - } else if (testFormat == "gif") { - handler = new QGifHandler; -#endif #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; @@ -442,19 +414,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, handler = new QPngHandler; break; #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - case _qt_JpgFormat: - case _qt_JpegFormat: - if (QJpegHandler::canRead(device)) - handler = new QJpegHandler; - break; -#endif -#ifdef QT_BUILTIN_GIF_READER - case _qt_GifFormat: - if (QGifHandler::canRead(device)) - handler = new QGifHandler; - break; -#endif #ifndef QT_NO_IMAGEFORMAT_BMP case _qt_BmpFormat: if (QBmpHandler::canRead(device)) @@ -491,8 +450,8 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, if (handler) { #ifdef QIMAGEREADER_DEBUG - qDebug() << "QImageReader::createReadHandler: the" << _qt_BuiltInFormats[currentFormat].extension - << "built-in handler can read this data"; + qDebug("QImageReader::createReadHandler: the %s built-in handler can read this data", + _qt_BuiltInFormats[currentFormat].extension); #endif break; } diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index b60cf59864..ddf9f2dda9 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -115,12 +115,6 @@ #ifndef QT_NO_IMAGEFORMAT_PNG #include <private/qpnghandler_p.h> #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG -#include <private/qjpeghandler_p.h> -#endif -#ifdef QT_BUILTIN_GIF_READER -#include <private/qgifhandler_p.h> -#endif #include <algorithm> @@ -184,14 +178,6 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, } else if (testFormat == "png") { handler = new QPngHandler; #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - } else if (testFormat == "jpg" || testFormat == "jpeg") { - handler = new QJpegHandler; -#endif -#ifdef QT_BUILTIN_GIF_READER - } else if (testFormat == "gif") { - handler = new QGifHandler; -#endif #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; @@ -910,9 +896,6 @@ QList<QByteArray> QImageWriter::supportedImageFormats() #ifndef QT_NO_IMAGEFORMAT_PNG formats << "png"; #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - formats << "jpg" << "jpeg"; -#endif #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats); @@ -951,9 +934,6 @@ QList<QByteArray> QImageWriter::supportedMimeTypes() #ifndef QT_NO_IMAGEFORMAT_PNG mimeTypes << "image/png"; #endif -#ifndef QT_NO_IMAGEFORMAT_JPEG - mimeTypes << "image/jpeg"; -#endif #ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanWrite, &mimeTypes); diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri deleted file mode 100644 index de40c6742e..0000000000 --- a/src/gui/image/qjpeghandler.pri +++ /dev/null @@ -1,11 +0,0 @@ -# common to plugin and built-in forms -HEADERS += $$PWD/qjpeghandler_p.h -SOURCES += $$PWD/qjpeghandler.cpp -contains(QT_CONFIG, system-jpeg) { - msvc: \ - LIBS += libjpeg.lib - else: \ - LIBS += -ljpeg -} else { - include($$PWD/../../3rdparty/libjpeg.pri) -} diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 0906b65d96..4032176efc 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -152,7 +152,7 @@ void QBlittablePlatformPixmap::fill(const QColor &color) uint pixel = qPremultiply(color.rgba()); const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()]; Q_ASSERT(layout->convertFromARGB32PM); - layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); + layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0); //so premultiplied formats are supported and ARGB32 and RGB32 blittable()->lock()->fill(pixel); @@ -298,10 +298,8 @@ QRectF QBlittablePlatformPixmap::clipAndTransformRect(const QRectF &rect) const if (clipData->hasRectClip) { transformationRect &= clipData->clipRect; } else if (clipData->hasRegionClip) { - const QVector<QRect> rects = clipData->clipRegion.rects(); - for (int i = 0; i < rects.size(); i++) { - transformationRect &= rects.at(i); - } + for (const QRect &rect : clipData->clipRegion) + transformationRect &= rect; } } } diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 13104ce17f..45047f556c 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -195,7 +195,7 @@ void QRasterPlatformPixmap::fill(const QColor &color) } pixel = qPremultiply(color.rgba()); const QPixelLayout *layout = &qPixelLayouts[image.format()]; - layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); + layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0); } else if (image.format() == QImage::Format_Alpha8) { pixel = qAlpha(color.rgba()); } else if (image.format() == QImage::Format_Grayscale8) { @@ -335,7 +335,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC } else if (inPlace && sourceImage.d->convertInPlace(format, flags)) { image = sourceImage; } else { - image = sourceImage.convertToFormat(format); + image = sourceImage.convertToFormat(format, flags); } if (image.d) { diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 7f20586156..92f6964783 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -48,84 +48,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WINCE -#define GetDIBits(a,b,c,d,e,f,g) qt_wince_GetDIBits(a,b,c,d,e,f,g) -int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint) -{ - if (!lpvBits) { - qWarning("::GetDIBits(), lpvBits NULL"); - return 0; - } - BITMAP bm; - GetObject(hSourceBitmap, sizeof(BITMAP), &bm); - bm.bmHeight = qAbs(bm.bmHeight); - - HBITMAP hTargetBitmap; - void *pixels; - - BITMAPINFO dibInfo; - memset(&dibInfo, 0, sizeof(dibInfo)); - dibInfo.bmiHeader.biBitCount = 32; - dibInfo.bmiHeader.biClrImportant = 0; - dibInfo.bmiHeader.biClrUsed = 0; - dibInfo.bmiHeader.biCompression = BI_RGB;; - dibInfo.bmiHeader.biHeight = -bm.bmHeight; - dibInfo.bmiHeader.biWidth = bm.bmWidth; - dibInfo.bmiHeader.biPlanes = 1; - dibInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - dibInfo.bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4; - - HDC displayDC = GetDC(NULL); - if (!displayDC) { - qWarning("::GetDIBits(), failed to GetDC"); - return 0; - } - - int ret = bm.bmHeight; - - hTargetBitmap = CreateDIBSection(displayDC, (const BITMAPINFO*) &dibInfo, DIB_RGB_COLORS, - (void**)&pixels, NULL, 0); - if (!hTargetBitmap) { - qWarning("::GetDIBits(), failed to CreateDIBSection"); - return 0; - } - - HDC hdcSrc = CreateCompatibleDC(displayDC); - HDC hdcDst = CreateCompatibleDC(displayDC); - - if (!(hdcDst && hdcSrc)) { - qWarning("::GetDIBits(), failed to CreateCompatibleDC"); - ret = 0; - } - - HBITMAP hOldBitmap1 = (HBITMAP) SelectObject(hdcSrc, hSourceBitmap); - HBITMAP hOldBitmap2 = (HBITMAP) SelectObject(hdcDst, hTargetBitmap); - - if (!(hOldBitmap1 && hOldBitmap2)) { - qWarning("::GetDIBits(), failed to SelectObject for bitmaps"); - ret = 0; - } - - if (!BitBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY)) { - qWarning("::GetDIBits(), BitBlt failed"); - ret = 0; - } - - SelectObject(hdcSrc, hOldBitmap1); - SelectObject(hdcDst, hOldBitmap2); - - DeleteDC(hdcSrc); - DeleteDC(hdcDst); - - ReleaseDC(NULL, displayDC); - - memcpy(lpvBits, pixels, dibInfo.bmiHeader.biSizeImage); - - DeleteObject(hTargetBitmap); - return ret; -} -#endif - static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih) { memset(bih, 0, sizeof(BITMAPINFOHEADER)); @@ -325,8 +247,6 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p) return hIcon; } -#ifndef Q_OS_WINCE - Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h) { QImage image(w, h, QImage::Format_ARGB32_Premultiplied); @@ -415,95 +335,5 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon) DeleteDC(hdc); return QPixmap::fromImage(image); } -#else //ifndef Q_OS_WINCE -Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon) -{ - HDC screenDevice = GetDC(0); - HDC hdc = CreateCompatibleDC(screenDevice); - ReleaseDC(0, screenDevice); - - ICONINFO iconinfo; - bool result = GetIconInfo(icon, &iconinfo); - if (!result) - qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()"); - - int w = 0; - int h = 0; - if (!iconinfo.xHotspot || !iconinfo.yHotspot) { - // We could not retrieve the icon size via GetIconInfo, - // so we try again using the icon bitmap. - BITMAP bm; - int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm); - if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm); - if (!result) { - qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size"); - return QPixmap(); - } - w = bm.bmWidth; - h = bm.bmHeight; - } else { - // x and y Hotspot describes the icon center - w = iconinfo.xHotspot * 2; - h = iconinfo.yHotspot * 2; - } - const DWORD dwImageSize = w * h * 4; - - BITMAPINFO bmi; - memset(&bmi, 0, sizeof(bmi)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFO); - bmi.bmiHeader.biWidth = w; - bmi.bmiHeader.biHeight = -h; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - bmi.bmiHeader.biSizeImage = dwImageSize; - - uchar* bits; - - HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0); - if (winBitmap ) - memset(bits, 0xff, dwImageSize); - if (!winBitmap) { - qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()"); - return QPixmap(); - } - - HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap); - if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL)) - qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); - - uint mask = 0xff000000; - // Create image and copy data into image. - QImage image(w, h, QImage::Format_ARGB32); - - if (!image.isNull()) { // failed to alloc? - int bytes_per_line = w * sizeof(QRgb); - for (int y=0; y < h; ++y) { - QRgb *dest = (QRgb *) image.scanLine(y); - const QRgb *src = (const QRgb *) (bits + y * bytes_per_line); - for (int x=0; x < w; ++x) { - dest[x] = src[x]; - } - } - } - if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK)) - qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); - if (!image.isNull()) { // failed to alloc? - int bytes_per_line = w * sizeof(QRgb); - for (int y=0; y < h; ++y) { - QRgb *dest = (QRgb *) image.scanLine(y); - const QRgb *src = (const QRgb *) (bits + y * bytes_per_line); - for (int x=0; x < w; ++x) { - if (!src[x]) - dest[x] = dest[x] | mask; - } - } - } - SelectObject(hdc, oldhdc); //restore state - DeleteObject(winBitmap); - DeleteDC(hdc); - return QPixmap::fromImage(image); -} -#endif //ifndef Q_OS_WINCE QT_END_NAMESPACE diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index c84f429e46..7fbb498bbb 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -75,20 +75,8 @@ # endif #endif -#ifdef Q_OS_WINCE -#define CALLBACK_CALL_TYPE __cdecl -#else -#define CALLBACK_CALL_TYPE -#endif - QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) && defined(STANDARDSHELL_UI_MODEL) -# define Q_INTERNAL_WIN_NO_THROW __declspec(nothrow) -#else -# define Q_INTERNAL_WIN_NO_THROW -#endif - // avoid going through QImage::scanLine() which calls detach #define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl) @@ -190,7 +178,7 @@ private: extern "C" { static -void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) +void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) { QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr); QIODevice *in = d->q->device(); @@ -215,7 +203,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz static -void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) +void qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) { QPNGImageWriter* qpiw = (QPNGImageWriter*)png_get_io_ptr(png_ptr); QIODevice* out = qpiw->device(); @@ -229,7 +217,7 @@ void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_s static -void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */) +void qpiw_flush_fn(png_structp /* png_ptr */) { } @@ -487,7 +475,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i } extern "C" { -static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) +static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) { qWarning("libpng warning: %s", message); } @@ -495,7 +483,7 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const } -void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) +void QPngHandlerPrivate::readPngTexts(png_info *info) { png_textp text_ptr; int num_text=0; @@ -522,7 +510,7 @@ void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) } -bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() +bool QPngHandlerPrivate::readPngHeader() { state = Error; png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); @@ -566,7 +554,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() return true; } -bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) +bool QPngHandlerPrivate::readPngImage(QImage *outImage) { if (state == Error) return false; @@ -810,7 +798,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y) return writeImage(image, -1, QString(), off_x, off_y); } -bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description, +bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description, int off_x_in, int off_y_in) { QPoint offset = image.offset(); diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri index 505d214130..e69de29bb2 100644 --- a/src/gui/image/qpnghandler.pri +++ b/src/gui/image/qpnghandler.pri @@ -1,4 +0,0 @@ -HEADERS += $$PWD/qpnghandler_p.h -SOURCES += $$PWD/qpnghandler.cpp - -include($$PWD/../../3rdparty/png_dependency.pri) diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 5ae8e893cb..5c8ff84929 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -845,7 +845,7 @@ static bool read_xpm_header( if (!read_xpm_string(buf, device, source, index, state)) return false; -#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) +#ifdef Q_CC_MSVC if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) #else if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 78a4dc4f35..2d3707c049 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2065,6 +2065,16 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) */ /*! + \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length) + \overload + \since 5.7 + + Constructs an input method attribute with no value. \a type + specifies the type of attribute, and \a start and \a length + the position of the attribute. +*/ + +/*! Constructs an event of type QEvent::InputMethod. The attributes(), preeditString(), commitString(), replacementStart(), and replacementLength() are initialized to default values. @@ -4411,6 +4421,7 @@ QTouchEvent::~QTouchEvent() The values of this enum describe additional information about a touch point. \value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger. + \value Token Indicates that the contact has been made by a fiducial object (e.g. a knob or other token) instead of a finger. */ /*! @@ -4457,6 +4468,22 @@ int QTouchEvent::TouchPoint::id() const } /*! + \since 5.8 + Returns the unique ID of this touch point or token, if any. + + It is normally invalid (with a \l {QPointerUniqueId::numeric()} {numeric()} value of -1), + because touchscreens cannot uniquely identify fingers. But when the + \l {TouchPoint::InfoFlag} {Token} flag is set, it is expected to uniquely + identify a specific token (fiducial object). + + \sa flags +*/ +QPointerUniqueId QTouchEvent::TouchPoint::uniqueId() const +{ + return d->uniqueId; +} + +/*! Returns the current state of this touch point. */ Qt::TouchPointState QTouchEvent::TouchPoint::state() const @@ -4660,6 +4687,19 @@ qreal QTouchEvent::TouchPoint::pressure() const } /*! + \since 5.8 + Returns the angular orientation of this touch point. The return value is in degrees, + where zero (the default) indicates the finger or token is pointing upwards, + a negative angle means it's rotated to the left, and a positive angle means + it's rotated to the right. Most touchscreens do not detect rotation, so + zero is the most common value. +*/ +qreal QTouchEvent::TouchPoint::rotation() const +{ + return d->rotation; +} + +/*! Returns a velocity vector for this touch point. The vector is in the screen's coordinate system, using pixels per seconds for the magnitude. @@ -4710,6 +4750,14 @@ void QTouchEvent::TouchPoint::setId(int id) } /*! \internal */ +void QTouchEvent::TouchPoint::setUniqueId(qint64 uid) +{ + if (d->ref.load() != 1) + d = d->detach(); + d->uniqueId = QPointerUniqueId(uid); +} + +/*! \internal */ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) { if (d->ref.load() != 1) @@ -4846,6 +4894,14 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure) } /*! \internal */ +void QTouchEvent::TouchPoint::setRotation(qreal angle) +{ + if (d->ref.load() != 1) + d = d->detach(); + d->rotation = angle; +} + +/*! \internal */ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v) { if (d->ref.load() != 1) @@ -5116,4 +5172,37 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const return m_applicationState; } +/*! + \class QPointerUniqueId + \since 5.8 + \ingroup events + \inmodule QtGui + + \brief QPointerUniqueId identifies a unique object, such as a tagged token + or stylus, which is used with a pointing device. + + \sa QTouchEvent::TouchPoint +*/ + +/*! + Constructs a unique pointer ID with a numeric \a id provided by the hardware. + The default is -1, which means an invalid pointer ID. +*/ +QPointerUniqueId::QPointerUniqueId(qint64 id) + : m_numericId(id) +{ +} + +/*! + \property QPointerUniqueId::numeric + \brief the numeric unique ID of the token represented by a touchpoint + + This is the numeric unique ID if the device provides that type of ID; + otherwise it is -1. +*/ +qint64 QPointerUniqueId::numeric() +{ + return m_numericId; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 0a207667ad..785884681f 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -535,8 +535,9 @@ public: class Attribute { public: Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(qMove(val)) {} - AttributeType type; + Attribute(AttributeType t, int s, int l) : type(t), start(s), length(l), value() {} + AttributeType type; int start; int length; QVariant value; @@ -789,6 +790,22 @@ inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);} #endif // QT_NO_SHORTCUT +class QPointerUniqueIdPrivate; +class Q_GUI_EXPORT QPointerUniqueId +{ + Q_GADGET + Q_PROPERTY(qint64 numeric READ numeric CONSTANT) +public: + explicit QPointerUniqueId(qint64 id = -1); + + qint64 numeric(); + +private: + // TODO for TUIO 2, or any other type of complex token ID, a d-pointer can replace + // m_numericId without changing the size of this class. + qint64 m_numericId; +}; + class QTouchEventTouchPointPrivate; class Q_GUI_EXPORT QTouchEvent : public QInputEvent { @@ -797,7 +814,8 @@ public: { public: enum InfoFlag { - Pen = 0x0001 + Pen = 0x0001, + Token = 0x0002 }; #ifndef Q_MOC_RUN // otherwise moc gives @@ -823,6 +841,7 @@ public: { qSwap(d, other.d); } int id() const; + QPointerUniqueId uniqueId() const; Qt::TouchPointState state() const; @@ -847,12 +866,14 @@ public: QRectF screenRect() const; qreal pressure() const; + qreal rotation() const; QVector2D velocity() const; InfoFlags flags() const; QVector<QPointF> rawScreenPositions() const; // internal void setId(int id); + void setUniqueId(qint64 uid); void setState(Qt::TouchPointStates state); void setPos(const QPointF &pos); void setScenePos(const QPointF &scenePos); @@ -870,6 +891,7 @@ public: void setSceneRect(const QRectF &sceneRect); void setScreenRect(const QRectF &screenRect); void setPressure(qreal pressure); + void setRotation(qreal angle); void setVelocity(const QVector2D &v); void setFlags(InfoFlags flags); void setRawScreenPositions(const QVector<QPointF> &positions); diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 726aa05d36..b37045c5d8 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -65,7 +65,8 @@ public: : ref(1), id(id), state(Qt::TouchPointReleased), - pressure(qreal(-1.)) + pressure(qreal(-1.)), + rotation(qreal(0.)) { } inline QTouchEventTouchPointPrivate *detach() @@ -79,12 +80,14 @@ public: QAtomicInt ref; int id; + QPointerUniqueId uniqueId; Qt::TouchPointStates state; QRectF rect, sceneRect, screenRect; QPointF normalizedPos, startPos, startScenePos, startScreenPos, startNormalizedPos, lastPos, lastScenePos, lastScreenPos, lastNormalizedPos; qreal pressure; + qreal rotation; QVector2D velocity; QTouchEvent::TouchPoint::InfoFlags flags; QVector<QPointF> rawScreenPositions; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a9f0ab04a1..239c5e135b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -104,13 +104,13 @@ #if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) # include <QtCore/qt_windows.h> # include <QtCore/QLibraryInfo> # if defined(Q_OS_WINPHONE) # include <Objbase.h> # endif -#endif // Q_OS_WIN && !Q_OS_WINCE +#endif // Q_OS_WIN #include <ctype.h> @@ -1102,12 +1102,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform keys.join(QStringLiteral(", "))); } fatalMessage += QStringLiteral("Reinstalling the application may fix this problem."); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Windows: Display message box unless it is a console application // or debug build showing an assert box. if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT qFatal("%s", qPrintable(fatalMessage)); return; } @@ -1186,7 +1186,7 @@ static void init_plugins(const QList<QByteArray> &pluginList) if (plugin) QGuiApplicationPrivate::generic_plugin_list.append(plugin); else - qWarning() << "No such plugin for spec " << pluginSpec; + qWarning("No such plugin for spec \"%s\"", pluginSpec.constData()); } } @@ -1310,7 +1310,7 @@ void QGuiApplicationPrivate::init() #ifndef QT_NO_SESSIONMANAGER QString session_id; QString session_key; -# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# if defined(Q_OS_WIN) wchar_t guidstr[40]; GUID guid; CoCreateGuid(&guid); @@ -2450,6 +2450,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QWindow *window = e->window.data(); typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents; + bool velocityOnly = false; for (int i = 0; i < e->points.count(); ++i) { QTouchEvent::TouchPoint touchPoint = e->points.at(i); @@ -2526,8 +2527,14 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // Stationary points might not be delivered down to the receiving item // and get their position transformed, keep the old values instead. - if (touchPoint.state() != Qt::TouchPointStationary) + if (touchPoint.state() == Qt::TouchPointStationary) { + if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) { + touchInfo.touchPoint.setVelocity(touchPoint.velocity()); + velocityOnly = true; + } + } else { touchInfo.touchPoint = touchPoint; + } break; } @@ -2561,7 +2568,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To break; case Qt::TouchPointStationary: // don't send the event if nothing changed - continue; + if (velocityOnly) + eventType = QEvent::TouchUpdate; + else + continue; default: eventType = QEvent::TouchUpdate; break; diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 4cc9e95e81..d6e467db59 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -68,10 +68,11 @@ static inline qreal initialGlobalScaleFactor() } } else { if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) { - qWarning() << "Warning:" << legacyDevicePixelEnvVar << "is deprecated. Instead use:" << endl - << " " << autoScreenEnvVar << "to enable platform plugin controlled per-screen factors." << endl - << " " << screenFactorsEnvVar << "to set per-screen factors." << endl - << " " << scaleFactorEnvVar << "to set the application global scale factor."; + qWarning("Warning: %s is deprecated. Instead use:\n" + " %s to enable platform plugin controlled per-screen factors.\n" + " %s to set per-screen factors.\n" + " %s to set the application global scale factor.", + legacyDevicePixelEnvVar, autoScreenEnvVar, screenFactorsEnvVar, scaleFactorEnvVar); int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar); if (dpr > 0) diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index eb3a9d5545..e790e3094f 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -382,8 +382,7 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow * qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pointRegion; - const auto rects = pixelRegion.rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : pixelRegion) { pointRegion += QRect(fromNative(rect.topLeft(), scaleFactor), fromNative(rect.size(), scaleFactor)); } @@ -399,7 +398,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW const qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pointRegion; - foreach (const QRect &rect, pixelRegion.rects()) { + for (const QRect &rect : pixelRegion) { const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor; const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor; pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())), @@ -415,8 +414,7 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pixelRegon; - const auto rects = pointRegion.rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : pointRegion) { pixelRegon += QRect(toNative(rect.topLeft(), scaleFactor), toNative(rect.size(), scaleFactor)); } diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 59bf2bb065..19464eeca3 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -940,13 +940,20 @@ GLuint QOpenGLContext::defaultFramebufferObject() const If \a surface is 0 this is equivalent to calling doneCurrent(). - Do not call this function from a different thread than the one the + Avoid calling this function from a different thread than the one the QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a different thread you should first call make sure it's not current in the current thread, by calling doneCurrent() if necessary. Then call moveToThread(otherThread) before using it in the other thread. - \sa functions(), doneCurrent() + By default Qt employs a check that enforces the above condition on the + thread affinity. It is still possible to disable this check by setting the + \c{Qt::AA_DontCheckOpenGLContextThreadAffinity} application attribute. Be + sure to understand the consequences of using QObjects from outside + the thread they live in, as explained in the + \l{QObject#Thread Affinity}{QObject thread affinity} documentation. + + \sa functions(), doneCurrent(), Qt::AA_DontCheckOpenGLContextThreadAffinity */ bool QOpenGLContext::makeCurrent(QSurface *surface) { @@ -954,8 +961,10 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (!isValid()) return false; - if (Q_UNLIKELY(thread() != QThread::currentThread())) + if (Q_UNLIKELY(!qApp->testAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity) + && thread() != QThread::currentThread())) { qFatal("Cannot make QOpenGLContext current in a different thread"); + } if (!surface) { doneCurrent(); diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index fe4d167078..c36186b815 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -156,23 +156,33 @@ public: QString windowTitle; }; -QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) +QFontDialogOptions::QFontDialogOptions(QFontDialogOptionsPrivate *dd) + : d(dd) { } -QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) +QFontDialogOptions::~QFontDialogOptions() { } -QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) +namespace { + struct FontDialogCombined : QFontDialogOptionsPrivate, QFontDialogOptions + { + FontDialogCombined() : QFontDialogOptionsPrivate(), QFontDialogOptions(this) {} + FontDialogCombined(const FontDialogCombined &other) + : QFontDialogOptionsPrivate(other), QFontDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QFontDialogOptions> QFontDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<FontDialogCombined>::create(); } -QFontDialogOptions::~QFontDialogOptions() +QSharedPointer<QFontDialogOptions> QFontDialogOptions::clone() const { + return QSharedPointer<FontDialogCombined>::create(*static_cast<const FontDialogCombined*>(this)); } QString QFontDialogOptions::windowTitle() const @@ -289,23 +299,33 @@ public: QString windowTitle; }; -QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) +QColorDialogOptions::QColorDialogOptions(QColorDialogOptionsPrivate *dd) + : d(dd) { } -QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) +QColorDialogOptions::~QColorDialogOptions() { } -QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) +namespace { + struct ColorDialogCombined : QColorDialogOptionsPrivate, QColorDialogOptions + { + ColorDialogCombined() : QColorDialogOptionsPrivate(), QColorDialogOptions(this) {} + ColorDialogCombined(const ColorDialogCombined &other) + : QColorDialogOptionsPrivate(other), QColorDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QColorDialogOptions> QColorDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<ColorDialogCombined>::create(); } -QColorDialogOptions::~QColorDialogOptions() +QSharedPointer<QColorDialogOptions> QColorDialogOptions::clone() const { + return QSharedPointer<ColorDialogCombined>::create(*static_cast<const ColorDialogCombined*>(this)); } QString QColorDialogOptions::windowTitle() const @@ -436,23 +456,32 @@ public: QStringList supportedSchemes; }; -QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) +QFileDialogOptions::QFileDialogOptions(QFileDialogOptionsPrivate *dd) + : d(dd) { } -QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) +QFileDialogOptions::~QFileDialogOptions() { } -QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) +namespace { + struct FileDialogCombined : QFileDialogOptionsPrivate, QFileDialogOptions + { + FileDialogCombined() : QFileDialogOptionsPrivate(), QFileDialogOptions(this) {} + FileDialogCombined(const FileDialogCombined &other) : QFileDialogOptionsPrivate(other), QFileDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QFileDialogOptions> QFileDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<FileDialogCombined>::create(); } -QFileDialogOptions::~QFileDialogOptions() +QSharedPointer<QFileDialogOptions> QFileDialogOptions::clone() const { + return QSharedPointer<FileDialogCombined>::create(*static_cast<const FileDialogCombined*>(this)); } QString QFileDialogOptions::windowTitle() const @@ -728,23 +757,33 @@ public: QPlatformDialogHelper::StandardButtons buttons; }; -QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate) +QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd) + : d(dd) { } -QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d) +QMessageDialogOptions::~QMessageDialogOptions() { } -QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs) +namespace { + struct MessageDialogCombined : QMessageDialogOptionsPrivate, QMessageDialogOptions + { + MessageDialogCombined() : QMessageDialogOptionsPrivate(), QMessageDialogOptions(this) {} + MessageDialogCombined(const MessageDialogCombined &other) + : QMessageDialogOptionsPrivate(other), QMessageDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<MessageDialogCombined>::create(); } -QMessageDialogOptions::~QMessageDialogOptions() +QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::clone() const { + return QSharedPointer<MessageDialogCombined>::create(*static_cast<const MessageDialogCombined*>(this)); } QString QMessageDialogOptions::windowTitle() const diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 825dcf293d..78667643fe 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -72,6 +72,8 @@ class QFontDialogOptionsPrivate; class QFileDialogOptionsPrivate; class QMessageDialogOptionsPrivate; +#define QPLATFORMDIALOGHELPERS_HAS_CREATE + class Q_GUI_EXPORT QPlatformDialogHelper : public QObject { Q_OBJECT @@ -176,6 +178,10 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QColorDialogOptions { Q_GADGET + Q_DISABLE_COPY(QColorDialogOptions) +protected: + explicit QColorDialogOptions(QColorDialogOptionsPrivate *dd); + ~QColorDialogOptions(); public: enum ColorDialogOption { ShowAlphaChannel = 0x00000001, @@ -186,12 +192,8 @@ public: Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) Q_FLAG(ColorDialogOptions) - QColorDialogOptions(); - QColorDialogOptions(const QColorDialogOptions &rhs); - QColorDialogOptions &operator=(const QColorDialogOptions &rhs); - ~QColorDialogOptions(); - - void swap(QColorDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QColorDialogOptions> create(); + QSharedPointer<QColorDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -211,11 +213,9 @@ public: static void setStandardColor(int index, QRgb color); private: - QSharedDataPointer<QColorDialogOptionsPrivate> d; + QColorDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QColorDialogOptions) - class Q_GUI_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -237,6 +237,11 @@ private: class Q_GUI_EXPORT QFontDialogOptions { Q_GADGET + Q_DISABLE_COPY(QFontDialogOptions) +protected: + explicit QFontDialogOptions(QFontDialogOptionsPrivate *dd); + ~QFontDialogOptions(); + public: enum FontDialogOption { NoButtons = 0x00000001, @@ -250,12 +255,8 @@ public: Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) Q_FLAG(FontDialogOptions) - QFontDialogOptions(); - QFontDialogOptions(const QFontDialogOptions &rhs); - QFontDialogOptions &operator=(const QFontDialogOptions &rhs); - ~QFontDialogOptions(); - - void swap(QFontDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QFontDialogOptions> create(); + QSharedPointer<QFontDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -266,11 +267,9 @@ public: FontDialogOptions options() const; private: - QSharedDataPointer<QFontDialogOptionsPrivate> d; + QFontDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QFontDialogOptions) - class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -292,6 +291,11 @@ private: class Q_GUI_EXPORT QFileDialogOptions { Q_GADGET + Q_DISABLE_COPY(QFileDialogOptions) +protected: + QFileDialogOptions(QFileDialogOptionsPrivate *dd); + ~QFileDialogOptions(); + public: enum ViewMode { Detail, List }; Q_ENUM(ViewMode) @@ -319,12 +323,8 @@ public: Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption) Q_FLAG(FileDialogOptions) - QFileDialogOptions(); - QFileDialogOptions(const QFileDialogOptions &rhs); - QFileDialogOptions &operator=(const QFileDialogOptions &rhs); - ~QFileDialogOptions(); - - void swap(QFileDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QFileDialogOptions> create(); + QSharedPointer<QFileDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -383,11 +383,9 @@ public: static QString defaultNameFilterString(); private: - QSharedDataPointer<QFileDialogOptionsPrivate> d; + QFileDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QFileDialogOptions) - class Q_GUI_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -423,17 +421,18 @@ private: class Q_GUI_EXPORT QMessageDialogOptions { Q_GADGET + Q_DISABLE_COPY(QMessageDialogOptions) +protected: + QMessageDialogOptions(QMessageDialogOptionsPrivate *dd); + ~QMessageDialogOptions(); + public: // Keep in sync with QMessageBox::Icon enum Icon { NoIcon, Information, Warning, Critical, Question }; Q_ENUM(Icon) - QMessageDialogOptions(); - QMessageDialogOptions(const QMessageDialogOptions &rhs); - QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs); - ~QMessageDialogOptions(); - - void swap(QMessageDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QMessageDialogOptions> create(); + QSharedPointer<QMessageDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -454,11 +453,9 @@ public: QPlatformDialogHelper::StandardButtons standardButtons() const; private: - QSharedDataPointer<QMessageDialogOptionsPrivate> d; + QMessageDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QMessageDialogOptions) - class Q_GUI_EXPORT QPlatformMessageDialogHelper : public QPlatformDialogHelper { Q_OBJECT diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 00b8e05f30..60b2706d35 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -469,7 +469,10 @@ QList<QTouchEvent::TouchPoint> QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd(); while (point != end) { p.setId(point->id); + if (point->uniqueId >= 0) + p.setUniqueId(point->uniqueId); p.setPressure(point->pressure); + p.setRotation(point->rotation); states |= point->state; p.setState(point->state); diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index eff3986788..cde70a1102 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -117,11 +117,14 @@ public: static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); struct TouchPoint { - TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary), flags(0) { } + TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary), flags(0) { } int id; // for application use + qint64 uniqueId; // for TUIO: object/token ID; otherwise empty + // TODO for TUIO 2.0: add registerPointerUniqueID(QPointerUniqueId) QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) QRectF area; // the touched area, centered at position in screen coordinates qreal pressure; // 0 to 1 + qreal rotation; // 0 means pointing straight up; 0 if unknown (like QTabletEvent::rotation) Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} QVector2D velocity; // in screen coordinate system, pixels / seconds QTouchEvent::TouchPoint::InfoFlags flags; diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp index 4e3d14ba37..1d3e47f93b 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -390,7 +390,7 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO fragShader->setObjectName(QString::fromLatin1(description)); #endif if (!fragShader->compileSourceCode(fragSource)) { - qWarning() << "Warning:" << description << "failed to compile!"; + qWarning("Warning: \"%s\" failed to compile!", description.constData()); break; } @@ -405,7 +405,7 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO vertexShader->setObjectName(QString::fromLatin1(description)); #endif if (!vertexShader->compileSourceCode(vertexSource)) { - qWarning() << "Warning:" << description << "failed to compile!"; + qWarning("Warning: \"%s\" failed to compile!", description.constData()); break; } diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp index 9d5a76380a..4235c9a339 100644 --- a/src/gui/opengl/qopenglfunctions_1_0.cpp +++ b/src/gui/opengl/qopenglfunctions_1_0.cpp @@ -74,12 +74,14 @@ QOpenGLFunctions_1_0::QOpenGLFunctions_1_0() QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } } bool QOpenGLFunctions_1_0::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp index 57385f1927..7d09bb40c1 100644 --- a/src/gui/opengl/qopenglfunctions_1_1.cpp +++ b/src/gui/opengl/qopenglfunctions_1_1.cpp @@ -76,18 +76,22 @@ QOpenGLFunctions_1_1::QOpenGLFunctions_1_1() QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } } bool QOpenGLFunctions_1_1::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp index 9eaa13862d..94a9d64660 100644 --- a/src/gui/opengl/qopenglfunctions_1_2.cpp +++ b/src/gui/opengl/qopenglfunctions_1_2.cpp @@ -78,24 +78,30 @@ QOpenGLFunctions_1_2::QOpenGLFunctions_1_2() QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } } bool QOpenGLFunctions_1_2::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp index 6211997302..972ef9ff70 100644 --- a/src/gui/opengl/qopenglfunctions_1_3.cpp +++ b/src/gui/opengl/qopenglfunctions_1_3.cpp @@ -80,30 +80,38 @@ QOpenGLFunctions_1_3::QOpenGLFunctions_1_3() QOpenGLFunctions_1_3::~QOpenGLFunctions_1_3() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_1_3::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp index d07f1decec..2a0820d0cb 100644 --- a/src/gui/opengl/qopenglfunctions_1_5.cpp +++ b/src/gui/opengl/qopenglfunctions_1_5.cpp @@ -83,39 +83,50 @@ QOpenGLFunctions_1_5::QOpenGLFunctions_1_5() QOpenGLFunctions_1_5::~QOpenGLFunctions_1_5() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } } bool QOpenGLFunctions_1_5::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp index b7dc8ef458..c175b13c5b 100644 --- a/src/gui/opengl/qopenglfunctions_2_0.cpp +++ b/src/gui/opengl/qopenglfunctions_2_0.cpp @@ -85,42 +85,54 @@ QOpenGLFunctions_2_0::QOpenGLFunctions_2_0() QOpenGLFunctions_2_0::~QOpenGLFunctions_2_0() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } } bool QOpenGLFunctions_2_0::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp index e756685d10..4e77efd121 100644 --- a/src/gui/opengl/qopenglfunctions_2_1.cpp +++ b/src/gui/opengl/qopenglfunctions_2_1.cpp @@ -86,45 +86,58 @@ QOpenGLFunctions_2_1::QOpenGLFunctions_2_1() QOpenGLFunctions_2_1::~QOpenGLFunctions_2_1() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } } bool QOpenGLFunctions_2_1::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp index a459ddf244..9328f5ca89 100644 --- a/src/gui/opengl/qopenglfunctions_3_1.cpp +++ b/src/gui/opengl/qopenglfunctions_3_1.cpp @@ -82,36 +82,46 @@ QOpenGLFunctions_3_1::QOpenGLFunctions_3_1() QOpenGLFunctions_3_1::~QOpenGLFunctions_3_1() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); + Q_ASSERT(d_3_1_Core->refs.load()); + } } bool QOpenGLFunctions_3_1::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp index 09402db09a..b90a123bfe 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp @@ -90,54 +90,70 @@ QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility() QOpenGLFunctions_3_2_Compatibility::~QOpenGLFunctions_3_2_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } } bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp index 177dc9e25d..02c0c78b01 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp @@ -83,39 +83,50 @@ QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core() QOpenGLFunctions_3_2_Core::~QOpenGLFunctions_3_2_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); + Q_ASSERT(d_3_2_Core->refs.load()); + } } bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp index 110a49ea53..c585f0fc7c 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp @@ -91,60 +91,78 @@ QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility() QOpenGLFunctions_3_3_Compatibility::~QOpenGLFunctions_3_3_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp index 2e706724d9..7779d92b6a 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp @@ -84,42 +84,54 @@ QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core() QOpenGLFunctions_3_3_Core::~QOpenGLFunctions_3_3_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); + Q_ASSERT(d_3_3_Core->refs.load()); + } } bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp index 14fb168c94..b5c423ef0c 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp @@ -92,63 +92,82 @@ QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility() QOpenGLFunctions_4_0_Compatibility::~QOpenGLFunctions_4_0_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp index 6dc94153c8..4e4e8cc547 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp @@ -85,45 +85,58 @@ QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core() QOpenGLFunctions_4_0_Core::~QOpenGLFunctions_4_0_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); + Q_ASSERT(d_4_0_Core->refs.load()); + } } bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp index 293409ddef..72c60c74b7 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp @@ -93,66 +93,86 @@ QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility() QOpenGLFunctions_4_1_Compatibility::~QOpenGLFunctions_4_1_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp index ff3d191781..5a1e1eb42f 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_1_core.cpp @@ -86,48 +86,62 @@ QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core() QOpenGLFunctions_4_1_Core::~QOpenGLFunctions_4_1_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); + Q_ASSERT(d_4_1_Core->refs.load()); + } } bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp index 58527e92b5..8398ef0948 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp @@ -94,69 +94,90 @@ QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility() QOpenGLFunctions_4_2_Compatibility::~QOpenGLFunctions_4_2_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp index b929abcf6a..fdfb4db455 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp @@ -87,51 +87,66 @@ QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core() QOpenGLFunctions_4_2_Core::~QOpenGLFunctions_4_2_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); + Q_ASSERT(d_4_2_Core->refs.load()); + } } bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp index a9f15083ad..19e67c6331 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp @@ -95,72 +95,94 @@ QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility() QOpenGLFunctions_4_3_Compatibility::~QOpenGLFunctions_4_3_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_4_3_Core) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_4_3_Core) { d_4_3_Core->refs.deref(); - Q_ASSERT(d_4_3_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_4_3_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp index d3f988ba0d..95e2d7bc43 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp @@ -88,54 +88,70 @@ QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core() QOpenGLFunctions_4_3_Core::~QOpenGLFunctions_4_3_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_4_3_Core) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_4_3_Core) { d_4_3_Core->refs.deref(); - Q_ASSERT(d_4_3_Core->refs.load()); + Q_ASSERT(d_4_3_Core->refs.load()); + } } bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp index 8cbb94c1a1..a33efd0b95 100644 --- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp @@ -95,75 +95,98 @@ QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility() QOpenGLFunctions_4_4_Compatibility::~QOpenGLFunctions_4_4_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_4_3_Core) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_4_3_Core) { d_4_3_Core->refs.deref(); - Q_ASSERT(d_4_3_Core->refs.load()); - if (d_4_4_Core) + Q_ASSERT(d_4_3_Core->refs.load()); + } + if (d_4_4_Core) { d_4_4_Core->refs.deref(); - Q_ASSERT(d_4_4_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_4_4_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } } bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp index 95bfc3a438..019a70087a 100644 --- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp @@ -89,57 +89,74 @@ QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core() QOpenGLFunctions_4_4_Core::~QOpenGLFunctions_4_4_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_4_3_Core) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_4_3_Core) { d_4_3_Core->refs.deref(); - Q_ASSERT(d_4_3_Core->refs.load()); - if (d_4_4_Core) + Q_ASSERT(d_4_3_Core->refs.load()); + } + if (d_4_4_Core) { d_4_4_Core->refs.deref(); - Q_ASSERT(d_4_4_Core->refs.load()); + Q_ASSERT(d_4_4_Core->refs.load()); + } } bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp index 81ee8559a5..f9d2bb9ceb 100644 --- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp @@ -97,81 +97,106 @@ QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility() QOpenGLFunctions_4_5_Compatibility::~QOpenGLFunctions_4_5_Compatibility() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_4_3_Core) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_4_3_Core) { d_4_3_Core->refs.deref(); - Q_ASSERT(d_4_3_Core->refs.load()); - if (d_4_4_Core) + Q_ASSERT(d_4_3_Core->refs.load()); + } + if (d_4_4_Core) { d_4_4_Core->refs.deref(); - Q_ASSERT(d_4_4_Core->refs.load()); - if (d_4_5_Core) + Q_ASSERT(d_4_4_Core->refs.load()); + } + if (d_4_5_Core) { d_4_5_Core->refs.deref(); - Q_ASSERT(d_4_5_Core->refs.load()); - if (d_1_0_Deprecated) + Q_ASSERT(d_4_5_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); - if (d_1_1_Deprecated) + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } + if (d_1_1_Deprecated) { d_1_1_Deprecated->refs.deref(); - Q_ASSERT(d_1_1_Deprecated->refs.load()); - if (d_1_2_Deprecated) + Q_ASSERT(d_1_1_Deprecated->refs.load()); + } + if (d_1_2_Deprecated) { d_1_2_Deprecated->refs.deref(); - Q_ASSERT(d_1_2_Deprecated->refs.load()); - if (d_1_3_Deprecated) + Q_ASSERT(d_1_2_Deprecated->refs.load()); + } + if (d_1_3_Deprecated) { d_1_3_Deprecated->refs.deref(); - Q_ASSERT(d_1_3_Deprecated->refs.load()); - if (d_1_4_Deprecated) + Q_ASSERT(d_1_3_Deprecated->refs.load()); + } + if (d_1_4_Deprecated) { d_1_4_Deprecated->refs.deref(); - Q_ASSERT(d_1_4_Deprecated->refs.load()); - if (d_3_3_Deprecated) + Q_ASSERT(d_1_4_Deprecated->refs.load()); + } + if (d_3_3_Deprecated) { d_3_3_Deprecated->refs.deref(); - Q_ASSERT(d_3_3_Deprecated->refs.load()); - if (d_4_5_Deprecated) + Q_ASSERT(d_3_3_Deprecated->refs.load()); + } + if (d_4_5_Deprecated) { d_4_5_Deprecated->refs.deref(); - Q_ASSERT(d_4_5_Deprecated->refs.load()); + Q_ASSERT(d_4_5_Deprecated->refs.load()); + } } bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp index 2fdb9ef855..27c0223cf9 100644 --- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_5_core.cpp @@ -90,60 +90,78 @@ QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core() QOpenGLFunctions_4_5_Core::~QOpenGLFunctions_4_5_Core() { - if (d_1_0_Core) + if (d_1_0_Core) { d_1_0_Core->refs.deref(); - Q_ASSERT(d_1_0_Core->refs.load()); - if (d_1_1_Core) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_1_Core) { d_1_1_Core->refs.deref(); - Q_ASSERT(d_1_1_Core->refs.load()); - if (d_1_2_Core) + Q_ASSERT(d_1_1_Core->refs.load()); + } + if (d_1_2_Core) { d_1_2_Core->refs.deref(); - Q_ASSERT(d_1_2_Core->refs.load()); - if (d_1_3_Core) + Q_ASSERT(d_1_2_Core->refs.load()); + } + if (d_1_3_Core) { d_1_3_Core->refs.deref(); - Q_ASSERT(d_1_3_Core->refs.load()); - if (d_1_4_Core) + Q_ASSERT(d_1_3_Core->refs.load()); + } + if (d_1_4_Core) { d_1_4_Core->refs.deref(); - Q_ASSERT(d_1_4_Core->refs.load()); - if (d_1_5_Core) + Q_ASSERT(d_1_4_Core->refs.load()); + } + if (d_1_5_Core) { d_1_5_Core->refs.deref(); - Q_ASSERT(d_1_5_Core->refs.load()); - if (d_2_0_Core) + Q_ASSERT(d_1_5_Core->refs.load()); + } + if (d_2_0_Core) { d_2_0_Core->refs.deref(); - Q_ASSERT(d_2_0_Core->refs.load()); - if (d_2_1_Core) + Q_ASSERT(d_2_0_Core->refs.load()); + } + if (d_2_1_Core) { d_2_1_Core->refs.deref(); - Q_ASSERT(d_2_1_Core->refs.load()); - if (d_3_0_Core) + Q_ASSERT(d_2_1_Core->refs.load()); + } + if (d_3_0_Core) { d_3_0_Core->refs.deref(); - Q_ASSERT(d_3_0_Core->refs.load()); - if (d_3_1_Core) + Q_ASSERT(d_3_0_Core->refs.load()); + } + if (d_3_1_Core) { d_3_1_Core->refs.deref(); - Q_ASSERT(d_3_1_Core->refs.load()); - if (d_3_2_Core) + Q_ASSERT(d_3_1_Core->refs.load()); + } + if (d_3_2_Core) { d_3_2_Core->refs.deref(); - Q_ASSERT(d_3_2_Core->refs.load()); - if (d_3_3_Core) + Q_ASSERT(d_3_2_Core->refs.load()); + } + if (d_3_3_Core) { d_3_3_Core->refs.deref(); - Q_ASSERT(d_3_3_Core->refs.load()); - if (d_4_0_Core) + Q_ASSERT(d_3_3_Core->refs.load()); + } + if (d_4_0_Core) { d_4_0_Core->refs.deref(); - Q_ASSERT(d_4_0_Core->refs.load()); - if (d_4_1_Core) + Q_ASSERT(d_4_0_Core->refs.load()); + } + if (d_4_1_Core) { d_4_1_Core->refs.deref(); - Q_ASSERT(d_4_1_Core->refs.load()); - if (d_4_2_Core) + Q_ASSERT(d_4_1_Core->refs.load()); + } + if (d_4_2_Core) { d_4_2_Core->refs.deref(); - Q_ASSERT(d_4_2_Core->refs.load()); - if (d_4_3_Core) + Q_ASSERT(d_4_2_Core->refs.load()); + } + if (d_4_3_Core) { d_4_3_Core->refs.deref(); - Q_ASSERT(d_4_3_Core->refs.load()); - if (d_4_4_Core) + Q_ASSERT(d_4_3_Core->refs.load()); + } + if (d_4_4_Core) { d_4_4_Core->refs.deref(); - Q_ASSERT(d_4_4_Core->refs.load()); - if (d_4_5_Core) + Q_ASSERT(d_4_4_Core->refs.load()); + } + if (d_4_5_Core) { d_4_5_Core->refs.deref(); - Q_ASSERT(d_4_5_Core->refs.load()); + Q_ASSERT(d_4_5_Core->refs.load()); + } } bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions() diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index d93871c99b..5c05a05d80 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1012,11 +1012,11 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, funcs.glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { - QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); + const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds); funcs.glClearStencil(0); // Clear to zero - for (int i = 0; i < clearRegion.size(); ++i) { + for (const QRect &rect : clearRegion) { #ifndef QT_GL_NO_SCISSOR_TEST - setScissor(clearRegion.at(i)); + setScissor(rect); #endif funcs.glClear(GL_STENCIL_BUFFER_BIT); } diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 4134513210..f076e10e20 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -337,9 +337,10 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q) // Dump the source code if we got it if (sourceCodeBuffer) { - qWarning("*** Problematic %s shader source code ***", type); - qWarning() << qPrintable(QString::fromLatin1(sourceCodeBuffer)); - qWarning("***"); + qWarning("*** Problematic %s shader source code ***\n" + "%ls\n" + "***", + type, qUtf16Printable(QString::fromLatin1(sourceCodeBuffer))); } // Cleanup @@ -1215,8 +1216,7 @@ int QOpenGLShaderProgram::attributeLocation(const char *name) const if (d->linked && d->programGuard && d->programGuard->id()) { return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name); } else { - qWarning() << "QOpenGLShaderProgram::attributeLocation(" << name - << "): shader program is not linked"; + qWarning("QOpenGLShaderProgram::attributeLocation(%s): shader program is not linked", name); return -1; } } @@ -1479,7 +1479,7 @@ void QOpenGLShaderProgram::setAttributeValue Q_D(QOpenGLShaderProgram); Q_UNUSED(d); if (rows < 1 || rows > 4) { - qWarning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported"; + qWarning("QOpenGLShaderProgram::setAttributeValue: rows %d not supported", rows); return; } if (location != -1) { @@ -1891,8 +1891,7 @@ int QOpenGLShaderProgram::uniformLocation(const char *name) const if (d->linked && d->programGuard && d->programGuard->id()) { return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name); } else { - qWarning() << "QOpenGLShaderProgram::uniformLocation(" << name - << "): shader program is not linked"; + qWarning("QOpenGLShaderProgram::uniformLocation(%s): shader program is not linked", name); return -1; } } @@ -2819,7 +2818,7 @@ void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *val else if (tupleSize == 4) d->glfuncs->glUniform4fv(location, count, values); else - qWarning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported"; + qWarning("QOpenGLShaderProgram::setUniformValue: size %d not supported", tupleSize); } } diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 20dd8d7f82..269e6f2d97 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -261,7 +261,7 @@ QT_BEGIN_NAMESPACE alpha-channel to feature \l {QColor#Alpha-Blended Drawing}{alpha-blended drawing}. - \sa QPalette, QBrush, QApplication::setColorSpec() + \sa QPalette, QBrush */ #define QCOLOR_INT_RANGE_CHECK(fn, var) \ diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index a325ee923e..b452019251 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -168,7 +168,7 @@ template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB66 template<QImage::Format Format> static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); @@ -198,7 +198,7 @@ static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int template<QImage::Format Format> static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); @@ -228,7 +228,7 @@ static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *sr template<QImage::Format Format> static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); @@ -282,7 +282,7 @@ static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint template<QImage::Format Format> static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); @@ -336,48 +336,110 @@ static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const template<QImage::Format Format, bool fromRGB> static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *dither) { - Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1); - Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1); - Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1); + Q_CONSTEXPR uchar rWidth = redWidth<Format>(); + Q_CONSTEXPR uchar gWidth = greenWidth<Format>(); + Q_CONSTEXPR uchar bWidth = blueWidth<Format>(); - Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>(); - Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>(); - Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>(); + // RGB32 -> RGB888 is not a precision loss. + if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) { + Q_CONSTEXPR uint rMask = (1 << rWidth) - 1; + Q_CONSTEXPR uint gMask = (1 << gWidth) - 1; + Q_CONSTEXPR uint bMask = (1 << bWidth) - 1; - for (int i = 0; i < count; ++i) { - const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]); - const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); - const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); - const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); - buffer[i] = r | g | b; + Q_CONSTEXPR uchar rRightShift = 24 - rWidth; + Q_CONSTEXPR uchar gRightShift = 16 - gWidth; + Q_CONSTEXPR uchar bRightShift = 8 - bWidth; + + for (int i = 0; i < count; ++i) { + const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]); + const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); + const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); + const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); + buffer[i] = r | g | b; + } + } else { + // We do ordered dither by using a rounding conversion, but instead of + // adding half of input precision, we add the adjusted result from the + // bayer matrix before narrowing. + // Note: Rounding conversion in itself is different from the naive + // conversion we do above for non-dithering. + const uint *bayer_line = qt_bayer_matrix[dither->y & 15]; + for (int i = 0; i < count; ++i) { + const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]); + const int d = bayer_line[(dither->x + i) & 15]; + const int dr = d - ((d + 1) >> rWidth); + const int dg = d - ((d + 1) >> gWidth); + const int db = d - ((d + 1) >> bWidth); + int r = qRed(c); + int g = qGreen(c); + int b = qBlue(c); + r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth); + g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth); + b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth); + buffer[i] = (r << redShift<Format>()) + | (g << greenShift<Format>()) + | (b << blueShift<Format>()); + } } return buffer; } template<QImage::Format Format, bool fromRGB> static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *dither) { - Q_CONSTEXPR uint aMask = ((1 << alphaWidth<Format>()) - 1); - Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1); - Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1); - Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1); + Q_CONSTEXPR uchar aWidth = alphaWidth<Format>(); + Q_CONSTEXPR uchar rWidth = redWidth<Format>(); + Q_CONSTEXPR uchar gWidth = greenWidth<Format>(); + Q_CONSTEXPR uchar bWidth = blueWidth<Format>(); - Q_CONSTEXPR uchar aRightShift = 32 - alphaWidth<Format>(); - Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>(); - Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>(); - Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>(); + if (!dither) { + Q_CONSTEXPR uint aMask = (1 << aWidth) - 1; + Q_CONSTEXPR uint rMask = (1 << rWidth) - 1; + Q_CONSTEXPR uint gMask = (1 << gWidth) - 1; + Q_CONSTEXPR uint bMask = (1 << bWidth) - 1; - Q_CONSTEXPR uint aOpaque = (0xff & aMask) << alphaShift<Format>(); - for (int i = 0; i < count; ++i) { - const uint c = src[i]; - const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>()); - const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); - const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); - const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); - buffer[i] = a | r | g | b; + Q_CONSTEXPR uchar aRightShift = 32 - aWidth; + Q_CONSTEXPR uchar rRightShift = 24 - rWidth; + Q_CONSTEXPR uchar gRightShift = 16 - gWidth; + Q_CONSTEXPR uchar bRightShift = 8 - bWidth; + + Q_CONSTEXPR uint aOpaque = aMask << alphaShift<Format>(); + for (int i = 0; i < count; ++i) { + const uint c = src[i]; + const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>()); + const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); + const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); + const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); + buffer[i] = a | r | g | b; + } + } else { + const uint *bayer_line = qt_bayer_matrix[dither->y & 15]; + for (int i = 0; i < count; ++i) { + const uint c = src[i]; + const int d = bayer_line[(dither->x + i) & 15]; + const int da = d - ((d + 1) >> aWidth); + const int dr = d - ((d + 1) >> rWidth); + const int dg = d - ((d + 1) >> gWidth); + const int db = d - ((d + 1) >> bWidth); + int a = qAlpha(c); + int r = qRed(c); + int g = qGreen(c); + int b = qBlue(c); + if (fromRGB) + a = (1 << aWidth) - 1; + else + a = (a + ((da - a) >> aWidth) + 1) >> (8 - aWidth); + r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth); + g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth); + b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth); + buffer[i] = (a << alphaShift<Format>()) + | (r << redShift<Format>()) + | (g << greenShift<Format>()) + | (b << blueShift<Format>()); + } } return buffer; } @@ -418,35 +480,35 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe // To convert in place, let 'dest' and 'src' be the same. static const uint *QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *clut) + const QVector<QRgb> *clut, QDitherInfo *) { for (int i = 0; i < count; ++i) - buffer[i] = qPremultiply(clut[src[i]]); + buffer[i] = qPremultiply(clut->at(src[i])); return buffer; } static const QRgba64 *QT_FASTCALL convertIndexedToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *clut) + const QVector<QRgb> *clut, QDitherInfo *) { for (int i = 0; i < count; ++i) - buffer[i] = QRgba64::fromArgb32(clut[src[i]]).premultiplied(); + buffer[i] = QRgba64::fromArgb32(clut->at(src[i])).premultiplied(); return buffer; } static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return src; } static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return qt_convertARGB32ToARGB32PM(buffer, src, count); } static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = RGBA2ARGB(src[i]); @@ -454,13 +516,13 @@ static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const u } static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return qt_convertRGBA8888ToARGB32PM(buffer, src, count); } static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qRgba(0, 0, 0, src[i]); @@ -468,7 +530,7 @@ static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *sr } static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qRgb(src[i], src[i], src[i]); @@ -476,7 +538,7 @@ static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint } static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]); @@ -484,7 +546,7 @@ static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const ui } static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255); @@ -492,7 +554,7 @@ static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, cons } static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qUnpremultiply(src[i]); @@ -500,7 +562,7 @@ static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uin } static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = ARGB2RGBA(src[i]); @@ -551,7 +613,7 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint * #endif static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { #ifdef __SSE2__ qConvertARGB32PMToARGB64PM_sse2<false, true>(buffer, src, count); @@ -563,7 +625,7 @@ static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uin } static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { #ifdef __SSE2__ qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count); @@ -577,7 +639,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const } static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { #ifdef __SSE2__ qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count); @@ -589,7 +651,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, con } static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { #ifdef __SSE2__ qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count); @@ -603,7 +665,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, con } static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { #ifdef __SSE2__ qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count); @@ -615,7 +677,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, c } static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = ARGB2RGBA(qUnpremultiply(src[i])); @@ -623,7 +685,7 @@ static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const u } static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = ARGB2RGBA(0xff000000 | src[i]); @@ -631,7 +693,7 @@ static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *sr } static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i])); @@ -640,10 +702,28 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint template<QtPixelOrder PixelOrder> static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *dither) { - for (int i = 0; i < count; ++i) - buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]); + if (!dither) { + for (int i = 0; i < count; ++i) + buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]); + } else { + for (int i = 0; i < count; ++i) { + const uint c = src[i]; + short d10 = (qt_bayer_matrix[dither->y & 15][(dither->x + i) & 15] << 2); + short a10 = (c >> 30) * 0x155; + short r10 = ((c >> 20) & 0x3ff); + short g10 = ((c >> 10) & 0x3ff); + short b10 = (c & 0x3ff); + if (PixelOrder == PixelOrderBGR) + std::swap(r10, b10); + short a8 = (a10 + ((d10 - a10) >> 8)) >> 2; + short r8 = (r10 + ((d10 - r10) >> 8)) >> 2; + short g8 = (g10 + ((d10 - g10) >> 8)) >> 2; + short b8 = (b10 + ((d10 - b10) >> 8)) >> 2; + buffer[i] = qRgba(r8, g8, b8, a8); + } + } return buffer; } @@ -693,7 +773,7 @@ static inline void qConvertA2RGB30PMToARGB64PM_sse2(QRgba64 *buffer, const uint template<QtPixelOrder PixelOrder> static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { #ifdef __SSE2__ qConvertA2RGB30PMToARGB64PM_sse2<PixelOrder>(buffer, src, count); @@ -706,7 +786,7 @@ static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, co template<QtPixelOrder PixelOrder> static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]); @@ -715,7 +795,7 @@ static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const template<QtPixelOrder PixelOrder> static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]); @@ -724,7 +804,7 @@ static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *s template<QtPixelOrder PixelOrder> static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i])); @@ -732,7 +812,7 @@ static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint } static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qAlpha(src[i]); @@ -740,7 +820,7 @@ static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uin } static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qGray(src[i]); @@ -748,7 +828,7 @@ static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const ui } static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qGray(qUnpremultiply(src[i])); @@ -1037,7 +1117,7 @@ static uint *QT_FASTCALL destFetch(uint *buffer, QRasterBuffer *rasterBuffer, in { const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length); - return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0)); + return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, 0, 0)); } static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) @@ -1045,14 +1125,14 @@ static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBu const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; uint buffer32[buffer_size]; const uint *ptr = qFetchPixels[layout->bpp](buffer32, rasterBuffer->scanLine(y), x, length); - return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, layout, 0)); + return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, 0, 0)); } static QRgba64 *QT_FASTCALL destFetch64uint32(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) { const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; const uint *src = ((const uint *)rasterBuffer->scanLine(y)) + x; - return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, layout, 0)); + return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, 0, 0)); } static DestFetchProc destFetchProc[QImage::NImageFormats] = @@ -1219,9 +1299,9 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con int l = qMin(length, buffer_size); const uint *ptr = 0; if (!layout->premultiplied && !layout->alphaWidth) - ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0); + ptr = layout->convertFromRGB32(buf, buffer, l, 0, 0); else - ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0); + ptr = layout->convertFromARGB32PM(buf, buffer, l, 0, 0); store(dest, ptr, x, l); length -= l; buffer += l; @@ -1247,9 +1327,9 @@ static void QT_FASTCALL destStore64(QRasterBuffer *rasterBuffer, int x, int y, c const uint *ptr = 0; convertFromRgb64(buf, buffer, l); if (!layout->premultiplied && !layout->alphaWidth) - ptr = layout->convertFromRGB32(buf, buf, l, layout, 0); + ptr = layout->convertFromRGB32(buf, buf, l, 0, 0); else - ptr = layout->convertFromARGB32PM(buf, buf, l, layout, 0); + ptr = layout->convertFromARGB32PM(buf, buf, l, 0, 0); store(dest, ptr, x, l); length -= l; buffer += l; @@ -1436,8 +1516,7 @@ static const uint *QT_FASTCALL fetchUntransformed(uint *buffer, const Operator * { const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length); - const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; - return layout->convertToARGB32PM(buffer, ptr, length, layout, clut); + return layout->convertToARGB32PM(buffer, ptr, length, data->texture.colorTable, 0); } static const uint *QT_FASTCALL fetchUntransformedARGB32PM(uint *, const Operator *, @@ -1465,14 +1544,13 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op const QSpanData *data, int y, int x, int length) { const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; - const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; if (layout->bpp != QPixelLayout::BPP32) { uint buffer32[buffer_size]; const uint *ptr = qFetchPixels[layout->bpp](buffer32, data->texture.scanLine(y), x, length); - return layout->convertToARGB64PM(buffer, ptr, length, layout, clut); + return layout->convertToARGB64PM(buffer, ptr, length, data->texture.colorTable, 0); } else { const uint *src = (const uint *)data->texture.scanLine(y) + x; - return layout->convertToARGB64PM(buffer, src, length, layout, clut); + return layout->convertToARGB64PM(buffer, src, length, data->texture.colorTable, 0); } } @@ -1639,8 +1717,7 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, ++b; } } - const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; - return layout->convertToARGB32PM(buffer, buffer, length, layout, clut); + return layout->convertToARGB32PM(buffer, buffer, length, data->texture.colorTable, 0); } template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */ @@ -1655,7 +1732,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; FetchPixelFunc fetch = qFetchPixel[layout->bpp]; - const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; + const QVector<QRgb> *clut = data->texture.colorTable; uint buffer32[buffer_size]; QRgba64 *b = buffer; @@ -1672,7 +1749,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper int i = 0, j = 0; while (i < length) { if (j == buffer_size) { - layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut); + layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0); b += buffer_size; j = 0; } @@ -1695,7 +1772,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper ++i; ++j; } if (j > 0) { - layout->convertToARGB64PM(b, buffer32, j, layout, clut); + layout->convertToARGB64PM(b, buffer32, j, clut, 0); b += j; } } else { @@ -1710,7 +1787,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper int i = 0, j = 0; while (i < length) { if (j == buffer_size) { - layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut); + layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0); b += buffer_size; j = 0; } @@ -1741,7 +1818,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper ++i; ++j; } if (j > 0) { - layout->convertToARGB64PM(b, buffer32, j, layout, clut); + layout->convertToARGB64PM(b, buffer32, j, clut, 0); b += j; } } @@ -2423,7 +2500,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper const QSpanData *data, int y, int x, int length) { const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; - const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; + const QVector<QRgb> *clut = data->texture.colorTable; int image_width = data->texture.width; int image_height = data->texture.height; @@ -2479,9 +2556,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper int len2 = qMin(x, count - len1); ptr1 = fetch(buf1, s1, x, len1); - ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, layout, clut); + ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, clut, 0); ptr2 = fetch(buf2, s2, x, len1); - ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, layout, clut); + ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, clut, 0); for (int i = 0; i < len1; ++i) { uint t = ptr1[i]; uint b = ptr2[i]; @@ -2491,9 +2568,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper if (len2) { ptr1 = fetch(buf1 + len1, s1, 0, len2); - ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, layout, clut); + ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, clut, 0); ptr2 = fetch(buf2 + len1, s2, 0, len2); - ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, layout, clut); + ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, clut, 0); for (int i = 0; i < len2; ++i) { uint t = ptr1[i]; uint b = ptr2[i]; @@ -2512,9 +2589,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper int leading = start - x; ptr1 = fetch(buf1 + leading, s1, start, len); - ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, layout, clut); + ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, clut, 0); ptr2 = fetch(buf2 + leading, s2, start, len); - ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, layout, clut); + ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, clut, 0); for (int i = 0; i < len; ++i) { uint t = ptr1[i]; @@ -2576,8 +2653,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper fx += fdx; } - layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); - layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); + layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0); + layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0); if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x int disty = (fy & 0x0000ffff) >> 8; @@ -2638,8 +2715,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper fx += fdx; fy += fdy; } - layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); - layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); + layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0); + layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0); if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) { //if we are zooming more than 8 times, we use 8bit precision for the position. @@ -2730,8 +2807,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper fw += fdw; } - layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); - layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); + layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0); + layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0); for (int i = 0; i < len; ++i) { int distx = distxs[i]; @@ -2752,7 +2829,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co const QSpanData *data, int y, int x, int length) { const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; - const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; + const QVector<QRgb> *clut = data->texture.colorTable; int image_width = data->texture.width; int image_height = data->texture.height; @@ -2863,9 +2940,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co fx += fdx; } - layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); + layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0); if (disty) - layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); + layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0); for (int i = 0; i < len; ++i) { int distx = (fracX & 0x0000ffff); @@ -3001,8 +3078,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co fx += fdx; fy += fdy; } - layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); - layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); + layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0); + layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0); for (int i = 0; i < len; ++i) { int distx = (fracX & 0x0000ffff); @@ -3073,8 +3150,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co fw += fdw; } - layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); - layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); + layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0); + layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0); for (int i = 0; i < len; ++i) { int distx = distxs[i]; @@ -4032,7 +4109,7 @@ template<typename T> struct QBlendBase { typedef T BlendType; - QBlendBase(QSpanData *d, Operator o) + QBlendBase(QSpanData *d, const Operator &o) : data(d) , op(o) , dest(0) @@ -4051,7 +4128,7 @@ struct QBlendBase class BlendSrcGeneric : public QBlendBase<uint> { public: - BlendSrcGeneric(QSpanData *d, Operator o) + BlendSrcGeneric(QSpanData *d, const Operator &o) : QBlendBase<uint>(d, o) { } @@ -4077,7 +4154,7 @@ public: class BlendSrcGenericRGB64 : public QBlendBase<QRgba64> { public: - BlendSrcGenericRGB64(QSpanData *d, Operator o) + BlendSrcGenericRGB64(QSpanData *d, const Operator &o) : QBlendBase<QRgba64>(d, o) { } @@ -5758,7 +5835,7 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int *dst = qRgb(nr, ng, nb); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false; static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma) @@ -5795,7 +5872,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, const quint32 c = color; const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); if (!tables) return; @@ -5822,7 +5899,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, } else if (coverage == 255) { dest[i] = c; } else { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel && qAlpha(dest[i]) == 255) { grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma); @@ -5863,7 +5940,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, } else if (coverage == 255) { dest[xp] = c; } else { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel && qAlpha(dest[xp]) == 255) { grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma); @@ -6321,7 +6398,7 @@ void qt_memfill32(quint32 *dest, quint32 color, int count) #endif #ifdef QT_COMPILER_SUPPORTS_SSE4_1 -template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); +template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QVector<QRgb> *, QDitherInfo *); #endif extern void qInitBlendFunctions(); @@ -6397,14 +6474,19 @@ static void qInitDrawhelperFunctions() #if defined(QT_COMPILER_SUPPORTS_SSE4_1) if (qCpuHasFeature(SSE4_1)) { #if !defined(__SSE4_1__) - extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); - extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); + extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4; #endif - extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); - extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); - extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); + extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); + extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4; @@ -6415,8 +6497,10 @@ static void qInitDrawhelperFunctions() #if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__) if (qCpuHasFeature(AVX2)) { - extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); - extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); + extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, + const QVector<QRgb> *, QDitherInfo *); qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2; qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2; } diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp index e11536ebd0..35a975c972 100644 --- a/src/gui/painting/qdrawhelper_avx2.cpp +++ b/src/gui/painting/qdrawhelper_avx2.cpp @@ -44,13 +44,13 @@ QT_BEGIN_NAMESPACE const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return qt_convertARGB32ToARGB32PM(buffer, src, count); } const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return qt_convertRGBA8888ToARGB32PM(buffer, src, count); } diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 21af6039f8..fa550541d3 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1171,11 +1171,15 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s) #undef MIX #undef AMIX -struct QPixelLayout; +struct QDitherInfo { + int x; + int y; +}; + typedef const uint *(QT_FASTCALL *ConvertFunc)(uint *buffer, const uint *src, int count, - const QPixelLayout *layout, const QRgb *clut); + const QVector<QRgb> *clut, QDitherInfo *dither); typedef const QRgba64 *(QT_FASTCALL *ConvertFunc64)(QRgba64 *buffer, const uint *src, int count, - const QPixelLayout *layout, const QRgb *clut); + const QVector<QRgb> *clut, QDitherInfo *dither); struct QPixelLayout { diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp index a39cdb3127..257bad9eca 100644 --- a/src/gui/painting/qdrawhelper_sse4.cpp +++ b/src/gui/painting/qdrawhelper_sse4.cpp @@ -45,19 +45,19 @@ QT_BEGIN_NAMESPACE const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return qt_convertARGB32ToARGB32PM(buffer, src, count); } const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { return qt_convertRGBA8888ToARGB32PM(buffer, src, count); } const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qUnpremultiply_sse4(src[i]); @@ -65,7 +65,7 @@ const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint } const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i])); @@ -73,7 +73,7 @@ const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uin } const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i])); @@ -82,7 +82,7 @@ const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *s template<QtPixelOrder PixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) + const QVector<QRgb> *, QDitherInfo *) { for (int i = 0; i < count; ++i) buffer[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]); @@ -91,10 +91,10 @@ const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const ui template const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *); + const QVector<QRgb> *, QDitherInfo *); template const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *); + const QVector<QRgb> *, QDitherInfo *); QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 81191d07b8..a50d1dfd73 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -312,7 +312,7 @@ void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s) { Qt::BrushStyle style = qbrush_style(s->brush); - caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern); + caps.updateState(STATE_BRUSH_PATTERN, style != Qt::SolidPattern); caps.updateState(STATE_BRUSH_ALPHA, qbrush_color(s->brush).alpha() < 255); } @@ -374,9 +374,8 @@ void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &colo else pmData->blittable()->fillRect(targetRect & clipData->clipRect, color); } else if (clipData->hasRegionClip) { - QVector<QRect> rects = clipData->clipRegion.rects(); - for (int i = 0; i < rects.size(); ++i) { - QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); + for (const QRect &rect : clipData->clipRegion) { + QRect intersectRect = rect.intersected(targetRect.toRect()); if (!intersectRect.isEmpty()) { unlock(); if (alpha) @@ -609,10 +608,8 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) } } else if (clipData->hasRegionClip) { QRect unclippedTargetRect(x, y, blitWidth, blitHeight); - const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects(); - const int intersectedSize = intersectedRects.size(); - for (int i = 0; i < intersectedSize; ++i) { - const QRect &targetRect = intersectedRects.at(i); + const QRegion targetRegion = clipData->clipRegion.intersected(unclippedTargetRect); + for (const QRect &targetRect : targetRegion) { if (!targetRect.isValid() || targetRect.isEmpty()) continue; int tmpSrcX = srcX + (targetRect.x() - x); @@ -686,9 +683,8 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q if (clipData->hasRectClip) { d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity); } else if (clipData->hasRegionClip) { - QVector<QRect>rects = clipData->clipRegion.rects(); - for (int i = 0; i<rects.size(); ++i) - d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity); + for (const QRect &rect : clipData->clipRegion) + d->clipAndDrawPixmap(rect, targetRect, pm, sr, canDrawOpacity); } } else { QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height()); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index bcef14ca61..e70079915a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2835,7 +2835,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) QRect rect = r.boundingRect(); if (qt_show_painter_debug_output) printf("QPainter::setClipRegion(), size=%d, [%d,%d,%d,%d]\n", - r.rects().size(), rect.x(), rect.y(), rect.width(), rect.height()); + r.rectCount(), rect.x(), rect.y(), rect.width(), rect.height()); #endif if (!d->engine) { qWarning("QPainter::setClipRegion: Painter not active"); @@ -6473,6 +6473,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText extended->drawTextItem(QPointF(x, y), ti2); else engine->drawTextItem(QPointF(x, y), ti2); + drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle, + ti2.flags, ti2.width.toReal(), ti2.charFormat); if (!rtl) x += ti2.width.toReal(); @@ -6504,6 +6506,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText extended->drawTextItem(QPointF(x, y), ti2); else engine->drawTextItem(QPointF(x,y), ti2); + drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle, + ti2.flags, ti2.width.toReal(), ti2.charFormat); // reset the high byte for all glyphs const int hi = which << 24; @@ -6515,9 +6519,9 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText extended->drawTextItem(p, ti); else engine->drawTextItem(p, ti); + drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle, + ti.flags, ti.width.toReal(), ti.charFormat); } - drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle, - ti.flags, ti.width.toReal(), ti.charFormat); if (state->renderHints != oldRenderHints) { state->renderHints = oldRenderHints; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ba14a45d4a..7072a2d79c 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1294,10 +1294,9 @@ void QPainterPath::addRegion(const QRegion ®ion) ensureData(); detach(); - QVector<QRect> rects = region.rects(); - d_func()->elements.reserve(rects.size() * 5); - for (int i=0; i<rects.size(); ++i) - addRect(rects.at(i)); + d_func()->elements.reserve(region.rectCount() * 5); + for (const QRect &rect : region) + addRect(rect); } diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 10f0fcc21d..02f9be197f 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1078,9 +1078,8 @@ void QPdfEngine::updateState(const QPaintEngineState &state) } else if (flags & DirtyClipRegion) { d->clipEnabled = true; QPainterPath path; - QVector<QRect> rects = state.clipRegion().rects(); - for (int i = 0; i < rects.size(); ++i) - path.addRect(rects.at(i)); + for (const QRect &rect : state.clipRegion()) + path.addRect(rect); updateClipPath(path, state.clipOperation()); flags |= DirtyClipPath; } else if (flags & DirtyClipEnabled) { diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 6cec4a0a8d..7381f381fe 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -250,9 +250,8 @@ static QRegion deviceRegion(const QRegion ®ion, QWindow *window, const QPoint return region; QVector<QRect> rects; - const QVector<QRect> regionRects = region.rects(); - rects.reserve(regionRects.count()); - for (const QRect &rect : regionRects) + rects.reserve(region.rectCount()); + for (const QRect &rect : region) rects.append(deviceRect(rect.translated(offset), window)); QRegion deviceRegion; @@ -412,7 +411,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i context->swapBuffers(window); } - +#endif /*! Implemented in subclasses to return the content of the backingstore as a QImage. @@ -425,7 +424,7 @@ QImage QPlatformBackingStore::toImage() const { return QImage(); } - +#ifndef QT_NO_OPENGL /*! May be reimplemented in subclasses to return the content of the backingstore as an OpenGL texture. \a dirtyRegion is the part of the diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h index 9b09620cce..52e6f40f44 100644 --- a/src/gui/painting/qplatformbackingstore.h +++ b/src/gui/painting/qplatformbackingstore.h @@ -121,7 +121,9 @@ public: virtual void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, QOpenGLContext *context, bool translucentBackground); +#endif virtual QImage toImage() const; +#ifndef QT_NO_OPENGL enum TextureFlag { TextureSwizzle = 0x01, TextureFlip = 0x02, diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 35c4abb3ac..abdfc7c8c7 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -81,8 +81,8 @@ QT_BEGIN_NAMESPACE contains() a QPoint or QRect. The bounding rectangle can be found with boundingRect(). - The function rects() gives a decomposition of the region into - rectangles. + Iteration over the region (with begin(), end()) gives a decomposition of + the region into rectangles. The same sequence of rectangles is returned by rects(). Example of using complex regions: \snippet code/src_gui_painting_qregion.cpp 0 @@ -395,23 +395,24 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt QDataStream &operator<<(QDataStream &s, const QRegion &r) { - QVector<QRect> a = r.rects(); - if (a.isEmpty()) { + auto b = r.begin(), e = r.end(); + if (b == e) { s << (quint32)0; } else { + const auto size = e - b; if (s.version() == 1) { - int i; - for (i = a.size() - 1; i > 0; --i) { + for (auto i = size - 1; i > 0; --i) { s << (quint32)(12 + i * 24); s << (int)QRGN_OR; } - for (i = 0; i < a.size(); ++i) { - s << (quint32)(4+8) << (int)QRGN_SETRECT << a[i]; - } + for (auto it = b; it != e; ++it) + s << (quint32)(4+8) << (int)QRGN_SETRECT << *it; } else { - s << (quint32)(4 + 4 + 16 * a.size()); // 16: storage size of QRect + s << quint32(4 + 4 + 16 * size); // 16: storage size of QRect s << (qint32)QRGN_RECTS; - s << a; + s << quint32(size); + for (auto it = b; it != e; ++it) + s << *it; } } return s; @@ -722,12 +723,9 @@ bool QRegion::intersects(const QRegion ®ion) const if (rectCount() == 1 && region.rectCount() == 1) return true; - const QVector<QRect> myRects = rects(); - const QVector<QRect> otherRects = region.rects(); - - for (QVector<QRect>::const_iterator i1 = myRects.constBegin(); i1 < myRects.constEnd(); ++i1) - for (QVector<QRect>::const_iterator i2 = otherRects.constBegin(); i2 < otherRects.constEnd(); ++i2) - if (rect_intersects(*i1, *i2)) + for (const QRect &myRect : *this) + for (const QRect &otherRect : region) + if (rect_intersects(myRect, otherRect)) return true; return false; } @@ -928,6 +926,100 @@ QRegion QRegion::intersect(const QRect &r) const */ /*! + \typedef QRegion::const_iterator + \since 5.8 + + An iterator over the QRects that make up the region. + + QRegion does not offer mutable iterators. + + \sa begin(), end() +*/ + +/*! + \typedef QRegion::const_reverse_iterator + \since 5.8 + + A reverse iterator over the QRects that make up the region. + + QRegion does not offer mutable iterators. + + \sa rbegin(), rend() +*/ + +/*! + \fn QRegion::begin() const + \since 5.8 + + Returns a const_iterator pointing to the beginning of the range of + rectangles that make up this range, in the order in which rects() + returns them. + + \sa rbegin(), cbegin(), end() +*/ + +/*! + \fn QRegion::cbegin() const + \since 5.8 + + Same as begin(). +*/ + +/*! + \fn QRegion::end() const + \since 5.8 + + Returns a const_iterator pointing to one past the end of the range of + rectangles that make up this range, in the order in which rects() + returns them. + + \sa rend(), cend(), begin() +*/ + +/*! + \fn QRegion::cend() const + \since 5.8 + + Same as end(). +*/ + +/*! + \fn QRegion::rbegin() const + \since 5.8 + + Returns a const_reverse_iterator pointing to the beginning of the range of + rectangles that make up this range, in the reverse order in which rects() + returns them. + + \sa begin(), crbegin(), rend() +*/ + +/*! + \fn QRegion::crbegin() const + \since 5.8 + + Same as rbegin(). +*/ + +/*! + \fn QRegion::rend() const + \since 5.8 + + Returns a const_reverse_iterator pointing to one past the end of the range of + rectangles that make up this range, in the reverse order in which rects() + returns them. + + \sa end(), crend(), rbegin() +*/ + +/*! + \fn QRegion::crend() const + \since 5.8 + + Same as rend(). +*/ + +/*! \fn void QRegion::setRects(const QRect *rects, int number) Sets the region using the array of rectangles specified by \a rects and @@ -1057,13 +1149,11 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) return result; } - const QVector<QRect> rects = region.rects(); + auto rect = region.begin(); + const auto end = region.end(); QVarLengthArray<Segment> segments; - segments.resize(4 * rects.size()); - - const QRect *rect = rects.constData(); - const QRect *end = rect + rects.size(); + segments.resize(4 * (end - rect)); int lastRowSegmentCount = 0; Segment *lastRowSegments = 0; @@ -1171,6 +1261,12 @@ struct QRegionPrivate { } } + const QRect *begin() const Q_DECL_NOTHROW + { return numRects == 1 ? &extents : rects.data(); } // avoid vectorize() + + const QRect *end() const Q_DECL_NOTHROW + { return begin() + numRects; } + inline void append(const QRect *r); void append(const QRegionPrivate *r); void prepend(const QRect *r); @@ -4192,7 +4288,7 @@ QRegion QRegion::xored(const QRegion &r) const } } -QRect QRegion::boundingRect() const +QRect QRegion::boundingRect() const Q_DECL_NOTHROW { if (isEmpty()) return QRect(); @@ -4248,6 +4344,16 @@ QVector<QRect> QRegion::rects() const } } +QRegion::const_iterator QRegion::begin() const Q_DECL_NOTHROW +{ + return d->qt_rgn ? d->qt_rgn->begin() : nullptr; +} + +QRegion::const_iterator QRegion::end() const Q_DECL_NOTHROW +{ + return d->qt_rgn ? d->qt_rgn->end() : nullptr; +} + void QRegion::setRects(const QRect *rects, int num) { *this = QRegion(); @@ -4280,7 +4386,7 @@ void QRegion::setRects(const QRect *rects, int num) } } -int QRegion::rectCount() const +int QRegion::rectCount() const Q_DECL_NOTHROW { return (d->qt_rgn ? d->qt_rgn->numRects : 0); } @@ -4310,10 +4416,10 @@ bool QRegion::intersects(const QRect &rect) const if (d->qt_rgn->numRects == 1) return true; - const QVector<QRect> myRects = rects(); - for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it) - if (rect_intersects(r, *it)) + for (const QRect &rect : *this) { + if (rect_intersects(r, rect)) return true; + } return false; } diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index d66f80fcde..3bf1a5268c 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -81,6 +81,18 @@ public: bool isEmpty() const; bool isNull() const; + typedef const QRect *const_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + + const_iterator begin() const Q_DECL_NOTHROW; + const_iterator cbegin() const Q_DECL_NOTHROW { return begin(); } + const_iterator end() const Q_DECL_NOTHROW; + const_iterator cend() const Q_DECL_NOTHROW { return end(); } + const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } + const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return rbegin(); } + const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator crend() const Q_DECL_NOTHROW { return rend(); } + bool contains(const QPoint &p) const; bool contains(const QRect &r) const; @@ -108,10 +120,10 @@ public: bool intersects(const QRegion &r) const; bool intersects(const QRect &r) const; - QRect boundingRect() const; + QRect boundingRect() const Q_DECL_NOTHROW; QVector<QRect> rects() const; void setRects(const QRect *rect, int num); - int rectCount() const; + int rectCount() const Q_DECL_NOTHROW; #ifdef Q_COMPILER_MANGLES_RETURN_TYPE // ### Qt 6: remove these, they're kept for MSVC compat const QRegion operator|(const QRegion &r) const; diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index d2c3eceeef..bfc8551a9b 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -247,6 +247,7 @@ void QTextureGlyphCache::fillInPendingGlyphs() resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1)); } + beginFillTexture(); { QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin(); while (iter != m_pendingGlyphs.end()) { @@ -256,6 +257,7 @@ void QTextureGlyphCache::fillInPendingGlyphs() ++iter; } } + endFillTexture(); m_pendingGlyphs.clear(); } diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 14271ccc65..a8efb4abb1 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -117,7 +117,9 @@ public: virtual void resizeTextureData(int width, int height) = 0; virtual int glyphPadding() const { return 0; } + virtual void beginFillTexture() { } virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0; + virtual void endFillTexture() { } inline void createCache(int width, int height) { m_w = width; diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index ff2497817e..2278378613 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -602,9 +602,32 @@ QTextDocument *QAbstractTextDocumentLayout::document() const */ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const { + QTextCharFormat fmt = formatAt(pos).toCharFormat(); + return fmt.anchorHref(); +} + +/*! + \since 5.8 + + Returns the source of the image at the given position \a pos, or an empty + string if no image exists at that point. +*/ +QString QAbstractTextDocumentLayout::imageAt(const QPointF &pos) const +{ + QTextImageFormat fmt = formatAt(pos).toImageFormat(); + return fmt.name(); +} + +/*! + \since 5.8 + + Returns the text format at the given position \a pos. +*/ +QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const +{ int cursorPos = hitTest(pos, Qt::ExactHit); if (cursorPos == -1) - return QString(); + return QTextFormat(); // compensate for preedit in the hit text block QTextBlock block = document()->firstBlock(); @@ -623,8 +646,7 @@ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle(); QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos); - QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format); - return fmt.anchorHref(); + return pieceTable->formatCollection()->format(it->format); } /*! diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 01704fe37b..e2fad12ad3 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -82,7 +82,10 @@ public: virtual void draw(QPainter *painter, const PaintContext &context) = 0; virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0; + QString anchorAt(const QPointF& pos) const; + QString imageAt(const QPointF &pos) const; + QTextFormat formatAt(const QPointF &pos) const; virtual int pageCount() const = 0; virtual QSizeF documentSize() const = 0; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index b9e05e726e..4782ef5e20 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -899,7 +899,7 @@ static QBrush brushFromData(const BrushData& c, const QPalette &pal) } } -static BorderStyle parseStyleValue(QCss::Value v) +static BorderStyle parseStyleValue(const QCss::Value &v) { if (v.type == Value::KnownIdentifier) { switch (v.variant.toInt()) { diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index d90134482d..d4bd975eca 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField"); + namespace { enum FillHDir @@ -734,8 +736,45 @@ static bool imageHasNarrowOutlines(const QImage &im) return minHThick == 1 || minVThick == 1; } +static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54; +static int QT_DISTANCEFIELD_DEFAULT_TILESIZE = 64; +static int QT_DISTANCEFIELD_DEFAULT_SCALE = 16; +static int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80; +static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000; + +static void initialDistanceFieldFactor() +{ + static bool initialized = false; + if (initialized) + return; + initialized = true; + + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE")) { + QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE:" << QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE; + } + + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_TILESIZE")) { + QT_DISTANCEFIELD_DEFAULT_TILESIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_TILESIZE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_TILESIZE:" << QT_DISTANCEFIELD_DEFAULT_TILESIZE; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_SCALE")) { + QT_DISTANCEFIELD_DEFAULT_SCALE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_SCALE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_SCALE:" << QT_DISTANCEFIELD_DEFAULT_SCALE; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_RADIUS")) { + QT_DISTANCEFIELD_DEFAULT_RADIUS = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_RADIUS"); + qDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_RADIUS:" << QT_DISTANCEFIELD_DEFAULT_RADIUS; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT")) { + QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT:" << QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT; + } +} + bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) { + initialDistanceFieldFactor(); QFontEngine *fe = fontEngine->cloneWithSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); if (!fe) return false; @@ -755,6 +794,7 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) bool qt_fontHasNarrowOutlines(const QRawFont &f) { QRawFont font = f; + initialDistanceFieldFactor(); font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); if (!font.isValid()) return false; @@ -767,6 +807,51 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f) QRawFont::PixelAntialiasing)); } +int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2; + else + return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE; +} + +int QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2; + else + return QT_DISTANCEFIELD_DEFAULT_TILESIZE; +} + +int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_SCALE / 2; + else + return QT_DISTANCEFIELD_DEFAULT_SCALE; +} + +int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_RADIUS / 2; + else + return QT_DISTANCEFIELD_DEFAULT_RADIUS; +} + +int QT_DISTANCEFIELD_HIGHGLYPHCOUNT() +{ + initialDistanceFieldFactor(); + return QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT; +} QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other) : QSharedData(other) diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h index 7cd385587b..3076a90b9d 100644 --- a/src/gui/text/qdistancefield_p.h +++ b/src/gui/text/qdistancefield_p.h @@ -54,31 +54,20 @@ #include <qrawfont.h> #include <private/qfontengine_p.h> #include <QtCore/qshareddata.h> +#include <QtCore/qglobal.h> +#include <QLoggingCategory> QT_BEGIN_NAMESPACE -#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54 -#define QT_DISTANCEFIELD_DEFAULT_TILESIZE 64 -#define QT_DISTANCEFIELD_DEFAULT_SCALE 16 -#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80 -#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000 - -#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE) -#define QT_DISTANCEFIELD_TILESIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_TILESIZE) -#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \ - QT_DISTANCEFIELD_DEFAULT_SCALE) -#define QT_DISTANCEFIELD_RADIUS(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_RADIUS / 2 : \ - QT_DISTANCEFIELD_DEFAULT_RADIUS) - bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(const QRawFont &f); bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(QFontEngine *fontEngine); +int Q_GUI_EXPORT QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_HIGHGLYPHCOUNT(); + class Q_GUI_EXPORT QDistanceFieldData : public QSharedData { public: diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index f50f771c07..3a08176044 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -3141,7 +3141,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table) html += QLatin1String("</table>"); } -void QTextHtmlExporter::emitFrame(QTextFrame::Iterator frameIt) +void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt) { if (!frameIt.atEnd()) { QTextFrame::Iterator next = frameIt; diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 93071aaf59..df0d52d8e9 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1077,8 +1077,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) QTextUndoCommand &last = undoStack[undoState - 1]; if ( (last.block_part && c.block_part && !last.block_end) // part of the same block => can merge - || (!c.block_part && !last.block_part)) { // two single undo items => can merge - + || (!c.block_part && !last.block_part) // two single undo items => can merge + || (c.command == QTextUndoCommand::Inserted && last.command == c.command && (last.block_part && !c.block_part))) { + // two sequential inserts that are not part of the same block => can merge if (last.tryMerge(c)) return; } diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 34849df0bb..caa63e15d2 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -378,7 +378,7 @@ private: enum StyleMode { EmitStyleTag, OmitStyleTag }; enum FrameType { TextFrame, TableFrame, RootFrame }; - void emitFrame(QTextFrame::Iterator frameIt); + void emitFrame(const QTextFrame::Iterator &frameIt); void emitTextFrame(const QTextFrame *frame); void emitBlock(const QTextBlock &block); void emitTable(const QTextTable *table); diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 9863955a55..1b2113d281 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -295,7 +295,7 @@ static inline bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextB ; } -static inline bool isEmptyBlockBeforeTable(QTextFrame::Iterator it) +static inline bool isEmptyBlockBeforeTable(const QTextFrame::Iterator &it) { QTextFrame::Iterator next = it; ++next; if (it.currentFrame()) @@ -419,7 +419,7 @@ static bool operator<(int pos, const QCheckPoint &checkPoint) #endif -static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect = QRectF()) +static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, const QRectF &gradientRect = QRectF()) { p->save(); if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) { @@ -1504,7 +1504,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p painter->restore(); } -static QFixed flowPosition(const QTextFrame::iterator it) +static QFixed flowPosition(const QTextFrame::iterator &it) { if (it.atEnd()) return 0; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 7864975091..e65ec15caa 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -843,7 +843,7 @@ enum JustificationClass { Adds an inter character justification opportunity after the number or letter character and a space justification opportunity after the space character. */ -static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, QGlyphLayout g, ushort *log_clusters, int spaceAs) +static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs) { int str_pos = 0; while (str_pos < length) { @@ -877,7 +877,7 @@ static inline void qt_getDefaultJustificationOpportunities(const ushort *string, } } -static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, QGlyphLayout g, ushort *log_clusters) +static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters) { Q_ASSERT(length > 0 && g.numGlyphs > 0); @@ -3512,7 +3512,7 @@ QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, } -QTransform qt_true_matrix(qreal w, qreal h, QTransform x) +QTransform qt_true_matrix(qreal w, qreal h, const QTransform &x) { QRectF rect = x.mapRect(QRectF(0, 0, w, h)); return x * QTransform::fromTranslate(-rect.x(), -rect.y()); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3b1ee8ec03..f5827bb683 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -975,7 +975,7 @@ void QTextLayout::setFlags(int flags) } static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPointF &pos, QTextLayout::FormatRange *selection, - QPainterPath *region, QRectF boundingRect) + QPainterPath *region, const QRectF &boundingRect) { const QScriptLine &line = eng->lines[lineNumber]; @@ -1326,7 +1326,11 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); + QPainter::CompositionMode origCompositionMode = p->compositionMode(); + if (p->paintEngine()->hasFeature(QPaintEngine::RasterOpModes)) + p->setCompositionMode(QPainter::RasterOp_NotDestination); p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush()); + p->setCompositionMode(origCompositionMode); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); if (d->layoutData->hasBidi) { diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 42c7c80f3b..17897ca869 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -37,7 +37,8 @@ HEADERS += \ access/qnetworkdiskcache.h \ access/qhttpthreaddelegate_p.h \ access/qhttpmultipart.h \ - access/qhttpmultipart_p.h + access/qhttpmultipart_p.h \ + access/qnetworkfile_p.h SOURCES += \ access/qftp.cpp \ @@ -68,7 +69,8 @@ SOURCES += \ access/qabstractnetworkcache.cpp \ access/qnetworkdiskcache.cpp \ access/qhttpthreaddelegate.cpp \ - access/qhttpmultipart.cpp + access/qhttpmultipart.cpp \ + access/qnetworkfile.cpp mac: LIBS_PRIVATE += -framework Security diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 3601c36bc2..24ada3a81f 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -484,8 +484,7 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) } // is this a valid reply? - if (fragment.length() >= 5 && !fragment.startsWith("HTTP/")) - { + if (fragment.length() == 5 && !fragment.startsWith("HTTP/")) { fragment.clear(); return -1; } @@ -739,6 +738,8 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuff #ifndef QT_NO_COMPRESS int QHttpNetworkReplyPrivate::initializeInflateStream() { + Q_ASSERT(inflateStrm); + inflateStrm->zalloc = Z_NULL; inflateStrm->zfree = Z_NULL; inflateStrm->opaque = Z_NULL; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index d2b1a8a912..ed586c1de5 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1523,27 +1523,35 @@ void QNetworkAccessManagerPrivate::clearCache(QNetworkAccessManager *manager) manager->d_func()->objectCache.clear(); manager->d_func()->authenticationManager->clearCache(); - if (manager->d_func()->httpThread) { - manager->d_func()->httpThread->quit(); - manager->d_func()->httpThread->wait(5000); - if (manager->d_func()->httpThread->isFinished()) - delete manager->d_func()->httpThread; - else - QObject::connect(manager->d_func()->httpThread, SIGNAL(finished()), manager->d_func()->httpThread, SLOT(deleteLater())); - manager->d_func()->httpThread = 0; - } + manager->d_func()->destroyThread(); } QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { - if (httpThread) { - httpThread->quit(); - httpThread->wait(5000); - if (httpThread->isFinished()) - delete httpThread; + destroyThread(); +} + +QThread * QNetworkAccessManagerPrivate::createThread() +{ + if (!thread) { + thread = new QThread; + thread->setObjectName(QStringLiteral("QNetworkAccessManager thread")); + thread->start(); + } + Q_ASSERT(thread); + return thread; +} + +void QNetworkAccessManagerPrivate::destroyThread() +{ + if (thread) { + thread->quit(); + thread->wait(5000); + if (thread->isFinished()) + delete thread; else - QObject::connect(httpThread, SIGNAL(finished()), httpThread, SLOT(deleteLater())); - httpThread = 0; + QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); + thread = 0; } } diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 4efa30df49..9d02fd7c34 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -172,6 +172,7 @@ private: friend class QNetworkReplyImplPrivate; friend class QNetworkReplyHttpImpl; friend class QNetworkReplyHttpImplPrivate; + friend class QNetworkReplyFileImpl; Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 413de2a4fe..48270f0c17 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -74,7 +74,7 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate public: QNetworkAccessManagerPrivate() : networkCache(0), cookieJar(0), - httpThread(0), + thread(0), #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif @@ -107,6 +107,9 @@ public: } ~QNetworkAccessManagerPrivate(); + QThread * createThread(); + void destroyThread(); + void _q_replyFinished(); void _q_replyEncrypted(); void _q_replySslErrors(const QList<QSslError> &errors); @@ -158,7 +161,7 @@ public: QNetworkCookieJar *cookieJar; - QThread *httpThread; + QThread *thread; #ifndef QT_NO_NETWORKPROXY diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 99e67cb463..68c962636e 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -421,7 +421,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) // ### verify that QFile uses the fd size and not the file name qint64 size = file->size() - file->pos(); const uchar *p = 0; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_INTEGRITY) +#if !defined(Q_OS_INTEGRITY) p = file->map(file->pos(), size); #endif if (p) { diff --git a/config.tests/unix/shivavg/shivavg.cpp b/src/network/access/qnetworkfile.cpp index 33fb7d226d..374dd26e2e 100644 --- a/config.tests/unix/shivavg/shivavg.cpp +++ b/src/network/access/qnetworkfile.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the config.tests of the Qt Toolkit. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -37,13 +37,56 @@ ** ****************************************************************************/ -#include <vg/openvg.h> +#include "qnetworkfile_p.h" -int main(int, char **) +#include <QtCore/QDebug> +#include <QNetworkReply> +#include <QtCore/QDateTime> +#include <QtCore/QFileInfo> +#include <QtCore/QMetaObject> +#include <QtCore/QCoreApplication> + +QT_BEGIN_NAMESPACE + +QNetworkFile::QNetworkFile() + : QFile() +{ +} + +QNetworkFile::QNetworkFile(const QString &name) + : QFile(name) +{ +} + +void QNetworkFile::open() +{ + bool opened = false; + QFileInfo fi(fileName()); + if (fi.isDir()) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", + "Cannot open %1: Path is a directory").arg(fileName()); + error(QNetworkReply::ContentOperationNotPermittedError, msg); + } else { + headerRead(QNetworkRequest::LastModifiedHeader, QVariant::fromValue(fi.lastModified())); + headerRead(QNetworkRequest::ContentLengthHeader, QVariant::fromValue(fi.size())); + opened = QFile::open(QIODevice::ReadOnly | QIODevice::Unbuffered); + if (!opened) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", + "Error opening %1: %2").arg(fileName(), errorString()); + if (exists()) + error(QNetworkReply::ContentAccessDenied, msg); + else + error(QNetworkReply::ContentNotFoundError, msg); + } + } + finished(opened); +} + +void QNetworkFile::close() { - VGint i; - i = 2; - vgFlush(); - vgDestroyContextSH(); - return 0; + // This override is needed because 'using' keyword cannot be used for slots. And the base + // function is not an invokable/slot function. + QFile::close(); } + +QT_END_NAMESPACE diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/network/access/qnetworkfile_p.h index f2c620a966..7794c0f18a 100644 --- a/src/widgets/kernel/qwidgetsfunctions_wince.h +++ b/src/network/access/qnetworkfile_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtWidgets module of the Qt Toolkit. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -36,25 +36,44 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QWIDGETSFUNCTIONS_WCE_H -#define QWIDGETSFUNCTIONS_WCE_H -#include <QtCore/qglobal.h> +#ifndef QNETWORKFILE_H +#define QNETWORKFILE_H -#ifdef Q_OS_WINCE -#include <QtCore/qfunctions_wince.h> +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the Network Access API. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include <QFile> +#include <qnetworkreply.h> -#ifdef QT_BUILD_GUI_LIB QT_BEGIN_NAMESPACE -QT_END_NAMESPACE -#endif +class QNetworkFile : public QFile +{ + Q_OBJECT +public: + QNetworkFile(); + QNetworkFile(const QString &name); + using QFile::open; + +public Q_SLOTS: + void open(); + void close() Q_DECL_OVERRIDE; -//WinCe 7 has shell support -#ifndef ShellExecute -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd); -#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f) -#endif +Q_SIGNALS: + void finished(bool ok); + void headerRead(QNetworkRequest::KnownHeaders header, const QVariant &value); + void error(QNetworkReply::NetworkError error, const QString &message); +}; + +QT_END_NAMESPACE -#endif // Q_OS_WINCE -#endif // QWIDGETSFUNCTIONS_WCE_H +#endif // QNETWORKFILE_H diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp index 36bc4b41df..ef319ebf0d 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp @@ -40,31 +40,45 @@ #include "qnetworkreplyfileimpl_p.h" #include "QtCore/qdatetime.h" +#include "qnetworkaccessmanager_p.h" #include <QtCore/QCoreApplication> #include <QtCore/QFileInfo> +#include <QtCore/QThread> +#include "qnetworkfile_p.h" +#include "qnetworkrequest.h" QT_BEGIN_NAMESPACE QNetworkReplyFileImplPrivate::QNetworkReplyFileImplPrivate() - : QNetworkReplyPrivate(), realFileSize(0) + : QNetworkReplyPrivate(), managerPrivate(0), realFile(0) { + qRegisterMetaType<QNetworkRequest::KnownHeaders>(); + qRegisterMetaType<QNetworkReply::NetworkError>(); } QNetworkReplyFileImpl::~QNetworkReplyFileImpl() { + QNetworkReplyFileImplPrivate *d = (QNetworkReplyFileImplPrivate*) d_func(); + if (d->realFile) { + if (d->realFile->thread() == QThread::currentThread()) + delete d->realFile; + else + QMetaObject::invokeMethod(d->realFile, "deleteLater", Qt::QueuedConnection); + } } -QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op) - : QNetworkReply(*new QNetworkReplyFileImplPrivate(), parent) +QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op) + : QNetworkReply(*new QNetworkReplyFileImplPrivate(), manager) { setRequest(req); setUrl(req.url()); setOperation(op); - setFinished(true); QNetworkReply::open(QIODevice::ReadOnly); QNetworkReplyFileImplPrivate *d = (QNetworkReplyFileImplPrivate*) d_func(); + d->managerPrivate = manager->d_func(); + QUrl url = req.url(); if (url.host() == QLatin1String("localhost")) url.setHost(QString()); @@ -77,7 +91,7 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ setError(QNetworkReply::ProtocolInvalidOperationError, msg); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProtocolInvalidOperationError)); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + fileOpenFinished(false); return; } #endif @@ -85,7 +99,6 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ url.setPath(QLatin1String("/")); setUrl(url); - QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { const QString scheme = url.scheme(); @@ -101,68 +114,85 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ } } - QFileInfo fi(fileName); - if (fi.isDir()) { - QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); - setError(QNetworkReply::ContentOperationNotPermittedError, msg); - QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError)); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); - return; - } - - d->realFile.setFileName(fileName); - bool opened = d->realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered); - - // could we open the file? - if (!opened) { - QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") - .arg(d->realFile.fileName(), d->realFile.errorString()); - - if (d->realFile.exists()) { - setError(QNetworkReply::ContentAccessDenied, msg); - QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); - } else { - setError(QNetworkReply::ContentNotFoundError, msg); + if (req.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()) { // Asynchronous open + auto realFile = new QNetworkFile(fileName); + connect(realFile, &QNetworkFile::headerRead, this, &QNetworkReplyFileImpl::setHeader, + Qt::QueuedConnection); + connect(realFile, &QNetworkFile::error, this, &QNetworkReplyFileImpl::setError, + Qt::QueuedConnection); + connect(realFile, SIGNAL(finished(bool)), SLOT(fileOpenFinished(bool)), + Qt::QueuedConnection); + + realFile->moveToThread(d->managerPrivate->createThread()); + QMetaObject::invokeMethod(realFile, "open", Qt::QueuedConnection); + + d->realFile = realFile; + } else { // Synch open + setFinished(true); + + QFileInfo fi(fileName); + if (fi.isDir()) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); + setError(QNetworkReply::ContentOperationNotPermittedError, msg); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError)); + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + return; + } + d->realFile = new QFile(fileName, this); + bool opened = d->realFile->open(QIODevice::ReadOnly | QIODevice::Unbuffered); + + // could we open the file? + if (!opened) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") + .arg(d->realFile->fileName(), d->realFile->errorString()); + + if (fi.exists()) { + setError(QNetworkReply::ContentAccessDenied, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); + } else { + setError(QNetworkReply::ContentNotFoundError, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError)); + } + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + return; } + setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); + setHeader(QNetworkRequest::ContentLengthHeader, fi.size()); + + QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, + Q_ARG(qint64, fi.size()), Q_ARG(qint64, fi.size())); + QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); - return; } - - setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); - d->realFileSize = fi.size(); - setHeader(QNetworkRequest::ContentLengthHeader, d->realFileSize); - - QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, - Q_ARG(qint64, d->realFileSize), Q_ARG(qint64, d->realFileSize)); - QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); } void QNetworkReplyFileImpl::close() { Q_D(QNetworkReplyFileImpl); QNetworkReply::close(); - d->realFile.close(); + if (d->realFile) { + if (d->realFile->thread() == thread()) + d->realFile->close(); + else + QMetaObject::invokeMethod(d->realFile, "close", Qt::QueuedConnection); + } } void QNetworkReplyFileImpl::abort() { - Q_D(QNetworkReplyFileImpl); - QNetworkReply::close(); - d->realFile.close(); + close(); } qint64 QNetworkReplyFileImpl::bytesAvailable() const { Q_D(const QNetworkReplyFileImpl); - if (!d->realFile.isOpen()) + if (!d->isFinished || !d->realFile || !d->realFile->isOpen()) return QNetworkReply::bytesAvailable(); - return QNetworkReply::bytesAvailable() + d->realFile.bytesAvailable(); + return QNetworkReply::bytesAvailable() + d->realFile->bytesAvailable(); } bool QNetworkReplyFileImpl::isSequential () const @@ -172,8 +202,9 @@ bool QNetworkReplyFileImpl::isSequential () const qint64 QNetworkReplyFileImpl::size() const { - Q_D(const QNetworkReplyFileImpl); - return d->realFileSize; + bool ok; + int size = header(QNetworkRequest::ContentLengthHeader).toInt(&ok); + return ok ? size : 0; } /*! @@ -182,11 +213,11 @@ qint64 QNetworkReplyFileImpl::size() const qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen) { Q_D(QNetworkReplyFileImpl); - if (!d->realFile.isOpen()) + if (!d->isFinished || !d->realFile || !d->realFile->isOpen()) return -1; - qint64 ret = d->realFile.read(data, maxlen); - if (bytesAvailable() == 0 && d->realFile.isOpen()) - d->realFile.close(); + qint64 ret = d->realFile->read(data, maxlen); + if (bytesAvailable() == 0) + d->realFile->close(); if (ret == 0 && bytesAvailable() == 0) return -1; else { @@ -196,6 +227,17 @@ qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen) } } +void QNetworkReplyFileImpl::fileOpenFinished(bool isOpen) +{ + setFinished(true); + if (isOpen) { + const auto fileSize = size(); + Q_EMIT metaDataChanged(); + Q_EMIT downloadProgress(fileSize, fileSize); + Q_EMIT readyRead(); + } + Q_EMIT finished(); +} QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h index bac00881a8..1f1be40bc8 100644 --- a/src/network/access/qnetworkreplyfileimpl_p.h +++ b/src/network/access/qnetworkreplyfileimpl_p.h @@ -59,13 +59,12 @@ QT_BEGIN_NAMESPACE - class QNetworkReplyFileImplPrivate; class QNetworkReplyFileImpl: public QNetworkReply { Q_OBJECT public: - QNetworkReplyFileImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); + QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); ~QNetworkReplyFileImpl(); virtual void abort() Q_DECL_OVERRIDE; @@ -77,6 +76,9 @@ public: virtual qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; +private Q_SLOTS: + void fileOpenFinished(bool isOpen); + Q_DECLARE_PRIVATE(QNetworkReplyFileImpl) }; @@ -85,12 +87,14 @@ class QNetworkReplyFileImplPrivate: public QNetworkReplyPrivate public: QNetworkReplyFileImplPrivate(); - QFile realFile; - qint64 realFileSize; + QNetworkAccessManagerPrivate *managerPrivate; + QPointer<QFile> realFile; Q_DECLARE_PUBLIC(QNetworkReplyFileImpl) }; QT_END_NAMESPACE +Q_DECLARE_METATYPE(QNetworkRequest::KnownHeaders) + #endif // QNETWORKREPLYFILEIMPL_H diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index e1323527f6..6b77ab303f 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -617,17 +617,10 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq thread->setObjectName(QStringLiteral("Qt HTTP synchronous thread")); QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); thread->start(); - } else if (!managerPrivate->httpThread) { + } else { // We use the manager-global thread. // At some point we could switch to having multiple threads if it makes sense. - managerPrivate->httpThread = new QThread(); - managerPrivate->httpThread->setObjectName(QStringLiteral("Qt HTTP thread")); - managerPrivate->httpThread->start(); - - thread = managerPrivate->httpThread; - } else { - // Asynchronous request, thread already exists - thread = managerPrivate->httpThread; + thread = managerPrivate->createThread(); } QUrl url = newHttpRequest.url(); @@ -1137,8 +1130,8 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt cookedHeaders.clear(); - if (managerPrivate->httpThread) - managerPrivate->httpThread->disconnect(); + if (managerPrivate->thread) + managerPrivate->thread->disconnect(); // Recurse QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection, diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 1a6dd04ecb..4641516549 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -458,7 +458,7 @@ bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray break; } default: { - qWarning() << "got unexpected zlib return value:" << zlibRet; + qWarning("got unexpected zlib return value: %d", zlibRet); return false; } } @@ -849,7 +849,7 @@ void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders) // break; } default: - qWarning() << "cannot handle frame of type" << type; + qWarning("cannot handle frame of type %d", int(type)); } } @@ -1085,7 +1085,7 @@ void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const break; } default: - qWarning() << "found unknown settings value" << value; + qWarning("found unknown settings value %u", uint(value)); } } } @@ -1124,7 +1124,7 @@ void QSpdyProtocolHandler::handleGOAWAY(char /*flags*/, quint32 /*length*/, break; } default: - qWarning() << "unexpected status code" << statusCode; + qWarning("unexpected status code %d", int(statusCode)); errorCode = QNetworkReply::ProtocolUnknownError; } diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 78753a7393..10c0dccb9e 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -1453,15 +1453,9 @@ static bool q_NTLM_SSPI_library_load() if (pSecurityFunctionTable == NULL) { securityDLLHandle = LoadLibrary(L"secur32.dll"); if (securityDLLHandle != NULL) { -#if defined(Q_OS_WINCE) - INIT_SECURITY_INTERFACE pInitSecurityInterface = - (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle, - L"InitSecurityInterfaceW"); -#else INIT_SECURITY_INTERFACE pInitSecurityInterface = (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle, "InitSecurityInterfaceW"); -#endif if (pInitSecurityInterface != NULL) pSecurityFunctionTable = pInitSecurityInterface(); } diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 0dbe1112cd..757a6ad0b0 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE // sockaddr_in6 size changed between old and new SDK // Only the new version is the correct one, so always // use this structure. -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) # if !defined(u_char) # define u_char unsigned char # endif @@ -152,20 +152,37 @@ void QHostAddressPrivate::setAddress(quint32 a_) /// parses v4-mapped addresses or the AnyIPv6 address and stores in \a a; /// returns true if the address was one of those -static bool convertToIpv4(quint32& a, const Q_IPV6ADDR &a6) +static bool convertToIpv4(quint32& a, const Q_IPV6ADDR &a6, const QHostAddress::ConversionMode mode) { + if (mode == QHostAddress::StrictConversion) + return false; + const uchar *ptr = a6.c; if (qFromUnaligned<quint64>(ptr) != 0) return false; - if (qFromBigEndian<quint32>(ptr + 8) == 0) { - // is it AnyIPv6? - a = 0; - return qFromBigEndian<quint32>(ptr + 12) == 0; + + const quint32 mid = qFromBigEndian<quint32>(ptr + 8); + if ((mid == 0xffff) && (mode & QHostAddress::ConvertV4MappedToIPv4)) { + a = qFromBigEndian<quint32>(ptr + 12); + return true; } - if (qFromBigEndian<quint32>(ptr + 8) != 0xFFFF) + if (mid != 0) return false; - a = qFromBigEndian<quint32>(ptr + 12); - return true; + + const quint32 low = qFromBigEndian<quint32>(ptr + 12); + if ((low == 0) && (mode & QHostAddress::ConvertUnspecifiedAddress)) { + a = 0; + return true; + } + if ((low == 1) && (mode & QHostAddress::ConvertLocalHost)) { + a = INADDR_LOOPBACK; + return true; + } + if ((low != 1) && (mode & QHostAddress::ConvertV4CompatToIPv4)) { + a = low; + return true; + } + return false; } void QHostAddressPrivate::setAddress(const quint8 *a_) @@ -174,7 +191,8 @@ void QHostAddressPrivate::setAddress(const quint8 *a_) isParsed = true; memcpy(a6.c, a_, sizeof(a6)); a = 0; - convertToIpv4(a, a6); + convertToIpv4(a, a6, (QHostAddress::ConvertV4MappedToIPv4 + | QHostAddress::ConvertUnspecifiedAddress)); } void QHostAddressPrivate::setAddress(const Q_IPV6ADDR &a_) @@ -386,6 +404,20 @@ void QNetmaskAddress::setPrefixLength(QAbstractSocket::NetworkLayerProtocol prot \value Any The dual stack any-address. A socket bound with this address will listen on both IPv4 and IPv6 interfaces. */ +/*! \enum QHostAddress::ConversionModeFlag + + \since 5.8 + + \value StrictConversion Don't convert IPv6 addresses to IPv4 when comparing two QHostAddress objects of different protocols, so they will always be considered different. + \value ConvertV4MappedToIPv4 Convert IPv4-mapped IPv6 addresses (RFC 4291 sect. 2.5.5.2) when comparing. Therefore QHostAddress("::ffff:192.168.1.1") will compare equal to QHostAddress("192.168.1.1"). + \value ConvertV4CompatToIPv4 Convert IPv4-compatible IPv6 addresses (RFC 4291 sect. 2.5.5.1) when comparing. Therefore QHostAddress("::192.168.1.1") will compare equal to QHostAddress("192.168.1.1"). + \value ConvertLocalHost Convert the IPv6 loopback addresses to its IPv4 equivalent when comparing. Therefore e.g. QHostAddress("::1") will compare equal to QHostAddress("127.0.0.1"). + \value ConvertUnspecifiedAddress All unspecified addresses will compare equal, namely AnyIPv4, AnyIPv6 and Any. + \value TolerantConversion Sets all three preceding flags. + + \sa isEqual() + */ + /*! Constructs a null host address object, i.e. an address which is not valid for any host or interface. \sa clear() @@ -691,7 +723,9 @@ quint32 QHostAddress::toIPv4Address(bool *ok) const quint32 dummy; if (ok) *ok = d->protocol == QAbstractSocket::IPv4Protocol || d->protocol == QAbstractSocket::AnyIPProtocol - || (d->protocol == QAbstractSocket::IPv6Protocol && convertToIpv4(dummy, d->a6)); + || (d->protocol == QAbstractSocket::IPv6Protocol + && convertToIpv4(dummy, d->a6, ConversionMode(QHostAddress::ConvertV4MappedToIPv4 + | QHostAddress::ConvertUnspecifiedAddress))); return d->a; } @@ -813,19 +847,73 @@ void QHostAddress::setScopeId(const QString &id) /*! Returns \c true if this host address is the same as the \a other address - given; otherwise returns \c false. + given; otherwise returns \c false. This operator just calls isEqual(other, StrictConversion). + + \sa isEqual() */ bool QHostAddress::operator==(const QHostAddress &other) const { + return isEqual(other, StrictConversion); +} + +/*! + \since 5.8 + + Returns \c true if this host address is the same as the \a other address + given; otherwise returns \c false. + + The parameter \a mode controls which conversions are preformed between addresses + of differing protocols. If no \a mode is given, \c TolerantConversion is performed + by default. + + \sa ConversionMode, operator==() + */ +bool QHostAddress::isEqual(const QHostAddress &other, ConversionMode mode) const +{ QT_ENSURE_PARSED(this); QT_ENSURE_PARSED(&other); - if (d->protocol == QAbstractSocket::IPv4Protocol) - return other.d->protocol == QAbstractSocket::IPv4Protocol && d->a == other.d->a; + if (d->protocol == QAbstractSocket::IPv4Protocol) { + switch (other.d->protocol) { + case QAbstractSocket::IPv4Protocol: + return d->a == other.d->a; + case QAbstractSocket::IPv6Protocol: + quint32 a4; + return convertToIpv4(a4, other.d->a6, mode) && (a4 == d->a); + case QAbstractSocket::AnyIPProtocol: + return (mode & QHostAddress::ConvertUnspecifiedAddress) && d->a == 0; + case QAbstractSocket::UnknownNetworkLayerProtocol: + return false; + } + } + if (d->protocol == QAbstractSocket::IPv6Protocol) { - return other.d->protocol == QAbstractSocket::IPv6Protocol - && memcmp(&d->a6, &other.d->a6, sizeof(Q_IPV6ADDR)) == 0; + switch (other.d->protocol) { + case QAbstractSocket::IPv4Protocol: + quint32 a4; + return convertToIpv4(a4, d->a6, mode) && (a4 == other.d->a); + case QAbstractSocket::IPv6Protocol: + return memcmp(&d->a6, &other.d->a6, sizeof(Q_IPV6ADDR)) == 0; + case QAbstractSocket::AnyIPProtocol: + return (mode & QHostAddress::ConvertUnspecifiedAddress) + && (other.d->a6_64.c[0] == 0) && (other.d->a6_64.c[1] == 0); + case QAbstractSocket::UnknownNetworkLayerProtocol: + return false; + } + } + + if ((d->protocol == QAbstractSocket::AnyIPProtocol) + && (mode & QHostAddress::ConvertUnspecifiedAddress)) { + switch (other.d->protocol) { + case QAbstractSocket::IPv4Protocol: + return other.d->a == 0; + case QAbstractSocket::IPv6Protocol: + return (other.d->a6_64.c[0] == 0) && (other.d->a6_64.c[1] == 0); + default: + break; + } } + return d->protocol == other.d->protocol; } diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h index 8236a71986..8cf6876511 100644 --- a/src/network/kernel/qhostaddress.h +++ b/src/network/kernel/qhostaddress.h @@ -79,6 +79,16 @@ public: AnyIPv6, AnyIPv4 }; + enum ConversionModeFlag { + ConvertV4MappedToIPv4 = 1, + ConvertV4CompatToIPv4 = 2, + ConvertUnspecifiedAddress = 4, + ConvertLocalHost = 8, + TolerantConversion = 0xff, + + StrictConversion = 0 + }; + Q_DECLARE_FLAGS(ConversionMode, ConversionModeFlag) QHostAddress(); explicit QHostAddress(quint32 ip4Addr); @@ -118,6 +128,7 @@ public: QString scopeId() const; void setScopeId(const QString &id); + bool isEqual(const QHostAddress &address, ConversionMode mode = TolerantConversion) const; bool operator ==(const QHostAddress &address) const; bool operator ==(SpecialAddress address) const; inline bool operator !=(const QHostAddress &address) const @@ -139,6 +150,7 @@ public: protected: QScopedPointer<QHostAddressPrivate> d; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QHostAddress::ConversionMode) Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QHostAddress) inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddress &address2) diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index cc6102a713..1d34ae8277 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -82,11 +82,7 @@ static void resolveLibrary() { // Attempt to resolve getaddrinfo(); without it we'll have to fall // back to gethostbyname(), which has no IPv6 support. -#if defined(Q_OS_WINCE) - local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo"); - local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo"); - local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo"); -#elif defined (Q_OS_WINRT) +#if defined (Q_OS_WINRT) local_getaddrinfo = (getaddrinfoProto) &getaddrinfo; local_freeaddrinfo = (freeaddrinfoProto) &freeaddrinfo; local_getnameinfo = (getnameinfoProto) getnameinfo; @@ -115,11 +111,6 @@ static void translateWSAError(int error, QHostInfo *results) QHostInfo QHostInfoAgent::fromName(const QString &hostName) { -#if defined(Q_OS_WINCE) - static QBasicMutex qPrivCEMutex; - QMutexLocker locker(&qPrivCEMutex); -#endif - QSysInfo::machineHostName(); // this initializes ws2_32.dll // Load res_init on demand. diff --git a/src/network/kernel/qnetworkfunctions_wince.h b/src/network/kernel/qnetworkfunctions_wince.h deleted file mode 100644 index 0e464a47f3..0000000000 --- a/src/network/kernel/qnetworkfunctions_wince.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKFUNCTIONS_WINCE_H -#define QNETWORKFUNCTIONS_WINCE_H - -#if 0 -#pragma qt_sync_stop_processing -#endif - -#ifdef Q_OS_WINCE - -#include <qt_windows.h> - -QT_BEGIN_NAMESPACE - -DECLARE_HANDLE(SC_HANDLE); -typedef enum _SC_ENUM_TYPE { - SC_ENUM_PROCESS_INFO = 0 -} SC_ENUM_TYPE; -#define SC_MANAGER_CONNECT 0x0001 -#define SC_MANAGER_CREATE_SERVICE 0x0002 -#define SC_MANAGER_ENUMERATE_SERVICE 0x0004 -#define SERVICE_ACTIVE 0x00000001 -#define SERVICE_INACTIVE 0x00000002 -#define SERVICE_STATE_ALL (SERVICE_ACTIVE | \ - SERVICE_INACTIVE) -typedef struct _SERVICE_STATUS_PROCESS { - DWORD dwServiceType; - DWORD dwCurrentState; - DWORD dwControlsAccepted; - DWORD dwWin32ExitCode; - DWORD dwServiceSpecificExitCode; - DWORD dwCheckPoint; - DWORD dwWaitHint; - DWORD dwProcessId; - DWORD dwServiceFlags; -} SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS; -typedef struct _ENUM_SERVICE_STATUS_PROCESSA { - LPSTR lpServiceName; - LPSTR lpDisplayName; - SERVICE_STATUS_PROCESS ServiceStatusProcess; -} ENUM_SERVICE_STATUS_PROCESSA, *LPENUM_SERVICE_STATUS_PROCESSA; -typedef struct _ENUM_SERVICE_STATUS_PROCESSW { - LPWSTR lpServiceName; - LPWSTR lpDisplayName; - SERVICE_STATUS_PROCESS ServiceStatusProcess; -} ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW; -#ifdef UNICODE -typedef ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESS; -typedef LPENUM_SERVICE_STATUS_PROCESSW LPENUM_SERVICE_STATUS_PROCESS; -#else -typedef ENUM_SERVICE_STATUS_PROCESSA ENUM_SERVICE_STATUS_PROCESS; -typedef LPENUM_SERVICE_STATUS_PROCESSA LPENUM_SERVICE_STATUS_PROCESS; -#endif // UNICODE - -QT_END_NAMESPACE - -#endif // Q_OS_WINCE -#endif // QNETWORKFUNCTIONS_WINCE_H diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index 0a82eac417..3002b2497b 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -81,19 +81,11 @@ static void resolveLibs() HINSTANCE iphlpapiHnd = GetModuleHandle(L"iphlpapi"); Q_ASSERT(iphlpapiHnd); -#if defined(Q_OS_WINCE) - // since Windows Embedded Compact 7 - ptrConvertInterfaceIndexToLuid = (PtrConvertInterfaceIndexToLuid)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceIndexToLuid"); - ptrConvertInterfaceLuidToName = (PtrConvertInterfaceLuidToName)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceLuidToNameW"); - ptrConvertInterfaceLuidToIndex = (PtrConvertInterfaceLuidToIndex)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceLuidToIndex"); - ptrConvertInterfaceNameToLuid = (PtrConvertInterfaceNameToLuid)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceNameToLuidW"); -#else // since Windows Vista ptrConvertInterfaceIndexToLuid = (PtrConvertInterfaceIndexToLuid)GetProcAddress(iphlpapiHnd, "ConvertInterfaceIndexToLuid"); ptrConvertInterfaceLuidToName = (PtrConvertInterfaceLuidToName)GetProcAddress(iphlpapiHnd, "ConvertInterfaceLuidToNameW"); ptrConvertInterfaceLuidToIndex = (PtrConvertInterfaceLuidToIndex)GetProcAddress(iphlpapiHnd, "ConvertInterfaceLuidToIndex"); ptrConvertInterfaceNameToLuid = (PtrConvertInterfaceNameToLuid)GetProcAddress(iphlpapiHnd, "ConvertInterfaceNameToLuidW"); -#endif done = true; } } diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index fe9f088062..a37585b5cd 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -53,7 +53,6 @@ #include <qt_windows.h> #include <wininet.h> #include <lmcons.h> -#include "qnetworkfunctions_wince.h" /* * Information on the WinHTTP DLL: @@ -123,7 +122,6 @@ static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCur static PtrWinHttpCloseHandle ptrWinHttpCloseHandle = 0; -#ifndef Q_OS_WINCE static bool currentProcessIsService() { typedef BOOL (WINAPI *PtrGetUserName)(LPTSTR lpBuffer, LPDWORD lpnSize); @@ -153,7 +151,6 @@ static bool currentProcessIsService() } return false; } -#endif // ! Q_OS_WINCE static QStringList splitSpaceSemicolon(const QString &source) { @@ -359,7 +356,7 @@ static QList<QNetworkProxy> parseServerList(const QNetworkProxyQuery &query, con return removeDuplicateProxies(result); } -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) namespace { class QRegistryWatcher { public: @@ -410,7 +407,7 @@ private: QVector<HKEY> m_registryHandles; }; } // namespace -#endif // !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#endif // !defined(Q_OS_WINRT) class QWindowsSystemProxy { @@ -429,7 +426,7 @@ public: QStringList proxyServerList; QStringList proxyBypass; QList<QNetworkProxy> defaultResult; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QRegistryWatcher proxySettingsWatcher; #endif bool initialized; @@ -465,7 +462,7 @@ void QWindowsSystemProxy::reset() void QWindowsSystemProxy::init() { bool proxySettingsChanged = false; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) proxySettingsChanged = proxySettingsWatcher.hasChanged(); #endif @@ -475,12 +472,7 @@ void QWindowsSystemProxy::init() reset(); -#ifdef Q_OS_WINCE - // Windows CE does not have any of the following API - return; -#else - -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) proxySettingsWatcher.clear(); // needs reset to trigger a new detection proxySettingsWatcher.addLocation(HKEY_CURRENT_USER, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")); proxySettingsWatcher.addLocation(HKEY_LOCAL_MACHINE, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")); @@ -568,7 +560,6 @@ void QWindowsSystemProxy::init() } functional = isAutoConfig || !proxyServerList.isEmpty(); -#endif } QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 802b623375..03f2ddb968 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -563,6 +563,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() cachedSocketDescriptor(-1), readBufferMaxSize(0), isBuffered(false), + hasPendingData(false), connectTimer(0), disconnectTimer(0), hostLookupId(-1), @@ -593,6 +594,7 @@ void QAbstractSocketPrivate::resetSocketLayer() qDebug("QAbstractSocketPrivate::resetSocketLayer()"); #endif + hasPendingData = false; if (socketEngine) { socketEngine->close(); socketEngine->disconnect(); @@ -683,14 +685,20 @@ bool QAbstractSocketPrivate::canReadNotification() qDebug("QAbstractSocketPrivate::canReadNotification()"); #endif - if (!isBuffered) - socketEngine->setReadNotificationEnabled(false); + if (!isBuffered) { + if (hasPendingData) { + socketEngine->setReadNotificationEnabled(false); + return true; + } + hasPendingData = true; + } // If buffered, read data from the socket into the read buffer qint64 newBytes = 0; if (isBuffered) { // Return if there is no space in the buffer if (readBufferMaxSize && buffer.size() >= readBufferMaxSize) { + socketEngine->setReadNotificationEnabled(false); #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::canReadNotification() buffer is full"); #endif @@ -708,11 +716,6 @@ bool QAbstractSocketPrivate::canReadNotification() return false; } newBytes = buffer.size() - newBytes; - - // If read buffer is full, disable the read socket notifier. - if (readBufferMaxSize && buffer.size() == readBufferMaxSize) { - socketEngine->setReadNotificationEnabled(false); - } } // Only emit readyRead() if there is data available. @@ -728,10 +731,6 @@ bool QAbstractSocketPrivate::canReadNotification() return true; } - // turn the socket engine off if we've reached the buffer size limit - if (socketEngine && isBuffered) - socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); - return true; } @@ -788,12 +787,8 @@ bool QAbstractSocketPrivate::canWriteNotification() #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::canWriteNotification() flushing"); #endif - bool dataWasWritten = writeToSocket(); - - if (socketEngine && writeBuffer.isEmpty() && socketEngine->bytesToWrite() == 0) - socketEngine->setWriteNotificationEnabled(false); - return dataWasWritten; + return writeToSocket(); } /*! \internal @@ -833,8 +828,12 @@ bool QAbstractSocketPrivate::writeToSocket() #endif // this covers the case when the buffer was empty, but we had to wait for the socket engine to finish - if (state == QAbstractSocket::ClosingState) + if (state == QAbstractSocket::ClosingState) { q->disconnectFromHost(); + } else { + if (socketEngine) + socketEngine->setWriteNotificationEnabled(false); + } return false; } @@ -872,8 +871,7 @@ bool QAbstractSocketPrivate::writeToSocket() emit q->channelBytesWritten(0, written); } - if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled() - && !socketEngine->bytesToWrite()) + if (writeBuffer.isEmpty() && socketEngine && !socketEngine->bytesToWrite()) socketEngine->setWriteNotificationEnabled(false); if (state == QAbstractSocket::ClosingState) q->disconnectFromHost(); @@ -1144,12 +1142,10 @@ void QAbstractSocketPrivate::_q_connectToNextAddress() */ void QAbstractSocketPrivate::_q_testConnection() { - if (socketEngine) { - if (threadData->hasEventDispatcher()) { - if (connectTimer) - connectTimer->stop(); - } + if (connectTimer) + connectTimer->stop(); + if (socketEngine) { if (socketEngine->state() == QAbstractSocket::ConnectedState) { // Fetch the parameters if our connection is completed; // otherwise, fall out and try the next address. @@ -1166,11 +1162,6 @@ void QAbstractSocketPrivate::_q_testConnection() addresses.clear(); } - if (threadData->hasEventDispatcher()) { - if (connectTimer) - connectTimer->stop(); - } - #if defined(QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::_q_testConnection() connection failed," " checking for alternative addresses"); @@ -2379,11 +2370,6 @@ void QAbstractSocket::abort() return; } #endif - if (d->connectTimer) { - d->connectTimer->stop(); - delete d->connectTimer; - d->connectTimer = 0; - } d->abortCalled = true; close(); @@ -2430,15 +2416,7 @@ bool QAbstractSocket::atEnd() const // Note! docs copied to QSslSocket::flush() bool QAbstractSocket::flush() { - Q_D(QAbstractSocket); -#ifndef QT_NO_SSL - // Manual polymorphism; flush() isn't virtual, but QSslSocket overloads - // it. - if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) - return socket->flush(); -#endif - Q_CHECK_SOCKETENGINE(false); - return d->flush(); + return d_func()->flush(); } /*! \reimp @@ -2461,8 +2439,9 @@ qint64 QAbstractSocket::readData(char *data, qint64 maxSize) d->setError(d->socketEngine->error(), d->socketEngine->errorString()); d->resetSocketLayer(); d->state = QAbstractSocket::UnconnectedState; - } else if (!d->socketEngine->isReadNotificationEnabled()) { + } else { // Only do this when there was no error + d->hasPendingData = false; d->socketEngine->setReadNotificationEnabled(true); } @@ -2828,12 +2807,12 @@ void QAbstractSocket::setReadBufferSize(qint64 size) if (d->readBufferMaxSize == size) return; d->readBufferMaxSize = size; - if (!d->emittedReadyRead && d->socketEngine) { - // ensure that the read notification is enabled if we've now got - // room in the read buffer - // but only if we're not inside canReadNotification -- that will take care on its own - if ((size == 0 || d->buffer.size() < size) && d->state == QAbstractSocket::ConnectedState) // Do not change the notifier unless we are connected. - d->socketEngine->setReadNotificationEnabled(true); + + // Do not change the notifier unless we are connected. + if (d->socketEngine && d->state == QAbstractSocket::ConnectedState) { + // Ensure that the read notification is enabled if we've now got + // room in the read buffer. + d->socketEngine->setReadNotificationEnabled(size == 0 || d->buffer.size() < size); } } diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index b718c21ff5..3164c96c1e 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -128,13 +128,12 @@ public: inline void resolveProxy(quint16 port) { resolveProxy(QString(), port); } void resetSocketLayer(); - bool flush(); + virtual bool flush(); bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol); virtual void configureCreatedSocket(); void startConnectingByName(const QString &host); void fetchConnectionParameters(); - void setupSocketNotifiers(); bool readFromSocket(); bool writeToSocket(); void emitReadyRead(); @@ -144,6 +143,7 @@ public: qint64 readBufferMaxSize; bool isBuffered; + bool hasPendingData; QTimer *connectTimer; QTimer *disconnectTimer; diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 19e9e1d9b7..5a05d7c98c 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -66,21 +66,20 @@ QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN -#define QT_SOCKLEN_T int -#define QT_SOCKOPTLEN_T int +# define QT_SOCKLEN_T int +# define QT_SOCKOPTLEN_T int // The following definitions are copied from the MinGW header mswsock.h which // was placed in the public domain. The WSASendMsg and WSARecvMsg functions // were introduced with Windows Vista, so some Win32 headers are lacking them. // There are no known versions of Windows CE or Embedded that contain them. -#ifndef Q_OS_WINCE # ifndef WSAID_WSARECVMSG typedef INT (WINAPI *LPFN_WSARECVMSG)(SOCKET s, LPWSAMSG lpMsg, LPDWORD lpdwNumberOfBytesRecvd, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); # define WSAID_WSARECVMSG {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}} -# endif +# endif // !WSAID_WSARECVMSG # ifndef WSAID_WSASENDMSG typedef struct { LPWSAMSG lpMsg; @@ -96,9 +95,8 @@ typedef INT (WSAAPI *LPFN_WSASENDMSG)(SOCKET s, LPWSAMSG lpMsg, DWORD dwFlags, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); # define WSAID_WSASENDMSG {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}} -# endif -#endif -#endif +# endif // !WSAID_WSASENDMSG +#endif // Q_OS_WIN union qt_sockaddr { sockaddr a; @@ -210,7 +208,7 @@ public: QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) LPFN_WSASENDMSG sendmsg; LPFN_WSARECVMSG recvmsg; # endif diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 648f2bf376..07f4899bae 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -387,7 +387,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc return false; } -#if !defined(Q_OS_WINCE) if (socketType == QAbstractSocket::UdpSocket) { // enable new behavior using // SIO_UDP_CONNRESET @@ -414,7 +413,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc &sendmsgguid, sizeof(sendmsgguid), &sendmsg, sizeof(sendmsg), &bytesReturned, NULL, NULL) == SOCKET_ERROR) sendmsg = 0; -#endif socketDescriptor = socket; if (socket != INVALID_SOCKET) { @@ -1078,7 +1076,6 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const { -#if !defined(Q_OS_WINCE) // Create a sockaddr struct and reset its port number. qt_sockaddr storage; QT_SOCKLEN_T storageSize = sizeof(storage); @@ -1105,18 +1102,6 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const result = true; } -#else // Q_OS_WINCE - bool result = false; - fd_set readS; - FD_ZERO(&readS); - FD_SET((SOCKET)socketDescriptor, &readS); - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 5000; - int available = ::select(1, &readS, 0, 0, &timeout); - result = available > 0; -#endif - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeHasPendingDatagrams() == %s", result ? "true" : "false"); @@ -1128,7 +1113,6 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const { qint64 ret = -1; -#if !defined(Q_OS_WINCE) int recvResult = 0; DWORD flags; DWORD bufferCount = 5; @@ -1173,18 +1157,6 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const if (buf) delete[] buf; -#else // Q_OS_WINCE - DWORD size = -1; - DWORD bytesReturned; - int ioResult = WSAIoctl(socketDescriptor, FIONREAD, 0,0, &size, sizeof(size), &bytesReturned, 0, 0); - if (ioResult == SOCKET_ERROR) { - int err = WSAGetLastError(); - WS_ERROR_DEBUG(err); - } else { - ret = qint64(size); - } -#endif - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %li", ret); #endif @@ -1192,12 +1164,6 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const return ret; } -#ifdef Q_OS_WINCE -// Windows CE has no support for sendmsg or recvmsg. We set it to null here to simplify the code below. -static int (*const recvmsg)(...) = 0; -static int (*const sendmsg)(...) = 0; -#endif - qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxLength, QIpPacketHeader *header, QAbstractSocketEngine::PacketHeaderOptions options) { @@ -1316,12 +1282,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l memset(&msg, 0, sizeof(msg)); memset(&aa, 0, sizeof(aa)); -#if !defined(Q_OS_WINCE) buf.buf = len ? (char*)data : 0; -#else - char tmp; - buf.buf = len ? (char*)data : &tmp; -#endif msg.lpBuffers = &buf; msg.dwBufferCount = 1; msg.name = &aa.a; @@ -1482,9 +1443,6 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) buf.len = maxLength; DWORD flags = 0; DWORD bytesRead = 0; -#if defined(Q_OS_WINCE) - WSASetLastError(0); -#endif if (::WSARecv(socketDescriptor, &buf, 1, &bytesRead, &flags, 0,0) == SOCKET_ERROR) { int err = WSAGetLastError(); WS_ERROR_DEBUG(err); @@ -1598,11 +1556,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; -#if !defined(Q_OS_WINCE) ret = select(socketDescriptor + 1, &fdread, &fdwrite, &fdexception, timeout < 0 ? 0 : &tv); -#else - ret = select(1, &fdread, &fdwrite, &fdexception, timeout < 0 ? 0 : &tv); -#endif //... but if it is actually set, pretend it did not happen if (ret > 0 && FD_ISSET((SOCKET)socketDescriptor, &fdexception)) diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 0c15810a48..369396271e 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -64,11 +64,7 @@ static const int MaxWriteBufferSize = 128*1024; //#define QSOCKS5SOCKETLAYER_DEBUG #define MAX_DATA_DUMP 256 -#if !defined(Q_OS_WINCE) #define SOCKS5_BLOCKING_BIND_TIMEOUT 5000 -#else -#define SOCKS5_BLOCKING_BIND_TIMEOUT 10000 -#endif #define Q_INIT_CHECK(returnValue) do { \ if (!d->data) { \ diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 7dd884c16a..809b603403 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -543,8 +543,11 @@ QTcpSocket *QTcpServer::nextPendingConnection() if (d->pendingConnections.isEmpty()) return 0; - if (!d->socketEngine->isReadNotificationEnabled()) + if (!d->socketEngine) { + qWarning("QTcpServer::nextPendingConnection() called while not listening"); + } else if (!d->socketEngine->isReadNotificationEnabled()) { d->socketEngine->setReadNotificationEnabled(true); + } return d->pendingConnections.takeFirst(); } diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp index c406009069..083648bc23 100644 --- a/src/network/socket/qudpsocket.cpp +++ b/src/network/socket/qudpsocket.cpp @@ -398,7 +398,8 @@ qint64 QUdpSocket::readDatagram(char *data, qint64 maxSize, QHostAddress *addres readBytes = d->socketEngine->readDatagram(data, maxSize); } - d_func()->socketEngine->setReadNotificationEnabled(true); + d->hasPendingData = false; + d->socketEngine->setReadNotificationEnabled(true); if (readBytes < 0) d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString()); return readBytes; diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index f50a7b1229..2d80f38bec 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -43,7 +43,7 @@ win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp \ socket/qlocalsocket_win.cpp \ socket/qlocalserver_win.cpp -win32:!wince:!winrt:LIBS_PRIVATE += -ladvapi32 +win32:!winrt:LIBS_PRIVATE += -ladvapi32 winrt { SOURCES += socket/qnativesocketengine_winrt.cpp \ @@ -54,15 +54,6 @@ winrt { DEFINES += QT_LOCALSOCKET_TCP } -wince { - SOURCES -= socket/qlocalsocket_win.cpp \ - socket/qlocalserver_win.cpp - SOURCES += socket/qlocalsocket_tcp.cpp \ - socket/qlocalserver_tcp.cpp - - DEFINES += QT_LOCALSOCKET_TCP -} - integrity: { SOURCES -= socket/qlocalsocket_unix.cpp \ socket/qlocalserver_unix.cpp diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index f9bb28e033..1eb253d202 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -119,7 +119,8 @@ const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1"; /*! \enum QSslConfiguration::NextProtocolNegotiationStatus - Describes the status of the Next Protocol Negotiation (NPN). + Describes the status of the Next Protocol Negotiation (NPN) or + Application-Layer Protocol Negotiation (ALPN). \value NextProtocolNegotiationNone No application protocol has been negotiated (yet). @@ -209,6 +210,7 @@ bool QSslConfiguration::operator==(const QSslConfiguration &other) const d->privateKey == other.d->privateKey && d->sessionCipher == other.d->sessionCipher && d->sessionProtocol == other.d->sessionProtocol && + d->preSharedKeyIdentityHint == other.d->preSharedKeyIdentityHint && d->ciphers == other.d->ciphers && d->ellipticCurves == other.d->ellipticCurves && d->caCertificates == other.d->caCertificates && @@ -259,6 +261,7 @@ bool QSslConfiguration::isNull() const d->sslOptions == QSslConfigurationPrivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && + d->preSharedKeyIdentityHint.isNull() && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone); @@ -809,11 +812,38 @@ QVector<QSslEllipticCurve> QSslConfiguration::supportedEllipticCurves() } /*! + \since 5.8 + + Returns the identity hint. + + \sa setPreSharedKeyIdentityHint() +*/ +QByteArray QSslConfiguration::preSharedKeyIdentityHint() const +{ + return d->preSharedKeyIdentityHint; +} + +/*! + \since 5.8 + + Sets the identity hint for a preshared key authentication. This will affect the next + initiated handshake; calling this function on an already-encrypted socket + will not affect the socket's identity hint. + + The identity hint is used in QSslSocket::SslServerMode only! +*/ +void QSslConfiguration::setPreSharedKeyIdentityHint(const QByteArray &hint) +{ + d->preSharedKeyIdentityHint = hint; +} + +/*! \since 5.3 This function returns the protocol negotiated with the server - if the Next Protocol Negotiation (NPN) TLS extension was enabled. - In order for the NPN extension to be enabled, setAllowedNextProtocols() + if the Next Protocol Negotiation (NPN) or Application-Layer Protocol + Negotiation (ALPN) TLS extension was enabled. + In order for the NPN/ALPN extension to be enabled, setAllowedNextProtocols() needs to be called explicitly before connecting to the server. If no protocol could be negotiated or the extension was not enabled, @@ -830,9 +860,10 @@ QByteArray QSslConfiguration::nextNegotiatedProtocol() const \since 5.3 This function sets the allowed \a protocols to be negotiated with the - server through the Next Protocol Negotiation (NPN) TLS extension; each + server through the Next Protocol Negotiation (NPN) or Application-Layer + Protocol Negotiation (ALPN) TLS extension; each element in \a protocols must define one allowed protocol. - The function must be called explicitly before connecting to send the NPN + The function must be called explicitly before connecting to send the NPN/ALPN extension in the SSL handshake. Whether or not the negotiation succeeded can be queried through nextProtocolNegotiationStatus(). @@ -852,8 +883,8 @@ void QSslConfiguration::setAllowedNextProtocols(QList<QByteArray> protocols) \since 5.3 This function returns the allowed protocols to be negotiated with the - server through the Next Protocol Negotiation (NPN) TLS extension, as set - by setAllowedNextProtocols(). + server through the Next Protocol Negotiation (NPN) or Application-Layer + Protocol Negotiation (ALPN) TLS extension, as set by setAllowedNextProtocols(). \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), setAllowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1 */ @@ -865,7 +896,8 @@ QList<QByteArray> QSslConfiguration::allowedNextProtocols() const /*! \since 5.3 - This function returns the status of the Next Protocol Negotiation (NPN). + This function returns the status of the Next Protocol Negotiation (NPN) + or Application-Layer Protocol Negotiation (ALPN). If the feature has not been enabled through setAllowedNextProtocols(), this function returns NextProtocolNegotiationNone. The status will be set before emitting the encrypted() signal. diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h index f0754d7ef5..1f39e1a06f 100644 --- a/src/network/ssl/qsslconfiguration.h +++ b/src/network/ssl/qsslconfiguration.h @@ -141,6 +141,9 @@ public: void setEllipticCurves(const QVector<QSslEllipticCurve> &curves); static QVector<QSslEllipticCurve> supportedEllipticCurves(); + QByteArray preSharedKeyIdentityHint() const; + void setPreSharedKeyIdentityHint(const QByteArray &hint); + static QSslConfiguration defaultConfiguration(); static void setDefaultConfiguration(const QSslConfiguration &configuration); diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h index 093c9d6598..113954d7d1 100644 --- a/src/network/ssl/qsslconfiguration_p.h +++ b/src/network/ssl/qsslconfiguration_p.h @@ -88,6 +88,7 @@ public: peerSessionShared(false), sslOptions(QSslConfigurationPrivate::defaultSslOptions), sslSessionTicketLifeTimeHint(-1), + preSharedKeyIdentityHint(), nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone) { } @@ -121,6 +122,8 @@ public: QSslKey ephemeralServerKey; + QByteArray preSharedKeyIdentityHint; + QList<QByteArray> nextAllowedProtocols; QByteArray nextNegotiatedProtocol; QSslConfiguration::NextProtocolNegotiationStatus nextProtocolNegotiationStatus; diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index b3786f989e..0db7e10409 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -344,6 +344,11 @@ init_context: } #endif // OPENSSL_NO_EC +#ifndef OPENSSL_NO_PSK + if (!client) + q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData()); +#endif // OPENSSL_NO_PSK + const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves(); if (!qcurves.isEmpty()) { #if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) @@ -457,6 +462,23 @@ SSL* QSslContext::createSsl() m_npnContext.data = reinterpret_cast<unsigned char *>(m_supportedNPNVersions.data()); m_npnContext.len = m_supportedNPNVersions.count(); m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone; +#if OPENSSL_VERSION_NUMBER >= 0x10002000L + if (q_SSLeay() >= 0x10002000L) { + // Callback's type has a parameter 'const unsigned char ** out' + // since it was introduced in 1.0.2. Internally, OpenSSL's own code + // (tests/examples) cast it to unsigned char * (since it's 'out'). + // We just re-use our NPN callback and cast here: + typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *, + const unsigned char *, unsigned int, void *); + // With ALPN callback is for a server side only, for a client m_npnContext.status + // will stay in NextProtocolNegotiationNone. + q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext); + // Client: + q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len); + } +#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... + + // And in case our peer does not support ALPN, but supports NPN: q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); } #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 3e7a30aa9f..82df861859 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -836,15 +836,7 @@ bool QSslSocket::atEnd() const // Note! docs copied from QAbstractSocket::flush() bool QSslSocket::flush() { - Q_D(QSslSocket); -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << "QSslSocket::flush()"; -#endif - if (d->mode != UnencryptedMode) - // encrypt any unencrypted bytes in our buffer - d->transmit(); - - return d->plainSocket ? d->plainSocket->flush() : false; + return d_func()->flush(); } /*! @@ -923,6 +915,7 @@ void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration) d->configuration.privateKey = configuration.privateKey(); d->configuration.ciphers = configuration.ciphers(); d->configuration.ellipticCurves = configuration.ellipticCurves(); + d->configuration.preSharedKeyIdentityHint = configuration.preSharedKeyIdentityHint(); d->configuration.caCertificates = configuration.caCertificates(); d->configuration.peerVerifyDepth = configuration.peerVerifyDepth(); d->configuration.peerVerifyMode = configuration.peerVerifyMode(); @@ -2614,6 +2607,22 @@ QByteArray QSslSocketPrivate::peek(qint64 maxSize) /*! \internal */ +bool QSslSocketPrivate::flush() +{ +#ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << "QSslSocketPrivate::flush()"; +#endif + if (mode != QSslSocket::UnencryptedMode) { + // encrypt any unencrypted bytes in our buffer + transmit(); + } + + return plainSocket && plainSocket->flush(); +} + +/*! + \internal +*/ bool QSslSocketPrivate::rootCertOnDemandLoadingSupported() { return s_loadRootCertsOnDemand; diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index c069ff2f9d..1f2ed7687b 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -116,7 +116,7 @@ public: bool canReadLine() const Q_DECL_OVERRIDE; void close() Q_DECL_OVERRIDE; bool atEnd() const Q_DECL_OVERRIDE; - bool flush(); + bool flush(); // ### Qt6: remove me (implementation moved to private flush()) void abort(); // From QAbstractSocket: diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 4f62f53a93..5cbd2af323 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -201,6 +201,15 @@ static unsigned int q_ssl_psk_client_callback(SSL *ssl, Q_ASSERT(d); return d->tlsPskClientCallback(hint, identity, max_identity_len, psk, max_psk_len); } + +static unsigned int q_ssl_psk_server_callback(SSL *ssl, + const char *identity, + unsigned char *psk, unsigned int max_psk_len) +{ + QSslSocketBackendPrivate *d = reinterpret_cast<QSslSocketBackendPrivate *>(q_SSL_get_ex_data(ssl, QSslSocketBackendPrivate::s_indexForSSLExtraData)); + Q_ASSERT(d); + return d->tlsPskServerCallback(identity, psk, max_psk_len); +} #endif } // extern "C" @@ -436,8 +445,12 @@ bool QSslSocketBackendPrivate::initSslContext() #if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) // Set the client callback for PSK - if (q_SSLeay() >= 0x10001000L && mode == QSslSocket::SslClientMode) - q_SSL_set_psk_client_callback(ssl, &q_ssl_psk_client_callback); + if (q_SSLeay() >= 0x10001000L) { + if (mode == QSslSocket::SslClientMode) + q_SSL_set_psk_client_callback(ssl, &q_ssl_psk_client_callback); + else if (mode == QSslSocket::SslServerMode) + q_SSL_set_psk_server_callback(ssl, &q_ssl_psk_server_callback); + } #endif return true; @@ -522,15 +535,9 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() #if defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); if (hLib) { -#if defined(Q_OS_WINCE) - ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, L"CertOpenStore"); - ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, L"CertFindCertificateInStore"); - ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, L"CertCloseStore"); -#else ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); -#endif if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen } else { @@ -691,15 +698,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() #if defined(Q_OS_WIN) if (ptrCertOpenSystemStoreW && ptrCertFindCertificateInStore && ptrCertCloseStore) { HCERTSTORE hSystemStore; -#if defined(Q_OS_WINCE) - hSystemStore = ptrCertOpenSystemStoreW(CERT_STORE_PROV_SYSTEM_W, - 0, - 0, - CERT_STORE_NO_CRYPT_RELEASE_FLAG|CERT_SYSTEM_STORE_CURRENT_USER, - L"ROOT"); -#else hSystemStore = ptrCertOpenSystemStoreW(0, L"ROOT"); -#endif if(hSystemStore) { PCCERT_CONTEXT pc = NULL; while(1) { @@ -1274,6 +1273,31 @@ unsigned int QSslSocketBackendPrivate::tlsPskClientCallback(const char *hint, return pskLength; } +unsigned int QSslSocketBackendPrivate::tlsPskServerCallback(const char *identity, + unsigned char *psk, unsigned int max_psk_len) +{ + QSslPreSharedKeyAuthenticator authenticator; + + // Fill in some read-only fields (for the user) + authenticator.d->identityHint = configuration.preSharedKeyIdentityHint; + authenticator.d->identity = identity; + authenticator.d->maximumIdentityLength = 0; // user cannot set an identity + authenticator.d->maximumPreSharedKeyLength = int(max_psk_len); + + // Let the client provide the remaining bits... + Q_Q(QSslSocket); + emit q->preSharedKeyAuthenticationRequired(&authenticator); + + // No PSK set? Return now to make the handshake fail + if (authenticator.preSharedKey().isEmpty()) + return 0; + + // Copy data back into OpenSSL + const int pskLength = qMin(authenticator.preSharedKey().length(), authenticator.maximumPreSharedKeyLength()); + ::memcpy(psk, authenticator.preSharedKey().constData(), pskLength); + return pskLength; +} + #ifdef Q_OS_WIN void QSslSocketBackendPrivate::fetchCaRootForCert(const QSslCertificate &cert) @@ -1571,7 +1595,22 @@ void QSslSocketBackendPrivate::continueHandshake() } else { const unsigned char *proto = 0; unsigned int proto_len = 0; - q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); +#if OPENSSL_VERSION_NUMBER >= 0x10002000L + if (q_SSLeay() >= 0x10002000L) { + q_SSL_get0_alpn_selected(ssl, &proto, &proto_len); + if (proto_len && mode == QSslSocket::SslClientMode) { + // Client does not have a callback that sets it ... + configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated; + } + } + + if (!proto_len) { // Test if NPN was more lucky ... +#else + { +#endif + q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); + } + if (proto_len) configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast<const char *>(proto), proto_len); else diff --git a/src/network/ssl/qsslsocket_openssl_android.cpp b/src/network/ssl/qsslsocket_openssl_android.cpp index d73ed8995e..b5d2458d56 100644 --- a/src/network/ssl/qsslsocket_openssl_android.cpp +++ b/src/network/ssl/qsslsocket_openssl_android.cpp @@ -70,6 +70,7 @@ QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData() QJNIEnvironmentPrivate env; jobjectArray jcertificates = static_cast<jobjectArray>(certificates.object()); const jint nCertificates = env->GetArrayLength(jcertificates); + certificateData.reserve(static_cast<int>(nCertificates)); for (int i = 0; i < nCertificates; ++i) { jbyteArray jCert = static_cast<jbyteArray>(env->GetObjectArrayElement(jcertificates, i)); diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index 0674c05d71..c6572315f0 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -143,6 +143,7 @@ public: bool checkSslErrors(); void storePeerCertificates(); unsigned int tlsPskClientCallback(const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); + unsigned int tlsPskServerCallback(const char *identity, unsigned char *psk, unsigned int max_psk_len); #ifdef Q_OS_WIN void fetchCaRootForCert(const QSslCertificate &cert); void _q_caRootLoaded(QSslCertificate,QSslCertificate) Q_DECL_OVERRIDE; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index d0982377fb..f625fd3e96 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -300,6 +300,8 @@ DEFINEFUNC2(void *, SSL_get_ex_data, const SSL *ssl, ssl, int idx, idx, return N #endif #if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) DEFINEFUNC2(void, SSL_set_psk_client_callback, SSL* ssl, ssl, q_psk_client_callback_t callback, callback, return, DUMMYARG) +DEFINEFUNC2(void, SSL_set_psk_server_callback, SSL* ssl, ssl, q_psk_server_callback_t callback, callback, return, DUMMYARG) +DEFINEFUNC2(int, SSL_CTX_use_psk_identity_hint, SSL_CTX* ctx, ctx, const char *hint, hint, return 0, return) #endif #if OPENSSL_VERSION_NUMBER >= 0x10000000L #ifndef OPENSSL_NO_SSL2 @@ -418,6 +420,18 @@ DEFINEFUNC3(void, SSL_CTX_set_next_proto_select_cb, SSL_CTX *s, s, void *arg, arg, return, DUMMYARG) DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s, const unsigned char **data, data, unsigned *len, len, return, DUMMYARG) +#if OPENSSL_VERSION_NUMBER >= 0x10002000L +DEFINEFUNC3(int, SSL_set_alpn_protos, SSL *s, s, const unsigned char *protos, protos, + unsigned protos_len, protos_len, return -1, return) +DEFINEFUNC3(void, SSL_CTX_set_alpn_select_cb, SSL_CTX *s, s, + int (*cb) (SSL *ssl, const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, void *arg), cb, + void *arg, arg, return, DUMMYARG) +DEFINEFUNC3(void, SSL_get0_alpn_selected, const SSL *s, s, const unsigned char **data, data, + unsigned *len, len, return, DUMMYARG) +#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG) @@ -889,6 +903,8 @@ bool q_resolveOpenSslSymbols() #endif #if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK) RESOLVEFUNC(SSL_set_psk_client_callback) + RESOLVEFUNC(SSL_set_psk_server_callback) + RESOLVEFUNC(SSL_CTX_use_psk_identity_hint) #endif RESOLVEFUNC(SSL_write) #ifndef OPENSSL_NO_SSL2 diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 36e041b6cb..45e4380580 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -376,6 +376,9 @@ void *q_SSL_get_ex_data(const SSL *ssl, int idx); #ifndef OPENSSL_NO_PSK typedef unsigned int (*q_psk_client_callback_t)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); void q_SSL_set_psk_client_callback(SSL *ssl, q_psk_client_callback_t callback); +typedef unsigned int (*q_psk_server_callback_t)(SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len); +void q_SSL_set_psk_server_callback(SSL *ssl, q_psk_server_callback_t callback); +int q_SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint); #endif // OPENSSL_NO_PSK #if OPENSSL_VERSION_NUMBER >= 0x10000000L #ifndef OPENSSL_NO_SSL2 @@ -558,6 +561,19 @@ void q_SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, void *arg); void q_SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, unsigned *len); +#if OPENSSL_VERSION_NUMBER >= 0x10002000L +int q_SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned protos_len); +void q_SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + int (*cb) (SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg), void *arg); +void q_SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned *len); +#endif #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... // Helper function diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 5d4d52cd6d..e791b9d166 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -89,11 +89,7 @@ QT_BEGIN_NAMESPACE #endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -#if defined(Q_OS_WINCE) - typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*); -#else typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(HCRYPTPROV_LEGACY, LPCWSTR); -#endif typedef PCCERT_CONTEXT (WINAPI *PtrCertFindCertificateInStore)(HCERTSTORE, DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); typedef BOOL (WINAPI *PtrCertCloseStore)(HCERTSTORE, DWORD); #endif // Q_OS_WIN && !Q_OS_WINRT @@ -193,6 +189,7 @@ public: virtual qint64 peek(char *data, qint64 maxSize) Q_DECL_OVERRIDE; virtual QByteArray peek(qint64 maxSize) Q_DECL_OVERRIDE; + bool flush() Q_DECL_OVERRIDE; // Platform specific functions virtual void startClientEncryption() = 0; diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp index 045c89eb0e..5704d6b151 100644 --- a/src/network/ssl/qsslsocket_winrt.cpp +++ b/src/network/ssl/qsslsocket_winrt.cpp @@ -215,7 +215,9 @@ QList<QSslCipher> QSslSocketBackendPrivate::defaultCiphers() const QString protocolStrings[] = { QStringLiteral("SSLv3"), QStringLiteral("TLSv1"), QStringLiteral("TLSv1.1"), QStringLiteral("TLSv1.2") }; const QSsl::SslProtocol protocols[] = { QSsl::SslV3, QSsl::TlsV1_0, QSsl::TlsV1_1, QSsl::TlsV1_2 }; - for (int i = 0; i < ARRAYSIZE(protocols); ++i) { + const int size = static_cast<int>(ARRAYSIZE(protocols)); + ciphers.reserve(size); + for (int i = 0; i < size; ++i) { QSslCipher cipher; cipher.d->isNull = false; cipher.d->name = QStringLiteral("WINRT"); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 868e9ed265..6365a7421b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1006,11 +1006,11 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { - QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); + const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds); glClearStencil(0); // Clear to zero - for (int i = 0; i < clearRegion.size(); ++i) { + for (const QRect &rect : clearRegion) { #ifndef QT_GL_NO_SCISSOR_TEST - setScissor(clearRegion.at(i)); + setScissor(rect); #endif glClear(GL_STENCIL_BUFFER_BIT); } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5c8c1d58eb..a17beb898d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1918,7 +1918,8 @@ void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, i { QWriteLocker locker(&m_lock); const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)}; - m_cache.insert(cacheKey, texture, cost); + const bool inserted = m_cache.insert(cacheKey, texture, cost); + Q_UNUSED(inserted) Q_ASSERT(inserted); } void QGLTextureCache::remove(qint64 key) diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri index a0b37cae1a..6a4689eb19 100644 --- a/src/platformsupport/eventdispatchers/eventdispatchers.pri +++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri @@ -17,6 +17,6 @@ HEADERS +=\ contains(QT_CONFIG, glib) { SOURCES +=$$PWD/qeventdispatcher_glib.cpp HEADERS +=$$PWD/qeventdispatcher_glib_p.h - QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS_PRIVATE += $$QT_LIBS_GLIB + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GLIB + LIBS_PRIVATE += $$QMAKE_LIBS_GLIB } diff --git a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp index 7d49c35d84..de369e0b00 100644 --- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp +++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp @@ -151,11 +151,10 @@ messageDebugEntries[] = { {WM_IME_ENDCOMPOSITION, "WM_IME_ENDCOMPOSITION", true}, {WM_IME_NOTIFY, "WM_IME_NOTIFY", true}, {WM_IME_REQUEST, "WM_IME_REQUEST", true}, -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) {WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true}, {WM_ENDSESSION, "WM_ENDSESSION", true}, #endif -#ifndef Q_OS_WINCE {WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true}, {WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true}, {WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true}, @@ -181,7 +180,6 @@ messageDebugEntries[] = { {WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true}, {WM_DISPLAYCHANGE, "WM_DISPLAYCHANGE", true}, {WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true}, -#endif // !Q_OS_WINCE {WM_THEMECHANGED, "WM_THEMECHANGED", true} }; diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp index 3a91988799..e6b9e09a25 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp +++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp @@ -80,6 +80,12 @@ const QImage QFbBackingStore::image() return mImage; } + +QImage QFbBackingStore::toImage() const +{ + return mImage; +} + void QFbBackingStore::lock() { mImageMutex.lock(); @@ -101,4 +107,3 @@ void QFbBackingStore::endPaint() } QT_END_NAMESPACE - diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h index fc06b95475..c8dfe3489c 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h +++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h @@ -72,6 +72,7 @@ public: void resize(const QSize &size, const QRegion ®ion) Q_DECL_OVERRIDE; const QImage image(); + QImage toImage() const override; void lock(); void unlock(); diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp index d631849775..ee8183c896 100644 --- a/src/platformsupport/fbconvenience/qfbscreen.cpp +++ b/src/platformsupport/fbconvenience/qfbscreen.cpp @@ -206,15 +206,13 @@ void QFbScreen::generateRects() remainingScreen -= localGeometry; QRegion windowRegion(localGeometry); windowRegion -= remainingScreen; - foreach (const QRect &rect, windowRegion.rects()) { + for (const QRect &rect : windowRegion) mCachedRects += QPair<QRect, int>(rect, i); - } } #endif } - const QVector<QRect> remainingScreenRects = remainingScreen.rects(); - mCachedRects.reserve(mCachedRects.count() + remainingScreenRects.count()); - foreach (const QRect &rect, remainingScreenRects) + mCachedRects.reserve(mCachedRects.count() + remainingScreen.rectCount()); + for (const QRect &rect : remainingScreen) mCachedRects += QPair<QRect, int>(rect, -1); mIsUpToDate = true; } @@ -253,7 +251,7 @@ QRegion QFbScreen::doRedraw() rectRegion -= intersect; // we only expect one rectangle, but defensive coding... - foreach (const QRect &rect, intersect.rects()) { + for (const QRect &rect : intersect) { bool firstLayer = true; if (layer == -1) { mCompositePainter->fillRect(rect, Qt::black); diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri index d70b3b6a1a..52cf771b2a 100644 --- a/src/platformsupport/fontdatabases/basic/basic.pri +++ b/src/platformsupport/fontdatabases/basic/basic.pri @@ -8,6 +8,4 @@ SOURCES += \ $$PWD/qbasicfontdatabase.cpp \ $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp -CONFIG += opentype - include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index ebb64d15b4..d9ffb85f96 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -5,7 +5,6 @@ contains(QT_CONFIG, freetype) { include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) HEADERS += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp - CONFIG += opentype } ios: \ diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index f5372151b7..df39dcf6be 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -638,7 +638,7 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi // QUrl::fromLocalFile() doesn't accept qrc pseudo-paths like ":/fonts/myfont.ttf". // Therefore construct from QString with the qrc:// scheme -> "qrc:///fonts/myfont.ttf". fontURL = QUrl(QStringLiteral("qrc://") + fileName.mid(1)).toCFURL(); - } else if (!fileName.isEmpty()) { + } else { // At this point we hope that filename is in a format that QUrl can handle. fontURL = QUrl::fromLocalFile(fileName).toCFURL(); } diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index c7209fe696..bbc5cf0c8f 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -215,6 +215,9 @@ void QCoreTextFontEngine::init() } else avgCharWidth = QFontEngine::averageCharWidth(); + underlineThickness = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont)); + underlinePos = -QFixed::fromReal(CTFontGetUnderlinePosition(ctfont)); + cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000; // HACK hb_coretext requires both CTFont and CGFont but user_data is only void* @@ -762,6 +765,16 @@ bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) co return false; } +QFixed QCoreTextFontEngine::lineThickness() const +{ + return underlineThickness; +} + +QFixed QCoreTextFontEngine::underlinePosition() const +{ + return underlinePos; +} + QFontEngine::Properties QCoreTextFontEngine::properties() const { Properties result; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 67a5a3185b..8a487f0ff0 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -92,6 +92,9 @@ public: int synthesized() const Q_DECL_OVERRIDE { return synthesisFlags; } bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; } + QFixed lineThickness() const Q_DECL_OVERRIDE; + QFixed underlinePosition() const Q_DECL_OVERRIDE; + void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight); FaceId faceId() const Q_DECL_OVERRIDE; @@ -141,6 +144,8 @@ private: int synthesisFlags; CGAffineTransform transform; QFixed avgCharWidth; + QFixed underlineThickness; + QFixed underlinePos; QFontEngine::FaceId face_id; mutable bool kerningPairsLoaded; }; diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp index 3b1a87b8cd..58e811dff1 100644 --- a/src/platformsupport/graphics/qrasterbackingstore.cpp +++ b/src/platformsupport/graphics/qrasterbackingstore.cpp @@ -89,7 +89,7 @@ bool QRasterBackingStore::scroll(const QRegion ®ion, int dx, int dy) const qreal devicePixelRatio = m_image.devicePixelRatio(); const QPoint delta(dx * devicePixelRatio, dy * devicePixelRatio); - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) qt_scrollRectInImage(m_image, QRect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio), delta); return true; @@ -103,7 +103,7 @@ void QRasterBackingStore::beginPaint(const QRegion ®ion) QPainter painter(&m_image); painter.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) painter.fillRect(rect, blank); } diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index 7c29be7804..dbaaf524e8 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -140,7 +140,7 @@ void QOpenGLCompositorBackingStore::updateTexture() QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) { - foreach (const QRect &rect, m_dirty.rects()) { + for (const QRect &rect : m_dirty) { QRect r = imageRect & rect; glPixelStorei(GL_UNPACK_ROW_LENGTH, m_image.width()); glTexSubImage2D(GL_TEXTURE_2D, 0, r.x(), r.y(), r.width(), r.height(), GL_RGBA, GL_UNSIGNED_BYTE, @@ -148,7 +148,7 @@ void QOpenGLCompositorBackingStore::updateTexture() glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } } else { - foreach (const QRect &rect, m_dirty.rects()) { + for (const QRect &rect : m_dirty) { // intersect with image rect to be sure QRect r = imageRect & rect; @@ -161,7 +161,7 @@ void QOpenGLCompositorBackingStore::updateTexture() fixed |= r; } - foreach (const QRect &rect, fixed.rects()) { + for (const QRect &rect : fixed) { // if the sub-rect is full-width we can pass the image data directly to // OpenGL instead of copying, since there's no gap between scanlines if (rect.width() == imageRect.width()) { @@ -258,7 +258,7 @@ void QOpenGLCompositorBackingStore::beginPaint(const QRegion ®ion) if (m_image.hasAlphaChannel()) { QPainter p(&m_image); p.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) p.fillRect(r, Qt::transparent); } } diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index cc590cc545..8028e65147 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -7,7 +7,7 @@ TEMPLATE = subdirs #win32:SUBDIRS += nla win32:SUBDIRS += generic -win32:!wince:!winrt: SUBDIRS += nativewifi +win32:!winrt: SUBDIRS += nativewifi mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan mac:SUBDIRS += generic android:SUBDIRS += android diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index aa0fc6b945..02ea7abf88 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -50,17 +50,10 @@ #include <QtCore/qdebug.h> #include <QtCore/private/qcoreapplication_p.h> -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) #include "../platformdefs_win.h" #endif -#ifdef Q_OS_WINCE -typedef ULONG NDIS_OID, *PNDIS_OID; -# ifndef QT_NO_WINCE_NUIOUSER -# include <nuiouser.h> -# endif -#endif // Q_OS_WINCE - #ifdef Q_OS_WINRT #include <qfunctions_winrt.h> @@ -92,36 +85,22 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_NETWORKINTERFACE static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) { -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) DWORD bytesWritten; NDIS_MEDIUM medium; NDIS_PHYSICAL_MEDIUM physicalMedium; -#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER) - NDISUIO_QUERY_OID nicGetOid; - HANDLE handle = CreateFile((PTCHAR)NDISUIO_DEVICE_NAME, 0, - FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); -#else unsigned long oid; HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); -#endif if (handle == INVALID_HANDLE_VALUE) return QNetworkConfiguration::BearerUnknown; bytesWritten = 0; -#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER) - ZeroMemory(&nicGetOid, sizeof(NDISUIO_QUERY_OID)); - nicGetOid.Oid = OID_GEN_MEDIA_SUPPORTED; - nicGetOid.ptcDeviceName = (PTCHAR)interface.utf16(); - bool result = DeviceIoControl(handle, IOCTL_NDISUIO_QUERY_OID_VALUE, &nicGetOid, sizeof(nicGetOid), - &nicGetOid, sizeof(nicGetOid), &bytesWritten, 0); -#else oid = OID_GEN_MEDIA_SUPPORTED; bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), &medium, sizeof(medium), &bytesWritten, 0); -#endif if (!result) { CloseHandle(handle); return QNetworkConfiguration::BearerUnknown; @@ -129,22 +108,9 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf bytesWritten = 0; -#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER) - medium = NDIS_MEDIUM( *(LPDWORD)nicGetOid.Data ); - - ZeroMemory(&nicGetOid, sizeof(NDISUIO_QUERY_OID)); - nicGetOid.Oid = OID_GEN_PHYSICAL_MEDIUM; - nicGetOid.ptcDeviceName = (PTCHAR)interface.utf16(); - - result = DeviceIoControl(handle, IOCTL_NDISUIO_QUERY_OID_VALUE, &nicGetOid, sizeof(nicGetOid), - &nicGetOid, sizeof(nicGetOid), &bytesWritten, 0); - - physicalMedium = NDIS_PHYSICAL_MEDIUM( *(LPDWORD)nicGetOid.Data ); -#else oid = OID_GEN_PHYSICAL_MEDIUM; result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); -#endif if (!result) { CloseHandle(handle); diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 32ff5446e5..113d0667d2 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -2,11 +2,7 @@ TARGET = qnlabearer QT = core core-private network network-private -!wince* { - LIBS += -lws2_32 -} else { - LIBS += -lws2 -} +LIBS += -lws2_32 HEADERS += qnlaengine.h \ ../platformdefs_win.h \ diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp index 6026e06b55..86decd312b 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp +++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp @@ -43,10 +43,12 @@ #include <QWindow> #include <QGuiApplication> #include <QTouchDevice> +#include <qmath.h> #include <qpa/qwindowsysteminterface.h> #include "qtuiocursor_p.h" +#include "qtuiotoken_p.h" #include "qtuiohandler_p.h" #include "qoscbundle_p.h" @@ -55,6 +57,12 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcTuioSource, "qt.qpa.tuio.source") Q_LOGGING_CATEGORY(lcTuioSet, "qt.qpa.tuio.set") +// With TUIO the first application takes exclusive ownership of the "device" +// we cannot attach more than one application to the same port anyway. +// Forcing delivery makes it easy to use simulators in the same machine +// and forget about headaches about unfocused TUIO windows. +static bool forceDelivery = qEnvironmentVariableIsSet("QT_TUIOTOUCH_DELIVER_WITHOUT_FOCUS"); + QTuioHandler::QTuioHandler(const QString &specification) : m_device(new QTouchDevice) // not leaked, QTouchDevice cleans up registered devices itself { @@ -157,29 +165,49 @@ void QTuioHandler::processPackets() messages.push_back(msg); } - foreach (const QOscMessage &message, messages) { - if (message.addressPattern() != "/tuio/2Dcur") { - qWarning() << "Ignoring unknown address pattern " << message.addressPattern(); - continue; - } - - QList<QVariant> arguments = message.arguments(); - if (arguments.count() == 0) { - qWarning("Ignoring TUIO message with no arguments"); - continue; - } - - QByteArray messageType = arguments.at(0).toByteArray(); - if (messageType == "source") { - process2DCurSource(message); - } else if (messageType == "alive") { - process2DCurAlive(message); - } else if (messageType == "set") { - process2DCurSet(message); - } else if (messageType == "fseq") { - process2DCurFseq(message); + for (const QOscMessage &message : messages) { + if (message.addressPattern() == "/tuio/2Dcur") { + QList<QVariant> arguments = message.arguments(); + if (arguments.count() == 0) { + qWarning("Ignoring TUIO message with no arguments"); + continue; + } + + QByteArray messageType = arguments.at(0).toByteArray(); + if (messageType == "source") { + process2DCurSource(message); + } else if (messageType == "alive") { + process2DCurAlive(message); + } else if (messageType == "set") { + process2DCurSet(message); + } else if (messageType == "fseq") { + process2DCurFseq(message); + } else { + qWarning() << "Ignoring unknown TUIO message type: " << messageType; + continue; + } + } else if (message.addressPattern() == "/tuio/2Dobj") { + QList<QVariant> arguments = message.arguments(); + if (arguments.count() == 0) { + qWarning("Ignoring TUIO message with no arguments"); + continue; + } + + QByteArray messageType = arguments.at(0).toByteArray(); + if (messageType == "source") { + process2DObjSource(message); + } else if (messageType == "alive") { + process2DObjAlive(message); + } else if (messageType == "set") { + process2DObjSet(message); + } else if (messageType == "fseq") { + process2DObjFseq(message); + } else { + qWarning() << "Ignoring unknown TUIO message type: " << messageType; + continue; + } } else { - qWarning() << "Ignoring unknown TUIO message type: " << messageType; + qWarning() << "Ignoring unknown address pattern " << message.addressPattern(); continue; } } @@ -328,11 +356,6 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message) Q_UNUSED(message); // TODO: do we need to do anything with the frame id? QWindow *win = QGuiApplication::focusWindow(); - // With TUIO the first application takes exclusive ownership of the "device" - // we cannot attach more than one application to the same port anyway. - // Forcing delivery makes it easy to use simulators in the same machine - // and forget about headaches about unfocused TUIO windows. - static bool forceDelivery = qEnvironmentVariableIsSet("QT_TUIOTOUCH_DELIVER_WITHOUT_FOCUS"); if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery) win = QGuiApplication::topLevelWindows().at(0); @@ -342,12 +365,12 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message) QList<QWindowSystemInterface::TouchPoint> tpl; tpl.reserve(m_activeCursors.size() + m_deadCursors.size()); - foreach (const QTuioCursor &tc, m_activeCursors) { + for (const QTuioCursor &tc : m_activeCursors) { QWindowSystemInterface::TouchPoint tp = cursorToTouchPoint(tc, win); tpl.append(tp); } - foreach (const QTuioCursor &tc, m_deadCursors) { + for (const QTuioCursor &tc : m_deadCursors) { QWindowSystemInterface::TouchPoint tp = cursorToTouchPoint(tc, win); tp.state = Qt::TouchPointReleased; tpl.append(tp); @@ -357,5 +380,181 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message) m_deadCursors.clear(); } +void QTuioHandler::process2DObjSource(const QOscMessage &message) +{ + QList<QVariant> arguments = message.arguments(); + if (arguments.count() != 2) { + qWarning() << "Ignoring malformed TUIO source message: " << arguments.count(); + return; + } + + if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) { + qWarning("Ignoring malformed TUIO source message (bad argument type)"); + return; + } + + qCDebug(lcTuioSource) << "Got TUIO source message from: " << arguments.at(1).toByteArray(); +} + +void QTuioHandler::process2DObjAlive(const QOscMessage &message) +{ + QList<QVariant> arguments = message.arguments(); + + // delta the notified tokens that are active, against the ones we already + // know of. + // + // TBD: right now we're assuming one 2DObj alive message corresponds to a + // new data source from the input. is this correct, or do we need to store + // changes and only process the deltas on fseq? + QMap<int, QTuioToken> oldActiveTokens = m_activeTokens; + QMap<int, QTuioToken> newActiveTokens; + + for (int i = 1; i < arguments.count(); ++i) { + if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) { + qWarning() << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')'; + return; + } + + int sessionId = arguments.at(i).toInt(); + if (!oldActiveTokens.contains(sessionId)) { + // newly active + QTuioToken token(sessionId); + token.setState(Qt::TouchPointPressed); + newActiveTokens.insert(sessionId, token); + } else { + // we already know about it, remove it so it isn't marked as released + QTuioToken token = oldActiveTokens.value(sessionId); + token.setState(Qt::TouchPointStationary); // position change in SET will update if needed + newActiveTokens.insert(sessionId, token); + oldActiveTokens.remove(sessionId); + } + } + + // anything left is dead now + QMap<int, QTuioToken>::ConstIterator it = oldActiveTokens.constBegin(); + + // deadTokens should be cleared from the last FSEQ now + m_deadTokens.reserve(oldActiveTokens.size()); + + // TODO: there could be an issue of resource exhaustion here if FSEQ isn't + // sent in a timely fashion. we should probably track message counts and + // force-flush if we get too many built up. + while (it != oldActiveTokens.constEnd()) { + m_deadTokens.append(it.value()); + ++it; + } + + m_activeTokens = newActiveTokens; +} + +void QTuioHandler::process2DObjSet(const QOscMessage &message) +{ + QList<QVariant> arguments = message.arguments(); + if (arguments.count() < 7) { + qWarning() << "Ignoring malformed TUIO set message with too few arguments: " << arguments.count(); + return; + } + + if (QMetaType::Type(arguments.at(1).type()) != QMetaType::Int || + QMetaType::Type(arguments.at(2).type()) != QMetaType::Int || + QMetaType::Type(arguments.at(3).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(4).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(5).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(6).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(7).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(8).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(9).type()) != QMetaType::Float || + QMetaType::Type(arguments.at(10).type()) != QMetaType::Float) { + qWarning() << "Ignoring malformed TUIO set message with bad types: " << arguments; + return; + } + + int id = arguments.at(1).toInt(); + int classId = arguments.at(2).toInt(); + float x = arguments.at(3).toFloat(); + float y = arguments.at(4).toFloat(); + float angle = arguments.at(5).toFloat(); + float vx = arguments.at(6).toFloat(); + float vy = arguments.at(7).toFloat(); + float angularVelocity = arguments.at(8).toFloat(); + float acceleration = arguments.at(9).toFloat(); + float angularAcceleration = arguments.at(10).toFloat(); + + QMap<int, QTuioToken>::Iterator it = m_activeTokens.find(id); + if (it == m_activeTokens.end()) { + qWarning() << "Ignoring malformed TUIO set for nonexistent token " << classId; + return; + } + + qCDebug(lcTuioSet) << "Processing SET for token " << classId << id << " @ " << x << y << "∡" << angle << + "vel" << vx << vy << angularVelocity << "acc" << acceleration << angularAcceleration; + QTuioToken &tok = *it; + tok.setClassId(classId); + tok.setX(x); + tok.setY(y); + tok.setVX(vx); + tok.setVY(vy); + tok.setAcceleration(acceleration); + tok.setAngle(angle); + tok.setAngularVelocity(angularAcceleration); + tok.setAngularAcceleration(angularAcceleration); +} + +QWindowSystemInterface::TouchPoint QTuioHandler::tokenToTouchPoint(const QTuioToken &tc, QWindow *win) +{ + QWindowSystemInterface::TouchPoint tp; + tp.id = tc.id(); + tp.uniqueId = tc.classId(); // TODO TUIO 2.0: populate a QVariant, and register the mapping from int to arbitrary UID data + tp.flags = QTouchEvent::TouchPoint::Token; + tp.pressure = 1.0f; + + tp.normalPosition = QPointF(tc.x(), tc.y()); + + if (!m_transform.isIdentity()) + tp.normalPosition = m_transform.map(tp.normalPosition); + + tp.state = tc.state(); + tp.area = QRectF(0, 0, 1, 1); + + // We map the token position to the size of the window. + QPointF relPos = QPointF(win->size().width() * tp.normalPosition.x(), win->size().height() * tp.normalPosition.y()); + QPointF delta = relPos - relPos.toPoint(); + tp.area.moveCenter(win->mapToGlobal(relPos.toPoint()) + delta); + tp.velocity = QVector2D(win->size().width() * tc.vx(), win->size().height() * tc.vy()); + tp.rotation = tc.angle() * 180.0 / M_PI; // convert radians to degrees + return tp; +} + + +void QTuioHandler::process2DObjFseq(const QOscMessage &message) +{ + Q_UNUSED(message); // TODO: do we need to do anything with the frame id? + + QWindow *win = QGuiApplication::focusWindow(); + if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery) + win = QGuiApplication::topLevelWindows().at(0); + + if (!win) + return; + + QList<QWindowSystemInterface::TouchPoint> tpl; + tpl.reserve(m_activeTokens.size() + m_deadTokens.size()); + + for (const QTuioToken & t : m_activeTokens) { + QWindowSystemInterface::TouchPoint tp = tokenToTouchPoint(t, win); + tpl.append(tp); + } + + for (const QTuioToken & t : m_deadTokens) { + QWindowSystemInterface::TouchPoint tp = tokenToTouchPoint(t, win); + tp.state = Qt::TouchPointReleased; + tp.velocity = QVector2D(); + tpl.append(tp); + } + QWindowSystemInterface::handleTouchEvent(win, m_device, tpl); + + m_deadTokens.clear(); +} + QT_END_NAMESPACE diff --git a/src/plugins/generic/tuiotouch/qtuiohandler_p.h b/src/plugins/generic/tuiotouch/qtuiohandler_p.h index 3034872aae..2e444f2a0d 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler_p.h +++ b/src/plugins/generic/tuiotouch/qtuiohandler_p.h @@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE class QTouchDevice; class QOscMessage; class QTuioCursor; +class QTuioToken; class QTuioHandler : public QObject { @@ -69,14 +70,21 @@ private slots: void process2DCurAlive(const QOscMessage &message); void process2DCurSet(const QOscMessage &message); void process2DCurFseq(const QOscMessage &message); + void process2DObjSource(const QOscMessage &message); + void process2DObjAlive(const QOscMessage &message); + void process2DObjSet(const QOscMessage &message); + void process2DObjFseq(const QOscMessage &message); private: QWindowSystemInterface::TouchPoint cursorToTouchPoint(const QTuioCursor &tc, QWindow *win); + QWindowSystemInterface::TouchPoint tokenToTouchPoint(const QTuioToken &tc, QWindow *win); QTouchDevice *m_device; QUdpSocket m_socket; QMap<int, QTuioCursor> m_activeCursors; QVector<QTuioCursor> m_deadCursors; + QMap<int, QTuioToken> m_activeTokens; + QVector<QTuioToken> m_deadTokens; QTransform m_transform; }; diff --git a/src/plugins/generic/tuiotouch/qtuiotoken_p.h b/src/plugins/generic/tuiotouch/qtuiotoken_p.h new file mode 100644 index 0000000000..5084aeed11 --- /dev/null +++ b/src/plugins/generic/tuiotouch/qtuiotoken_p.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTUIOOBJECT_P_H +#define QTUIOOBJECT_P_H + +#include <Qt> +#include <qmath.h> + +QT_BEGIN_NAMESPACE + +/*! + \internal + + A fiducial object, or token, represented by 2Dobj in TUIO 1.x and tok in TUIO 2: + a physical object whose position and rotation can be uniquely tracked + on the touchscreen surface. +*/ +class QTuioToken +{ +public: + QTuioToken(int id = -1) + : m_id(id) + , m_classId(-1) + , m_x(0) + , m_y(0) + , m_vx(0) + , m_vy(0) + , m_acceleration(0) + , m_angle(0) + , m_angularVelocity(0) + , m_angularAcceleration(0) + , m_state(Qt::TouchPointPressed) + { + } + + int id() const { return m_id; } + + int classId() const { return m_classId; } + void setClassId(int classId) { m_classId = classId; } + + void setX(float x) + { + if (state() == Qt::TouchPointStationary && + !qFuzzyCompare(m_x + 2.0, x + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0 + setState(Qt::TouchPointMoved); + } + m_x = x; + } + float x() const { return m_x; } + + void setY(float y) + { + if (state() == Qt::TouchPointStationary && + !qFuzzyCompare(m_y + 2.0, y + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0 + setState(Qt::TouchPointMoved); + } + m_y = y; + } + float y() const { return m_y; } + + void setVX(float vx) { m_vx = vx; } + float vx() const { return m_vx; } + + void setVY(float vy) { m_vy = vy; } + float vy() const { return m_vy; } + + void setAcceleration(float acceleration) { m_acceleration = acceleration; } + float acceleration() const { return m_acceleration; } + + float angle() const { return m_angle; } + void setAngle(float angle) + { + if (angle > M_PI) + angle = angle - M_PI * 2.0; // zero is pointing upwards, and is the default; but we want to have negative angles when rotating left + if (state() == Qt::TouchPointStationary && + !qFuzzyCompare(m_angle + 2.0, angle + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0 + setState(Qt::TouchPointMoved); + } + m_angle = angle; + } + + float angularVelocity() const { return m_angularVelocity; } + void setAngularVelocity(float angularVelocity) { m_angularVelocity = angularVelocity; } + + float angularAcceleration() const { return m_angularAcceleration; } + void setAngularAcceleration(float angularAcceleration) { m_angularAcceleration = angularAcceleration; } + + void setState(const Qt::TouchPointState &state) { m_state = state; } + Qt::TouchPointState state() const { return m_state; } + +private: + int m_id; // sessionID, temporary object ID + int m_classId; // classID (e.g. marker ID) + float m_x; + float m_y; + float m_vx; + float m_vy; + float m_acceleration; + float m_angle; + float m_angularVelocity; + float m_angularAcceleration; + Qt::TouchPointState m_state; +}; + +QT_END_NAMESPACE + +#endif // QTUIOOBJECT_P_H diff --git a/src/plugins/generic/tuiotouch/tuiotouch.pro b/src/plugins/generic/tuiotouch/tuiotouch.pro index ae2ccde058..ad6a1c6876 100644 --- a/src/plugins/generic/tuiotouch/tuiotouch.pro +++ b/src/plugins/generic/tuiotouch/tuiotouch.pro @@ -15,7 +15,8 @@ HEADERS += \ qoscbundle_p.h \ qoscmessage_p.h \ qtuiohandler_p.h \ - qtuiocursor_p.h + qtuiocursor_p.h \ + qtuiotoken_p.h OTHER_FILES += \ tuiotouch.json diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index a361bc2532..c2625be85a 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -1,9 +1,8 @@ TARGET = qgif -include(../../../gui/image/qgifhandler.pri) -INCLUDEPATH += ../../../gui/image -SOURCES += $$PWD/main.cpp -HEADERS += $$PWD/main.h +SOURCES += main.cpp qgifhandler.cpp +HEADERS += main.h qgifhandler_p.h + OTHER_FILES += gif.json PLUGIN_TYPE = imageformats diff --git a/src/gui/image/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index 476b456563..476b456563 100644 --- a/src/gui/image/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp diff --git a/src/gui/image/qgifhandler_p.h b/src/plugins/imageformats/gif/qgifhandler_p.h index bc3debe83c..bc3debe83c 100644 --- a/src/gui/image/qgifhandler_p.h +++ b/src/plugins/imageformats/gif/qgifhandler_p.h diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro index 60afdaed70..7ca1f18cb1 100644 --- a/src/plugins/imageformats/ico/ico.pro +++ b/src/plugins/imageformats/ico/ico.pro @@ -1,10 +1,7 @@ TARGET = qico -QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)" - -HEADERS += qicohandler.h main.h -SOURCES += main.cpp \ - qicohandler.cpp +HEADERS += main.h qicohandler.h +SOURCES += main.cpp qicohandler.cpp OTHER_FILES += ico.json PLUGIN_TYPE = imageformats diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index 2b05f2feec..3de77c056d 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -!contains(QT_CONFIG, no-jpeg):!contains(QT_CONFIG, jpeg):SUBDIRS += jpeg -!contains(QT_CONFIG, no-gif):!contains(QT_CONFIG, gif):SUBDIRS += gif !contains(QT_CONFIG, no-ico):SUBDIRS += ico +contains(QT_CONFIG, jpeg): SUBDIRS += jpeg +contains(QT_CONFIG, gif): SUBDIRS += gif diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index 526556179c..9181abb465 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -2,12 +2,18 @@ TARGET = qjpeg QT += core-private -QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)" +SOURCES += main.cpp qjpeghandler.cpp +HEADERS += main.h qjpeghandler_p.h + +contains(QT_CONFIG, system-jpeg) { + msvc: \ + LIBS += libjpeg.lib + else: \ + LIBS += -ljpeg +} else { + include($$PWD/../../../3rdparty/libjpeg.pri) +} -include(../../../gui/image/qjpeghandler.pri) -INCLUDEPATH += ../../../gui/image -SOURCES += main.cpp -HEADERS += main.h OTHER_FILES += jpeg.json PLUGIN_TYPE = imageformats diff --git a/src/gui/image/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 52e8b39f11..52e8b39f11 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp diff --git a/src/gui/image/qjpeghandler_p.h b/src/plugins/imageformats/jpeg/qjpeghandler_p.h index 534ce12115..534ce12115 100644 --- a/src/gui/image/qjpeghandler_p.h +++ b/src/plugins/imageformats/jpeg/qjpeghandler_p.h diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 200d5789a8..994fe8386b 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -278,7 +278,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint QList<QInputMethodEvent::Attribute> attributes = t.attributes.imAttributes(); if (!t.text.isEmpty()) - attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant()); + attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0); QInputMethodEvent event(t.text, attributes); QCoreApplication::sendEvent(input, &event); diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index dc420775cf..125a03469f 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -645,7 +645,7 @@ jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPos : localPos - text.length() + newCursorPosition; //move the cursor attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, - newLocalPos, 0, QVariant())); + newLocalPos, 0)); } } m_blockUpdateSelection = updateSelectionWasBlocked; @@ -691,7 +691,7 @@ jboolean QAndroidInputContext::finishComposingText() // Moving Qt's cursor to where the preedit cursor used to be QList<QInputMethodEvent::Attribute> attributes; - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0)); QInputMethodEvent event(QString(), attributes); event.setCommitString(m_composingText); @@ -848,8 +848,7 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur QList<QInputMethodEvent::Attribute> attributes; attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, newCursorPosition, - 1, - QVariant())); + 1)); // Show compose text underlined QTextCharFormat underlined; underlined.setFontUnderline(true); @@ -921,7 +920,7 @@ jboolean QAndroidInputContext::setComposingRegion(jint start, jint end) QVariant(underlined))); // Keep the cursor position unchanged (don't move to end of preedit) - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1)); QInputMethodEvent event(m_composingText, attributes); event.setCommitString(QString(), relativeStart, length); @@ -955,7 +954,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) // preedit cursor int localOldPos = query->value(Qt::ImCursorPosition).toInt(); int pos = localCursorPos - localOldPos; - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1)); //but we have to tell Qt about the compose text all over again @@ -970,8 +969,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) // actually changing the selection attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, - end - start, - QVariant())); + end - start)); } QInputMethodEvent event(m_composingText, attributes); sendInputMethodEventThreadSafe(&event); diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 80d7e31aa3..e10bd95e12 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -80,6 +80,8 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::Pri Qt::ApplicationState QAndroidPlatformIntegration::m_defaultApplicationState = Qt::ApplicationActive; +bool QAndroidPlatformIntegration::m_showPasswordEnabled = false; + void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { if (resource=="JavaVM") @@ -191,6 +193,19 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ } QWindowSystemInterface::registerTouchDevice(m_touchDevice); } + + auto contentResolver = javaActivity.callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); + Q_ASSERT(contentResolver.isValid()); + QJNIObjectPrivate txtShowPassValue = QJNIObjectPrivate::callStaticObjectMethod("android/provider/Settings$System", + "getString", + "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;", + contentResolver.object(), + QJNIObjectPrivate::getStaticObjectField("android/provider/Settings$System", "TEXT_SHOW_PASSWORD", "Ljava/lang/String;").object()); + if (txtShowPassValue.isValid()) { + bool ok = false; + const int txtShowPass = txtShowPassValue.toString().toInt(&ok); + m_showPasswordEnabled = ok ? (txtShowPass == 1) : false; + } } QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState); @@ -313,6 +328,9 @@ QPlatformServices *QAndroidPlatformIntegration::services() const QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const { switch (hint) { + case PasswordMaskDelay: + // this number is from a hard-coded value in Android code (cf. PasswordTransformationMethod) + return m_showPasswordEnabled ? 1500 : 0; case ShowIsMaximized: return true; default: diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h index 1f06c23d0b..bda0bee9ad 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/qandroidplatformintegration.h @@ -143,6 +143,8 @@ private: static Qt::ApplicationState m_defaultApplicationState; + static bool m_showPasswordEnabled; + QPlatformFontDatabase *m_androidFDB; QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface; QAndroidPlatformServices *m_androidPlatformServices; diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index aa4fa94f0a..35a93bb847 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -379,9 +379,8 @@ void QAndroidPlatformScreen::doRedraw() } } - foreach (const QRect &rect, visibleRegion.rects()) { + for (const QRect &rect : visibleRegion) compositePainter.fillRect(rect, QColor(Qt::transparent)); - } ret = ANativeWindow_unlockAndPost(m_nativeSurface); if (ret >= 0) diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index c496134606..170f17504f 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -71,11 +71,11 @@ ** ****************************************************************************/ -#include <qcocoaapplication.h> +#include "qcocoaapplication.h" -#include <qcocoaintrospection.h> -#include <qcocoaapplicationdelegate.h> -#include <qcocoahelpers.h> +#include "qcocoaintrospection.h" +#include "qcocoaapplicationdelegate.h" +#include "qcocoahelpers.h" #include <qguiapplication.h> #include <qdebug.h> diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h index fa05626d18..52a3e756b9 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.h +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h @@ -57,11 +57,8 @@ public: QPaintDevice *paintDevice() Q_DECL_OVERRIDE; void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; -#ifndef QT_NO_OPENGL QImage toImage() const Q_DECL_OVERRIDE; -#else - QImage toImage() const; // No QPlatformBackingStore::toImage() for NO_OPENGL builds. -#endif + void resize (const QSize &size, const QRegion &) Q_DECL_OVERRIDE; bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE; void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index b060d6a082..20233518b3 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -96,9 +96,8 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy) extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); const qreal devicePixelRatio = m_qImage.devicePixelRatio(); QPoint qpoint(dx * devicePixelRatio, dy * devicePixelRatio); - const QVector<QRect> qrects = area.rects(); - for (int i = 0; i < qrects.count(); ++i) { - const QRect &qrect = QRect(qrects.at(i).topLeft() * devicePixelRatio, qrects.at(i).size() * devicePixelRatio); + for (const QRect &rect : area) { + const QRect qrect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio); qt_scrollRectInImage(m_qImage, qrect, qpoint); } return true; @@ -109,10 +108,9 @@ void QCocoaBackingStore::beginPaint(const QRegion ®ion) if (m_qImage.hasAlphaChannel()) { QPainter p(&m_qImage); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = region.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(), end = rects.end(); it != end; ++it) - p.fillRect(*it, blank); + for (const QRect &rect : region) + p.fillRect(rect, blank); } } diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 47f9539d9c..488c9b8928 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -132,7 +132,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); - (void)setDialogHelper:(QCocoaColorDialogHelper *)helper { mHelper = helper; - [mColorPanel setShowsAlpha:mHelper->options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; + if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) { [self restoreOriginalContentView]; } else if (!mStolenContentView) { @@ -483,6 +483,14 @@ bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowMod { if (windowModality == Qt::WindowModal) windowModality = Qt::ApplicationModal; + + // Workaround for Apple rdar://25792119: If you invoke + // -setShowsAlpha: multiple times before showing the color + // picker, its height grows irrevocably. Instead, only + // invoke it once, when we show the dialog. + [[NSColorPanel sharedColorPanel] setShowsAlpha: + options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; + sharedColorPanel()->init(this); return sharedColorPanel()->show(windowModality, parent); } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495..0375dd85f2 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -61,6 +61,8 @@ #include <qvarlengtharray.h> #include <stdlib.h> #include <qabstracteventdispatcher.h> +#include <qsysinfo.h> +#include <qglobal.h> #include <QDir> #include <qpa/qplatformnativeinterface.h> @@ -160,6 +162,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); // here to make sure it gets the correct value. [mSavePanel setDelegate:self]; +#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_11) + mOpenPanel.accessoryViewDisclosed = YES; +#endif + if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept)) [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]]; if (mOptions->isLabelExplicitlySet(QFileDialogOptions::FileName)) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 7480d99d19..c91c67fe79 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -202,15 +202,9 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon) HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion ®ion) { HIMutableShapeRef shape = HIShapeCreateMutable(); - QVector<QRect> rects = region.rects(); - if (!rects.isEmpty()) { - int n = rects.count(); - const QRect *qt_r = rects.constData(); - while (n--) { - CGRect cgRect = CGRectMake(qt_r->x(), qt_r->y(), qt_r->width(), qt_r->height()); - HIShapeUnionWithRect(shape, &cgRect); - ++qt_r; - } + for (const QRect &rect : region) { + CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); + HIShapeUnionWithRect(shape, &cgRect); } return shape; } diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.h b/src/plugins/platforms/cocoa/qcocoakeymapper.h index 93ebc5b9dc..4ba615efeb 100644 --- a/src/plugins/platforms/cocoa/qcocoakeymapper.h +++ b/src/plugins/platforms/cocoa/qcocoakeymapper.h @@ -40,7 +40,7 @@ #ifndef QCOCOAKEYMAPPER_H #define QCOCOAKEYMAPPER_H -#include <qcocoahelpers.h> +#include "qcocoahelpers.h" #include <AppKit/AppKit.h> #include <Carbon/Carbon.h> diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 4d2af84e8e..4d5f5d74f2 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -72,6 +72,7 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; QCocoaWindow *_platformWindow; BOOL _grabbingMouse; BOOL _releaseOnMouseUp; + QPointer<QObject> _watcher; } @property (nonatomic, readonly) QCocoaNSWindow *window; @@ -321,6 +322,11 @@ public: // for QNSView }; QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false) + + // This object is tracked by a 'watcher' + // object in a window helper, preventing use of dangling + // pointers. + QObject sentinel; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 29cc4130ed..01e72303be 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -99,6 +99,7 @@ static bool isMouseEvent(NSEvent *ev) // make sure that m_nsWindow stays valid until the // QCocoaWindow is deleted by Qt. [_window setReleasedWhenClosed:NO]; + _watcher = &_platformWindow->sentinel; } return self; @@ -107,7 +108,7 @@ static bool isMouseEvent(NSEvent *ev) - (void)handleWindowEvent:(NSEvent *)theEvent { QCocoaWindow *pw = self.platformWindow; - if (pw && pw->m_forwardWindow) { + if (_watcher && pw && pw->m_forwardWindow) { if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) { QNSView *forwardView = pw->m_qtView; if (theEvent.type == NSLeftMouseUp) { @@ -146,7 +147,7 @@ static bool isMouseEvent(NSEvent *ev) if (!self.window.delegate) return; // Already detached, pending NSAppKitDefined event - if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { + if (_watcher && pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { NSPoint loc = [theEvent locationInWindow]; NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]]; NSRect contentFrame = [[self.window contentView] frame]; @@ -162,6 +163,7 @@ static bool isMouseEvent(NSEvent *ev) - (void)detachFromPlatformWindow { _platformWindow = 0; + _watcher.clear(); [self.window.delegate release]; self.window.delegate = nil; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 12629700ec..66df5c724b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -426,7 +426,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; // set the active window to zero here, the new key window's // NSWindowDidBecomeKeyNotification hander will change the active window NSWindow *keyWindow = [NSApp keyWindow]; - if (!keyWindow) { + if (!keyWindow || keyWindow == windowNotification.object) { // no new key window, go ahead and set the active window to zero if (!m_platformWindow->windowIsPopupType() && !m_isMenuView) QWindowSystemInterface::handleWindowActivated(0); @@ -519,7 +519,7 @@ QT_WARNING_POP m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->getBackingStoreDevicePixelRatio(); - foreach (QRect rect, region.rects()) + for (const QRect &rect : region) [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 395c25c915..759c4d26a5 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -88,10 +88,7 @@ static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransfor if (rgn.isEmpty()) { CGContextAddRect(hd, CGRectMake(0, 0, 0, 0)); } else { - QVector<QRect> rects = rgn.rects(); - const int count = rects.size(); - for (int i = 0; i < count; i++) { - const QRect &r = rects[i]; + for (const QRect &r : rgn) { CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height()); CGContextAddRect(hd, mac_r); } diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro index 005a4da6db..f4c3b5cc3b 100644 --- a/src/plugins/platforms/direct2d/direct2d.pro +++ b/src/plugins/platforms/direct2d/direct2d.pro @@ -4,7 +4,7 @@ QT *= core-private QT *= gui-private QT *= platformsupport-private -LIBS *= -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32 +LIBS += -ldwmapi -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32 include(../windows/windows.pri) diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp index 97eadb207b..38f2352934 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp @@ -95,7 +95,7 @@ void QWindowsDirect2DBackingStore::beginPaint(const QRegion ®ion) painter.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) painter.fillRect(r, clear); } @@ -127,10 +127,14 @@ void QWindowsDirect2DBackingStore::resize(const QSize &size, const QRegion ®i QPixmap *newPixmap = nativeWindow(window())->pixmap(); if (!old.isNull()) { - foreach (const QRect &rect, region.rects()) { + for (const QRect &rect : region) platformPixmap(newPixmap)->copy(old.handle(), rect); - } } } +QImage QWindowsDirect2DBackingStore::toImage() const +{ + return nativeWindow(window())->pixmap()->toImage(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h index 9d754866cc..670c4e9840 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h @@ -60,6 +60,8 @@ public: QPaintDevice *paintDevice() Q_DECL_OVERRIDE; void flush(QWindow *targetWindow, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; + + QImage toImage() const override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp index 4e677166b2..c750b02078 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp @@ -122,7 +122,7 @@ void QWindowsDirect2DWindow::flush(QWindowsDirect2DBitmap *bitmap, const QRegion QRegion clipped = region; clipped &= QRect(QPoint(), size); - foreach (const QRect &rect, clipped.rects()) { + for (const QRect &rect : clipped) { QRectF rectF(rect); dc->DrawBitmap(bitmap->bitmap(), to_d2d_rect_f(rectF), diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp index 0bcf93aa3d..8d5e1e50c4 100644 --- a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp @@ -70,9 +70,7 @@ void QDirectFbBackingStore::flush(QWindow *, const QRegion ®ion, const QPoint { m_pmdata->blittable()->unlock(); - QVector<QRect> rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); + for (const QRect &rect : region) { DFBRegion dfbReg(rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()); m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); } @@ -108,13 +106,15 @@ bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy) if (area.rectCount() == 1) { scrollSurface(m_dfbSurface.data(), area.boundingRect(), dx, dy); } else { - const QVector<QRect> rects = area.rects(); - const int n = rects.size(); - for (int i=0; i<n; ++i) { - scrollSurface(m_dfbSurface.data(), rects.at(i), dx, dy); - } + for (const QRect &rect : area) + scrollSurface(m_dfbSurface.data(), rect, dx, dy); } return true; } +QImage QDirectFbBackingStore::toImage() const +{ + return m_pixmap.data()->toImage(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.h b/src/plugins/platforms/directfb/qdirectfbbackingstore.h index 33ab1c111d..af1ce92e64 100644 --- a/src/plugins/platforms/directfb/qdirectfbbackingstore.h +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.h @@ -59,6 +59,8 @@ public: void resize (const QSize &size, const QRegion &staticContents); bool scroll(const QRegion &area, int dx, int dy); + QImage toImage() const override; + private: void lockSurfaceToImage(); diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index 8d82364cc0..f49f81912e 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -493,7 +493,7 @@ void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity) Q_UNUSED(activity); Q_ASSERT(activity == kCFRunLoopExit); - if (m_processEventLevel == 1 && !QThreadData::current()->eventLoops.top()->isRunning()) { + if (m_processEventLevel == 1 && !currentEventLoop()->isRunning()) { qEventDispatcherDebug() << "Root runloop level exited"; interruptEventLoopExec(); } diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index d123bdf82d..025dc22111 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -414,9 +414,8 @@ QRegion QLinuxFbScreen::doRedraw() if (!mBlitter) mBlitter = new QPainter(&mFbScreenImage); - QVector<QRect> rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - mBlitter->drawImage(rects[i], *mScreenImage, rects[i]); + for (const QRect &rect : touched) + mBlitter->drawImage(rect, *mScreenImage, rect); return touched; } diff --git a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp index 465ad355b9..f80d85842a 100644 --- a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp +++ b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp @@ -100,7 +100,7 @@ void QMirClientBackingStore::updateTexture() QRegion fixed; QRect imageRect = mImage.rect(); - Q_FOREACH (const QRect &rect, mDirty.rects()) { + for (const QRect &rect : mDirty) { // intersect with image rect to be sure QRect r = imageRect & rect; @@ -113,7 +113,7 @@ void QMirClientBackingStore::updateTexture() fixed |= r; } - Q_FOREACH (const QRect &rect, fixed.rects()) { + for (const QRect &rect : fixed) { // if the sub-rect is full-width we can pass the image data directly to // OpenGL instead of copying, since there is no gap between scanlines if (rect.width() == imageRect.width()) { diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp index ed1a81c2b3..a63aacdbfe 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp +++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp @@ -179,9 +179,8 @@ bool QOffscreenBackingStore::scroll(const QRegion &area, int dx, int dy) if (m_image.isNull()) return false; - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + for (const QRect &rect : area) + qt_scrollRectInImage(m_image, rect, QPoint(dx, dy)); return true; } diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp index a08ac2b839..90a09d3087 100644 --- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp @@ -97,7 +97,7 @@ void QQnxButtonEventNotifier::start() m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read); QObject::connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(updateButtonStates())); - qButtonDebug() << "successfully connected to Navigator. fd =" << m_fd; + qButtonDebug("successfully connected to Navigator. fd = %d", m_fd); } void QQnxButtonEventNotifier::updateButtonStates() @@ -121,7 +121,7 @@ void QQnxButtonEventNotifier::updateButtonStates() // Ensure data is null terminated buffer[bytes] = '\0'; - qButtonDebug() << "received PPS message:\n" << buffer; + qButtonDebug("received PPS message:\n%s", buffer); // Process received message QByteArray ppsData = QByteArray::fromRawData(buffer, bytes); diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 79ff74b113..ce3a445d7c 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -721,7 +721,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED, sizeof(caretEvent)); caretEvent.old_pos = lastCaret; caretEvent.new_pos = m_caretPosition; - qInputContextDebug() << "ictrl_dispatch_event caret changed" << lastCaret << m_caretPosition; + qInputContextDebug("ictrl_dispatch_event caret changed %d %d", lastCaret, m_caretPosition); p_ictrl_dispatch_event(&caretEvent.event); } } @@ -914,7 +914,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan navigation_event_t navEvent; initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key, sizeof(navEvent)); navEvent.magnitude = 1; - qInputContextDebug() << "ictrl_dispatch_even navigation" << key; + qInputContextDebug("ictrl_dispatch_even navigation %d", key); p_ictrl_dispatch_event(&navEvent.event); } } else { @@ -927,7 +927,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan keyEvent.sequence_id = sequenceId; p_ictrl_dispatch_event(&keyEvent.event); - qInputContextDebug() << "ictrl_dispatch_even key" << key; + qInputContextDebug("ictrl_dispatch_even key %d", key); } return true; @@ -943,7 +943,7 @@ void QQnxInputContext::updateCursorPosition() QCoreApplication::sendEvent(input, &query); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug() << m_caretPosition; + qInputContextDebug("%d", m_caretPosition); } void QQnxInputContext::endComposition() @@ -1116,7 +1116,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) int flags = KEY_SYM_VALID | KEY_CAP_VALID; if (event->event_id == IMF_KEY_DOWN) flags |= KEY_DOWN; - qInputContextDebug() << "EVENT_KEY" << flags << keySym; + qInputContextDebug("EVENT_KEY %d %d", flags, keySym); QQnxScreenEventHandler::injectKeyboardEvent(flags, keySym, modifiers, 0, keyCap); result = 0; break; @@ -1156,7 +1156,7 @@ int32_t QQnxInputContext::onCommitText(spannable_string_t *text, int32_t new_cur int32_t QQnxInputContext::onDeleteSurroundingText(int32_t left_length, int32_t right_length) { - qInputContextDebug() << "L:" << left_length << " R:" << right_length; + qInputContextDebug("L: %d R: %d", int(left_length), int(right_length)); QObject *input = qGuiApp->focusObject(); if (!input) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 3a0e97af6e..9d38742d6f 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -453,11 +453,11 @@ void QQnxIntegration::createDisplays() Q_SCREEN_CHECKERROR(result, "Failed to query display attachment"); if (!isAttached) { - qIntegrationDebug() << "Skipping non-attached display" << i; + qIntegrationDebug("Skipping non-attached display %d", i); continue; } - qIntegrationDebug() << "Creating screen for display" << i; + qIntegrationDebug("Creating screen for display %d", i); createDisplay(displays[i], /*isPrimary=*/false); } // of displays iteration } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp index 4955938a3a..0e16764b79 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp @@ -63,14 +63,14 @@ bool QQnxNavigatorEventHandler::handleOrientationCheck(int angle) { // reply to navigator that (any) orientation is acceptable // TODO: check if top window flags prohibit orientation change - qNavigatorEventHandlerDebug() << "angle=" << angle; + qNavigatorEventHandlerDebug("angle=%d", angle); return true; } void QQnxNavigatorEventHandler::handleOrientationChange(int angle) { // update screen geometry and reply to navigator that we're ready - qNavigatorEventHandlerDebug() << "angle=" << angle; + qNavigatorEventHandlerDebug("angle=%d", angle); emit rotationChanged(angle); } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp index 9ccda2d94a..1f630863b7 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp @@ -91,8 +91,7 @@ void QQnxNavigatorEventNotifier::start() errno = 0; m_fd = open(navigatorControlPath, O_RDWR); if (m_fd == -1) { - qNavigatorEventNotifierDebug() << "failed to open navigator pps:" - << strerror(errno); + qNavigatorEventNotifierDebug("failed to open navigator pps: %s", strerror(errno)); return; } diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp index fd1bbc4a85..d5234ca92f 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp @@ -79,7 +79,7 @@ bool QQnxNavigatorPps::openPpsConnection() return false; } - qNavigatorDebug() << "successfully connected to Navigator. fd=" << m_fd; + qNavigatorDebug("successfully connected to Navigator. fd=%d", m_fd); return true; } diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index c9a89def41..a758bdf7f4 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -139,7 +139,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) platformWindow()->adjustBufferSize(); if (window()->requestedFormat().alphaBufferSize() > 0) { - foreach (const QRect &r, region.rects()) { + for (const QRect &r : region) { // Clear transparent regions const int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index 0fe80d856d..b075690e3d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -208,10 +208,9 @@ void QQnxRasterWindow::blitPreviousToCurrent(const QRegion ®ion, int dx, int QQnxBuffer &previousBuffer = m_buffers[m_previousBufferIndex]; // Break down region into non-overlapping rectangles - const QVector<QRect> rects = region.rects(); - for (int i = rects.size() - 1; i >= 0; i--) { + for (auto rit = region.rbegin(), rend = region.rend(); rit != rend; ++rit) { // Clip rectangle to bounds of target - const QRect rect = rects[i].intersected(currentBuffer.rect()); + const QRect rect = rit->intersected(currentBuffer.rect()); if (rect.isEmpty()) continue; diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 16ddcd784b..678e83cd57 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -340,11 +340,12 @@ qreal QQnxScreen::refreshRate() const qWarning("QQnxScreen: Failed to query screen mode. Using default value of 60Hz"); return 60.0; } - qScreenDebug() << "screen mode:" << endl - << " width =" << displayMode.width << endl - << " height =" << displayMode.height << endl - << " refresh =" << displayMode.refresh << endl - << " interlaced =" << displayMode.interlaced; + qScreenDebug("screen mode:\n" + " width = %u\n" + " height = %u\n" + " refresh = %u\n" + " interlaced = %u", + uint(displayMode.width), uint(displayMode.height), uint(displayMode.refresh), uint(displayMode.interlaced)); return static_cast<qreal>(displayMode.refresh); } @@ -404,7 +405,7 @@ static bool isOrthogonal(int angle1, int angle2) void QQnxScreen::setRotation(int rotation) { - qScreenDebug() << "orientation =" << rotation; + qScreenDebug("orientation = %d", rotation); // Check if rotation changed // We only want to rotate if we are the primary screen if (m_currentRotation != rotation && isPrimaryScreen()) { diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 599d43a8c8..42651732c2 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -147,7 +147,7 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType) default: // event ignored - qScreenEventDebug() << "unknown event" << qnxType; + qScreenEventDebug("unknown event %d", qnxType); return false; } diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index 1174dc6ab3..025c03c058 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -164,7 +164,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() { ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1); - qVirtualKeyboardDebug() << "keyboardMessage size: " << nread; + qVirtualKeyboardDebug("keyboardMessage size: %zd", nread); if (nread < 0){ connect(); // reconnect return; @@ -230,7 +230,7 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage() } setHeight(newHeight); - qVirtualKeyboardDebug() << "size=" << newHeight; + qVirtualKeyboardDebug("size=%d", newHeight); } bool QQnxVirtualKeyboardPps::showKeyboard() diff --git a/src/plugins/platforms/windows/accessible/accessible.pri b/src/plugins/platforms/windows/accessible/accessible.pri index 0774d907f2..0e3aacc558 100644 --- a/src/plugins/platforms/windows/accessible/accessible.pri +++ b/src/plugins/platforms/windows/accessible/accessible.pri @@ -6,15 +6,13 @@ HEADERS += \ $$PWD/qwindowsaccessibility.h \ $$PWD/comutils.h -!wince: { - SOURCES += $$PWD/qwindowsmsaaaccessible.cpp - HEADERS += $$PWD/qwindowsmsaaaccessible.h +SOURCES += $$PWD/qwindowsmsaaaccessible.cpp +HEADERS += $$PWD/qwindowsmsaaaccessible.h - !mingw: { - SOURCES += $$PWD/iaccessible2.cpp - HEADERS += $$PWD/iaccessible2.h - include(../../../../3rdparty/iaccessible2/iaccessible2.pri) - } +!mingw: { + SOURCES += $$PWD/iaccessible2.cpp + HEADERS += $$PWD/iaccessible2.h + include(../../../../3rdparty/iaccessible2/iaccessible2.pri) } mingw: LIBS *= -luuid diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp index 7655bdf622..1c072c5e2c 100644 --- a/src/plugins/platforms/windows/accessible/comutils.cpp +++ b/src/plugins/platforms/windows/accessible/comutils.cpp @@ -170,7 +170,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN case QVariant::LongLong: if (out && arg.vt == (VT_CY|VT_BYREF)) { arg.pcyVal->int64 = qvar.toLongLong(); -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 } else if (out && arg.vt == (VT_I8|VT_BYREF)) { *arg.pllVal = qvar.toLongLong(); } else { @@ -181,22 +180,11 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN arg.vt |= VT_BYREF; } } -#else - } else { - arg.vt = VT_CY; - arg.cyVal.int64 = qvar.toLongLong(); - if (out) { - arg.pcyVal = new CY(arg.cyVal); - arg.vt |= VT_BYREF; - } - } -#endif break; case QVariant::ULongLong: if (out && arg.vt == (VT_CY|VT_BYREF)) { arg.pcyVal->int64 = qvar.toULongLong(); -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 } else if (out && arg.vt == (VT_UI8|VT_BYREF)) { *arg.pullVal = qvar.toULongLong(); } else { @@ -207,18 +195,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN arg.vt |= VT_BYREF; } } -#else - } else { - arg.vt = VT_CY; - arg.cyVal.int64 = qvar.toULongLong(); - if (out) { - arg.pcyVal = new CY(arg.cyVal); - arg.vt |= VT_BYREF; - } - } - -#endif - break; case QVariant::Bool: diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index 4a3f0ccb2b..08edf816b0 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -56,12 +56,10 @@ #include <QtGui/qguiapplication.h> #include "qwindowsaccessibility.h" -#if !defined(Q_OS_WINCE) -# ifdef Q_CC_MINGW -# include "qwindowsmsaaaccessible.h" -# else -# include "iaccessible2.h" -# endif +#ifdef Q_CC_MINGW +# include "qwindowsmsaaaccessible.h" +#else +# include "iaccessible2.h" #endif #include "comutils.h" @@ -74,11 +72,7 @@ #include <winuser.h> #if !defined(WINABLEAPI) -# if defined(Q_OS_WINCE) -# include <bldver.h> -# else -# include <winable.h> -# endif +# include <winable.h> #endif #include <servprov.h> @@ -153,10 +147,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) } } -#if defined(Q_OS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0 - // There is no user32.lib nor NotifyWinEvent for CE - return; -#else // An event has to be associated with a window, // so find the first parent that is a widget and that has a WId QAccessibleInterface *iface = event->accessibleInterface(); @@ -179,7 +169,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) event->type() != QAccessible::ObjectDestroyed) { ::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface)); } -#endif // Q_OS_WINCE } QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface) @@ -202,11 +191,6 @@ QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface) */ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) { -#if defined(Q_OS_WINCE) - Q_UNUSED(acc); - - return 0; -#else if (!acc) return 0; @@ -222,12 +206,10 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) IAccessible *iacc = 0; wacc->QueryInterface(IID_IAccessible, reinterpret_cast<void **>(&iacc)); return iacc; -#endif // defined(Q_OS_WINCE) } bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult) { -#if !defined(Q_OS_WINCE) if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) { /* For UI Automation */ } else if (DWORD(lParam) == DWORD(OBJID_CLIENT)) { @@ -263,12 +245,6 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W } } } -#else - Q_UNUSED(hwnd); - Q_UNUSED(wParam); - Q_UNUSED(lParam); - Q_UNUSED(lResult); -#endif // !defined(Q_OS_WINCE) return false; } diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h deleted file mode 100644 index 309191537a..0000000000 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMFUNCTIONS_WCE_H -#define QPLATFORMFUNCTIONS_WCE_H -// -// W A R N I N G -// ------------- -// -// This file is part of the QPA API and is not meant to be used -// in applications. Usage of this API may make your code -// source and binary incompatible with future versions of Qt. -// - -#ifdef Q_OS_WINCE -#include <QtCore/qfunctions_wince.h> -#define UNDER_NT -#include <wingdi.h> -#include <objidl.h> - -#ifndef WM_MOUSELEAVE -# define WM_MOUSELEAVE 0x02A3 -#endif - -#ifndef WM_TOUCH -# define WM_TOUCH 0x0240 -#endif - -#ifndef WM_GETOBJECT -#define WM_GETOBJECT 0x003D -#endif - -#define GetWindowLongPtr GetWindowLong -#define SetWindowLongPtr SetWindowLong -#define GWLP_USERDATA GWL_USERDATA - -#ifndef CWP_SKIPINVISIBLE -#define CWP_SKIPINVISIBLE 0x0001 -#define CWP_SKIPTRANSPARENT 0x0004 -#endif - -#ifndef CS_OWNDC -#define CS_OWNDC 0x0020 -#endif - -#ifndef HWND_MESSAGE -#define HWND_MESSAGE 0 -#endif - -// Real Value would be 0x40000000, but if we pass this to Windows Embedded Compact -// he blits it wrongly, so lets not do any harm and define it to 0 -#ifndef CAPTUREBLT -#define CAPTUREBLT (DWORD)0x0 -#endif - -#define SW_SHOWMINIMIZED SW_MINIMIZE -#define SW_SHOWMINNOACTIVE SW_MINIMIZE - -#ifndef CF_DIBV5 -#define CF_DIBV5 17 -#endif - -#ifndef WM_MOUSEACTIVATE -#define WM_MOUSEACTIVATE 0x0021 -#endif - -#ifndef WM_CHILDACTIVATE -#define WM_CHILDACTIVATE 0x0022 -#endif - -#ifndef WM_PARENTNOTIFY -#define WM_PARENTNOTIFY 0x0210 -#endif - -#ifndef WM_ENTERIDLE -#define WM_ENTERIDLE 0x0121 -#endif - -#ifndef WM_GETMINMAXINFO -#define WM_GETMINMAXINFO 0x0024 -#endif - -#ifndef WM_WINDOWPOSCHANGING -#define WM_WINDOWPOSCHANGING 0x0046 -#endif - -#ifndef WM_NCMOUSEMOVE -#define WM_NCMOUSEMOVE 0x00A0 -#endif - -#ifndef WM_NCMBUTTONDBLCLK -#define WM_NCMBUTTONDBLCLK 0x00A -#endif - -#ifndef WM_NCCREATE -#define WM_NCCREATE 0x0081 -#endif - -#ifndef WM_NCCALCSIZE -#define WM_NCCALCSIZE 0x0083 -#endif - -#ifndef WM_NCACTIVATE -#define WM_NCACTIVATE 0x0086 -#endif - -#ifndef WM_NCMOUSELEAVE -#define WM_NCMOUSELEAVE 0x02A2 -#endif - -#ifndef WM_NCLBUTTONDOWN -#define WM_NCLBUTTONDOWN 0x00A1 -#endif - -#ifndef WM_NCLBUTTONUP -#define WM_NCLBUTTONUP 0x00A2 -#endif - -#ifndef WM_NCPAINT -#define WM_NCPAINT 0x0085 -#endif - -#ifndef WM_NCHITTEST -#define WM_NCHITTEST 0x0084 -#endif - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - -#ifndef WM_DISPLAYCHANGE -#define WM_DISPLAYCHANGE 0x007E -#endif - -#ifndef VREFRESH -#define VREFRESH 116 -#endif - -#ifndef SM_SWAPBUTTON -#define SM_SWAPBUTTON 23 -#endif - -// application defines -#define SPI_SETNONCLIENTMETRICS 72 -#define SPI_SETICONTITLELOGFONT 0x0022 -#define WM_ACTIVATEAPP 0x001c -#define SW_PARENTCLOSING 1 -#define SW_OTHERMAXIMIZED 2 -#define SW_PARENTOPENING 3 -#define SW_OTHERRESTORED 4 -#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) - -// drag n drop -#ifndef CFSTR_PERFORMEDDROPEFFECT -#define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect") -#endif - -// QWidget -#define SW_SHOWMINIMIZED SW_MINIMIZE - -// QRegion -#define ALTERNATE 0 -#define WINDING 1 - -// QFontEngine -typedef struct _FIXED { - WORD fract; - short value; -} FIXED; - -typedef struct tagPOINTFX { - FIXED x; - FIXED y; -} POINTFX; - -typedef struct _MAT2 { - FIXED eM11; - FIXED eM12; - FIXED eM21; - FIXED eM22; -} MAT2; - -typedef struct _GLYPHMETRICS { - UINT gmBlackBoxX; - UINT gmBlackBoxY; - POINT gmptGlyphOrigin; - short gmCellIncX; - short gmCellIncY; -} GLYPHMETRICS; - -typedef struct tagTTPOLYGONHEADER -{ - DWORD cb; - DWORD dwType; - POINTFX pfxStart; -} TTPOLYGONHEADER; - -typedef struct tagTTPOLYCURVE -{ - WORD wType; - WORD cpfx; - POINTFX apfx[1]; -} TTPOLYCURVE; - -#define GGO_NATIVE 2 -#define GGO_GLYPH_INDEX 0x0080 -#define TT_PRIM_LINE 1 -#define TT_PRIM_QSPLINE 2 -#define TT_PRIM_CSPLINE 3 -#define ANSI_VAR_FONT 12 - -#ifndef OleInitialize -#define OleInitialize(a) 0 -#endif - -#ifndef SPI_GETSNAPTODEFBUTTON -#define SPI_GETSNAPTODEFBUTTON 95 -#endif - -#ifndef WS_EX_LAYERED -#define WS_EX_LAYERED 0x00080000 -#endif - -// Clipboard -------------------------------------------------------- -#ifndef WM_CHANGECBCHAIN -#define WM_CHANGECBCHAIN 0x030D -#endif - -#ifndef WM_DRAWCLIPBOARD -#define WM_DRAWCLIPBOARD 0x0308 -#endif - -#include <QFileInfo> - -inline bool IsIconic( HWND /*hWnd*/ ) -{ - return false; -} - -inline int AddFontResourceExW( LPCWSTR name, DWORD /*fl*/, PVOID /*res*/) -{ - QString fName = QString::fromWCharArray(name); - QFileInfo fileinfo(fName); - fName = fileinfo.absoluteFilePath(); - return AddFontResource((LPCWSTR)fName.utf16()); -} - -inline bool RemoveFontResourceExW( LPCWSTR /*name*/, DWORD /*fl*/, PVOID /*pdv*/) -{ - return 0; -} - -inline void OleUninitialize() -{ -} - -inline DWORD GetGlyphOutline( HDC /*hdc*/, UINT /*uChar*/, INT /*fuFormat*/, GLYPHMETRICS * /*lpgm*/, - DWORD /*cjBuffer*/, LPVOID /*pvBuffer*/, CONST MAT2 * /*lpmat2*/ ) -{ - qFatal("GetGlyphOutline() not supported under Windows CE. Please try using freetype font-rendering, by " - "passing the command line argument -platform windows:fontengine=freetype to the application."); - return GDI_ERROR; -} - -inline HWND GetAncestor(HWND hWnd, UINT /*gaFlags*/) -{ - return GetParent(hWnd); -} - -#ifndef GA_PARENT -# define GA_PARENT 1 -#endif - -#ifndef SPI_SETFONTSMOOTHINGTYPE -# define SPI_SETFONTSMOOTHINGTYPE 0x200B -#endif -#ifndef SPI_GETFONTSMOOTHINGTYPE -# define SPI_GETFONTSMOOTHINGTYPE 0x200A -#endif -#ifndef FE_FONTSMOOTHINGCLEARTYPE -# define FE_FONTSMOOTHINGCLEARTYPE 0x0002 -#endif - -#ifndef DEVICE_FONTTYPE -#define DEVICE_FONTTYPE 0x0002 -#endif - -#ifndef RASTER_FONTTYPE -#define RASTER_FONTTYPE 0x0001 -#endif - -#ifndef WM_DISPLAYCHANGE -#define WM_DISPLAYCHANGE 0x007E -#endif - -BOOL qt_wince_ChangeClipboardChain( - HWND hWndRemove, // handle to window to remove - HWND hWndNewNext // handle to next window -); -#define ChangeClipboardChain(a,b) qt_wince_ChangeClipboardChain(a,b); - -HWND qt_wince_SetClipboardViewer( - HWND hWndNewViewer // handle to clipboard viewer window -); -#define SetClipboardViewer(a) qt_wince_SetClipboardViewer(a) - -/* Shell stock icon IDs - SHGetStockIconInfo() is not available on CE, but we're using these - constants in code that is built on CE as well */ - enum - { - SIID_INVALID = -1, - SIID_DOCNOASSOC = 0, - SIID_FOLDER = 3, - SIID_FOLDEROPEN = 4, - SIID_DRIVE35 = 6, - SIID_DRIVEFIXED = 8, - SIID_DRIVENET = 9, - SIID_DRIVECD = 11, - SIID_HELP = 23, - SIID_RECYCLER = 31, - SIID_DRIVEDVD = 59, - SIID_SHIELD = 77, - SIID_WARNING = 78, - SIID_INFO = 79, - SIID_ERROR = 80 -}; - -#ifndef SHGSI_LINKOVERLAY -// Value is wrong, but doesn't matter, not used at runtime -#define SHGSI_LINKOVERLAY 0 -#endif - -#endif // Q_OS_WINCE -#endif // QPLATFORMFUNCTIONS_WCE_H diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 90008663e7..cb85856787 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -43,9 +43,6 @@ #include "qtwindows_additional.h" #include <QtCore/qnamespace.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif QT_BEGIN_NAMESPACE @@ -158,10 +155,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: return QtWindows::MouseWheelEvent; -#ifndef Q_OS_WINCE case WM_WINDOWPOSCHANGING: return QtWindows::GeometryChangingEvent; -#endif case WM_MOVE: return QtWindows::MoveEvent; case WM_SHOWWINDOW: @@ -172,10 +167,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ResizeEvent; case WM_NCCALCSIZE: return QtWindows::CalculateSize; -#ifndef Q_OS_WINCE case WM_NCHITTEST: return QtWindows::NonClientHitTest; -#endif // !Q_OS_WINCE case WM_GETMINMAXINFO: return QtWindows::QuerySizeHints; case WM_KEYDOWN: // keyboard event @@ -243,12 +236,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ContextMenu; #endif case WM_SYSCOMMAND: -#ifndef Q_OS_WINCE if ((wParamIn & 0xfff0) == SC_CONTEXTHELP) return QtWindows::WhatsThisEvent; -#endif break; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) case WM_QUERYENDSESSION: return QtWindows::QueryEndSessionApplicationEvent; case WM_ENDSESSION: diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 7123ed826d..3b7374dc92 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -87,7 +87,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, QWindowsWindow *rw = QWindowsWindow::windowsWindowOf(window); Q_ASSERT(rw); -#ifndef Q_OS_WINCE const bool hasAlpha = rw->format().hasAlpha(); const Qt::WindowFlags flags = window->flags(); if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) { @@ -101,21 +100,16 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA}; - if (QWindowsContext::user32dll.updateLayeredWindowIndirect) { - RECT dirty = {dirtyRect.x(), dirtyRect.y(), - dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; - UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; - const BOOL result = QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); - if (!result) - qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d)," - " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(), - r.width(), r.height(), dirtyRect.width(), dirtyRect.height(), - dirtyRect.x(), dirtyRect.y()); - } else { - QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA); - } + RECT dirty = {dirtyRect.x(), dirtyRect.y(), + dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; + UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; + const BOOL result = UpdateLayeredWindowIndirect(rw->handle(), &info); + if (!result) + qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d)," + " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(), + r.width(), r.height(), dirtyRect.width(), dirtyRect.height(), + dirtyRect.x(), dirtyRect.y()); } else { -#endif const HDC dc = rw->getDC(); if (!dc) { qErrnoWarning("%s: GetDC failed", __FUNCTION__); @@ -129,9 +123,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, qErrnoWarning(int(lastError), "%s: BitBlt failed", __FUNCTION__); } rw->releaseDC(); -#ifndef Q_OS_WINCE } -#endif // Write image for debug purposes. if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) { @@ -175,7 +167,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) staticRegion &= QRect(0, 0, newimg.width(), newimg.height()); QPainter painter(&newimg); painter.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &rect, staticRegion.rects()) + for (const QRect &rect : staticRegion) painter.drawImage(rect, oldimg, rect); } @@ -190,10 +182,9 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) if (m_image.isNull() || m_image->image().isNull()) return false; - const QVector<QRect> rects = area.rects(); const QPoint offset(dx, dy); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image->image(), rects.at(i), offset); + for (const QRect &rect : area) + qt_scrollRectInImage(m_image->image(), rect, offset); return true; } @@ -207,7 +198,7 @@ void QWindowsBackingStore::beginPaint(const QRegion ®ion) QPainter p(&m_image->image()); p.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) p.fillRect(r, blank); } } @@ -219,8 +210,6 @@ HDC QWindowsBackingStore::getDC() const return 0; } -#ifndef QT_NO_OPENGL - QImage QWindowsBackingStore::toImage() const { if (m_image.isNull()) { @@ -230,6 +219,4 @@ QImage QWindowsBackingStore::toImage() const return m_image.data()->image(); } -#endif // !QT_NO_OPENGL - QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h index 26c79348a9..5cd621375d 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.h +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -65,9 +65,7 @@ public: HDC getDC() const; -#ifndef QT_NO_OPENGL QImage toImage() const Q_DECL_OVERRIDE; -#endif private: QScopedPointer<QWindowsNativeImage> m_image; diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index d527e07308..21bc9d7377 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -237,8 +237,7 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L return; // In rare cases, a clipboard viewer can hang (application crashed, // suspended by a shell prompt 'Select' or debugger). - if (QWindowsContext::user32dll.isHungAppWindow - && QWindowsContext::user32dll.isHungAppWindow(m_nextClipboardViewer)) { + if (IsHungAppWindow(m_nextClipboardViewer)) { qWarning("Cowardly refusing to send clipboard message to hung application..."); return; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index efeb1f5f05..ef0962c2ff 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -51,7 +51,7 @@ #ifndef QT_NO_ACCESSIBILITY # include "accessible/qwindowsaccessibility.h" #endif -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) # include <private/qsessionmanager_p.h> # include "qwindowssessionmanager.h" #endif @@ -76,9 +76,7 @@ #include <stdlib.h> #include <stdio.h> #include <windowsx.h> -#ifndef Q_OS_WINCE -# include <comdef.h> -#endif +#include <comdef.h> QT_BEGIN_NAMESPACE @@ -99,45 +97,29 @@ int QWindowsContext::verbose = 0; # define LANG_SYRIAC 0x5a #endif -static inline bool useRTL_Extensions(QSysInfo::WinVersion ver) +static inline bool useRTL_Extensions() { - // This is SDK dependent on CE so out of scope for now - if (QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - return false; - if ((ver & QSysInfo::WV_NT_based) && (ver >= QSysInfo::WV_VISTA)) { - // Since the IsValidLanguageGroup/IsValidLocale functions always return true on - // Vista, check the Keyboard Layouts for enabling RTL. - if (const int nLayouts = GetKeyboardLayoutList(0, 0)) { - QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]); - GetKeyboardLayoutList(nLayouts, lpList.data()); - for (int i = 0; i < nLayouts; ++i) { - switch (PRIMARYLANGID((quintptr)lpList[i])) { - case LANG_ARABIC: - case LANG_HEBREW: - case LANG_FARSI: - case LANG_SYRIAC: - return true; - default: - break; - } + // Since the IsValidLanguageGroup/IsValidLocale functions always return true on + // Vista, check the Keyboard Layouts for enabling RTL. + if (const int nLayouts = GetKeyboardLayoutList(0, 0)) { + QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]); + GetKeyboardLayoutList(nLayouts, lpList.data()); + for (int i = 0; i < nLayouts; ++i) { + switch (PRIMARYLANGID((quintptr)lpList[i])) { + case LANG_ARABIC: + case LANG_HEBREW: + case LANG_FARSI: + case LANG_SYRIAC: + return true; + default: + break; } } - return false; - } // NT/Vista -#ifndef Q_OS_WINCE - // Pre-NT: figure out whether a RTL language is installed - return IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED) - || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED); -#else + } return false; -#endif } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) static inline QWindowsSessionManager *platformSessionManager() { QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp)); QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager)); @@ -160,13 +142,8 @@ static inline QWindowsSessionManager *platformSessionManager() { \internal \ingroup qt-lighthouse-win */ - -#ifndef Q_OS_WINCE - QWindowsUser32DLL::QWindowsUser32DLL() : - setLayeredWindowAttributes(0), updateLayeredWindow(0), - updateLayeredWindowIndirect(0), - isHungAppWindow(0), isTouchWindow(0), + isTouchWindow(0), registerTouchWindow(0), unregisterTouchWindow(0), getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0), addClipboardFormatListener(0), removeClipboardFormatListener(0), @@ -177,20 +154,11 @@ QWindowsUser32DLL::QWindowsUser32DLL() : void QWindowsUser32DLL::init() { QSystemLibrary library(QStringLiteral("user32")); - // MinGW (g++ 3.4.5) accepts only C casts. - setLayeredWindowAttributes = (SetLayeredWindowAttributes)(library.resolve("SetLayeredWindowAttributes")); - updateLayeredWindow = (UpdateLayeredWindow)(library.resolve("UpdateLayeredWindow")); - if (Q_UNLIKELY(!setLayeredWindowAttributes || !updateLayeredWindow)) - qFatal("This version of Windows is not supported (User32.dll is missing the symbols 'SetLayeredWindowAttributes', 'UpdateLayeredWindow')."); - - updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect")); - isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow"); setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware"); - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { - addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); - removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); - } + addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); + removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); + getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences"); setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences"); } @@ -208,38 +176,6 @@ bool QWindowsUser32DLL::initTouch() return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle; } -/*! - \class QWindowsShell32DLL - \brief Struct that contains dynamically resolved symbols of Shell32.dll. - - The stub libraries shipped with the MinGW compiler miss some of the - functions. They need to be retrieved dynamically. - - \sa QWindowsUser32DLL - - \internal - \ingroup qt-lighthouse-win -*/ - -QWindowsShell32DLL::QWindowsShell32DLL() - : sHCreateItemFromParsingName(0) - , sHGetKnownFolderIDList(0) - , sHGetStockIconInfo(0) - , sHGetImageList(0) - , sHCreateItemFromIDList(0) -{ -} - -void QWindowsShell32DLL::init() -{ - QSystemLibrary library(QStringLiteral("shell32")); - sHCreateItemFromParsingName = (SHCreateItemFromParsingName)(library.resolve("SHCreateItemFromParsingName")); - sHGetKnownFolderIDList = (SHGetKnownFolderIDList)(library.resolve("SHGetKnownFolderIDList")); - sHGetStockIconInfo = (SHGetStockIconInfo)library.resolve("SHGetStockIconInfo"); - sHGetImageList = (SHGetImageList)library.resolve("SHGetImageList"); - sHCreateItemFromIDList = (SHCreateItemFromIDList)library.resolve("SHCreateItemFromIDList"); -} - QWindowsShcoreDLL::QWindowsShcoreDLL() : getProcessDpiAwareness(0) , setProcessDpiAwareness(0) @@ -258,11 +194,8 @@ void QWindowsShcoreDLL::init() } QWindowsUser32DLL QWindowsContext::user32dll; -QWindowsShell32DLL QWindowsContext::shell32dll; QWindowsShcoreDLL QWindowsContext::shcoredll; -#endif // !Q_OS_WINCE - QWindowsContext *QWindowsContext::m_instance = 0; /*! @@ -291,7 +224,7 @@ struct QWindowsContextPrivate { QWindowsMimeConverter m_mimeConverter; QWindowsScreenManager m_screenManager; QSharedPointer<QWindowCreationContext> m_creationContext; -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) QScopedPointer<QWindowsTabletSupport> m_tabletSupport; #endif const HRESULT m_oleInitializeResult; @@ -306,18 +239,14 @@ QWindowsContextPrivate::QWindowsContextPrivate() , m_eventType(QByteArrayLiteral("windows_generic_MSG")) , m_lastActiveWindow(0), m_asyncExpose(0) { - const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); -#ifndef Q_OS_WINCE QWindowsContext::user32dll.init(); - QWindowsContext::shell32dll.init(); QWindowsContext::shcoredll.init(); if (m_mouseHandler.touchDevice() && QWindowsContext::user32dll.initTouch()) m_systemInfo |= QWindowsContext::SI_SupportsTouch; -#endif // !Q_OS_WINCE m_displayContext = GetDC(0); m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); - if (useRTL_Extensions(ver)) { + if (useRTL_Extensions()) { m_systemInfo |= QWindowsContext::SI_RTL_Extensions; m_keyMapper.setUseRTLExtensions(true); } @@ -338,7 +267,7 @@ QWindowsContext::QWindowsContext() : const QByteArray bv = qgetenv("QT_QPA_VERBOSE"); if (!bv.isEmpty()) QLoggingCategory::setFilterRules(QString::fromLocal8Bit(bv)); -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) d->m_tabletSupport.reset(QWindowsTabletSupport::create()); qCDebug(lcQpaTablet) << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description()); #endif @@ -346,7 +275,7 @@ QWindowsContext::QWindowsContext() : QWindowsContext::~QWindowsContext() { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) d->m_tabletSupport.reset(); // Destroy internal window before unregistering classes. #endif unregisterWindowClasses(); @@ -371,12 +300,10 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) if (!touchDevice) return false; -#ifndef Q_OS_WINCE if (!QWindowsContext::user32dll.initTouch()) { delete touchDevice; return false; } -#endif // !Q_OS_WINCE if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); @@ -389,7 +316,7 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) void QWindowsContext::setTabletAbsoluteRange(int a) { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->setAbsoluteRange(a); #else @@ -399,19 +326,16 @@ void QWindowsContext::setTabletAbsoluteRange(int a) int QWindowsContext::processDpiAwareness() { -#ifndef Q_OS_WINCE int result; if (QWindowsContext::shcoredll.getProcessDpiAwareness && SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(NULL, &result))) { return result; } -#endif // !Q_OS_WINCE return -1; } void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness) { -#ifndef Q_OS_WINCE qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); @@ -426,9 +350,6 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA qErrnoWarning("SetProcessDPIAware() failed"); } } -#else // !Q_OS_WINCE - Q_UNUSED(dpiAwareness) -#endif } QWindowsContext *QWindowsContext::instance() @@ -559,19 +480,14 @@ QString QWindowsContext::registerWindowClass(QString cname, if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our list return cname; -#ifndef Q_OS_WINCE WNDCLASSEX wc; wc.cbSize = sizeof(WNDCLASSEX); -#else - WNDCLASS wc; -#endif wc.style = style; wc.lpfnWndProc = proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = appInstance; wc.hCursor = 0; -#ifndef Q_OS_WINCE wc.hbrBackground = brush; if (icon) { wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE)); @@ -587,22 +503,10 @@ QString QWindowsContext::registerWindowClass(QString cname, wc.hIcon = 0; wc.hIconSm = 0; } -#else - if (icon) { - wc.hIcon = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); - } else { - wc.hIcon = 0; - } -#endif wc.lpszMenuName = 0; wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16()); -#ifndef Q_OS_WINCE ATOM atom = RegisterClassEx(&wc); -#else - ATOM atom = RegisterClass(&wc); -#endif - if (!atom) qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.", qPrintable(cname)); @@ -720,28 +624,14 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c POINT point = screenPoint; ScreenToClient(*hwnd, &point); // Returns parent if inside & none matched. -#ifndef Q_OS_WINCE const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); -#else -// Under Windows CE we don't use ChildWindowFromPointEx as it's not available -// and ChildWindowFromPoint does not work properly. - Q_UNUSED(cwexFlags) - const HWND child = WindowFromPoint(point); -#endif if (!child || child == *hwnd) return false; if (QWindowsWindow *window = context->findPlatformWindow(child)) { *result = window; *hwnd = child; -#ifndef Q_OS_WINCE return true; -#else -// WindowFromPoint does not return same handle in two sequential calls, which leads -// to an endless loop, but calling WindowFromPoint once is good enough. - return false; -#endif } -#ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT . // QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible // full screen windows of other applications that have WS_EX_TRANSPARENT set // (for example created by screen sharing applications). In that case, try to @@ -757,7 +647,6 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c return true; } } -#endif // !Q_OS_WINCE *hwnd = child; return true; } @@ -784,7 +673,7 @@ QWindowsScreenManager &QWindowsContext::screenManager() QWindowsTabletSupport *QWindowsContext::tabletSupport() const { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) return d->m_tabletSupport.data(); #else return 0; @@ -810,7 +699,6 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn, HWND_MESSAGE, NULL, static_cast<HINSTANCE>(GetModuleHandle(0)), NULL); } -#ifndef Q_OS_WINCE // Re-engineered from the inline function _com_error::ErrorMessage(). // We cannot use it directly since it uses swprintf_s(), which is not // present in the MSVCRT.DLL found on Windows XP (QTBUG-35617). @@ -829,7 +717,6 @@ static inline QString errorMessageFromComError(const _com_error &comError) return QStringLiteral("IDispatch error #") + QString::number(wCode); return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16); } -#endif // !Q_OS_WINCE /*! \brief Common COM error strings. @@ -894,12 +781,10 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr) default: break; } -#ifndef Q_OS_WINCE _com_error error(hr); result += QByteArrayLiteral(" ("); result += errorMessageFromComError(error); result += ')'; -#endif // !Q_OS_WINCE return result; } @@ -935,9 +820,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, ClientToScreen(msg.hwnd, &msg.pt); } } else { -#ifndef Q_OS_WINCE GetCursorPos(&msg.pt); -#endif } // Run the native event filters. @@ -980,7 +863,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, switch (et) { case QtWindows::GestureEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1019,11 +902,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, // Pass on to current creation context if (!platformWindow && !d->m_creationContext.isNull()) { switch (et) { -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO case QtWindows::QuerySizeHints: d->m_creationContext->applyToMinMaxInfo(reinterpret_cast<MINMAXINFO *>(lParam)); return true; -#endif case QtWindows::ResizeEvent: d->m_creationContext->obtainedGeometry.setSize(QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); return true; @@ -1061,7 +942,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodKeyEvent: case QtWindows::InputMethodKeyDownEvent: case QtWindows::AppCommandEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); @@ -1072,7 +953,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::ResizeEvent: platformWindow->handleResized(static_cast<int>(wParam)); return true; -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO case QtWindows::QuerySizeHints: platformWindow->getSizeHints(reinterpret_cast<MINMAXINFO *>(lParam)); return true;// maybe available on some SDKs revisit WM_NCCALCSIZE @@ -1082,30 +962,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return platformWindow->handleNonClientHitTest(QPoint(msg.pt.x, msg.pt.y), result); case QtWindows::GeometryChangingEvent: return platformWindow->QWindowsWindow::handleGeometryChanging(&msg); -#endif // !Q_OS_WINCE case QtWindows::ExposeEvent: return platformWindow->handleWmPaint(hwnd, message, wParam, lParam); case QtWindows::NonClientMouseEvent: if (platformWindow->frameStrutEventsEnabled()) -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif break; -/* the mouse tracking on windows already handles the reset of the cursor - * and does not like somebody else handling it. - * on WINCE its necessary to handle this event to get the correct cursor - */ -#ifdef Q_OS_WINCE - case QtWindows::CursorEvent: - { - QWindowsWindow::baseWindowOf(platformWindow->window())->applyCursor(); - return true; - } -#endif case QtWindows::ScrollEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result); @@ -1113,13 +981,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::MouseWheelEvent: case QtWindows::MouseEvent: case QtWindows::LeaveEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif case QtWindows::TouchEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1152,7 +1020,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::CompositionSettingsChanged: platformWindow->handleCompositionSettingsChanged(); return true; -#ifndef Q_OS_WINCE case QtWindows::ActivateWindowEvent: if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { *result = LRESULT(MA_NOACTIVATE); @@ -1175,7 +1042,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; } break; -#endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: return handleContextMenuEvent(platformWindow->window(), msg); @@ -1186,7 +1052,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; #endif } break; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); if (sessionManager->isActive()) { // bogus message from windows @@ -1226,7 +1092,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } return true; } -#endif // !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#endif // !defined(QT_NO_SESSIONMANAGER) default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 3559335747..32d7800ef5 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -79,38 +79,23 @@ class QPoint; class QKeyEvent; class QTouchDevice; -#ifndef Q_OS_WINCE struct QWindowsUser32DLL { QWindowsUser32DLL(); inline void init(); inline bool initTouch(); - typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); + typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); // Windows 7 typedef BOOL (WINAPI *RegisterTouchWindow)(HWND, ULONG); typedef BOOL (WINAPI *UnregisterTouchWindow)(HWND); typedef BOOL (WINAPI *GetTouchInputInfo)(HANDLE, UINT, PVOID, int); typedef BOOL (WINAPI *CloseTouchInputHandle)(HANDLE); - typedef BOOL (WINAPI *SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); - typedef BOOL (WINAPI *UpdateLayeredWindow)(HWND, HDC , const POINT *, - const SIZE *, HDC, const POINT *, COLORREF, - const BLENDFUNCTION *, DWORD); - typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *); - typedef BOOL (WINAPI *IsHungAppWindow)(HWND); typedef BOOL (WINAPI *SetProcessDPIAware)(); typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND); typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND); typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *); typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); - // Functions missing in Q_CC_GNU stub libraries. - SetLayeredWindowAttributes setLayeredWindowAttributes; - UpdateLayeredWindow updateLayeredWindow; - - // Functions missing in older versions of Windows - UpdateLayeredWindowIndirect updateLayeredWindowIndirect; - IsHungAppWindow isHungAppWindow; - // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC). IsTouchWindow isTouchWindow; RegisterTouchWindow registerTouchWindow; @@ -121,7 +106,8 @@ struct QWindowsUser32DLL // Windows Vista onwards SetProcessDPIAware setProcessDPIAware; - // Clipboard listeners, Windows Vista onwards + // Clipboard listeners are present on Windows Vista onwards + // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5. AddClipboardFormatListener addClipboardFormatListener; RemoveClipboardFormatListener removeClipboardFormatListener; @@ -130,24 +116,6 @@ struct QWindowsUser32DLL SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences; }; -struct QWindowsShell32DLL -{ - QWindowsShell32DLL(); - inline void init(); - - typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **); - typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *); - typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *); - typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **); - typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **); - - SHCreateItemFromParsingName sHCreateItemFromParsingName; - SHGetKnownFolderIDList sHGetKnownFolderIDList; - SHGetStockIconInfo sHGetStockIconInfo; - SHGetImageList sHGetImageList; - SHCreateItemFromIDList sHCreateItemFromIDList; -}; - // Shell scaling library (Windows 8.1 onwards) struct QWindowsShcoreDLL { QWindowsShcoreDLL(); @@ -163,8 +131,6 @@ struct QWindowsShcoreDLL { GetDpiForMonitor getDpiForMonitor; }; -#endif // Q_OS_WINCE - class QWindowsContext { Q_DISABLE_COPY(QWindowsContext) @@ -236,11 +202,9 @@ public: QWindowsMimeConverter &mimeConverter() const; QWindowsScreenManager &screenManager(); QWindowsTabletSupport *tabletSupport() const; -#ifndef Q_OS_WINCE + static QWindowsUser32DLL user32dll; - static QWindowsShell32DLL shell32dll; static QWindowsShcoreDLL shcoredll; -#endif static QByteArray comErrorString(HRESULT hr); bool asyncExpose() const; diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index d02648fade..1bebe88df7 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -56,7 +56,7 @@ static bool initResources() { -#if !defined (Q_OS_WINCE) && !defined (QT_NO_IMAGEFORMAT_PNG) +#if !defined (QT_NO_IMAGEFORMAT_PNG) Q_INIT_RESOURCE(cursors); #endif return true; @@ -143,7 +143,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, if (hotSpot.y() < 0) hotSpot.setY(height / 2); const int n = qMax(1, width / 8); -#if !defined(Q_OS_WINCE) QScopedArrayPointer<uchar> xBits(new uchar[height * n]); QScopedArrayPointer<uchar> xMask(new uchar[height * n]); int x = 0; @@ -164,54 +163,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, } return CreateCursor(GetModuleHandle(0), hotSpot.x(), hotSpot.y(), width, height, xBits.data(), xMask.data()); -#elif defined(GWES_ICONCURS) // Q_OS_WINCE - // Windows CE only supports fixed cursor size. - int sysW = GetSystemMetrics(SM_CXCURSOR); - int sysH = GetSystemMetrics(SM_CYCURSOR); - int sysN = qMax(1, sysW / 8); - uchar* xBits = new uchar[sysH * sysN]; - uchar* xMask = new uchar[sysH * sysN]; - int x = 0; - for (int i = 0; i < sysH; ++i) { - if (i >= height) { - memset(&xBits[x] , 255, sysN); - memset(&xMask[x] , 0, sysN); - x += sysN; - } else { - int fillWidth = n > sysN ? sysN : n; - const uchar *bits = bbits.constScanLine(i); - const uchar *mask = mbits.constScanLine(i); - for (int j = 0; j < fillWidth; ++j) { - uchar b = bits[j]; - uchar m = mask[j]; - if (invb) - b ^= 0xFF; - if (invm) - m ^= 0xFF; - xBits[x] = ~m; - xMask[x] = b ^ m; - ++x; - } - for (int j = fillWidth; j < sysN; ++j ) { - xBits[x] = 255; - xMask[x] = 0; - ++x; - } - } - } - - HCURSOR hcurs = CreateCursor(qWinAppInst(), hotSpot.x(), hotSpot.y(), sysW, sysH, - xBits, xMask); - delete [] xBits; - delete [] xMask; - return hcurs; -#else - Q_UNUSED(n); - Q_UNUSED(invm); - Q_UNUSED(invb); - Q_UNUSED(mbits); - return 0; -#endif } // Create a cursor from image and mask of the format QImage::Format_Mono. @@ -252,7 +203,7 @@ static QSize systemCursorSize(const QPlatformScreen *screen = Q_NULLPTR) return primaryScreenCursorSize; } -#if defined (Q_OS_WINCE) || defined (QT_NO_IMAGEFORMAT_PNG) +#if defined (QT_NO_IMAGEFORMAT_PNG) static inline QSize standardCursorSize() { return QSize(32, 32); } @@ -468,7 +419,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor return QWindowsCursor::PixmapCursor(); } -#else // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +#else // QT_NO_IMAGEFORMAT_PNG struct QWindowsCustomPngCursor { Qt::CursorShape shape; int size; @@ -526,7 +477,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor QString::fromLatin1(bestFit->fileName)); return PixmapCursor(rawImage, QPoint(bestFit->hotSpotX, bestFit->hotSpotY)); } -#endif // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +#endif // !QT_NO_IMAGEFORMAT_PNG struct QWindowsStandardCursorMapping { Qt::CursorShape shape; @@ -575,13 +526,8 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const // Load available standard cursors from resources const QWindowsStandardCursorMapping *sEnd = standardCursors + sizeof(standardCursors) / sizeof(standardCursors[0]); for (const QWindowsStandardCursorMapping *s = standardCursors; s < sEnd; ++s) { - if (s->shape == cursorShape) { -#ifndef Q_OS_WINCE + if (s->shape == cursorShape) return static_cast<HCURSOR>(LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED)); -#else - return LoadCursor(0, s->resource); -#endif - } } qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cursorShape); @@ -677,7 +623,6 @@ QPoint QWindowsCursor::mousePosition() QWindowsCursor::CursorState QWindowsCursor::cursorState() { -#ifndef Q_OS_WINCE enum { cursorShowing = 0x1, cursorSuppressed = 0x2 }; // Windows 8: CURSOR_SUPPRESSED CURSORINFO cursorInfo; cursorInfo.cbSize = sizeof(CURSORINFO); @@ -687,7 +632,6 @@ QWindowsCursor::CursorState QWindowsCursor::cursorState() if (cursorInfo.flags & cursorSuppressed) return CursorSuppressed; } -#endif // !Q_OS_WINCE return CursorHidden; } @@ -758,7 +702,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const "...............XXXX....."}; if (m_ignoreDragCursor.isNull()) { -#if !defined (Q_OS_WINCE) HCURSOR cursor = LoadCursor(NULL, IDC_NO); ICONINFO iconInfo = {0, 0, 0, 0, 0}; GetIconInfo(cursor, &iconInfo); @@ -782,9 +725,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const DeleteObject(iconInfo.hbmMask); DeleteObject(iconInfo.hbmColor); DestroyCursor(cursor); -#else // !Q_OS_WINCE - m_ignoreDragCursor = QPixmap(ignoreDragCursorXpmC); -#endif // !Q_OS_WINCE } return m_ignoreDragCursor; } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index d5e5f87e5c..a237013c87 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -637,7 +637,6 @@ void QWindowsDialogHelperBase<BaseClass>::stopTimer() } } -#ifndef Q_OS_WINCE // Find a file dialog window created by IFileDialog by process id, window // title and class, which starts with a hash '#'. @@ -673,7 +672,6 @@ static inline HWND findDialogWindow(const QString &title) EnumWindows(findDialogEnumWindowsProc, reinterpret_cast<LPARAM>(&context)); return context.hwnd; } -#endif // !Q_OS_WINCE template <class BaseClass> void QWindowsDialogHelperBase<BaseClass>::hide() @@ -989,24 +987,19 @@ void QWindowsNativeFileDialogBase::setWindowTitle(const QString &title) IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) { -#ifndef Q_OS_WINCE if (url.isLocalFile()) { - if (!QWindowsContext::shell32dll.sHCreateItemFromParsingName) - return Q_NULLPTR; IShellItem *result = Q_NULLPTR; const QString native = QDir::toNativeSeparators(url.toLocalFile()); const HRESULT hr = - QWindowsContext::shell32dll.sHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()), - NULL, IID_IShellItem, - reinterpret_cast<void **>(&result)); + SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()), + NULL, IID_IShellItem, + reinterpret_cast<void **>(&result)); if (FAILED(hr)) { qErrnoWarning("%s: SHCreateItemFromParsingName(%s)) failed", __FUNCTION__, qPrintable(url.toString())); return Q_NULLPTR; } return result; } else if (url.scheme() == QLatin1String("clsid")) { - if (!QWindowsContext::shell32dll.sHGetKnownFolderIDList || !QWindowsContext::shell32dll.sHCreateItemFromIDList) - return Q_NULLPTR; // Support for virtual folders via GUID // (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx) // specified as "clsid:<GUID>" (without '{', '}'). @@ -1017,12 +1010,12 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) return Q_NULLPTR; } PIDLIST_ABSOLUTE idList; - HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList); + HRESULT hr = SHGetKnownFolderIDList(uuid, 0, 0, &idList); if (FAILED(hr)) { qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); return Q_NULLPTR; } - hr = QWindowsContext::shell32dll.sHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result)); + hr = SHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result)); CoTaskMemFree(idList); if (FAILED(hr)) { qErrnoWarning("%s: SHCreateItemFromIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); @@ -1032,9 +1025,6 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) } else { qWarning() << __FUNCTION__ << ": Unhandled scheme: " << url.scheme(); } -#else // !Q_OS_WINCE - Q_UNUSED(url) -#endif return 0; } @@ -1050,11 +1040,9 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory) QString QWindowsNativeFileDialogBase::directory() const { -#ifndef Q_OS_WINCE IShellItem *item = 0; if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item) return QWindowsNativeFileDialogBase::itemPath(item); -#endif return QString(); } @@ -1106,7 +1094,7 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, qErrnoWarning("%s: SetOptions() failed", __FUNCTION__); } -#if !defined(Q_OS_WINCE) && defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7 +#if defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7 // Helper for "Libraries": collections of folders appearing from Windows 7 // on, visible in the file dialogs. @@ -1159,7 +1147,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *i return result; } -#else // !Q_OS_WINCE && __IShellLibrary_INTERFACE_DEFINED__ +#else // __IShellLibrary_INTERFACE_DEFINED__ QList<QUrl> QWindowsNativeFileDialogBase::libraryItemFolders(IShellItem *) { @@ -1171,7 +1159,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *) return QString(); } -#endif // Q_OS_WINCE || !__IShellLibrary_INTERFACE_DEFINED__ +#endif // !__IShellLibrary_INTERFACE_DEFINED__ QString QWindowsNativeFileDialogBase::itemPath(IShellItem *item) { @@ -1417,14 +1405,12 @@ bool QWindowsNativeFileDialogBase::onFileOk() void QWindowsNativeFileDialogBase::close() { m_fileDialog->Close(S_OK); -#ifndef Q_OS_WINCE // IFileDialog::Close() does not work unless invoked from a callback. // Try to find the window and send it a WM_CLOSE in addition. const HWND hwnd = findDialogWindow(m_title); qCDebug(lcQpaDialogs) << __FUNCTION__ << "closing" << hwnd; if (hwnd && IsWindowVisible(hwnd)) PostMessageW(hwnd, WM_CLOSE, 0, 0); -#endif // !Q_OS_WINCE } HRESULT QWindowsNativeFileDialogEventHandler::OnFolderChanging(IFileDialog *, IShellItem *item) @@ -1725,8 +1711,6 @@ QString QWindowsFileDialogHelper::selectedNameFilter() const return m_data.selectedNameFilter(); } -#ifndef Q_OS_WINCE - /*! \class QWindowsXpNativeFileDialog \brief Native Windows directory dialog for Windows XP using SHlib-functions. @@ -2050,8 +2034,6 @@ QString QWindowsXpFileDialogHelper::selectedNameFilter() const return m_data.selectedNameFilter(); } -#endif // Q_OS_WINCE - /*! \class QWindowsNativeColorDialog \brief Native Windows color dialog. @@ -2209,17 +2191,13 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type) if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs) return 0; switch (type) { - case QPlatformTheme::FileDialog: -#ifndef Q_OS_WINCE // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003). + case QPlatformTheme::FileDialog: // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003). if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs || QSysInfo::windowsVersion() <= QSysInfo::WV_2003) { return new QWindowsXpFileDialogHelper(); } if (QSysInfo::windowsVersion() > QSysInfo::WV_2003) return new QWindowsFileDialogHelper(); -#else - return new QWindowsFileDialogHelper(); -#endif // Q_OS_WINCE case QPlatformTheme::ColorDialog: #ifdef USE_NATIVE_COLOR_DIALOG return new QWindowsColorDialogHelper(); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 42caeb1c89..96cabb20e4 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -95,13 +95,9 @@ static void *resolveFunc(HMODULE lib, const char *name) return proc; } #else -static void *resolveFunc(HMODULE lib, const char *name) +static inline void *resolveFunc(HMODULE lib, const char *name) { -# ifndef Q_OS_WINCE - return (void *) ::GetProcAddress(lib, name); -# else - return (void *) ::GetProcAddress(lib, (const wchar_t *) QString::fromLatin1(name).utf16()); -# endif // Q_OS_WINCE + return ::GetProcAddress(lib, name); } #endif // Q_CC_MINGW @@ -121,7 +117,7 @@ void *QWindowsLibEGL::resolve(const char *name) bool QWindowsLibEGL::init() { const char dllName[] = QT_STRINGIFY(LIBEGL_NAME) -#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) +#if defined(QT_DEBUG) "d" #endif ""; @@ -178,7 +174,7 @@ bool QWindowsLibGLESv2::init() { const char dllName[] = QT_STRINGIFY(LIBGLESV2_NAME) -#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) +#if defined(QT_DEBUG) "d" #endif ""; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 68a8fc5390..be183034de 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -57,10 +57,6 @@ #include <wchar.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif - #if !defined(QT_NO_DIRECTWRITE) # if defined(QT_USE_DIRECTWRITE2) # include <dwrite_2.h> @@ -947,17 +943,6 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, quint32 codePageRange[2] = { signature->fsCsb[0], signature->fsCsb[1] }; -#ifdef Q_OS_WINCE - if (signature->fsUsb[0] == 0) { - // If the unicode ranges bit mask is zero then - // EnumFontFamiliesEx failed to determine it properly. - // In this case we just pretend that the font supports all languages. - unicodeRange[0] = 0xbfffffff; // second most significant bit must be zero - unicodeRange[1] = 0xffffffff; - unicodeRange[2] = 0xffffffff; - unicodeRange[3] = 0xffffffff; - } -#endif writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange); // ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains // the symbol for Baht, and Windows thus reports that it supports the Thai script. @@ -1117,9 +1102,8 @@ QWindowsFontEngineDataPtr sharedFontData() } #endif // QT_NO_THREAD -#ifndef Q_OS_WINCE extern Q_GUI_EXPORT bool qt_needs_a8_gamma_correction; -#endif + QWindowsFontDatabase::QWindowsFontDatabase() { // Properties accessed by QWin32PrintEngine (Qt Print Support) @@ -1133,9 +1117,7 @@ QWindowsFontDatabase::QWindowsFontDatabase() qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: " << data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma; } -#ifndef Q_OS_WINCE qt_needs_a8_gamma_correction = true; -#endif } QWindowsFontDatabase::~QWindowsFontDatabase() @@ -1586,14 +1568,12 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) int strat = OUT_DEFAULT_PRECIS; if (request.styleStrategy & QFont::PreferBitmap) { strat = OUT_RASTER_PRECIS; -#ifndef Q_OS_WINCE } else if (request.styleStrategy & QFont::PreferDevice) { strat = OUT_DEVICE_PRECIS; } else if (request.styleStrategy & QFont::PreferOutline) { strat = OUT_OUTLINE_PRECIS; } else if (request.styleStrategy & QFont::ForceOutline) { strat = OUT_TT_ONLY_PRECIS; -#endif } lf.lfOutPrecision = strat; @@ -1602,10 +1582,8 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) if (request.styleStrategy & QFont::PreferMatch) qual = DRAFT_QUALITY; -#ifndef Q_OS_WINCE else if (request.styleStrategy & QFont::PreferQuality) qual = PROOF_QUALITY; -#endif if (request.styleStrategy & QFont::PreferAntialias) { if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) { diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index fb75e75dcd..d782519c68 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -53,10 +53,6 @@ #include <QtGui/QFontDatabase> #include <wchar.h> -#ifdef Q_OS_WINCE -#include <QtCore/QFile> -#include <QtEndian> -#endif QT_BEGIN_NAMESPACE @@ -108,8 +104,6 @@ static FontFile * createFontFile(const QString &fileName, int index) extern bool localizedName(const QString &name); extern QString getEnglishName(const QString &familyName); -#ifndef Q_OS_WINCE - namespace { struct FontKey { @@ -165,223 +159,6 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR) return Q_NULLPTR; } -#else // Q_OS_WINCE - -typedef struct { - quint16 majorVersion; - quint16 minorVersion; - quint16 numTables; - quint16 searchRange; - quint16 entrySelector; - quint16 rangeShift; -} OFFSET_TABLE; - -typedef struct { - quint32 tag; - quint32 checkSum; - quint32 offset; - quint32 length; -} TABLE_DIRECTORY; - -typedef struct { - quint16 fontSelector; - quint16 nrCount; - quint16 storageOffset; -} NAME_TABLE_HEADER; - -typedef struct { - quint16 platformID; - quint16 encodingID; - quint16 languageID; - quint16 nameID; - quint16 stringLength; - quint16 stringOffset; -} NAME_RECORD; - -typedef struct { - quint32 tag; - quint16 majorVersion; - quint16 minorVersion; - quint32 numFonts; -} TTC_TABLE_HEADER; - -static QString fontNameFromTTFile(const QString &filename, int startPos = 0) -{ - QFile f(filename); - QString retVal; - qint64 bytesRead; - qint64 bytesToRead; - - if (f.open(QIODevice::ReadOnly)) { - f.seek(startPos); - OFFSET_TABLE ttOffsetTable; - bytesToRead = sizeof(OFFSET_TABLE); - bytesRead = f.read((char*)&ttOffsetTable, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttOffsetTable.numTables = qFromBigEndian(ttOffsetTable.numTables); - ttOffsetTable.majorVersion = qFromBigEndian(ttOffsetTable.majorVersion); - ttOffsetTable.minorVersion = qFromBigEndian(ttOffsetTable.minorVersion); - - if (ttOffsetTable.majorVersion != 1 || ttOffsetTable.minorVersion != 0) - return retVal; - - TABLE_DIRECTORY tblDir; - bool found = false; - - for (int i = 0; i < ttOffsetTable.numTables; i++) { - bytesToRead = sizeof(TABLE_DIRECTORY); - bytesRead = f.read((char*)&tblDir, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - if (qFromBigEndian(tblDir.tag) == MAKE_TAG('n', 'a', 'm', 'e')) { - found = true; - tblDir.length = qFromBigEndian(tblDir.length); - tblDir.offset = qFromBigEndian(tblDir.offset); - break; - } - } - - if (found) { - f.seek(tblDir.offset); - NAME_TABLE_HEADER ttNTHeader; - bytesToRead = sizeof(NAME_TABLE_HEADER); - bytesRead = f.read((char*)&ttNTHeader, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttNTHeader.nrCount = qFromBigEndian(ttNTHeader.nrCount); - ttNTHeader.storageOffset = qFromBigEndian(ttNTHeader.storageOffset); - NAME_RECORD ttRecord; - found = false; - - for (int i = 0; i < ttNTHeader.nrCount; i++) { - bytesToRead = sizeof(NAME_RECORD); - bytesRead = f.read((char*)&ttRecord, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttRecord.nameID = qFromBigEndian(ttRecord.nameID); - if (ttRecord.nameID == 1) { - ttRecord.stringLength = qFromBigEndian(ttRecord.stringLength); - ttRecord.stringOffset = qFromBigEndian(ttRecord.stringOffset); - int nPos = f.pos(); - f.seek(tblDir.offset + ttRecord.stringOffset + ttNTHeader.storageOffset); - - QByteArray nameByteArray = f.read(ttRecord.stringLength); - if (!nameByteArray.isEmpty()) { - if (ttRecord.encodingID == 256 || ttRecord.encodingID == 768) { - //This is UTF-16 in big endian - int stringLength = ttRecord.stringLength / 2; - retVal.resize(stringLength); - QChar *data = retVal.data(); - const ushort *srcData = (const ushort *)nameByteArray.data(); - for (int i = 0; i < stringLength; ++i) - data[i] = qFromBigEndian(srcData[i]); - return retVal; - } else if (ttRecord.encodingID == 0) { - //This is Latin1 - retVal = QString::fromLatin1(nameByteArray); - } else { - qWarning("Could not retrieve Font name from file: %s", qPrintable(QDir::toNativeSeparators(filename))); - } - break; - } - f.seek(nPos); - } - } - } - f.close(); - } - return retVal; -} - -static QStringList fontNamesFromTTCFile(const QString &filename) -{ - QFile f(filename); - QStringList retVal; - qint64 bytesRead; - qint64 bytesToRead; - - if (f.open(QIODevice::ReadOnly)) { - TTC_TABLE_HEADER ttcTableHeader; - bytesToRead = sizeof(TTC_TABLE_HEADER); - bytesRead = f.read((char*)&ttcTableHeader, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttcTableHeader.majorVersion = qFromBigEndian(ttcTableHeader.majorVersion); - ttcTableHeader.minorVersion = qFromBigEndian(ttcTableHeader.minorVersion); - ttcTableHeader.numFonts = qFromBigEndian(ttcTableHeader.numFonts); - - if (ttcTableHeader.majorVersion < 1 || ttcTableHeader.majorVersion > 2) - return retVal; - QVarLengthArray<quint32> offsetTable(ttcTableHeader.numFonts); - bytesToRead = sizeof(quint32) * ttcTableHeader.numFonts; - bytesRead = f.read((char*)offsetTable.data(), bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - f.close(); - for (int i = 0; i < (int)ttcTableHeader.numFonts; ++i) - retVal << fontNameFromTTFile(filename, qFromBigEndian(offsetTable[i])); - } - return retVal; -} - -static inline QString fontSettingsOrganization() { return QStringLiteral("Qt-Project"); } -static inline QString fontSettingsApplication() { return QStringLiteral("Qtbase"); } -static inline QString fontSettingsGroup() { return QStringLiteral("CEFontCache"); } - -static QString findFontFile(const QString &faceName) -{ - static QHash<QString, QString> fontCache; - - if (fontCache.isEmpty()) { - QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication()); - settings.beginGroup(fontSettingsGroup()); - foreach (const QString &fontName, settings.allKeys()) - fontCache.insert(fontName, settings.value(fontName).toString()); - settings.endGroup(); - } - - QString value = fontCache.value(faceName); - - //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts - if (value.isEmpty() || !QFile::exists(value)) { - QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication()); - settings.beginGroup(fontSettingsGroup()); - - //empty the cache first, as it seems that it is dirty - settings.remove(QString()); - - QDirIterator it(QStringLiteral("/Windows"), QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.ttc"), QDir::Files | QDir::Hidden | QDir::System); - const QLatin1Char lowerF('f'); - const QLatin1Char upperF('F'); - while (it.hasNext()) { - const QString fontFile = it.next(); - QStringList fontNames; - const QChar c = fontFile[fontFile.size() - 1]; - if (c == lowerF || c == upperF) - fontNames << fontNameFromTTFile(fontFile); - else - fontNames << fontNamesFromTTCFile(fontFile); - foreach (const QString fontName, fontNames) { - if (fontName.isEmpty()) - continue; - fontCache.insert(fontName, fontFile); - settings.setValue(fontName, fontFile); - - if (localizedName(fontName)) { - QString englishFontName = getEnglishName(fontName); - fontCache.insert(englishFontName, fontFile); - settings.setValue(englishFontName, fontFile); - } - } - } - settings.endGroup(); - value = fontCache.value(faceName); - } - return value; -} -#endif // Q_OS_WINCE - static bool addFontToDatabase(const QString &faceName, const QString &fullName, uchar charSet, @@ -453,7 +230,6 @@ static bool addFontToDatabase(const QString &faceName, } int index = 0; -#ifndef Q_OS_WINCE const FontKey *key = findFontKey(faceName, &index); if (!key) { key = findFontKey(fullName, &index); @@ -465,19 +241,11 @@ static bool addFontToDatabase(const QString &faceName, return false; } QString value = key->fileName; -#else - QString value = findFontFile(faceName); -#endif - if (value.isEmpty()) return false; if (!QDir::isAbsolutePath(value)) -#ifndef Q_OS_WINCE value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\")); -#else - value.prepend(QFile::decodeName("/Windows/")); -#endif QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); @@ -501,24 +269,6 @@ static bool addFontToDatabase(const QString &faceName, return true; } -#ifdef Q_OS_WINCE -static QByteArray getFntTable(HFONT hfont, uint tag) -{ - HDC hdc = GetDC(0); - HGDIOBJ oldFont = SelectObject(hdc, hfont); - quint32 t = qFromBigEndian<quint32>(tag); - QByteArray buffer; - - DWORD length = GetFontData(hdc, t, 0, NULL, 0); - if (length != GDI_ERROR) { - buffer.resize(length); - GetFontData(hdc, t, 0, reinterpret_cast<uchar *>(buffer.data()), length); - } - SelectObject(hdc, oldFont); - return buffer; -} -#endif - static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric, DWORD type, LPARAM) { @@ -576,8 +326,6 @@ struct PopulateFamiliesContext }; } // namespace -#ifndef Q_OS_WINCE - // Delayed population of font families static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric, @@ -633,74 +381,6 @@ void QWindowsFontDatabaseFT::populateFontDatabase() QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); } -#else // !Q_OS_WINCE - -// Non-delayed population of fonts (Windows CE). - -static int QT_WIN_CALLBACK populateFontCe(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM lparam) -{ - // the "@family" fonts are just the same as "family". Ignore them. - const wchar_t *faceNameW = f->elfLogFont.lfFaceName; - if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) { - const uchar charSet = f->elfLogFont.lfCharSet; - - FONTSIGNATURE signature; - QByteArray table; - - if (type & TRUETYPE_FONTTYPE) { - HFONT hfont = CreateFontIndirect(&f->elfLogFont); - table = getFntTable(hfont, MAKE_TAG('O', 'S', '/', '2')); - DeleteObject((HGDIOBJ)hfont); - } - - if (table.length() >= 86) { - // See also qfontdatabase_mac.cpp, offsets taken from OS/2 table in the TrueType spec - uchar *tableData = reinterpret_cast<uchar *>(table.data()); - - signature.fsUsb[0] = qFromBigEndian<quint32>(tableData + 42); - signature.fsUsb[1] = qFromBigEndian<quint32>(tableData + 46); - signature.fsUsb[2] = qFromBigEndian<quint32>(tableData + 50); - signature.fsUsb[3] = qFromBigEndian<quint32>(tableData + 54); - - signature.fsCsb[0] = qFromBigEndian<quint32>(tableData + 78); - signature.fsCsb[1] = qFromBigEndian<quint32>(tableData + 82); - } else { - memset(&signature, 0, sizeof(signature)); - } - - // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is - // identical to a TEXTMETRIC except for the last four members, which we don't use - // anyway - const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName); - if (addFontToDatabase(faceName, QString::fromWCharArray(f->elfFullName), - charSet, (TEXTMETRIC *)textmetric, &signature, type, true)) { - PopulateFamiliesContext *context = reinterpret_cast<PopulateFamiliesContext *>(lparam); - if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - } - } - - // keep on enumerating - return 1; -} - -void QWindowsFontDatabaseFT::populateFontDatabase() -{ - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - HDC dummy = GetDC(0); - lf.lfFaceName[0] = 0; - lf.lfPitchAndFamily = 0; - PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)populateFontCe, reinterpret_cast<LPARAM>(&context), 0); - ReleaseDC(0, dummy); - // Work around EnumFontFamiliesEx() not listing the system font, see below. - if (!context.seenSystemDefaultFont) - populateFamily(context.systemDefaultFont); -} -#endif // Q_OS_WINCE - QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, void *handle) { QFontEngine *fe = QBasicFontDatabase::fontEngine(fontDef, handle); @@ -718,21 +398,8 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { QStringList result; - result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); - -#ifdef Q_OS_WINCE - QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\FontLink\\SystemLink"), QSettings::NativeFormat); - const QStringList fontList = settings.value(family).toStringList(); - foreach (const QString &fallback, fontList) { - const int sep = fallback.indexOf(QLatin1Char(',')); - if (sep > 0) - result << fallback.mid(sep + 1); - } -#endif - result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); - result.append(QBasicFontDatabase::fallbacksForFamily(family, style, styleHint, script)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 806af6458b..0c213b933c 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -65,10 +65,6 @@ #include <limits.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif - #if !defined(QT_NO_DIRECTWRITE) # include <dwrite.h> #endif @@ -205,9 +201,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa { int glyph_pos = 0; { -#if defined(Q_OS_WINCE) - { -#else if (symbol) { QStringIterator it(str, str + numChars); while (it.hasNext()) { @@ -225,7 +218,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa ++glyph_pos; } } else { -#endif QStringIterator it(str, str + numChars); while (it.hasNext()) { const uint uc = it.next(); @@ -329,21 +321,16 @@ QWindowsFontEngine::~QWindowsFontEngine() glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const { - glyph_t glyph; + glyph_t glyph = 0; -#if !defined(Q_OS_WINCE) if (symbol) { glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); if (glyph == 0 && ucs4 < 0x100) glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000); } else if (ttf) { glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); - } else -#endif - if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { + } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { glyph = ucs4; - } else { - glyph = 0; } return glyph; @@ -377,12 +364,8 @@ bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *g inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width) { -#if defined(Q_OS_WINCE) - GetCharWidth32(hdc, glyph, glyph, &width); -#else if (ptrGetCharWidthI) ptrGetCharWidthI(hdc, glyph, 1, 0, &width); -#endif } void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const @@ -467,7 +450,7 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(const QGlyphLayout &glyphs) return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0); } -#ifndef Q_OS_WINCE + bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const { Q_ASSERT(metrics != 0); @@ -520,11 +503,9 @@ bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, g return false; } } -#endif glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform &t) { -#ifndef Q_OS_WINCE HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); @@ -542,34 +523,6 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform } return glyphMetrics; -#else - HDC hdc = m_fontEngineData->hdc; - HGDIOBJ oldFont = SelectObject(hdc, hfont); - - ABC abc; - int width; - int advance; -#ifdef GWES_MGTT // true type fonts - if (GetCharABCWidths(hdc, glyph, glyph, &abc)) { - width = qAbs(abc.abcA) + abc.abcB + qAbs(abc.abcC); - advance = abc.abcA + abc.abcB + abc.abcC; - } - else -#endif -#if defined(GWES_MGRAST) || defined(GWES_MGRAST2) // raster fonts - if (GetCharWidth32(hdc, glyph, glyph, &width)) { - advance = width; - } - else -#endif - { // fallback - width = tm.tmMaxCharWidth; - advance = width; - } - - SelectObject(hdc, oldFont); - return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, advance, 0).transformed(t); -#endif } QFixed QWindowsFontEngine::ascent() const @@ -636,22 +589,16 @@ void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qre HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); -#ifndef Q_OS_WINCE - if (ttf) -#endif - { + if (ttf) { ABC abcWidths; GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths); if (leftBearing) *leftBearing = abcWidths.abcA; if (rightBearing) *rightBearing = abcWidths.abcC; - } -#ifndef Q_OS_WINCE - else { + } else { QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing); } -#endif } #endif // Q_CC_MINGW @@ -670,7 +617,6 @@ qreal QWindowsFontEngine::minLeftBearing() const qreal QWindowsFontEngine::minRightBearing() const { -#ifndef Q_OS_WINCE if (rbearing == SHRT_MIN) { int ml = 0; int mr = 0; @@ -726,40 +672,6 @@ qreal QWindowsFontEngine::minRightBearing() const } return rbearing; -#else // !Q_OS_WINCE - if (rbearing == SHRT_MIN) { - int ml = 0; - int mr = 0; - HDC hdc = m_fontEngineData->hdc; - SelectObject(hdc, hfont); - if (ttf) { - ABC *abc = 0; - int n = tm.tmLastChar - tm.tmFirstChar; - if (n <= max_font_count) { - abc = new ABC[n+1]; - GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc); - } else { - abc = new ABC[char_table_entries+1]; - for (int i = 0; i < char_table_entries; i++) - GetCharABCWidths(hdc, char_table[i], char_table[i], abc+i); - n = char_table_entries; - } - ml = abc[0].abcA; - mr = abc[0].abcC; - for (int i = 1; i < n; i++) { - if (abc[i].abcA + abc[i].abcB + abc[i].abcC != 0) { - ml = qMin(ml,abc[i].abcA); - mr = qMin(mr,abc[i].abcC); - } - } - delete [] abc; - } - lbearing = ml; - rbearing = mr; - } - - return rbearing; -#endif // Q_OS_WINCE } static inline double qt_fixed_to_double(const FIXED &p) { @@ -786,7 +698,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, GLYPHMETRICS gMetric; memset(&gMetric, 0, sizeof(GLYPHMETRICS)); -#ifndef Q_OS_WINCE if (metric) { // If metrics requested, retrieve first using GGO_METRICS, because the returned // values are incorrect for OpenType PS fonts if obtained at the same time as the @@ -801,7 +712,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, int(gMetric.gmBlackBoxX), int(gMetric.gmBlackBoxY), gMetric.gmCellIncX, gMetric.gmCellIncY); } -#endif uint glyphFormat = GGO_NATIVE; @@ -820,15 +730,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, return false; } -#ifdef Q_OS_WINCE - if (metric) { - // #### obey scale - *metric = glyph_metrics_t(gMetric.gmptGlyphOrigin.x, -gMetric.gmptGlyphOrigin.y, - (int)gMetric.gmBlackBoxX, (int)gMetric.gmBlackBoxY, - gMetric.gmCellIncX, gMetric.gmCellIncY); - } -#endif - DWORD offset = 0; DWORD headerOffset = 0; @@ -1052,7 +953,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, bool has_transformation = t.type() > QTransform::TxTranslate; -#ifndef Q_OS_WINCE unsigned int options = ttf ? ETO_GLYPH_INDEX : 0; XFORM xform; @@ -1095,13 +995,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, xform.eDx -= tgm.gmptGlyphOrigin.x; xform.eDy += tgm.gmptGlyphOrigin.y; } -#else // else wince - unsigned int options = 0; - if (has_transformation) { - qWarning() << "QWindowsFontEngine is unable to apply transformations other than translations for fonts on Windows CE." - << "If you need them anyway, start your application with -platform windows:fontengine=freetype."; - } -#endif // wince // The padding here needs to be kept in sync with the values in alphaMapBoundingBox. QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin, @@ -1123,14 +1016,11 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, HGDIOBJ old_font = SelectObject(hdc, font); -#ifndef Q_OS_WINCE if (has_transformation) { SetGraphicsMode(hdc, GM_ADVANCED); SetWorldTransform(hdc, &xform); ExtTextOut(hdc, 0, 0, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0); - } else -#endif // !Q_OS_WINCE - { + } else { ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0); } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index cc2f05b6d1..48439e9523 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -149,15 +149,9 @@ QT_BEGIN_NAMESPACE QWindowsOpengl32DLL QOpenGLStaticContext::opengl32; -void *QWindowsOpengl32DLL::resolve(const char *name) +FARPROC QWindowsOpengl32DLL::resolve(const char *name) { -#ifndef Q_OS_WINCE - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, name) : 0; -#else - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0; -#endif - - return proc; + return m_lib ? ::GetProcAddress(m_lib, name) : nullptr; } bool QWindowsOpengl32DLL::init(bool softwareRendering) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index e8c78860f2..3ebf5b7bc2 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -122,7 +122,7 @@ struct QWindowsOpengl32DLL void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params); const GLubyte * (APIENTRY * glGetString)(GLenum name); - void *resolve(const char *name); + FARPROC resolve(const char *name); private: HMODULE m_lib; bool m_nonOpengl32; diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index ea68ba8cab..ddadbbea5d 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -190,11 +190,7 @@ bool QWindowsInputContext::hasCapability(Capability capability) const { switch (capability) { case QPlatformInputContext::HiddenTextCapability: -#ifndef Q_OS_WINCE return false; // QTBUG-40691, do not show IME on desktop for password entry fields. -#else - break; // Windows CE: Show software keyboard. -#endif default: break; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 9486dd84f0..b2fde7a0c6 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -64,7 +64,7 @@ #include <qpa/qplatformnativeinterface.h> #include <qpa/qwindowsysteminterface.h> -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#ifndef QT_NO_SESSIONMANAGER # include "qwindowssessionmanager.h" #endif #include <QtGui/qtouchdevice.h> @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE It should compile with: \list - \li Microsoft Visual Studio 2008 or later (using the Microsoft Windows SDK, + \li Microsoft Visual Studio 2013 or later (using the Microsoft Windows SDK, (\c Q_CC_MSVC). \li Stock \l{http://mingw.org/}{MinGW} (\c Q_CC_MINGW). This version ships with headers that are missing a lot of WinAPI. @@ -112,7 +112,6 @@ QT_BEGIN_NAMESPACE (\c Q_CC_MINGW and \c __MINGW64_VERSION_MAJOR indicating the version). MinGW-w64 provides more complete headers (compared to stock MinGW from mingw.org), including a considerable part of the Windows SDK. - \li Visual Studio 2008 for Windows Embedded (\c Q_OS_WINCE). \endlist The file \c qtwindows_additional.h contains defines and declarations that @@ -214,9 +213,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL : m_options(0) , m_fontDatabase(0) { -#ifndef Q_OS_WINCE Q_INIT_RESOURCE(openglblacklists); -#endif static bool dpiAwarenessSet = false; int tabletAbsoluteRange = -1; @@ -471,46 +468,16 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext() } #endif // !QT_NO_OPENGL -/* Workaround for QTBUG-24205: In 'Auto', pick the FreeType engine for - * QML2 applications. */ - -#ifdef Q_OS_WINCE -// It's not easy to detect if we are running a QML application -// Let's try to do so by checking if the Qt Quick module is loaded. -inline bool isQMLApplication() -{ - // check if the Qt Quick module is loaded -#ifdef _DEBUG - HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L"d.dll"); -#else - HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L".dll"); -#endif - return (handle != NULL); -} -#endif - QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const { if (!d->m_fontDatabase) { #ifdef QT_NO_FREETYPE d->m_fontDatabase = new QWindowsFontDatabase(); #else // QT_NO_FREETYPE - if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) { + if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) d->m_fontDatabase = new QWindowsFontDatabaseFT; - } else if (d->m_options & QWindowsIntegration::FontDatabaseNative){ - d->m_fontDatabase = new QWindowsFontDatabase; - } else { -#ifndef Q_OS_WINCE + else d->m_fontDatabase = new QWindowsFontDatabase; -#else - if (isQMLApplication()) { - qCDebug(lcQpaFonts) << "QML application detected, using FreeType rendering"; - d->m_fontDatabase = new QWindowsFontDatabaseFT; - } - else - d->m_fontDatabase = new QWindowsFontDatabase; -#endif - } #endif // QT_NO_FREETYPE } return d->m_fontDatabase; @@ -598,7 +565,7 @@ unsigned QWindowsIntegration::options() const return d->m_options; } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const QString &id, const QString &key) const { return new QWindowsSessionManager(id, key); diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 9658ef711d..437253cedc 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -104,7 +104,7 @@ public: void beep() const Q_DECL_OVERRIDE; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; #endif diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp index 2dfe7fc5f9..21ebee6262 100644 --- a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp @@ -39,7 +39,6 @@ #include "qwindowsinternalmimedata.h" #include "qwindowscontext.h" -#include "qplatformfunctions_wince.h" #include "qwindowsmime.h" #include <QDebug> /*! diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 5b2370b69d..8d6e83298e 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -552,34 +552,6 @@ inline quint32 winceKeyBend(quint32 keyCode) return KeyTbl[keyCode]; } -#ifdef Q_OS_WINCE -QT_BEGIN_INCLUDE_NAMESPACE -int ToUnicode(UINT vk, int /*scancode*/, unsigned char* /*kbdBuffer*/, LPWSTR unicodeBuffer, int, int) -{ - QT_USE_NAMESPACE - QChar* buf = reinterpret_cast< QChar*>(unicodeBuffer); - if (KeyTbl[vk] == 0) { - buf[0] = vk; - return 1; - } - return 0; -} - -int ToAscii(UINT vk, int scancode, unsigned char *kbdBuffer, LPWORD unicodeBuffer, int flag) -{ - return ToUnicode(vk, scancode, kbdBuffer, (LPWSTR) unicodeBuffer, 0, flag); - -} - -bool GetKeyboardState(unsigned char* kbuffer) -{ - for (int i=0; i< 256; ++i) - kbuffer[i] = GetAsyncKeyState(i); - return true; -} -QT_END_INCLUDE_NAMESPACE -#endif // Q_OS_WINCE - // Translate a VK into a Qt key code, or unicode character static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0) { @@ -780,7 +752,6 @@ static void showSystemMenu(QWindow* w) if (!menu) return; // no menu for this window -#ifndef Q_OS_WINCE #define enabled (MF_BYCOMMAND | MF_ENABLED) #define disabled (MF_BYCOMMAND | MF_GRAYED) @@ -805,7 +776,6 @@ static void showSystemMenu(QWindow* w) #undef enabled #undef disabled -#endif // !Q_OS_WINCE const QPoint pos = QHighDpi::toNativePixels(topLevel->geometry().topLeft(), topLevel); const int ret = TrackPopupMenuEx(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD, @@ -1172,7 +1142,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms modifiers, scancode, quint32(msg.wParam), nModifiers, text, false); result =true; bool store = true; -#ifndef Q_OS_WINCE // Alt+<alphanumerical> go to the Win32 menu system if unhandled by Qt if (msgType == WM_SYSKEYDOWN && !result && a) { HWND parent = GetParent(QWindowsWindow::handleOf(receiver)); @@ -1186,7 +1155,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms parent = GetParent(parent); } } -#endif // !Q_OS_WINCE if (!store) key_recorder.findKey(int(msg.wParam), true); } @@ -1216,7 +1184,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms nModifiers, (rec ? rec->text : QString()), false); result = true; -#ifndef Q_OS_WINCE // don't pass Alt to Windows unless we are embedded in a non-Qt window if (code == Qt::Key_Alt) { const QWindowsContext *context = QWindowsContext::instance(); @@ -1229,7 +1196,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms parent = GetParent(parent); } } -#endif } } return result; diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index cb112446fc..d6375693d8 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -403,11 +403,9 @@ QDebug operator<<(QDebug d, const FORMATETC &tc) case CF_UNICODETEXT: d << "CF_UNICODETEXT"; break; -#ifndef Q_OS_WINCE case CF_ENHMETAFILE: d << "CF_ENHMETAFILE"; break; -#endif // !Q_OS_WINCE default: d << QWindowsMimeConverter::clipboardFormatName(tc.cfFormat); break; diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 78fff65d84..fcba0d9e9b 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -203,7 +203,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; -#ifndef Q_OS_WINCE // Check for events synthesized from touch. Lower byte is touch index, 0 means pen. static const bool passSynthesizedMouseEvents = !(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch); @@ -218,7 +217,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, return false; } } -#endif // !Q_OS_WINCE const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); if (et & QtWindows::NonClientEventFlag) { @@ -320,7 +318,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, const bool hasCapture = platformWindow->hasMouseCapture(); const bool currentNotCapturing = hasCapture && currentWindowUnderMouse != window; -#ifndef Q_OS_WINCE // Enter new window: track to generate leave event. // If there is an active capture, only track if the current window is capturing, // so we don't get extra leave when cursor leaves the application. @@ -334,7 +331,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, qWarning("TrackMouseEvent failed."); m_trackedWindow = window; } -#endif // !Q_OS_WINCE // No enter or leave events are sent as long as there is an autocapturing window. if (!hasCapture || !platformWindow->testFlag(QWindowsWindow::AutoMouseCapture)) { @@ -487,7 +483,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QtWindows::WindowsEventType, MSG msg, LRESULT *) { -#ifndef Q_OS_WINCE typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList; @@ -563,109 +558,17 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); -#else // !Q_OS_WINCE - Q_UNUSED(window) - Q_UNUSED(msg) -#endif return true; - } bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType, MSG msg, LRESULT *) { -#ifndef Q_OS_WINCE Q_UNUSED(window) Q_UNUSED(hwnd) Q_UNUSED(msg) return false; -#else // !Q_OS_WINCE - GESTUREINFO gi; - memset(&gi, 0, sizeof(GESTUREINFO)); - gi.cbSize = sizeof(GESTUREINFO); - - if (!GetGestureInfo((HGESTUREINFO)msg.lParam, &gi)) - return false; - - const QPoint position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); - - if (gi.dwID != GID_DIRECTMANIPULATION) - return true; - static QPoint lastTouchPos; - const QScreen *screen = window->screen(); - if (!screen) - screen = QGuiApplication::primaryScreen(); - if (!screen) - return true; - const QRect screenGeometry = screen->geometry(); - QWindowSystemInterface::TouchPoint touchPoint; - static QWindowSystemInterface::TouchPoint touchPoint2; - touchPoint.id = 0;//gi.dwInstanceID; - touchPoint.pressure = 1.0; - - if (gi.dwFlags & GF_BEGIN) - touchPoint.state = Qt::TouchPointPressed; - else if (gi.dwFlags & GF_END) - touchPoint.state = Qt::TouchPointReleased; - else if (gi.dwFlags == 0) - touchPoint.state = Qt::TouchPointMoved; - else - return true; - touchPoint2.pressure = 1.0; - touchPoint2.id = 1; - const QPoint winEventPosition = position; - const int deltaX = GID_DIRECTMANIPULATION_DELTA_X(gi.ullArguments); - const int deltaY = GID_DIRECTMANIPULATION_DELTA_Y(gi.ullArguments); - //Touch points are taken from the whole screen so map the position to the screen - const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); - const QPoint globalPosition2 = QWindowsGeometryHint::mapToGlobal(hwnd, QPoint(position.x() + deltaX, position.y() + deltaY)); - - touchPoint.normalPosition = - QPointF( (qreal)globalPosition.x() / screenGeometry.width(), (qreal)globalPosition.y() / screenGeometry.height() ); - - touchPoint.area.moveCenter(globalPosition); - - QList<QWindowSystemInterface::TouchPoint> pointList; - pointList.append(touchPoint); - if (deltaX != 0 && deltaY != 0) { - touchPoint2.state = m_had2ndTouchPoint ? Qt::TouchPointMoved : Qt::TouchPointPressed; - m_had2ndTouchPoint = true; - touchPoint2.normalPosition = - QPointF( (qreal)globalPosition2.x() / screenGeometry.width(), (qreal)globalPosition2.y() / screenGeometry.height() ); - - touchPoint2.area.moveCenter(globalPosition2); - lastTouchPos = globalPosition2; - pointList.append(touchPoint2); - } else if (m_had2ndTouchPoint) { - touchPoint2.normalPosition = - QPointF( (qreal)lastTouchPos.x() / screenGeometry.width(), (qreal)lastTouchPos.y() / screenGeometry.height() ); - - touchPoint2.area.moveCenter(lastTouchPos); - touchPoint2.state = Qt::TouchPointReleased; - pointList.append(touchPoint2); - m_had2ndTouchPoint = false; - } - - if (!m_touchDevice) { - m_touchDevice = new QTouchDevice; - // TODO: Device used to be hardcoded to screen in previous code. - m_touchDevice->setType(QTouchDevice::TouchScreen); - m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition); - QWindowSystemInterface::registerTouchDevice(m_touchDevice); - } - - QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, pointList); - // handle window focusing in/out - if (window != m_windowUnderMouse) { - if (m_windowUnderMouse) - QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse); - if (window) - QWindowSystemInterface::handleEnterEvent(window); - m_windowUnderMouse = window; - } - return true; -#endif // Q_OS_WINCE } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index d16c9f9e02..3eacc5f1a5 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -91,10 +91,6 @@ private: QTouchDevice *m_touchDevice; bool m_leftButtonDown; QWindow *m_previousCaptureWindow; -#ifdef Q_OS_WINCE -//This is required to send a touch up if we don't get a second touch position any more - bool m_had2ndTouchPoint; -#endif }; Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam) diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp index bc8bfda32b..ec9683ea8d 100644 --- a/src/plugins/platforms/windows/qwindowsnativeimage.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp @@ -126,9 +126,7 @@ QWindowsNativeImage::QWindowsNativeImage(int width, int height, m_image = QImage(width, height, format); } -#ifndef Q_OS_WINCE GdiFlush(); -#endif } QWindowsNativeImage::~QWindowsNativeImage() diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 4ca7f0e413..d5d50a69cd 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -54,17 +54,14 @@ #include <private/qopengl_p.h> #endif -#ifndef Q_OS_WINCE -# include <QtCore/qt_windows.h> -# include <private/qsystemlibrary_p.h> -# include <d3d9.h> -#endif +#include <QtCore/qt_windows.h> +#include <private/qsystemlibrary_p.h> +#include <d3d9.h> QT_BEGIN_NAMESPACE GpuDescription GpuDescription::detect() { -#ifndef Q_OS_WINCE typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT); GpuDescription result; @@ -95,13 +92,6 @@ GpuDescription GpuDescription::detect() result.description = adapterIdentifier.Description; } return result; -#else // !Q_OS_WINCE - GpuDescription result; - result.vendorId = result.deviceId = result.revision =1; - result.driverVersion = QVersionNumber(1, 1, 1); - result.driverName = result.description = QByteArrayLiteral("Generic"); - return result; -#endif } #ifndef QT_NO_DEBUG_STREAM @@ -155,7 +145,6 @@ QVariant GpuDescription::toVariant() const QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() { -#ifndef Q_OS_WINCE const char platformVar[] = "QT_ANGLE_PLATFORM"; if (qEnvironmentVariableIsSet(platformVar)) { const QByteArray anglePlatform = qgetenv(platformVar); @@ -167,13 +156,11 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() return QWindowsOpenGLTester::AngleRendererD3d11Warp; qCWarning(lcQpaGl) << "Invalid value set for " << platformVar << ": " << anglePlatform; } -#endif // !Q_OS_WINCE return QWindowsOpenGLTester::InvalidRenderer; } QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() { -#ifndef Q_OS_WINCE const char openGlVar[] = "QT_OPENGL"; if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES)) { const Renderer glesRenderer = QWindowsOpenGLTester::requestedGlesRenderer(); @@ -195,12 +182,9 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() return QWindowsOpenGLTester::SoftwareRasterizer; qCWarning(lcQpaGl) << "Invalid value set for " << openGlVar << ": " << requested; } -#endif // !Q_OS_WINCE return QWindowsOpenGLTester::InvalidRenderer; } -#ifndef Q_OS_WINCE - static inline QString resolveBugListFile(const QString &fileName) { if (QFileInfo(fileName).isAbsolute()) @@ -216,12 +200,10 @@ static inline QString resolveBugListFile(const QString &fileName) return QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName); } -# ifndef QT_NO_OPENGL +#ifndef QT_NO_OPENGL typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRenderersCache; Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache) -# endif - -#endif // !Q_OS_WINCE +#endif QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly) { @@ -229,8 +211,6 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c Q_UNUSED(glesOnly) #if defined(QT_NO_OPENGL) return 0; -#elif defined(Q_OS_WINCE) - return QWindowsOpenGLTester::Gles; #else QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description); SupportedRenderersCache *srCache = supportedRenderersCache(); @@ -280,7 +260,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c } srCache->insert(qgpu, result); return result; -#endif // !Q_OS_WINCE && !QT_NO_OPENGL +#endif // !QT_NO_OPENGL } QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers() @@ -301,7 +281,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers() bool QWindowsOpenGLTester::testDesktopGL() { -#if !defined(QT_NO_OPENGL) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_OPENGL) HMODULE lib = 0; HWND wnd = 0; HDC dc = 0; @@ -428,7 +408,7 @@ cleanup: return result; #else return false; -#endif // !QT_NO_OPENGL && !Q_OS_WINCE +#endif // !QT_NO_OPENGL } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index b476c9be1d..93839ccf43 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -68,8 +68,6 @@ static inline QDpi deviceDPI(HDC hdc) return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); } -#ifndef Q_OS_WINCE - static inline QDpi monitorDPI(HMONITOR hMonitor) { if (QWindowsContext::shcoredll.isValid()) { @@ -81,8 +79,6 @@ static inline QDpi monitorDPI(HMONITOR hMonitor) return QDpi(0, 0); } -#endif // !Q_OS_WINCE - typedef QList<QWindowsScreenData> WindowsScreenDataList; static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) @@ -99,20 +95,9 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) if (data->name == QLatin1String("WinDisc")) { data->flags |= QWindowsScreenData::LockScreen; } else { -#ifdef Q_OS_WINCE - //Windows CE, just supports one Display and expects to get only DISPLAY, - //instead of DISPLAY0 and so on, which are passed by info.szDevice - HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); -#else - HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL); -#endif - if (hdc) { -#ifndef Q_OS_WINCE + if (const HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL)) { const QDpi dpi = monitorDPI(hMonitor); data->dpi = dpi.first ? dpi : deviceDPI(hdc); -#else - data->dpi = deviceDPI(hdc); -#endif data->depth = GetDeviceCaps(hdc, BITSPIXEL); data->format = data->depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; data->physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE)); @@ -330,7 +315,6 @@ enum OrientationPreference // matching Win32 API ORIENTATION_PREFERENCE bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) { bool result = false; -#ifndef Q_OS_WINCE if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) { DWORD orientationPreference = 0; switch (o) { @@ -352,14 +336,12 @@ bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) } result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference); } -#endif // !Q_OS_WINCE return result; } Qt::ScreenOrientation QWindowsScreen::orientationPreference() { Qt::ScreenOrientation result = Qt::PrimaryOrientation; -#ifndef Q_OS_WINCE if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) { DWORD orientationPreference = 0; if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) { @@ -379,7 +361,6 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() } } } -#endif // !Q_OS_WINCE return result; } @@ -388,7 +369,7 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() */ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const { -#if defined(Q_OS_WINCE) || !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) +#if !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) return QPlatformScreen::Subpixel_None; #else QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint(); diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 2afc410e07..02a9dc3bc3 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -41,9 +41,6 @@ #define QWINDOWSSCREEN_H #include "qtwindowsglobal.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif #include <QtCore/QList> #include <QtCore/QVector> diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 3c99e3507e..5074db9051 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -46,9 +46,7 @@ #include <QtCore/QDir> #include <shlobj.h> -#ifndef Q_OS_WINCE -# include <intshcut.h> -#endif +#include <intshcut.h> QT_BEGIN_NAMESPACE @@ -56,7 +54,6 @@ enum { debug = 0 }; static inline bool shellExecute(const QUrl &url) { -#ifndef Q_OS_WINCE const QString nativeFilePath = url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded); const quintptr result = @@ -69,10 +66,6 @@ static inline bool shellExecute(const QUrl &url) return false; } return true; -#else - Q_UNUSED(url); - return false; -#endif } // Retrieve the commandline for the default mail client. It contains a @@ -107,13 +100,9 @@ static inline QString mailCommand() } if (!command[0]) return QString(); -#ifndef Q_OS_WINCE wchar_t expandedCommand[MAX_PATH] = {0}; return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ? QString::fromWCharArray(expandedCommand) : QString::fromWCharArray(command); -#else - return QString(); -#endif } static inline bool launchMail(const QUrl &url) diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 4a24d62770..2c05dcddfc 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -42,7 +42,7 @@ #include "qtwindowsglobal.h" -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) #include <QtCore/QVector> #include <QtCore/QPointF> @@ -143,5 +143,5 @@ private: QT_END_NAMESPACE -#endif // !QT_NO_TABLETEVENT && !Q_OS_WINCE +#endif // !QT_NO_TABLETEVENT #endif // QWINDOWSTABLETSUPPORT_H diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index c64955be80..046c32a80a 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -49,17 +49,12 @@ #include "qwindowsintegration.h" #include "qt_windows.h" #include "qwindowsfontdatabase.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -# include "winuser.h" -#else -# include <commctrl.h> -# include <objbase.h> -# ifndef Q_CC_MINGW -# include <commoncontrols.h> -# endif -# include <shellapi.h> +#include <commctrl.h> +#include <objbase.h> +#ifndef Q_CC_MINGW +# include <commoncontrols.h> #endif +#include <shellapi.h> #include <QtCore/QVariant> #include <QtCore/QCoreApplication> @@ -128,7 +123,6 @@ static inline QColor getSysColor(int index) return COLORREFToQColor(GetSysColor(index)); } -#ifndef QT_NO_WINCE_SHELLSDK // QTBUG-48823/Windows 10: SHGetFileInfo() (as called by item views on file system // models has been observed to trigger a WM_PAINT on the mainwindow. Suppress the // behavior by running it in a thread. @@ -161,7 +155,6 @@ static bool shGetFileInfoBackground(QWindowsThreadPoolRunner &r, } return result; } -#endif // !QT_NO_WINCE_SHELLSDK // from QStyle::standardPalette static inline QPalette standardPalette() @@ -272,14 +265,9 @@ static inline QPalette menuPalette(const QPalette &systemPalette) result.setColor(QPalette::Active, QPalette::ButtonText, menuTextColor); result.setColor(QPalette::Disabled, QPalette::WindowText, disabled); result.setColor(QPalette::Disabled, QPalette::Text, disabled); -#ifndef Q_OS_WINCE const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false); result.setColor(QPalette::Disabled, QPalette::Highlight, getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)); -#else - result.setColor(QPalette::Disabled, QPalette::Highlight, - getSysColor(COLOR_HIGHLIGHT)); -#endif result.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled); result.setColor(QPalette::Disabled, QPalette::Button, result.color(QPalette::Active, QPalette::Button)); @@ -305,11 +293,7 @@ static inline QPalette *menuBarPalette(const QPalette &menuPalette) QPalette *result = 0; if (booleanSystemParametersInfo(SPI_GETFLATMENU, false)) { result = new QPalette(menuPalette); -#ifndef Q_OS_WINCE const QColor menubar(getSysColor(COLOR_MENUBAR)); -#else - const QColor menubar(getSysColor(COLOR_MENU)); -#endif result->setColor(QPalette::Active, QPalette::Button, menubar); result->setColor(QPalette::Disabled, QPalette::Button, menubar); result->setColor(QPalette::Inactive, QPalette::Button, menubar); @@ -379,12 +363,10 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const return QVariant(iconThemeSearchPaths()); case StyleNames: return QVariant(styleNames()); -#ifndef Q_OS_WINCE case TextCursorWidth: return QVariant(int(dWordSystemParametersInfo(SPI_GETCARETWIDTH, 1u))); case DropShadow: return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false)); -#endif // !Q_OS_WINCE case MaximumScrollBarDragDistance: return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375)); case KeyboardScheme: @@ -438,7 +420,6 @@ void QWindowsTheme::clearFonts() void QWindowsTheme::refreshFonts() { -#ifndef Q_OS_WINCE // ALL THIS FUNCTIONALITY IS MISSING ON WINCE clearFonts(); if (!QGuiApplication::desktopSettingsAware()) return; @@ -467,7 +448,6 @@ void QWindowsTheme::refreshFonts() m_fonts[DockWidgetTitleFont] = new QFont(titleFont); m_fonts[ItemViewFont] = new QFont(iconTitleFont); m_fonts[FixedFont] = new QFont(fixedFont); -#endif // !Q_OS_WINCE } bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const @@ -491,12 +471,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); static QPixmap loadIconFromShell32(int resourceId, QSizeF size) { -#ifdef Q_OS_WINCE - HMODULE hmod = LoadLibrary(L"ceshell"); -#else - HMODULE hmod = QSystemLibrary::load(L"shell32"); -#endif - if (hmod) { + if (const HMODULE hmod = QSystemLibrary::load(L"shell32")) { HICON iconHandle = static_cast<HICON>(LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, int(size.width()), int(size.height()), 0)); @@ -515,7 +490,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con const int scaleFactor = primaryScreen ? qRound(QHighDpiScaling::factor(primaryScreen)) : 1; const QSizeF pixmapSize = size * scaleFactor; int resourceId = -1; - int stockId = SIID_INVALID; + SHSTOCKICONID stockId = SIID_INVALID; UINT stockFlags = 0; LPCTSTR iconName = 0; switch (sp) { @@ -578,7 +553,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con stockId = SIID_RECYCLER; resourceId = 191; break; -#ifndef Q_OS_WINCE case MessageBoxInformation: stockId = SIID_INFO; iconName = IDI_INFORMATION; @@ -598,30 +572,23 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con case VistaShield: stockId = SIID_SHIELD; break; -#endif default: break; } -#ifndef Q_OS_WINCE if (stockId != SIID_INVALID) { - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) - && QWindowsContext::shell32dll.sHGetStockIconInfo) { - QPixmap pixmap; - SHSTOCKICONINFO iconInfo; - memset(&iconInfo, 0, sizeof(iconInfo)); - iconInfo.cbSize = sizeof(iconInfo); - stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON); - if (QWindowsContext::shell32dll.sHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) { - pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); - pixmap.setDevicePixelRatio(scaleFactor); - DestroyIcon(iconInfo.hIcon); - return pixmap; - } + QPixmap pixmap; + SHSTOCKICONINFO iconInfo; + memset(&iconInfo, 0, sizeof(iconInfo)); + iconInfo.cbSize = sizeof(iconInfo); + stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON); + if (SHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) { + pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); + pixmap.setDevicePixelRatio(scaleFactor); + DestroyIcon(iconInfo.hIcon); + return pixmap; } } -#endif if (resourceId != -1) { QPixmap pixmap = loadIconFromShell32(resourceId, pixmapSize); @@ -698,14 +665,8 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info) // For MinGW: static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}}; - if (!QWindowsContext::shell32dll.sHGetImageList) - return result; - if (iImageList == sHIL_JUMBO && QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) - return result; - IImageList *imageList = 0; - HRESULT hr = QWindowsContext::shell32dll.sHGetImageList(iImageList, iID_IImageList, - reinterpret_cast<void **>(&imageList)); + HRESULT hr = SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList)); if (hr != S_OK) return result; HICON hIcon; @@ -761,22 +722,13 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s SHFILEINFO info; const unsigned int flags = -#ifndef Q_OS_WINCE SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX; -#else - iconSize|SHGFI_SYSICONINDEX; -#endif // Q_OS_WINCE - -#if !defined(QT_NO_WINCE_SHELLSDK) const bool val = cacheableDirIcon && useDefaultFolderIcon ? shGetFileInfoBackground(m_threadPoolRunner, L"dummy", FILE_ATTRIBUTE_DIRECTORY, &info, flags | SHGFI_USEFILEATTRIBUTES) : shGetFileInfoBackground(m_threadPoolRunner, reinterpret_cast<const wchar_t *>(filePath.utf16()), 0, &info, flags); -#else - const bool val = false; -#endif // !QT_NO_WINCE_SHELLSDK // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases if (val && info.hIcon) { diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 79f41bb6ec..c369bafafc 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -62,6 +62,8 @@ #include <QtCore/QDebug> +#include <dwmapi.h> + QT_BEGIN_NAMESPACE enum { @@ -147,7 +149,6 @@ QDebug operator<<(QDebug d, const POINT &p) return d; } -# ifndef Q_OS_WINCE QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p) { QDebugStateSaver saver(d); @@ -178,14 +179,12 @@ QDebug operator<<(QDebug d, const WINDOWPLACEMENT &wp) << ", rcNormalPosition=" << wp.rcNormalPosition; return d; } -# endif // !Q_OS_WINCE #endif // !QT_NO_DEBUG_STREAM // QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT // is in workspace/available area coordinates. static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) { -#ifndef Q_OS_WINCE if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) return QPoint(0, 0); const QWindowsScreenManager &screenManager = QWindowsContext::instance()->screenManager(); @@ -193,10 +192,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) ? screenManager.screens().constFirst() : screenManager.screenAtDp(point); if (screen) return screen->availableGeometry().topLeft() - screen->geometry().topLeft(); -#else - Q_UNUSED(hwnd) - Q_UNUSED(point) -#endif return QPoint(0, 0); } @@ -205,7 +200,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) static inline QRect frameGeometry(HWND hwnd, bool topLevel) { RECT rect = { 0, 0, 0, 0 }; -#ifndef Q_OS_WINCE if (topLevel) { WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); @@ -215,7 +209,6 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel) return result.translated(windowPlacementOffset(hwnd, result.topLeft())); } } -#endif // !Q_OS_WINCE GetWindowRect(hwnd, &rect); // Screen coordinates. const HWND parent = GetParent(hwnd); if (parent && !topLevel) { @@ -236,7 +229,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd) { if (!IsWindowVisible(hwnd)) return QWindow::Hidden; -#ifndef Q_OS_WINCE WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement(hwnd, &windowPlacement)) { @@ -251,7 +243,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd) break; } } -#endif // !Q_OS_WINCE return QWindow::Windowed; } @@ -269,65 +260,27 @@ static inline bool windowIsOpenGL(const QWindow *w) static bool applyBlurBehindWindow(HWND hwnd) { -#ifdef Q_OS_WINCE - Q_UNUSED(hwnd); - return false; -#else - enum { dwmBbEnable = 0x1, dwmBbBlurRegion = 0x2 }; - - struct DwmBlurBehind { - DWORD dwFlags; - BOOL fEnable; - HRGN hRgnBlur; - BOOL fTransitionOnMaximized; - }; - - typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND, const DwmBlurBehind*); - typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL *); - - // DWM API is available only from Windows Vista - if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) - return false; - - static bool functionPointersResolved = false; - static PtrDwmEnableBlurBehindWindow dwmBlurBehind = 0; - static PtrDwmIsCompositionEnabled dwmIsCompositionEnabled = 0; - - if (Q_UNLIKELY(!functionPointersResolved)) { - QSystemLibrary library(QStringLiteral("dwmapi")); - if (library.load()) { - dwmBlurBehind = (PtrDwmEnableBlurBehindWindow)(library.resolve("DwmEnableBlurBehindWindow")); - dwmIsCompositionEnabled = (PtrDwmIsCompositionEnabled)(library.resolve("DwmIsCompositionEnabled")); - } - - functionPointersResolved = true; - } - - if (Q_UNLIKELY(!dwmBlurBehind || !dwmIsCompositionEnabled)) - return false; - BOOL compositionEnabled; - if (dwmIsCompositionEnabled(&compositionEnabled) != S_OK) + if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK) return false; - DwmBlurBehind blurBehind = {0, 0, 0, 0}; + DWM_BLURBEHIND blurBehind = {0, 0, 0, 0}; if (compositionEnabled) { - blurBehind.dwFlags = dwmBbEnable | dwmBbBlurRegion; + blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; blurBehind.fEnable = TRUE; blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1); } else { - blurBehind.dwFlags = dwmBbEnable; + blurBehind.dwFlags = DWM_BB_ENABLE; blurBehind.fEnable = FALSE; } - const bool result = dwmBlurBehind(hwnd, &blurBehind) == S_OK; + const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK; if (blurBehind.hRgnBlur) DeleteObject(blurBehind.hRgnBlur); return result; -#endif // Q_OS_WINCE } // from qwidget_win.cpp, pass flags separately in case they have been "autofixed". @@ -346,7 +299,6 @@ static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags) // Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT). bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity) { -#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE); const bool needsLayered = (flags & Qt::WindowTransparentForInput) || (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0; @@ -359,36 +311,22 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has } } return needsLayered; -#else // !Q_OS_WINCE - Q_UNUSED(hwnd); - Q_UNUSED(flags); - Q_UNUSED(hasAlpha); - Q_UNUSED(opacity); - return false; -#endif // Q_OS_WINCE } static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool openGL, qreal level) { -#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls - Q_UNUSED(hwnd); - Q_UNUSED(flags); - Q_UNUSED(hasAlpha); - Q_UNUSED(level); -#else if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) { const BYTE alpha = BYTE(qRound(255.0 * level)); if (hasAlpha && !openGL && (flags & Qt::FramelessWindowHint)) { // Non-GL windows with alpha: Use blend function to update. BLENDFUNCTION blend = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; - QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); + UpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); } else { - QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); } } else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered. InvalidateRect(hwnd, NULL, TRUE); } -#endif // !Q_OS_WINCE } static inline void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity) @@ -602,12 +540,10 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag exStyle |= WS_EX_TOOLWINDOW; } -#ifndef Q_OS_WINCE // make mouse events fall through this window // NOTE: WS_EX_TRANSPARENT flag can make mouse inputs fall through a layered window if (flagsIn & Qt::WindowTransparentForInput) exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT; -#endif } } @@ -648,10 +584,6 @@ QWindowsWindowData context->frameX, context->frameY, context->frameWidth, context->frameHeight, parentHandle, NULL, appinst, NULL); -#ifdef Q_OS_WINCE - if (DisableGestures(result.hwnd, TGF_GID_ALL, TGF_SCOPE_WINDOW)) - EnableGestures(result.hwnd, TGF_GID_DIRECTMANIPULATION, TGF_SCOPE_WINDOW); -#endif qCDebug(lcQpaWindows).nospace() << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " << context->obtainedGeometry << ' ' << context->margins; @@ -762,9 +694,7 @@ bool QWindowsGeometryHint::validSize(const QSize &s) const QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) { RECT rect = {0,0,0,0}; -#ifndef Q_OS_WINCE style &= ~(WS_OVERLAPPED); // Not permitted, see docs. -#endif if (!AdjustWindowRectEx(&rect, style, FALSE, exStyle)) qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__); const QMargins result(qAbs(rect.left), qAbs(rect.top), @@ -777,7 +707,6 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result) { -#ifndef Q_OS_WINCE // NCCALCSIZE_PARAMS structure if wParam==TRUE if (!msg.wParam || customMargins.isNull()) return false; @@ -793,15 +722,8 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co << ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2] << ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy; return true; -#else - Q_UNUSED(customMargins) - Q_UNUSED(msg) - Q_UNUSED(result) - return false; -#endif } -#ifndef Q_OS_WINCE void QWindowsGeometryHint::applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const { return applyToMinMaxInfo(DWORD(GetWindowLong(hwnd, GWL_STYLE)), @@ -833,7 +755,6 @@ void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXI << " frame=" << margins << ' ' << frameWidth << ',' << frameHeight << " out " << *mmi; } -#endif // !Q_OS_WINCE bool QWindowsGeometryHint::positionIncludesFrame(const QWindow *w) { @@ -1078,9 +999,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) m_dropTarget(0), m_savedStyle(0), m_format(aWindow->requestedFormat()), -#ifdef Q_OS_WINCE - m_previouslyHidden(false), -#endif m_iconSmall(0), m_iconBig(0), m_surface(0) @@ -1114,10 +1032,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) QWindowsWindow::~QWindowsWindow() { setFlag(WithinDestroy); -#ifndef Q_OS_WINCE if (testFlag(TouchRegistered)) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); -#endif // !Q_OS_WINCE destroyWindow(); destroyIcon(); } @@ -1161,14 +1077,6 @@ void QWindowsWindow::destroyWindow() m_surface = 0; } #endif -#ifdef Q_OS_WINCE - if ((m_windowState & Qt::WindowFullScreen) && !m_previouslyHidden) { - HWND handle = FindWindow(L"HHTaskBar", L""); - if (handle) { - ShowWindow(handle, SW_SHOW); - } - } -#endif // !Q_OS_WINCE DestroyWindow(m_data.hwnd); context->removeWindow(m_data.hwnd); m_data.hwnd = 0; @@ -1336,7 +1244,6 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const return pos; } -#ifndef Q_OS_WINCE static inline HWND transientParentHwnd(HWND hwnd) { if (GetAncestor(hwnd, GA_PARENT) == GetDesktopWindow()) { @@ -1346,7 +1253,6 @@ static inline HWND transientParentHwnd(HWND hwnd) } return 0; } -#endif // !Q_OS_WINCE // Update the transient parent for a toplevel window. The concept does not // really exist on Windows, the relationship is set by passing a parent along with !WS_CHILD @@ -1354,7 +1260,6 @@ static inline HWND transientParentHwnd(HWND hwnd) // SetParent, which would make it a real child). void QWindowsWindow::updateTransientParent() const { -#ifndef Q_OS_WINCE if (window()->type() == Qt::Popup) return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). // Update transient parent. @@ -1366,7 +1271,6 @@ void QWindowsWindow::updateTransientParent() const newTransientParent = tw->handle(); if (newTransientParent != oldTransientParent) SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent)); -#endif // !Q_OS_WINCE } static inline bool testShowWithoutActivating(const QWindow *window) @@ -1484,16 +1388,12 @@ void QWindowsWindow::handleCompositionSettingsChanged() static QRect normalFrameGeometry(HWND hwnd) { -#ifndef Q_OS_WINCE WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement(hwnd, &wp)) { const QRect result = qrectFromRECT(wp.rcNormalPosition); return result.translated(windowPlacementOffset(hwnd, result.topLeft())); } -#else - Q_UNUSED(hwnd) -#endif return QRect(); } @@ -1613,7 +1513,6 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const << " new frame: " << frameGeometry; bool result = false; -#ifndef Q_OS_WINCE const HWND hwnd = handle(); WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); @@ -1626,9 +1525,7 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const RECTfromQRect(frameGeometry.translated(-windowPlacementOffset(hwnd, frameGeometry.topLeft()))); windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE; result = SetWindowPlacement(hwnd, &windowPlacement); - } else -#endif // !Q_OS_WINCE - { + } else { result = MoveWindow(hwnd, frameGeometry.x(), frameGeometry.y(), frameGeometry.width(), frameGeometry.height(), true); } @@ -1820,18 +1717,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) setFlag(FrameDirty); if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { -#ifdef Q_OS_WINCE - HWND handle = FindWindow(L"HHTaskBar", L""); - if (handle) { - if (newState == Qt::WindowFullScreen) { - BOOL hidden = ShowWindow(handle, SW_HIDE); - if (!hidden) - m_previouslyHidden = true; - } else if (!m_previouslyHidden){ - ShowWindow(handle, SW_SHOW); - } - } -#endif if (newState == Qt::WindowFullScreen) { #ifndef Q_FLATTEN_EXPOSE UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; @@ -1843,17 +1728,13 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) // Window state but emulated by changing geometry and style. if (!m_savedStyle) { m_savedStyle = style(); -#ifndef Q_OS_WINCE if (oldState == Qt::WindowMinimized || oldState == Qt::WindowMaximized) { const QRect nf = normalFrameGeometry(m_data.hwnd); if (nf.isValid()) m_savedFrameGeometry = nf; } else { -#endif m_savedFrameGeometry = frameGeometry_sys(); -#ifndef Q_OS_WINCE } -#endif } if (m_savedStyle & WS_SYSMENU) newStyle |= WS_SYSMENU; @@ -1966,7 +1847,6 @@ void QWindowsWindow::propagateSizeHints() bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &margins) { -#ifndef Q_OS_WINCE if (!qWindow->isTopLevel()) // Implement hasHeightForWidth(). return false; WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam); @@ -1986,10 +1866,6 @@ bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow * windowPos->cx = correctedFrameGeometry.width(); windowPos->cy = correctedFrameGeometry.height(); return true; -#else // !Q_OS_WINCE - Q_UNUSED(message) - return false; -#endif } bool QWindowsWindow::handleGeometryChanging(MSG *message) const @@ -2047,15 +1923,13 @@ static inline void addRectToWinRegion(const QRect &rect, HRGN *winRegion) static HRGN qRegionToWinRegion(const QRegion ®ion) { - const QVector<QRect> rects = region.rects(); - if (rects.isEmpty()) - return NULL; - const int rectCount = rects.size(); - if (rectCount == 1) - return createRectRegion(region.boundingRect()); - HRGN hRegion = createRectRegion(rects.front()); - for (int i = 1; i < rectCount; ++i) - addRectToWinRegion(rects.at(i), &hRegion); + auto it = region.begin(); + const auto end = region.end(); + if (it == end) + return nullptr; + HRGN hRegion = createRectRegion(*it); + while (++it != end) + addRectToWinRegion(*it, &hRegion); return hRegion; } @@ -2084,7 +1958,6 @@ void QWindowsWindow::requestActivateWindow() // 'Active' state handling is based in focus since it needs to work for // child windows as well. if (m_data.hwnd) { -#ifndef Q_OS_WINCE const DWORD currentThread = GetCurrentThreadId(); bool attached = false; DWORD foregroundThread = 0; @@ -2101,13 +1974,10 @@ void QWindowsWindow::requestActivateWindow() attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE; } } -#endif // !Q_OS_WINCE SetForegroundWindow(m_data.hwnd); SetFocus(m_data.hwnd); -#ifndef Q_OS_WINCE if (attached) AttachThreadInput(foregroundThread, currentThread, FALSE); -#endif // !Q_OS_WINCE } } @@ -2189,7 +2059,6 @@ void QWindowsWindow::setFrameStrutEventsEnabled(bool enabled) } } -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const { const QWindowsGeometryHint hint(window(), m_data.customMargins); @@ -2260,8 +2129,6 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re return false; } -#endif // !Q_OS_WINCE - #ifndef QT_NO_CURSOR // Return the default cursor (Arrow) from QWindowsCursor's cache. static inline CursorHandlePtr defaultCursor(const QWindow *w) @@ -2328,7 +2195,6 @@ void QWindowsWindow::setCursor(const CursorHandlePtr &c) #endif } -#ifndef Q_OS_WINCE void QWindowsWindow::setAlertState(bool enabled) { if (isAlertState() == enabled) @@ -2367,7 +2233,6 @@ void QWindowsWindow::stopAlertWindow() info.uCount = 0; FlashWindowEx(&info); } -#endif // !Q_OS_WINCE bool QWindowsWindow::isEnabled() const { @@ -2483,7 +2348,6 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) { -#ifndef Q_OS_WINCE if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) { ULONG touchFlags = 0; const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags); @@ -2496,7 +2360,6 @@ void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTou else qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName())); } -#endif // !Q_OS_WINCE } void QWindowsWindow::aboutToMakeCurrent() diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 999761f3c6..070add052b 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -41,9 +41,6 @@ #define QWINDOWSWINDOW_H #include "qtwindows_additional.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif #include "qwindowscursor.h" #include <qpa/qplatformwindow.h> @@ -60,10 +57,8 @@ struct QWindowsGeometryHint explicit QWindowsGeometryHint(const QWindow *w, const QMargins &customMargins); static QMargins frame(DWORD style, DWORD exStyle); static bool handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result); -#ifndef Q_OS_WINCE //MinMax maybe define struct if not available void applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const; void applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const; -#endif bool validSize(const QSize &s) const; static inline QPoint mapToGlobal(HWND hwnd, const QPoint &); @@ -83,10 +78,8 @@ struct QWindowCreationContext QWindowCreationContext(const QWindow *w, const QRect &r, const QMargins &customMargins, DWORD style, DWORD exStyle); -#ifndef Q_OS_WINCE //MinMax maybe define struct if not available void applyToMinMaxInfo(MINMAXINFO *mmi) const { geometryHint.applyToMinMaxInfo(style, exStyle, mmi); } -#endif QWindowsGeometryHint geometryHint; const QWindow *window; @@ -293,10 +286,8 @@ public: HDC getDC(); void releaseDC(); -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void getSizeHints(MINMAXINFO *mmi) const; bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const; -#endif // !Q_OS_WINCE #ifndef QT_NO_CURSOR CursorHandlePtr cursor() const { return m_cursor; } @@ -316,12 +307,10 @@ public: void invalidateSurface() Q_DECL_OVERRIDE; void aboutToMakeCurrent(); -#ifndef Q_OS_WINCE void setAlertState(bool enabled) Q_DECL_OVERRIDE; bool isAlertState() const Q_DECL_OVERRIDE { return testFlag(AlertState); } void alertWindow(int durationMs = 0); void stopAlertWindow(); -#endif static void setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes); void registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes = QWindowsWindowFunctions::NormalTouch); @@ -355,9 +344,6 @@ private: unsigned m_savedStyle; QRect m_savedFrameGeometry; const QSurfaceFormat m_format; -#ifdef Q_OS_WINCE - bool m_previouslyHidden; -#endif HICON m_iconSmall; HICON m_iconBig; void *m_surface; @@ -366,11 +352,9 @@ private: #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const RECT &r); QDebug operator<<(QDebug d, const POINT &); -# ifndef Q_OS_WINCE QDebug operator<<(QDebug d, const MINMAXINFO &i); QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p); QDebug operator<<(QDebug d, const WINDOWPLACEMENT &); -# endif // !Q_OS_WINCE #endif // !QT_NO_DEBUG_STREAM // ---------- QWindowsGeometryHint inline functions. @@ -434,11 +418,7 @@ inline void QWindowsWindow::destroyIcon() inline bool QWindowsWindow::isLayered() const { -#ifndef Q_OS_WINCE return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED; -#else - return false; -#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index f4dbd10a49..b8476df792 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -1,14 +1,11 @@ # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. -LIBS *= -lole32 -!wince: LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32 +LIBS += -lole32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32 contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32 mingw: LIBS *= -luuid # For the dialog helpers: -!wince: LIBS *= -lshlwapi -lshell32 -!wince: LIBS *= -ladvapi32 -wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" +LIBS += -lshlwapi -lshell32 -ladvapi32 DEFINES *= QT_NO_CAST_FROM_ASCII @@ -62,7 +59,6 @@ HEADERS += \ $$PWD/qwindowstheme.h \ $$PWD/qwindowsdialoghelpers.h \ $$PWD/qwindowsservices.h \ - $$PWD/qplatformfunctions_wince.h \ $$PWD/qwindowsnativeimage.h \ $$PWD/qwindowsnativeinterface.h \ $$PWD/qwindowsopengltester.h \ @@ -101,36 +97,30 @@ contains(QT_CONFIG,dynamicgl) { } } -!wince:!contains( DEFINES, QT_NO_TABLETEVENT ) { +!contains( DEFINES, QT_NO_TABLETEVENT ) { INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wintab HEADERS += $$PWD/qwindowstabletsupport.h SOURCES += $$PWD/qwindowstabletsupport.cpp } -!wince:!contains( DEFINES, QT_NO_SESSIONMANAGER ) { +!contains( DEFINES, QT_NO_SESSIONMANAGER ) { SOURCES += $$PWD/qwindowssessionmanager.cpp HEADERS += $$PWD/qwindowssessionmanager.h } -!wince:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) { - RESOURCES += $$PWD/cursors.qrc -} +!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ):RESOURCES += $$PWD/cursors.qrc -!wince: RESOURCES += $$PWD/openglblacklists.qrc +RESOURCES += $$PWD/openglblacklists.qrc contains(QT_CONFIG, freetype) { - DEFINES *= QT_NO_FONTCONFIG - include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) - HEADERS += \ - $$PWD/qwindowsfontdatabase_ft.h - SOURCES += \ - $$PWD/qwindowsfontdatabase_ft.cpp -} else:contains(QT_CONFIG, system-freetype) { - include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) - HEADERS += \ - $$PWD/qwindowsfontdatabase_ft.h - SOURCES += \ - $$PWD/qwindowsfontdatabase_ft.cpp + HEADERS += $$PWD/qwindowsfontdatabase_ft.h + SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp + contains(QT_CONFIG, system-freetype) { + include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) + } else { + DEFINES *= QT_NO_FONTCONFIG + include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) + } } contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri) diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 2e0f723693..adafa830d5 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -4,7 +4,7 @@ QT *= core-private QT *= gui-private QT *= platformsupport-private -!wince:LIBS *= -lgdi32 +LIBS += -lgdi32 -ldwmapi include(windows.pri) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 51c6b198e5..2925917562 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -223,14 +223,14 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy) preparePaint(area); const QPoint delta(dx, dy); - foreach (const QRect &rect, area.rects()) + for (const QRect &rect : area) qt_scrollRectInImage(*image(), rect, delta); if (m_xcb_pixmap) { flushPixmap(area); ensureGC(m_xcb_pixmap); const QRect bounds(QPoint(0, 0), size()); - foreach (const QRect &src, area.rects()) { + for (const QRect &src : area) { const QRect dst = src.translated(delta).intersected(bounds); Q_XCB_CALL(xcb_copy_area(xcb_connection(), m_xcb_pixmap, @@ -531,11 +531,9 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) if (m_image->hasAlpha()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = m_paintRegion.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); - } + for (const QRect &rect : m_paintRegion) + p.fillRect(rect, blank); } } @@ -547,22 +545,21 @@ void QXcbBackingStore::endPaint() // Slow path: the paint device was m_rgbImage. Now copy with swapping red // and blue into m_image. - const QVector<QRect> rects = m_paintRegion.rects(); - if (rects.isEmpty()) + auto it = m_paintRegion.begin(); + const auto end = m_paintRegion.end(); + if (it == end) return; QPainter p(m_image->image()); - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + while (it != end) { const QRect rect = *it; p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } } -#ifndef QT_NO_OPENGL QImage QXcbBackingStore::toImage() const { return m_image && m_image->image() ? *m_image->image() : QImage(); } -#endif QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const { diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 1f5652d918..4b8c040729 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -62,8 +62,8 @@ public: void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, QOpenGLContext *context, bool translucentBackground) Q_DECL_OVERRIDE; - QImage toImage() const Q_DECL_OVERRIDE; #endif + QImage toImage() const Q_DECL_OVERRIDE; QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index a97420380c..b0b21a5be4 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2748,9 +2748,8 @@ void QXcbWindow::setMask(const QRegion ®ion) XCB_SHAPE_SK_BOUNDING, xcb_window(), 0, 0, XCB_NONE); } else { QVector<xcb_rectangle_t> rects; - const QVector<QRect> regionRects = region.rects(); - rects.reserve(regionRects.count()); - foreach (const QRect &r, regionRects) + rects.reserve(region.rectCount()); + for (const QRect &r : region) rects.push_back(qRectToXCBRectangle(r)); xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index f4a4e5a78a..cbb4c361f9 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -48,10 +48,10 @@ contains(QT_CONFIG, xcb-xlib) { DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp LIBS += -lXi - !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) { - DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \ - LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \ - LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH + !isEmpty(QMAKE_XINPUT2_VERSION_MAJOR) { + DEFINES += LIBXI_MAJOR=$$QMAKE_XINPUT2_VERSION_MAJOR \ + LIBXI_MINOR=$$QMAKE_XINPUT2_VERSION_MINOR \ + LIBXI_PATCH=$$QMAKE_XINPUT2_VERSION_PATCH } } } @@ -81,7 +81,7 @@ CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, dbus-linked) { QT += dbus - LIBS += $$QT_LIBS_DBUS + LIBS += $$QMAKE_LIBS_DBUS } contains(QT_CONFIG, xcb-qt) { diff --git a/src/plugins/platformthemes/gtk3/gtk3.pro b/src/plugins/platformthemes/gtk3/gtk3.pro index cd19e73ed8..557918c5a4 100644 --- a/src/plugins/platformthemes/gtk3/gtk3.pro +++ b/src/plugins/platformthemes/gtk3/gtk3.pro @@ -8,8 +8,8 @@ load(qt_plugin) QT += core-private gui-private platformsupport-private CONFIG += X11 -QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTK3 -LIBS += $$QT_LIBS_QGTK3 +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GTK3 +LIBS += $$QMAKE_LIBS_GTK3 HEADERS += \ qgtk3dialoghelpers.h \ diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro index 2365c5bc0e..31822ef8dc 100644 --- a/src/plugins/sqldrivers/db2/db2.pro +++ b/src/plugins/sqldrivers/db2/db2.pro @@ -1,8 +1,15 @@ TARGET = qsqldb2 -SOURCES = main.cpp +HEADERS += $$PWD/qsql_db2_p.h +SOURCES += $$PWD/qsql_db2.cpp $$PWD/main.cpp + +unix { + !contains(LIBS, .*db2.*):LIBS += -ldb2 +} else { + !contains(LIBS, .*db2.*):LIBS += -ldb2cli +} + OTHER_FILES += db2.json -include(../../../sql/drivers/db2/qsql_db2.pri) PLUGIN_CLASS_NAME = QDB2DriverPlugin include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/db2/main.cpp b/src/plugins/sqldrivers/db2/main.cpp index 3869d7798d..97338b8eef 100644 --- a/src/plugins/sqldrivers/db2/main.cpp +++ b/src/plugins/sqldrivers/db2/main.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../sql/drivers/db2/qsql_db2_p.h" +#include "qsql_db2_p.h" QT_BEGIN_NAMESPACE diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp index 4ccc3aca9e..4ccc3aca9e 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp diff --git a/src/sql/drivers/db2/qsql_db2_p.h b/src/plugins/sqldrivers/db2/qsql_db2_p.h index fa6d739479..fa6d739479 100644 --- a/src/sql/drivers/db2/qsql_db2_p.h +++ b/src/plugins/sqldrivers/db2/qsql_db2_p.h diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro index 1f29597a2b..8237245183 100644 --- a/src/plugins/sqldrivers/ibase/ibase.pro +++ b/src/plugins/sqldrivers/ibase/ibase.pro @@ -1,8 +1,17 @@ TARGET = qsqlibase -SOURCES = main.cpp +HEADERS += $$PWD/qsql_ibase_p.h +SOURCES += $$PWD/qsql_ibase.cpp $$PWD/main.cpp + +unix { + !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds +} else { + !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) { + LIBS += -lgds32_ms + } +} + OTHER_FILES += ibase.json -include(../../../sql/drivers/ibase/qsql_ibase.pri) PLUGIN_CLASS_NAME = QIBaseDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/ibase/main.cpp b/src/plugins/sqldrivers/ibase/main.cpp index c6f0b785de..8d462afcdc 100644 --- a/src/plugins/sqldrivers/ibase/main.cpp +++ b/src/plugins/sqldrivers/ibase/main.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../sql/drivers/ibase/qsql_ibase_p.h" +#include "qsql_ibase_p.h" QT_BEGIN_NAMESPACE diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp index 6fd91b6b76..6fd91b6b76 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp diff --git a/src/sql/drivers/ibase/qsql_ibase_p.h b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h index c7cee41462..c7cee41462 100644 --- a/src/sql/drivers/ibase/qsql_ibase_p.h +++ b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp index 855a6eeb9c..00d9c5bb34 100644 --- a/src/plugins/sqldrivers/mysql/main.cpp +++ b/src/plugins/sqldrivers/mysql/main.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../sql/drivers/mysql/qsql_mysql_p.h" +#include "qsql_mysql_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro index c917bfca48..3bd8cd0040 100644 --- a/src/plugins/sqldrivers/mysql/mysql.pro +++ b/src/plugins/sqldrivers/mysql/mysql.pro @@ -1,8 +1,23 @@ TARGET = qsqlmysql -SOURCES = main.cpp +HEADERS += $$PWD/qsql_mysql_p.h +SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp + +QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_MYSQL +LIBS += $$QMAKE_LIBS_MYSQL + +unix { + isEmpty(QMAKE_LIBS_MYSQL) { + !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { + use_libmysqlclient_r:LIBS += -lmysqlclient_r + else:LIBS += -lmysqlclient + } + } +} else { + !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql +} + OTHER_FILES += mysql.json -include(../../../sql/drivers/mysql/qsql_mysql.pri) PLUGIN_CLASS_NAME = QMYSQLDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp index 56caf52dcb..56caf52dcb 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp diff --git a/src/sql/drivers/mysql/qsql_mysql_p.h b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h index 7641f9aa34..7641f9aa34 100644 --- a/src/sql/drivers/mysql/qsql_mysql_p.h +++ b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h diff --git a/src/plugins/sqldrivers/oci/main.cpp b/src/plugins/sqldrivers/oci/main.cpp index 980116123d..e576928d31 100644 --- a/src/plugins/sqldrivers/oci/main.cpp +++ b/src/plugins/sqldrivers/oci/main.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../sql/drivers/oci/qsql_oci_p.h" +#include "qsql_oci_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro index 96a0dd9ab6..a22d1181bf 100644 --- a/src/plugins/sqldrivers/oci/oci.pro +++ b/src/plugins/sqldrivers/oci/oci.pro @@ -1,8 +1,16 @@ TARGET = qsqloci -SOURCES = main.cpp +HEADERS += $$PWD/qsql_oci_p.h +SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp + +unix { + !contains(LIBS, .*clnts.*):LIBS += -lclntsh +} else { + LIBS *= -loci +} +darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ + OTHER_FILES += oci.json -include(../../../sql/drivers/oci/qsql_oci.pri) PLUGIN_CLASS_NAME = QOCIDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp index 47d6db7ea4..47d6db7ea4 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp diff --git a/src/sql/drivers/oci/qsql_oci_p.h b/src/plugins/sqldrivers/oci/qsql_oci_p.h index 69911f4bee..69911f4bee 100644 --- a/src/sql/drivers/oci/qsql_oci_p.h +++ b/src/plugins/sqldrivers/oci/qsql_oci_p.h diff --git a/src/plugins/sqldrivers/odbc/main.cpp b/src/plugins/sqldrivers/odbc/main.cpp index 69ea7b1f8e..ac63941a82 100644 --- a/src/plugins/sqldrivers/odbc/main.cpp +++ b/src/plugins/sqldrivers/odbc/main.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../sql/drivers/odbc/qsql_odbc_p.h" +#include "qsql_odbc_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro index c0020c065f..0e49f1ac66 100644 --- a/src/plugins/sqldrivers/odbc/odbc.pro +++ b/src/plugins/sqldrivers/odbc/odbc.pro @@ -1,8 +1,19 @@ TARGET = qsqlodbc -SOURCES = main.cpp +HEADERS += $$PWD/qsql_odbc_p.h +SOURCES += $$PWD/qsql_odbc.cpp $$PWD/main.cpp + +unix { + DEFINES += UNICODE + !contains(LIBS, .*odbc.*) { + osx:LIBS += -liodbc + else:LIBS += $$QMAKE_LIBS_ODBC + } +} else { + LIBS *= -lodbc32 +} + OTHER_FILES += odbc.json -include(../../../sql/drivers/odbc/qsql_odbc.pri) PLUGIN_CLASS_NAME = QODBCDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 59ef42d609..59ef42d609 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp diff --git a/src/sql/drivers/odbc/qsql_odbc_p.h b/src/plugins/sqldrivers/odbc/qsql_odbc_p.h index f4ce8bc243..f4ce8bc243 100644 --- a/src/sql/drivers/odbc/qsql_odbc_p.h +++ b/src/plugins/sqldrivers/odbc/qsql_odbc_p.h diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp index eae1c1c554..7657fcbfdf 100644 --- a/src/plugins/sqldrivers/psql/main.cpp +++ b/src/plugins/sqldrivers/psql/main.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../sql/drivers/psql/qsql_psql_p.h" +#include "qsql_psql_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro index 0fabe0e616..4a05266120 100644 --- a/src/plugins/sqldrivers/psql/psql.pro +++ b/src/plugins/sqldrivers/psql/psql.pro @@ -1,8 +1,17 @@ TARGET = qsqlpsql -SOURCES = main.cpp +HEADERS += $$PWD/qsql_psql_p.h +SOURCES += $$PWD/qsql_psql.cpp $$PWD/main.cpp + +unix|mingw { + LIBS += $$QMAKE_LIBS_PSQL + !contains(LIBS, .*pq.*):LIBS += -lpq + QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_PSQL +} else { + !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32 +} + OTHER_FILES += psql.json -include(../../../sql/drivers/psql/qsql_psql.pri) PLUGIN_CLASS_NAME = QPSQLDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index fcf75af298..fcf75af298 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp diff --git a/src/sql/drivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h index 8468b9af93..8468b9af93 100644 --- a/src/sql/drivers/psql/qsql_psql_p.h +++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h diff --git a/src/plugins/sqldrivers/sqldrivers.pro b/src/plugins/sqldrivers/sqldrivers.pro index 39c58d4f2b..37dbd2394e 100644 --- a/src/plugins/sqldrivers/sqldrivers.pro +++ b/src/plugins/sqldrivers/sqldrivers.pro @@ -1,11 +1,11 @@ TEMPLATE = subdirs -contains(sql-plugins, psql) : SUBDIRS += psql -contains(sql-plugins, mysql) : SUBDIRS += mysql -contains(sql-plugins, odbc) : SUBDIRS += odbc -contains(sql-plugins, tds) : SUBDIRS += tds -contains(sql-plugins, oci) : SUBDIRS += oci -contains(sql-plugins, db2) : SUBDIRS += db2 -contains(sql-plugins, sqlite) : SUBDIRS += sqlite -contains(sql-plugins, sqlite2) : SUBDIRS += sqlite2 -contains(sql-plugins, ibase) : SUBDIRS += ibase +contains(sql-drivers, psql) : SUBDIRS += psql +contains(sql-drivers, mysql) : SUBDIRS += mysql +contains(sql-drivers, odbc) : SUBDIRS += odbc +contains(sql-drivers, tds) : SUBDIRS += tds +contains(sql-drivers, oci) : SUBDIRS += oci +contains(sql-drivers, db2) : SUBDIRS += db2 +contains(sql-drivers, sqlite) : SUBDIRS += sqlite +contains(sql-drivers, sqlite2) : SUBDIRS += sqlite2 +contains(sql-drivers, ibase) : SUBDIRS += ibase diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 2a45b73d14..ef4ef2e93c 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -59,6 +59,7 @@ #endif #include <sqlite3.h> +#include <functional> Q_DECLARE_OPAQUE_POINTER(sqlite3*) Q_DECLARE_METATYPE(sqlite3*) @@ -140,6 +141,7 @@ public: inline QSQLiteDriverPrivate() : QSqlDriverPrivate(), access(0) { dbmsType = QSqlDriver::SQLite; } sqlite3 *access; QList <QSQLiteResult *> results; + QStringList notificationid; }; @@ -571,6 +573,7 @@ QSQLiteDriver::QSQLiteDriver(sqlite3 *connection, QObject *parent) QSQLiteDriver::~QSQLiteDriver() { + close(); } bool QSQLiteDriver::hasFeature(DriverFeature f) const @@ -585,11 +588,11 @@ bool QSQLiteDriver::hasFeature(DriverFeature f) const case SimpleLocking: case FinishQuery: case LowPrecisionNumbers: + case EventNotifications: return true; case QuerySize: case NamedPlaceholders: case BatchOperations: - case EventNotifications: case MultipleResultSets: case CancelQuery: return false; @@ -664,9 +667,13 @@ void QSQLiteDriver::close() for (QSQLiteResult *result : qAsConst(d->results)) result->d_func()->finalize(); + if (d->access && (d->notificationid.count() > 0)) { + d->notificationid.clear(); + sqlite3_update_hook(d->access, NULL, NULL); + } + if (sqlite3_close(d->access) != SQLITE_OK) - setLastError(qMakeError(d->access, tr("Error closing database"), - QSqlError::ConnectionError)); + setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError)); d->access = 0; setOpen(false); setOpenError(false); @@ -825,4 +832,72 @@ QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierTyp return _q_escapeIdentifier(identifier); } +static void handle_sqlite_callback(void *qobj,int aoperation, char const *adbname, char const *atablename, + sqlite3_int64 arowid) +{ + Q_UNUSED(aoperation); + Q_UNUSED(adbname); + QSQLiteDriver *driver = static_cast<QSQLiteDriver *>(qobj); + if (driver) { + QMetaObject::invokeMethod(driver, "handleNotification", Qt::QueuedConnection, + Q_ARG(QString, QString::fromUtf8(atablename)), Q_ARG(qint64, arowid)); + } +} + +bool QSQLiteDriver::subscribeToNotification(const QString &name) +{ + Q_D(QSQLiteDriver); + if (!isOpen()) { + qWarning("Database not open."); + return false; + } + + if (d->notificationid.contains(name)) { + qWarning("Already subscribing to '%s'.", qPrintable(name)); + return false; + } + + //sqlite supports only one notification callback, so only the first is registered + d->notificationid << name; + if (d->notificationid.count() == 1) + sqlite3_update_hook(d->access, &handle_sqlite_callback, reinterpret_cast<void *> (this)); + + return true; +} + +bool QSQLiteDriver::unsubscribeFromNotification(const QString &name) +{ + Q_D(QSQLiteDriver); + if (!isOpen()) { + qWarning("Database not open."); + return false; + } + + if (!d->notificationid.contains(name)) { + qWarning("Not subscribed to '%s'.", qPrintable(name)); + return false; + } + + d->notificationid.removeAll(name); + if (d->notificationid.isEmpty()) + sqlite3_update_hook(d->access, NULL, NULL); + + return true; +} + +QStringList QSQLiteDriver::subscribedToNotifications() const +{ + Q_D(const QSQLiteDriver); + return d->notificationid; +} + +void QSQLiteDriver::handleNotification(const QString &tableName, qint64 rowid) +{ + Q_D(const QSQLiteDriver); + if (d->notificationid.contains(tableName)) { + emit notification(tableName); + emit notification(tableName, QSqlDriver::UnknownSource, QVariant(rowid)); + } +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/sqlite/qsql_sqlite_p.h b/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h index c9b7708698..ca969a4b53 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite_p.h +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h @@ -93,6 +93,12 @@ public: QSqlIndex primaryIndex(const QString &table) const Q_DECL_OVERRIDE; QVariant handle() const Q_DECL_OVERRIDE; QString escapeIdentifier(const QString &identifier, IdentifierType) const Q_DECL_OVERRIDE; + + bool subscribeToNotification(const QString &name) Q_DECL_OVERRIDE; + bool unsubscribeFromNotification(const QString &name) Q_DECL_OVERRIDE; + QStringList subscribedToNotifications() const Q_DECL_OVERRIDE; +private Q_SLOTS: + void handleNotification(const QString &tableName, qint64 rowid); }; QT_END_NAMESPACE diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp index 94b41c9878..2ad466a61e 100644 --- a/src/plugins/sqldrivers/sqlite/smain.cpp +++ b/src/plugins/sqldrivers/sqlite/smain.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../../src/sql/drivers/sqlite/qsql_sqlite_p.h" +#include "qsql_sqlite_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro index cc6d02cbe8..c98655f85c 100644 --- a/src/plugins/sqldrivers/sqlite/sqlite.pro +++ b/src/plugins/sqldrivers/sqlite/sqlite.pro @@ -1,8 +1,16 @@ TARGET = qsqlite -SOURCES = smain.cpp +HEADERS += $$PWD/qsql_sqlite_p.h +SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp + +!system-sqlite:!contains(LIBS, .*sqlite3.*) { + include($$PWD/../../../3rdparty/sqlite.pri) +} else { + LIBS += $$QMAKE_LIBS_SQLITE + QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_SQLITE +} + OTHER_FILES += sqlite.json -include(../../../sql/drivers/sqlite/qsql_sqlite.pri) PLUGIN_CLASS_NAME = QSQLiteDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp index 67c24e4168..67c24e4168 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h index 83b248ec6a..83b248ec6a 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h +++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h diff --git a/src/plugins/sqldrivers/sqlite2/smain.cpp b/src/plugins/sqldrivers/sqlite2/smain.cpp index 06b428c8ef..3a5734f8c9 100644 --- a/src/plugins/sqldrivers/sqlite2/smain.cpp +++ b/src/plugins/sqldrivers/sqlite2/smain.cpp @@ -39,7 +39,7 @@ #include <qsqldriverplugin.h> #include <qstringlist.h> -#include "../../../../src/sql/drivers/sqlite2/qsql_sqlite2_p.h" +#include "qsql_sqlite2_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro index d69afc119f..d0ab0eef41 100644 --- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro +++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro @@ -1,8 +1,11 @@ TARGET = qsqlite2 -SOURCES = smain.cpp +HEADERS += $$PWD/qsql_sqlite2_p.h +SOURCES += $$PWD/qsql_sqlite2.cpp $$PWD/smain.cpp + +!contains(LIBS, .*sqlite.*):LIBS += -lsqlite + OTHER_FILES += sqlite2.json -include(../../../sql/drivers/sqlite2/qsql_sqlite2.pri) PLUGIN_CLASS_NAME = QSQLite2DriverPlugin include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp index ffb31ae179..4aa1444608 100644 --- a/src/plugins/sqldrivers/tds/main.cpp +++ b/src/plugins/sqldrivers/tds/main.cpp @@ -45,7 +45,7 @@ #define _WINSCARD_H_ #include <windows.h> #endif -#include "../../../sql/drivers/tds/qsql_tds_p.h" +#include "qsql_tds_p.h" QT_BEGIN_NAMESPACE diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/plugins/sqldrivers/tds/qsql_tds.cpp index 10d9fe7298..10d9fe7298 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/plugins/sqldrivers/tds/qsql_tds.cpp diff --git a/src/sql/drivers/tds/qsql_tds_p.h b/src/plugins/sqldrivers/tds/qsql_tds_p.h index d0914455a2..d0914455a2 100644 --- a/src/sql/drivers/tds/qsql_tds_p.h +++ b/src/plugins/sqldrivers/tds/qsql_tds_p.h diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro index 88f4b7c451..b5d32ae5a8 100644 --- a/src/plugins/sqldrivers/tds/tds.pro +++ b/src/plugins/sqldrivers/tds/tds.pro @@ -1,8 +1,17 @@ TARGET = qsqltds -SOURCES = main.cpp +HEADERS += $$PWD/qsql_tds_p.h +SOURCES += $$PWD/qsql_tds.cpp $$PWD/main.cpp + +unix|mingw: { + LIBS += $$QMAKE_LIBS_TDS + !contains(LIBS, .*sybdb.*):LIBS += -lsybdb + QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_TDS +} else { + LIBS *= -lNTWDBLIB +} + OTHER_FILES += tds.json -include(../../../sql/drivers/tds/qsql_tds.pri) PLUGIN_CLASS_NAME = QTDSDriverPlugin include(../qsqldriverbase.pri) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index edf4dcb164..a57b72b13e 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1716,7 +1716,6 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h } } -#if !defined(Q_OS_WINCE) // Scale, rotate and translate here. XFORM win_xform; win_xform.eM11 = xform.m11(); @@ -1728,7 +1727,6 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h SetGraphicsMode(hdc, GM_ADVANCED); SetWorldTransform(hdc, &win_xform); -#endif if (fast) { // fast path @@ -1781,11 +1779,9 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h } } -#if !defined(Q_OS_WINCE) win_xform.eM11 = win_xform.eM22 = 1.0; win_xform.eM12 = win_xform.eM21 = win_xform.eDx = win_xform.eDy = 0.0; SetWorldTransform(hdc, &win_xform); -#endif SelectObject(hdc, old_font); } diff --git a/src/sql/drivers/db2/qsql_db2.pri b/src/sql/drivers/db2/qsql_db2.pri deleted file mode 100644 index c9e65e2c2e..0000000000 --- a/src/sql/drivers/db2/qsql_db2.pri +++ /dev/null @@ -1,8 +0,0 @@ -HEADERS += $$PWD/qsql_db2_p.h -SOURCES += $$PWD/qsql_db2.cpp - -unix { - !contains(LIBS, .*db2.*):LIBS += -ldb2 -} else { - !contains(LIBS, .*db2.*):LIBS += -ldb2cli -} diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri deleted file mode 100644 index 87cc0b1d9e..0000000000 --- a/src/sql/drivers/drivers.pri +++ /dev/null @@ -1,11 +0,0 @@ -contains(sql-drivers, all):sql-driver += psql mysql odbc oci tds db2 sqlite ibase - -contains(sql-drivers, psql):include($$PWD/psql/qsql_psql.pri) -contains(sql-drivers, mysql):include($$PWD/mysql/qsql_mysql.pri) -contains(sql-drivers, odbc):include($$PWD/odbc/qsql_odbc.pri) -contains(sql-drivers, oci):include($$PWD/oci/qsql_oci.pri) -contains(sql-drivers, tds):include($$PWD/tds/qsql_tds.pri) -contains(sql-drivers, db2):include($$PWD/db2/qsql_db2.pri) -contains(sql-drivers, ibase):include($$PWD/ibase/qsql_ibase.pri) -contains(sql-drivers, sqlite2):include($$PWD/sqlite2/qsql_sqlite2.pri) -contains(sql-drivers, sqlite):include($$PWD/sqlite/qsql_sqlite.pri) diff --git a/src/sql/drivers/ibase/qsql_ibase.pri b/src/sql/drivers/ibase/qsql_ibase.pri deleted file mode 100644 index ef3b68d34e..0000000000 --- a/src/sql/drivers/ibase/qsql_ibase.pri +++ /dev/null @@ -1,10 +0,0 @@ -HEADERS += $$PWD/qsql_ibase_p.h -SOURCES += $$PWD/qsql_ibase.cpp - -unix { - !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds -} else { - !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) { - LIBS += -lgds32_ms - } -} diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri deleted file mode 100644 index 3cfb6144a1..0000000000 --- a/src/sql/drivers/mysql/qsql_mysql.pri +++ /dev/null @@ -1,16 +0,0 @@ -HEADERS += $$PWD/qsql_mysql_p.h -SOURCES += $$PWD/qsql_mysql.cpp - -QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL -LIBS += $$QT_LFLAGS_MYSQL - -unix { - isEmpty(QT_LFLAGS_MYSQL) { - !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { - use_libmysqlclient_r:LIBS += -lmysqlclient_r - else:LIBS += -lmysqlclient - } - } -} else { - !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql -} diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri deleted file mode 100644 index 66ccdb1abb..0000000000 --- a/src/sql/drivers/oci/qsql_oci.pri +++ /dev/null @@ -1,9 +0,0 @@ -HEADERS += $$PWD/qsql_oci_p.h -SOURCES += $$PWD/qsql_oci.cpp - -unix { - !contains(LIBS, .*clnts.*):LIBS += -lclntsh -} else { - LIBS *= -loci -} -mac:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri deleted file mode 100644 index b206df37c3..0000000000 --- a/src/sql/drivers/odbc/qsql_odbc.pri +++ /dev/null @@ -1,12 +0,0 @@ -HEADERS += $$PWD/qsql_odbc_p.h -SOURCES += $$PWD/qsql_odbc.cpp - -unix { - DEFINES += UNICODE - !contains(LIBS, .*odbc.*) { - macx:LIBS += -liodbc - else:LIBS += $$QT_LFLAGS_ODBC - } -} else { - LIBS *= -lodbc32 -} diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri deleted file mode 100644 index 867be3edb8..0000000000 --- a/src/sql/drivers/psql/qsql_psql.pri +++ /dev/null @@ -1,10 +0,0 @@ -HEADERS += $$PWD/qsql_psql_p.h -SOURCES += $$PWD/qsql_psql.cpp - -unix|mingw { - LIBS += $$QT_LFLAGS_PSQL - !contains(LIBS, .*pq.*):LIBS += -lpq - QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL -} else { - !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32 -} diff --git a/src/sql/drivers/sqlite/qsql_sqlite.pri b/src/sql/drivers/sqlite/qsql_sqlite.pri deleted file mode 100644 index e323f2eba5..0000000000 --- a/src/sql/drivers/sqlite/qsql_sqlite.pri +++ /dev/null @@ -1,9 +0,0 @@ -HEADERS += $$PWD/qsql_sqlite_p.h -SOURCES += $$PWD/qsql_sqlite.cpp - -!system-sqlite:!contains(LIBS, .*sqlite3.*) { - include($$PWD/../../../3rdparty/sqlite.pri) -} else { - LIBS += $$QT_LFLAGS_SQLITE - QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE -} diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri deleted file mode 100644 index 5baba30db0..0000000000 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.pri +++ /dev/null @@ -1,4 +0,0 @@ -HEADERS += $$PWD/qsql_sqlite2_p.h -SOURCES += $$PWD/qsql_sqlite2.cpp - -!contains(LIBS, .*sqlite.*):LIBS += -lsqlite diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri deleted file mode 100644 index 8c528c154d..0000000000 --- a/src/sql/drivers/tds/qsql_tds.pri +++ /dev/null @@ -1,10 +0,0 @@ -HEADERS += $$PWD/qsql_tds_p.h -SOURCES += $$PWD/qsql_tds.cpp - -unix|mingw: { - LIBS += $$QT_LFLAGS_TDS - !contains(LIBS, .*sybdb.*):LIBS += -lsybdb - QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS -} else { - LIBS *= -lNTWDBLIB -} diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 62e1b6a7a5..d91e502b96 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -39,51 +39,6 @@ #include "qsqldatabase.h" #include "qsqlquery.h" - -#ifdef Q_OS_WIN32 -// Conflicting declarations of LPCBYTE in sqlfront.h and winscard.h -#define _WINSCARD_H_ -#endif - -#ifdef QT_SQL_PSQL -#include "../drivers/psql/qsql_psql_p.h" -#endif -#ifdef QT_SQL_MYSQL -#include "../drivers/mysql/qsql_mysql_p.h" -#endif -#ifdef QT_SQL_ODBC -#include "../drivers/odbc/qsql_odbc_p.h" -#endif -#ifdef QT_SQL_OCI -#include "../drivers/oci/qsql_oci_p.h" -#endif -#ifdef QT_SQL_TDS -// conflicting RETCODE typedef between odbc and freetds -#define RETCODE DBRETCODE -#include "../drivers/tds/qsql_tds_p.h" -#undef RETCODE -#endif -#ifdef QT_SQL_DB2 -#include "../drivers/db2/qsql_db2_p.h" -#endif -#ifdef QT_SQL_SQLITE -#include "../drivers/sqlite/qsql_sqlite_p.h" -#endif -#ifdef QT_SQL_SQLITE2 -#include "../drivers/sqlite2/qsql_sqlite2_p.h" -#endif -#ifdef QT_SQL_IBASE -#undef SQL_FLOAT // avoid clash with ODBC -#undef SQL_DOUBLE -#undef SQL_TIMESTAMP -#undef SQL_TYPE_TIME -#undef SQL_TYPE_DATE -#undef SQL_DATE -#define SCHAR IBASE_SCHAR // avoid clash with ODBC (older versions of ibase.h with Firebird) -#include "../drivers/ibase/qsql_ibase_p.h" -#undef SCHAR -#endif - #include "qdebug.h" #include "qcoreapplication.h" #include "qreadwritelock.h" @@ -542,39 +497,6 @@ QStringList QSqlDatabase::drivers() { QStringList list; -#ifdef QT_SQL_PSQL - list << QLatin1String("QPSQL7"); - list << QLatin1String("QPSQL"); -#endif -#ifdef QT_SQL_MYSQL - list << QLatin1String("QMYSQL3"); - list << QLatin1String("QMYSQL"); -#endif -#ifdef QT_SQL_ODBC - list << QLatin1String("QODBC3"); - list << QLatin1String("QODBC"); -#endif -#ifdef QT_SQL_OCI - list << QLatin1String("QOCI8"); - list << QLatin1String("QOCI"); -#endif -#ifdef QT_SQL_TDS - list << QLatin1String("QTDS7"); - list << QLatin1String("QTDS"); -#endif -#ifdef QT_SQL_DB2 - list << QLatin1String("QDB2"); -#endif -#ifdef QT_SQL_SQLITE - list << QLatin1String("QSQLITE"); -#endif -#ifdef QT_SQL_SQLITE2 - list << QLatin1String("QSQLITE2"); -#endif -#ifdef QT_SQL_IBASE - list << QLatin1String("QIBASE"); -#endif - if (QFactoryLoader *fl = loader()) { typedef QMultiMap<int, QString> PluginKeyMap; typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; @@ -726,45 +648,6 @@ void QSqlDatabasePrivate::init(const QString &type) drvName = type; if (!driver) { -#ifdef QT_SQL_PSQL - if (type == QLatin1String("QPSQL") || type == QLatin1String("QPSQL7")) - driver = new QPSQLDriver(); -#endif -#ifdef QT_SQL_MYSQL - if (type == QLatin1String("QMYSQL") || type == QLatin1String("QMYSQL3")) - driver = new QMYSQLDriver(); -#endif -#ifdef QT_SQL_ODBC - if (type == QLatin1String("QODBC") || type == QLatin1String("QODBC3")) - driver = new QODBCDriver(); -#endif -#ifdef QT_SQL_OCI - if (type == QLatin1String("QOCI") || type == QLatin1String("QOCI8")) - driver = new QOCIDriver(); -#endif -#ifdef QT_SQL_TDS - if (type == QLatin1String("QTDS") || type == QLatin1String("QTDS7")) - driver = new QTDSDriver(); -#endif -#ifdef QT_SQL_DB2 - if (type == QLatin1String("QDB2")) - driver = new QDB2Driver(); -#endif -#ifdef QT_SQL_SQLITE - if (type == QLatin1String("QSQLITE")) - driver = new QSQLiteDriver(); -#endif -#ifdef QT_SQL_SQLITE2 - if (type == QLatin1String("QSQLITE2")) - driver = new QSQLite2Driver(); -#endif -#ifdef QT_SQL_IBASE - if (type == QLatin1String("QIBASE")) - driver = new QIBaseDriver(); -#endif - } - - if (!driver) { DriverDict dict = QSqlDatabasePrivate::driverDict(); for (DriverDict::const_iterator it = dict.constBegin(); it != dict.constEnd() && !driver; ++it) { diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 218671d7e7..622ffb66c5 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -11,7 +11,6 @@ PRECOMPILED_HEADER = ../corelib/global/qt_pch.h SQL_P = sql include(kernel/kernel.pri) -include(drivers/drivers.pri) include(models/models.pri) MODULE_PLUGIN_TYPES = \ diff --git a/src/src.pro b/src/src.pro index 4a165a2dab..0e411f96af 100644 --- a/src/src.pro +++ b/src/src.pro @@ -129,7 +129,7 @@ src_plugins.depends = src_sql src_xml src_network src_android.subdir = $$PWD/android # this order is important -contains(QT_CONFIG, zlib)|cross_compile: SUBDIRS += src_qtzlib +!contains(QT_CONFIG, system-zlib)|cross_compile: SUBDIRS += src_qtzlib SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc !contains(QT_DISABLED_FEATURES, regularexpression):pcre { SUBDIRS += src_3rdparty_pcre @@ -149,7 +149,7 @@ contains(QT_CONFIG, dbus) { } contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent !contains(QT_CONFIG, no-gui) { - contains(QT_CONFIG, harfbuzz) { + contains(QT_CONFIG, harfbuzz):!contains(QT_CONFIG, system-harfbuzz) { SUBDIRS += src_3rdparty_harfbuzzng src_gui.depends += src_3rdparty_harfbuzzng } @@ -157,7 +157,7 @@ contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent SUBDIRS += src_angle src_gui.depends += src_angle } - contains(QT_CONFIG, freetype) { + contains(QT_CONFIG, freetype):!contains(QT_CONFIG, system-freetype) { SUBDIRS += src_3rdparty_freetype src_platformsupport.depends += src_3rdparty_freetype } diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp index 72b5eb3ed7..8337600fa1 100644 --- a/src/testlib/qabstracttestlogger.cpp +++ b/src/testlib/qabstracttestlogger.cpp @@ -62,7 +62,7 @@ QAbstractTestLogger::QAbstractTestLogger(const char *filename) stream = stdout; return; } -#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) +#if defined(_MSC_VER) if (::fopen_s(&stream, filename, "wt")) { #else stream = ::fopen(filename, "wt"); diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index 0a9072907f..0ba55dbeb7 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -56,6 +56,7 @@ \value CPUTicks CPU time \value CPUMigrations Process migrations between CPUs \value CPUCycles CPU cycles + \value RefCPUCycles Reference CPU cycles \value BusCycles Bus cycles \value StalledCycles Cycles stalled \value InstructionReads Instruction reads @@ -108,6 +109,8 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) return "CPUMigrations"; case CPUCycles: return "CPUCycles"; + case RefCPUCycles: + return "RefCPUCycles"; case BusCycles: return "BusCycles"; case StalledCycles: @@ -180,6 +183,8 @@ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) return "CPU migrations"; case CPUCycles: return "CPU cycles"; + case RefCPUCycles: + return "Reference CPU cycles"; case BusCycles: return "bus cycles"; case StalledCycles: diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h index 44bf14b9b6..6e423473b1 100644 --- a/src/testlib/qbenchmarkmetric.h +++ b/src/testlib/qbenchmarkmetric.h @@ -78,7 +78,8 @@ enum QBenchmarkMetric { MinorPageFaults, MajorPageFaults, AlignmentFaults, - EmulationFaults + EmulationFaults, + RefCPUCycles, }; } diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index 587d3e0124..d6db40ce52 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -153,6 +153,7 @@ bool QBenchmarkPerfEventsMeasurer::isAvailable() Event type Event counter Unit Name and aliases HARDWARE CPU_CYCLES CPUCycles cycles cpu-cycles + HARDWARE REF_CPU_CYCLES RefCPUCycles ref-cycles HARDWARE INSTRUCTIONS Instructions instructions HARDWARE CACHE_REFERENCES CacheReferences cache-references HARDWARE CACHE_MISSES CacheMisses cache-misses @@ -321,6 +322,7 @@ static const char eventlist_strings[] = "migrations\0" "minor-faults\0" "page-faults\0" + "ref-cycles\0" "stalled-cycles-backend\0" "stalled-cycles-frontend\0" "task-clock\0" @@ -407,9 +409,10 @@ static const Events eventlist[] = { { 1256, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS, QTest::CPUMigrations }, { 1267, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN, QTest::MinorPageFaults }, { 1280, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS, QTest::PageFaults }, - { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles }, - { 1315, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles }, - { 1339, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds }, + { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES, QTest::RefCPUCycles }, + { 1303, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles }, + { 1326, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles }, + { 1350, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds }, { 0, PERF_TYPE_MAX, 0, QTest::Events } }; /* -- END GENERATED CODE -- */ diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index a286246acd..dc20d922e5 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -49,10 +49,6 @@ #include <stdlib.h> #include <string.h> -#ifdef Q_OS_WINCE -#include <QtCore/QString> -#endif - #ifdef min // windows.h without NOMINMAX is included by the benchmark headers. # undef min #endif @@ -215,16 +211,7 @@ Q_CORE_EXPORT bool qt_logging_to_console(); // defined in qlogging.cpp void QPlainTestLogger::outputMessage(const char *str) { -#if defined(Q_OS_WINCE) - QString strUtf16 = QString::fromLocal8Bit(str); - const int maxOutputLength = 255; - do { - QString tmp = strUtf16.left(maxOutputLength); - OutputDebugString((wchar_t*)tmp.utf16()); - strUtf16.remove(0, maxOutputLength); - } while (!strUtf16.isEmpty()); - if (stream != stdout) -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) // log to system log only if output is not redirected, and no console is attached if (!qt_logging_to_console() && stream == stdout) { OutputDebugStringA(str); diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index c35b767875..261c769c15 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -192,6 +192,11 @@ template<> inline char *toString(const QHostAddress &addr) } #endif +inline char *toString(std::nullptr_t) +{ + return toString(QLatin1String("nullptr")); +} + template<> inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual, const char *expected, const char *file, int line) diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 4ef2dd3f67..e891150330 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -95,9 +95,6 @@ static QSet<QByteArray> keywords() #ifdef Q_OS_WINRT << "winrt" #endif -#ifdef Q_OS_WINCE - << "wince" -#endif #if QT_POINTER_SIZE == 8 << "64bit" diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index f4f758df6c..ed26c406a5 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -87,11 +87,9 @@ #endif #ifdef Q_OS_WIN -#ifndef Q_OS_WINCE # if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR)) # include <crtdbg.h> # endif -#endif #include <windows.h> // for Sleep #endif #ifdef Q_OS_UNIX @@ -1433,7 +1431,7 @@ FatalSignalHandler::~FatalSignalHandler() } // namespace -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Helper class for resolving symbol names by dynamically loading "dbghelp.dll". class DebugSymbolResolver @@ -1571,7 +1569,7 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) return EXCEPTION_EXECUTE_HANDLER; } -#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN) && !Q_OS_WINRT static void initEnvironment() { @@ -1663,7 +1661,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) qtest_qParseArgs(argc, argv, false); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (!noCrashHandler) { # ifndef Q_CC_MINGW _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); @@ -1673,7 +1671,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) SetUnhandledExceptionFilter(windowsFaultHandler); # endif } // !noCrashHandler -#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN #ifdef QTESTLIB_USE_VALGRIND if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) { @@ -2408,6 +2406,14 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac \internal */ +/*! \fn bool QTest::qCompare(T *t, std::nullptr_t, const char *actual, const char *expected, const char *file, int line) + \internal +*/ + +/*! \fn bool QTest::qCompare(std::nullptr_t, T *t, const char *actual, const char *expected, const char *file, int line) + \internal +*/ + /*! \fn bool QTest::qCompare(T *t1, T *t2, const char *actual, const char *expected, const char *file, int line) \internal */ diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index a27f7820f9..0395875cb3 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -332,13 +332,27 @@ namespace QTest Q_TESTLIB_EXPORT bool qCompare(double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line); - inline bool compare_ptr_helper(const void *t1, const void *t2, const char *actual, + inline bool compare_ptr_helper(const volatile void *t1, const volatile void *t2, const char *actual, const char *expected, const char *file, int line) { return compare_helper(t1 == t2, "Compared pointers are not the same", toString(t1), toString(t2), actual, expected, file, line); } + inline bool compare_ptr_helper(const volatile void *t1, std::nullptr_t, const char *actual, + const char *expected, const char *file, int line) + { + return compare_helper(t1 == nullptr, "Compared pointers are not the same", + toString(t1), toString(nullptr), actual, expected, file, line); + } + + inline bool compare_ptr_helper(std::nullptr_t, const volatile void *t2, const char *actual, + const char *expected, const char *file, int line) + { + return compare_helper(nullptr == t2, "Compared pointers are not the same", + toString(nullptr), toString(t2), actual, expected, file, line); + } + Q_TESTLIB_EXPORT bool compare_string_helper(const char *t1, const char *t2, const char *actual, const char *expected, const char *file, int line); @@ -388,6 +402,19 @@ namespace QTest return compare_ptr_helper(t1, t2, actual, expected, file, line); } + template <typename T> + inline bool qCompare(T *t1, std::nullptr_t, const char *actual, const char *expected, + const char *file, int line) + { + return compare_ptr_helper(t1, nullptr, actual, expected, file, line); + } + template <typename T> + inline bool qCompare(std::nullptr_t, T *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_ptr_helper(nullptr, t2, actual, expected, file, line); + } + template <typename T1, typename T2> inline bool qCompare(const T1 *t1, const T2 *t2, const char *actual, const char *expected, const char *file, int line) diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index 85f71fc27f..9513cf0c58 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -907,6 +907,14 @@ */ /*! + \fn char *QTest::toString(std::nullptr_t) + \overload + \since 5.8 + + Returns a string containing \c{nullptr}. +*/ + +/*! \fn char *QTest::toString(const QString &string) \overload diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp index 72faaeb9b1..ec33c29ae5 100644 --- a/src/testlib/qxunittestlogger.cpp +++ b/src/testlib/qxunittestlogger.cpp @@ -256,7 +256,7 @@ void QXunitTestLogger::addBenchmarkResult(const QBenchmarkResult &result) benchmarkElement->addAttribute( QTest::AI_Metric, - QTest::benchmarkMetricName(QBenchmarkTestMethodData::current->result.metric)); + QTest::benchmarkMetricName(result.metric)); benchmarkElement->addAttribute(QTest::AI_Tag, result.context.tag.toUtf8().data()); const qreal valuePerIteration = qreal(result.value) / qreal(result.iterations); diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 85fb0cd2fe..9d204208cf 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -66,13 +66,6 @@ DEFINES *= QT_NO_CAST_TO_ASCII \ QT_NO_CAST_FROM_ASCII \ QT_NO_DATASTREAM embedded:QMAKE_CXXFLAGS += -fno-rtti -wince: LIBS += \ - ole32.lib \ - oleaut32.lib \ - uuid.lib \ - commctrl.lib \ - coredll.lib \ - winsock.lib mac { LIBS += -framework Security diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 3cfdbf3429..47aa886568 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -133,7 +133,7 @@ macx { ../../corelib/io/qstandardpaths_win.cpp } -if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri) +!contains(QT_CONFIG, system-zlib)|cross_compile:include(../../3rdparty/zlib.pri) else:include(../../3rdparty/zlib_dependency.pri) win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32 diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 0734a92d5a..491301d582 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -200,20 +200,24 @@ int runMoc(int argc, char **argv) .arg(mocOutputRevision).arg(QString::fromLatin1(QT_VERSION_STR))); parser.addHelpOption(); parser.addVersionOption(); + parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); QCommandLineOption outputOption(QStringLiteral("o")); outputOption.setDescription(QStringLiteral("Write output to file rather than stdout.")); outputOption.setValueName(QStringLiteral("file")); + outputOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(outputOption); QCommandLineOption includePathOption(QStringLiteral("I")); includePathOption.setDescription(QStringLiteral("Add dir to the include path for header files.")); includePathOption.setValueName(QStringLiteral("dir")); + includePathOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(includePathOption); QCommandLineOption macFrameworkOption(QStringLiteral("F")); macFrameworkOption.setDescription(QStringLiteral("Add Mac framework to the include path for header files.")); macFrameworkOption.setValueName(QStringLiteral("framework")); + macFrameworkOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(macFrameworkOption); QCommandLineOption preprocessOption(QStringLiteral("E")); @@ -223,16 +227,19 @@ int runMoc(int argc, char **argv) QCommandLineOption defineOption(QStringLiteral("D")); defineOption.setDescription(QStringLiteral("Define macro, with optional definition.")); defineOption.setValueName(QStringLiteral("macro[=def]")); + defineOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(defineOption); QCommandLineOption undefineOption(QStringLiteral("U")); undefineOption.setDescription(QStringLiteral("Undefine macro.")); undefineOption.setValueName(QStringLiteral("macro")); + undefineOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(undefineOption); QCommandLineOption metadataOption(QStringLiteral("M")); metadataOption.setDescription(QStringLiteral("Add key/value pair to plugin meta data")); metadataOption.setValueName(QStringLiteral("key=value")); + metadataOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(metadataOption); QCommandLineOption noIncludeOption(QStringLiteral("i")); @@ -242,11 +249,13 @@ int runMoc(int argc, char **argv) QCommandLineOption pathPrefixOption(QStringLiteral("p")); pathPrefixOption.setDescription(QStringLiteral("Path prefix for included file.")); pathPrefixOption.setValueName(QStringLiteral("path")); + pathPrefixOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(pathPrefixOption); QCommandLineOption forceIncludeOption(QStringLiteral("f")); forceIncludeOption.setDescription(QStringLiteral("Force #include <file> (overwrite default).")); forceIncludeOption.setValueName(QStringLiteral("file")); + forceIncludeOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(forceIncludeOption); QCommandLineOption prependIncludeOption(QStringLiteral("b")); @@ -257,6 +266,7 @@ int runMoc(int argc, char **argv) QCommandLineOption noNotesWarningsCompatOption(QStringLiteral("n")); noNotesWarningsCompatOption.setDescription(QStringLiteral("Do not display notes (-nn) or warnings (-nw). Compatibility option.")); noNotesWarningsCompatOption.setValueName(QStringLiteral("which")); + noNotesWarningsCompatOption.setFlags(QCommandLineOption::ShortOptionStyle); parser.addOption(noNotesWarningsCompatOption); QCommandLineOption noNotesOption(QStringLiteral("no-notes")); diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 026d099dc0..8c8141f9e5 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -770,22 +770,22 @@ void WriteInitialization::acceptWidget(DomWidget *node) // // Special handling for qtableview/qtreeview fake header attributes // - static QStringList realPropertyNames = - (QStringList() << QLatin1String("visible") - << QLatin1String("cascadingSectionResizes") - << QLatin1String("defaultSectionSize") - << QLatin1String("highlightSections") - << QLatin1String("minimumSectionSize") - << QLatin1String("showSortIndicator") - << QLatin1String("stretchLastSection")); + static const QLatin1String realPropertyNames[] = { + QLatin1String("visible"), + QLatin1String("cascadingSectionResizes"), + QLatin1String("defaultSectionSize"), + QLatin1String("highlightSections"), + QLatin1String("minimumSectionSize"), + QLatin1String("showSortIndicator"), + QLatin1String("stretchLastSection"), + }; if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeView")) || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeWidget"))) { DomPropertyList headerProperties; - foreach (const QString &realPropertyName, realPropertyNames) { - const QString upperPropertyName = realPropertyName.at(0).toUpper() - + realPropertyName.mid(1); - const QString fakePropertyName = QLatin1String("header") + upperPropertyName; + for (auto realPropertyName : realPropertyNames) { + const QString fakePropertyName = QLatin1String("header") + + QChar(realPropertyName.at(0)).toUpper() + realPropertyName.mid(1); if (DomProperty *fakeProperty = attributes.value(fakePropertyName)) { fakeProperty->setAttributeName(realPropertyName); headerProperties << fakeProperty; @@ -797,16 +797,16 @@ void WriteInitialization::acceptWidget(DomWidget *node) } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableView")) || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableWidget"))) { - static QStringList headerPrefixes = - (QStringList() << QLatin1String("horizontalHeader") - << QLatin1String("verticalHeader")); + static const QLatin1String headerPrefixes[] = { + QLatin1String("horizontalHeader"), + QLatin1String("verticalHeader"), + }; - foreach (const QString &headerPrefix, headerPrefixes) { + for (auto headerPrefix : headerPrefixes) { DomPropertyList headerProperties; - foreach (const QString &realPropertyName, realPropertyNames) { - const QString upperPropertyName = realPropertyName.at(0).toUpper() - + realPropertyName.mid(1); - const QString fakePropertyName = headerPrefix + upperPropertyName; + for (auto realPropertyName : realPropertyNames) { + const QString fakePropertyName = headerPrefix + + QChar(realPropertyName.at(0)).toUpper() + realPropertyName.mid(1); if (DomProperty *fakeProperty = attributes.value(fakePropertyName)) { fakeProperty->setAttributeName(realPropertyName); headerProperties << fakeProperty; diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 8faa73b68b..463019dbd0 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -120,19 +120,26 @@ public: { if (!isValid()) return QString(); + QString str; switch (t) { case QAccessible::Name: - return qt_accStripAmp(m_parent->tabText(m_index)); + str = m_parent->accessibleTabName(m_index); + if (str.isEmpty()) + str = qt_accStripAmp(m_parent->tabText(m_index)); + break; case QAccessible::Accelerator: - return qt_accHotKey(m_parent->tabText(m_index)); + str = qt_accHotKey(m_parent->tabText(m_index)); + break; case QAccessible::Description: - return m_parent->tabToolTip(m_index); + str = m_parent->tabToolTip(m_index); + break; case QAccessible::Help: - return m_parent->tabWhatsThis(m_index); + str = m_parent->tabWhatsThis(m_index); + break; default: break; } - return QString(); + return str; } void setText(QAccessible::Text, const QString &) Q_DECL_OVERRIDE {} @@ -237,7 +244,12 @@ int QAccessibleTabBar::childCount() const QString QAccessibleTabBar::text(QAccessible::Text t) const { if (t == QAccessible::Name) { - return qt_accStripAmp(tabBar()->tabText(tabBar()->currentIndex())); + const QTabBar *tBar = tabBar(); + int idx = tBar->currentIndex(); + QString str = tBar->accessibleTabName(idx); + if (str.isEmpty()) + str = qt_accStripAmp(tBar->tabText(idx)); + return str; } else if (t == QAccessible::Accelerator) { return qt_accHotKey(tabBar()->tabText(tabBar()->currentIndex())); } diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index ebe8efc79e..ecb84d8b50 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -512,7 +512,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const if (!iface) { QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); if (Q_UNLIKELY(!index.isValid())) { - qWarning() << "QAccessibleTable::child: Invalid index at: " << row << column; + qWarning("QAccessibleTable::child: Invalid index at: %d %d", row, column); return 0; } iface = new QAccessibleTableCell(view(), index, cellRole()); @@ -783,7 +783,7 @@ QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const { QModelIndex index = indexFromLogical(row, column); if (Q_UNLIKELY(!index.isValid())) { - qWarning() << "Requested invalid tree cell: " << row << column; + qWarning("Requested invalid tree cell: %d %d", row, column); return 0; } const QTreeView *treeView = qobject_cast<const QTreeView*>(view()); diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 98f1f4870d..5494036827 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -92,7 +92,7 @@ public: SetColorAll = ShowColor | SelectColor }; - QColorDialogPrivate() : options(new QColorDialogOptions) + QColorDialogPrivate() : options(QColorDialogOptions::create()) #ifdef Q_OS_WIN32 , updateTimer(0) #endif @@ -1203,14 +1203,10 @@ QColorShower::QColorShower(QColorDialog *parent) gl->setMargin(gl->spacing()); lab = new QColorShowLabel(this); -#ifndef Q_OS_WINCE #ifdef QT_SMALL_COLORDIALOG lab->setMinimumHeight(60); #endif lab->setMinimumWidth(60); -#else - lab->setMinimumWidth(20); -#endif // For QVGA screens only the comboboxes and color label are visible. // For nHD screens only color and luminence pickers and color label are visible. @@ -1725,7 +1721,7 @@ void QColorDialogPrivate::initWidgets() leftLay = 0; -#if defined(Q_OS_WINCE) || defined(QT_SMALL_COLORDIALOG) +#if defined(QT_SMALL_COLORDIALOG) smallDisplay = true; const int lumSpace = 20; #else @@ -1748,7 +1744,7 @@ void QColorDialogPrivate::initWidgets() leftLay->addWidget(lblBasicColors); leftLay->addWidget(standard); -#if !defined(Q_OS_WINCE) && !defined(QT_SMALL_COLORDIALOG) +#if !defined(QT_SMALL_COLORDIALOG) // The screen color picker button screenColorPickerButton = new QPushButton(); leftLay->addWidget(screenColorPickerButton); @@ -1757,9 +1753,7 @@ void QColorDialogPrivate::initWidgets() q->connect(screenColorPickerButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor())); #endif -#if !defined(Q_OS_WINCE) leftLay->addStretch(); -#endif custom = new QColorWell(q, customColorRows, colorColumns, QColorDialogOptions::customColors()); custom->setAcceptDrops(true); @@ -1954,10 +1948,8 @@ static const Qt::WindowFlags DefaultWindowFlags = Constructs a color dialog with the given \a parent. */ QColorDialog::QColorDialog(QWidget *parent) - : QDialog(*new QColorDialogPrivate, parent, DefaultWindowFlags) + : QColorDialog(QColor(Qt::white), parent) { - Q_D(QColorDialog); - d->init(Qt::white); } /*! diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 5eb6130a45..74d138442a 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -427,31 +427,6 @@ void QDialogPrivate::resetModalitySetByOpen() resetModalityTo = -1; } -#if defined(Q_OS_WINCE) -#ifdef Q_OS_WINCE_WM -void QDialogPrivate::_q_doneAction() -{ - //Done... - QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest)); -} -#endif - -/*! - \reimp -*/ -bool QDialog::event(QEvent *e) -{ - bool result = QWidget::event(e); -#ifdef Q_OS_WINCE - if (e->type() == QEvent::OkRequest) { - accept(); - result = true; - } -#endif - return result; -} -#endif - /*! In general returns the modal dialog's result code, \c Accepted or \c Rejected. diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index db5baf24f9..562fbb63bb 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -98,9 +98,6 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags()); -#if defined(Q_OS_WINCE) - bool event(QEvent *e); -#endif void keyPressEvent(QKeyEvent *); void closeEvent(QCloseEvent *); void showEvent(QShowEvent *); @@ -113,10 +110,6 @@ protected: private: Q_DECLARE_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) - -#ifdef Q_OS_WINCE_WM - Q_PRIVATE_SLOT(d_func(), void _q_doneAction()) -#endif }; QT_END_NAMESPACE diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index 6a9b5bae57..6fe4b602a1 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -99,10 +99,6 @@ public: void hideDefault(); void resetModalitySetByOpen(); -#ifdef Q_OS_WINCE_WM - void _q_doneAction(); -#endif - int rescode; int resetModalityTo; bool wasModalitySet; diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 77d9eb29ac..5fcbe3fe9d 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -60,11 +60,6 @@ #include <stdio.h> #include <stdlib.h> -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp -#endif - QT_BEGIN_NAMESPACE class QErrorMessagePrivate : public QDialogPrivate @@ -100,32 +95,12 @@ public: QSize QErrorMessageTextView::minimumSizeHint() const { -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - if (qt_wince_is_high_dpi()) - return QSize(200, 200); - else - return QSize(100, 100); - else - return QSize(70, 70); -#else return QSize(50, 50); -#endif } QSize QErrorMessageTextView::sizeHint() const { -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - if (qt_wince_is_high_dpi()) - return QSize(400, 200); - else - return QSize(320, 120); - else - return QSize(300, 100); -#else return QSize(250, 75); -#endif //Q_OS_WINCE } /*! @@ -248,9 +223,6 @@ QErrorMessage::QErrorMessage(QWidget * parent) d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif d->again->setChecked(true); -#if defined(Q_OS_WINCE) - d->ok->setFixedSize(0,0); -#endif d->ok->setFocus(); d->retranslateStrings(); diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index d9b6dc05bf..5357cf28f7 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -60,15 +60,7 @@ #include <qmimedatabase.h> #include <qapplication.h> #include <qstylepainter.h> -#if !defined(Q_OS_WINCE) #include "ui_qfiledialog.h" -#else -#define Q_EMBEDDED_SMALLSCREEN -#include "ui_qfiledialog_embedded.h" -#if defined(Q_OS_WINCE) -extern bool qt_priv_ptr_valid; -#endif -#endif #if defined(Q_OS_UNIX) #include <pwd.h> #include <unistd.h> // for pathconf() on OS X @@ -533,7 +525,7 @@ QFileDialogPrivate::QFileDialogPrivate() showHiddenAction(0), useDefaultCaption(true), qFileDialogUi(0), - options(new QFileDialogOptions) + options(QFileDialogOptions::create()) { } @@ -1750,7 +1742,7 @@ int QFileDialogPrivate::maxNameLength(const QString &path) { #if defined(Q_OS_UNIX) return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); -#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WINRT) Q_UNUSED(path); return MAX_PATH; #elif defined(Q_OS_WIN) @@ -4015,7 +4007,7 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { -#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) +#if defined(Q_OS_UNIX) if (currentLocation == QDir::separator()) return path.mid(currentLocation.length()); #endif diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index f273a4fb37..d10f6d7065 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -177,10 +177,6 @@ public: #if defined(Q_OS_WIN) QString n(path); n.replace(QLatin1Char('\\'), QLatin1Char('/')); -#if defined(Q_OS_WINCE) - if ((n.size() > 1) && (n.startsWith(QLatin1String("//")))) - n = n.mid(1); -#endif return n; #else // the compile should optimize away this return path; diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 014792ea93..6df020dd58 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -263,7 +263,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const static QString translateDriveName(const QFileInfo &drive) { QString driveName = drive.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (driveName.startsWith(QLatin1Char('/'))) // UNC host return drive.fileName(); if (driveName.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index c72761f2ae..2f7edd8d07 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -366,13 +366,13 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS // ### TODO can we use bool QAbstractFileEngine::caseSensitive() const? QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty()) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && QDir::fromNativeSeparators(longPath) != QLatin1String("/") #endif ) return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root); QModelIndex index = QModelIndex(); // start with "My Computer" -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = QLatin1String("\\\\") + pathElements.constFirst(); if (absolutePath == QDir::fromNativeSeparators(host)) @@ -398,7 +398,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS } else #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) { if (!pathElements.at(0).contains(QLatin1Char(':'))) { QString rootPath = QDir(longPath).rootPath(); @@ -831,7 +831,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const */ QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QFileSystemNode *dirNode = node(index); if (!dirNode->volumeName.isNull()) return dirNode->volumeName + QLatin1String(" (") + name(index) + QLatin1Char(')'); @@ -1281,11 +1281,10 @@ QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const idx = idx.parent(); } QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator())); -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/')) fullPath = fullPath.mid(1); -#endif -#if defined(Q_OS_WIN) +#else if (fullPath.length() == 2 && fullPath.endsWith(QLatin1Char(':'))) fullPath.append(QLatin1Char('/')); #endif @@ -1676,7 +1675,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile #else Q_UNUSED(info) #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //The parentNode is "" so we are listing the drives if (parentNode->fileName.isEmpty()) { wchar_t name[MAX_PATH + 1]; diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index af3406b699..beb25f665d 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -95,7 +95,7 @@ public: } QString fileName; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QString volumeName; #endif diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 2a500d3a08..1c4166c567 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -110,7 +110,7 @@ static const Qt::WindowFlags DefaultWindowFlags = QFontDialogPrivate::QFontDialogPrivate() : writingSystem(QFontDatabase::Any), - options(QSharedPointer<QFontDialogOptions>::create()) + options(QFontDialogOptions::create()) { } @@ -168,10 +168,8 @@ QFontDialog::QFontDialog(QWidget *parent) \a initial color. */ QFontDialog::QFontDialog(const QFont &initial, QWidget *parent) - : QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags) + : QFontDialog(parent) { - Q_D(QFontDialog); - d->init(); setCurrentFont(initial); } @@ -321,11 +319,7 @@ void QFontDialogPrivate::init() buttonBox->addButton(QDialogButtonBox::Cancel); QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject())); -#if defined(Q_OS_WINCE) - q->resize(180, 120); -#else q->resize(500, 360); -#endif // Q_OS_WINCE sizeEdit->installEventFilter(q); familyList->installEventFilter(q); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 207b6e3919..994015030f 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -200,7 +200,7 @@ public: #endif compatMode(false), autoAddOkButton(true), detectedEscapeButton(0), informativeLabel(0), - options(new QMessageDialogOptions) { } + options(QMessageDialogOptions::create()) { } void init(const QString &title = QString(), const QString &text = QString()); void setupLayout(); @@ -218,9 +218,6 @@ public: int layoutMinimumWidth(); void retranslateStrings(); -#ifdef Q_OS_WINCE - void hideSpecial(); -#endif static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); @@ -362,24 +359,15 @@ void QMessageBoxPrivate::updateSize() return; QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); -#if defined(Q_OS_WINCE) - // the width of the screen, less the window border. - int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); -#else int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this // on small screens allows the messagebox be the same size as the screen if (screenSize.width() <= 1024) hardLimit = screenSize.width(); -#endif #ifdef Q_OS_MAC int softLimit = qMin(screenSize.width()/2, 420); #else // note: ideally on windows, hard and soft limits but it breaks compat -#ifndef Q_OS_WINCE int softLimit = qMin(screenSize.width()/2, 500); -#else - int softLimit = qMin(screenSize.width() * 3 / 4, 500); -#endif //Q_OS_WINCE #endif if (informativeLabel) @@ -436,28 +424,6 @@ void QMessageBoxPrivate::updateSize() QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } - -#ifdef Q_OS_WINCE -/*! - \internal - Hides special buttons which are rather shown in the title bar - on WinCE, to conserve screen space. -*/ - -void QMessageBoxPrivate::hideSpecial() -{ - Q_Q(QMessageBox); - QList<QPushButton*> list = q->findChildren<QPushButton*>(); - for (int i=0; i<list.size(); ++i) { - QPushButton *pb = list.at(i); - QString text = pb->text(); - text.remove(QChar::fromLatin1('&')); - if (text == QApplication::translate("QMessageBox", "OK" )) - pb->setFixedSize(0,0); - } -} -#endif - static int oldButton(int button) { switch (button & QMessageBox::ButtonMask) { @@ -1368,24 +1334,6 @@ bool QMessageBox::event(QEvent *e) case QEvent::LanguageChange: d_func()->retranslateStrings(); break; -#ifdef Q_OS_WINCE - case QEvent::OkRequest: - case QEvent::HelpRequest: { - QString bName = - (e->type() == QEvent::OkRequest) - ? QApplication::translate("QMessageBox", "OK") - : QApplication::translate("QMessageBox", "Help"); - QList<QPushButton*> list = findChildren<QPushButton*>(); - for (int i=0; i<list.size(); ++i) { - QPushButton *pb = list.at(i); - if (pb->text() == bName) { - if (pb->isEnabled()) - pb->click(); - return pb->isEnabled(); - } - } - } -#endif default: break; } @@ -1525,20 +1473,6 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) QDialog::keyPressEvent(e); } -#ifdef Q_OS_WINCE -/*! - \reimp -*/ -void QMessageBox::setVisible(bool visible) -{ - Q_D(QMessageBox); - if (visible) - d->hideSpecial(); - QDialog::setVisible(visible); -} -#endif - - /*! \overload @@ -1596,9 +1530,6 @@ void QMessageBox::showEvent(QShowEvent *e) Q_D(QMessageBox); if (d->autoAddOkButton) { addButton(Ok); -#if defined(Q_OS_WINCE) - d->hideSpecial(); -#endif } if (d->detailsButton) addButton(d->detailsButton, QMessageBox::ActionRole); @@ -1915,9 +1846,6 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); if (!pm.isNull()) msgBox->setIconPixmap(pm); -#if defined(Q_OS_WINCE) - msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok)); -#endif // should perhaps be a style hint #ifdef Q_OS_MAC diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index c958e4c352..8cded63a3c 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -142,10 +142,6 @@ public: QPushButton *addButton(StandardButton button); void removeButton(QAbstractButton *button); -#ifdef Q_OS_WINCE - void setVisible(bool visible); -#endif - using QDialog::open; void open(QObject *receiver, const char *member); diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index f3fe500d26..26a8fcc92d 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -138,9 +138,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance void QProgressDialogPrivate::layout() { Q_Q(QProgressDialog); - int sp = q->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); - int mtb = q->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); - int mlr = qMin(q->width() / 10, mtb); + int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q); + int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q); + int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q)); + int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q)); const bool centered = bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); @@ -154,12 +155,12 @@ void QProgressDialogPrivate::layout() // dialog can be made very small if the user demands it so. for (int attempt=5; attempt--;) { cspc = cancel ? cs.height() + sp : 0; - lh = qMax(0, q->height() - mtb - bh.height() - sp - cspc); + lh = qMax(0, q->height() - mb - bh.height() - sp - cspc); if (lh < q->height()/4) { // Getting cramped sp /= 2; - mtb /= 2; + mb /= 2; if (cancel) { cs.setHeight(qMax(4,cs.height()-sp-2)); } @@ -171,14 +172,14 @@ void QProgressDialogPrivate::layout() if (cancel) { cancel->setGeometry( - centered ? q->width()/2 - cs.width()/2 : q->width() - mlr - cs.width(), - q->height() - mtb - cs.height(), + centered ? q->width()/2 - cs.width()/2 : q->width() - mr - cs.width(), + q->height() - mb - cs.height(), cs.width(), cs.height()); } if (label) - label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); - bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); + label->setGeometry(ml, additionalSpacing, q->width() - ml - mr, lh); + bar->setGeometry(ml, lh + sp + additionalSpacing, q->width() - ml - mr, bh.height()); } void QProgressDialogPrivate::retranslateStrings() diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 53f947354c..f3d27ff77f 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -69,10 +69,6 @@ #include "private/qdialog_p.h" #include <qdebug.h> -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp -#endif - #include <string.h> // for memset() #include <algorithm> @@ -2215,10 +2211,6 @@ QWizard::QWizard(QWidget *parent, Qt::WindowFlags flags) { Q_D(QWizard); d->init(); -#ifdef Q_OS_WINCE - if (!qt_wince_is_mobile()) - setWindowFlags(windowFlags() & ~Qt::WindowOkButtonHint); -#endif } /*! diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp index c39a0d83bb..a907a0421f 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -77,6 +77,7 @@ QApplication::setStyle(QStyleFactory::create("Fusion")); //! [1] +// ### fixme: Qt 6: Remove [2] //! [2] int main(int argc, char *argv[]) { diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index db683a4e4d..b00a950823 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1439,9 +1439,8 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con // Determine the item's exposed area option->exposedRect = QRectF(); const QTransform reverseMap = worldTransform.inverted(); - const QVector<QRect> exposedRects(exposedRegion.rects()); - for (int i = 0; i < exposedRects.size(); ++i) { - option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i))); + for (const QRect &exposedRect : exposedRegion) { + option->exposedRect |= reverseMap.mapRect(QRectF(exposedRect)); if (option->exposedRect.contains(brect)) break; } @@ -5350,8 +5349,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c QTransform unscale = QTransform::fromScale(1 / granularity, 1 / granularity); QRegion r; QBitmap colorMask = QBitmap::fromImage(mask.createMaskFromColor(0)); - const auto rects = QRegion(colorMask).rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : QRegion(colorMask)) { QRect xrect = unscale.mapRect(rect).translated(deviceRect.topLeft() - QPoint(pad, pad)); r += xrect.adjusted(-1, -1, 1, 1) & deviceRect; } @@ -5915,9 +5913,8 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) // Append newly exposed areas. Note that the exposed region is currently // in pixmap coordinates, so we have to translate it to item coordinates. exposed.translate(cache->boundingRect.topLeft()); - const QVector<QRect> exposedRects = exposed.rects(); - for (int i = 0; i < exposedRects.size(); ++i) - cache->exposed += exposedRects.at(i); + for (const QRect &exposedRect : exposed) + cache->exposed += exposedRect; // Trigger update. This will redraw the newly exposed area and make sure // the pixmap is re-blitted in case there are overlapping items. diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index cb1d1e68d1..7b67f332e1 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4657,8 +4657,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte for (int i = 0; i < exposed.size(); ++i) br |= exposed.at(i); QTransform pixmapToItem = itemToPixmap.inverted(); - const auto rects = scrollExposure.rects(); - for (const QRect &r : rects) + for (const QRect &r : scrollExposure) br |= pixmapToItem.mapRect(r); } styleOptionTmp = *option; diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index fc5dbdd80a..44e80ebeb9 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1029,9 +1029,7 @@ bool QGraphicsViewPrivate::updateRegion(const QRectF &rect, const QTransform &xf if (!intersectsViewport(viewRect, viewport->width(), viewport->height())) return false; // Update region for sure outside viewport. - const QVector<QRect> &rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) { - viewRect = rects.at(i); + for (QRect viewRect : region) { if (dontAdjustForAntialiasing) viewRect.adjust(-1, -1, 1, 1); else @@ -1146,8 +1144,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg // the expose region, convert it to a path, and then search for items // using QGraphicsScene::items(QPainterPath); QRegion adjustedRegion; - const auto rects = exposedRegion.rects(); - for (const QRect &r : rects) + for (const QRect &r : exposedRegion) adjustedRegion += r.adjusted(-1, -1, 1, 1); const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); @@ -2676,11 +2673,9 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects) // Extract and reset dirty scene rect info. QVector<QRect> dirtyViewportRects; - const QVector<QRect> &dirtyRects = d->dirtyRegion.rects(); - const int dirtyRectsCount = dirtyRects.size(); - dirtyViewportRects.reserve(dirtyRectsCount + rects.count()); - for (int i = 0; i < dirtyRectsCount; ++i) - dirtyViewportRects += dirtyRects.at(i); + dirtyViewportRects.reserve(d->dirtyRegion.rectCount() + rects.count()); + for (const QRect &dirtyRect : d->dirtyRegion) + dirtyViewportRects += dirtyRect; d->dirtyRegion = QRegion(); d->dirtyBoundingRect = QRect(); diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 9bb4497811..0ab2e1860c 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -340,8 +340,8 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged() This enum indicates how the view responds to user selections: \value SingleSelection When the user selects an item, any already-selected - item becomes unselected, and the user cannot unselect the selected item by - clicking on it. + item becomes unselected. It is possible for the user to deselect the selected + item. \value ContiguousSelection When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index dfb1d7619e..315d2503a4 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -858,7 +858,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const return QModelIndex(); QString absolutePath = QDir(path).absolutePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) absolutePath = absolutePath.toLower(); // On Windows, "filename......." and "filename" are equivalent if (absolutePath.endsWith(QLatin1Char('.'))) { @@ -873,7 +873,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty() || !QFileInfo::exists(path)) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && path != QLatin1String("/") #endif ) @@ -883,7 +883,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const if (!d->root.populated) // make sure the root is populated d->populate(&d->root); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = pathElements.first(); int r = 0; @@ -901,7 +901,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const emit const_cast<QDirModel*>(this)->layoutChanged(); } else #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathElements.at(0).endsWith(QLatin1Char(':'))) { pathElements[0] += QLatin1Char('/'); } @@ -925,7 +925,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const const QFileInfo& fi = parent->children.at(j).info; QString childFileName; childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) childFileName = childFileName.toLower(); #endif if (childFileName == element) { @@ -938,15 +938,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const // we couldn't find the path element, we create a new node since we _know_ that the path is valid if (row == -1) { -#if defined(Q_OS_WINCE) - QString newPath; - if (parent->info.isRoot()) - newPath = parent->info.absoluteFilePath() + element; - else - newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#else QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#endif if (!d->allowAppendChild || !QFileInfo(newPath).isDir()) return QModelIndex(); d->appendChild(parent, newPath); @@ -1290,7 +1282,7 @@ QString QDirModelPrivate::name(const QModelIndex &index) const const QFileInfo info = n->info; if (info.isRoot()) { QString name = info.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (name.startsWith(QLatin1Char('/'))) // UNC host return info.fileName(); if (name.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp index 66c0ffcd58..78ff5f79ab 100644 --- a/src/widgets/itemviews/qfileiconprovider.cpp +++ b/src/widgets/itemviews/qfileiconprovider.cpp @@ -365,7 +365,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const return retIcon; if (info.isRoot()) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) { UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16()); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index e045d60fc8..ff3832e499 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1398,8 +1398,7 @@ void QTableView::paintEvent(QPaintEvent *event) firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn); } - const QVector<QRect> rects = region.rects(); - for (auto dirtyArea : rects) { + for (QRect dirtyArea : region) { dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y))); if (rightToLeft) { dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x))); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index cecaa4d8fb..cd3081dae5 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1477,13 +1477,12 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos()); d->hoverBranch = d->itemDecorationAt(hoverPos); - QVector<QRect> rects = region.rects(); QVector<int> drawn; - bool multipleRects = (rects.size() > 1); - for (int a = 0; a < rects.size(); ++a) { + bool multipleRects = (region.rectCount() > 1); + for (const QRect &a : region) { const QRect area = (multipleRects - ? QRect(0, rects.at(a).y(), viewportWidth, rects.at(a).height()) - : rects.at(a)); + ? QRect(0, a.y(), viewportWidth, a.height()) + : a); d->leftAndRight = d->startAndEndColumns(area); int i = firstVisibleItem; // the first item at the top of the viewport diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 718ecffcc9..88b29e9147 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -279,12 +279,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) group the action will be automatically inserted into the group. */ QAction::QAction(QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(*new QActionPrivate, parent) { - Q_D(QAction); - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } @@ -302,13 +298,10 @@ QAction::QAction(QObject* parent) */ QAction::QAction(const QString &text, QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(parent) { Q_D(QAction); d->text = text; - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } /*! @@ -324,14 +317,10 @@ QAction::QAction(const QString &text, QObject* parent) setToolTip(). */ QAction::QAction(const QIcon &icon, const QString &text, QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(text, parent) { Q_D(QAction); d->icon = icon; - d->text = text; - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } /*! diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 4bc06c94e0..a8a0968ff8 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -101,23 +101,13 @@ #include "qdatetime.h" -#ifdef Q_OS_WINCE -extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp -extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp -extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp -#endif - #include <qpa/qplatformwindow.h> //#define ALIEN_DEBUG static void initResources() { -#if defined(Q_OS_WINCE) - Q_INIT_RESOURCE(qstyle_wince); -#else Q_INIT_RESOURCE(qstyle); -#endif Q_INIT_RESOURCE(qmessagebox); } @@ -171,12 +161,7 @@ static QByteArray nativeStyleClassName() return name; } -#ifdef Q_OS_WINCE -int QApplicationPrivate::autoMaximizeThreshold = -1; -bool QApplicationPrivate::autoSipEnabled = false; -#else bool QApplicationPrivate::autoSipEnabled = true; -#endif QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) : QApplicationPrivateBase(argc, argv, flags) @@ -352,8 +337,10 @@ void QApplicationPrivate::createEventDispatcher() \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings */ +// ### fixme: Qt 6: Remove ColorSpec and accessors. /*! \enum QApplication::ColorSpec + \obsolete \value NormalColor the default color allocation policy \value CustomColor the same as NormalColor for X11; allocates colors @@ -410,8 +397,6 @@ QString QApplicationPrivate::styleSheet; // default application styles #endif QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0; -int QApplicationPrivate::app_cspec = QApplication::NormalColor; - QPalette *QApplicationPrivate::sys_pal = 0; // default system palette QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer @@ -654,17 +639,6 @@ void QApplicationPrivate::initialize() if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0) QCoreApplication::setAttribute(Qt::AA_NativeWindows); -#ifdef Q_OS_WINCE -#ifdef QT_AUTO_MAXIMIZE_THRESHOLD - autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD; -#else - if (qt_wince_is_mobile()) - autoMaximizeThreshold = 50; - else - autoMaximizeThreshold = -1; -#endif //QT_AUTO_MAXIMIZE_THRESHOLD -#endif //Q_OS_WINCE - #ifndef QT_NO_WHEELEVENT QApplicationPrivate::wheel_scroll_lines = 3; #endif @@ -1058,19 +1032,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis The default is platform dependent. */ - -#ifdef Q_OS_WINCE -void QApplication::setAutoMaximizeThreshold(const int threshold) -{ - QApplicationPrivate::autoMaximizeThreshold = threshold; -} - -int QApplication::autoMaximizeThreshold() const -{ - return QApplicationPrivate::autoMaximizeThreshold; -} -#endif - void QApplication::setAutoSipEnabled(const bool enabled) { QApplicationPrivate::autoSipEnabled = enabled; @@ -1314,17 +1275,21 @@ QStyle* QApplication::setStyle(const QString& style) /*! Returns the color specification. + \obsolete \sa QApplication::setColorSpec() */ int QApplication::colorSpec() { - return QApplicationPrivate::app_cspec; + return QApplication::NormalColor; } /*! Sets the color specification for the application to \a spec. + \obsolete + + This call has no effect. The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color @@ -1380,10 +1345,7 @@ int QApplication::colorSpec() void QApplication::setColorSpec(int spec) { - if (Q_UNLIKELY(qApp)) - qWarning("QApplication::setColorSpec: This function must be " - "called before the QApplication object is created"); - QApplicationPrivate::app_cspec = spec; + Q_UNUSED(spec) } /*! @@ -3777,7 +3739,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) if (receiver->isWidgetType()) { QWidget *widget = static_cast<QWidget *>(receiver); -#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) +#if !defined(QT_NO_CURSOR) // toggle HasMouse widget state on enter and leave if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window())) diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index b27fba620e..52f44759f4 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -84,9 +84,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication #ifndef QT_NO_STYLE_STYLESHEET Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) #endif -#ifdef Q_OS_WINCE - Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold) -#endif Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled) public: @@ -101,8 +98,10 @@ public: static void setStyle(QStyle*); static QStyle *setStyle(const QString&); enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 }; - static int colorSpec(); - static void setColorSpec(int); +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED static int colorSpec(); + QT_DEPRECATED static void setColorSpec(int); +#endif // QT_DEPRECATED_SINCE(5, 8) #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {} #endif @@ -195,10 +194,6 @@ public Q_SLOTS: #ifndef QT_NO_STYLE_STYLESHEET void setStyleSheet(const QString& sheet); #endif -#ifdef Q_OS_WINCE - void setAutoMaximizeThreshold(const int threshold); - int autoMaximizeThreshold() const; -#endif void setAutoSipEnabled(const bool enabled); bool autoSipEnabled() const; static void closeAllWindows(); diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 3358cce744..8aab3bfae4 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -90,11 +90,8 @@ extern Q_GUI_EXPORT bool qt_is_gui_used; extern QClipboard *qt_clipboard; #endif -#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE) +#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) extern QSysInfo::WinVersion qt_winver; -# ifdef Q_OS_WINCE - extern DWORD qt_cever; -# endif #elif defined (Q_OS_MAC) extern QSysInfo::MacVersion qt_macver; #endif @@ -126,9 +123,6 @@ public: #endif static void reset_instance_pointer(); #endif -#ifdef Q_OS_WINCE - static int autoMaximizeThreshold; -#endif static bool autoSipEnabled; static QString desktopStyleKey(); @@ -189,7 +183,6 @@ public: static QWidgetList *popupWidgets; static QStyle *app_style; static bool overrides_native_style; - static int app_cspec; static QPalette *sys_pal; static QPalette *set_pal; diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 9b346a2c50..ce5e58642c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -185,6 +185,7 @@ public: int insertRow(int row); void insertRows(int row, int count); + void removeRow(int row); void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item); void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout); void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget); @@ -947,6 +948,12 @@ void QFormLayoutPrivate::insertRows(int row, int count) } } +void QFormLayoutPrivate::removeRow(int row) +{ + if (uint(row) < uint(m_matrix.rowCount())) + m_matrix.removeRow(row); +} + void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item) { const bool fullRow = role == QFormLayout::SpanningRole; @@ -1178,6 +1185,28 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) */ /*! + \since 5.8 + + \struct QFormLayout::TakeRowResult + + \brief Contains the result of a QFormLayout::takeRow() call. + + \sa QFormLayout::takeRow() +*/ + +/*! + \variable QFormLayout::TakeRowResult::labelItem + + Contains the layout item corresponding to the label of the row. +*/ + +/*! + \variable QFormLayout::TakeRowResult::fieldItem + + Contains the layout item corresponding to the field of the row. +*/ + +/*! Constructs a new form layout with the given \a parent widget. \sa QWidget::setLayout() @@ -1380,6 +1409,287 @@ void QFormLayout::insertRow(int row, QLayout *layout) invalidate(); } +static QLayoutItem *ownershipCleanedItem(QFormLayoutItem *item, QFormLayout *layout) +{ + if (!item) + return nullptr; + + // grab ownership back from the QFormLayoutItem + QLayoutItem *i = item->item; + item->item = nullptr; + delete item; + + if (QLayout *l = i->layout()) { + // sanity check in case the user passed something weird to QObject::setParent() + if (l->parent() == layout) + l->setParent(nullptr); + } + + return i; +} + +static void clearQLayoutItem(QLayoutItem *item) +{ + if (Q_LIKELY(item)) { + if (QLayout *layout = item->layout()) { + while (QLayoutItem *child = layout->takeAt(0)) { + clearQLayoutItem(child); + delete child; + } + delete layout; + } + delete item->widget(); + delete item->spacerItem(); + } +} + +/*! + \since 5.8 + + Deletes row \a row from this form layout. + + \a row must be non-negative and less than rowCount(). + + After this call, rowCount() is decremented by one. All widgets and + nested layouts that occupied this row are deleted. That includes both + the field widget(s) and the label, if any. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + flay->removeRow(2); // le == nullptr at this point + \endcode + + If you want to remove the row from the layout without deleting the widgets, use takeRow() instead. + + \sa takeRow() +*/ +void QFormLayout::removeRow(int row) +{ + TakeRowResult result = takeRow(row); + clearQLayoutItem(result.labelItem); + clearQLayoutItem(result.fieldItem); +} + +/*! + \since 5.8 + + \overload + + Deletes the row corresponding to \a widget from this form layout. + + After this call, rowCount() is decremented by one. All widgets and + nested layouts that occupied this row are deleted. That includes both + the field widget(s) and the label, if any. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + flay->removeRow(le); // le == nullptr at this point + \endcode + + If you want to remove the row from the layout without deleting the widgets, use takeRow() instead. + + \sa takeRow() +*/ +void QFormLayout::removeRow(QWidget *widget) +{ + TakeRowResult result = takeRow(widget); + clearQLayoutItem(result.labelItem); + clearQLayoutItem(result.fieldItem); +} + +/*! + \since 5.8 + + \overload + + Deletes the row corresponding to \a layout from this form layout. + + After this call, rowCount() is decremented by one. All widgets and + nested layouts that occupied this row are deleted. That includes both + the field widget(s) and the label, if any. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QVBoxLayout> vbl = new QVBoxLayout; + flay->insertRow(2, "User:", vbl); + // later: + flay->removeRow(layout); // vbl == nullptr at this point + \endcode + + If you want to remove the row from the form layout without deleting the inserted layout, + use takeRow() instead. + + \sa takeRow() +*/ +void QFormLayout::removeRow(QLayout *layout) +{ + TakeRowResult result = takeRow(layout); + clearQLayoutItem(result.labelItem); + clearQLayoutItem(result.fieldItem); +} + +/*! + \since 5.8 + + Removes the specified \a row from this form layout. + + \a row must be non-negative and less than rowCount(). + + \note This function doesn't delete anything. + + After this call, rowCount() is decremented by one. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + QFormLayout::TakeRowResult result = flay->takeRow(2); + \endcode + + If you want to remove the row from the layout and delete the widgets, use removeRow() instead. + + \return A structure containing both the widget and + corresponding label layout items + + \sa removeRow() +*/ +QFormLayout::TakeRowResult QFormLayout::takeRow(int row) +{ + Q_D(QFormLayout); + + const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(row)); + if (Q_UNLIKELY(storageIndex == -1)) { + qWarning("QFormLayout::takeRow: Invalid row %d", row); + return TakeRowResult(); + } + + int storageRow, dummy; + QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &storageRow, &dummy); + Q_ASSERT(d->m_matrix(storageRow, dummy)); + + QFormLayoutItem *label = d->m_matrix(storageRow, 0); + QFormLayoutItem *field = d->m_matrix(storageRow, 1); + + Q_ASSERT(field); + + d->m_things.removeOne(label); + d->m_things.removeOne(field); + d->m_matrix.removeRow(storageRow); + + invalidate(); + + TakeRowResult result; + result.labelItem = ownershipCleanedItem(label, this); + result.fieldItem = ownershipCleanedItem(field, this); + return result; +} + +/*! + \since 5.8 + + \overload + + Removes the specified \a widget from this form layout. + + \note This function doesn't delete anything. + + After this call, rowCount() is decremented by one. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + QFormLayout::TakeRowResult result = flay->takeRow(widget); + \endcode + + If you want to remove the row from the layout and delete the widgets, use removeRow() instead. + + \return A structure containing both the widget and + corresponding label layout items + + \sa removeRow() +*/ +QFormLayout::TakeRowResult QFormLayout::takeRow(QWidget *widget) +{ + Q_D(QFormLayout); + if (Q_UNLIKELY(!d->checkWidget(widget))) + return TakeRowResult(); + + int row; + ItemRole role; + getWidgetPosition(widget, &row, &role); + + if (Q_UNLIKELY(row < 0)) { + qWarning("QFormLayout::takeRow: Invalid widget"); + return TakeRowResult(); + } + + return takeRow(row); +} + +/*! + \since 5.8 + + \overload + + Removes the specified \a layout from this form layout. + + \note This function doesn't delete anything. + + After this call, rowCount() is decremented by one. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + \code + QFormLayout *flay = ...; + QPointer<QVBoxLayout> vbl = new QVBoxLayout; + flay->insertRow(2, "User:", vbl); + // later: + QFormLayout::TakeRowResult result = flay->takeRow(widget); + \endcode + + If you want to remove the row from the form layout and delete the inserted layout, + use removeRow() instead. + + \return A structure containing both the widget and + corresponding label layout items + + \sa removeRow() +*/ +QFormLayout::TakeRowResult QFormLayout::takeRow(QLayout *layout) +{ + Q_D(QFormLayout); + if (Q_UNLIKELY(!d->checkLayout(layout))) + return TakeRowResult(); + + int row; + ItemRole role; + getLayoutPosition(layout, &row, &role); + + if (Q_UNLIKELY(row < 0)) { + qWarning("QFormLayout::takeRow: Invalid layout"); + return TakeRowResult(); + } + + return takeRow(row); +} + /*! \reimp */ @@ -1436,18 +1746,7 @@ QLayoutItem *QFormLayout::takeAt(int index) invalidate(); - // grab ownership back from the QFormLayoutItem - QLayoutItem *i = item->item; - item->item = 0; - delete item; - - if (QLayout *l = i->layout()) { - // sanity check in case the user passed something weird to QObject::setParent() - if (l->parent() == this) - l->setParent(0); - } - - return i; + return ownershipCleanedItem(item, this); } /*! diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h index 8e4f7b7309..ca15ec6f9a 100644 --- a/src/widgets/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -80,6 +80,11 @@ public: }; Q_ENUM(ItemRole) + struct TakeRowResult { + QLayoutItem *labelItem; + QLayoutItem *fieldItem; + }; + explicit QFormLayout(QWidget *parent = Q_NULLPTR); ~QFormLayout(); @@ -114,6 +119,14 @@ public: void insertRow(int row, QWidget *widget); void insertRow(int row, QLayout *layout); + void removeRow(int row); + void removeRow(QWidget *widget); + void removeRow(QLayout *layout); + + TakeRowResult takeRow(int row); + TakeRowResult takeRow(QWidget *widget); + TakeRowResult takeRow(QLayout *layout); + void setItem(int row, ItemRole role, QLayoutItem *item); void setWidget(int row, ItemRole role, QWidget *widget); void setLayout(int row, ItemRole role, QLayout *layout); @@ -153,6 +166,8 @@ private: void resetFormAlignment(); }; +Q_DECLARE_TYPEINFO(QFormLayout::TakeRowResult, Q_PRIMITIVE_TYPE); + QT_END_NAMESPACE #endif diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 8af3516d4b..777be8525e 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -75,7 +75,7 @@ static inline int panTouchPoints() const int result = qEnvironmentVariableIntValue(panTouchPointVariable, &ok); if (ok && result >= 1) return result; - qWarning() << "Ignoring invalid value of " << panTouchPointVariable; + qWarning("Ignoring invalid value of %s", panTouchPointVariable); } // Pan should use 1 finger on a touch screen and 2 fingers on touch pads etc. // where 1 finger movements are used for mouse event synthetization. For now, diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index b58e7fdc9e..29df38f19c 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -746,9 +746,13 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain, if (orientation == Qt::Vertical) { QGridBox *sibling = vReversed ? previousBox : box; if (sibling) { - QWidget *wid = sibling->item()->widget(); - if (wid) - spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); + if (sibling->item()->isEmpty()) { + spacing = 0; + } else { + QWidget *wid = sibling->item()->widget(); + if (wid) + spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top()); + } } } } diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 240f525722..86c1628e22 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -945,12 +945,7 @@ void QLayout::addChildWidget(QWidget *w) void QLayout::setMenuBar(QWidget *widget) { Q_D(QLayout); - -#ifdef Q_OS_WINCE_WM - if (widget && widget->size().height() > 0) -#else if (widget) -#endif addChildWidget(widget); d->menubar = widget; } diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index bf162249d0..7bd9e74924 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -456,12 +456,11 @@ QShortcut::QShortcut(QWidget *parent) QShortcut::QShortcut(const QKeySequence &key, QWidget *parent, const char *member, const char *ambiguousMember, Qt::ShortcutContext context) - : QObject(*new QShortcutPrivate, parent) + : QShortcut(parent) { QAPP_CHECK("QShortcut"); Q_D(QShortcut); - Q_ASSERT(parent != 0); d->sc_context = context; d->sc_sequence = key; d->redoGrab(qApp->d_func()->shortcutMap); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 281567cede..426f206480 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1107,11 +1107,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) if (customize) ; // don't modify window flags if the user explicitly set them. else if (type == Qt::Dialog || type == Qt::Sheet) -#ifndef Q_OS_WINCE flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint; -#else - flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; -#endif else if (type == Qt::Tool) flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; else @@ -2404,9 +2400,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush); painter->restore(); } else { - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) - painter->fillRect(rects.at(i), brush); + for (const QRect &rect : rgn) + painter->fillRect(rect, brush); } } @@ -4552,7 +4547,7 @@ const QPalette &QWidget::palette() const if (!isEnabled()) { data->pal.setCurrentColorGroup(QPalette::Disabled); } else if ((!isVisible() || isActiveWindow()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this)) #endif ) { @@ -8553,13 +8548,9 @@ QSize QWidgetPrivate::adjustedSize() const #else // all others QRect screen = QApplication::desktop()->screenGeometry(q->pos()); #endif -#if defined (Q_OS_WINCE) - s.setWidth(qMin(s.width(), screen.width())); - s.setHeight(qMin(s.height(), screen.height())); -#else s.setWidth(qMin(s.width(), screen.width()*2/3)); s.setHeight(qMin(s.height(), screen.height()*2/3)); -#endif + if (QTLWExtra *extra = maybeTopData()) extra->sizeAdjusted = true; } @@ -10745,10 +10736,8 @@ void QWidget::scroll(int dx, int dy) // Graphics View maintains its own dirty region as a list of rects; // until we can connect item updates directly to the view, we must // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) - proxy->update(rect); - } + for (const QRect &rect : d->dirty) + proxy->update(rect.translated(dx, dy)); proxy->scroll(dx, dy, proxy->subWidgetRect(this)); return; } @@ -10788,7 +10777,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r) // until we can connect item updates directly to the view, we must // separately add a translated dirty region. if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) + for (const QRect &rect : d->dirty.translated(dx, dy) & r) proxy->update(rect); } proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 9025160e5c..7a4a6d862d 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -158,7 +158,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec } i = (i + 1) & 3; - foreach (const QRect &rect, region.rects()) { + for (const QRect &rect : region) { RECT winRect; SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); FillRect(hdc, &winRect, brush); @@ -1311,9 +1311,8 @@ void QWidgetBackingStore::doSync() updateStaticContentsSize(); dirty = QRegion(); updateRequestSent = false; - const QVector<QRect> rects(toClean.rects()); - for (int i = 0; i < rects.size(); ++i) - tlw->d_func()->extra->proxyWidget->update(rects.at(i)); + for (const QRect &rect : toClean) + tlw->d_func()->extra->proxyWidget->update(rect); return; } #endif diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.cpp b/src/widgets/kernel/qwidgetsfunctions_wince.cpp deleted file mode 100644 index 2bf8c6563b..0000000000 --- a/src/widgets/kernel/qwidgetsfunctions_wince.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qwidgetsfunctions_wince.h" -#include <shellapi.h> - -QT_USE_NAMESPACE - -#ifndef ShellExecute -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd) -{ - SHELLEXECUTEINFO info; - info.hwnd = hwnd; - info.lpVerb = L"Open"; - info.lpFile = file; - info.lpParameters = params; - info.lpDirectory = dir; - info.nShow = showCmd; - info.cbSize = sizeof(info); - ShellExecuteEx(&info); - return info.hInstApp; -} -#endif - -// Internal Qt ----------------------------------------------------- -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMNAME, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -int qt_wince_get_build() -{ - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (GetVersionEx(&osvi)) - return osvi.dwBuildNumber; - return 0; -} - -int qt_wince_get_version() -{ - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (GetVersionEx(&osvi)) - return (osvi.dwMajorVersion * 10 + osvi.dwMinorVersion); - return 0; -} - -bool qt_wince_is_windows_mobile_65() -{ - const DWORD dwFirstWM65BuildNumber = 21139; - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (!GetVersionEx(&osvi)) - return false; - return osvi.dwMajorVersion > 5 - || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 || - (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber))); -} - -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} - -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} - -bool qt_wince_is_high_dpi() { - if (!qt_wince_is_pocket_pc()) - return false; - HDC deviceContext = GetDC(0); - int dpi = GetDeviceCaps(deviceContext, LOGPIXELSX); - ReleaseDC(0, deviceContext); - if ((dpi < 1000) && (dpi > 0)) - return dpi > 96; - else - return false; -} diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index e2d5afdeec..a3121287b3 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -2,6 +2,4 @@ # -------------------------------------------------------------------- INCLUDEPATH += ../3rdparty/wintab -!wince:!winrt { - LIBS_PRIVATE *= -lshell32 -} +!winrt: LIBS_PRIVATE *= -lshell32 diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 437becbf70..91d4bcc7ab 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -3724,6 +3724,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl btnOpt.state &= ~State_MouseOver; int bsx = 0; int bsy = 0; + const int buttonIconMetric = proxy()->pixelMetric(PM_TitleBarButtonIconSize, &btnOpt, widget); + const QSize buttonIconSize(buttonIconMetric, buttonIconMetric); if (opt->subControls & QStyle::SC_MdiCloseButton) { if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) { btnOpt.state |= State_Sunken; @@ -3738,7 +3740,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget); proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); - QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), QSize(16, 16)); + QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), buttonIconSize); proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } if (opt->subControls & QStyle::SC_MdiNormalButton) { @@ -3755,7 +3757,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget); proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); - QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), QSize(16, 16)); + QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), buttonIconSize); proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } if (opt->subControls & QStyle::SC_MdiMinButton) { @@ -3772,7 +3774,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget); proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); - QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), QSize(16, 16)); + QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), buttonIconSize); proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } } @@ -4393,6 +4395,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid } break; } + case PM_TitleBarButtonSize: + ret = int(QStyleHelper::dpiScaled(16.)); + break; + case PM_TitleBarButtonIconSize: + ret = int(QStyleHelper::dpiScaled(16.)); + break; + case PM_ScrollBarSliderMin: ret = int(QStyleHelper::dpiScaled(9.)); break; @@ -4845,16 +4854,18 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, #endif // QT_NO_GROUPBOX case CT_MdiControls: if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) { + const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, styleOpt, widget); int width = 1; if (styleOpt->subControls & SC_MdiMinButton) - width += 16 + 1; + width += buttonSize + 1; if (styleOpt->subControls & SC_MdiNormalButton) - width += 16 + 1; + width += buttonSize + 1; if (styleOpt->subControls & SC_MdiCloseButton) - width += 16 + 1; - sz = QSize(width, 16); + width += buttonSize + 1; + sz = QSize(width, buttonSize); } else { - sz = QSize(52, 16); + const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, opt, widget); + sz = QSize(1 + 3 * (buttonSize + 1), buttonSize); } break; #ifndef QT_NO_ITEMVIEWS diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 5b6e47e2c6..a9cea0e2ab 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3102,6 +3102,9 @@ int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, co case PM_DockWidgetTitleBarButtonMargin: val = 2; break; + case PM_TitleBarButtonSize: + val = 19; + break; case PM_MaximumDragDistance: return -1; // Do not dpi-scale because the value is magic case PM_TabCloseIndicatorWidth: @@ -3225,18 +3228,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti newSize += QSize(4, 4); break; case CT_MdiControls: - if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) { - int width = 0; - if (styleOpt->subControls & SC_MdiMinButton) - width += 19 + 1; - if (styleOpt->subControls & SC_MdiNormalButton) - width += 19 + 1; - if (styleOpt->subControls & SC_MdiCloseButton) - width += 19 + 1; - newSize = QSize(width, 19); - } else { - newSize = QSize(60, 19); - } + newSize -= QSize(1, 0); break; default: break; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index e51f750916..4b60654448 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -587,7 +587,7 @@ HIMutableShapeRef qt_mac_toHIMutableShape(const QRegion ®ion) CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); HIShapeUnionWithRect(shape, &cgRect); } else { - foreach (const QRect &qtRect, region.rects()) { + for (const QRect &qtRect : region) { CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); HIShapeUnionWithRect(shape, &cgRect); } @@ -2253,9 +2253,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush CGContextSaveGState(cg); HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted); - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); + for (const QRect &rect : rgn) { // Anchor the pattern to the top so it stays put when the window is resized. CGContextSetPatternPhase(cg, CGSizeMake(rect.width(), rect.height())); CGRect mac_rect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); @@ -7117,11 +7115,11 @@ void qt_mac_scale_region(QRegion *region, qreal scaleFactor) return; QVector<QRect> scaledRects; - scaledRects.reserve(region->rects().count()); + scaledRects.reserve(region->rectCount()); - foreach (const QRect &rect, region->rects()) { + for (const QRect &rect : *region) scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor)); - } + region->setRects(&scaledRects[0], scaledRects.count()); } diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index 182c974729..5739678932 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -131,16 +131,9 @@ QProxyStyle::QProxyStyle(QStyle *style) : \sa QStyleFactory::create() */ -QProxyStyle::QProxyStyle(const QString &key) : - QCommonStyle(*new QProxyStylePrivate()) +QProxyStyle::QProxyStyle(const QString &key) + : QProxyStyle(QStyleFactory::create(key)) { - Q_D(QProxyStyle); - QStyle *style = QStyleFactory::create(key); - if (style) { - d->baseStyle = style; - style->setProxy(this); - style->setParent(this); // Take ownership - } } /*! diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 103c49496e..16a11e6029 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1494,6 +1494,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PM_HeaderDefaultSectionSizeVertical The default size of sections in a vertical header. This enum value has been introduced in Qt 5.5. + \value PM_TitleBarButtonIconSize The size of button icons on a title bar. + This enum value has been introduced in Qt 5.8. + \value PM_TitleBarButtonSize The size of buttons on a title bar. + This enum value has been introduced in Qt 5.8. + \value PM_CustomBase Base value for custom pixel metrics. Custom values must be greater than this value. diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index 0f1259160e..0c8805e7a5 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -570,6 +570,9 @@ public: PM_HeaderDefaultSectionSizeHorizontal, PM_HeaderDefaultSectionSizeVertical, + PM_TitleBarButtonIconSize, + PM_TitleBarButtonSize, + // do not add any values below/greater than this PM_CustomBase = 0xf0000000 }; diff --git a/src/widgets/styles/qstyle_wince.qrc b/src/widgets/styles/qstyle_wince.qrc deleted file mode 100644 index c3d643fac7..0000000000 --- a/src/widgets/styles/qstyle_wince.qrc +++ /dev/null @@ -1,97 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/qt-project.org/styles/commonstyle"> -<file>images/filelink-16.png</file> -<file>images/filelink-32.png</file> -<file>images/file-16.png</file> -<file>images/file-32.png</file> -<file>images/newdirectory-16.png</file> -<file>images/newdirectory-32.png</file> -<file>images/parentdir-16.png</file> -<file>images/parentdir-32.png</file> -<file>images/dvd-16.png</file> -<file>images/dvd-32.png</file> -<file>images/cdr-16.png</file> -<file>images/cdr-32.png</file> -<file>images/floppy-16.png</file> -<file>images/floppy-32.png</file> -<file>images/harddrive-16.png</file> -<file>images/harddrive-32.png</file> -<file>images/trash-16.png</file> -<file>images/trash-32.png</file> -<file>images/networkdrive-16.png</file> -<file>images/networkdrive-32.png</file> -<file>images/computer-16.png</file> -<file>images/computer-32.png</file> -<file>images/desktop-16.png</file> -<file>images/desktop-32.png</file> -<file>images/dirclosed-16.png</file> -<file>images/dirclosed-32.png</file> -<file>images/dirlink-16.png</file> -<file>images/dirlink-32.png</file> -<file>images/diropen-16.png</file> -<file>images/diropen-32.png</file> -<file>images/left-16.png</file> -<file>images/left-32.png</file> -<file>images/right-16.png</file> -<file>images/right-32.png</file> -<file>images/up-16.png</file> -<file>images/up-32.png</file> -<file>images/down-16.png</file> -<file>images/down-32.png</file> -<file>images/filecontents-16.png</file> -<file>images/filecontents-32.png</file> -<file>images/fileinfo-16.png</file> -<file>images/fileinfo-32.png</file> -<file>images/viewdetailed-16.png</file> -<file>images/viewdetailed-32.png</file> -<file>images/viewlist-16.png</file> -<file>images/viewlist-32.png</file> -<file>images/fontbitmap-16.png</file> -<file>images/fonttruetype-16.png</file> -<file>images/standardbutton-apply-16.png</file> -<file>images/standardbutton-apply-32.png</file> -<file>images/standardbutton-cancel-16.png</file> -<file>images/standardbutton-cancel-32.png</file> -<file>images/standardbutton-clear-16.png</file> -<file>images/standardbutton-clear-32.png</file> -<file>images/standardbutton-close-16.png</file> -<file>images/standardbutton-close-32.png</file> -<file>images/standardbutton-delete-16.png</file> -<file>images/standardbutton-delete-32.png</file> -<file>images/standardbutton-help-16.png</file> -<file>images/standardbutton-help-32.png</file> -<file>images/standardbutton-no-16.png</file> -<file>images/standardbutton-no-32.png</file> -<file>images/standardbutton-ok-16.png</file> -<file>images/standardbutton-ok-32.png</file> -<file>images/standardbutton-open-16.png</file> -<file>images/standardbutton-open-32.png</file> -<file>images/standardbutton-save-16.png</file> -<file>images/standardbutton-save-32.png</file> -<file>images/standardbutton-yes-16.png</file> -<file>images/standardbutton-yes-32.png</file> -<file>images/standardbutton-closetab-16.png</file> -<file>images/standardbutton-closetab-down-16.png</file> -<file>images/standardbutton-closetab-hover-16.png</file> -<file>images/refresh-24.png</file> -<file>images/refresh-32.png</file> -<file>images/stop-24.png</file> -<file>images/stop-32.png</file> -<file>images/media-stop-16.png</file> -<file>images/media-stop-32.png</file> -<file>images/media-play-16.png</file> -<file>images/media-play-32.png</file> -<file>images/media-pause-16.png</file> -<file>images/media-pause-32.png</file> -<file>images/media-seek-forward-16.png</file> -<file>images/media-seek-forward-32.png</file> -<file>images/media-seek-backward-16.png</file> -<file>images/media-seek-backward-32.png</file> -<file>images/media-skip-forward-16.png</file> -<file>images/media-skip-forward-32.png</file> -<file>images/media-skip-backward-16.png</file> -<file>images/media-skip-backward-32.png</file> -<file>images/media-volume-16.png</file> -<file>images/media-volume-muted-16.png</file> -</qresource> -</RCC> diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index bebd322c9e..bb849c148f 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -56,12 +56,6 @@ #ifndef QT_NO_STYLE_WINDOWSVISTA #include "qwindowsvistastyle_p.h" #endif -#ifndef QT_NO_STYLE_WINDOWSCE -#include "qwindowscestyle_p.h" -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE -#include "qwindowsmobilestyle_p.h" -#endif #if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC) # include "qmacstyle_mac_p.h" @@ -114,16 +108,6 @@ QStyle *QStyleFactory::create(const QString& key) ret = new QWindowsStyle; else #endif -#ifndef QT_NO_STYLE_WINDOWSCE - if (style == QLatin1String("windowsce")) - ret = new QWindowsCEStyle; - else -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE - if (style == QLatin1String("windowsmobile")) - ret = new QWindowsMobileStyle; - else -#endif #ifndef QT_NO_STYLE_WINDOWSXP if (style == QLatin1String("windowsxp")) ret = new QWindowsXPStyle; @@ -180,14 +164,6 @@ QStringList QStyleFactory::keys() if (!list.contains(QLatin1String("Windows"))) list << QLatin1String("Windows"); #endif -#ifndef QT_NO_STYLE_WINDOWSCE - if (!list.contains(QLatin1String("WindowsCE"))) - list << QLatin1String("WindowsCE"); -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE - if (!list.contains(QLatin1String("WindowsMobile"))) - list << QLatin1String("WindowsMobile"); -#endif #ifndef QT_NO_STYLE_WINDOWSXP if (!list.contains(QLatin1String("WindowsXP")) && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) diff --git a/src/widgets/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp deleted file mode 100644 index 0fb4192417..0000000000 --- a/src/widgets/styles/qwindowscestyle.cpp +++ /dev/null @@ -1,2431 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowscestyle_p.h" - -#if !defined(QT_NO_STYLE_WINDOWSCE) || defined(QT_PLUGIN) - -#include "qpainterpath.h" -#include "qapplication.h" -#include "qdockwidget.h" -#include "qtoolbar.h" -#include "qpaintengine.h" -#include "qpainter.h" -#include "qstyleoption.h" -#include "qwindowscestyle_p_p.h" -#include "qdebug.h" -#include "qdrawutil.h" - -QT_BEGIN_NAMESPACE - -static const int windowsItemFrame = 2; // menu item frame width -static const int windowsItemHMargin = 3; // menu item hor text margin -static const int windowsItemVMargin = 2; // menu item ver text margin -static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsRightBorder = 15; // right border on windows -static const int windowsCheckMarkWidth = 14; // checkmarks width on windows - -static const int windowsCEitemViewCheckBoxSize = 14; -static const int windowsCEFrameGroupBoxOffset = 9; -static const int windowsCEIndicatorSize = 14; -static const int windowsCEExclusiveIndicatorSize = 14; -static const int windowsCESliderThickness = 24; -static const int windowsCEIconSize = 16; - -static const QColor windowsCECheckBoxGradientColorBegin = QColor(222, 224, 214); -static const QColor windowsCECheckBoxGradientColorEnd = QColor(255, 255, 255); - -enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; - -QWindowsCEStyle::QWindowsCEStyle() : QWindowsStyle() { - qApp->setEffectEnabled(Qt::UI_FadeMenu, false); - qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); -} - -QWindowsCEStyle::~QWindowsCEStyle() -{ -} - -void QWindowsCEStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - - bool doRestore = false; - QRect rect = option->rect; - - switch (element) { - case PE_PanelButtonTool: { - if ( -#ifndef QT_NO_TOOLBAR - (widget && qobject_cast<QToolBar*>(widget->parentWidget())) || -#endif -#ifndef QT_NO_DOCKWIDGET - (widget && widget->inherits("QDockWidgetTitleButton")) || -#endif - (option->state & (State_Sunken | State_On))) - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(0, 0, 0, 0), - option->palette, option->state & (State_Sunken | State_On), - &option->palette.button()); - if (option->state & (State_On)){ - QBrush fill = QBrush(option->palette.midlight().color(), Qt::Dense4Pattern); - painter->fillRect(option->rect.adjusted(windowsItemFrame , windowsItemFrame , - -windowsItemFrame , -windowsItemFrame ), fill); - } - break; } - case PE_IndicatorButtonDropDown: - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), - &option->palette.brush(QPalette::Button)); - break; -#ifndef QT_NO_TABBAR - case PE_IndicatorTabTear: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - bool rtl = tab->direction == Qt::RightToLeft; - QRect rect = tab->rect; - QPainterPath path; - rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); - rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); - path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); - int count = 3; - for(int jags = 1; jags <= count; ++jags, rtl = !rtl) - path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); - - painter->setPen(QPen(tab->palette.light(), qreal(.8))); - painter->setBrush(tab->palette.background()); - painter->setRenderHint(QPainter::Antialiasing); - painter->drawPath(path); - } - break; -#endif //QT_NO_TABBAR -#ifndef QT_NO_TOOLBAR - case PE_IndicatorToolBarSeparator: - //nothing to draw on WindowsCE - break; - case PE_IndicatorToolBarHandle: - painter->save(); - painter->translate(option->rect.x(), option->rect.y()); - if (option->state & State_Horizontal) { - int x = option->rect.width() / 2 - 4; - if (QApplication::layoutDirection() == Qt::RightToLeft) - x -= 2; - if (option->rect.height() > 4) { - QWindowsCEStylePrivate::drawWinCEButton(painter,x - 1, 0, 7, option->rect.height(), - option->palette, false, 0); - QWindowsCEStylePrivate::drawWinCEPanel(painter, x, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - QWindowsCEStylePrivate::drawWinCEPanel(painter, x + 3, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - painter->setPen(option->palette.button().color()); - painter->drawLine(x + 4, 2, x + 4,option->rect.height() - 2); - } - } else { - if (option->rect.width() > 4) { - int y = option->rect.height() / 2 - 4; - QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y, option->rect.width() - 2, 3, - option->palette, false, 0); - QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y + 3, option->rect.width() - 2, 3, - option->palette, false, 0); - } - } - painter->restore(); - break; - -#endif // QT_NO_TOOLBAR - case PE_FrameButtonTool: { -#ifndef QT_NO_DOCKWIDGET - if (widget && widget->inherits("QDockWidgetTitleButton")) { - if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent())) - if (dw->isFloating()){ - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(1, 1, 0, 0), - option->palette, option->state & (State_Sunken | State_On), - &option->palette.button()); - return; - } - } -#endif // QT_NO_DOCKWIDGET - QBrush fill; - bool stippled; - bool panel = (element == PE_PanelButtonTool); - if ((!(option->state & State_Sunken )) - && (!(option->state & State_Enabled) - || ((option->state & State_Enabled ) && !(option->state & State_MouseOver))) - && (option->state & State_On)) { - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - stippled = true; - } else { - fill = option->palette.brush(QPalette::Button); - stippled = false; - } - if (option->state & (State_Raised | State_Sunken | State_On)) { - if (option->state & State_AutoRaise) { - if(option->state & (State_Enabled | State_Sunken | State_On)){ - if (panel) - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), &fill); - else - qDrawShadeRect(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), 1); - } - if (stippled) { - painter->setPen(option->palette.button().color()); - painter->drawRect(option->rect.adjusted(1, 1, -2, -2)); - } - } else { - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), panel ? &fill : 0); - } - } else { - painter->fillRect(option->rect, fill); - } - break; } - - case PE_PanelButtonBevel: { - QBrush fill; - bool panel = element != PE_FrameButtonBevel; - painter->setBrushOrigin(option->rect.topLeft()); - if (!(option->state & State_Sunken) && (option->state & State_On)) - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - else - fill = option->palette.brush(QPalette::Button); - - if (option->state & (State_Raised | State_On | State_Sunken)) { - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), - panel ? &fill : 0); ; - } else { - if (panel) - painter->fillRect(option->rect, fill); - else - painter->drawRect(option->rect); - } - break; } - - case PE_FrameGroupBox: - if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - QRect fr = frame->rect; - painter->setPen(frame->palette.shadow().color()); - painter->drawRect(fr.x(), fr.y(), fr.x() + fr.width() - 1, - fr.y() + fr.height() - windowsCEFrameGroupBoxOffset); - } - break; - - case PE_IndicatorCheckBox: { - QBrush fill; - if (option->state & State_NoChange) - fill = QBrush(option->palette.base().color(), Qt::Dense4Pattern); - else if (option->state & State_Sunken) - fill = option->palette.button(); - else if (option->state & State_Enabled) - fill = option->palette.base(); - else - fill = option->palette.background(); - painter->save(); - doRestore = true; - painter->fillRect(option->rect,fill); - painter->setPen(option->palette.dark().color()); - painter->drawRect(option->rect); - painter->setPen(option->palette.shadow().color()); - painter->drawLine(option->rect.x() + 1,option->rect.y() + 1, - option->rect.x() + option->rect.width() - 1, option->rect.y() + 1); - painter->drawLine(option->rect.x() + 1,option->rect.y() + 1, - option->rect.x() + 1, option->rect.y() + option->rect.height() - 1); - //fall through... - } - case PE_IndicatorViewItemCheck: { - if (!doRestore) { - painter->save(); - doRestore = true; - } - int arrowSize= 2; - if (element == PE_IndicatorViewItemCheck) { - QLinearGradient linearGradient(QPoint(option->rect.x(),option->rect.y()), QPoint(option->rect.x()+option->rect.width(), - option->rect.y()+option->rect.height())); - linearGradient.setColorAt(0, windowsCECheckBoxGradientColorBegin); - linearGradient.setColorAt(1, windowsCECheckBoxGradientColorEnd); - painter->setBrush(linearGradient); - painter->setPen(Qt::NoPen); - if (option->state & State_NoChange) - painter->setBrush(option->palette.brush(QPalette::Button)); - painter->setPen(option->palette.link().color()); - painter->drawRect(option->rect.x(), option->rect.y(), windowsCEitemViewCheckBoxSize, windowsCEitemViewCheckBoxSize); - painter->setPen(option->palette.brightText().color()); - arrowSize= 3; - } - if (!(option->state & State_Off)) { - QLineF lines[9]; - int i, xx, yy; - xx = option->rect.x() + 4; - yy = option->rect.y() + 6; - for (i = 0; i < 4; ++i) { - lines[i] = QLineF(xx, yy, xx, yy + arrowSize); - ++xx; - ++yy; - } - yy -= 2; - for (i = 4; i < 9; ++i) { - lines[i] = QLineF(xx, yy, xx, yy + arrowSize); - ++xx; - --yy; - } - painter->drawLines(lines, 9); - } - if (doRestore) - painter->restore(); - - break; } - case PE_IndicatorRadioButton: { - QRect ir = option->rect; - painter->save(); - painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.light()); - painter->drawEllipse(option->rect); - painter->setPen(option->palette.shadow().color()); - painter->setBrush(option->palette.shadow().color()); - painter->drawArc(option->rect, 0, 360 * 16); - painter->drawArc(option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2, - option->rect.height() - 2, 40 * 16, 180 * 16); - painter->setPen(option->palette.light().color()); - painter->drawPoint(option->rect.x() + 11, option->rect.y() + 3); - painter->drawPoint(option->rect.x() + 3,option->rect.y() + 3); - painter->setPen(option->palette.shadow().color()); - painter->drawPoint(option->rect.x() +3,option->rect.y() + 12); - if (option->state & (State_Sunken | State_On)) { - painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.text()); - painter->drawEllipse(option->rect.x() +3,option->rect.y()+ 2,9,10); - } - painter->restore(); - break; } - case PE_PanelMenuBar: - painter->save(); - painter->setPen(option->palette.shadow().color()); - painter->drawRect(option->rect); - painter->restore(); - break; - case PE_PanelButtonCommand: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QBrush fill; - State flags = option->state; - QPalette pal = option->palette; - QRect r = option->rect; - if (! (flags & State_Sunken) && (flags & State_On)) - fill = QBrush(pal.light().color(), Qt::Dense4Pattern); - else - fill = pal.brush(QPalette::Button); - if (btn->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) { - painter->setPen(pal.dark().color()); - painter->setBrush(fill); - painter->drawRect(r.adjusted(0, 0, -1, -1)); - } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) { - QWindowsCEStylePrivate::drawWinCEButton(painter, r, pal, flags & (State_Sunken | State_On), - &fill); - } else { - painter->fillRect(r, fill); - } - - } - break; - case PE_FrameDefaultButton: { - painter->setPen(option->palette.shadow().color()); - QRect rect = option->rect; - rect.adjust(0, 0, -1, -1); - painter->drawRect(rect); - break; } - case PE_IndicatorSpinPlus: - case PE_IndicatorSpinMinus: { - QRect r = option->rect; - int fw = pixelMetric(PM_DefaultFrameWidth, option, widget)+2; - QRect br = r.adjusted(fw, fw, -fw, -fw); - int offset = (option->state & State_Sunken) ? 1 : 0; - int step = (br.width() + 4) / 5; - painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, - br.width(), step, - option->palette.buttonText()); - if (element == PE_IndicatorSpinPlus) - painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4, - step, br.height()-7, - option->palette.buttonText()); - break; } - case PE_IndicatorSpinUp: - case PE_IndicatorSpinDown: { - painter->save(); - QPoint points[7]; - switch (element) { - case PE_IndicatorSpinUp: - points[0] = QPoint(-2, -4); - points[1] = QPoint(-2, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(0, -2); - points[5] = QPoint(0, 0); - points[6] = QPoint(1, -1); - break; - case PE_IndicatorSpinDown: - points[0] = QPoint(0, -4); - points[1] = QPoint(0, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(-2, -2); - points[5] = QPoint(-2, 0); - points[6] = QPoint(-3, -1); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2); - painter->setPen(option->palette.buttonText().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2 + 1, - option->rect.y() + option->rect.height() / 2 + 1); - painter->setPen(option->palette.light().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - painter->translate(-1, -1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } - - painter->restore(); - break; } - case PE_IndicatorArrowUp: - case PE_IndicatorArrowDown: - case PE_IndicatorArrowRight: - case PE_IndicatorArrowLeft: { - painter->save(); - QPoint points[9]; - switch (element) { - case PE_IndicatorArrowUp: - - points[0] = QPoint(-4, 2); - points[1] = QPoint(4, 2); - points[2] = QPoint(-3, 1); - points[3] = QPoint(3, 1); - points[4] = QPoint(-2, 0); - points[5] = QPoint(2, 0); - points[6] = QPoint(-1, -1); - points[7] = QPoint(1, -1); - points[8] = QPoint(0, -2); - break; - case PE_IndicatorArrowDown: - - points[0] = QPoint(-4, -2); - points[1] = QPoint(4, -2); - points[2] = QPoint(-3, -1); - points[3] = QPoint(3, -1); - points[4] = QPoint(-2, 0); - points[5] = QPoint(2, 0); - points[6] = QPoint(-1, 1); - points[7] = QPoint(1, 1); - points[8] = QPoint(0, 2); - break; - case PE_IndicatorArrowRight: - points[0] = QPoint(-3, -4); - points[1] = QPoint(-3, 4); - points[2] = QPoint(-2, -3); - points[3] = QPoint(-2, 3); - points[4] = QPoint(-1, -2); - points[5] = QPoint(-1, 2); - points[6] = QPoint(0, -1); - points[7] = QPoint(0, 1); - points[8] = QPoint(1, 0); - break; - case PE_IndicatorArrowLeft: - points[0] = QPoint(1, -4); - points[1] = QPoint(1, 4); - points[2] = QPoint(0, -3); - points[3] = QPoint(0, 3); - points[4] = QPoint(-1, -2); - points[5] = QPoint(-1, 2); - points[6] = QPoint(-2, -1); - points[7] = QPoint(-2, 1); - points[8] = QPoint(-3, 0); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2); - painter->setPen(option->palette.buttonText().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawLine(points[6], points[7]); - painter->drawPoint(points[8]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2 + 1, - option->rect.y() + option->rect.height() / 2 + 1); - painter->setPen(option->palette.light().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawLine(points[6], points[7]); - painter->drawPoint(points[8]); - painter->translate(-1, -1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawLine(points[6], points[7]); - painter->drawPoint(points[8]); - } - painter->restore(); - break; } - - case PE_FrameWindow: { - QPalette popupPal = option->palette; - popupPal.setColor(QPalette::Light, option->palette.background().color()); - popupPal.setColor(QPalette::Midlight, option->palette.light().color()); - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, popupPal, option->state & State_Sunken); - break; } - - case PE_Frame: - case PE_FrameMenu: - if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - QPalette popupPal = frame->palette; - QRect r = frame->rect; - qDrawPlainRect(painter, r, frame->palette.shadow().color(),1); - } - break; - case PE_FrameStatusBar: - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, 0); - break; - - case PE_FrameTabWidget: { - QRect rect = option->rect; - QPalette pal = option->palette; - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, false, 0); - break; } - default: - QWindowsStyle::drawPrimitive(element, option, painter, widget); - break; - } -} - -void QWindowsCEStyle::drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - switch (element) { - #ifndef QT_NO_MENU - case CE_MenuTearoff: { - if(option->state & State_Selected) { - if(pixelMetric(PM_MenuPanelWidth, option, widget) > 1) - qDrawShadePanel(painter, option->rect.x(), option->rect.y(), option->rect.width(), - option->rect.height(), option->palette, false, 2, - &option->palette.brush(QPalette::Button)); - else - qDrawShadePanel(painter, option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2, - option->rect.height() - 2, option->palette, true, 1, &option->palette.brush(QPalette::Button)); - } else { - painter->fillRect(option->rect, option->palette.brush(QPalette::Button)); - } - painter->setPen(QPen(option->palette.dark().color(), 1, Qt::DashLine)); - painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2-1, option->rect.x()+option->rect.width()-4, - option->rect.y()+option->rect.height()/2-1); - painter->setPen(QPen(option->palette.light().color(), 1, Qt::DashLine)); - painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2, option->rect.x()+option->rect.width()-4, - option->rect.y()+option->rect.height()/2); - break; } - - - case CE_MenuBarItem: - if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - bool active = mbi->state & State_Selected; - bool hasFocus = mbi->state & State_HasFocus; - bool down = mbi->state & State_Sunken; - QStyleOptionMenuItem newMbi = *mbi; - if (active || hasFocus) { - QBrush b = mbi->palette.brush(QPalette::Highlight); - if (active && down) { - painter->fillRect(mbi->rect.adjusted(0, 1, 0, -1), b); - } - } - uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip - | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, mbi, widget)) - alignment |= Qt::TextHideMnemonic; - - painter->save(); - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize), - (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); - if (!pix.isNull()) - drawItemPixmap(painter,mbi->rect, alignment, pix); - else - if (active && down) - drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, - mbi->text, QPalette::Light); - else - drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, - mbi->text, QPalette::ButtonText); - painter->restore(); - } - break; - - case CE_MenuBarEmptyArea: - painter->save(); - painter->setPen(option->palette.shadow().color()); - if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground)) { - painter->eraseRect(option->rect); - QRect r = option->rect; - painter->drawLine(r.x() + 1, r.y() + 1, r.x()+ 1, r.y()+ r.height() - 2); - painter->drawLine(r.x() - 2 + r.width(), r.y() + 1, r.x() - 2 + r.width(), r.y() + r.height() - 2); - painter->drawLine(r.x() + 1, r.y() +1, r.x() - 1 + r.width(), r.y() + 1); - painter->drawLine(r.x() + 1, r.y() + r.height()-2 , r.x() - 2 + r.width(), r.y() + r.height() - 2); - } - painter->restore(); - break; - - case CE_MenuItem: - if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - int x, y, w, h; - menuitem->rect.getRect(&x, &y, &w, &h); - int tab = menuitem->tabWidth; - bool dis = !(menuitem->state & State_Enabled); - bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable - ? menuitem->checked : false; - bool act = menuitem->state & State_Selected; - - // windows always has a check column, regardless whether we have an icon or not - int checkcol = qMax(menuitem->maxIconWidth, windowsCheckMarkWidth); - QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button); - painter->fillRect(menuitem->rect.adjusted(1, 1, 0, 0), fill); - - if (menuitem->menuItemType == QStyleOptionMenuItem::Separator) { - int yoff = y-1 + h / 2; - painter->setPen(menuitem->palette.shadow().color()); - painter->drawLine(x + 4, yoff + 1, x + w - 8, yoff + 1); - return; - } - - QRect vCheckRect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x(), - menuitem->rect.y(), checkcol, menuitem->rect.height())); - if (checked) { - if (act && !dis) { - qDrawPlainRect(painter, vCheckRect, - menuitem->palette.button().color(), 1, - &menuitem->palette.brush(QPalette::Button)); - } else { - QBrush fill(menuitem->palette.button().color(), Qt::Dense4Pattern); - qDrawPlainRect(painter, vCheckRect,menuitem->palette.button().color(), 1, &fill); - } - } else if (!act) { - painter->fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button)); - } - // On Windows Style, if we have a checkable item and an icon we - // draw the icon recessed to indicate an item is checked. If we - // have no icon, we draw a checkmark instead. - if (!menuitem->icon.isNull()) { - QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal; - if (act && !dis) - mode = QIcon::Active; - QPixmap pixmap; - if (checked) - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On); - else - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode); - const int pixw = pixmap.width() / pixmap.devicePixelRatio(); - const int pixh = pixmap.height() / pixmap.devicePixelRatio(); - if (act && !dis && !checked) - qDrawPlainRect(painter, vCheckRect, menuitem->palette.button().color(), 1, - &menuitem->palette.brush(QPalette::Button)); - QRect pmr(0, 0, pixw, pixh); - pmr.moveCenter(vCheckRect.center()); - painter->setPen(menuitem->palette.text().color()); - painter->drawPixmap(pmr.topLeft(), pixmap); - } else if (checked) { - QStyleOptionMenuItem newMi = *menuitem; - newMi.state = State_None; - if (!dis) - newMi.state |= State_Enabled; - if (act) - newMi.state |= State_On; - newMi.rect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x() - + windowsItemFrame, menuitem->rect.y() + windowsItemFrame, - checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame)); - drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, painter, widget); - } - painter->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color()); - - QColor discol; - if (dis) { - discol = menuitem->palette.text().color(); - painter->setPen(discol); - } - int xm = windowsItemFrame + checkcol + windowsItemHMargin; - int xpos = menuitem->rect.x() + xm; - QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); - QRect vTextRect = visualRect(option->direction, menuitem->rect, textRect); - QString s = menuitem->text; - if (!s.isEmpty()) { // draw text - painter->save(); - int t = s.indexOf(QLatin1Char('\t')); - int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) - text_flags |= Qt::TextHideMnemonic; - text_flags |= Qt::AlignLeft; - if (t >= 0) { - QRect vShortcutRect = visualRect(option->direction, menuitem->rect, - QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); - if (dis && !act) - painter->setPen(discol); - painter->drawText(vShortcutRect, text_flags, s.mid(t + 1)); - s = s.left(t); - } - QFont font = menuitem->font; - if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) - font.setBold(true); - painter->setFont(font); - if (dis && !act) - painter->setPen(discol); - painter->drawText(vTextRect, text_flags, s.left(t)); - painter->restore(); - } - if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow - int dim = (h - 2 * windowsItemFrame) / 2; - PrimitiveElement arrow; - arrow = (option->direction == Qt::RightToLeft) ? PE_IndicatorSpinDown : PE_IndicatorSpinUp; - xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim; - QRect vSubMenuRect = visualRect(option->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim)); - QStyleOptionMenuItem newMI = *menuitem; - newMI.rect = vSubMenuRect; - newMI.state = dis ? State_None : State_Enabled; - if (act) - newMI.palette.setColor(QPalette::ButtonText, - newMI.palette.highlightedText().color()); - drawPrimitive(arrow, &newMI, painter, widget); - } - } - break; -#endif // QT_NO_MENU - case CE_MenuVMargin: - painter->fillRect(option->rect, Qt::white); - break; - case CE_MenuEmptyArea: - QWindowsStyle::drawControl(element,option, painter, widget); - break; - -#ifndef QT_NO_TABBAR - case CE_TabBarTab: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - drawControl(CE_TabBarTabShape, tab, painter, widget); - drawControl(CE_TabBarTabLabel, tab, painter, widget); - } - break; - case CE_TabBarTabShape: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - bool rtlHorTabs = (tab->direction == Qt::RightToLeft - && (tab->shape == QTabBar::RoundedNorth - || tab->shape == QTabBar::RoundedSouth)); - bool selected = tab->state & State_Selected; - bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End) - || (rtlHorTabs - && tab->position == QStyleOptionTab::Beginning)); - bool firstTab = ((!rtlHorTabs - && tab->position == QStyleOptionTab::Beginning) - || (rtlHorTabs - && tab->position == QStyleOptionTab::End)); - bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; - bool previousSelected = - ((!rtlHorTabs - && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected) - || (rtlHorTabs - && tab->selectedPosition == QStyleOptionTab::NextIsSelected)); - bool nextSelected = - ((!rtlHorTabs - && tab->selectedPosition == QStyleOptionTab::NextIsSelected) - || (rtlHorTabs - && tab->selectedPosition - == QStyleOptionTab::PreviousIsSelected)); - int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget); - bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft) - || (rtlHorTabs - && tabBarAlignment == Qt::AlignRight); - - bool rightAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignRight) - || (rtlHorTabs - && tabBarAlignment == Qt::AlignLeft); - QColor light = tab->palette.light().color(); - QColor midlight = tab->palette.midlight().color(); - QColor dark = tab->palette.dark().color(); - QColor shadow = tab->palette.shadow().color(); - QColor background = tab->palette.background().color(); - int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget); - if (selected) - borderThinkness /= 2; - QRect r2(option->rect); - int x1 = r2.left(); - int x2 = r2.right(); - int y1 = r2.top(); - int y2 = r2.bottom(); - switch (tab->shape) { - default: - QCommonStyle::drawControl(element, tab, painter, widget); - break; - case QTabBar::RoundedNorth: { - if (!selected) { - y1 += 2; - x1 += firstTab ? borderThinkness : 0; - x2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x1, y2 - 1, x2, y2 - 1); - painter->drawLine(x1, y2 + 1, x2, y2 + 1); - painter->drawLine(x1, y2, x2, y2); - } - // Left - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - painter->drawPoint(x1 + 1, y1 + 1); - painter->setPen(midlight); - painter->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 - - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - - } - // Top - { - int beg = x1 + (previousSelected ? 0 : 2); - int end = x2 - (nextSelected ? 0 : 2); - painter->setPen(dark); - painter->drawLine(beg, y1, end, y1); - - painter->setPen(midlight); - painter->drawLine(beg, y1 + 1, end, y1 + 1); - - } - // Right - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness)); - painter->drawPoint(x2 - 1, y1 + 1); - painter->setPen(dark); - painter->drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness)); - } - break; } - case QTabBar::RoundedSouth: { - if (!selected) { - y2 -= 2; - x1 += firstTab ? borderThinkness : 0; - x2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x1, y1 + 1, x2 - 1, y1 + 1); - painter->drawLine(x1, y1 - 1, x2 - 1, y1 - 1); - painter->drawLine(x1, y1, x2 - 1, y1); - } - // Left - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - painter->drawPoint(x1 + 1, y2 - 1); - painter->setPen(midlight); - painter->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - } - // Bottom - { - int beg = x1 + (previousSelected ? 0 : 2); - int end = x2 - (nextSelected ? 0 : 2); - painter->setPen(shadow); - painter->drawLine(beg, y2, end, y2); - painter->setPen(dark); - painter->drawLine(beg, y2 - 1, end, y2 - 1); - } - // Right - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness)); - painter->drawPoint(x2 - 1, y2 - 1); - painter->setPen(dark); - painter->drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness)); - } - break; } - case QTabBar::RoundedWest: { - if (!selected) { - x1 += 2; - y1 += firstTab ? borderThinkness : 0; - y2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x2 - 1, y1, x2 - 1, y2); - painter->drawLine(x2, y1, x2, y2); - } - // Top - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && - leftAligned ? 0 : borderThinkness), y1); - painter->drawPoint(x1 + 1, y1 + 1); - painter->setPen(midlight); - painter->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected && - leftAligned ? 0 : borderThinkness), y1 + 1); - } - // Left - { - int beg = y1 + (previousSelected ? 0 : 2); - int end = y2 - (nextSelected ? 0 : 2); - painter->setPen(dark); - painter->drawLine(x1, beg, x1, end); - painter->setPen(midlight); - painter->drawLine(x1 + 1, beg, x1 + 1, end); - } - // Bottom - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness), y2); - painter->drawPoint(x1 + 2, y2 - 1); - painter->setPen(dark); - painter->drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness), y2 - 1); - painter->drawPoint(x1 + 1, y2 - 1); - painter->drawPoint(x1 + 2, y2); - } - break; } - case QTabBar::RoundedEast: { - if (!selected) { - x2 -= 2; - y1 += firstTab ? borderThinkness : 0; - y2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x1 + 1, y1, x1 + 1, y2 - 1); - painter->drawLine(x1, y1, x1, y2 - 1); - } - // Top - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && - leftAligned ? 0 : borderThinkness), y1); - painter->drawPoint(x2 - 1, y1 + 1); - painter->setPen(midlight); - painter->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) && - selected && leftAligned ? 0 : borderThinkness), y1 + 1); - painter->drawPoint(x2 - 1, y1); - - } - // Right - { - int beg = y1 + (previousSelected ? 0 : 2); - int end = y2 - (nextSelected ? 0 : 2); - painter->setPen(shadow); - painter->drawLine(x2, beg, x2, end); - painter->setPen(dark); - painter->drawLine(x2 - 1, beg, x2 - 1, end); - } - // Bottom - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) && - selected && rightAligned ? 0 : borderThinkness), y2); - painter->drawPoint(x2 - 1, y2 - 1); - painter->setPen(dark); - painter->drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) && - selected && rightAligned ? 0 : borderThinkness), y2 - 1); - } - break; } - } - } - break; -#endif // QT_NO_TABBAR - - case CE_ToolBar: { - QRect rect = option->rect; - painter->setPen(QPen(option->palette.dark().color())); - painter->drawLine(rect.topRight().x()-1, - rect.topRight().y(), - rect.bottomRight().x()-1, - rect.bottomRight().y()); - painter->drawLine(rect.bottomLeft().x(), - rect.bottomLeft().y(), - rect.bottomRight().x(), - rect.bottomRight().y()); - painter->setPen(QPen(option->palette.light().color())); - painter->drawLine(rect.topRight().x(), - rect.topRight().y(), - rect.bottomRight().x(), - rect.bottomRight().y()); - painter->drawLine(rect.topLeft().x(), - rect.topLeft().y(), - rect.topRight().x(), - rect.topRight().y()); - - break; } -#ifndef QT_NO_SCROLLBAR - case CE_ScrollBarSubLine: - case CE_ScrollBarAddLine: { - if (option->state & State_Sunken) { - QStyleOption buttonOpt = *option; - - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - } else { - QStyleOption buttonOpt = *option; - if (!(buttonOpt.state & State_Sunken)) - buttonOpt.state |= State_Raised; - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - } - PrimitiveElement arrow; - if (option->state & State_Horizontal) { - if (element == CE_ScrollBarAddLine) - arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft; - else - arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight; - } else { - if (element == CE_ScrollBarAddLine) - arrow = PE_IndicatorArrowDown; - else - arrow = PE_IndicatorArrowUp; - } - drawPrimitive(arrow, option, painter, widget); - break; } - case CE_ScrollBarAddPage: - case CE_ScrollBarSubPage: { - QBrush br; - QBrush bg = painter->background(); - Qt::BGMode bg_mode = painter->backgroundMode(); - painter->setPen(Qt::NoPen); - painter->setBackgroundMode(Qt::OpaqueMode); - - if (option->state & State_Sunken) { - br = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern); - painter->setBackground(option->palette.dark().color()); - painter->setBrush(br); - } else { - QPixmap pm = option->palette.brush(QPalette::Light).texture(); - if (option->state & State_Enabled) - br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.button().color(), Qt::Dense4Pattern); - else - br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern); - painter->setBackground(option->palette.base().color()); - painter->setBrush(br); - } - painter->drawRect(option->rect); - painter->setBackground(bg); - painter->setBackgroundMode(bg_mode); - break; } - case CE_ScrollBarSlider: - if (!(option->state & State_Enabled)) { - QStyleOptionButton buttonOpt; - buttonOpt.QStyleOption::operator=(*option); - buttonOpt.state = State_Enabled | State_Raised; - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - QPixmap pm = option->palette.brush(QPalette::Light).texture(); - QBrush br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern); - painter->setPen(Qt::NoPen); - painter->setBrush(br); - painter->setBackgroundMode(Qt::OpaqueMode); - painter->drawRect(option->rect.adjusted(2, 2, -2, -2)); - } else { - QStyleOptionButton buttonOpt; - buttonOpt.QStyleOption::operator=(*option); - buttonOpt.state = State_Enabled | State_Raised; - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - } - break; -#endif // QT_NO_SCROLLBAR - case CE_HeaderSection: { - QBrush fill; - if (option->state & State_On) - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - else - fill = option->palette.brush(QPalette::Button); - - if (option->state & (State_Raised | State_Sunken)) { - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & State_Sunken, &fill); - } else { - painter->fillRect(option->rect, fill); - } - break; } - - case CE_DockWidgetTitle: - QWindowsStyle::drawControl(element,option, painter, widget); - break; - - case CE_PushButtonLabel: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - painter->save(); - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - QRect ir = btn->rect; - uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, btn, widget)) - tf |= Qt::TextHideMnemonic; - - if (btn->state & (State_On | State_Sunken)) - ir.translate(pixelMetric(PM_ButtonShiftHorizontal, option, widget), - pixelMetric(PM_ButtonShiftVertical, option, widget)); - if (!btn->icon.isNull()) { - QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal - : QIcon::Disabled; - if (mode == QIcon::Normal && btn->state & State_HasFocus) - mode = QIcon::Active; - QIcon::State state = QIcon::Off; - if (btn->state & State_On) - state = QIcon::On; - QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - //Center the icon if there is no text - - QPoint point; - if (btn->text.isEmpty()) { - point = QPoint(ir.x() + ir.width() / 2 - pixw / 2, - ir.y() + ir.height() / 2 - pixh / 2); - } else { - point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2); - } - if (btn->direction == Qt::RightToLeft) - point.rx() += pixw; - - if ((btn->state & (State_On | State_Sunken)) && btn->direction == Qt::RightToLeft) - point.rx() -= pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2; - - painter->drawPixmap(visualPos(btn->direction, btn->rect, point), pixmap); - - if (btn->direction == Qt::RightToLeft) - ir.translate(-4, 0); - else - ir.translate(pixw + 4, 0); - ir.setWidth(ir.width() - (pixw + 4)); - // left-align text if there is - if (!btn->text.isEmpty()) - tf |= Qt::AlignLeft; - } else { - tf |= Qt::AlignHCenter; - } - drawItemText(painter, ir, tf, btn->palette, (btn->state & State_Enabled), - btn->text, QPalette::ButtonText); - painter->restore(); - } - break; - default: - QWindowsStyle::drawControl(element, option, painter, widget); - break; - } -} - -void QWindowsCEStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const { - switch (control) { - #ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - int len = pixelMetric(PM_SliderLength, slider, widget); - int ticks = slider->tickPosition; - QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget); - QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget); - - if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { - int mid = thickness / 2; - if (ticks & QSlider::TicksAbove) - mid += len / 8; - if (ticks & QSlider::TicksBelow) - mid -= len / 8; - - painter->setPen(slider->palette.shadow().color()); - if (slider->orientation == Qt::Horizontal) { - QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x(), groove.y() + mid - 2, - groove.width(), 4, option->palette, true); - painter->drawLine(groove.x() + 1, groove.y() + mid - 1, - groove.x() + groove.width() - 3, groove.y() + mid - 1); - } else { - QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x() + mid - 2, groove.y(), - 4, groove.height(), option->palette, true); - painter->drawLine(groove.x() + mid - 1, groove.y() + 1, - groove.x() + mid - 1, groove.y() + groove.height() - 3); - } - } - if (slider->subControls & SC_SliderTickmarks) { - QStyleOptionSlider tmpSlider = *slider; - tmpSlider.subControls = SC_SliderTickmarks; - QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget); - } - - if (slider->subControls & SC_SliderHandle) { - // 4444440 - // 4333310 - // 4322210 - // 4322210 - // 4322210 - // 4322210 - // *43210* - // **440** - // ***0*** - const QColor c0 = slider->palette.shadow().color(); - const QColor c1 = slider->palette.dark().color(); - // const QColor c2 = g.button(); - const QColor c3 = slider->palette.midlight().color(); - const QColor c4 = slider->palette.dark().color(); - QBrush handleBrush; - - if (slider->state & State_Enabled) { - handleBrush = slider->palette.color(QPalette::Button); - } else { - handleBrush = QBrush(slider->palette.color(QPalette::Button), - Qt::Dense4Pattern); - } - - int x = handle.x(), y = handle.y(), - wi = handle.width(), he = handle.height(); - - int x1 = x; - int x2 = x + wi - 1; - int y1 = y; - int y2 = y + he - 1; - - Qt::Orientation orient = slider->orientation; - bool tickAbove = slider->tickPosition == QSlider::TicksAbove; - bool tickBelow = slider->tickPosition == QSlider::TicksBelow; - - if (slider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*slider); - fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - QWindowsCEStylePrivate::drawWinCEButton(painter, QRect(x, y, wi, he), slider->palette, false, - &handleBrush); - painter->setBackgroundMode(oldMode); - QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill); - return; - } - QSliderDirection dir; - if (orient == Qt::Horizontal) - if (tickAbove) - dir = SlUp; - else - dir = SlDown; - else - if (tickAbove) - dir = SlLeft; - else - dir = SlRight; - QPolygon a; - int d = 0; - switch (dir) { - case SlUp: - x2++; - y1 = y1 + wi / 2; - d = (wi + 1) / 2 - 1; - a.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d, y1 - d); - break; - case SlDown: - x2++; - y2 = y2 - wi / 2; - d = (wi + 1) / 2 - 1; - a.setPoints(5, x1, y1, x1, y2, x1 + d, y2+d, x2, y2, x2, y1); - break; - case SlLeft: - d = (he + 1) / 2 - 1; - x1 = x1 + he / 2; - a.setPoints(5, x1, y1, x1 - d, y1 + d, x1, y2, x2, y2, x2, y1); - y1--; - break; - case SlRight: - d = (he + 1) / 2 - 1; - x2 = x2 - he / 2; - a.setPoints(5, x1, y1, x1, y2, x2, y2, x2 + d, y1 + d, x2, y1); - y1--; - break; - } - QBrush oldBrush = painter->brush(); - painter->setPen(Qt::NoPen); - painter->setBrush(handleBrush); - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - painter->drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1); - painter->drawPolygon(a); - QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill); - painter->setBrush(oldBrush); - painter->setBackgroundMode(oldMode); - - if (dir != SlUp) { - painter->setPen(c4); - painter->drawLine(x1, y1, x2, y1); - painter->setPen(c3); - painter->drawLine(x1, y1 + 1, x2, y1 + 1); - } - if (dir != SlLeft) { - painter->setPen(c3); - painter->drawLine(x1 + 1, y1 + 1, x1 + 1, y2); - painter->setPen(c4); - painter->drawLine(x1, y1, x1, y2); - } - if (dir != SlRight) { - painter->setPen(c0); - painter->drawLine(x2, y1, x2, y2); - painter->setPen(c1); - painter->drawLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1); - } - if (dir != SlDown) { - painter->setPen(c0); - painter->drawLine(x1, y2, x2, y2); - painter->setPen(c1); - painter->drawLine(x1+1, y2 - 1, x2 - 1, y2 - 1); - } - - switch (dir) { - case SlUp: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4,y1), fill); - painter->setPen(c4); - painter->drawLine(x1, y1, x1 + d, y1 - d); - painter->setPen(c0); - d = wi - d - 1; - painter->drawLine(x2, y1, x2 - d, y1 - d); - d--; - painter->setPen(c3); - painter->drawLine(x1 + 1, y1, x1 + 1 + d-1, y1 - d + 1); - painter->setPen(c1); - painter->drawLine(x2 - 1, y1, x2-1 - d, y1 - d); - break; - case SlDown: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 3, y2 - d, x2 - x1 - 4,y2 - 8), fill); - painter->setPen(c4); - painter->drawLine(x1, y2, x1 + d, y2 + d); - painter->setPen(c0); - d = wi - d - 1; - painter->drawLine(x2, y2, x2 - d, y2 + d); - d--; - painter->setPen(c3); - painter->drawLine(x1 + 1, y2, x1 + 1 + d - 1, y2 + d - 1); - painter->setPen(c1); - painter->drawLine(x2 - 1, y2, x2 - 1 - d, y2 + d); - break; - case SlLeft: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1,y2 - y1 - 3), fill); - painter->setPen(c4); - painter->drawLine(x1, y1, x1 - d, y1 + d); - painter->setPen(c0); - d = he - d - 1; - painter->drawLine(x1, y2, x1 - d, y2 - d); - d--; - painter->setPen(c3); - painter->drawLine(x1, y1 + 1, x1 - d + 1, y1 + 1 + d - 1); - painter->setPen(c1); - painter->drawLine(x1, y2 - 1, x1 - d, y2 - 1 - d); - break; - case SlRight: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3), fill); - painter->setPen(c4); - painter->drawLine(x2, y1, x2 + d, y1 + d); - painter->setPen(c0); - d = he - d - 1; - painter->drawLine(x2, y2, x2 + d, y2 - d); - d--; - painter->setPen(c3); - painter->drawLine(x2, y1 + 1, x2 + d - 1, y1 + 1 + d - 1); - painter->setPen(c1); - painter->drawLine(x2, y2 - 1, x2 + d, y2 - 1 - d); - break; - } - } - } - break; -#endif // QT_NO_SLIDER - case CC_ToolButton: - if (const QStyleOptionToolButton *toolbutton - = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - QRect button, menuarea; - -#ifndef QT_NO_TOOLBAR - bool flat = !(widget ? qobject_cast<QToolBar*>(widget->parentWidget()) : 0); -#else - bool flat = true; -#endif - - button = subControlRect(control, toolbutton, SC_ToolButton, widget); - menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); - - if (flat && (toolbutton->subControls & SC_ToolButtonMenu)) { - menuarea.setLeft(menuarea.left() - 4); - button.setRight(button.right() - 4); - } - - State bflags = toolbutton->state; - - if (bflags & State_AutoRaise) - if (!(bflags & State_MouseOver)) { - bflags &= ~State_Raised; - } - State mflags = bflags; - - if (toolbutton->activeSubControls & SC_ToolButton) - bflags |= State_Sunken; - if (toolbutton->activeSubControls & SC_ToolButtonMenu) - mflags |= State_Sunken; - - QStyleOption tool(0); - tool.palette = toolbutton->palette; - if (toolbutton->subControls & SC_ToolButton) { - tool.rect = button; - tool.state = bflags; - drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); - } - - if (toolbutton->subControls & SC_ToolButtonMenu) { - tool.rect = menuarea; - tool.state = mflags; - tool.state = bflags; - drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget); - - if (!flat) { - - //connect buttons - painter->save(); - painter->setPen(tool.palette.button().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() - 2, tool.rect.y() + tool.rect.height()); - painter->drawLine(tool.rect.x() - 1, tool.rect.y(), tool.rect.x() - 1, tool.rect.y() + tool.rect.height()); - painter->drawLine(tool.rect.x(), tool.rect.y(), tool.rect.x(), tool.rect.y() + tool.rect.height()); - painter->drawLine(tool.rect.x() + 1, tool.rect.y(), tool.rect.x() + 1, tool.rect.y() + tool.rect.height()); - - if (tool.state & State_Sunken) - { - painter->setPen(tool.palette.midlight().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 2, - tool.rect.x() + 1, tool.rect.y() + tool.rect.height() -2 ); - painter->setPen(tool.palette.shadow().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1); - painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() + 1, tool.rect.y()); - painter->setPen(tool.palette.light().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1, - tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1); - } - else - { - painter->setPen(tool.palette.dark().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y(),tool.rect.x() + 1, tool.rect.y()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y()+tool.rect.height() - 2,tool.rect.x() + 1, - tool.rect.y() + tool.rect.height() - 2); - painter->setPen(tool.palette.midlight().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1); - painter->setPen(tool.palette.shadow().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1, - tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1); - } - painter->restore(); - } - - - if (!flat) { - tool.rect.adjust(-3,0,-3,0); - painter->save(); - painter->setPen(tool.palette.button().color()); - if (tool.state & State_Sunken) - painter->drawLine(tool.rect.x() + 2, tool.rect.y() + 10, - tool.rect.x() + tool.rect.width(), tool.rect.y() + 10); - else - painter->drawLine(tool.rect.x() + 1, tool.rect.y() + 9, tool.rect.x() + - tool.rect.width() - 1, tool.rect.y() + 9); - painter->restore(); - } else { - tool.rect.adjust(-1,0,-1,0); - } - - drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); - } - - if (toolbutton->state & State_HasFocus) { - QStyleOptionFocusRect fr; - fr.QStyleOption::operator=(*toolbutton); - fr.rect.adjust(3, 3, -3, -3); - if (toolbutton->features & QStyleOptionToolButton::Menu) - fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, - toolbutton, widget), 0); - drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); - } - QStyleOptionToolButton label = *toolbutton; - int fw = pixelMetric(PM_DefaultFrameWidth, option, widget); - label.rect = button.adjusted(fw, fw, -fw, -fw); - drawControl(CE_ToolButtonLabel, &label, painter, widget); - } - break; - -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - // Draw frame - painter->save(); - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - QStyleOptionGroupBox groupBoxFont = *groupBox; - groupBoxFont.fontMetrics = QFontMetrics(f); - QRect textRect = subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget); - QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget); - if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { - QStyleOptionFrame frame; - frame.QStyleOption::operator=(*groupBox); - frame.features = groupBox->features; - frame.lineWidth = groupBox->lineWidth; - frame.midLineWidth = groupBox->midLineWidth; - frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); - painter->save(); - - QRegion region(groupBox->rect); - if (!groupBox->text.isEmpty()) { - bool ltr = groupBox->direction == Qt::LeftToRight; - QRect finalRect = checkBoxRect.united(textRect); - if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) - finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); - region -= finalRect; - } - painter->setClipRegion(region); - drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); - painter->restore(); - } - - // Draw title - if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { - QColor textColor = groupBox->textColor; - if (textColor.isValid()) - painter->setPen(textColor); - int alignment = int(groupBox->textAlignment); - if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) - alignment |= Qt::TextHideMnemonic; - - drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, - groupBox->palette, groupBox->state & State_Enabled, groupBox->text, - textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); - - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - } - // Draw checkbox - if (groupBox->subControls & SC_GroupBoxCheckBox) { - QStyleOptionButton box; - box.QStyleOption::operator=(*groupBox); - box.rect = checkBoxRect; - drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); - } - painter->restore(); - } - break; -#endif //QT_NO_GROUPBOX -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QBrush editBrush = cmb->palette.brush(QPalette::Base); - if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame) - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, &editBrush); - else - painter->fillRect(option->rect, editBrush); - - if (cmb->subControls & SC_ComboBoxArrow) { - State flags = State_None; - - QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); - if (cmb->activeSubControls == SC_ComboBoxArrow) { - painter->setPen(cmb->palette.dark().color()); - painter->setBrush(cmb->palette.brush(QPalette::Button)); - painter->drawRect(ar.adjusted(0, 0, -1, -1)); - QWindowsCEStylePrivate::drawWinCEButton(painter, ar.adjusted(0, 0, -1, -1), option->palette, true, - &cmb->palette.brush(QPalette::Button)); - } else { - // Make qDrawWinButton use the right colors for drawing the shade of the button - - QWindowsCEStylePrivate::drawWinCEButton(painter, ar, option->palette, false, - &cmb->palette.brush(QPalette::Button)); - } - - ar.adjust(2, 2, -2, -2); - if (option->state & State_Enabled) - flags |= State_Enabled; - - if (cmb->activeSubControls == SC_ComboBoxArrow) - flags |= State_Sunken; - QStyleOption arrowOpt(0); - arrowOpt.rect = ar; - arrowOpt.palette = cmb->palette; - arrowOpt.state = flags; - drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); - } - if (cmb->subControls & SC_ComboBoxEditField) { - QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); - if (cmb->state & State_HasFocus && !cmb->editable) - painter->fillRect(re.x(), re.y(), re.width(), re.height(), - cmb->palette.brush(QPalette::Highlight)); - if (cmb->state & State_HasFocus) { - painter->setPen(cmb->palette.highlightedText().color()); - painter->setBackground(cmb->palette.highlight()); - } else { - painter->setPen(cmb->palette.text().color()); - painter->setBackground(cmb->palette.background()); - } - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget); - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } - } - break; -#endif // QT_NO_COMBOBOX -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QStyleOptionSpinBox copy = *sb; - PrimitiveElement pe; - - if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { - QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); - QWindowsCEStylePrivate::drawWinCEPanel(painter, r, option->palette, true); - } - QPalette shadePal(option->palette); - shadePal.setColor(QPalette::Button, option->palette.light().color()); - shadePal.setColor(QPalette::Light, option->palette.button().color()); - - bool reverse = QApplication::layoutDirection() == Qt::RightToLeft; - - if (sb->subControls & SC_SpinBoxUp) { - copy.subControls = SC_SpinBoxUp; - QPalette pal2 = sb->palette; - if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - if (reverse) - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); - else - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); - QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, option->palette, copy.state & (State_Sunken | State_On), - ©.palette.brush(QPalette::Button)); - copy.rect.adjust(3, 0, -4, 0); - drawPrimitive(pe, ©, painter, widget); - } - if (sb->subControls & SC_SpinBoxDown) { - copy.subControls = SC_SpinBoxDown; - copy.state = sb->state; - QPalette pal2 = sb->palette; - if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - - if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - if (reverse) - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); - else - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); - QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, shadePal, copy.state & (State_Sunken | State_On), - ©.palette.brush(QPalette::Button)); - - copy.rect.adjust(3, 0, -4, 0); - if (pe == PE_IndicatorArrowUp || pe == PE_IndicatorArrowDown) { - copy.rect = copy.rect.adjusted(1, 1, -1, -1); - drawPrimitive(pe, ©, painter, widget); - } - else { - drawPrimitive(pe, ©, painter, widget); - } - if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { - QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget); - painter->save(); - painter->setPen(option->palette.light().color()); - painter->drawLine(r.x() + 1 + r.width(), r.y() - 2, r.x() + 1 + r.width(), r.y() + r.height() + 1); - painter->setPen(option->palette.midlight().color()); - painter->drawLine(r.x() + r.width(), r.y() - 1, r.x() + r.width(), r.y() + r.height()); - painter->restore(); - } - } - } - break; -#endif // QT_NO_SPINBOX - - default: - QWindowsStyle::drawComplexControl(control, option, painter, widget); - break; - } -} - -void QWindowsCEStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, - bool enabled, const QString& text, QPalette::ColorRole textRole) const { - if (text.isEmpty()) - return; - QPen savedPen; - if (textRole != QPalette::NoRole) { - savedPen = painter->pen(); - painter->setPen(pal.color(textRole)); - } - if (!enabled) { - QPen pen = painter->pen(); - painter->setPen(pal.light().color()); - //painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text); - painter->setPen(pen); - } - painter->drawText(rect, alignment, text); - if (textRole != QPalette::NoRole) - painter->setPen(savedPen); -} - - -QSize QWindowsCEStyle::sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const { - QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); - switch (type) { - case CT_PushButton: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); - int w = newSize.width(), - h = newSize.height(); - int defwidth = 0; - if (btn->features & QStyleOptionButton::AutoDefaultButton) - defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget); - if (w < 75 + defwidth && btn->icon.isNull()) - w = 75 + defwidth; - if (h < 23 + defwidth) - h = 23 + defwidth; - newSize = QSize(w+14, h); - } - break; - - case CT_RadioButton: - case CT_CheckBox: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - bool isRadio = (type == CT_RadioButton); - QRect irect = visualRect(btn->direction, btn->rect, - subElementRect(isRadio ? SE_RadioButtonIndicator - : SE_CheckBoxIndicator, btn, widget)); - int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight - : PM_IndicatorHeight, btn, widget); - int margins = (!btn->icon.isNull() && btn->text.isEmpty()) ? 0 : 10; - newSize += QSize(irect.right() + margins, 4); - newSize.setHeight(qMax(newSize.height(), h)); - } - break; - case CT_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw -1, qMax(24, newSize.height() + fw-1)); - } - break; -#ifndef QT_NO_SPINBOX - case CT_SpinBox: - if (const QStyleOptionSpinBox *spnb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - int fw = spnb->frame ? pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw - 5, newSize.height() + fw - 6); - } - break; -#endif - case CT_LineEdit: - newSize += QSize(0,1); - break; - case CT_MenuBarItem: - newSize += QSize(5, 1); - break; - case CT_MenuItem: - newSize += QSize(0, -2); - break; - case CT_MenuBar: - newSize += QSize(0, -1); - break; - case CT_ToolButton: - if (const QStyleOptionToolButton *b = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - if (b->toolButtonStyle != Qt::ToolButtonIconOnly) - newSize = QSize(newSize.width() + 1, newSize.height() - 1); - else - newSize = QSize(newSize.width() + 1, newSize.height()); - } - break; - - default: - break; - } - return newSize; -} - -QRect QWindowsCEStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { - QRect rect = QWindowsStyle::subElementRect(element, option, widget); - switch (element) { -#ifndef QT_NO_COMBOBOX - case SE_ComboBoxFocusRect: - if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int margin = cb->frame ? 3 : 0; - rect.setRect(margin, margin, option->rect.width() - 2*margin - 20, option->rect.height() - 2*margin); - rect = visualRect(option->direction, option->rect, rect); - } - break; -#endif // QT_NO_COMBOBOX - default: - break; - } - return rect; -} - -QRect QWindowsCEStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, - SubControl subControl, const QWidget *widget) const { - QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget); - switch (control) { -#ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget); - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - - switch (subControl) { - case SC_SliderHandle: { - int sliderPos = 0; - int len = pixelMetric(PM_SliderLength, slider, widget); - bool horizontal = slider->orientation == Qt::Horizontal; - sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, - slider->sliderPosition, - (horizontal ? slider->rect.width() - : slider->rect.height()) - len, - slider->upsideDown); - if (horizontal) - rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); - else - rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); - break; } - default: - break; - } - rect = visualRect(slider->direction, slider->rect, rect); - } - break; -#endif //QT_NO_SLIDER -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int x = cb->rect.x(), - y = cb->rect.y(), - wi = cb->rect.width(), - he = cb->rect.height(); - int xpos = x; - int margin = cb->frame ? 3 : 0; - int bmarg = cb->frame ? 2 : 0; - xpos += wi - (he - 2*bmarg) - bmarg; - switch (subControl) { - case SC_ComboBoxArrow: - rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg); - break; - case SC_ComboBoxEditField: - rect.setRect(x + margin, y + margin, wi - 2 * margin - (he - 2*bmarg), he - 2 * margin); - break; - case SC_ComboBoxListBoxPopup: - rect = cb->rect; - break; - case SC_ComboBoxFrame: - rect = cb->rect; - break; - default: - break; - } - rect = visualRect(cb->direction, cb->rect, rect); - } -#endif //QT_NO_COMBOBOX -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QSize bs; - int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; - bs.setWidth(qMax(18, (spinbox->rect.height() / 2 - fw + 1))); - // 1.6 -approximate golden mean - bs.setHeight(qMax(18, qMin((bs.height() * 8 / 5), (spinbox->rect.width() / 4)))); - bs = bs.expandedTo(QApplication::globalStrut()); - int y = fw; - int x, lx, rx; - x = spinbox->rect.width() - y - bs.width() * 2; - lx = fw; - rx = x - fw; - switch (subControl) { - case SC_SpinBoxUp: - rect = QRect(x + bs.width(), y, bs.width(), bs.height()); - break; - case SC_SpinBoxDown: - rect = QRect(x, y , bs.width(), bs.height()); - break; - case SC_SpinBoxEditField: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) { - rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw); - } else { - rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw); - } - break; - case SC_SpinBoxFrame: - rect = spinbox->rect; - default: - break; - } - rect = visualRect(spinbox->direction, spinbox->rect, rect); - } - break; -#endif // Qt_NO_SPINBOX -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: { - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - switch (subControl) { - case SC_GroupBoxFrame: - // FALL THROUGH - case SC_GroupBoxContents: { - int topMargin = 0; - int topHeight = 0; - int bottomMargin = 0; - int noLabelMargin = 0; - QRect frameRect = groupBox->rect; - int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); - if (groupBox->text.size()) { - topHeight = groupBox->fontMetrics.height(); - if (verticalAlignment & Qt::AlignVCenter) - topMargin = topHeight / 2; - else if (verticalAlignment & Qt::AlignTop) - topMargin = -topHeight/2; - } - else { - topHeight = groupBox->fontMetrics.height(); - noLabelMargin = topHeight / 2; - if (verticalAlignment & Qt::AlignVCenter) { - topMargin = topHeight / 4 - 4; - bottomMargin = topHeight / 4 - 4; - } - else if (verticalAlignment & Qt::AlignTop) { - topMargin = topHeight/2 - 4; - bottomMargin = topHeight/2 - 4; - } - } - - if (subControl == SC_GroupBoxFrame) { - frameRect.setTop(topMargin); - frameRect.setBottom(frameRect.height() + bottomMargin); - rect = frameRect; - break; - } - - int frameWidth = 0; - if ((groupBox->features & QStyleOptionFrame::Flat) == 0) - frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget); - rect = frameRect.adjusted(frameWidth, frameWidth + topHeight, -frameWidth, -frameWidth - noLabelMargin); - break; - } - case SC_GroupBoxCheckBox: - // FALL THROUGH - case SC_GroupBoxLabel: { - QFontMetrics fontMetrics = groupBox->fontMetrics; - int h = fontMetrics.height(); - int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); - const int marg = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 8; - rect = groupBox->rect.adjusted(marg, 0, -marg, 0); - rect.setHeight(h); - - int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1; - bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; - int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; - - // Adjusted rect for label + indicatorWidth + indicatorSpace - QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, - QSize(tw + checkBoxSize, h), rect); - - // Adjust totalRect if checkbox is set - if (hasCheckBox) { - bool ltr = groupBox->direction == Qt::LeftToRight; - int left = 0; - // Adjust for check box - if (subControl == SC_GroupBoxCheckBox) { - int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget); - left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); - int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; - totalRect.setRect(left, top, indicatorWidth, indicatorHeight); - // Adjust for label - } else { - left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); - totalRect.setRect(left, totalRect.top(), - totalRect.width() - checkBoxSize, totalRect.height()); - } - } - rect = totalRect; - break; - } - default: - break; - } - } - break; - } -#endif // QT_NO_GROUPBOX - default: - break; - } - return rect; -} - -QStyle::SubControl QWindowsCEStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, - const QPoint &pos, const QWidget *widget) const { - /*switch (control) { - default: - break; - }*/ - return QWindowsStyle::hitTestComplexControl(control, option, pos, widget); -} - - -QPalette QWindowsCEStyle::standardPalette() const { - QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ), - QColor(132, 130, 132), QColor(198, 195, 198) , Qt::black, Qt::white, Qt::white, QColor(198, 195, 198)); - palette.setColor(QPalette::Window, QColor(198, 195, 198)); - palette.setColor(QPalette::Base, Qt::white); - palette.setColor(QPalette::Button, QColor(198, 195, 198)); - palette.setColor(QPalette::Highlight, QColor(0, 0, 132)); - palette.setColor(QPalette::Light, Qt::white); - palette.setColor(QPalette::Midlight, QColor(222, 223, 222 )); - palette.setColor(QPalette::Dark, QColor(132, 130, 132)); - palette.setColor(QPalette::Mid, QColor(132, 130, 132)); - palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); - palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow) - palette.setColor(QPalette::Link, QColor(24,81,132)); // color for the box around the ItemView indicator - - return palette; -} - -void QWindowsCEStyle::polish(QApplication *app) { - QWindowsStyle::polish(app); -} - -void QWindowsCEStyle::polish(QWidget *widget) { - QWindowsStyle::polish(widget); -} - -void QWindowsCEStyle::polish(QPalette &palette) { - QWindowsStyle::polish(palette); -} - -int QWindowsCEStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const { - int ret; - - switch (pm) { - case PM_DefaultFrameWidth: - ret = 1; - break; - - case PM_MenuBarHMargin: - ret = 2; - break; - case PM_MenuBarVMargin: - ret = 2; - break; - /*case PM_MenuBarItemSpacing: - ret = 2; - break;*/ - - case PM_MenuButtonIndicator: - ret = 10; - break; - - case PM_SpinBoxFrameWidth: - ret = 2; - break; - case PM_ButtonDefaultIndicator: - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - ret = 1; - break; -#ifndef QT_NO_TABBAR - case PM_TabBarTabShiftHorizontal: - ret = 0; - break; - case PM_TabBarTabShiftVertical: - ret = 6; - break; -#endif - case PM_MaximumDragDistance: - ret = 60; - break; - - case PM_IndicatorWidth: - ret = windowsCEIndicatorSize; - break; - - case PM_IndicatorHeight: - ret = windowsCEIndicatorSize; - break; - - case PM_ExclusiveIndicatorWidth: - ret = windowsCEExclusiveIndicatorSize; - break; - - case PM_ExclusiveIndicatorHeight: - ret = windowsCEExclusiveIndicatorSize;; - break; - -#ifndef QT_NO_SLIDER - case PM_SliderLength: - ret = 12; - break; - case PM_SliderThickness: - ret = windowsCESliderThickness; - break; - - case PM_TabBarScrollButtonWidth: - ret = 18; - break; - - // Returns the number of pixels to use for the business part of the - // slider (i.e., the non-tickmark portion). The remaining space is shared - // equally between the tickmark regions. - case PM_SliderControlThickness: - if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); - int ticks = sl->tickPosition; - int n = 0; - if (ticks & QSlider::TicksAbove) - ++n; - if (ticks & QSlider::TicksBelow) - ++n; - if (!n) { - ret = space; - break; - } - int thick = 12; - if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) - thick += pixelMetric(PM_SliderLength, sl, widget) / 4; - - space -= thick; - if (space > 0) - thick += (space * 2) / (n + 2); - ret = thick; - } else { - ret = 0; - } - break; -#endif // QT_NO_SLIDER - -#ifndef QT_NO_MENU - - case PM_SmallIconSize: - ret = windowsCEIconSize; - break; - case PM_ButtonMargin: - ret = 6; - break; - - case PM_LargeIconSize: - ret = 32; - break; - - case PM_IconViewIconSize: - ret = pixelMetric(PM_LargeIconSize, opt, widget); - break; - - case PM_ToolBarIconSize: - ret = windowsCEIconSize; - break; - case PM_DockWidgetTitleMargin: - ret = 2; - break; -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) -// case PM_DockWidgetFrameWidth: -// ret = GetSystemMetrics(SM_CXFRAME); -// break; -#else - case PM_DockWidgetFrameWidth: - ret = 4; - break; -#endif // Q_DEAD_CODE_FROM_QT4_WIN - break; - -#endif // QT_NO_MENU - - case PM_TitleBarHeight: - ret = 30; - break; - case PM_ScrollBarExtent: - ret = 19; - break; - case PM_SplitterWidth: - ret = qMax(4, QApplication::globalStrut().width()); - break; - -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) - case PM_MDIFrameWidth: - ret = 3; - break; -#endif - case PM_ToolBarItemMargin: - ret = 1; - break; - case PM_ToolBarItemSpacing: - ret = 0; - break; - case PM_ToolBarHandleExtent: - ret = 10; - break; - case PM_ButtonIconSize: - ret = 22; - break; - default: - ret = QWindowsStyle::pixelMetric(pm, opt, widget); - break; - } - return ret; -} - -QPixmap QWindowsCEStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, - const QWidget *widget) const { -#ifndef QT_NO_IMAGEFORMAT_XPM - /*switch (standardPixmap) { - - default: - break; - }*/ -#endif //QT_NO_IMAGEFORMAT_XPM - return QWindowsStyle::standardPixmap(standardPixmap, opt, widget); -} - -int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, - QStyleHintReturn *returnData) const { - int ret; - switch (hint) { - case SH_TabBar_ElideMode: - ret = Qt::ElideMiddle; - break; - case SH_EtchDisabledText: - ret = false; - break; - case SH_RequestSoftwareInputPanel: - ret = RSIP_OnMouseClick; - break; - default: - ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); - break; - } - return ret; -} - -void QWindowsCEStylePrivate::drawWinShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill) { - if (w < 2 || h < 2) // can't do anything with that - return; - QPen oldPen = p->pen(); - QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) }; - p->setPen(c1); - p->drawPolyline(a, 3); - QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; - p->setPen(c2); - p->drawPolyline(b, 3); - if (w > 4 && h > 4) { - QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c3); - p->drawPolyline(c, 3); - QPoint d[3] = { QPoint(x+1, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y+1) }; - p->setPen(c4); - p->drawPolyline(d, 3); - if (fill) - p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill); - } - p->setPen(oldPen); -} - -void QWindowsCEStylePrivate::drawWinCEShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill) { - if (w < 2 || h < 2) // can't do anything with that - return; - QPen oldPen = p->pen(); - QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; - p->setPen(c2); - p->drawPolyline(b, 3); - if (w > 4 && h > 4) { - QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c3); - p->drawPolyline(c, 3); - QPoint d[5] = { QPoint(x, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y), QPoint(x, y), QPoint(x, y+h-2) }; - p->setPen(c4); - p->drawPolyline(d, 5); - if (fill) - p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill); - } - QPoint a[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c1); - p->drawPolyline(a, 3); - p->setPen(oldPen); -} - -void QWindowsCEStylePrivate::drawWinCEShadesSunken(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill) { - if (w < 2 || h < 2) // can't do anything with that - return; - QPen oldPen = p->pen(); - - QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; - p->setPen(c2); - p->drawPolyline(b, 3); - if (w > 4 && h > 4) { - QPoint d[3] = { QPoint(x, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y) }; - p->setPen(c4); - p->drawPolyline(d, 3); - QPoint c[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) }; - p->setPen(c3); - p->drawPolyline(c, 3); - if (fill) - p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill); - } - QPoint a[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c1); - p->drawPolyline(a, 3); - p->setPen(oldPen); -} - - -void QWindowsCEStylePrivate::drawWinCEButton(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken, - const QBrush *fill) { - if (sunken) - drawWinCEShadesSunken(p, x, y, w, h, - pal.shadow().color(), pal.light().color(), pal.shadow().color(), - pal.midlight().color(), fill); - else - drawWinCEShades(p, x, y, w, h, - pal.midlight().color(), pal.shadow().color(), pal.button().color(), - pal.dark().color(), fill); -} - -void QWindowsCEStylePrivate::drawWinCEPanel(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken, - const QBrush *fill) { - if (sunken) - drawWinShades(p, x, y, w, h, - pal.dark().color(), pal.light().color(), pal.shadow().color(), - pal.midlight().color(), fill); - else - drawWinShades(p, x, y, w, h, - pal.light().color(), pal.shadow().color(), pal.button().color(), - pal.midlight().color(), fill); -} - -void QWindowsCEStylePrivate::drawWinCEButton(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken, const QBrush *fill) { - drawWinCEButton(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill); -} - -void QWindowsCEStylePrivate::drawWinCEPanel(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken, const QBrush *fill) { - drawWinCEPanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill); -} - -QT_END_NAMESPACE - -#endif // QT_NO_STYLE_WINDOWSCE diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h deleted file mode 100644 index 1530fdcf0f..0000000000 --- a/src/widgets/styles/qwindowscestyle_p.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSCESTYLE_P_H -#define QWINDOWSCESTYLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qwindowsstyle_p.h> - -QT_BEGIN_NAMESPACE - - -#if !defined(QT_NO_STYLE_WINDOWSCE) - -class QWindowsCEStyle : public QWindowsStyle -{ - Q_OBJECT -public: - QWindowsCEStyle(); - ~QWindowsCEStyle(); - - void drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget = 0) const; - - void drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const; - - void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const; - - virtual void drawItemText(QPainter *painter, const QRect &rect, - int flags, const QPalette &pal, bool enabled, - const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; - - QSize sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const; - - QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; - QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, - SubControl sc, const QWidget *widget) const; - - SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, - const QPoint &pos, const QWidget *widget = 0) const; - - QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, - const QWidget *widget = 0) const; - int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; - - int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, - QStyleHintReturn *returnData = 0) const; - - void polish(QWidget *widget); - void polish(QPalette &palette); - void polish(QApplication *app); - QPalette standardPalette() const; -}; - -#endif // QT_NO_STYLE_WINDOWSCE - -QT_END_NAMESPACE - -#endif // QWINDOWSCESTYLE_P_H diff --git a/src/widgets/styles/qwindowscestyle_p_p.h b/src/widgets/styles/qwindowscestyle_p_p.h deleted file mode 100644 index 2920413287..0000000000 --- a/src/widgets/styles/qwindowscestyle_p_p.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSCESTYLE_P_P_H -#define QWINDOWSCESTYLE_P_P_H - -#include "qwindowscestyle_p.h" -#include <private/qwindowsstyle_p_p.h> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -class QPainter; -class QPalette; -class QPoint; -class QColor; -class QBrush; -class QRect; - -// Private class -class QWindowsCEStylePrivate : public QWindowsStylePrivate -{ - Q_DECLARE_PUBLIC(QWindowsCEStyle) -public: - inline QWindowsCEStylePrivate() - { } - - -static void drawWinCEButton(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinCEButton(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinCEPanel(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinCEPanel(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill); - -static void drawWinCEShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill); - -static void drawWinCEShadesSunken(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill); - - - - -}; - -QT_END_NAMESPACE - -#endif //QWINDOWSCESTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp deleted file mode 100644 index 45323d1d15..0000000000 --- a/src/widgets/styles/qwindowsmobilestyle.cpp +++ /dev/null @@ -1,7277 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsmobilestyle_p.h" -#include "qwindowsmobilestyle_p_p.h" - -#if !defined(QT_NO_STYLE_WINDOWSMOBILE) || defined(QT_PLUGIN) - -#include "qpainterpath.h" -#include "qapplication.h" -#include "qdesktopwidget.h" -#include "qwidget.h" -#include "qdockwidget.h" -#include "qframe.h" -#include "qmenu.h" -#include "qpaintengine.h" -#include "qpainter.h" -#include "qgroupbox.h" -#include "qstyleoption.h" -#include "qlistview.h" -#include "qdrawutil.h" -#include "qtoolbar.h" -#include "qabstractscrollarea.h" -#include "qabstractbutton.h" -#include "qcombobox.h" -#include "qscrollbar.h" -#include "qabstractitemview.h" -#include "qmenubar.h" -#include "qtoolbutton.h" -#include "qtextedit.h" -#include "qdialog.h" -#include "qdebug.h" -#include "qtabwidget.h" - -#ifdef Q_OS_WINCE -#include "qt_windows.h" -extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp -#endif // Q_OS_WINCE - -#include "qstylehelper_p.h" - -QT_BEGIN_NAMESPACE - -static const int windowsItemFrame = 1; // menu item frame width - -static const int windowsMobileitemViewCheckBoxSize = 13; -static const int windowsMobileFrameGroupBoxOffset = 9; -static const int windowsMobileIndicatorSize = 14; -static const int windowsMobileExclusiveIndicatorSize = 14; -static const int windowsMobileSliderThickness = 6; -static const int windowsMobileIconSize = 16; -static const int PE_IndicatorArrowUpBig = 0xf000101; -static const int PE_IndicatorArrowDownBig = 0xf000102; -static const int PE_IndicatorArrowLeftBig = 0xf000103; -static const int PE_IndicatorArrowRightBig = 0xf000104; - -/* XPM */ -static const char *const radiobutton_xpm[] = { - "30 30 2 1", - " c None", - ". c #000000", - " ........ ", - " .............. ", - " .... .... ", - " .... .... ", - " ... ... ", - " ... ... ", - " .. .. ", - " .. .. ", - " ... ... ", - " .. .. ", - " .. .. ", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - " .. .. ", - " .. .. ", - " ... ... ", - " .. .. ", - " .. .. ", - " ... ... ", - " ... ... ", - " .... .... ", - " .... .... ", - " .............. ", - " ........ "}; - -/* XPM */ -static const char * const radiobutton_low_xpm[] = { - "15 15 2 1", - " c None", - ". c #000000", - " ..... ", - " .. .. ", - " . . ", - " . . ", - " . . ", - ". .", - ". .", - ". .", - ". .", - ". .", - " . . ", - " . . ", - " . . ", - " .. .. ", - " ..... "}; - -/* XPM */ - static const char * const arrowleft_big_xpm[] = { - "9 17 2 1", - " c None", - ". c #000000", - " .", - " ..", - " ...", - " ....", - " .....", - " ......", - " .......", - " ........", - ".........", - " ........", - " .......", - " ......", - " .....", - " ....", - " ...", - " ..", - " ."}; - -/* XPM */ - static const char * const arrowleft_xpm[] = { - "8 15 2 1", - " c None", - ". c #000000", - " .", - " ..", - " ...", - " ....", - " .....", - " ......", - " .......", - "........", - " .......", - " ......", - " .....", - " ....", - " ...", - " ..", - " ."}; - - - -/* XPM */ -static const char *const horlines_xpm[] = { - "2 2 2 1", - " c None", - ". c #000000", - " ", - ".."}; - -/* XPM */ -static const char *const vertlines_xpm[] = { - "2 2 2 1", - " c None", - ". c #000000", - ". ", - ". "}; - -/* XPM */ -static const char *const radiochecked_xpm[] = { - "18 18 2 1", - " c None", - ". c #000000", - " ...... ", - " .......... ", - " .............. ", - " .............. ", - " ................ ", - " ................ ", - "..................", - "..................", - "..................", - "..................", - "..................", - "..................", - " ................ ", - " ................ ", - " .............. ", - " .............. ", - " .......... ", - " ...... "}; - -/* XPM */ -static const char * const radiochecked_low_xpm[] = { - "9 9 2 1", - " c None", - ". c #000000", - " ... ", - " ....... ", - " ....... ", - ".........", - ".........", - ".........", - " ....... ", - " ....... ", - " ... "}; - -static const char *const arrowdown_xpm[] = { - "15 8 2 1", - " c None", - ". c #000000", - "...............", - " ............. ", - " ........... ", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . "}; - - -static const char *const arrowdown_big_xpm[] = { - "17 9 2 1", - " c None", - ". c #000000", - ".................", - " ............... ", - " ............. ", - " ........... ", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . "}; - - -/* XPM */ -static const char *const checkedlight_xpm[] = { - "24 24 2 1", - " c None", - ". c #000000", - " ", - " ", - " ", - " ", - " ", - " . ", - " .. ", - " ... ", - " .... ", - " ..... ", - " ...... ", - " . ...... ", - " .. ...... ", - " ... ...... ", - " .... ...... ", - " .......... ", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . ", - " ", - " ", - " "}; - - -/* XPM */ -static const char *const checkedbold_xpm[] = { - "26 26 2 1", - " c None", - ". c #000000", - " ", - " ", - " ", - " ", - " ", - " ", - " .. ", - " ... ", - " .... ", - " ..... ", - " .. ...... ", - " ... ....... ", - " .... ....... ", - " ..... ....... ", - " ...... ....... ", - " .............. ", - " ............ ", - " .......... ", - " ........ ", - " ...... ", - " .... ", - " .. ", - " ", - " ", - " ", - " "}; - -/* XPM */ -static const char * const checkedbold_low_xpm[] = { - "9 8 2 1", - " c None", - ". c #000000", - " .", - " ..", - ". ...", - ".. ... ", - "... ... ", - " ..... ", - " ... ", - " . "}; - -/* XPM */ -static const char * const checkedlight_low_xpm[] = { - "8 8 2 1", - " c None", - ". c #000000", - " .", - " ..", - " ...", - ". ... ", - ".. ... ", - "..... ", - " ... ", - " . "}; - -/* XPM */ -static const char * const highlightedradiobutton_xpm[] = { - "30 30 3 1", - " c None", - ". c #000000", - "+ c #0078CC", - " ........ ", - " .............. ", - " ....++++++++.... ", - " ....++++++++++++.... ", - " ...++++ ++++... ", - " ...+++ +++... ", - " ..++ ++.. ", - " ..++ ++.. ", - " ...++ ++... ", - " ..++ ++.. ", - " ..++ ++.. ", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - " ..++ ++.. ", - " ..++ ++.. ", - " ...++ ++... ", - " ..++ ++.. ", - " ..++ ++.. ", - " ...+++ +++... ", - " ...++++ ++++... ", - " ....++++++++++++.... ", - " ....++++++++.... ", - " .............. ", - " ........ "}; - -/* XPM */ -static const char * const highlightedradiobutton_low_xpm[] = { - "15 15 3 1", - " c None", - ". c #000000", - "+ c #3192D6", - " ..... ", - " ..+++++.. ", - " .++ ++. ", - " .+ +. ", - " .+ +. ", - ".+ +.", - ".+ +.", - ".+ +.", - ".+ +.", - ".+ +.", - " .+ +. ", - " .+ +. ", - " .++ ++. ", - " ..+++++.. ", - " ..... "}; - -/* XPM */ -static const char * const cross_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@..........@@@..++ ", -" ++..@@@@........@@@@..++ ", -" ++..@@@@@......@@@@@..++ ", -" ++...@@@@@....@@@@@...++ ", -" ++....@@@@@..@@@@@....++ ", -" ++.....@@@@@@@@@@.....++ ", -" ++......@@@@@@@@......++ ", -" ++.......@@@@@@.......++ ", -" ++.......@@@@@@.......++ ", -" ++......@@@@@@@@......++ ", -" ++.....@@@@@@@@@@.....++ ", -" ++....@@@@@..@@@@@....++ ", -" ++...@@@@@....@@@@@...++ ", -" ++..@@@@@......@@@@@..++ ", -" ++..@@@@........@@@@..++ ", -" ++..@@@..........@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const cross_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +.@@....@@.+ ", -" +.@@@..@@@.+ ", -" +..@@@@@@..+ ", -" +...@@@@...+ ", -" +...@@@@...+ ", -" +..@@@@@@..+ ", -" +.@@@..@@@.+ ", -" +.@@....@@.+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - -/* XPM */ -static const char * const max_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const max_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +..........+ ", -" +.@@@@@@@@.+ ", -" +.@@@@@@@@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@@@@@@@@.+ ", -" +..........+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - -/* XPM */ -static const char * const normal_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const normal_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +.@@@@@@@@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@@@@@@@@.+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - - -/* XPM */ -static const char * const min_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const min_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +.@@@@@@@@.+ ", -" +..........+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - -#ifdef Q_OS_WINCE_WM - -static char * sbhandleup_xpm[] = { -"26 41 45 1", -" c None", -". c #000000", -"+ c #E7E7E7", -"@ c #D6D7D6", -"# c #949294", -"$ c #737573", -"% c #636563", -"& c #636163", -"* c #5A5D5A", -"= c #5A595A", -"- c #525552", -"; c #525152", -"> c #4A4D4A", -", c #7B797B", -"' c #CECFCE", -") c #CED3CE", -"! c #6B6D6B", -"~ c #6B696B", -"{ c #737173", -"] c #7B7D7B", -"^ c #848684", -"/ c #848284", -"( c #8C8A8C", -"_ c #8C8E8C", -": c #B5B2B5", -"< c #FFFFFF", -"[ c #949694", -"} c #B5B6B5", -"| c #9C9A9C", -"1 c #ADAEAD", -"2 c #9C9E9C", -"3 c #BDBABD", -"4 c #BDBEBD", -"5 c #F7F3F7", -"6 c #C6C3C6", -"7 c #C6C7C6", -"8 c #A5A2A5", -"9 c #CECBCE", -"0 c #FFFBFF", -"a c #ADAAAD", -"b c #A5A6A5", -"c c #D6D3D6", -"d c #B5BAB5", -"e c #DEDFDE", -"f c #DEDBDE", -"..........................", -"+@#$%%&&&**===---;;;;>=,'+", -"+@#$%%&&&**===---;;;;>=$'+", -")$!!~~%%&&&**===---;;;;>;'", -"#{$]],,$${{{!!~~%%%&&&*-;]", -"#{$]],,$${{{!!~~%%%&&&*-;]", -",$^//]],,$${{{!!~~%%%&&*;*", -",,(^^//]],$${!!!!!~~%%%&-*", -",,(^^//]],$${!!!!!~~%%%&-*", -"]]_((^^//]$!%%~!{{!!~~%%-*", -"//#__((^^]{:<<:~!{{{!!~~=*", -"//#__((^^]{:<<:~!{{{!!~~=&", -"//###__(/$:<<<<:~{${{!!~*&", -"^^[[##_^]:<<<<<<}!{$${{!*%", -"^^[[##_^]:<<<<<<}!{$${{!*%", -"((|[[#_/:<<<<<<<<}!$$${{&~", -"((||[#^1<<<<1:<<<<}!$$$$&~", -"((||[#^1<<<<1:<<<<}!$$$$&~", -"__2|#(1<<<<}],}<<<<}{$,$%~", -"##2|_1<<<<}^((]3<<<<}{$,~!", -"##2|_1<<<<}^((]3<<<<}{$,~!", -"##2#1<<<<3^###(/4<<<<}{,~{", -"##2#1<<<<3^###(/4<<<<}{,~!", -"[[2_5<<<4(#|[[#_/6<<<<,,!{", -"[|2_5<<4_[||||[[_/7<<<,]{$", -"[|2_5<<4_[||||[[_/7<<<,]{$", -"||8_5<6#|2222|||[_/9<<,]{$", -"228#06[28888222||[_/'<,/$,", -"228#06[28888222||[_/'<,/$,", -"22a|6[8bbbb88822||[(/c](,]", -"881b8baaabbbb88222|[(^(_,]", -"881b8baaabbbb88222|[(^(_,]", -"88111111aaabbb88822|[###]/", -"bb:::11111aaabbb8822||[[/^", -"bb:::11111aaabbb8822||[[//", -"bb:::::1111aaabbb8822||[/(", -"3a1::::::1111aaabb8822|_^8", -"da1::::::1111aaabb8822|_^8", -"e1aaabbbb888822||[[##__((@", -"+e4:aaabbbb88822||[[[#[b@+", -"+e4:aaabbbb88822||[[[#[bf+"}; - -static char * sbhandledown_xpm[] = { -"26 40 46 1", -" c None", -". c #E7E7E7", -"+ c #DEDFDE", -"@ c #BDBEBD", -"# c #B5B2B5", -"$ c #ADAAAD", -"% c #A5A6A5", -"& c #A5A2A5", -"* c #9C9E9C", -"= c #9C9A9C", -"- c #949694", -"; c #949294", -"> c #D6D7D6", -", c #DEDBDE", -"' c #D6DBD6", -") c #ADAEAD", -"! c #8C8E8C", -"~ c #8C8A8C", -"{ c #BDBABD", -"] c #848684", -"^ c #B5BAB5", -"/ c #848284", -"( c #848A84", -"_ c #7B7D7B", -": c #7B797B", -"< c #C6C3C6", -"[ c #D6D3D6", -"} c #FFFBFF", -"| c #CECFCE", -"1 c #FFFFFF", -"2 c #737573", -"3 c #F7F3F7", -"4 c #CECBCE", -"5 c #737173", -"6 c #C6C7C6", -"7 c #6B6D6B", -"8 c #B5B6B5", -"9 c #6B696B", -"0 c #636563", -"a c #636163", -"b c #5A5D5A", -"c c #5A595A", -"d c #525552", -"e c #525152", -"f c #4A4D4A", -"g c #C6CBC6", -".+@#$$$%%%%&&&**==---;-%>.", -".+@#$$$%%%%&&&**==---;-%,.", -"')$$$%%%%&&&&**==--;;!!~~>", -"{$)######))))$$$%%&&**=!]&", -"^$)######))))$$$%%&&**=!]&", -"%%#####))))$$$%%%&&**==-/(", -"%%###)))))$$$%%%&&**==--/]", -"%%###)))))$$$%%%&&**==--//", -"&&))))))$$$%%%&&&**=-;;;_/", -"&&)%&%$$$%%%%&&***=-~]~!:_", -"&&)%&%$$$%%%%&&***=-~]~!:_", -"**$=<-&%%%%&&&**==-~/[_~:_", -"**&;}<-*&&&&***==-!/|1:/2:", -"**&;}<-*&&&&***==-!/|1:/2:", -"==&!31<;=****===-!/411:_5:", -"-=*!311@!-====--!/6111:_52", -"-=*!311@!-====--!/6111:_52", -"--*!3111@~;=--;!/<1111::75", -";;*;)1111{];;;~/@111185:95", -";;*;)1111{];;;~/@111185:97", -";;*=!)11118]~~_{1111852:97", -";;*=!)11118]~~_{1111852:97", -"!!*=;~)11118_:81111852:207", -"~~==-;])1111)#1111872222a9", -"~~==-;])1111)#1111872222a9", -"~~=--;!/#111111118722255a0", -"]]--;;!]_#11111187522557b0", -"]]--;;!]_#11111187522557b0", -"//;;;!!~/2#1111#95255779ba", -"//;!!~~]]_5#11#975557799cb", -"//;!!~~]]_5#11#975557799ca", -"__!~~]]//_27009755779900db", -"::~]]//__:2257777799000adb", -"::~]]//__:2257777799000adb", -":2]//__::225557799000aabeb", -";52__::225557799000aaabde_", -";52__::225557799000aaabde_", -"[2779900aaabbcccdddeeeefeg", -".>;200aaabbcccdddeeeefc:|.", -".>;200aaabbcccdddeeeefc2|."}; - -static char * sbgripdown_xpm[] = { -"26 34 39 1", -" c None", -". c #949294", -"+ c #9C9E9C", -"@ c #9C9A9C", -"# c #949694", -"$ c #8C8E8C", -"% c #8C8A8C", -"& c #848684", -"* c #848284", -"= c #7B7D7B", -"- c #7B797B", -"; c #6B696B", -"> c #636563", -", c #737573", -"' c #636163", -") c #737173", -"! c #5A5D5A", -"~ c #6B6D6B", -"{ c #5A595A", -"] c #B5B6B5", -"^ c #BDBEBD", -"/ c #ADAEAD", -"( c #BDBABD", -"_ c #525552", -": c #313031", -"< c #525152", -"[ c #ADAAAD", -"} c #BDBAB5", -"| c #4A4D4A", -"1 c #4A494A", -"2 c #C6C3C6", -"3 c #C6CBC6", -"4 c #E7E7E7", -"5 c #DEDFDE", -"6 c #E7E3E7", -"7 c #DEE3DE", -"8 c #CECBCE", -"9 c #8C928C", -"0 c #CECFCE", -"..+++@@@###...$$%&&**==-;>", -"$.++@@@@##...$$%%&**==-->>", -"$$+@@@@###..$$%%&&*==--,>>", -"$$@@@@###..$$%%&&**==-,,>'", -"%%@@@###..$$$%&&**==--,,''", -"%%@@###..$$$%&&**==--,,)''", -"%%@###...$$%%&&*==--,,))'!", -"&&###...$$%%&&**==--,)))!!", -"&&##...$$%%&&**==--,,))~!!", -"&&#...$$%%&&**==--,,))~~!{", -"**...$$%%&&**==--,,))~~;!{", -"**..$$%%&&**===--,)))~~;{{", -"**.$$%%&]^&===//,,))~~;;{{", -"==$$%%&&]^*==-((,))~~;;>{_", -"==$%%&&***::--,,::~~;;;>__", -"==%%&&&**=::-,,)::~~;;>>__", -"--%&&&**==--,,)))~~;;>>>__", -"--&&&**==--,,)))~~;;>>>'_<", -",-&&**==]^-,))[[~;;>>>''<<", -",,&**==-]^-)))}};;>>>'''<<", -",,**==--,,::)~~;::>>'''!<<", -"))*==--,,)::~~;;::>'''!!<|", -"))==--,,)))~~;;;>>'''!!!||", -"))=--,,)))~~;;;>>'''!!!{||", -"~~--,,)))~~;;;>>'''!!!{{||", -"~~-,,)))~~;;>>>'''!!!{{{|1", -";;,,)))~~;;>>>'''!!!{{{_1<", -"~;,)))~~;;>>>'''!!!{{{__1'", -"%>~))~~;;>>>'''!!!{{{__|1$", -"2>>~~~;;>>>''!!!{{{{__<113", -"4%'';;;>>>''!!!{{{{__<11%4", -"45-!!'>>>''!!!{{{{_<|11)64", -"447+!{{___<<<||||1111|+444", -"444489~__<<<||||111>$04444"}; - -static char * sbgripup_xpm[] = { -"26 34 38 1", -" c None", -". c #E7E7E7", -"+ c #D6DBD6", -"@ c #C6C7C6", -"# c #B5B6B5", -"$ c #ADAEAD", -"% c #ADAAAD", -"& c #A5A6A5", -"* c #A5A2A5", -"= c #BDBEBD", -"- c #DEDFDE", -"; c #C6CBC6", -"> c #9C9E9C", -", c #E7E3E7", -"' c #BDBABD", -") c #B5B2B5", -"! c #9C9A9C", -"~ c #DEE3DE", -"{ c #949694", -"] c #D6D7D6", -"^ c #949294", -"/ c #DEDBDE", -"( c #8C8E8C", -"_ c #8C8A8C", -": c #848684", -"< c #D6D3CE", -"[ c #CECBCE", -"} c #D6D3D6", -"| c #848284", -"1 c #313031", -"2 c #7B7D7B", -"3 c #CECFCE", -"4 c #CECBC6", -"5 c #7B797B", -"6 c #737573", -"7 c #737173", -"8 c #6B6D6B", -"9 c #6B696B", -"....+@#$$%%%%&&&***$=-....", -"...;$$$$$%%%&&&&**>>>>@...", -".,'$$)#'#####)))$$$%*!!$~.", -".=$)#'''####))))$$$%%*!{'.", -"]$$''''#####)))$$$%%%&*{^/", -"=$#'''#####)))$$$$%%&&&!^#", -"$$'''#####))))$$$%%%&&*>(!", -"$$''#####))))$$$%%%&&&*>(^", -"$$######))))$$$$%%&&&**>(_", -"%$#####))))$$$$%%%&&***>__", -"%$####))))$$$$%%%&&&**>>__", -"%%###)))))$$$%%%&&&**>>>_:", -"%%##))))<])$$%[[&&***>>!::", -"%%#)))))<]$$%%}<&&**>>!!:|", -"&%)))))$$$11%%&&11*>>>!!:|", -"&&))))$$$$11%&&&11*>>!!{||", -"&&)))$$$$$%%%&&&**>>!!!{|2", -"&&))$$$$$%%%&&&**>>>!!{{|2", -"*&)$$$$$3]%&&&4@*>>!!{{{22", -"**$$$$$%3]%&&&<<>>!!!{{^25", -"**$$$$%%%%11&**>11!!{{^^25", -"**$$$%%%%&11***>11!!{{^^55", -"**$$%%%%&&&***>>!!!{{^^(55", -">>$%%%%&&&***>>>!!{{^^((56", -">>%%%%&&&&***>>!!!{{^^((66", -">>%%%&&&&***>>!!!{{^^((_67", -"!>%%&&&&***>>>!!{{{^^(__67", -"!!%&&&&***>>>!!!{{^^((_:77", -"!!&&&&***>>>!!!{{^^((__:77", -"!!&&&****>>!!!{{^^^(__::78", -"{!&&****>>>!!{{{^^((_::|88", -"{{&****>>>!!!{{^^((__:||88", -"{{****>>>!!!{{^^^(__::|289", -"{{***>>>!!!{{{^^((_::||289"}; - -static char * sbgripmiddle_xpm[] = { -"26 2 12 1", -" c None", -". c #949294", -"+ c #A5A2A5", -"@ c #9C9E9C", -"# c #9C9A9C", -"$ c #949694", -"% c #8C8E8C", -"& c #8C8A8C", -"* c #848684", -"= c #848284", -"- c #7B7D7B", -"; c #6B696B", -"..++@@@###$$$..%%&&*==--;;", -"..++@@@###$$$..%%&&*==--;;"}; - - -static char * listviewhighmiddle_xpm[] = { -"8 46 197 2", -" c None", -". c #66759E", -"+ c #6C789D", -"@ c #6A789E", -"# c #6B789E", -"$ c #6A779D", -"% c #6C789C", -"& c #6F7D9B", -"* c #6F7D9A", -"= c #9DB6EE", -"- c #9DB6ED", -"; c #9CB6ED", -"> c #A1B6EF", -", c #A2B6F0", -"' c #93AAE9", -") c #95ABEA", -"! c #94ABEA", -"~ c #94A9E8", -"{ c #8BA8EA", -"] c #8BA7EA", -"^ c #8AA7EA", -"/ c #8EAAE8", -"( c #8FAAE8", -"_ c #88A2E7", -": c #8CA3E8", -"< c #8BA3E7", -"[ c #8BA3E8", -"} c #8BA2E7", -"| c #8CA2E7", -"1 c #8DA2E7", -"2 c #87A1E8", -"3 c #87A1E9", -"4 c #86A0E8", -"5 c #86A1E7", -"6 c #87A2E7", -"7 c #859EE9", -"8 c #849DE9", -"9 c #869EE9", -"0 c #869FE9", -"a c #7C9BEA", -"b c #7C9CEA", -"c c #7B9CEA", -"d c #7C9BE9", -"e c #7E9CE9", -"f c #7B9AEA", -"g c #7C99E9", -"h c #7C9AEA", -"i c #7B9AE8", -"j c #7A9AEA", -"k c #7996E1", -"l c #7C96E4", -"m c #7B96E3", -"n c #7B95E3", -"o c #7E95E5", -"p c #7E95E6", -"q c #7292E1", -"r c #7490DF", -"s c #7591E0", -"t c #7590DF", -"u c #7392E1", -"v c #6D8CDE", -"w c #6F8EDD", -"x c #6E8DDD", -"y c #6E8DDE", -"z c #6F8EDE", -"A c #6E8EDE", -"B c #718EDD", -"C c #728EDD", -"D c #6B89E0", -"E c #6C89DF", -"F c #6D89E0", -"G c #6D89DF", -"H c #6C88DF", -"I c #6D88DF", -"J c #6D86DD", -"K c #6086E0", -"L c #6686E0", -"M c #6586E0", -"N c #6486E0", -"O c #6485E0", -"P c #6786DF", -"Q c #5F85E0", -"R c #6583DE", -"S c #6683DE", -"T c #6682DD", -"U c #6086DF", -"V c #5F86E0", -"W c #567ED7", -"X c #567ED8", -"Y c #557DD7", -"Z c #5A7FD8", -"` c #6281DA", -" . c #5379D9", -".. c #5278D9", -"+. c #547BD8", -"@. c #4C73D7", -"#. c #4B72D2", -"$. c #4C73D4", -"%. c #4C73D3", -"&. c #4B72D4", -"*. c #4F75D3", -"=. c #5074D2", -"-. c #4971D0", -";. c #4871D0", -">. c #335ECF", -",. c #325ECB", -"'. c #335ECD", -"). c #335ECE", -"!. c #325DCD", -"~. c #2E59C9", -"{. c #3059C9", -"]. c #2F59C9", -"^. c #2F59C8", -"/. c #2B59CA", -"(. c #3355C6", -"_. c #3354C5", -":. c #3156C7", -"<. c #3056C7", -"[. c #3355C7", -"}. c #3355C5", -"|. c #254EBF", -"1. c #1F51C1", -"2. c #234FC0", -"3. c #234FBF", -"4. c #2350C0", -"5. c #1E50BE", -"6. c #1D50C0", -"7. c #264DBE", -"8. c #264CBD", -"9. c #254DBE", -"0. c #244EBF", -"a. c #254DBF", -"b. c #234CBF", -"c. c #244CC0", -"d. c #244BC0", -"e. c #234BC0", -"f. c #234BBF", -"g. c #234CBE", -"h. c #2049B7", -"i. c #2A49B5", -"j. c #2749B5", -"k. c #2749B6", -"l. c #2D49B4", -"m. c #2649B6", -"n. c #2946B5", -"o. c #2A48B6", -"p. c #2947B5", -"q. c #2946B6", -"r. c #2848B6", -"s. c #2549B5", -"t. c #2648B6", -"u. c #2744B5", -"v. c #2744B4", -"w. c #2744AF", -"x. c #2543B4", -"y. c #2543B2", -"z. c #2442B2", -"A. c #2442B3", -"B. c #2442B5", -"C. c #2543B3", -"D. c #1F40B1", -"E. c #1E40B1", -"F. c #243EAE", -"G. c #273BAC", -"H. c #263DAC", -"I. c #253CAB", -"J. c #273CAB", -"K. c #273CAC", -"L. c #263BAA", -"M. c #253CAE", -"N. c #263BA6", -"O. c #253BA5", -"P. c #253AA5", -"Q. c #253BA6", -"R. c #253CA7", -"S. c #263AA6", -"T. c #243CA6", -"U. c #253CA5", -"V. c #273BA8", -"W. c #2F4DA4", -"X. c #2F4DA3", -"Y. c #1B2F85", -"Z. c #B5B5B6", -"`. c #B5B5B5", -" + c #B5B6B6", -".+ c #B5B4B6", -"++ c #C2C3C5", -"@+ c #C0C3C3", -"#+ c #C1C3C4", -"$+ c #E3E3E3", -"%+ c #E3E3E4", -"&+ c #E4E3E4", -"*+ c #E2E3E4", -"=+ c #ECEEEB", -"-+ c #EBEDEA", -";+ c #EEF0ED", -">+ c #EFF0EE", -". + @ @ # # $ % ", -"& & * & & & & & ", -"= = - = = ; > , ", -"' ) ! ! ! ) ' ~ ", -"{ ] { { { ^ / ( ", -"_ : < [ : } | 1 ", -"2 2 2 3 2 4 5 6 ", -"7 7 7 7 7 8 9 0 ", -"a b a a a c d e ", -"f g h h h h i j ", -"k l m m m n o p ", -"q q q q q q q q ", -"r r s s s t q u ", -"v w x y z A B C ", -"D E F F G F H I ", -"J K L M N O P Q ", -"R R S S S T U V ", -"W W X X X Y Z ` ", -" . . . . ...+.W ", -" . . . . ..... .", -"@.#.$.$.%.&.*.=.", -"-.-.;.-.-.-.-.-.", -">.,.'.).).!.!.>.", -"~.{.].^.].^././.", -"(.(.(.(.(._.:.<.", -"(.(.[.[.[.[.(.}.", -"|.1.2.3.3.4.5.6.", -"7.7.7.7.7.8.9.0.", -"a.b.c.d.c.e.f.g.", -"h.i.j.k.j.k.l.m.", -"n.o.p.q.r.p.s.t.", -"u.u.v.u.u.u.u.u.", -"w.x.y.z.A.y.B.C.", -"D.D.E.D.D.D.D.D.", -"D.D.E.D.D.D.D.D.", -"F.G.H.I.J.K.L.M.", -"N.N.O.N.N.P.Q.R.", -"N.N.S.N.N.N.N.N.", -"T.N.T.T.T.U.N.V.", -"W.W.X.W.W.W.W.W.", -"W.W.W.W.W.W.W.W.", -"Y.Y.Y.Y.Y.Y.Y.Y.", -"Z.`. + +.+Z.`.`.", -"++@+#+#+#+#+@+@+", -"$+%+&+&+*+%+%+%+", -"=+-+;+-+-+>+-+-+"}; - - - -static char * listviewhighcornerleft_xpm[] = { -"100 46 1475 2", -" c None", -". c #FBFBFC", -"+ c #E8EAE7", -"@ c #758DC3", -"# c #42599E", -"$ c #28418A", -"% c #19418F", -"& c #3F5695", -"* c #415896", -"= c #435A98", -"- c #445C99", -"; c #465E9B", -"> c #48609B", -", c #49629C", -"' c #4A639D", -") c #49639D", -"! c #4A629D", -"~ c #4B639D", -"{ c #4B649D", -"] c #4C659D", -"^ c #4D669D", -"/ c #4E689D", -"( c #506A9D", -"_ c #516A9D", -": c #536B9C", -"< c #546C9C", -"[ c #566D9B", -"} c #576D9B", -"| c #586E9C", -"1 c #5B6F9D", -"2 c #61739D", -"3 c #63749E", -"4 c #64749E", -"5 c #68769E", -"6 c #6A779E", -"7 c #6B789E", -"8 c #66759E", -"9 c #6C789D", -"0 c #EEF0ED", -"a c #D0D3DC", -"b c #3E51A3", -"c c #28428B", -"d c #29428C", -"e c #425996", -"f c #455C99", -"g c #485F9C", -"h c #49619E", -"i c #4A63A0", -"j c #4B64A1", -"k c #4B65A1", -"l c #4C66A2", -"m c #4D67A2", -"n c #4F69A1", -"o c #516AA1", -"p c #536CA0", -"q c #556DA1", -"r c #576EA0", -"s c #586F9F", -"t c #586E9F", -"u c #596F9E", -"v c #5A6F9E", -"w c #5C709E", -"x c #5E719E", -"y c #5F729F", -"z c #62739F", -"A c #63739E", -"B c #64749D", -"C c #65749E", -"D c #69769D", -"E c #6C799E", -"F c #6D799F", -"G c #707D9F", -"H c #717F9E", -"I c #6E7AA1", -"J c #6C789E", -"K c #6F7C9C", -"L c #6F7D9B", -"M c #2A4AA0", -"N c #4971D0", -"O c #4C72D8", -"P c #5472C0", -"Q c #5573BF", -"R c #5774BF", -"S c #5875BF", -"T c #5976C1", -"U c #5A76C1", -"V c #5C78C2", -"W c #5E7AC2", -"X c #607CC3", -"Y c #627EC3", -"Z c #637FC4", -"` c #6581C5", -" . c #6682C6", -".. c #6783C7", -"+. c #6984C8", -"@. c #6B85C9", -"#. c #6D87CA", -"$. c #6F89CB", -"%. c #718CCD", -"&. c #748ECF", -"*. c #7690D0", -"=. c #7992D2", -"-. c #7A93D3", -";. c #7C95D5", -">. c #7F98D7", -",. c #8099D8", -"'. c #859CDB", -"). c #8AA0DD", -"!. c #8DA3DF", -"~. c #8FA5E0", -"{. c #90A5E0", -"]. c #91A6E1", -"^. c #91A5E1", -"/. c #90A4E0", -"(. c #8EA3DE", -"_. c #92A6E2", -":. c #8FA4DF", -"<. c #90A5DE", -"[. c #90A5DC", -"}. c #90A6DB", -"|. c #91A6E0", -"1. c #93A7E2", -"2. c #95AAE6", -"3. c #99AEEA", -"4. c #9AB2EA", -"5. c #99B1E9", -"6. c #99B1E7", -"7. c #98AFE6", -"8. c #93A8E2", -"9. c #97ACE7", -"0. c #9AB3EB", -"a. c #9DB5ED", -"b. c #9DB6EE", -"c. c #375095", -"d. c #4056AD", -"e. c #506DCD", -"f. c #4360CC", -"g. c #345ED6", -"h. c #335ECF", -"i. c #355ED6", -"j. c #355FD6", -"k. c #365FD6", -"l. c #355FD0", -"m. c #3760D5", -"n. c #3A63D4", -"o. c #3C63D1", -"p. c #3B63CD", -"q. c #3B63C9", -"r. c #3B62C9", -"s. c #3D63C8", -"t. c #4065C5", -"u. c #4567C5", -"v. c #496BC5", -"w. c #4F70C7", -"x. c #5273C8", -"y. c #5475CA", -"z. c #5777CB", -"A. c #5879CD", -"B. c #5A7BCE", -"C. c #5D7DCF", -"D. c #5F7ECF", -"E. c #617FD0", -"F. c #6381D1", -"G. c #6583D2", -"H. c #6785D2", -"I. c #6886D3", -"J. c #6A88D4", -"K. c #6C89D5", -"L. c #6E8BD6", -"M. c #708CD7", -"N. c #718DD8", -"O. c #738EDA", -"P. c #748FDB", -"Q. c #7691DC", -"R. c #7893DD", -"S. c #7994DD", -"T. c #7A96DE", -"U. c #7B97DF", -"V. c #7C98E0", -"W. c #7E9AE2", -"X. c #7F9BE3", -"Y. c #829DE4", -"Z. c #849FE5", -"`. c #87A0E6", -" + c #88A1E7", -".+ c #89A2E6", -"++ c #8CA3E7", -"@+ c #8EA5E9", -"#+ c #8EA6E9", -"$+ c #8FA7E9", -"%+ c #8FA8E8", -"&+ c #8FA9E8", -"*+ c #91A9E8", -"=+ c #90A7E8", -"-+ c #8FA8EA", -";+ c #90AAEA", -">+ c #93ABEA", -",+ c #95ABEA", -"'+ c #93ABE9", -")+ c #94ABEA", -"!+ c #90A9EA", -"~+ c #93AAE9", -"{+ c #273E7E", -"]+ c #345ED5", -"^+ c #3D60CE", -"/+ c #3D60CF", -"(+ c #345ECF", -"_+ c #335ED0", -":+ c #355FD3", -"<+ c #3A60CE", -"[+ c #3A5FCB", -"}+ c #385FC9", -"|+ c #3B60C8", -"1+ c #3C63CB", -"2+ c #3E64CB", -"3+ c #4166CA", -"4+ c #4568C9", -"5+ c #4A6CC7", -"6+ c #4F71C8", -"7+ c #5172CA", -"8+ c #5475CE", -"9+ c #5678D3", -"0+ c #597CD6", -"a+ c #5C7ED7", -"b+ c #5E7FD8", -"c+ c #6181D9", -"d+ c #6383DA", -"e+ c #6585DA", -"f+ c #6786DB", -"g+ c #6988DC", -"h+ c #6B8ADD", -"i+ c #6D8BDE", -"j+ c #6F8DDE", -"k+ c #718EDF", -"l+ c #728FE0", -"m+ c #7390E1", -"n+ c #7390E2", -"o+ c #7491E3", -"p+ c #7592E4", -"q+ c #7693E4", -"r+ c #7794E5", -"s+ c #7894E5", -"t+ c #7995E6", -"u+ c #7B96E6", -"v+ c #7C97E7", -"w+ c #7D9AE8", -"x+ c #7F9CE9", -"y+ c #829DE9", -"z+ c #849EE9", -"A+ c #859EE9", -"B+ c #87A0E7", -"C+ c #8AA2E7", -"D+ c #8BA3E8", -"E+ c #89A2E7", -"F+ c #8CA6EA", -"G+ c #8BA6EA", -"H+ c #8BA7EA", -"I+ c #8CA3E8", -"J+ c #8BA8EA", -"K+ c #8CA7EA", -"L+ c #8CA8EA", -"M+ c #4659C7", -"N+ c #355ECF", -"O+ c #3660CF", -"P+ c #3860CE", -"Q+ c #3961CD", -"R+ c #3B61CB", -"S+ c #3B61CA", -"T+ c #3D62CA", -"U+ c #3D63CA", -"V+ c #4165CB", -"W+ c #456ACB", -"X+ c #4B6FCD", -"Y+ c #5174CE", -"Z+ c #5275D1", -"`+ c #5477D4", -" @ c #5678D9", -".@ c #587ADB", -"+@ c #597BDB", -"@@ c #5B7DDC", -"#@ c #5E7FDC", -"$@ c #6081DD", -"%@ c #6283DE", -"&@ c #6484DF", -"*@ c #6787E0", -"=@ c #6989E1", -"-@ c #6B8BE1", -";@ c #6D8DE2", -">@ c #6F8EE3", -",@ c #718FE4", -"'@ c #7290E4", -")@ c #7491E5", -"!@ c #7692E6", -"~@ c #7793E5", -"{@ c #7894E6", -"]@ c #7895E7", -"^@ c #7996E8", -"/@ c #7A97E8", -"(@ c #7B98E9", -"_@ c #7D99E8", -":@ c #7F9AE8", -"<@ c #7F9BE9", -"[@ c #7F9CEA", -"}@ c #859EE8", -"|@ c #859FE8", -"1@ c #85A0E9", -"2@ c #869FE9", -"3@ c #86A1E7", -"4@ c #86A0E9", -"5@ c #87A1E7", -"6@ c #88A2E7", -"7@ c #87A1E9", -"8@ c #5A6FCA", -"9@ c #365FCF", -"0@ c #345ED0", -"a@ c #385FCC", -"b@ c #385FCE", -"c@ c #3A61CC", -"d@ c #3B62CD", -"e@ c #3E64CD", -"f@ c #4167CF", -"g@ c #4469CF", -"h@ c #486CD1", -"i@ c #4D71D2", -"j@ c #5175D4", -"k@ c #5376D6", -"l@ c #5578DA", -"m@ c #5679DC", -"n@ c #587BDD", -"o@ c #5A7DDE", -"p@ c #5D80DE", -"q@ c #5F82DF", -"r@ c #6284DF", -"s@ c #6585E0", -"t@ c #6787E1", -"u@ c #6988E2", -"v@ c #6B8AE2", -"w@ c #6D8CE3", -"x@ c #6E8DE3", -"y@ c #708EE4", -"z@ c #718FE3", -"A@ c #7391E4", -"B@ c #7592E5", -"C@ c #7895E5", -"D@ c #7996E6", -"E@ c #7A97E6", -"F@ c #7B98E7", -"G@ c #7A98E8", -"H@ c #7B99E9", -"I@ c #7E9AE9", -"J@ c #7D9AE9", -"K@ c #7E9AEA", -"L@ c #809CE9", -"M@ c #819DE8", -"N@ c #7F9BEA", -"O@ c #819DE9", -"P@ c #819CE9", -"Q@ c #839EE9", -"R@ c #839EE8", -"S@ c #839DEA", -"T@ c #859FE9", -"U@ c #87A0E8", -"V@ c #86A0E8", -"W@ c #87A1E8", -"X@ c #3760CF", -"Y@ c #3A61CE", -"Z@ c #3A62CD", -"`@ c #3F66CE", -" # c #4368D0", -".# c #466CD2", -"+# c #496DD5", -"@# c #4E72D6", -"## c #5175D8", -"$# c #5276DA", -"%# c #5578DC", -"&# c #577ADC", -"*# c #597CDD", -"=# c #5B7DDD", -"-# c #5D7FDE", -";# c #5E81DE", -"># c #6183DF", -",# c #6386DF", -"'# c #6687E0", -")# c #6888E0", -"!# c #6A89E1", -"~# c #6C8AE1", -"{# c #6E8CE2", -"]# c #6F8DE2", -"^# c #7390E4", -"/# c #7390E3", -"(# c #7491E4", -"_# c #7693E5", -":# c #7895E6", -"<# c #7896E6", -"[# c #7997E7", -"}# c #7B97E7", -"|# c #7B98E8", -"1# c #7C98E8", -"2# c #7E9BE9", -"3# c #809CEA", -"4# c #819CEA", -"5# c #839DE9", -"6# c #365FD0", -"7# c #3660D0", -"8# c #3961CF", -"9# c #3B63CF", -"0# c #3D64D0", -"a# c #4067D0", -"b# c #4469D2", -"c# c #466BD3", -"d# c #496ED5", -"e# c #4C71D6", -"f# c #4E72D8", -"g# c #5074D9", -"h# c #5376DB", -"i# c #5578DB", -"j# c #587ADC", -"k# c #5B7CDC", -"l# c #5D7EDD", -"m# c #5F80DD", -"n# c #6081DE", -"o# c #6383DE", -"p# c #6686DF", -"q# c #6887E0", -"r# c #6988E0", -"s# c #6B89E1", -"t# c #6C8AE0", -"u# c #6E8CE1", -"v# c #708EE2", -"w# c #718FE2", -"x# c #7290E3", -"y# c #7391E2", -"z# c #7492E1", -"A# c #7592E2", -"B# c #7691E3", -"C# c #7591E3", -"D# c #7692E3", -"E# c #7693E3", -"F# c #7793E4", -"G# c #7893E4", -"H# c #7994E5", -"I# c #7D97E8", -"J# c #7E98E8", -"K# c #7D98E8", -"L# c #7D99E9", -"M# c #7D9BEA", -"N# c #7D9CEA", -"O# c #7E99E8", -"P# c #7D9AEA", -"Q# c #7C9BEA", -"R# c #7C9CEA", -"S# c #355FCF", -"T# c #3860D0", -"U# c #3A62D0", -"V# c #3C64D1", -"W# c #4167D1", -"X# c #4369D3", -"Y# c #466BD4", -"Z# c #486DD5", -"`# c #4A6ED7", -" $ c #4C70D8", -".$ c #5478D9", -"+$ c #577BDA", -"@$ c #597DDB", -"#$ c #5B7EDB", -"$$ c #5D7FDC", -"%$ c #6182DE", -"&$ c #6284DE", -"*$ c #6485DF", -"=$ c #6586DF", -"-$ c #6787DF", -";$ c #6888DF", -">$ c #6A8ADF", -",$ c #6C8BE0", -"'$ c #6D8CE0", -")$ c #6E8DE1", -"!$ c #6F8DE1", -"~$ c #708EE1", -"{$ c #718FE0", -"]$ c #728FE1", -"^$ c #7390E0", -"/$ c #738FE0", -"($ c #7490E1", -"_$ c #7590E1", -":$ c #7591E1", -"<$ c #7592E1", -"[$ c #7692E2", -"}$ c #7794E2", -"|$ c #7894E3", -"1$ c #7996E3", -"2$ c #7A96E5", -"3$ c #7B98E6", -"4$ c #7B9AE8", -"5$ c #7C99E8", -"6$ c #7C96E5", -"7$ c #7D97E7", -"8$ c #7C99E9", -"9$ c #7B9AE9", -"0$ c #7B9AEA", -"a$ c #5B6DCF", -"b$ c #305EC8", -"c$ c #335ECE", -"d$ c #305ECA", -"e$ c #345FCF", -"f$ c #3761D0", -"g$ c #3A62D1", -"h$ c #3C64D2", -"i$ c #4066D3", -"j$ c #466BD5", -"k$ c #486ED6", -"l$ c #4A6ED6", -"m$ c #4D71D8", -"n$ c #4F72D9", -"o$ c #5073D9", -"p$ c #4F72D8", -"q$ c #5074D8", -"r$ c #5276D9", -"s$ c #587ADA", -"t$ c #5B7CDB", -"u$ c #5D7EDC", -"v$ c #5F7FDD", -"w$ c #6081DC", -"x$ c #6182DD", -"y$ c #6283DD", -"z$ c #6484DE", -"A$ c #6585DD", -"B$ c #6787DE", -"C$ c #6988DF", -"D$ c #6A89DE", -"E$ c #6C8ADF", -"F$ c #6D8BDF", -"G$ c #6E8CE0", -"H$ c #6F8DE0", -"I$ c #718EE0", -"J$ c #728FDF", -"K$ c #728FDE", -"L$ c #7290E0", -"M$ c #7190E0", -"N$ c #7291E0", -"O$ c #7191E0", -"P$ c #7392E1", -"Q$ c #7493E1", -"R$ c #7594E1", -"S$ c #7594E2", -"T$ c #7694E2", -"U$ c #7695E2", -"V$ c #7A96E4", -"W$ c #7895E2", -"X$ c #7A96E2", -"Y$ c #7A96E3", -"Z$ c #7B96E3", -"`$ c #7996E1", -" % c #7C96E4", -".% c #305EC9", -"+% c #315ECC", -"@% c #325ECE", -"#% c #3760D0", -"$% c #3962D1", -"%% c #3E66D3", -"&% c #4268D4", -"*% c #446BD5", -"=% c #476CD6", -"-% c #496ED7", -";% c #4B6FD7", -">% c #4C70D7", -",% c #4E71D7", -"'% c #5074D7", -")% c #5276D8", -"!% c #5376D8", -"~% c #5779DA", -"{% c #597ADA", -"]% c #5A7BDB", -"^% c #5B7CDA", -"/% c #5D7EDB", -"(% c #5E7FDB", -"_% c #6182DB", -":% c #6384DC", -"<% c #6586DD", -"[% c #6686DC", -"}% c #6887DD", -"|% c #6988DD", -"1% c #6A8ADE", -"2% c #6B8BDE", -"3% c #6C8CDE", -"4% c #6E8DDF", -"5% c #6E8CDF", -"6% c #6D8DDF", -"7% c #6C8BDF", -"8% c #6F8DDF", -"9% c #718FDF", -"0% c #7290DF", -"a% c #7391E0", -"b% c #7491E0", -"c% c #7292E1", -"d% c #3959C5", -"e% c #345BC5", -"f% c #315EC8", -"g% c #355BC5", -"h% c #325EC8", -"i% c #315ECB", -"j% c #345DCC", -"k% c #335ECD", -"l% c #345ECD", -"m% c #355FCE", -"n% c #3862D0", -"o% c #3E66D2", -"p% c #456BD5", -"q% c #476CD5", -"r% c #4B6ED7", -"s% c #4B6FD6", -"t% c #4B6FD5", -"u% c #4D71D6", -"v% c #5073D7", -"w% c #5174D7", -"x% c #5275D8", -"y% c #5577D8", -"z% c #5678D8", -"A% c #5779D9", -"B% c #587AD8", -"C% c #597CD9", -"D% c #5B7DD9", -"E% c #5D7FDA", -"F% c #5F80DB", -"G% c #6182DC", -"H% c #6484DC", -"I% c #6585DC", -"J% c #6787DD", -"K% c #6988DE", -"L% c #6B8ADE", -"M% c #6B8ADF", -"N% c #6989DE", -"O% c #6B89DE", -"P% c #6E8BDF", -"Q% c #708CDE", -"R% c #708DDF", -"S% c #708FDF", -"T% c #728EDF", -"U% c #6F8EDD", -"V% c #728EDD", -"W% c #7390DF", -"X% c #7490DF", -"Y% c #335DC8", -"Z% c #3759C5", -"`% c #3859C5", -" & c #335EC8", -".& c #325DCA", -"+& c #345CCB", -"@& c #335DCC", -"#& c #345DCD", -"$& c #355FCD", -"%& c #3861D0", -"&& c #3B64D1", -"*& c #3E65D2", -"=& c #4168D3", -"-& c #456AD5", -";& c #4B6ED5", -">& c #4C6FD4", -",& c #4D70D5", -"'& c #4F72D6", -")& c #5173D6", -"!& c #5375D7", -"~& c #5476D8", -"{& c #5577D7", -"]& c #5477D8", -"^& c #5677D8", -"/& c #5879D9", -"(& c #597AD9", -"_& c #5C7DDA", -":& c #6080DC", -"<& c #6080DB", -"[& c #6181DC", -"}& c #6282DC", -"|& c #6383DD", -"1& c #6484DD", -"2& c #6686DE", -"3& c #6685DE", -"4& c #6786DE", -"5& c #6687DE", -"6& c #6887DE", -"7& c #6987DE", -"8& c #6788DF", -"9& c #6785DF", -"0& c #6B89DF", -"a& c #6C89DF", -"b& c #6F8DDD", -"c& c #6D8CDE", -"d& c #445BBB", -"e& c #3759BE", -"f& c #375AC6", -"g& c #355CC8", -"h& c #345CCA", -"i& c #355ECC", -"j& c #365FCD", -"k& c #3761CE", -"l& c #3A63D0", -"m& c #3D65D1", -"n& c #466AD4", -"o& c #476BD4", -"p& c #486CD3", -"q& c #4A6ED4", -"r& c #4B6ED4", -"s& c #4E71D6", -"t& c #4F71D5", -"u& c #5072D6", -"v& c #5274D7", -"w& c #5273D7", -"x& c #5274D6", -"y& c #5476D7", -"z& c #5779D8", -"A& c #587AD9", -"B& c #5A7CDA", -"C& c #5C7DDB", -"D& c #5D7EDA", -"E& c #6081DA", -"F& c #6181DB", -"G& c #6283DC", -"H& c #6483DD", -"I& c #6483DE", -"J& c #6585DE", -"K& c #6786DF", -"L& c #6886DE", -"M& c #6887DF", -"N& c #6987DF", -"O& c #6A88DF", -"P& c #6786E0", -"Q& c #6A86DE", -"R& c #6B89E0", -"S& c #365BC8", -"T& c #365CC8", -"U& c #375DCA", -"V& c #375FCB", -"W& c #3860CD", -"X& c #3C63D0", -"Y& c #4167D2", -"Z& c #4268D2", -"`& c #4368D2", -" * c #4367D2", -".* c #4568D2", -"+* c #466AD2", -"@* c #496CD3", -"#* c #4A6DD3", -"$* c #4A6DD4", -"%* c #4D70D4", -"&* c #4F72D5", -"** c #4C70D4", -"=* c #4E72D5", -"-* c #5173D5", -";* c #5375D6", -">* c #597BDA", -",* c #5B7DDA", -"'* c #5C7EDB", -")* c #5D7FDB", -"!* c #5E80DB", -"~* c #5E81DA", -"{* c #5F81DB", -"]* c #5F82DB", -"^* c #6384DD", -"/* c #6384DE", -"(* c #6585DF", -"_* c #6486E0", -":* c #6583DD", -"<* c #6386E0", -"[* c #6686E0", -"}* c #6B86DD", -"|* c #6D86DD", -"1* c #6086E0", -"2* c #5573CD", -"3* c #3959C3", -"4* c #3959C4", -"5* c #3759C0", -"6* c #375BC7", -"7* c #365CC7", -"8* c #395FCC", -"9* c #3B62CE", -"0* c #3E64D0", -"a* c #4066D1", -"b* c #4166D1", -"c* c #4064CF", -"d* c #4065CF", -"e* c #4266D0", -"f* c #4468D1", -"g* c #4569D1", -"h* c #476BD2", -"i* c #466AD1", -"j* c #476AD2", -"k* c #456AD1", -"l* c #496DD2", -"m* c #4A6FD3", -"n* c #496ED2", -"o* c #4B70D4", -"p* c #4D71D4", -"q* c #4E72D4", -"r* c #5073D4", -"s* c #5174D5", -"t* c #5175D5", -"u* c #5276D6", -"v* c #5377D6", -"w* c #5478D7", -"x* c #5579D7", -"y* c #567AD8", -"z* c #577BD9", -"A* c #597CD8", -"B* c #5A7DD9", -"C* c #5A7ED9", -"D* c #5B7FDA", -"E* c #5C80DA", -"F* c #5D80DA", -"G* c #5E81DB", -"H* c #5D80DB", -"I* c #6082DC", -"J* c #6183DD", -"K* c #6183DE", -"L* c #6082DB", -"M* c #6282DE", -"N* c #6682DE", -"O* c #6583DE", -"P* c #3759BF", -"Q* c #375AC2", -"R* c #375AC1", -"S* c #375AC4", -"T* c #395DCA", -"U* c #3A5ECA", -"V* c #3C60CC", -"W* c #3D61CD", -"X* c #3D61CC", -"Y* c #3C61CD", -"Z* c #3E62CD", -"`* c #3F64CE", -" = c #4266CF", -".= c #4468D0", -"+= c #4267CF", -"@= c #4166CE", -"#= c #4065CE", -"$= c #4166CD", -"%= c #4267CE", -"&= c #456AD0", -"*= c #4368CE", -"== c #4468CF", -"-= c #4569D0", -";= c #486BD1", -">= c #4B6FD3", -",= c #4C70D3", -"'= c #4F73D4", -")= c #5275D5", -"!= c #5477D6", -"~= c #577BD7", -"{= c #587CD8", -"]= c #577CD8", -"^= c #597DD9", -"/= c #5A7DDA", -"(= c #597DDA", -"_= c #587CDA", -":= c #5A7EDA", -"<= c #567BD8", -"[= c #557AD9", -"}= c #567BD9", -"|= c #577CD9", -"1= c #587DD9", -"2= c #587ED9", -"3= c #577ED8", -"4= c #587DD8", -"5= c #587ED8", -"6= c #567ED7", -"7= c #526ABD", -"8= c #3759C1", -"9= c #385BC7", -"0= c #395CC8", -"a= c #3B5DC9", -"b= c #3B5ECA", -"c= c #3A5FCA", -"d= c #3B60CC", -"e= c #3C61CC", -"f= c #3D62CD", -"g= c #3E63CD", -"h= c #3C61CB", -"i= c #3C61CA", -"j= c #3D62CB", -"k= c #3F64CC", -"l= c #4065CD", -"m= c #4669D0", -"n= c #476AD0", -"o= c #496BD1", -"p= c #4A6DD2", -"q= c #4B6ED2", -"r= c #4D71D3", -"s= c #4E73D4", -"t= c #4F74D4", -"u= c #5075D5", -"v= c #5276D5", -"w= c #5377D7", -"x= c #5278D7", -"y= c #5277D6", -"z= c #5378D7", -"A= c #5379D8", -"B= c #5379D9", -"C= c #5278D8", -"D= c #5178D7", -"E= c #3355C0", -"F= c #3556C1", -"G= c #395AC6", -"H= c #385AC7", -"I= c #395BC7", -"J= c #395EC9", -"K= c #395FCA", -"L= c #3B60CA", -"M= c #3B60CB", -"N= c #375DC7", -"O= c #385EC8", -"P= c #395FC9", -"Q= c #3A60CA", -"R= c #3D63CC", -"S= c #4367CF", -"T= c #476BD1", -"U= c #4A6ED2", -"V= c #4B6FD2", -"W= c #4C6FD2", -"X= c #4D70D1", -"Y= c #4E71D2", -"Z= c #4E72D2", -"`= c #4E74D4", -" - c #4E75D5", -".- c #4E75D4", -"+- c #4F75D3", -"@- c #5075D2", -"#- c #5075D3", -"$- c #5177D7", -"%- c #5178D8", -"&- c #4F75D5", -"*- c #5076D5", -"=- c #4F76D6", -"-- c #5279D9", -";- c #3C52B1", -">- c #3656C3", -",- c #3757C5", -"'- c #3758C6", -")- c #3759C6", -"!- c #375BC6", -"~- c #385CC7", -"{- c #385DC8", -"]- c #365CC6", -"^- c #355BC6", -"/- c #355CC6", -"(- c #365DC7", -"_- c #375EC8", -":- c #375CC6", -"<- c #385EC6", -"[- c #3A5FC7", -"}- c #3C60C8", -"|- c #3D61C9", -"1- c #3E62CA", -"2- c #4063CC", -"3- c #4165CE", -"4- c #4268D0", -"5- c #4269D1", -"6- c #436AD2", -"7- c #446AD2", -"8- c #456BD2", -"9- c #496CD1", -"0- c #4C6CD0", -"a- c #4D6CCF", -"b- c #4E6DD0", -"c- c #4F6ECF", -"d- c #4E6FCF", -"e- c #4C70CF", -"f- c #4A71D0", -"g- c #4F6FCF", -"h- c #4B71D0", -"i- c #4A72D1", -"j- c #4B73D4", -"k- c #4F70D0", -"l- c #4C73D3", -"m- c #4C73D6", -"n- c #4B72D2", -"o- c #4B71D1", -"p- c #4C73D7", -"q- c #3354C0", -"r- c #3152BE", -"s- c #3052BE", -"t- c #3051BF", -"u- c #2E4FBF", -"v- c #2E4FBE", -"w- c #2E50BF", -"x- c #2F50BF", -"y- c #3156C4", -"z- c #2F56C5", -"A- c #2E57C5", -"B- c #2F57C5", -"C- c #3057C6", -"D- c #3258C6", -"E- c #3459C7", -"F- c #365AC7", -"G- c #385BC8", -"H- c #3B5DCA", -"I- c #3B5DCB", -"J- c #3C5ECC", -"K- c #3C60CD", -"L- c #3C62CE", -"M- c #3D65D0", -"N- c #3D66D1", -"O- c #4166D2", -"P- c #4667D2", -"Q- c #4A67D1", -"R- c #4C68D0", -"S- c #4C69CF", -"T- c #4D6BCE", -"U- c #4E6DCD", -"V- c #4E6ECE", -"W- c #4E6DCE", -"X- c #4970D0", -"Y- c #4770D0", -"Z- c #4B6BCE", -"`- c #4A6CCE", -" ; c #496DCF", -".; c #476FD0", -"+; c #4870D0", -"@; c #486DCF", -"#; c #242F79", -"$; c #2F41AC", -"%; c #2040B8", -"&; c #2041B8", -"*; c #2243B3", -"=; c #2243B8", -"-; c #2343B8", -";; c #2444B8", -">; c #2445B8", -",; c #2445B6", -"'; c #2445B7", -"); c #2444B9", -"!; c #2949BE", -"~; c #2649BF", -"{; c #234BBF", -"]; c #224CBF", -"^; c #224AC0", -"/; c #244CC0", -"(; c #254DC0", -"_; c #254DC1", -":; c #264DC2", -"<; c #274EC3", -"[; c #274CC3", -"}; c #274DC4", -"|; c #254DC5", -"1; c #214EC5", -"2; c #204FC6", -"3; c #1F50C8", -"4; c #2151C9", -"5; c #2B53C8", -"6; c #3154C7", -"7; c #3255C6", -"8; c #2F57C7", -"9; c #2C58C9", -"0; c #2D59CA", -"a; c #2D58C9", -"b; c #2E5BCC", -"c; c #325ECC", -"d; c #325ECB", -"e; c #1F40B1", -"f; c #1F40B2", -"g; c #1F40B3", -"h; c #2A44BD", -"i; c #2845BE", -"j; c #2745BE", -"k; c #2646BF", -"l; c #2546BE", -"m; c #2347BF", -"n; c #2147BF", -"o; c #2048C0", -"p; c #1D48C0", -"q; c #1C48C0", -"r; c #1B47C0", -"s; c #1C48BF", -"t; c #1E49BE", -"u; c #214ABD", -"v; c #244CBD", -"w; c #264DBE", -"x; c #254EC0", -"y; c #214FC2", -"z; c #1B51C5", -"A; c #1C51C7", -"B; c #2250C8", -"C; c #2A52C8", -"D; c #3254C6", -"E; c #3355C5", -"F; c #3154C8", -"G; c #3355C6", -"H; c #2F57C8", -"I; c #2E58C9", -"J; c #2E59C9", -"K; c #3059C9", -"L; c #2040B6", -"M; c #2743BB", -"N; c #2844BC", -"O; c #2743BD", -"P; c #2844BE", -"Q; c #2844BD", -"R; c #2346BE", -"S; c #2047BF", -"T; c #1E48C0", -"U; c #1D47C0", -"V; c #1D49BF", -"W; c #1F49BF", -"X; c #204ABE", -"Y; c #254DBF", -"Z; c #234EC0", -"`; c #2050C1", -" > c #1C51C3", -".> c #1F51C6", -"+> c #2651C8", -"@> c #2D53C7", -"#> c #3155C6", -"$> c #3155C7", -"%> c #3355C7", -"&> c #3254C7", -"*> c #1E40B1", -"=> c #2141B8", -"-> c #2442B9", -";> c #2744BB", -">> c #2945BB", -",> c #2A45BB", -"'> c #2944BA", -")> c #2745BB", -"!> c #2545BC", -"~> c #2246BD", -"{> c #2047BE", -"]> c #1F47BD", -"^> c #1D48BE", -"/> c #1E49C0", -"(> c #1F4AC0", -"_> c #214BBF", -":> c #244CBE", -"<> c #254DBE", -"[> c #244DBE", -"}> c #224FBF", -"|> c #2051C1", -"1> c #2151C3", -"2> c #2252C5", -"3> c #2151C1", -"4> c #2851C6", -"5> c #2A50C6", -"6> c #2E54C6", -"7> c #1F51C2", -"8> c #1D52C5", -"9> c #2651C9", -"0> c #2950C7", -"a> c #2D40A5", -"b> c #2040B0", -"c> c #1F40B0", -"d> c #223CAE", -"e> c #233CAE", -"f> c #253BAC", -"g> c #253BAD", -"h> c #233CB0", -"i> c #213EB2", -"j> c #1F3FB4", -"k> c #1E40B6", -"l> c #1F3FB7", -"m> c #1E3EB8", -"n> c #1F3FB8", -"o> c #2040B7", -"p> c #2141B6", -"q> c #2140B7", -"r> c #2241B6", -"s> c #2342B5", -"t> c #2442B6", -"u> c #2543B5", -"v> c #2643B4", -"w> c #2544B6", -"x> c #2346B8", -"y> c #2247B9", -"z> c #2048BC", -"A> c #1F48BF", -"B> c #2049C0", -"C> c #214AC0", -"D> c #224BBF", -"E> c #234CBE", -"F> c #244DBF", -"G> c #234CBF", -"H> c #264DC0", -"I> c #274EBF", -"J> c #264DBF", -"K> c #254EBF", -"L> c #2050C0", -"M> c #1F51C1", -"N> c #1E42A4", -"O> c #263BA6", -"P> c #253BA7", -"Q> c #253CA7", -"R> c #1E41A5", -"S> c #1F40AF", -"T> c #273AAC", -"U> c #1E40B0", -"V> c #1F40B5", -"W> c #1F40B6", -"X> c #1F40B8", -"Y> c #1E40B8", -"Z> c #1F3EB8", -"`> c #203FB7", -" , c #2240B6", -"., c #2341B7", -"+, c #2345B9", -"@, c #2147BB", -"#, c #2148BA", -"$, c #2049BB", -"%, c #2049BD", -"&, c #2049BF", -"*, c #224BBE", -"=, c #244DBD", -"-, c #244CBF", -";, c #182969", -">, c #273BAD", -",, c #2739AB", -"', c #263AAC", -"), c #243CAE", -"!, c #233DAE", -"~, c #213EAF", -"{, c #1F3FB0", -"], c #2040B4", -"^, c #1F3FB6", -"/, c #1E3EB7", -"(, c #2240B7", -"_, c #2341B6", -":, c #2543B4", -"<, c #2644B3", -"[, c #2544B5", -"}, c #2545B5", -"|, c #2547B6", -"1, c #2548B7", -"2, c #2349BA", -"3, c #1F49BE", -"4, c #2149BD", -"5, c #2049BE", -"6, c #214BBE", -"7, c #2249BE", -"8, c #234CBD", -"9, c #2149BE", -"0, c #1E49BF", -"a, c #253BA9", -"b, c #253BAB", -"c, c #263AAB", -"d, c #213DAF", -"e, c #203EAF", -"f, c #1D40AF", -"g, c #1D40B0", -"h, c #1E40B4", -"i, c #2241B7", -"j, c #2643B6", -"k, c #2744B5", -"l, c #2643B5", -"m, c #2346B6", -"n, c #2147B7", -"o, c #2644B6", -"p, c #2247B7", -"q, c #2248B8", -"r, c #2647B7", -"s, c #2549B7", -"t, c #2645B7", -"u, c #2148B8", -"v, c #2847B6", -"w, c #2549B6", -"x, c #2849B6", -"y, c #2049B7", -"z, c #2A49B5", -"A, c #243BA4", -"B, c #253BA5", -"C, c #253BA6", -"D, c #263AA7", -"E, c #263AA8", -"F, c #2739AA", -"G, c #243CAD", -"H, c #223DAE", -"I, c #1F3EAF", -"J, c #1E3FB0", -"K, c #1D40B1", -"L, c #1E3FB1", -"M, c #1F3FB3", -"N, c #1F3FB5", -"O, c #2140B6", -"P, c #2140B8", -"Q, c #2744B4", -"R, c #2746B6", -"S, c #2947B6", -"T, c #2946B5", -"U, c #2A48B6", -"V, c #3551A8", -"W, c #1F399C", -"X, c #143D9F", -"Y, c #263BA5", -"Z, c #273BA8", -"`, c #273BAA", -" ' c #263AAD", -".' c #233CAD", -"+' c #213DAE", -"@' c #203FB2", -"#' c #2342B6", -"$' c #2443B6", -"%' c #2543B6", -"&' c #2644B5", -"*' c #133D9E", -"=' c #263BA7", -"-' c #263BA9", -";' c #273BA9", -">' c #263AAA", -",' c #2539AB", -"'' c #2639AB", -")' c #253AAC", -"!' c #243BAD", -"~' c #223DAF", -"{' c #203FB0", -"]' c #2040B1", -"^' c #2140B3", -"/' c #2543B1", -"(' c #2744AF", -"_' c #1A3CA0", -":' c #1D3BA2", -"<' c #233BA4", -"[' c #263AA5", -"}' c #253AA5", -"|' c #263AA6", -"1' c #263BA4", -"2' c #243BA5", -"3' c #263BA8", -"4' c #223EAF", -"5' c #3B4CA5", -"6' c #1D379A", -"7' c #1E389C", -"8' c #1E399F", -"9' c #1F3BA2", -"0' c #1F3BA3", -"a' c #213BA4", -"b' c #233AA3", -"c' c #243AA3", -"d' c #2539A4", -"e' c #253AA6", -"f' c #243BA7", -"g' c #253CAA", -"h' c #253CAC", -"i' c #253CAD", -"j' c #253CAE", -"k' c #243DAE", -"l' c #213FAF", -"m' c #223FAF", -"n' c #2040AF", -"o' c #253D93", -"p' c #1D3894", -"q' c #1F379A", -"r' c #1E389B", -"s' c #1D399C", -"t' c #1C3A9D", -"u' c #1B3A9D", -"v' c #183B9E", -"w' c #163C9E", -"x' c #153C9E", -"y' c #163B9D", -"z' c #173B9D", -"A' c #193A9D", -"B' c #1C3A9E", -"C' c #1F3AA1", -"D' c #223AA4", -"E' c #253BA8", -"F' c #273BA7", -"G' c #263CAB", -"H' c #263CAC", -"I' c #243EAE", -"J' c #273BAC", -"K' c #2A3795", -"L' c #1F389B", -"M' c #1D389B", -"N' c #1C399C", -"O' c #1B399C", -"P' c #1A3A9D", -"Q' c #1D399B", -"R' c #1B399B", -"S' c #1A3A9C", -"T' c #1B3A9F", -"U' c #1D3AA0", -"V' c #203BA2", -"W' c #203BA3", -"X' c #2639A6", -"Y' c #1B3692", -"Z' c #1C3794", -"`' c #1D3796", -" ) c #1E3898", -".) c #1E389A", -"+) c #1F399B", -"@) c #1A399C", -"#) c #193A9E", -"$) c #1A3BA0", -"%) c #1C3BA2", -"&) c #1D3CA3", -"*) c #203CA4", -"=) c #223BA5", -"-) c #3C4699", -";) c #2B4595", -">) c #1C3793", -",) c #1D3895", -"') c #1E3897", -")) c #1F3998", -"!) c #1F3999", -"~) c #1F399A", -"{) c #1E399C", -"]) c #1C3B9E", -"^) c #1D3BA0", -"/) c #1E3CA2", -"() c #223CA5", -"_) c #243CA6", -":) c #596FA9", -"<) c #3B4894", -"[) c #314993", -"}) c #29499F", -"|) c #28489E", -"1) c #2B4BA1", -"2) c #2C4BA1", -"3) c #2D4CA2", -"4) c #2E4CA3", -"5) c #2F4CA4", -"6) c #2E4CA4", -"7) c #2F4DA3", -"8) c #2F4DA4", -"9) c #D3D5D2", -"0) c #3B4794", -"a) c #314791", -"b) c #304892", -"c) c #304893", -"d) c #2F4995", -"e) c #2F4997", -"f) c #2D4A9A", -"g) c #2A4A9D", -"h) c #294A9F", -"i) c #284AA0", -"j) c #294AA0", -"k) c #2B4AA1", -"l) c #2D4CA3", -"m) c #C9CAC9", -"n) c #455D9B", -"o) c #242F78", -"p) c #1B2F85", -"q) c #C6C3C8", -"r) c #B5B2B6", -"s) c #B5B7B4", -"t) c #B5B7B3", -"u) c #B5B2B5", -"v) c #B5B3B4", -"w) c #B5B5B4", -"x) c #B5B6B3", -"y) c #B5B4B4", -"z) c #B5B3B5", -"A) c #B5B4B5", -"B) c #B5B5B5", -"C) c #B5B5B3", -"D) c #B5B5B6", -"E) c #BAC3BE", -"F) c #B9C3BD", -"G) c #C1C3C4", -"H) c #BFC3C2", -"I) c #B9C3BE", -"J) c #BBC3BF", -"K) c #BDC3C1", -"L) c #C0C3C3", -"M) c #BEC3C1", -"N) c #C2C3C5", -"O) c #E6E3E8", -"P) c #E0E2DF", -"Q) c #E1E1E1", -"R) c #E2E1E3", -"S) c #E4E1E6", -"T) c #E4E2E7", -"U) c #E4E2E6", -"V) c #E3E3E4", -"W) c #E2E3E3", -"X) c #E1E3E2", -"Y) c #E3E3E3", -"Z) c #E3E3E2", -"`) c #EBEDEA", -" ! c #EAECE9", -".! c #E9EBE8", -"+! c #ECEEEB", -". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ", -"0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ", -"@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.", -"c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+", -"$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+", -"{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+", -"{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@", -"{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+", -"{+{+8@8@f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#", -"$ {+8@e.f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.S#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$", -"$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %", -"$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%", -"$ $ 8@e.f.f.d%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%", -"$ $ 8@8@f.f.d%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%", -"$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&", -"{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*", -"{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*", -"{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=", -"{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=", -"{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=", -"{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-", -"{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ", -"#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;", -"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;", -"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;", -"#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;", -"#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>", -"#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;", -"#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>", -";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,", -";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,", -";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,", -";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,", -";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;", -";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;", -";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'", -";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", -";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", -"{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>", -":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", -"9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", -"+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)", -"+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)", -". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)", -". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)", -". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"}; - - -static char * listviewhighcornerright_xpm[] = { -"100 46 780 2", -" c None", -". c #6A779D", -"+ c #6C789C", -"@ c #6C789D", -"# c #6B789D", -"$ c #6A779E", -"% c #66759E", -"& c #64749E", -"* c #63749E", -"= c #61739D", -"- c #576D9B", -"; c #556C9C", -"> c #4D679D", -", c #4A649D", -"' c #49629D", -") c #465E9C", -"! c #40579C", -"~ c #3B5394", -"{ c #2C4E97", -"] c #314993", -"^ c #2B4595", -"/ c #1B4296", -"( c #253D93", -"_ c #19418F", -": c #0F3C96", -"< c #42599E", -"[ c #758DC3", -"} c #E8EAE7", -"| c #EEF0ED", -"1 c #FBFBFC", -"2 c #6F7D9B", -"3 c #6F7D9A", -"4 c #6E7B9C", -"5 c #67759E", -"6 c #63739E", -"7 c #62739D", -"8 c #596F9C", -"9 c #4A639D", -"0 c #47609C", -"a c #445B9F", -"b c #3E5697", -"c c #2E509A", -"d c #2D509A", -"e c #2D4F99", -"f c #2D4F98", -"g c #28418A", -"h c #3E51A3", -"i c #D0D3DC", -"j c #A1B6EF", -"k c #A2B6F0", -"l c #A1B6F0", -"m c #A3B6F0", -"n c #A0B6EF", -"o c #9DB6EE", -"p c #9CB5EF", -"q c #9CB2F0", -"r c #9FB5EE", -"s c #9CB4EB", -"t c #9AB3EC", -"u c #9AB0EC", -"v c #9DB3EB", -"w c #9BB4EC", -"x c #9BB4EE", -"y c #9BB1EF", -"z c #9BB0F0", -"A c #90ACF0", -"B c #93ABEE", -"C c #91A8EB", -"D c #8BA3E8", -"E c #88A1E7", -"F c #809DE9", -"G c #7A99E8", -"H c #7491E5", -"I c #698AE4", -"J c #6184E3", -"K c #507EDC", -"L c #4E7CDB", -"M c #4F7DDC", -"N c #5479DA", -"O c #567BDC", -"P c #577CDD", -"Q c #5074DA", -"R c #5174DB", -"S c #5175DC", -"T c #5276DD", -"U c #4D71DE", -"V c #4C72D8", -"W c #3A6CE0", -"X c #2B49A6", -"Y c #E0E2DF", -"Z c #93AAE9", -"` c #94A9E8", -" . c #94AAE9", -".. c #93A9E9", -"+. c #92AAE9", -"@. c #8DA9E8", -"#. c #8CA7E9", -"$. c #92ABE9", -"%. c #8EAAE9", -"&. c #8EA9E9", -"*. c #8FAAE9", -"=. c #8CA8E9", -"-. c #8CA2E7", -";. c #86A1E6", -">. c #839EE9", -",. c #7F9CE9", -"'. c #7A97E8", -"). c #7693E7", -"!. c #6E8EE8", -"~. c #678AE9", -"{. c #5D84E3", -"]. c #577CDF", -"^. c #4E77DF", -"/. c #4A70DB", -"(. c #4870DB", -"_. c #4870DC", -":. c #4770E3", -"<. c #496FDC", -"[. c #486EDB", -"}. c #466FE4", -"|. c #466EE3", -"1. c #4167D9", -"2. c #4066D8", -"3. c #3F66D8", -"4. c #3D64D7", -"5. c #3960DA", -"6. c #476DD9", -"7. c #446EE5", -"8. c #305EC8", -"9. c #8EAAE8", -"0. c #8FAAE8", -"a. c #91AAE9", -"b. c #8FA9E8", -"c. c #8BA8E8", -"d. c #8AA7E9", -"e. c #8BA5EA", -"f. c #8AA7E8", -"g. c #87A2E6", -"h. c #859FE8", -"i. c #7F9DE8", -"j. c #7C9AE8", -"k. c #7B95E7", -"l. c #7090E8", -"m. c #6B8BE9", -"n. c #6386E6", -"o. c #5881E1", -"p. c #5479DE", -"q. c #4D74DE", -"r. c #476EDB", -"s. c #446EE1", -"t. c #446EE0", -"u. c #446EDF", -"v. c #446DE0", -"w. c #426ADF", -"x. c #3C64DA", -"y. c #4360CC", -"z. c #D3D5D2", -"A. c #E6E3E8", -"B. c #8DA2E7", -"C. c #8CA6EA", -"D. c #8DA3E9", -"E. c #88A2E7", -"F. c #87A1E7", -"G. c #8AA1E7", -"H. c #849EE9", -"I. c #7D9AE9", -"J. c #7B98E8", -"K. c #7796E5", -"L. c #7191E7", -"M. c #688CE9", -"N. c #6687E5", -"O. c #5C83E1", -"P. c #557BDE", -"Q. c #4F76DE", -"R. c #4C72DE", -"S. c #456EDF", -"T. c #426AD9", -"U. c #4269D9", -"V. c #4269D8", -"W. c #3D64D9", -"X. c #3A61DA", -"Y. c #345ED6", -"Z. c #335ECF", -"`. c #C6C3C8", -" + c #86A1E7", -".+ c #87A2E7", -"++ c #87A0E7", -"@+ c #859EE8", -"#+ c #849DE9", -"$+ c #7E9BE9", -"%+ c #7A99E9", -"&+ c #7A95E5", -"*+ c #7593E7", -"=+ c #6F8EE9", -"-+ c #668AE5", -";+ c #6386E0", -">+ c #5B82DF", -",+ c #5379DE", -"'+ c #5075DE", -")+ c #4B6FDC", -"!+ c #446AD7", -"~+ c #4269D6", -"{+ c #4269D5", -"]+ c #3E65D7", -"^+ c #C9CAC9", -"/+ c #869EE9", -"(+ c #859FE9", -"_+ c #849FE9", -":+ c #829DE8", -"<+ c #819DE8", -"[+ c #7B9AE9", -"}+ c #7A96E6", -"|+ c #7290E8", -"1+ c #698CE6", -"2+ c #6689E0", -"3+ c #5D84E0", -"4+ c #587FDF", -"5+ c #5377DD", -"6+ c #4B74DE", -"7+ c #496BD8", -"8+ c #7C9BE9", -"9+ c #7E9CE9", -"0+ c #7D9AEA", -"a+ c #7D9BEA", -"b+ c #7D98E8", -"c+ c #7C98E8", -"d+ c #7796E4", -"e+ c #7592E6", -"f+ c #7390E1", -"g+ c #698DE0", -"h+ c #6588DE", -"i+ c #5E84E0", -"j+ c #5880DF", -"k+ c #5479DC", -"l+ c #4F75DE", -"m+ c #4A6FDB", -"n+ c #436AD7", -"o+ c #3F65D7", -"p+ c #BAC3BE", -"q+ c #7B9AE8", -"r+ c #7B9AEA", -"s+ c #7A9AEA", -"t+ c #7B99E9", -"u+ c #7D97E7", -"v+ c #7D95E6", -"w+ c #7D95E5", -"x+ c #7C95E6", -"y+ c #7493E3", -"z+ c #7290DF", -"A+ c #6C8DDE", -"B+ c #6B89E1", -"C+ c #6486DF", -"D+ c #5D81DF", -"E+ c #567DDE", -"F+ c #4F73DE", -"G+ c #496EDA", -"H+ c #355ED6", -"I+ c #345ED5", -"J+ c #7E95E5", -"K+ c #7C97E8", -"L+ c #7C97E7", -"M+ c #7B94E6", -"N+ c #7A95E4", -"O+ c #7695E5", -"P+ c #7694E4", -"Q+ c #7994E6", -"R+ c #7995E4", -"S+ c #7594E4", -"T+ c #7391E2", -"U+ c #6E8EDE", -"V+ c #6B8ADE", -"W+ c #6688DF", -"X+ c #5F84E0", -"Y+ c #5980E0", -"Z+ c #4D72DD", -"`+ c #456BD7", -" @ c #4168D6", -".@ c #3C64D7", -"+@ c #335ED0", -"@@ c #4659C7", -"#@ c #7292E1", -"$@ c #7392E1", -"%@ c #7492E1", -"&@ c #718FDF", -"*@ c #6F8EDE", -"=@ c #6D8BDE", -"-@ c #6B88DF", -";@ c #597FDF", -">@ c #557ADD", -",@ c #5176DC", -"'@ c #4D74DD", -")@ c #496DDA", -"!@ c #3860D8", -"~@ c #7391E0", -"{@ c #7290DE", -"]@ c #6D8EDD", -"^@ c #6D8DDD", -"/@ c #7190E0", -"(@ c #6C8DDD", -"_@ c #6B89DF", -":@ c #6487E0", -"<@ c #6085DF", -"[@ c #5F81DE", -"}@ c #567EDE", -"|@ c #4F74D9", -"1@ c #466BD7", -"2@ c #4067D5", -"3@ c #3C63D7", -"4@ c #335ED3", -"5@ c #335ED1", -"6@ c #718EDD", -"7@ c #728EDD", -"8@ c #748EDD", -"9@ c #708EDD", -"0@ c #6F8DDD", -"a@ c #6E8DDD", -"b@ c #6C8ADE", -"c@ c #6C89DF", -"d@ c #6988DF", -"e@ c #6387DF", -"f@ c #6282DE", -"g@ c #5681E0", -"h@ c #577BDD", -"i@ c #5277DB", -"j@ c #4D73D8", -"k@ c #4A70D8", -"l@ c #436AD5", -"m@ c #3F66D6", -"n@ c #3C63D8", -"o@ c #3960D8", -"p@ c #3860D7", -"q@ c #335ED2", -"r@ c #345ED4", -"s@ c #6C88DF", -"t@ c #6D88DF", -"u@ c #6B89DE", -"v@ c #6888DF", -"w@ c #6587E0", -"x@ c #6989DF", -"y@ c #6687E0", -"z@ c #6287E0", -"A@ c #6281DD", -"B@ c #5881E0", -"C@ c #557ADB", -"D@ c #5176D9", -"E@ c #4E75D7", -"F@ c #4A6FD8", -"G@ c #476BD6", -"H@ c #4067D6", -"I@ c #3C62D7", -"J@ c #3C60D4", -"K@ c #365ED1", -"L@ c #345ED3", -"M@ c #6786DF", -"N@ c #5F85E0", -"O@ c #5F86E0", -"P@ c #6186DF", -"Q@ c #6286E0", -"R@ c #6284DF", -"S@ c #6384DF", -"T@ c #5B7FDE", -"U@ c #577DDC", -"V@ c #557BDA", -"W@ c #5278D8", -"X@ c #4E76D6", -"Y@ c #4C72D7", -"Z@ c #486DD8", -"`@ c #4469D6", -" # c #3F62D2", -".# c #3C60CF", -"+# c #345ECF", -"@# c #6086DF", -"## c #6085E0", -"$# c #6285DF", -"%# c #6383DD", -"&# c #6481DC", -"*# c #6380DD", -"=# c #6183DE", -"-# c #6083DD", -";# c #6081DC", -"># c #6080DD", -",# c #6083DE", -"'# c #6181DC", -")# c #6280DD", -"!# c #577EDB", -"~# c #557CD7", -"{# c #4F76D6", -"]# c #4E74D7", -"^# c #466CD7", -"/# c #3B64D6", -"(# c #4261CD", -"_# c #375FCE", -":# c #5A7FD8", -"<# c #6281DA", -"[# c #5F81D8", -"}# c #5C80D8", -"|# c #557DD7", -"1# c #577ED8", -"2# c #567ED7", -"3# c #587DD8", -"4# c #577DD8", -"5# c #587ED8", -"6# c #567DD8", -"7# c #5379D9", -"8# c #5177D7", -"9# c #4D74D5", -"0# c #486ED9", -"a# c #4068D4", -"b# c #3D65D2", -"c# c #4361CC", -"d# c #345ECE", -"e# c #325DCF", -"f# c #2C5AD1", -"g# c #3959C5", -"h# c #547BD8", -"i# c #567DD7", -"j# c #557BD8", -"k# c #5279D9", -"l# c #5278D9", -"m# c #4D74D6", -"n# c #4B71D8", -"o# c #496CD8", -"p# c #4669D7", -"q# c #3D66D3", -"r# c #3F62CF", -"s# c #4260CC", -"t# c #5379D8", -"u# c #4E75D4", -"v# c #4C73D7", -"w# c #476CD7", -"x# c #4869D0", -"y# c #4067D2", -"z# c #3D64D1", -"A# c #4261CC", -"B# c #395FCE", -"C# c #4F75D3", -"D# c #5074D2", -"E# c #5174D1", -"F# c #5175D1", -"G# c #4F74D3", -"H# c #4C73D5", -"I# c #4C73D4", -"J# c #4A72D1", -"K# c #4B70CF", -"L# c #506CCC", -"M# c #4D6BCE", -"N# c #4167D0", -"O# c #3D65D1", -"P# c #3F63CF", -"Q# c #3B5FCD", -"R# c #3159CD", -"S# c #4971D0", -"T# c #4870CF", -"U# c #4C6FCF", -"V# c #4E6CCE", -"W# c #4E6BCE", -"X# c #4769CF", -"Y# c #3D66D0", -"Z# c #3C65D1", -"`# c #4062CE", -" $ c #3D5FCD", -".$ c #365FCF", -"+$ c #325DCD", -"@$ c #2D5AD0", -"#$ c #3859C5", -"$$ c #355FCF", -"%$ c #355ECF", -"&$ c #335ECE", -"*$ c #305CCD", -"=$ c #2B5ACE", -"-$ c #3056C9", -";$ c #2553C6", -">$ c #2153C8", -",$ c #1F4FC7", -"'$ c #274CC5", -")$ c #214AC7", -"!$ c #1C48C8", -"~$ c #1244C9", -"{$ c #1043C9", -"]$ c #1144C9", -"^$ c #2A45BE", -"/$ c #2744B5", -"($ c #1D49C0", -"_$ c #2B58DE", -":$ c #002D94", -"<$ c #2B59CA", -"[$ c #2A59CA", -"}$ c #2E57C8", -"|$ c #3255C6", -"1$ c #3355C5", -"2$ c #1C52C8", -"3$ c #1D50C7", -"4$ c #234FC6", -"5$ c #264CC5", -"6$ c #1D48C7", -"7$ c #1245C8", -"8$ c #1F44C2", -"9$ c #2945BE", -"0$ c #2A45BD", -"a$ c #2040BF", -"b$ c #3156C7", -"c$ c #3056C7", -"d$ c #3354C5", -"e$ c #3355C6", -"f$ c #3255C5", -"g$ c #3254C5", -"h$ c #1952C7", -"i$ c #1951C8", -"j$ c #2050C7", -"k$ c #274CC4", -"l$ c #244CC6", -"m$ c #1F49C7", -"n$ c #1E47C5", -"o$ c #2045C3", -"p$ c #1C44BF", -"q$ c #2045BE", -"r$ c #2040B8", -"s$ c #3254C6", -"t$ c #3055C6", -"u$ c #2A54C6", -"v$ c #2353C7", -"w$ c #3054C5", -"x$ c #2F55C5", -"y$ c #2A54C5", -"z$ c #2553C5", -"A$ c #2F54C5", -"B$ c #3155C6", -"C$ c #2A54C7", -"D$ c #1A52C8", -"E$ c #204FC2", -"F$ c #264DC6", -"G$ c #234BC5", -"H$ c #1D48C1", -"I$ c #1E48BF", -"J$ c #2646BE", -"K$ c #2B45BD", -"L$ c #1E43BE", -"M$ c #2643BF", -"N$ c #2243BF", -"O$ c #3049BC", -"P$ c #1E50BE", -"Q$ c #1D50C0", -"R$ c #1D50BF", -"S$ c #1852C1", -"T$ c #1E51C0", -"U$ c #214FBF", -"V$ c #2050C0", -"W$ c #244EBF", -"X$ c #2151C0", -"Y$ c #234FBF", -"Z$ c #2350C0", -"`$ c #2351C0", -" % c #244FBF", -".% c #2250C0", -"+% c #2051C0", -"@% c #1E50C0", -"#% c #244DBE", -"$% c #274DBF", -"%% c #244CBF", -"&% c #1C48C0", -"*% c #2247BF", -"=% c #2C44BD", -"-% c #1C44BE", -";% c #1444BF", -">% c #1841BF", -",% c #1F40BF", -"'% c #254DBE", -")% c #224FBE", -"!% c #224FBF", -"~% c #234EBF", -"{% c #254CBD", -"]% c #244DBD", -"^% c #244CBD", -"/% c #264DBE", -"(% c #264DBD", -"_% c #214BC0", -":% c #1D48C0", -"<% c #2347BF", -"[% c #2B44BD", -"}% c #2444BE", -"|% c #0F42BF", -"1% c #0641BF", -"2% c #0F41BF", -"3% c #1741BE", -"4% c #1F40BD", -"5% c #234BBF", -"6% c #234CBE", -"7% c #214BBE", -"8% c #244CBE", -"9% c #214ABE", -"0% c #214ABF", -"a% c #1F48C0", -"b% c #2746BE", -"c% c #1F43BE", -"d% c #0941BE", -"e% c #0342BA", -"f% c #0242BC", -"g% c #1241B8", -"h% c #1F40B7", -"i% c #2F41AC", -"j% c #2644AE", -"k% c #2D49B4", -"l% c #2649B6", -"m% c #2949B7", -"n% c #2849B5", -"o% c #2149B8", -"p% c #1E49B9", -"q% c #1F48B8", -"r% c #1F49B9", -"s% c #2545B6", -"t% c #2744B7", -"u% c #2844B7", -"v% c #2043B8", -"w% c #1241B7", -"x% c #1340B8", -"y% c #0D41B8", -"z% c #1941B8", -"A% c #1F40B8", -"B% c #203FB8", -"C% c #2549B5", -"D% c #2648B6", -"E% c #2547B7", -"F% c #2248B7", -"G% c #2048B7", -"H% c #2346B6", -"I% c #2146B6", -"J% c #2247B7", -"K% c #2148B7", -"L% c #2743B4", -"M% c #2643B5", -"N% c #2542B6", -"O% c #1D42B7", -"P% c #0E42B8", -"Q% c #0C41B8", -"R% c #1341B8", -"S% c #1740B8", -"T% c #1C41B8", -"U% c #1F40B1", -"V% c #2644B5", -"W% c #2544B5", -"X% c #2544B4", -"Y% c #2444B5", -"Z% c #2444B4", -"`% c #2744B4", -" & c #2241B7", -".& c #1D41B8", -"+& c #0B42B8", -"@& c #0942B8", -"#& c #0C42B8", -"$& c #0F41B8", -"%& c #1641B8", -"&& c #2442B5", -"*& c #2543B3", -"=& c #2342B2", -"-& c #2341B4", -";& c #2141B3", -">& c #2141B5", -",& c #2140B5", -"'& c #2040B5", -")& c #1C40B7", -"!& c #1B41B3", -"~& c #0142B6", -"{& c #0E41B7", -"]& c #1141B7", -"^& c #1440B2", -"/& c #113FB0", -"(& c #1440B0", -"_& c #213EAF", -":& c #233DAE", -"<& c #223EAF", -"[& c #1E40B1", -"}& c #173EAD", -"|& c #1440AF", -"1& c #0D40AF", -"2& c #0941B0", -"3& c #0D3FAE", -"4& c #1B3CAC", -"5& c #233CAD", -"6& c #203FB0", -"7& c #273BAD", -"8& c #1D40B0", -"9& c #2040B1", -"0& c #1E40B0", -"a& c #1C40B0", -"b& c #1B3DAC", -"c& c #143DAC", -"d& c #193DAD", -"e& c #1B3DAD", -"f& c #173DAD", -"g& c #153DAC", -"h& c #1C3CAC", -"i& c #243CAD", -"j& c #213FB0", -"k& c #263BAA", -"l& c #253CAE", -"m& c #273AAC", -"n& c #273AAD", -"o& c #253BAD", -"p& c #1D3CAC", -"q& c #243BAD", -"r& c #1E3CAC", -"s& c #263BAD", -"t& c #1A3DAC", -"u& c #143DAB", -"v& c #163DAC", -"w& c #1A3CAC", -"x& c #1F3CAD", -"y& c #263BAB", -"z& c #263BA6", -"A& c #1E42A4", -"B& c #2D40A5", -"C& c #253BA6", -"D& c #253CA7", -"E& c #263AA5", -"F& c #253BA7", -"G& c #1E3BA6", -"H& c #193DA6", -"I& c #173DA5", -"J& c #143DA6", -"K& c #1A3DA7", -"L& c #133DA6", -"M& c #123DA5", -"N& c #1A3CA7", -"O& c #243BA6", -"P& c #263AA7", -"Q& c #273BA7", -"R& c #263AA6", -"S& c #223BA6", -"T& c #1D3BA6", -"U& c #173CA6", -"V& c #133DA5", -"W& c #1B3DA6", -"X& c #193DA5", -"Y& c #123DA4", -"Z& c #163CA5", -"`& c #213CA6", -" * c #273BA8", -".* c #263BA7", -"+* c #253BA5", -"@* c #263BA5", -"#* c #1C3BA6", -"$* c #1B3BA9", -"%* c #133BA8", -"&* c #0A3BA7", -"** c #083AA6", -"=* c #123CA5", -"-* c #0839A8", -";* c #0239A6", -">* c #123AA8", -",* c #1F49C8", -"'* c #2F4DA4", -")* c #2E4DA3", -"!* c #384CA4", -"~* c #3C4DA7", -"{* c #394EA7", -"]* c #3B4CA5", -"^* c #3C52B1", -"/* c #3551A8", -"(* c #3759BE", -"_* c #4161C7", -":* c #0033A8", -"<* c #596FA9", -"[* c #2F4DA3", -"}* c #2D4BA5", -"|* c #2E4CA4", -"1* c #2C4AA5", -"2* c #2D4BA4", -"3* c #354DA4", -"4* c #3A4BA4", -"5* c #394DA6", -"6* c #4056AD", -"7* c #445BBB", -"8* c #B5B7B4", -"9* c #1B2F85", -"0* c #242F79", -"a* c #B5B5B5", -"b* c #B5B2B6", -"c* c #C0C3C3", -"d* c #E3E3E4", -"e* c #EBEDEA", -". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ", -"2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ", -"j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ", -"Z ` . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ", -"9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ", -"-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ", -" +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ", -"/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ", -"8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ", -"q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.", -"J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @4.4..@5.5.5.5.5.5.Y.Y.Y.I+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ", -"#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @4.X.5.5.H+Y.Y.Y.!@Y.Y.I++@+@Z.Z.+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", -"#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@3@5.5.5.Y.Y.I+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ", -"6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@p@Y.I+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", -"s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ", -"M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.", -"@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ", -":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.", -"h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ", -"l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.", -"C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ", -"S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.", -"+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ", -"<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.", -"b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ", -"e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.", -"P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ", -"'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.", -"5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ", -"k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", -"C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ", -"/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", -"&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ", -"U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.", -"U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ", -"k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.", -"C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ", -"z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.", -"z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ", -"'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ", -"'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ", -"9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ", -"a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ", -"c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ", -"d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ", -"e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "}; - - -static char * tabmiddle_xpm[] = { -"33 42 32 1", -" c None", -". c #CECFEF", -"+ c #CECBE7", -"@ c #C6C7E7", -"# c #C6CBE7", -"$ c #BDBEDE", -"% c #BDC3DE", -"& c #CECBEF", -"* c #B5B6D6", -"= c #ADAECE", -"- c #ADB2CE", -"; c #BDBAD6", -"> c #B5BAD6", -", c #C6C3DE", -"' c #ADAAC6", -") c #B5B2CE", -"! c #B5B6CE", -"~ c #A5A2BD", -"{ c #A5A6BD", -"] c #9C9EB5", -"^ c #9CA2BD", -"/ c #ADAEC6", -"( c #C6C3E7", -"_ c #9C9AB5", -": c #A5A6C6", -"< c #949AAD", -"[ c #A5AAC6", -"} c #9496AD", -"| c #BDBADE", -"1 c #BDBED6", -"2 c #9CA2B5", -"3 c #A5AABD", -"..........................+@.#.#.", -"........................$@%&#.#..", -"......................**$$@@&#.#.", -".....................=-;>,%+@.#..", -"....................'')!$$@@&#.#.", -"...................~{=)$$@@&#.#..", -"..................]^'/;;(%&#.#...", -"................._]:/*>,%&@.#.#..", -".................<{[)!$%+@.#.#...", -"................}~{=!$%@@.#......", -"................]^/-|$@@.#.......", -"................]'/*;@@&#........", -"...............<~[)>,%&#.#.......", -"...............]~=)$%+#.#........", -"...............]'/;1@@.#.........", -"...............~{)*,%&#..........", -"...............2/-$$@#...........", -"...............~[*>(@&#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>@@.#..........", -"...............^=!$%&#...........", -"...............{/*;@@.#..........", -"...............{)!$%&#...........", -"..............]'/;1@@.#..........", -"..............23)>,%&#...........", -"..............~=-$$@@.#..........", -".............]{/*;@@.#...........", -"............<^[)>,%&#............", -"............]{/!$%@@.#...........", -"..........]^[-!$%@@.#............", -".........]^3/!>$@@.#.............", -".......<]^3/!>$@@&#..............", -".....<]2{[/!>$%@&#.#.............", -"}<<_]2{3/-!>$%@&#.#.............."}; - - -static char * tabselectedbeginn_xpm[] = { -"33 39 28 1", -" c None", -". c #CECFEF", -"+ c #EFF3EF", -"@ c #FFFBFF", -"# c #F7FBF7", -"$ c #FFFFFF", -"% c #EFEFEF", -"& c #F7F7F7", -"* c #DEDFDE", -"= c #E7E7E7", -"- c #D6D3D6", -"; c #DEE3DE", -"> c #EFEBEF", -", c #F7F3F7", -"' c #CECBCE", -") c #CECFCE", -"! c #D6D7D6", -"~ c #DEDBDE", -"{ c #E7EBE7", -"] c #C6C7C6", -"^ c #E7E3E7", -"/ c #BDC3BD", -"( c #CED3CE", -"_ c #BDBABD", -": c #C6C3C6", -"< c #C6CBC6", -"[ c #D6DBD6", -"} c #BDBEBD", -"..........................+@#$#$$", -"........................%%&&@#$#$", -"......................*==%%&&@#$$", -"....................--*;>%,&@#$#$", -"...................')!~={,+@#$#$$", -"...................]-!^=%%&&@#$#$", -"................../'(~;>%&&@#$#$$", -"................._])!*={,&@#$#$$$", -"................_])~*>%&&$#$$$$$$", -"................:<![={&&@#$$$$$$$", -"................:)!^=,+@#$$$$$$$$", -"...............}'(*^%+@#$#$$$$$$$", -"...............:<!*>%&&$#$$$$$$$$", -".............../)!^{,&@#$$$$$$$$$", -"...............](*^%+@#$$$$$$$$$$", -"...............]!~=%&&$$$$$$$$$$$", -"...............'(*=,+@#$$$$$$$$$$", -"...............<!*>%&&$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'!^=,&@#$$$$$$$$$$", -"...............<~*>%&#$$$$$$$$$$$", -"...............)!^{,&@#$$$$$$$$$$", -"..............])~;%+@#$$$$$$$$$$$", -"..............]-[={&&$#$$$$$$$$$$", -".............])!^=,&@#$$$$$$$$$$$", -"............:'-*^%+@#$$$$$$$$$$$$", -"............])~*>%&&$#$$$$$$$$$$$", -"...........:'!*={,&@#$$$$$$$$$$$$", -"..........:'-~^=,+@#$$$$$$$$$$$$$", -".......}]'-~^=%,&@#$$$$$$$$$$$$$$", -".....}:])-~^=%,+@#$#$$$$$$$$$$$$$", -"}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"}; - - -static char * tabselectedend_xpm[] = { -"33 42 33 1", -" c None", -". c #FFFFFF", -"+ c #CECBE7", -"@ c #C6C7E7", -"# c #CECFEF", -"$ c #C6CBE7", -"% c #BDBEDE", -"& c #BDC3DE", -"* c #CECBEF", -"= c #B5B6D6", -"- c #ADAECE", -"; c #ADB2CE", -"> c #BDBAD6", -", c #B5BAD6", -"' c #C6C3DE", -") c #ADAAC6", -"! c #B5B2CE", -"~ c #B5B6CE", -"{ c #A5A2BD", -"] c #A5A6BD", -"^ c #9C9EB5", -"/ c #9CA2BD", -"( c #ADAEC6", -"_ c #C6C3E7", -": c #9C9AB5", -"< c #A5A6C6", -"[ c #949AAD", -"} c #A5AAC6", -"| c #9496AD", -"1 c #BDBADE", -"2 c #BDBED6", -"3 c #9CA2B5", -"4 c #A5AABD", -"..........................+@#$#$#", -"........................%@&*$#$##", -"......................==%%@@*$#$#", -".....................-;>,'&+@#$##", -"....................))!~%%@@*$#$#", -"...................{]-!%%@@*$#$##", -"..................^/)(>>_&*$#$###", -".................:^<(=,'&*@#$#$##", -".................[]}!~%&+@#$#$###", -"................|{]-~%&@@#$######", -"................^/(;1%@@#$#######", -"................^)(=>@@*$########", -"...............[{}!,'&*$#$#######", -"...............^{-!%&+$#$########", -"...............^)(>2@@#$#########", -"...............{]!='&*$##########", -"...............3(;%%@$###########", -"...............{}=,_@*$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,@@#$##########", -".............../-~%&*$###########", -"...............](=>@@#$##########", -"...............]!~%&*$###########", -"..............^)(>2@@#$##########", -"..............34!,'&*$###########", -"..............{-;%%@@#$##########", -".............^](=>@@#$###########", -"............[/}!,'&*$############", -"............^](~%&@@#$###########", -"..........^/};~%&@@#$############", -".........^/4(~,%@@#$#############", -".......[^/4(~,%@@*$##############", -".....[^3]}(~,%&@*$#$#############", -"|[[:^3]4(;~,%&@*$#$##############"}; - - -static char * tabend_xpm[] = { -"33 42 3 1", -" c None", -". c #CECFEF", -"+ c #FFFFFF", -"..........................+++++++", -"........................+++++++++", -"......................+++++++++++", -".....................++++++++++++", -"....................+++++++++++++", -"...................++++++++++++++", -"..................+++++++++++++++", -".................++++++++++++++++", -".................++++++++++++++++", -"................+++++++++++++++++", -"................+++++++++++++++++", -"................+++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"..............+++++++++++++++++++", -"..............+++++++++++++++++++", -"..............+++++++++++++++++++", -".............++++++++++++++++++++", -"............+++++++++++++++++++++", -"............+++++++++++++++++++++", -"..........+++++++++++++++++++++++", -".........++++++++++++++++++++++++", -".......++++++++++++++++++++++++++", -".....++++++++++++++++++++++++++++", -"+++++++++++++++++++++++++++++++++"}; - - - - -QColor fromHsl(QColor c) -{ - const qreal h = c.hueF(); - const qreal s = c.saturationF(); - const qreal l = c.valueF(); - - qreal ca[3] = {0, 0, 0}; - - if (s == 0 || h == 1) { - // achromatic case - ca[0] = ca[1] = ca[2] = l; - } else { - // chromatic case - qreal temp2; - if (l < qreal(0.5)) - temp2 = l * (qreal(1.0) + s); - else - temp2 = l + s - (l * s); - - const qreal temp1 = (qreal(2.0) * l) - temp2; - qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), - h, - h - (qreal(1.0) / qreal(3.0)) }; - - for (int i = 0; i != 3; ++i) { - if (temp3[i] < qreal(0.0)) - temp3[i] += qreal(1.0); - else if (temp3[i] > qreal(1.0)) - temp3[i] -= qreal(1.0); - - const qreal sixtemp3 = temp3[i] * qreal(6.0); - - if (sixtemp3 < qreal(1.0)) - ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3)); - else if ((temp3[i] * qreal(2.0)) < qreal(1.0)) - ca[i] = (temp2); - else if ((temp3[i] * qreal(3.0)) < qreal(2.0)) - ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0); - else ca[i] = temp1; - } - } - - return QColor::fromRgbF(ca[0], ca[1], ca[2]); -} - -#define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) -#define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) - -QColor toHsl(QColor c) -{ - QColor color; - qreal h; - qreal s; - qreal l; - - const qreal r = c.redF(); - const qreal g = c.greenF(); - const qreal b = c.blueF(); - const qreal max = Q_MAX_3(r, g, b); - const qreal min = Q_MIN_3(r, g, b); - const qreal delta = max - min; - const qreal delta2 = max + min; - const qreal lightness = qreal(0.5) * delta2; - l = (lightness); - if (qFuzzyIsNull(delta)) { - // achromatic case, hue is undefined - h = 0; - s = 0; - } else { - // chromatic case - qreal hue = 0; - if (lightness < qreal(0.5)) - s = ((delta / delta2)); - else - s = ((delta / (qreal(2.0) - delta2))); - if (qFuzzyCompare(r, max)) { - hue = ((g - b) /delta); - } else if (qFuzzyCompare(g, max)) { - hue = (2.0 + (b - r) / delta); - } else if (qFuzzyCompare(b, max)) { - hue = (4.0 + (r - g) / delta); - } else { - Q_ASSERT_X(false, "QColor::toHsv", "internal error"); - } - hue *= 60.0; - if (hue < 0.0) - hue += 360.0; - h = (hue * 100); - } - - h = h / 36000; - - return QColor::fromHsvF(h, s, l); -} - -void tintColor(QColor &color, QColor tintColor, qreal _saturation) -{ - tintColor = toHsl(tintColor); - color = toHsl(color); - qreal hue = tintColor.hueF(); - - qreal saturation = color.saturationF(); - if (_saturation) - saturation = _saturation; - qreal lightness = color.valueF(); - color.setHsvF(hue, saturation, lightness); - - color = fromHsl(color); - color.toRgb(); -} - -void tintImagePal(QImage *image, QColor color, qreal saturation) -{ - QVector<QRgb> colorTable = image->colorTable(); - for (int i=2;i< colorTable.size();i++) { - QColor c(toHsl(colorTable.at(i))); - tintColor(c, color, saturation); - colorTable[i] = c.rgb(); - } - image->setColorTable(colorTable); -} - - -void tintImage(QImage *image, QColor color, qreal saturation) -{ - *image = image->convertToFormat(QImage::Format_RGB32); - - for (int x = 0; x < image->width(); x++) - for (int y = 0; y < image->height(); y++) { - QColor c(image->pixel(x,y)); - tintColor(c, color, saturation); - image->setPixel(x, y, c.rgb()); - } -} - -#endif //Q_OS_WINCE_WM - - -enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight }; - -#ifdef Q_OS_WINCE_WM - -void QWindowsMobileStylePrivate::tintImagesButton(QColor color) -{ - if (currentTintButton == color) - return; - currentTintButton = color; - - imageTabEnd = QImage(tabend_xpm); - imageTabSelectedEnd = QImage(tabselectedend_xpm); - imageTabSelectedBegin = QImage(tabselectedbeginn_xpm); - imageTabMiddle = QImage(tabmiddle_xpm); - tintImage(&imageTabEnd, color, 0.0); - tintImage(&imageTabSelectedEnd, color, 0.0); - tintImage(&imageTabSelectedBegin, color, 0.0); - tintImage(&imageTabMiddle, color, 0.0); - - if (!doubleControls) { - int height = imageTabMiddle.height() / 2 + 1; - imageTabEnd = imageTabEnd.scaledToHeight(height); - imageTabMiddle = imageTabMiddle.scaledToHeight(height); - imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height); - imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height); - } -} - -void QWindowsMobileStylePrivate::tintImagesHigh(QColor color) -{ - if (currentTintHigh == color) - return; - currentTintHigh = color; - tintListViewHighlight(color); - imageScrollbarHandleUpHigh = imageScrollbarHandleUp; - imageScrollbarHandleDownHigh = imageScrollbarHandleDown; - tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8)); - tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8)); -} - -void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color) -{ - imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm); - tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0)); - - imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm); - tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0)); - - imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm); - tintImage(&imageListViewHighlightMiddle, color, qreal(0.0)); - - int height = imageListViewHighlightMiddle.height(); - if (!doubleControls) { - height = height / 2; - imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height); - imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height); - imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height); - } -} - -#endif //Q_OS_WINCE_WM - -void QWindowsMobileStylePrivate::setupWindowsMobileStyle65() -{ -#ifdef Q_OS_WINCE_WM - wm65 = qt_wince_is_windows_mobile_65(); - if (wm65) { - imageScrollbarHandleUp = QImage(sbhandleup_xpm); - imageScrollbarHandleDown = QImage(sbhandledown_xpm); - imageScrollbarGripUp = QImage(sbgripup_xpm); - imageScrollbarGripDown = QImage(sbgripdown_xpm); - imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm); - - if (!doubleControls) { - imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2); - imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2); - imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2); - imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2); - imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2); - } else { - } - tintImagesHigh(Qt::blue); - } -#endif //Q_OS_WINCE_WM -} - -void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab) -{ -#ifndef QT_NO_TABBAR -#ifdef Q_OS_WINCE_WM - if (wm65) { - tintImagesButton(tab->palette.button().color()); - QRect r; - r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0)); - r.setBottomRight(tab->rect.bottomRight()); - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.window()); - } else { - painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0))); - } - if (tab->selectedPosition == QStyleOptionTab::NextIsSelected) { - painter->drawImage(r, imageTabSelectedBegin); - } else if (tab->position == QStyleOptionTab::End || - tab->position == QStyleOptionTab::OnlyOneTab) { - if (!(tab->state & QStyle::State_Selected)) { - painter->drawImage(r, imageTabEnd); - } - } else if (tab->state & QStyle::State_Selected) { - painter->drawImage(r, imageTabSelectedEnd); - } else { - painter->drawImage(r, imageTabMiddle); - } - if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) { - painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd); - } - //imageTabBarBig - return; - } -#endif //Q_OS_WINCE_WM - painter->save(); - painter->setPen(tab->palette.shadow().color()); - if (doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - if(tab->shape == QTabBar::RoundedNorth) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.light()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - } - else if(tab->shape == QTabBar::RoundedSouth) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - if (doubleControls) - painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1)); - else - painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - } - else if(tab->shape == QTabBar::RoundedEast) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.light()); - painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft()); - painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); - } - } - else if(tab->shape == QTabBar::RoundedWest) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.light()); - painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); - } - } - painter->restore(); -#endif //QT_NO_TABBAR -} - -void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItem *option, QRect rect) -{ -#ifdef Q_OS_WINCE_WM - if (wm65) { - QRect r; - if (rect.isValid()) - r = rect; - else - r = option->rect; - tintImagesHigh(option->palette.highlight().color()); - - painter->setPen(QColor(Qt::lightGray)); - - if (option->viewItemPosition == QStyleOptionViewItem::Middle) { - painter->drawImage(r, imageListViewHighlightMiddle); - } else if (option->viewItemPosition == QStyleOptionViewItem::Beginning) { - painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle); - } else if (option->viewItemPosition == QStyleOptionViewItem::End) { - painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle); - } else { - painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle); - } - - QImage cornerLeft = imageListViewHighlightCornerLeft; - QImage cornerRight = imageListViewHighlightCornerRight; - - int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width(); - - if ((width * 2) > r.width()) { - width = (r.width() - 5) / 2; - } - - cornerLeft = cornerLeft.scaled(width, r.height()); - cornerRight = cornerRight.scaled(width, r.height()); - - if ((option->viewItemPosition == QStyleOptionViewItem::Beginning) || (option->viewItemPosition == QStyleOptionViewItem::OnlyOne) || !option->viewItemPosition) { - painter->drawImage(r.topLeft(), cornerLeft); - } - if ((option->viewItemPosition == QStyleOptionViewItem::End) || (option->viewItemPosition == QStyleOptionViewItem::OnlyOne) || !option->viewItemPosition) { - painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight); - } - return; - } -#endif //Q_OS_WINCE_WM - QPalette::ColorGroup cg = option->state & QStyle::State_Enabled - ? QPalette::Normal : QPalette::Disabled; - - if (rect.isValid()) - painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight)); - else - painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight)); -} - -void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame) -{ -#ifdef Q_OS_WINCE_WM - if (wm65) { - if (newScrollbar->orientation == Qt::Horizontal) { - QTransform transform; - transform.rotate(-90); - QRect r = newScrollbar->rect; - p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform)); - p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform)); - p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform)); - } else { - QRect r = newScrollbar->rect; - p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle); - p->drawImage(r.topLeft(), imageScrollbarGripUp); - p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown); - } - return ; - } -#endif - if (newScrollbar->orientation == Qt::Horizontal) { - p->fillRect(newScrollbar->rect,option->palette.button()); - QRect r = newScrollbar->rect; - p->drawLine(r.topLeft(), r.bottomLeft()); - p->drawLine(r.topRight(), r.bottomRight()); - if (smartphone) { - p->drawLine(r.topLeft(), r.topRight()); - p->drawLine(r.bottomLeft(), r.bottomRight()); - } - } - else { - p->fillRect(newScrollbar->rect,option->palette.button()); - QRect r = newScrollbar->rect; - p->drawLine(r.topLeft(), r.topRight()); - p->drawLine(r.bottomLeft(), r.bottomRight()); - if (smartphone) { - p->drawLine(r.topLeft(), r.bottomLeft()); - p->drawLine(r.topRight(), r.bottomRight()); - } - } - if (newScrollbar->state & QStyle::State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*newScrollbar); - fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2, - newScrollbar->rect.width() - 5, - newScrollbar->rect.height() - 5); - } - int gripMargin = doubleControls ? 4 : 2; - int doubleLines = doubleControls ? 2 : 1; - //If there is a frame around the scrollbar (abstractScrollArea), - //then the margin is different, because of the missing frame - int gripMarginFrame = doubleControls ? 3 : 1; - if (drawCompleteFrame) - gripMarginFrame = 0; - //draw grips - if (!smartphone) - if (newScrollbar->orientation == Qt::Horizontal) { - for (int i = -3; i < 3; i += 2) { - p->drawLine( - QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, - newScrollbar->rect.top() + gripMargin +gripMarginFrame), - QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, - newScrollbar->rect.bottom() - gripMargin)); - } - } else { - for (int i = -2; i < 4 ; i += 2) { - p->drawLine( - QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame , - newScrollbar->rect.center().y() + 1 + i * doubleLines - 1), - QPoint(newScrollbar->rect.right() - gripMargin, - newScrollbar->rect.center().y() + 1 + i * doubleLines - 1)); - } - } - if (!smartphone) { - QRect r; - if (doubleControls) - r = option->rect.adjusted(1, 1, -1, 0); - else - r = option->rect.adjusted(0, 0, -1, 0); - if (drawCompleteFrame && doubleControls) - r.adjust(0, 0, 0, -1); - //Check if the scrollbar is part of an abstractItemView and draw the frame according - if (drawCompleteFrame) - p->drawRect(r); - else - if (newScrollbar->orientation == Qt::Horizontal) - p->drawLine(r.topLeft(), r.topRight()); - else - p->drawLine(r.topLeft(), r.bottomLeft()); - } -} - -void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool ) -{ -#ifdef Q_OS_WINCE_WM - if (wm65) { - tintImagesHigh(opt->palette.highlight().color()); - QRect r = opt->rect; - if (opt->orientation == Qt::Horizontal) { - QTransform transform; - transform.rotate(-90); - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform)); - else - p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform)); - } else { - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh); - else - p->drawImage(r.topLeft(), imageScrollbarHandleUp); - } - return ; - } -#endif //Q_OS_WINCE_WM - - QBrush fill = opt->palette.button(); - if (opt->state & QStyle::State_Sunken) - fill = opt->palette.shadow(); - - QStyleOption arrowOpt = *opt; - if (doubleControls) - arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3); - else - arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); - - bool horizontal = (opt->orientation == Qt::Horizontal); - - if (horizontal) { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0,0,1,0); - p->drawLine(r.topRight(), r.bottomRight()); - if (doubleControls) - arrowOpt.rect.adjust(0, -2 ,0, -2); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0); - } else { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0, 0, 0, 1); - p->drawLine(r.bottomLeft(), r.bottomRight()); - if (completeFrame) - arrowOpt.rect.adjust(-2, 0, -2, 0); - if (doubleControls) - arrowOpt.rect.adjust(0, -4 , 0, -4); - if (completeFrame && doubleControls) - arrowOpt.rect.adjust(2, 0, 2, 0); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0); - } -} - -void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar) -{ -#ifndef QT_NO_SCROLLBAR -#ifdef Q_OS_WINCE_WM - if (wm65) { - tintImagesHigh(opt->palette.highlight().color()); - QRect r = opt->rect; - if (opt->orientation == Qt::Horizontal) { - QTransform transform; - transform.rotate(-90); - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform)); - else - p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform)); - } else { - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh); - else - p->drawImage(r.topLeft(), imageScrollbarHandleDown); - } - return ; - } -#endif //Q_OS_WINCE_WM - - QBrush fill = opt->palette.button(); - if (opt->state & QStyle::State_Sunken) - fill = opt->palette.shadow(); - - QStyleOption arrowOpt = *opt; - if (doubleControls) - arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3); - else - arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); - - bool horizontal = (opt->orientation == Qt::Horizontal); - - if (horizontal) { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0, 0, 0, 0); - p->drawLine(r.topLeft(), r.bottomLeft()); - if (secondScrollBar) - p->drawLine(r.topRight(), r.bottomRight()); - if (doubleControls) - arrowOpt.rect.adjust(0, 4, 0, 4 ); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0); - } else { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0, -1, 0, -1); - p->drawLine(r.topLeft(), r.topRight()); - if (secondScrollBar) - p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1)); - if (completeFrame) - arrowOpt.rect.adjust(-2, 0, -2, 0); - if (doubleControls) - arrowOpt.rect.adjust(1, 0, 1, 0 ); - if (completeFrame && doubleControls) - arrowOpt.rect.adjust(1, 0, 1, 0); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0); - } -#endif //QT_NO_SCROLLBAR -} - -void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt) -{ -#ifndef QT_NO_SCROLLBAR -#ifdef Q_OS_WINCE_WM - if (wm65) { - p->fillRect(opt->rect, QColor(231, 231, 231)); - return ; - } -#endif - QBrush fill; - if (smartphone) { - fill = opt->palette.light(); - p->fillRect(opt->rect, fill); - fill = opt->palette.button(); - QImage image; -#ifndef QT_NO_IMAGEFORMAT_XPM - if (opt->orientation == Qt::Horizontal) - image = QImage(vertlines_xpm); - else - image = QImage(horlines_xpm); -#endif - image.setColor(1, opt->palette.button().color().rgb()); - fill.setTextureImage(image); - } - else { - fill = opt->palette.light(); - } - p->fillRect(opt->rect, fill); -#endif //QT_NO_SCROLLBAR -} - -QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) { - qApp->setEffectEnabled(Qt::UI_FadeMenu, false); - qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); -} - -QWindowsMobileStyle::QWindowsMobileStyle() : QWindowsStyle(*new QWindowsMobileStylePrivate) { - qApp->setEffectEnabled(Qt::UI_FadeMenu, false); - qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); -} - -QWindowsMobileStyle::~QWindowsMobileStyle() -{ -} - -QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() { - -#ifdef Q_OS_WINCE - doubleControls = qt_wince_is_high_dpi(); - smartphone = qt_wince_is_smartphone(); -#else - doubleControls = false; - smartphone = false; -#endif //Q_OS_WINCE - -#ifndef QT_NO_IMAGEFORMAT_XPM - - imageArrowDown = QImage(arrowdown_xpm); - imageArrowUp = QImage(arrowdown_xpm).mirrored(); - imageArrowLeft = QImage(arrowleft_xpm); - imageArrowRight = QImage(arrowleft_xpm).mirrored(true, false); - if (doubleControls) { - imageRadioButton = QImage(radiobutton_xpm); - imageRadioButtonChecked = QImage(radiochecked_xpm); - imageChecked = QImage(checkedlight_xpm); - imageCheckedBold = QImage(checkedbold_xpm); - imageRadioButtonHighlighted = QImage(highlightedradiobutton_xpm); - imageClose = QImage(cross_big_xpm); - imageMaximize = QImage(max_big_xpm); - imageMinimize = QImage(min_big_xpm); - imageNormalize = QImage(normal_big_xpm); - } else { - imageRadioButton = QImage(radiobutton_low_xpm); - imageRadioButtonChecked = QImage(radiochecked_low_xpm); - imageChecked = QImage(checkedlight_low_xpm); - imageCheckedBold = QImage(checkedbold_low_xpm); - imageRadioButtonHighlighted = QImage(highlightedradiobutton_low_xpm); - imageClose = QImage(cross_small_xpm); - imageMaximize = QImage(max_small_xpm); - imageMinimize = QImage(min_small_xpm); - imageNormalize = QImage(normal_small_xpm); - } - - setupWindowsMobileStyle65(); - - - imageArrowDownBig = QImage(arrowdown_big_xpm); - imageArrowUpBig = QImage(arrowdown_big_xpm).mirrored(); - imageArrowLeftBig = QImage(arrowleft_big_xpm); - imageArrowRightBig = QImage(arrowleft_big_xpm).mirrored(true, false); - -#endif -} - -void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - bool doRestore = false; - QRect rect = option->rect; - painter->setClipping(false); - - switch (element) { - case PE_PanelButtonTool: { - int penSize = 1; - if (d->doubleControls) - penSize = 2; - if (widget) - if (QWidget *parent = widget->parentWidget()) -#ifndef QT_NO_TABWIDGET - if (qobject_cast<QTabWidget *>(parent->parentWidget())) { -#else - if (false) { -#endif //QT_NO_TABBAR - rect.adjust(0,2*penSize,0,-1*penSize); - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); - if (option->state & (State_Sunken)) - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.shadow()); - } - else { - if (!(option->state & State_AutoRaise) || (option->state & (State_Sunken | State_On))) - qDrawPlainRect(painter,option->rect.adjusted(0, penSize, 0, -1 * penSize) , - option->palette.button().color(), 0, &option->palette.button()); - if (option->state & (State_Sunken)) { - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); - } - if (option->state & (State_On)){ - QBrush fill = QBrush(option->palette.light().color()); - painter->fillRect(rect.adjusted(windowsItemFrame , windowsItemFrame , - -windowsItemFrame , -windowsItemFrame ), fill); - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); - } - } - break; } - case PE_IndicatorButtonDropDown: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.button()); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.button()); - break; -#ifndef QT_NO_TABBAR - case PE_IndicatorTabTear: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - bool rtl = tab->direction == Qt::RightToLeft; - QRect rect = tab->rect; - QPainterPath path; - rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); - rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); - path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); - int count = 3; - for(int jags = 1; jags <= count; ++jags, rtl = !rtl) - path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); - painter->setPen(QPen(tab->palette.light(), qreal(.8))); - painter->setBrush(tab->palette.background()); - painter->setRenderHint(QPainter::Antialiasing); - painter->drawPath(path); - } - break; -#endif //QT_NO_TABBAR - -#ifndef QT_NO_TOOLBAR - case PE_IndicatorToolBarSeparator: { - painter->save(); - QPoint p1, p2; - if (option->state & State_Horizontal) { - p1 = QPoint(option->rect.width()/2, 0); - p2 = QPoint(p1.x(), option->rect.height()); - } else { - p1 = QPoint(0, option->rect.height()/2); - p2 = QPoint(option->rect.width(), p1.y()); - } - - - painter->setPen(option->palette.mid().color()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - painter->drawLine(p1, p2); - painter->restore(); - break; } -#endif // QT_NO_TOOLBAR - case PE_IndicatorToolBarHandle: - painter->save(); - painter->translate(option->rect.x(), option->rect.y()); - if (option->state & State_Horizontal) { - int x = option->rect.width() / 2 - 4; - if (QApplication::layoutDirection() == Qt::RightToLeft) - x -= 2; - if (option->rect.height() > 4) { - qDrawWinButton(painter,x-1,0,7,option->rect.height(), option->palette, false, 0); - - qDrawShadePanel(painter, x, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - qDrawShadePanel(painter, x + 3, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - painter->setPen(option->palette.button().color()); - } - } else { - if (option->rect.width() > 4) { - int y = option->rect.height() / 2 - 4; - qDrawShadePanel(painter, 2, y, option->rect.width() - 2, 3, - option->palette, false, 0); - qDrawShadePanel(painter, 2, y + 3, option->rect.width() - 2, 3, - option->palette, false, 0); - } - } - painter->restore(); - break; - -#ifndef QT_NO_PROGRESSBAR - case PE_IndicatorProgressChunk: { - bool vertical = false; - if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) - vertical = pb->orientation == Qt::Vertical; - if (!vertical) { - painter->fillRect(option->rect.x(), option->rect.y()+2, option->rect.width(), option->rect.height()-4, - option->palette.brush(QPalette::Highlight)); - } else { - painter->fillRect(option->rect.x()+2, option->rect.y(), option->rect.width()-4, option->rect.height(), - option->palette.brush(QPalette::Highlight)); - } - } - break; -#endif // QT_NO_PROGRESSBAR - - case PE_FrameButtonTool: { -#ifndef QT_NO_DOCKWIDGET - if (widget && widget->inherits("QDockWidgetTitleButton")) { - if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent())) - if (dw->isFloating()){ - qDrawPlainRect(painter,option->rect.adjusted(1, 1, 0, 0), - option->palette.shadow().color(),1,&option->palette.button()); - return; - } - } -#endif // QT_NO_DOCKWIDGET - QBrush fill; - bool stippled; - bool panel = (element == PE_PanelButtonTool); - if ((!(option->state & State_Sunken )) - && (!(option->state & State_Enabled) - || ((option->state & State_Enabled ) && !(option->state & State_MouseOver))) - && (option->state & State_On)) { - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - stippled = true; - } else { - fill = option->palette.brush(QPalette::Button); - stippled = false; - } - if (option->state & (State_Raised | State_Sunken | State_On)) { - if (option->state & State_AutoRaise) { - if(option->state & (State_Enabled | State_Sunken | State_On)){ - if (panel) - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); - else - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); - } - if (stippled) { - painter->setPen(option->palette.button().color()); - painter->drawRect(option->rect.adjusted(1, 1, -2, -2)); - } - } else { - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); - } - } else { - painter->fillRect(option->rect, fill); - } - break; } - - case PE_FrameFocusRect: - if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) { - //### check for d->alt_down - int penSize; - d->doubleControls ? penSize = 2 : penSize = 1; - bool alternateFocusStyle = false; - if (!widget) - alternateFocusStyle = true; -#ifndef QT_NO_COMBOBOX - if (qobject_cast<const QComboBox*>(widget)) - alternateFocusStyle = true; -#endif - if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, option)) - return; - QRect r = option->rect; - painter->save(); - painter->setBackgroundMode(Qt::TransparentMode); - if (alternateFocusStyle) { - QColor bg_col = fropt->backgroundColor; - if (!bg_col.isValid()) - bg_col = painter->background().color(); - // Create an "XOR" color. - QColor patternCol((bg_col.red() ^ 0xff) & 0xff, - (bg_col.green() ^ 0xff) & 0xff, - (bg_col.blue() ^ 0xff) & 0xff); - painter->setBrush(QBrush(patternCol, Qt::Dense4Pattern)); - painter->setBrushOrigin(r.topLeft()); - } - else { - painter->setPen(option->palette.highlight().color()); - painter->setBrush(option->palette.highlight()); - } - painter->setPen(Qt::NoPen); - painter->setBrushOrigin(r.topLeft()); - painter->drawRect(r.left(), r.top(), r.width(), penSize); // Top - painter->drawRect(r.left(), r.bottom(), r.width() + penSize - 1, penSize); // Bottom - painter->drawRect(r.left(), r.top(), penSize, r.height()); // Left - painter->drawRect(r.right(), r.top(), penSize, r.height()); // Right - painter->restore(); - } - break; - - case PE_PanelButtonBevel: { - QBrush fill; - bool panel = element != PE_FrameButtonBevel; - painter->setBrushOrigin(option->rect.topLeft()); - if (!(option->state & State_Sunken) && (option->state & State_On)) - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - else - fill = option->palette.brush(QPalette::Button); - - if (option->state & (State_Raised | State_On | State_Sunken)) { - if (d->doubleControls) - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),2,&fill); - else - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),1,&fill); - } else { - if (panel) - painter->fillRect(option->rect, fill); - else - painter->drawRect(option->rect); - } - break; } - - case PE_FrameGroupBox: - if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - - if (!(frame->features & QStyleOptionFrame::Flat)) { - QPen oldPen = painter->pen(); - QRect r = frame->rect; - painter->setPen(frame->palette.shadow().color()); - painter->fillRect(r.x(), r.y(), r.x() + r.width()-1, - r.y() + r.height() - windowsMobileFrameGroupBoxOffset, - frame->palette.light()); - painter ->drawLine(r.topLeft() + QPoint(-2, 1), r.topRight()+ QPoint(0, 1)); - if (d->doubleControls) - painter ->drawLine(r.topLeft() + QPoint(-2, 2), r.topRight()+ QPoint(0, 2)); - painter->setPen(oldPen); - } - } - break; - - case PE_IndicatorCheckBox: { - QBrush fill; - QRect r = d->doubleControls ? option->rect.adjusted(0,1,0,-1) : option->rect; - if (option->state & State_NoChange) - fill = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern); - else if (option->state & State_Sunken) - fill = option->palette.button(); - else if (option->state & State_Enabled) - fill = option->palette.base(); - else - fill = option->palette.background(); - painter->save(); - doRestore = true; - if (d->doubleControls && (option->state & State_NoChange)) - painter->fillRect(r, fill); - else - painter->fillRect(option->rect, fill); - painter->setPen(option->palette.shadow().color()); - painter->drawLine(r.topLeft(), r.topRight()); - painter->drawLine(r.topRight(), r.bottomRight()); - painter->drawLine(r.bottomLeft(), r.bottomRight()); - painter->drawLine(r.bottomLeft(), r.topLeft()); - if (d->doubleControls) { - QRect r0 = r.adjusted(1, 1, -1, -1); - painter->drawLine(r0.topLeft(), r0.topRight()); - painter->drawLine(r0.topRight(), r0.bottomRight()); - painter->drawLine(r0.bottomLeft(), r0.bottomRight()); - painter->drawLine(r0.bottomLeft(), r0.topLeft()); - } - if (option->state & State_HasFocus) { - painter->setPen(option->palette.highlight().color()); - QRect r2 = d->doubleControls ? r.adjusted(2, 2, -2, -2) : r.adjusted(1, 1, -1, -1); - painter->drawLine(r2.topLeft(), r2.topRight()); - painter->drawLine(r2.topRight(), r2.bottomRight()); - painter->drawLine(r2.bottomLeft(), r2.bottomRight()); - painter->drawLine(r2.bottomLeft(), r2.topLeft()); - if (d->doubleControls) { - QRect r3 = r2.adjusted(1, 1, -1, -1); - painter->drawLine(r3.topLeft(), r3.topRight()); - painter->drawLine(r3.topRight(), r3.bottomRight()); - painter->drawLine(r3.bottomLeft(), r3.bottomRight()); - painter->drawLine(r3.bottomLeft(), r3.topLeft()); - } - painter->setPen(option->palette.shadow().color()); - } - //fall through... - } - case PE_IndicatorViewItemCheck: { - if (!doRestore) { - painter->save(); - doRestore = true; - } - if (element == PE_IndicatorViewItemCheck) { - painter->setPen(option->palette.shadow().color()); - if (option->state & State_NoChange) - painter->setBrush(option->palette.brush(QPalette::Button)); - if (d->doubleControls) { - QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize * 2, windowsMobileitemViewCheckBoxSize * 2); - qDrawPlainRect(painter, r, option->palette.shadow().color(), 2); - } else { - QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize); - qDrawPlainRect(painter, r, option->palette.shadow().color(), 1); - } - if (option->state & State_Enabled) - d->imageChecked.setColor(1, option->palette.shadow().color().rgba()); - else - d->imageChecked.setColor(1, option->palette.dark().color().rgba()); - if (!(option->state & State_Off)) { - if (d->doubleControls) - painter->drawImage(option->rect.x(), option->rect.y(), d->imageChecked); - else - painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageChecked); - } - } - else { - if (option->state & State_NoChange) - d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); - else if (option->state & State_Enabled) - d->imageCheckedBold.setColor(1, option->palette.shadow().color().rgba()); - else - d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); - if (!(option->state & State_Off)) { - if (d->doubleControls) - painter->drawImage(option->rect.x() + 2, option->rect.y(), d->imageCheckedBold); - else - painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageCheckedBold); - } - } - if (doRestore) - painter->restore(); - break; } - case PE_IndicatorRadioButton: { - painter->save(); - - if (option->state & State_HasFocus) { - d->imageRadioButtonHighlighted.setColor(1, option->palette.shadow().color().rgba()); - d->imageRadioButtonHighlighted.setColor(2, option->palette.highlight().color().rgba()); - painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButtonHighlighted); - } - else { - d->imageRadioButton.setColor(1, option->palette.shadow().color().rgba()); - painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButton); - } - if (option->state & (State_Sunken | State_On)) { - if (option->state & State_Enabled) - d->imageRadioButtonChecked.setColor(1, option->palette.shadow().color().rgba()); - else - d->imageRadioButtonChecked.setColor(1, option->palette.dark().color().rgba()); - - static const int offset = d->doubleControls ? 6 : 3; - painter->drawImage(option->rect.x() + offset, option->rect.y() + offset, d->imageRadioButtonChecked); - } - painter->restore(); - break; } - case PE_PanelButtonCommand: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QBrush fill; - State flags = option->state; - QPalette pal = option->palette; - QRect r = option->rect; - if ((flags & State_Sunken || flags & State_On) ) - fill = pal.brush(QPalette::Shadow); - else - fill = pal.brush(QPalette::Button); - int singleLine = 1; - int doubleLine = 2; - if (d->doubleControls) { - singleLine = 2; - doubleLine = 4; - } - if (button->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) { - if (d->doubleControls) { - qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); - qDrawPlainRect(painter, r.adjusted(1, 1, -1, 1), pal.shadow().color(), 1, &fill); - } - else { - qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); - } - } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) { - qDrawPlainRect(painter, r, pal.shadow().color(), singleLine, &fill); - } else { - painter->fillRect(r, fill); - } - } - break; - case PE_FrameDefaultButton: { - painter->save(); - painter->setPen(option->palette.shadow().color()); - QRect rect = option->rect; - if (d->doubleControls) { - rect.adjust(1, 1, -2, -2); - painter->drawRect(rect); - painter->drawRect(rect.adjusted(1, 1, -1, -1)); - } - - else { - rect.adjust(2, 2, -3, -3); - painter->drawRect(rect); - } - painter->restore(); - break; } - case PE_IndicatorSpinPlus: - case PE_IndicatorSpinMinus: { - QRect r = option->rect; - int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2; - QRect br = r.adjusted(fw, fw, -fw, -fw); - int offset = (option->state & State_Sunken) ? 1 : 0; - int step = (br.width() + 4) / 5; - painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, - br.width(), step, option->palette.buttonText()); - if (element == PE_IndicatorSpinPlus) - painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4, - step, br.height() - 7, option->palette.buttonText()); - break; } - case PE_IndicatorSpinUp: - case PE_IndicatorSpinDown: { - painter->save(); - QPoint points[7]; - switch (element) { - case PE_IndicatorSpinUp: - points[0] = QPoint(-2, -4); - points[1] = QPoint(-2, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(0, -2); - points[5] = QPoint(0, 0); - points[6] = QPoint(1, -1); - break; - case PE_IndicatorSpinDown: - points[0] = QPoint(0, -4); - points[1] = QPoint(0, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(-2, -2); - points[5] = QPoint(-2, 0); - points[6] = QPoint(-3, -1); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal), - proxy()->pixelMetric(PM_ButtonShiftVertical)); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2); - painter->setPen(option->palette.buttonText().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2 + 1, - option->rect.y() + option->rect.height() / 2 + 1); - painter->setPen(option->palette.light().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - painter->translate(-1, -1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } - painter->restore(); - break; } - - case PE_IndicatorArrowUpBig: - case PE_IndicatorArrowDownBig: - case PE_IndicatorArrowLeftBig: - case PE_IndicatorArrowRightBig: - - case PE_IndicatorArrowUp: - case PE_IndicatorArrowDown: - case PE_IndicatorArrowRight: - case PE_IndicatorArrowLeft: { - painter->save(); - - if (d->doubleControls) { - QColor color; - if (option->state & State_Sunken) - color = option->palette.light().color(); - else - color = option->palette.buttonText().color(); - QImage image; - int xoffset, yoffset; - bool isTabBarArrow = widget && widget->parent() - && widget->inherits("QToolButton") - && widget->parent()->inherits("QTabBar"); - - switch (element) { - case PE_IndicatorArrowUp: - image = d->imageArrowUp; - xoffset = 1; - yoffset = 12; - break; - case PE_IndicatorArrowDown: - image = d->imageArrowDown; - xoffset = 1; - yoffset =12; - break; - case PE_IndicatorArrowLeft: - image = d->imageArrowLeft; - xoffset = 8; - yoffset = isTabBarArrow ? 12 : 2; - break; - case PE_IndicatorArrowRight: - image = d->imageArrowRight; - xoffset = 8; - yoffset = isTabBarArrow ? 12 : 2; - break; - case PE_IndicatorArrowUpBig: - image = d->imageArrowUpBig; - xoffset = 3; - yoffset = 12; - break; - case PE_IndicatorArrowDownBig: - image = d->imageArrowDownBig; - xoffset = 2; - yoffset =12; - break; - case PE_IndicatorArrowLeftBig: - image = d->imageArrowLeftBig; - xoffset = 8; - yoffset = 2; - break; - case PE_IndicatorArrowRightBig: - image = d->imageArrowRightBig; - xoffset = 8; - yoffset = 2; - break; - default: - break; - } - image.setColor(1, color.rgba()); - painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image); - } - else { - QPoint points[7]; - switch (element) { - case PE_IndicatorArrowUp: - case PE_IndicatorArrowUpBig: - points[0] = QPoint(-3, 1); - points[1] = QPoint(3, 1); - points[2] = QPoint(-2, 0); - points[3] = QPoint(2, 0); - points[4] = QPoint(-1, -1); - points[5] = QPoint(1, -1); - points[6] = QPoint(0, -2); - break; - case PE_IndicatorArrowDown: - case PE_IndicatorArrowDownBig: - points[0] = QPoint(-3, -1); - points[1] = QPoint(3, -1); - points[2] = QPoint(-2, 0); - points[3] = QPoint(2, 0); - points[4] = QPoint(-1, 1); - points[5] = QPoint(1, 1); - points[6] = QPoint(0, 2); - break; - case PE_IndicatorArrowRight: - case PE_IndicatorArrowRightBig: - points[0] = QPoint(-2, -3); - points[1] = QPoint(-2, 3); - points[2] = QPoint(-1, -2); - points[3] = QPoint(-1, 2); - points[4] = QPoint(0, -1); - points[5] = QPoint(0, 1); - points[6] = QPoint(1, 0); - break; - case PE_IndicatorArrowLeft: - case PE_IndicatorArrowLeftBig: - points[0] = QPoint(0, -3); - points[1] = QPoint(0, 3); - points[2] = QPoint(-1, -2); - points[3] = QPoint(-1, 2); - points[4] = QPoint(-2, -1); - points[5] = QPoint(-2, 1); - points[6] = QPoint(-3, 0); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->setPen(option->palette.light().color()); - else - painter->setPen(option->palette.buttonText().color()); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2 - 1); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2 - 1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } - } - painter->restore(); - break; } -#ifndef QT_NO_TABWIDGET - case PE_FrameTabWidget: - if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) { - QRect rect = option->rect; - QPalette pal = option->palette; - painter->save(); - QBrush fill = pal.light(); - painter->fillRect(rect, fill); - painter->setPen(pal.shadow().color()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - switch (tab->shape) { - case QTabBar::RoundedNorth: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - { - if (d->doubleControls) - painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1)); - else - painter->drawLine(rect.topLeft(), rect.topRight()); - } - break; - case QTabBar::RoundedSouth: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - { - if (d->doubleControls) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - else - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - } - break; - case QTabBar::RoundedEast: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - painter->drawLine(rect.topRight(), rect.bottomRight()); - break; - case QTabBar::RoundedWest: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - painter->drawLine(rect.topLeft(), rect.bottomLeft()); - break; - case QTabBar::TriangularWest: - case QTabBar::TriangularEast: - case QTabBar::TriangularSouth: - case QTabBar::TriangularNorth: - if (d->doubleControls) - qDrawPlainRect(painter, rect.adjusted(0,-2,0,0), option->palette.shadow().color(),2,&pal.light()); - else - qDrawPlainRect(painter, rect, option->palette.shadow().color(),1,&pal.light()); - break; - default: - break; - } - painter->restore(); - } - break; -#endif //QT_NO_TABBAR -#ifndef QT_NO_ITEMVIEWS - case PE_PanelItemViewRow: - if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { - QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled - ? QPalette::Normal : QPalette::Disabled; - if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) - cg = QPalette::Inactive; - - if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget)) - d->drawPanelItemViewSelected(painter, vopt); - else if (vopt->features & QStyleOptionViewItem::Alternate) - painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); - else if (!(vopt->state & QStyle::State_Enabled)) - painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base)); - } - break; - case PE_PanelItemViewItem: - if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { - QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled - ? QPalette::Normal : QPalette::Disabled; - if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) - cg = QPalette::Inactive; - - if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) { - d->drawPanelItemViewSelected(painter, vopt); - } else { - if (vopt->backgroundBrush.style() != Qt::NoBrush) { - QPointF oldBO = painter->brushOrigin(); - painter->setBrushOrigin(vopt->rect.topLeft()); - painter->fillRect(vopt->rect, vopt->backgroundBrush); - painter->setBrushOrigin(oldBO); - } - - if (vopt->state & QStyle::State_Selected) { - QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText, option, widget); - d->drawPanelItemViewSelected(painter, vopt, textRect); - } - } - } - break; -#endif //QT_NO_ITEMVIEWS - - case PE_FrameWindow: { - QPalette popupPal = option->palette; - popupPal.setColor(QPalette::Light, option->palette.background().color()); - popupPal.setColor(QPalette::Midlight, option->palette.light().color()); - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),2,0); - else - qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),1,0); - break; } - case PE_FrameTabBarBase: { - break; } - case PE_Widget: - break; - case PE_IndicatorMenuCheckMark: { - int markW = option->rect.width() > 7 ? 7 : option->rect.width(); - int markH = markW; - if (d->doubleControls) - markW*=2; - markH*=2; - int posX = option->rect.x() + (option->rect.width() - markW)/2 + 1; - int posY = option->rect.y() + (option->rect.height() - markH)/2; - - QVector<QLineF> a; - a.reserve(markH); - - int i, xx, yy; - xx = posX; - yy = 3 + posY; - for (i = 0; i < markW/2; ++i) { - a << QLineF(xx, yy, xx, yy + 2); - ++xx; - ++yy; - } - yy -= 2; - for (; i < markH; ++i) { - a << QLineF(xx, yy, xx, yy + 2); - ++xx; - --yy; - } - if (!(option->state & State_Enabled) && !(option->state & State_On)) { - int pnt; - painter->setPen(option->palette.highlightedText().color()); - QPoint offset(1, 1); - for (pnt = 0; pnt < a.size(); ++pnt) - a[pnt].translate(offset.x(), offset.y()); - painter->drawLines(a); - for (pnt = 0; pnt < a.size(); ++pnt) - a[pnt].translate(offset.x(), offset.y()); - } - painter->setPen(option->palette.text().color()); - painter->drawLines(a); - break; } - case PE_IndicatorBranch: { - // Copied from the Windows style. - static const int decoration_size = d->doubleControls ? 18 : 9; - static const int ofsA = d->doubleControls ? 4 : 2; - static const int ofsB = d->doubleControls ? 8 : 4; - static const int ofsC = d->doubleControls ? 12 : 6; - static const int ofsD = d->doubleControls ? 1 : 0; - int mid_h = option->rect.x() + option->rect.width() / 2; - int mid_v = option->rect.y() + option->rect.height() / 2; - int bef_h = mid_h; - int bef_v = mid_v; - int aft_h = mid_h; - int aft_v = mid_v; - if (option->state & State_Children) { - int delta = decoration_size / 2; - bef_h -= delta; - bef_v -= delta; - aft_h += delta; - aft_v += delta; - QPen oldPen = painter->pen(); - QPen crossPen = oldPen; - crossPen.setWidth(2); - painter->setPen(crossPen); - painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD); - if (!(option->state & State_Open)) - painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD); - painter->setPen(option->palette.dark().color()); - painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1); - if (d->doubleControls) - painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3); - painter->setPen(oldPen); - } - QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern); - if (option->state & State_Item) { - if (option->direction == Qt::RightToLeft) - painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush); - else - painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush); - } - if (option->state & State_Sibling) - painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush); - if (option->state & (State_Open | State_Children | State_Item | State_Sibling)) - painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush); - break; } - case PE_Frame: - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), - d->doubleControls ? 2 : 1, &option->palette.background()); - break; - case PE_FrameLineEdit: - case PE_FrameMenu: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1); - break; - case PE_FrameStatusBar: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,0); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,0); - break; - - default: - QWindowsStyle::drawPrimitive(element, option, painter, widget); - break; - } -} - -void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - - painter->setClipping(false); - switch (element) { - case CE_MenuBarEmptyArea: - painter->setClipping(true); - QWindowsStyle::drawControl(element, option, painter, widget); - break; - case CE_PushButtonBevel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QRect br = button->rect; - int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); - - if (button->features & QStyleOptionButton::AutoDefaultButton) - br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); - QStyleOptionButton tmpBtn = *button; - tmpBtn.rect = br; - proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget); - if (button->features & QStyleOptionButton::HasMenu) { - int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); - QRect ir = button->rect; - QStyleOptionButton newButton = *button; - if (d->doubleControls) - newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4); - else - newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4); - proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget); - } - if (button->features & QStyleOptionButton::DefaultButton) - proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget); - } - break; - case CE_RadioButton: - case CE_CheckBox: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - bool isRadio = (element == CE_RadioButton); - QStyleOptionButton subopt = *button; - subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator - : SE_CheckBoxIndicator, button, widget); - proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, - &subopt, painter, widget); - subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents - : SE_CheckBoxContents, button, widget); - proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); - if (button->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*button); - fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect - : SE_CheckBoxFocusRect, button, widget); - proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - } - break; - case CE_RadioButtonLabel: - case CE_CheckBoxLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - uint alignment = visualAlignment(button->direction, Qt::AlignLeft | Qt::AlignVCenter); - if (!styleHint(SH_UnderlineShortcut, button, widget)) - alignment |= Qt::TextHideMnemonic; - QPixmap pix; - QRect textRect = button->rect; - if (!button->icon.isNull()) { - pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); - proxy()->drawItemPixmap(painter, button->rect, alignment, pix); - if (button->direction == Qt::RightToLeft) - textRect.setRight(textRect.right() - button->iconSize.width() - 4); - else - textRect.setLeft(textRect.left() + button->iconSize.width() + 4); - } - if (!button->text.isEmpty()){ - if (button->state & State_Enabled) - proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, - button->palette, false, button->text, QPalette::WindowText); - else - proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, - button->palette, false, button->text, QPalette::Mid); - } - } - break; -#ifndef QT_NO_PROGRESSBAR - case CE_ProgressBarGroove: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.brush(QPalette::Window)); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.brush(QPalette::Window)); - break; -#endif //QT_NO_PROGRESSBAR -#ifndef QT_NO_TABBAR - case CE_TabBarTab: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget); - proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget); - } - break; - case CE_TabBarTabShape: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - - if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast || - tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) { - d->drawTabBarTab(painter, tab); - } else { - QCommonStyle::drawControl(element, option, painter, widget); - } - break; } - -#endif // QT_NO_TABBAR - -#ifndef QT_NO_TOOLBAR - case CE_ToolBar: - if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { - QRect rect = option->rect; - painter->save(); - painter->setPen(option->palette.dark().color()); - painter->fillRect(rect,option->palette.button()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(4); - painter->setPen(pen); - } - if (toolBar->toolBarArea == Qt::TopToolBarArea) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - else - painter->drawLine(rect.topLeft(), rect.topRight()); - painter->restore(); - break; } -#endif //QT_NO_TOOLBAR - case CE_Header: - if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QRegion clipRegion = painter->clipRegion(); - painter->setClipRect(option->rect); - proxy()->drawControl(CE_HeaderSection, header, painter, widget); - QStyleOptionHeader subopt = *header; - subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget); - if (header->state & State_Sunken) - subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color()); - subopt.state |= QStyle::State_On; - if (subopt.rect.isValid()) - proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget); - if (header->sortIndicator != QStyleOptionHeader::None) { - subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget); - proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); - } - painter->setClipRegion(clipRegion); - } - break; - - case CE_HeaderSection: - if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QBrush fill; - QColor color; - QRect rect = option->rect; - painter->setPen(option->palette.shadow().color()); - - int penSize = 1; - - if (d->doubleControls) { - penSize = 2; - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - - //fix Frame - - if (header->position == QStyleOptionHeader::End - || (header->position == QStyleOptionHeader::OnlyOneSection - && !header->text.isEmpty())) - if (Qt::Horizontal == header->orientation ) - rect.adjust(0, 0, penSize, 0); - else - rect.adjust(0, 0, 0, penSize); - - if (option->state & State_Sunken) { - fill = option->palette.brush(QPalette::Shadow); - color = option->palette.light().color(); - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - painter->drawLine(rect.topRight(), rect.bottomRight()); - rect.adjust(0, 0, -penSize, -penSize); - } - else { - fill = option->palette.brush(QPalette::Button); - color = option->palette.shadow().color(); - if (Qt::Horizontal == header->orientation ) - rect.adjust(-penSize, 0, 0, 0); - else - rect.adjust(0, -penSize, 0, 0); - } - if (Qt::Horizontal == header->orientation ) - rect.adjust(0,-penSize,0,0); - else - rect.adjust(-penSize, 0, 0, 0); - - if (option->state & State_Sunken) { - qDrawPlainRect(painter, rect, color, penSize, &fill); - } else { - //Corner - rect.adjust(-penSize, 0, 0, 0); - qDrawPlainRect(painter, rect, color, penSize, &fill); - } - - //Hack to get rid of some double lines... StyleOptions need a clean flag for that - rect = option->rect; -#ifndef QT_NO_SCROLLAREA - if (const QAbstractScrollArea *abstractScrollArea = qobject_cast<const QAbstractScrollArea *> (widget) ) { - QRect rectScrollArea = abstractScrollArea->geometry(); - if (Qt::Horizontal == header->orientation ) - if ((rectScrollArea.right() - rect.right() ) > 1) - painter->drawLine(rect.topRight(), rect.bottomRight()); - else ; - else - if ((rectScrollArea.bottom() - rect.bottom() ) > 1) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - } -#endif // QT_NO_SCROLLAREA - break; - } -#ifndef QT_NO_COMBOBOX - case CE_ComboBoxLabel: - // This is copied from qcommonstyle.cpp with the difference, that - // the editRect isn't adjusted when calling drawItemText. - if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); - painter->save(); - painter->setClipRect(editRect); - if (!cb->currentIcon.isNull()) { - QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal - : QIcon::Disabled; - QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); - QRect iconRect(editRect); - iconRect.setWidth(cb->iconSize.width() + 4); - iconRect = alignedRect(cb->direction, - Qt::AlignLeft | Qt::AlignVCenter, - iconRect.size(), editRect); - if (cb->editable) - painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); - proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); - - if (cb->direction == Qt::RightToLeft) - editRect.translate(-4 - cb->iconSize.width(), 0); - else - editRect.translate(cb->iconSize.width() + 4, 0); - } - if (!cb->currentText.isEmpty() && !cb->editable) { - proxy()->drawItemText(painter, editRect, - visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), - cb->palette, cb->state & State_Enabled, cb->currentText); - } - painter->restore(); - } - break; -#endif // QT_NO_COMBOBOX -#ifndef QT_NO_DOCKWIDGET - case CE_DockWidgetTitle: - if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { - - const bool verticalTitleBar = dwOpt->verticalTitleBar; - - QRect rect = dwOpt->rect; - QRect r = rect; - - if (verticalTitleBar) { - r = r.transposed(); - - painter->save(); - painter->translate(r.left(), r.top() + r.width()); - painter->rotate(-90); - painter->translate(-r.left(), -r.top()); - } - - bool floating = false; - bool active = dwOpt->state & State_Active; - int menuOffset = 0; //used to center text when floated - QColor inactiveCaptionTextColor = option->palette.highlightedText().color(); - if (dwOpt->movable) { - QColor left, right; - - //Titlebar gradient - if (widget && widget->isWindow()) { - floating = true; - if (active) { - right = option->palette.highlight().color(); - left = right.lighter(125); - } else { - left = option->palette.highlight().color().lighter(125); - right = QColor(0xff, 0xff, 0xff); - } - menuOffset = 2; - QBrush fillBrush(left); - if (left != right) { - QPoint p1(r.x(), r.top() + r.height()/2); - QPoint p2(rect.right(), r.top() + r.height()/2); - QLinearGradient lg(p1, p2); - lg.setColorAt(0, left); - lg.setColorAt(1, right); - fillBrush = lg; - } - painter->fillRect(r.adjusted(0, 0, 0, -3), fillBrush); - } else { - painter->fillRect(r.adjusted(0, 0, 0, -3), option->palette.button().color()); - } - painter->setPen(dwOpt->palette.color(QPalette::Light)); - if (!widget || !widget->isWindow()) { - painter->drawLine(r.topLeft(), r.topRight()); - painter->setPen(dwOpt->palette.color(QPalette::Dark)); - painter->drawLine(r.bottomLeft(), r.bottomRight()); } - } - if (!dwOpt->title.isEmpty()) { - QFont oldFont = painter->font(); - QFont newFont = oldFont; - if (newFont.pointSize() > 2) - newFont.setPointSize(newFont.pointSize() - 2); - if (floating) - newFont.setBold(true); - painter->setFont(newFont); - QPalette palette = dwOpt->palette; - palette.setColor(QPalette::Window, inactiveCaptionTextColor); - QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget); - if (verticalTitleBar) { - titleRect = QRect(r.left() + rect.bottom() - - titleRect.bottom(), - r.top() + titleRect.left() - rect.left(), - titleRect.height(), titleRect.width()); - } - proxy()->drawItemText(painter, titleRect, - Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette, - dwOpt->state & State_Enabled, dwOpt->title, - floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText); - painter->setFont(oldFont); - } - if (verticalTitleBar) - painter->restore(); - } - return; -#endif // QT_NO_DOCKWIDGET - - case CE_PushButtonLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - painter->save(); - QRect ir = button->rect; - QPalette::ColorRole colorRole; - uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, button, widget)) - tf |= Qt::TextHideMnemonic; - - if (button->state & (State_On | State_Sunken)) - colorRole = QPalette::Light; - else - colorRole = QPalette::ButtonText; - - if (!button->icon.isNull()) { - QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal - : QIcon::Disabled; - if (mode == QIcon::Normal && button->state & State_HasFocus) - mode = QIcon::Active; - QIcon::State state = QIcon::Off; - if (button->state & State_On) - state = QIcon::On; - QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - //Center the icon if there is no text - - QPoint point; - if (button->text.isEmpty()) { - point = QPoint(ir.x() + ir.width() / 2 - pixw / 2, - ir.y() + ir.height() / 2 - pixh / 2); - } else { - point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2); - } - if (button->direction == Qt::RightToLeft) - point.rx() += pixw; - - if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft) - point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2; - - painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); - - if (button->direction == Qt::RightToLeft) - ir.translate(-4, 0); - else - ir.translate(pixw + 4, 0); - ir.setWidth(ir.width() - (pixw + 4)); - // left-align text if there is - if (!button->text.isEmpty()) - tf |= Qt::AlignLeft; - } else { - tf |= Qt::AlignHCenter; - } - if (button->state & State_Enabled) - proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole); - else - proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid); - painter->restore(); - } - break; - default: - QWindowsStyle::drawControl(element, option, painter, widget); - break; - } -} - -void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const { - - painter->setClipping(false); - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - switch (control) { -#ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); - int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); - int ticks = slider->tickPosition; - QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget); - QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget); - - if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { - int mid = thickness / 2; - if (ticks & QSlider::TicksAbove) - mid += len / 8; - if (ticks & QSlider::TicksBelow) - mid -= len / 8; - - painter->setPen(slider->palette.shadow().color()); - if (slider->orientation == Qt::Horizontal) { - qDrawPlainRect(painter, groove.x(), groove.y() + mid - 2, - groove.width(), 4, option->palette.shadow().color(),1,0); - } else { - qDrawPlainRect(painter, groove.x()+mid-2, groove.y(), - 4, groove.height(), option->palette.shadow().color(),1,0); - } - } - if (slider->subControls & SC_SliderTickmarks) { - QStyleOptionSlider tmpSlider = *slider; - tmpSlider.subControls = SC_SliderTickmarks; - QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget); - } - - if (slider->subControls & SC_SliderHandle) { - const QColor c0 = slider->palette.shadow().color(); - const QColor c1 = slider->palette.dark().color(); - const QColor c3 = slider->palette.midlight().color(); - const QColor c4 = slider->palette.dark().color(); - QBrush handleBrush; - - if (slider->state & State_Enabled) { - handleBrush = slider->palette.color(QPalette::Light); - } else { - handleBrush = QBrush(slider->palette.color(QPalette::Shadow), - Qt::Dense4Pattern); - } - int x = handle.x(), y = handle.y(), - wi = handle.width(), he = handle.height(); - int x1 = x; - int x2 = x+wi-1; - int y1 = y; - int y2 = y+he-1; - - Qt::Orientation orient = slider->orientation; - bool tickAbove = slider->tickPosition == QSlider::TicksAbove; - bool tickBelow = slider->tickPosition == QSlider::TicksBelow; - - if (slider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*slider); - fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget); - proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - qDrawPlainRect(painter, QRect(x, y, wi, he) - ,slider->palette.shadow().color(),1,&handleBrush); - painter->setBackgroundMode(oldMode); - QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill); - return; - } - QSliderDirection dir; - if (orient == Qt::Horizontal) - if (tickAbove) - dir = SliderUp; - else - dir = SliderDown; - else - if (tickAbove) - dir = SliderLeft; - else - dir = SliderRight; - QPolygon polygon; - int d = 0; - switch (dir) { - case SliderUp: - x2++; - y1 = y1 + wi / 2; - d = (wi + 1) / 2 - 1; - polygon.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d,y1 - d); - break; - case SliderDown: - x2++; - y2 = y2 - wi/2; - d = (wi + 1) / 2 - 1; - polygon.setPoints(5, x1, y1, x1, y2, x1 + d,y2 + d, x2, y2, x2, y1); - break; - case SliderLeft: - d = (he + 1) / 2 - 1; - x1 = x1 + he/2; - polygon.setPoints(5, x1, y1, x1 - d, y1 + d, x1,y2, x2, y2, x2, y1); - y1--; - break; - case SliderRight: - d = (he + 1) / 2 - 1; - x2 = x2 - he/2; - polygon.setPoints(5, x1, y1, x1, y2, x2,y2, x2 + d, y1 + d, x2, y1); - y1--; - break; - } - QBrush oldBrush = painter->brush(); - painter->setPen(Qt::NoPen); - painter->setBrush(handleBrush); - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - painter->drawRect(x1, y1, x2-x1+1, y2-y1+1); - painter->drawPolygon(polygon); - QBrush fill = QBrush(option->palette.button().color(), Qt::Dense4Pattern); - painter->setBrush(oldBrush); - painter->setBackgroundMode(oldMode); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill); - - if (dir != SliderUp) { - painter->setPen(c0); - painter->drawLine(x1, y1, x2, y1); - } - if (dir != SliderLeft) { - painter->setPen(c0); - painter->drawLine(x1, y1, x1, y2); - } - if (dir != SliderRight) { - painter->setPen(c0); - painter->drawLine(x2, y1, x2, y2); - } - if (dir != SliderDown) { - painter->setPen(c0); - painter->drawLine(x1, y2, x2, y2); - } - switch (dir) { - case SliderUp: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4, y1),fill); - painter->setPen(c0); - painter->drawLine(x1, y1, x1 + d, y1 - d); - d = wi - d - 1; - painter->drawLine(x2, y1, x2 -d , y1 -d ); - d--; - break; - case SliderDown: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1+3, y2 - d, x2 - x1 -4,y2 - 8),fill); - painter->setPen(c0); - painter->drawLine(x1, y2, x1 + d, y2 + d); - d = wi - d - 1; - painter->drawLine(x2, y2, x2 - d, y2 + d); - d--; - break; - case SliderLeft: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1, y2 - y1 - 3),fill); - painter->setPen(c0); - painter->drawLine(x1, y1, x1 - d, y1 + d); - d = he - d - 1; - painter->drawLine(x1, y2, x1 - d, y2 - d); - d--; - break; - case SliderRight: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3),fill); - painter->setPen(c0); - painter->drawLine(x2, y1, x2 + d, y1 + d); - painter->setPen(c0); - d = he - d - 1; - painter->drawLine(x2, y2, x2 + d, y2 - d); - d--; - break; - } - } - } - break; -#endif //QT_NO_SLIDER -#ifndef QT_NO_SCROLLBAR - case CC_ScrollBar: - painter->save(); - painter->setPen(option->palette.shadow().color()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::SquareCap); - painter->setPen(pen); - } - if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - d->drawScrollbarGroove(painter, scrollbar); - // Make a copy here and reset it for each primitive. - QStyleOptionSlider newScrollbar = *scrollbar; - State saveFlags = scrollbar->state; - //Check if the scrollbar is part of an abstractItemView and draw the frame according - bool drawCompleteFrame = true; - bool secondScrollBar = false; - if (widget) - if (QWidget *parent = widget->parentWidget()) { - if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) { - drawCompleteFrame = (abstractScrollArea->frameStyle() == QFrame::NoFrame) || (abstractScrollArea->frameStyle() == QFrame::StyledPanel); - secondScrollBar = (abstractScrollArea->horizontalScrollBar()->isVisible() - && abstractScrollArea->verticalScrollBar()->isVisible()) ; - } -#ifndef QT_NO_LISTVIEW - if (QListView *listView = qobject_cast<QListView *>(parent->parentWidget())) - drawCompleteFrame = false; -#endif - } - if (scrollbar->minimum == scrollbar->maximum) - saveFlags |= State_Enabled; - if (scrollbar->subControls & SC_ScrollBarSubLine) { - newScrollbar.state = saveFlags; - newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget); - if (newScrollbar.rect.isValid()) { - if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine)) - newScrollbar.state &= ~(State_Sunken | State_MouseOver); - d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); - } - } - if (scrollbar->subControls & SC_ScrollBarAddLine) { - newScrollbar.rect = scrollbar->rect; - newScrollbar.state = saveFlags; - newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget); - if (newScrollbar.rect.isValid()) { - if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine)) - newScrollbar.state &= ~(State_Sunken | State_MouseOver); - d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); - } - } - if (scrollbar->subControls & SC_ScrollBarSlider) { - - newScrollbar.rect = scrollbar->rect; - newScrollbar.state = saveFlags; - newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget); - - if (newScrollbar.rect.isValid()) { - if (!(scrollbar->activeSubControls & SC_ScrollBarSlider)) - newScrollbar.state &= ~(State_Sunken | State_MouseOver); - d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame); - } - } - } - painter->restore(); - break; -#endif // QT_NO_SCROLLBAR - case CC_ToolButton: - if (const QStyleOptionToolButton *toolbutton - = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - QRect button, menuarea; - bool isTabWidget = false; -#ifndef QT_NO_TABWIDGET - if (widget) - if (QWidget *parent = widget->parentWidget()) - isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget())); -#endif //QT_NO_TABWIDGET - - button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget); - menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); - State buttonFlags = toolbutton->state; - if (buttonFlags & State_AutoRaise) { - if (!(buttonFlags & State_MouseOver)) { - buttonFlags &= ~State_Raised; - } - } - State menuFlags = buttonFlags; - if (toolbutton->activeSubControls & SC_ToolButton) - buttonFlags |= State_Sunken; - if (toolbutton->activeSubControls & SC_ToolButtonMenu) - menuFlags |= State_On; - QStyleOption tool(0); - tool.palette = toolbutton->palette; - if (toolbutton->subControls & SC_ToolButton) { - tool.rect = button; - tool.state = buttonFlags; - proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); - } - if (toolbutton->subControls & SC_ToolButtonMenu) { - tool.rect = menuarea; - tool.state = buttonFlags & State_Enabled; - QStyleOption toolMenu(0); - toolMenu = *toolbutton; - toolMenu.state = menuFlags; - if (buttonFlags & State_Sunken) - proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget); - QStyleOption arrowOpt(0); - arrowOpt.rect = tool.rect; - arrowOpt.palette = tool.palette; - State flags = State_None; - if (menuFlags & State_Enabled) - flags |= State_Enabled; - if ((menuFlags & State_On) && !(buttonFlags & State_Sunken)) { - flags |= State_Sunken; - painter->fillRect(menuarea, option->palette.shadow()); - } - arrowOpt.state = flags; - proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); - } - if (toolbutton->state & State_HasFocus) { - QStyleOptionFocusRect focusRect; - focusRect.QStyleOption::operator=(*toolbutton); - focusRect.rect.adjust(3, 3, -3, -3); - if (toolbutton->features & QStyleOptionToolButton::Menu) - focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, - toolbutton, widget), 0); - proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget); - } - QStyleOptionToolButton label = *toolbutton; - if (isTabWidget) - label.state = toolbutton->state; - else - label.state = toolbutton->state & State_Enabled; - int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); - label.rect = button.adjusted(fw, fw, -fw, -fw); - proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget); - } - break; - -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - // Draw frame - painter->save(); - QFont font = painter->font(); - font.setBold(true); - painter->setFont(font); - QStyleOptionGroupBox groupBoxFont = *groupBox; - groupBoxFont.fontMetrics = QFontMetrics(font); - QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget); - QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0); - if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { - QStyleOptionFrame frame; - frame.QStyleOption::operator=(*groupBox); - frame.features = groupBox->features; - frame.lineWidth = groupBox->lineWidth; - frame.midLineWidth = groupBox->midLineWidth; - frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); - painter->save(); - QRegion region(groupBox->rect); - if (!groupBox->text.isEmpty()) { - bool ltr = groupBox->direction == Qt::LeftToRight; - QRect finalRect = checkBoxRect.united(textRect); - if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) - finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); - region -= finalRect; - } - proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); - painter->restore(); - } - // Draw checkbox - if (groupBox->subControls & SC_GroupBoxCheckBox) { - QStyleOptionButton box; - box.QStyleOption::operator=(*groupBox); - box.rect = checkBoxRect; - proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); - } - // Draw title - if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { - QColor textColor = groupBox->textColor; - if (textColor.isValid()) - painter->setPen(textColor); - else - painter->setPen(groupBox->palette.link().color()); - painter->setPen(groupBox->palette.link().color()); - - int alignment = int(groupBox->textAlignment); - if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) - alignment |= Qt::TextHideMnemonic; - - if (groupBox->state & State_Enabled) - proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, - groupBox->palette, true, groupBox->text, - textColor.isValid() ? QPalette::NoRole : QPalette::Link); - else - proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, - groupBox->palette, true, groupBox->text, QPalette::Mid); - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - } - painter->restore(); - } - break; -#endif //QT_NO_GROUPBOX - -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QBrush editBrush = cmb->palette.brush(QPalette::Base); - if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush); - else - painter->fillRect(option->rect, editBrush); - State flags = State_None; - QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); - if ((option->state & State_On)) { - painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow)); - } - if (d->doubleControls) - ar.adjust(5, 0, 5, 0); - else - ar.adjust(2, 0, -2, 0); - if (option->state & State_Enabled) - flags |= State_Enabled; - if (option->state & State_On) - flags |= State_Sunken; - QStyleOption arrowOpt(0); - arrowOpt.rect = ar; - arrowOpt.palette = cmb->palette; - arrowOpt.state = flags; - proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget); - if (cmb->subControls & SC_ComboBoxEditField) { - QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); - if (cmb->state & State_HasFocus && !cmb->editable) - painter->fillRect(re.x(), re.y(), re.width(), re.height(), - cmb->palette.brush(QPalette::Highlight)); - if (cmb->state & State_HasFocus) { - painter->setPen(cmb->palette.highlightedText().color()); - painter->setBackground(cmb->palette.highlight()); - } else { - painter->setPen(cmb->palette.text().color()); - painter->setBackground(cmb->palette.background()); - } - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget); - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - if ((option->state & State_On)) - proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } - } - break; -#endif // QT_NO_COMBOBOX - - -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QStyleOptionSpinBox copy = *spinBox; - //PrimitiveElement primitiveElement; - int primitiveElement; - - if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { - QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget); - qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0); - } - QPalette shadePal(option->palette); - shadePal.setColor(QPalette::Button, option->palette.light().color()); - shadePal.setColor(QPalette::Light, option->palette.base().color()); - if (spinBox->subControls & SC_SpinBoxUp) { - copy.subControls = SC_SpinBoxUp; - QPalette pal2 = spinBox->palette; - if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig - : PE_IndicatorArrowUpBig); - copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); - if (copy.state & (State_Sunken | State_On)) - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Shadow)); - else - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Base)); - copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0); - proxy()->drawPrimitive(PrimitiveElement(primitiveElement), ©, painter, widget); - } - if (spinBox->subControls & SC_SpinBoxDown) { - copy.subControls = SC_SpinBoxDown; - copy.state = spinBox->state; - QPalette pal2 = spinBox->palette; - if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig - : PE_IndicatorArrowDownBig); - copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Base)); - if (copy.state & (State_Sunken | State_On)) - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Shadow)); - else - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Base)); - copy.rect.adjust(3, 0, -4, 0); - if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) { - int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget); - copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); - proxy()->drawPrimitive(PrimitiveElement(primitiveElement), ©, painter, widget); - } - else { - proxy()->drawPrimitive(PrimitiveElement(primitiveElement), ©, painter, widget); - } - if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { - QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget); - } - } - } - break; -#endif // QT_NO_SPINBOX - - default: - QWindowsStyle::drawComplexControl(control, option, painter, widget); - break; - } -} - -QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const { - - QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); - switch (type) { - case CT_PushButton: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - newSize = QCommonStyle::sizeFromContents(type, option, size, widget); - int w = newSize.width(), - h = newSize.height(); - int defwidth = 0; - if (button->features & QStyleOptionButton::AutoDefaultButton) - defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); - - int minwidth = int(QStyleHelper::dpiScaled(55.0f)); - int minheight = int(QStyleHelper::dpiScaled(19.0f)); - - if (w < minwidth + defwidth && button->icon.isNull()) - w = minwidth + defwidth; - if (h < minheight + defwidth) - h = minheight + defwidth; - newSize = QSize(w + 4, h + 4); - } - break; - -#ifndef QT_NO_GROUPBOX - case CT_GroupBox: - if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) { - newSize = size + QSize(!grb->isFlat() ? 16 : 0, !grb->isFlat() ? 16 : 0); - } - break; -#endif // QT_NO_GROUPBOX - - case CT_RadioButton: - case CT_CheckBox: - newSize = size; - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - bool isRadio = (type == CT_RadioButton); - QRect irect = visualRect(button->direction, button->rect, - proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator - : SE_CheckBoxIndicator, button, widget)); - int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight - : PM_IndicatorHeight, button, widget); - int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10; - if (d_func()->doubleControls) - margins *= 2; - newSize += QSize(irect.right() + margins, 1); - newSize.setHeight(qMax(newSize.height(), h)); - } - break; -#ifndef QT_NO_COMBOBOX - case CT_ComboBox: - if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23) - } - break; -#endif -#ifndef QT_NO_SPINBOX - case CT_SpinBox: - if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6); - } - break; -#endif -#ifndef QT_NO_LINEEDIT - case CT_LineEdit: - newSize += QSize(0,1); - break; -#endif - case CT_ToolButton: - newSize = QSize(newSize.width() + 1, newSize.height()); - break; - case CT_TabBarTab: - if (d_func()->doubleControls) - newSize = QSize(newSize.width(), 42); - else - newSize = QSize(newSize.width(), 21); - break; - case CT_HeaderSection: - newSize += QSize(4, 2); - break; -#ifndef QT_NO_ITEMVIEWS -#ifdef Q_OS_WINCE_WM - case CT_ItemViewItem: - if (d_func()->wm65) - if (d_func()->doubleControls) - newSize.setHeight(46); - else - newSize.setHeight(23); - break; -#endif //Q_OS_WINCE_WM -#endif //QT_NO_ITEMVIEWS - default: - break; - } - return newSize; -} - -QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - QRect rect = QWindowsStyle::subElementRect(element, option, widget); - switch (element) { -#ifndef QT_NO_TABWIDGET - case SE_TabWidgetTabBar: - if (d->doubleControls) - rect.adjust(-2, 0, 2, 0); - else - rect.adjust(-2, 0, 2, 0); - break; -#endif //QT_NO_TABWIDGET - case SE_CheckBoxFocusRect: - rect.adjust(1,0,-2,-1); - break; - case SE_RadioButtonFocusRect: - rect.adjust(1,1,-2,-2); - break; - default: - break; -#ifndef QT_NO_SLIDER - case SE_SliderFocusRect: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - rect = slider->rect; - } - break; - case SE_PushButtonFocusRect: - if (d->doubleControls) - rect.adjust(-1, -1, 0, 0); - break; -#endif // QT_NO_SLIDER -#ifndef QT_NO_ITEMVIEWS - case SE_ItemViewItemFocusRect: -#ifdef Q_OS_WINCE_WM - if (d->wm65) - rect = QRect(); -#endif - break; -#endif //QT_NO_ITEMVIEWS - } - return rect; -} - -QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, - SubControl subControl, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); - switch (control) { - -#ifndef QT_NO_SCROLLBAR - case CC_ScrollBar: - if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); - float stretchFactor = 1.4f; - int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor); - -#ifdef Q_OS_WINCE_WM - if (d->wm65) - { - sliderButtonExtent = d->imageScrollbarHandleUp.width(); - sliderButtonExtentDir = d->imageScrollbarHandleUp.height(); - } -#endif //Q_OS_WINCE_WM - - int sliderlen; - int maxlen = ((scrollbar->orientation == Qt::Horizontal) ? - scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2); - // calculate slider length - if (scrollbar->maximum != scrollbar->minimum) { - uint range = scrollbar->maximum - scrollbar->minimum; - sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); - - int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); - if (sliderlen < slidermin || range > INT_MAX / 2) - sliderlen = slidermin; - if (sliderlen > maxlen) - sliderlen = maxlen; - } else { - sliderlen = maxlen; - } - int sliderstart = sliderButtonExtentDir + sliderPositionFromValue(scrollbar->minimum, - scrollbar->maximum, - scrollbar->sliderPosition, - maxlen - sliderlen, - scrollbar->upsideDown); - if (d->smartphone) { - sliderstart -= sliderButtonExtentDir; - sliderlen += 2*sliderButtonExtent; - } - switch (subControl) { - case SC_ScrollBarSubLine: // top/left button - if (scrollbar->orientation == Qt::Horizontal) { - int buttonWidth = qMin(scrollbar->rect.width() / 2, sliderButtonExtentDir ); - rect.setRect(0, 0, buttonWidth, sliderButtonExtent); - } else { - int buttonHeight = qMin(scrollbar->rect.height() / 2, sliderButtonExtentDir); - rect.setRect(0, 0, sliderButtonExtent, buttonHeight); - } - if (d->smartphone) - rect.setRect(0, 0, 0, 0); - break; - case SC_ScrollBarAddLine: // bottom/right button - if (scrollbar->orientation == Qt::Horizontal) { - int buttonWidth = qMin(scrollbar->rect.width()/2, sliderButtonExtentDir); - rect.setRect(scrollbar->rect.width() - buttonWidth, 0, buttonWidth, sliderButtonExtent); - } else { - int buttonHeight = qMin(scrollbar->rect.height()/2, sliderButtonExtentDir ); - rect.setRect(0, scrollbar->rect.height() - buttonHeight, sliderButtonExtent, buttonHeight); - } - if (d->smartphone) - rect.setRect(0, 0, 0, 0); - break; - case SC_ScrollBarSubPage: // between top/left button and slider - if (scrollbar->orientation == Qt::Horizontal) - if (d->smartphone) - rect.setRect(0, 0, sliderstart, sliderButtonExtent); - else - rect.setRect(sliderButtonExtent, 0, sliderstart - sliderButtonExtent, sliderButtonExtent); - else - if (d->smartphone) - rect.setRect(0, 0, sliderButtonExtent, sliderstart); - else - rect.setRect(0, sliderButtonExtent, sliderButtonExtent, sliderstart - sliderButtonExtent); - break; - case SC_ScrollBarAddPage: // between bottom/right button and slider - if (scrollbar->orientation == Qt::Horizontal) - if (d->smartphone) - rect.setRect(sliderstart + sliderlen, 0, - maxlen - sliderstart - sliderlen + 2*sliderButtonExtent, sliderButtonExtent); - else - rect.setRect(sliderstart + sliderlen, 0, - maxlen - sliderstart - sliderlen + sliderButtonExtent, sliderButtonExtent); - else - if (d->smartphone) - rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, - maxlen - sliderstart - sliderlen + 2*sliderButtonExtent); - else - rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, - maxlen - sliderstart - sliderlen + sliderButtonExtent); - break; - case SC_ScrollBarGroove: - if (scrollbar->orientation == Qt::Horizontal) - rect.setRect(sliderButtonExtent, 0, scrollbar->rect.width() - sliderButtonExtent * 2, - scrollbar->rect.height()); - else - rect.setRect(0, sliderButtonExtent, scrollbar->rect.width(), - scrollbar->rect.height() - sliderButtonExtent * 2); - break; - case SC_ScrollBarSlider: - if (scrollbar->orientation == Qt::Horizontal) - rect.setRect(sliderstart, 0, sliderlen, sliderButtonExtent); - else - rect.setRect(0, sliderstart, sliderButtonExtent, sliderlen); - break; - default: - break; - } - rect = visualRect(scrollbar->direction, scrollbar->rect, rect); - } - break; -#endif // QT_NO_SCROLLBAR - - - -#ifndef QT_NO_TOOLBUTTON - case CC_ToolButton: - if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget); - rect = toolButton->rect; - switch (subControl) { - case SC_ToolButton: - if ((toolButton->features - & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) - == QStyleOptionToolButton::Menu) - rect.adjust(0, 0, -mbi, 0); - break; - case SC_ToolButtonMenu: - if ((toolButton->features - & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) - == QStyleOptionToolButton::Menu) - rect.adjust(rect.width() - mbi, 1, 0, 1); - break; - default: - break; - } - rect = visualRect(toolButton->direction, toolButton->rect, rect); - } - break; -#endif // QT_NO_TOOLBUTTON - -#ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); - int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); - switch (subControl) { - case SC_SliderHandle: { - int sliderPos = 0; - int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); - bool horizontal = slider->orientation == Qt::Horizontal; - sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, - slider->sliderPosition, - (horizontal ? slider->rect.width() - : slider->rect.height()) - len, - slider->upsideDown); - if (horizontal) - rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); - else - rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); - break; } - default: - break; - } - rect = visualRect(slider->direction, slider->rect, rect); - } - break; -#endif //QT_NO_SLIDER -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int x = comboBox->rect.x(), - y = comboBox->rect.y(), - wi = comboBox->rect.width(), - he = comboBox->rect.height(); - int xpos = x; - int margin = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; - int bmarg = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; - if (subControl == SC_ComboBoxArrow) - xpos += wi - int((he - 2*bmarg)*0.9) - bmarg; - else - xpos += wi - (he - 2*bmarg) - bmarg; - switch (subControl) { - case SC_ComboBoxArrow: - rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg); - break; - case SC_ComboBoxEditField: - rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin); - if (d->doubleControls) { - if (comboBox->editable) - rect.adjust(2, 0, 0, 0); - else - rect.adjust(4, 2, 0, -2); - } else if (!comboBox->editable) { - rect.adjust(2, 1, 0, -1); - } - break; - case SC_ComboBoxFrame: - rect = comboBox->rect; - break; - default: - break; - } - } -#endif //QT_NO_COMBOBOX -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QSize bs; - int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0; - bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height()))); - // 1.6 -approximate golden mean - bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8)))); - bs = bs.expandedTo(QApplication::globalStrut()); - int x, lx, rx; - x = spinBox->rect.width() - bs.width()*2; - lx = fw; - rx = x - fw; - switch (subControl) { - case SC_SpinBoxUp: - rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height()); - break; - case SC_SpinBoxDown: - rect = QRect(x + bs.width(), 0, bs.width(), bs.height()); - break; - case SC_SpinBoxEditField: - if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) { - rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw); - } else { - rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw); - } - break; - case SC_SpinBoxFrame: - rect = spinBox->rect; - default: - break; - } - rect = visualRect(spinBox->direction, spinBox->rect, rect); - } - break; -#endif // Qt_NO_SPINBOX -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: { - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - switch (subControl) { - case SC_GroupBoxFrame: - // FALL THROUGH - case SC_GroupBoxContents: { - int topMargin = 0; - int topHeight = 0; - int bottomMargin = 0; - int labelMargin = 2; - - QRect frameRect = groupBox->rect; - int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); - if (groupBox->text.size()) { - topHeight = groupBox->fontMetrics.height(); - if (verticalAlignment & Qt::AlignVCenter) - topMargin = topHeight+5; - else if (verticalAlignment & Qt::AlignTop) - topMargin = -topHeight+5; - } - if (subControl == SC_GroupBoxFrame) { - frameRect.setTop(topMargin); - frameRect.setBottom(frameRect.height() + bottomMargin); - rect = frameRect; - break; - } - int frameWidth = 0; - if (groupBox->text.size()) { - frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); - rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth); - } - else { - rect = groupBox->rect; - } - break; - } - case SC_GroupBoxCheckBox: - // FALL THROUGH - case SC_GroupBoxLabel: { - QFontMetrics fontMetrics = groupBox->fontMetrics; - int h = fontMetrics.height(); - int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); - const int margX = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 2; - const int margY = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 2; - rect = groupBox->rect.adjusted(margX, margY, -margX, 0); - if (groupBox->text.size()) - rect.setHeight(h); - else - rect.setHeight(0); - int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1; - bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; - int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; - - // Adjusted rect for label + indicatorWidth + indicatorSpace - QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, - QSize(textWidth + checkBoxSize, h), rect); - - // Adjust totalRect if checkbox is set - if (hasCheckBox) { - bool ltr = groupBox->direction == Qt::LeftToRight; - int left = 2; - // Adjust for check box - if (subControl == SC_GroupBoxCheckBox) { - int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); - left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); - int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; - totalRect.setRect(left, top, indicatorWidth, indicatorHeight); - // Adjust for label - } else { - left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); - totalRect.setRect(left, totalRect.top(), - totalRect.width() - checkBoxSize, totalRect.height()); - } - } - if ((subControl== SC_GroupBoxLabel)) - totalRect.adjust(-2,0,6,0); - rect = totalRect; - break; - } - default: - break; - } - } - break; - } -#endif // QT_NO_GROUPBOX - default: - break; - } - return rect; -} - -QPalette QWindowsMobileStyle::standardPalette() const { - QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ), - QColor(132, 130, 132), QColor(198, 195, 198), Qt::black, Qt::white, Qt::white, QColor(198, 195, 198)); - palette.setColor(QPalette::Window, QColor(206, 223, 239)); - palette.setColor(QPalette::Link, QColor(8,77,123)); //Alternate TextColor for labels... - palette.setColor(QPalette::Base, Qt::white); - palette.setColor(QPalette::Button, QColor(206, 223, 239)); - palette.setColor(QPalette::Highlight, QColor(49, 146, 214)); - palette.setColor(QPalette::Light, Qt::white); - palette.setColor(QPalette::Text, Qt::black); - palette.setColor(QPalette::ButtonText, Qt::black); - palette.setColor(QPalette::Midlight, QColor(222, 223, 222 )); - palette.setColor(QPalette::Dark, QColor(132, 130, 132)); - palette.setColor(QPalette::Mid, QColor(189, 190, 189)); - palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); - palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow) - return palette; -} - - -/*! \reimp */ -void QWindowsMobileStyle::polish(QApplication *application) { - QWindowsStyle::polish(application); -} - -/*! \reimp */ -void QWindowsMobileStyle::polish(QWidget *widget) { - -#ifndef QT_NO_TOOLBAR - if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) { - QPalette pal = toolBar->palette(); - pal.setColor(QPalette::Background, pal.button().color()); - toolBar->setPalette(pal); - } - else -#endif //QT_NO_TOOLBAR - - QWindowsStyle::polish(widget); -} - -void QWindowsMobileStyle::unpolish(QWidget *widget) -{ - QWindowsStyle::unpolish(widget); -} - -void QWindowsMobileStyle::unpolish(QApplication *app) -{ - QWindowsStyle::unpolish(app); -} - -/*! \reimp */ -void QWindowsMobileStyle::polish(QPalette &palette) { - QWindowsStyle::polish(palette); -} - -int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - int ret; - - switch (pm) { - case PM_DefaultTopLevelMargin: - ret =0; - break; - case PM_DefaultLayoutSpacing: - d->doubleControls ? ret = 8 : ret = 4; - break; - case PM_HeaderMargin: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_DefaultChildMargin: - d->doubleControls ? ret = 10 : ret = 5; - break; - case PM_ToolBarSeparatorExtent: - d->doubleControls ? ret = 6 : ret = 3; - break; - case PM_DefaultFrameWidth: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_MenuVMargin: - ret = 1; - break; - case PM_MenuHMargin: - ret = 1; - break; - case PM_MenuButtonIndicator: - ret = d->doubleControls ? 24 : 14; - break; - case PM_ComboBoxFrameWidth: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_SpinBoxFrameWidth: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_ButtonDefaultIndicator: - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - d->doubleControls ? ret = 2 : ret = 1; - break; -#ifndef QT_NO_TABBAR - case PM_TabBarTabShiftHorizontal: - ret = 0; - break; - case PM_TabBarTabShiftVertical: - ret = 0; - break; -#endif - case PM_MaximumDragDistance: - ret = 60; - break; - case PM_TabBarTabVSpace: - ret = d->doubleControls ? 12 : 6; - break; - case PM_TabBarBaseHeight: - ret = 0; - break; - case PM_IndicatorWidth: - ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; - break; - case PM_IndicatorHeight: - ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; - break; - case PM_ExclusiveIndicatorWidth: - ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; - break; - case PM_ExclusiveIndicatorHeight: - ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; - break; -#ifndef QT_NO_SLIDER - case PM_SliderLength: - ret = d->doubleControls ? 16 : 8; - break; - case PM_FocusFrameHMargin: - ret = d->doubleControls ? 1 : 2; - break; - case PM_SliderThickness: - ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness; - break; - case PM_TabBarScrollButtonWidth: - ret = d->doubleControls ? 14 * 2 : 18; - break; - case PM_CheckBoxLabelSpacing: - case PM_RadioButtonLabelSpacing: - ret = d->doubleControls ? 6 * 2 : 6; - break; - // Returns the number of pixels to use for the business part of the - // slider (i.e., the non-tickmark portion). The remaining space is shared - // equally between the tickmark regions. - case PM_SliderControlThickness: - if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); - int ticks = sl->tickPosition; - int n = 0; - if (ticks & QSlider::TicksAbove) - ++n; - if (ticks & QSlider::TicksBelow) - ++n; - if (!n) { - ret = space; - break; - } - int thick = 8; - if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) - thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4; - - space -= thick; - if (space > 0) - thick += (space * 2) / (n + 2); - ret = thick; - } else { - ret = 0; - } - break; -#endif // QT_NO_SLIDER -#ifndef QT_NO_MENU - case PM_SmallIconSize: - d->doubleControls ? ret = windowsMobileIconSize * 2 : ret = windowsMobileIconSize; - break; - case PM_ButtonMargin: - d->doubleControls ? ret = 8 : ret = 4; - break; - case PM_LargeIconSize: - d->doubleControls ? ret = 64 : ret = 32; - break; - case PM_IconViewIconSize: - ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); - break; - case PM_ToolBarIconSize: - d->doubleControls ? ret = 2 * windowsMobileIconSize : ret = windowsMobileIconSize; - break; - case PM_DockWidgetTitleMargin: - ret = 2; - break; -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) -#else - case PM_DockWidgetFrameWidth: - ret = 4; - break; -#endif // Q_DEAD_CODE_FROM_QT4_WIN - break; -#endif // QT_NO_MENU - - case PM_TitleBarHeight: - d->doubleControls ? ret = 42 : ret = 21; - break; - case PM_ScrollBarSliderMin: -#ifdef Q_OS_WINCE_WM - if (d->wm65) -#else - if (false) -#endif - { - d->doubleControls ? ret = 68 : ret = 34; - } else { - d->doubleControls ? ret = 36 : ret = 18; - } - break; - case PM_ScrollBarExtent: { - - if (d->smartphone) - ret = 9; - else - d->doubleControls ? ret = 25 : ret = 13; - -#ifdef Q_OS_WINCE_WM - if (d->wm65) -#else - if (false) -#endif - { - d->doubleControls ? ret = 26 : ret = 13; - break; - } - -#ifndef QT_NO_SCROLLAREA - //Check if the scrollbar is part of an abstractItemView and set size according - if (widget) - if (QWidget *parent = widget->parentWidget()) - if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) - if (d->smartphone) - ret = 8; - else - d->doubleControls ? ret = 24 : ret = 12; -#endif - } - break; - case PM_SplitterWidth: - ret = qMax(4, QApplication::globalStrut().width()); - break; - -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) - case PM_MDIFrameWidth: - ret = 1; - break; -#endif - case PM_ToolBarExtensionExtent: - d->doubleControls ? ret = 32 : ret = 16; - break; - case PM_ToolBarItemMargin: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_ToolBarItemSpacing: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_ToolBarHandleExtent: - d->doubleControls ? ret = 16 : ret = 8; - break; - case PM_ButtonIconSize: - d->doubleControls ? ret = 32 : ret = 16; - break; - case PM_TextCursorWidth: - ret = 2; - break; - case PM_TabBar_ScrollButtonOverlap: - ret = 0; - break; - default: - ret = QWindowsStyle::pixelMetric(pm, opt, widget); - break; - } - return ret; -} - -int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, - QStyleHintReturn *returnData) const { - - int ret; - switch (hint) { - case SH_Menu_MouseTracking: - case SH_ComboBox_ListMouseTracking: - case SH_EtchDisabledText: - ret = 0; - break; - case SH_DitherDisabledText: - ret = 0; - break; - case SH_ItemView_ShowDecorationSelected: - ret = 0; - break; -#ifndef QT_NO_TABWIDGET - case SH_TabWidget_DefaultTabPosition: - ret = QTabWidget::South; - break; -#endif - case SH_ToolBar_Movable: - ret = false; - break; - case SH_ScrollBar_ContextMenu: - ret = false; - break; - case SH_MenuBar_AltKeyNavigation: - ret = false; - break; - case SH_RequestSoftwareInputPanel: - ret = RSIP_OnMouseClick; - break; - default: - ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); - break; - } - return ret; -} - -QPixmap QWindowsMobileStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, - const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - switch (sp) { -#ifndef QT_NO_IMAGEFORMAT_XPM - case SP_ToolBarHorizontalExtensionButton: { - QPixmap pixmap = QCommonStyle::standardPixmap(sp, option, widget); - if (d->doubleControls) - return pixmap.scaledToHeight(pixmap.height() * 2); - else - return pixmap; - } - case SP_TitleBarMaxButton: - case SP_TitleBarCloseButton: - case SP_TitleBarNormalButton: - case SP_TitleBarMinButton: { - QImage image; - switch (sp) { - case SP_TitleBarMaxButton: - image = d->imageMaximize; - break; - case SP_TitleBarCloseButton: - image = d->imageClose; - break; - case SP_TitleBarNormalButton: - image = d->imageNormalize; - break; - case SP_TitleBarMinButton: - image = d->imageMinimize; - break; - default: - break; - } - if (option) { - image.setColor(0, option->palette.shadow().color().rgba()); - image.setColor(1, option->palette.highlight().color().rgba()); - image.setColor(2, option->palette.highlight().color().lighter(150).rgba()); - image.setColor(3, option->palette.highlightedText().color().rgba()); - } - - return QPixmap::fromImage(image); - } - -#endif - default: - return QWindowsStyle::standardPixmap(sp, option, widget); - } -} - -QPixmap QWindowsMobileStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, - const QStyleOption *option) const { - - switch (iconMode) { - case QIcon::Selected: { -#ifdef Q_OS_WINCE_WM - if (d_func()->wm65) - return pixmap; -#endif //Q_OS_WINCE_WM - QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); - int imgh = img.height(); - int imgw = img.width(); - for (int y = 0; y < imgh; y += 2) { - for (int x = 0; x < imgw; x += 2) { - QColor c = option->palette.highlight().color().rgb(); - c.setAlpha( qAlpha(img.pixel(x, y))); - QRgb pixel = c.rgba(); - img.setPixel(x, y, pixel); - } - } - return QPixmap::fromImage(img); - } - default: - break; - } - return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, option); -} - - -bool QWindowsMobileStyle::doubleControls() const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - return d->doubleControls; -} - -void QWindowsMobileStyle::setDoubleControls(bool doubleControls) { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - d->doubleControls = doubleControls; -} - -QT_END_NAMESPACE - -#endif // QT_NO_STYLE_WINDOWSMOBILE - diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h deleted file mode 100644 index 68dfbfb412..0000000000 --- a/src/widgets/styles/qwindowsmobilestyle_p.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSMOBILESTYLE_P_H -#define QWINDOWSMOBILESTYLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qwindowsstyle_p.h> - -QT_BEGIN_NAMESPACE - - -#if !defined(QT_NO_STYLE_WINDOWSMOBILE) - -class QWindowsMobileStylePrivate; - -class QWindowsMobileStyle : public QWindowsStyle -{ - Q_OBJECT -public: - QWindowsMobileStyle(); - ~QWindowsMobileStyle(); - - void drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget = 0) const; - - void drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const; - - void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const; - - QSize sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const; - - QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; - - QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, - SubControl sc, const QWidget *widget) const; - - QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, - const QStyleOption *option) const; - - QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option, - const QWidget *widget) const; - - int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; - - int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, - QStyleHintReturn *returnData = 0) const; - - void polish(QApplication*); - void unpolish(QApplication*); - void polish(QWidget *widget); - void unpolish(QWidget *widget); - void polish(QPalette &); - - QPalette standardPalette() const; - - bool doubleControls() const; - - void setDoubleControls(bool); - -protected: - QWindowsMobileStyle(QWindowsMobileStylePrivate &dd); - -private: - Q_DECLARE_PRIVATE(QWindowsMobileStyle) -}; - -#endif // QT_NO_STYLE_WINDOWSMOBILE - -QT_END_NAMESPACE - -#endif //QWINDOWSMOBILESTYLE_P_H diff --git a/src/widgets/styles/qwindowsmobilestyle_p_p.h b/src/widgets/styles/qwindowsmobilestyle_p_p.h deleted file mode 100644 index cd9e4636ec..0000000000 --- a/src/widgets/styles/qwindowsmobilestyle_p_p.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSMOBILESTYLE_P_P_H -#define QWINDOWSMOBILESTYLE_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include "qwindowsmobilestyle_p.h" -#include "qwindowsstyle_p_p.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_STYLE_WINDOWSMOBILE - -class QStyleOptionTab; -class QStyleOptionSlider; - -class QWindowsMobileStylePrivate : public QWindowsStylePrivate -{ - Q_DECLARE_PUBLIC(QWindowsMobileStyle) -public: - QWindowsMobileStylePrivate(); - bool doubleControls; - bool smartphone; -#ifdef Q_OS_WINCE_WM - bool wm65; -#endif - - QImage imageRadioButton; - QImage imageRadioButtonChecked; - QImage imageRadioButtonHighlighted; - QImage imageChecked; - QImage imageCheckedBold; - QImage imageArrowDown; - QImage imageArrowUp; - QImage imageArrowLeft; - QImage imageArrowRight; - QImage imageArrowDownBig; - QImage imageArrowUpBig; - QImage imageArrowLeftBig; - QImage imageArrowRightBig; - QImage imageClose; - QImage imageMaximize; - QImage imageNormalize; - QImage imageMinimize; - - void setupWindowsMobileStyle65(); - -#ifdef Q_OS_WINCE_WM - //Windows Mobile 6.5 images - QImage imageScrollbarHandleUp; - QImage imageScrollbarHandleDown; - QImage imageScrollbarHandleUpHigh; - QImage imageScrollbarHandleDownHigh; - QImage imageScrollbarGripUp; - QImage imageScrollbarGripDown; - QImage imageScrollbarGripMiddle; - QImage imageListViewHighlightCornerLeft; - QImage imageListViewHighlightCornerRight; - QImage imageListViewHighlightMiddle; - QImage imageTabEnd; - QImage imageTabSelectedEnd; - QImage imageTabSelectedBegin; - QImage imageTabMiddle; - - QColor currentTintHigh; - QColor currentTintButton; - - void tintImagesHigh(QColor color); - void tintImagesButton(QColor color); - void tintListViewHighlight(QColor color); - -#endif //Q_OS_WINCE_WM - - void drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false); - void drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false); - void drawScrollbarGroove(QPainter *p, const QStyleOptionSlider *opt); - void drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame); - void drawTabBarTab(QPainter *p, const QStyleOptionTab *tab); - void drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItem *option, QRect rect = QRect()); - -}; - -QT_END_NAMESPACE - -#endif // QT_NO_STYLE_WINDOWSMOBILE -#endif //QWINDOWSMOBILESTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index f6323bb41c..e0e9d0f6f1 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -122,7 +122,7 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; QWindowsStylePrivate::QWindowsStylePrivate() : alt_down(false), menuBarTimer(0) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { QSystemLibrary shellLib(QLatin1String("shell32")); @@ -305,25 +305,15 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) switch (pm) { case QStyle::PM_DockWidgetFrameWidth: -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CXFRAME); -# else - return GetSystemMetrics(SM_CXDLGFRAME); -# endif - break; case QStyle::PM_TitleBarHeight: if (widget && (widget->windowType() == Qt::Tool)) { // MS always use one less than they say -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CYSMCAPTION) - 1; -# else - return GetSystemMetrics(SM_CYCAPTION) - 1; -# endif } return GetSystemMetrics(SM_CYCAPTION) - 1; -# ifndef Q_OS_WINCE case QStyle::PM_ScrollBarExtent: { NONCLIENTMETRICS ncm; @@ -332,14 +322,9 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const return qMax(ncm.iScrollHeight, ncm.iScrollWidth); } break; -# endif // !Q_OS_WINCE case QStyle::PM_MdiSubWindowFrameWidth: -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CYFRAME); -# else - return GetSystemMetrics(SM_CYDLGFRAME); -# endif default: break; @@ -476,7 +461,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QPixmap desktopIcon; switch(standardPixmap) { case SP_DriveCDIcon: @@ -515,7 +500,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl if (!desktopIcon.isNull()) { return desktopIcon; } -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT return QCommonStyle::standardPixmap(standardPixmap, opt, widget); } @@ -592,12 +577,12 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid #endif // Q_OS_WIN && !Q_OS_WINRT case SH_Menu_SubMenuSloppyCloseTimeout: case SH_Menu_SubMenuPopupDelay: { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) DWORD delay; if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) ret = delay; else -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT ret = 400; break; } diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 661c1f7a88..1f910d41cb 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -269,7 +269,7 @@ static HRGN qt_hrgn_from_qregion(const QRegion ®ion) qt_add_rect(hRegion, region.boundingRect()); return hRegion; } - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) qt_add_rect(hRegion, rect); return hRegion; } @@ -1125,11 +1125,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa painter->setClipRegion(newRegion); #if defined(DEBUG_XP_STYLE) && 0 printf("Using region:\n"); - QVector<QRect> rects = newRegion.rects(); - for (int i = 0; i < rects.count(); ++i) { - const QRect &r = rects.at(i); + for (const QRect &r : newRegion) printf(" (%d, %d, %d, %d)\n", r.x(), r.y(), r.right(), r.bottom()); - } #endif } diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 11f7d973cc..1805e4a8af 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -33,11 +33,7 @@ SOURCES += \ styles/qstylesheetstyle_default.cpp \ styles/qpixmapstyle.cpp -wince* { - RESOURCES += styles/qstyle_wince.qrc -} else { - RESOURCES += styles/qstyle.qrc -} +RESOURCES += styles/qstyle.qrc contains( styles, all ) { styles = fusion mac windows windowsxp windowsvista @@ -95,22 +91,6 @@ contains( styles, fusion ) { DEFINES += QT_NO_STYLE_FUSION } -contains( styles, windowsce ) { - HEADERS += styles/qwindowscestyle_p.h - HEADERS += styles/qwindowscestyle_p_p.h - SOURCES += styles/qwindowscestyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWSCE -} - -contains( styles, windowsmobile ) { - HEADERS += styles/qwindowsmobilestyle_p.h - HEADERS += styles/qwindowsmobilestyle_p_p.h - SOURCES += styles/qwindowsmobilestyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWSMOBILE -} - contains( styles, android ) { HEADERS += styles/qandroidstyle_p.h SOURCES += styles/qandroidstyle.cpp diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 083a4a4f27..5425644b41 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -480,7 +480,7 @@ QMatchData QCompletionEngine::filterHistory() for (int i = 0; i < source->rowCount(); i++) { QString str = source->index(i, c->column).data().toString(); if (str.startsWith(c->prefix, c->cs) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && ((!isFsModel && !isDirModel) || QDir::toNativeSeparators(str) != QDir::separator()) #endif ) @@ -1051,7 +1051,7 @@ void QCompleter::setModel(QAbstractItemModel *model) delete oldModel; #ifndef QT_NO_DIRMODEL if (qobject_cast<QDirModel *>(model)) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1061,7 +1061,7 @@ void QCompleter::setModel(QAbstractItemModel *model) #ifndef QT_NO_FILESYSTEMMODEL QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model); if (fsModel) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1786,7 +1786,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const idx = parent.sibling(parent.row(), index.column()); } while (idx.isValid()); -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) if (list.count() == 1) // only the separator or some other text return list[0]; list[0].clear() ; // the join below will provide the separator @@ -1826,7 +1826,7 @@ QStringList QCompleter::splitPath(const QString& path) const return QStringList(completionPrefix()); QString pathCopy = QDir::toNativeSeparators(path); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\")) return QStringList(pathCopy); const bool startsWithDoubleSlash = pathCopy.startsWith(QLatin1String("\\\\")); @@ -1837,7 +1837,7 @@ QStringList QCompleter::splitPath(const QString& path) const const QChar sep = QDir::separator(); QStringList parts = pathCopy.split(sep); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (startsWithDoubleSlash) parts[0].prepend(QLatin1String("\\\\")); #else diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 3606b7c773..7b0ecc6972 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -141,7 +141,7 @@ QSystemTrayIcon::QSystemTrayIcon(QObject *parent) \sa visible */ QSystemTrayIcon::QSystemTrayIcon(const QIcon &icon, QObject *parent) -: QObject(*new QSystemTrayIconPrivate(), parent) + : QSystemTrayIcon(parent) { setIcon(icon); } @@ -446,19 +446,11 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title titleLabel->setText(title); QFont f = titleLabel->font(); f.setBold(true); -#ifdef Q_OS_WINCE - f.setPointSize(f.pointSize() - 2); -#endif titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows -#ifdef Q_OS_WINCE - const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); - const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; -#else const int iconSize = 18; const int closeButtonSize = 15; -#endif QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); @@ -468,21 +460,13 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QLabel *msgLabel = new QLabel; -#ifdef Q_OS_WINCE - f.setBold(false); - msgLabel->setFont(f); -#endif msgLabel->installEventFilter(this); msgLabel->setText(message); msgLabel->setTextFormat(Qt::PlainText); msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label -#ifdef Q_OS_WINCE - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; -#else int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; -#endif if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { @@ -493,15 +477,9 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title control->document()->setDefaultTextOption(opt); } } -#ifdef Q_OS_WINCE - // Make sure that the text isn't wrapped "somewhere" in the balloon widget - // in the case that we have a long title label. - setMaximumWidth(limit); -#else // Here we allow the text being much smaller than the balloon widget // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); -#endif } QIcon si; diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp deleted file mode 100644 index fa876574f8..0000000000 --- a/src/widgets/util/qsystemtrayicon_wince.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsystemtrayicon_p.h" -#ifndef QT_NO_SYSTEMTRAYICON -#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE - -#include <qt_windows.h> -#include <shlwapi.h> -#include <QApplication> - -QT_BEGIN_NAMESPACE - -static const UINT q_uNOTIFYICONID = 13; // IDs from 0 to 12 are reserved on WinCE. -#define MYWM_NOTIFYICON (WM_APP+101) - -struct Q_NOTIFYICONIDENTIFIER { - DWORD cbSize; - HWND hWnd; - UINT uID; - GUID guidItem; -}; - -class QSystemTrayIconSys : QWidget -{ -public: - QSystemTrayIconSys(QSystemTrayIcon *object); - ~QSystemTrayIconSys(); - bool winEvent( MSG *m, long *result ); - bool trayMessage(DWORD msg); - void setIconContents(NOTIFYICONDATA &data); - void createIcon(); - QRect findTrayGeometry(); - HICON hIcon; - QPoint globalPos; - QSystemTrayIcon *q; -private: - uint notifyIconSize; - int maxTipLength; - bool ignoreNextMouseRelease; -}; - -QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) - : hIcon(0), q(object), ignoreNextMouseRelease(false) - -{ - notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; - maxTipLength = 64; -} - -QSystemTrayIconSys::~QSystemTrayIconSys() -{ - if (hIcon) - DestroyIcon(hIcon); -} - -QRect QSystemTrayIconSys::findTrayGeometry() -{ - // Use lower right corner as fallback - QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight(); - QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10); - return ret; -} - -void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) -{ - tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - tnd.uCallbackMessage = MYWM_NOTIFYICON; - tnd.hIcon = hIcon; - QString tip = q->toolTip(); - - if (!tip.isNull()) { - tip = tip.left(maxTipLength - 1) + QChar(); - memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t)); - } -} - -bool QSystemTrayIconSys::trayMessage(DWORD msg) -{ - NOTIFYICONDATA tnd; - memset(&tnd, 0, notifyIconSize); - tnd.uID = q_uNOTIFYICONID; - tnd.cbSize = notifyIconSize; - tnd.hWnd = winId(); - - Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - - if (msg != NIM_DELETE) { - setIconContents(tnd); - } - - return Shell_NotifyIcon(msg, &tnd); -} - -void QSystemTrayIconSys::createIcon() -{ - hIcon = 0; - QIcon icon = q->icon(); - if (icon.isNull()) - return; - - //const QSize preferredSize(GetSystemMetrics(SM_CXSMICON) * 2, GetSystemMetrics(SM_CYSMICON) * 2); - const QSize preferredSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); - QPixmap pm = icon.pixmap(preferredSize); - if (pm.isNull()) - return; - - hIcon = pm.toWinHICON(); -} - -bool QSystemTrayIconSys::winEvent( MSG *m, long *result ) -{ - switch(m->message) { - case WM_CREATE: - SetWindowLong(winId(), GWL_USERDATA, (LONG)((CREATESTRUCTW*)m->lParam)->lpCreateParams); - break; - - case MYWM_NOTIFYICON: - { - QPoint gpos = QCursor::pos(); - - switch (m->lParam) { - case WM_LBUTTONUP: - if (ignoreNextMouseRelease) - ignoreNextMouseRelease = false; - else - emit q->activated(QSystemTrayIcon::Trigger); - break; - - case WM_LBUTTONDBLCLK: - ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse - // release we must ignore it - emit q->activated(QSystemTrayIcon::DoubleClick); - break; - - case WM_RBUTTONUP: - if (q->contextMenu()) { - q->contextMenu()->popup(gpos); - - // We must ensure that the popup menu doesn't show up behind the task bar. - QRect desktopRect = qApp->desktop()->availableGeometry(); - int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height(); - if (gpos.y() > maxY) { - gpos.ry() = maxY; - q->contextMenu()->move(gpos); - } - } - emit q->activated(QSystemTrayIcon::Context); - break; - - case WM_MBUTTONUP: - emit q->activated(QSystemTrayIcon::MiddleClick); - break; - - default: - break; - } - break; - } - default: - return QWidget::winEvent(m, result); - } - return 0; -} - -QSystemTrayIconPrivate::QSystemTrayIconPrivate() - : sys(0), - visible(false) -{ -} - -QSystemTrayIconPrivate::~QSystemTrayIconPrivate() -{ -} - -void QSystemTrayIconPrivate::install_sys() -{ - Q_Q(QSystemTrayIcon); - if (!sys) { - sys = new QSystemTrayIconSys(q); - sys->createIcon(); - sys->trayMessage(NIM_ADD); - } -} - -void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut) -{ - if (!sys) - return; - - uint uSecs = 0; - if ( timeOut < 0) - uSecs = 10000; //10 sec default - else uSecs = (int)timeOut; - - //message is limited to 255 chars + NULL - QString messageString; - if (message.isEmpty() && !title.isEmpty()) - messageString = QLatin1Char(' '); //ensures that the message shows when only title is set - else - messageString = message.left(255) + QChar(); - - //title is limited to 63 chars + NULL - QString titleString = title.left(63) + QChar(); - - //show QBalloonTip - QRect trayRect = sys->findTrayGeometry(); - QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(), - trayRect.center().y()), uSecs, false); -} - -QRect QSystemTrayIconPrivate::geometry_sys() const -{ - return QRect(); -} - -void QSystemTrayIconPrivate::remove_sys() -{ - if (!sys) - return; - - sys->trayMessage(NIM_DELETE); - delete sys; - sys = 0; -} - -void QSystemTrayIconPrivate::updateIcon_sys() -{ - if (!sys) - return; - - HICON hIconToDestroy = sys->hIcon; - - sys->createIcon(); - sys->trayMessage(NIM_MODIFY); - - if (hIconToDestroy) - DestroyIcon(hIconToDestroy); -} - -void QSystemTrayIconPrivate::updateMenu_sys() -{ - -} - -void QSystemTrayIconPrivate::updateToolTip_sys() -{ - // Calling sys->trayMessage(NIM_MODIFY) on an existing icon is broken on Windows CE. - // So we need to call updateIcon_sys() which creates a new icon handle. - updateIcon_sys(); -} - -bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys() -{ - return true; -} - -bool QSystemTrayIconPrivate::supportsMessages_sys() -{ - return true; -} - -QT_END_NAMESPACE - -#endif diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 1a3ff58793..1863ab9145 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -110,10 +110,8 @@ QT_BEGIN_NAMESPACE */ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent) + : QUndoCommand(parent) { - d = new QUndoCommandPrivate; - if (parent != 0) - parent->d->child_list.append(this); setText(text); } diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 9f43dc42f0..700831771d 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -27,7 +27,7 @@ SOURCES += \ util/qundostack.cpp \ util/qundoview.cpp -win32:!wince:!winrt { +win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp } else:contains(QT_CONFIG, xcb) { SOURCES += util/qsystemtrayicon_x11.cpp diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index b609e4c434..e4f7640a10 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -1,5 +1,4 @@ TARGET = QtWidgets -wince: ORIG_TARGET = $$TARGET QT = core-private gui-private MODULE_CONFIG = uic diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 2ad9f88e6b..90cd6bde99 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -1316,7 +1316,7 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) void QAbstractScrollArea::wheelEvent(QWheelEvent *e) { Q_D(QAbstractScrollArea); - if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal) + if (e->orientation() == Qt::Horizontal) QApplication::sendEvent(d->hbar, e); else QApplication::sendEvent(d->vbar, e); diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 19369d6cb1..d4ba17b08e 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -204,10 +204,8 @@ QCheckBox::QCheckBox(QWidget *parent) */ QCheckBox::QCheckBox(const QString &text, QWidget *parent) - : QAbstractButton (*new QCheckBoxPrivate, parent) + : QCheckBox(parent) { - Q_D(QCheckBox); - d->init(); setText(text); } diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp index 2ec8b1c41a..b6ec2a8d31 100644 --- a/src/widgets/widgets/qcommandlinkbutton.cpp +++ b/src/widgets/widgets/qcommandlinkbutton.cpp @@ -281,23 +281,18 @@ QCommandLinkButton::QCommandLinkButton(QWidget *parent) */ QCommandLinkButton::QCommandLinkButton(const QString &text, QWidget *parent) - : QPushButton(*new QCommandLinkButtonPrivate, parent) + : QCommandLinkButton(parent) { - Q_D(QCommandLinkButton); setText(text); - d->init(); } /*! Constructs a command link with a \a text, a \a description, and a \a parent. */ QCommandLinkButton::QCommandLinkButton(const QString &text, const QString &description, QWidget *parent) - : QPushButton(*new QCommandLinkButtonPrivate, parent) + : QCommandLinkButton(text, parent) { - Q_D(QCommandLinkButton); - setText(text); setDescription(description); - d->init(); } /*! diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 2b68c308ec..0d369eb28c 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -462,9 +462,8 @@ void QDialogButtonBoxPrivate::retranslateStrings() \sa orientation, addButton() */ QDialogButtonBox::QDialogButtonBox(QWidget *parent) - : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0) + : QDialogButtonBox(Qt::Horizontal, parent) { - d_func()->initLayout(); } /*! @@ -487,10 +486,8 @@ QDialogButtonBox::QDialogButtonBox(Qt::Orientation orientation, QWidget *parent) \sa orientation, addButton() */ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent) - : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0) + : QDialogButtonBox(buttons, Qt::Horizontal, parent) { - d_func()->initLayout(); - d_func()->createStandardButtons(buttons); } /*! @@ -501,9 +498,8 @@ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent) */ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation, QWidget *parent) - : QWidget(*new QDialogButtonBoxPrivate(orientation), parent, 0) + : QDialogButtonBox(orientation, parent) { - d_func()->initLayout(); d_func()->createStandardButtons(buttons); } diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 293a04ef88..2358568efe 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -230,7 +230,7 @@ bool QDockWidgetLayout::nativeWindowDeco() const */ bool QDockWidgetLayout::wmSupportsNativeWindowDeco() { -#if defined(Q_OS_WINCE) || defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) return false; #else static const bool xcb = !QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive); @@ -1224,10 +1224,8 @@ QDockWidget::QDockWidget(QWidget *parent, Qt::WindowFlags flags) \sa setWindowTitle() */ QDockWidget::QDockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) - : QWidget(*new QDockWidgetPrivate, parent, flags) + : QDockWidget(parent, flags) { - Q_D(QDockWidget); - d->init(); setWindowTitle(title); } diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index a2ba50695a..b02651767c 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -110,7 +110,7 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) QAlphaWidget::~QAlphaWidget() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // Restore user-defined opacity value if (widget) widget->setWindowOpacity(1); @@ -144,7 +144,7 @@ void QAlphaWidget::run(int time) checkTime.start(); showWidget = true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) qApp->installEventFilter(this); widget->setWindowOpacity(0.0); widget->show(); @@ -251,7 +251,7 @@ void QAlphaWidget::render() else alpha = 1; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (alpha >= 1 || !showWidget) { anim.stop(); qApp->removeEventFilter(this); @@ -268,10 +268,6 @@ void QAlphaWidget::render() if (widget) { if (!showWidget) { -#ifdef Q_OS_WIN - setEnabled(true); - setFocus(); -#endif // Q_OS_WIN widget->hide(); } else { //Since we are faking the visibility of the widget @@ -288,7 +284,7 @@ void QAlphaWidget::render() pm = QPixmap::fromImage(mixedImage); repaint(); } -#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#endif // defined(Q_OS_WIN) } /* diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index 5bdd6f20e6..a9b32ae065 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -194,10 +194,8 @@ QGroupBox::QGroupBox(QWidget *parent) */ QGroupBox::QGroupBox(const QString &title, QWidget *parent) - : QWidget(*new QGroupBoxPrivate, parent, 0) + : QGroupBox(parent) { - Q_D(QGroupBox); - d->init(); setTitle(title); } diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index f8a3be366e..2fbc42330d 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -138,21 +138,17 @@ void QKeySequenceEditPrivate::finishEditing() /*! Constructs a QKeySequenceEdit widget with the given \a parent. */ -QKeySequenceEdit::QKeySequenceEdit(QWidget *parent) : - QWidget(*new QKeySequenceEditPrivate, parent, 0) +QKeySequenceEdit::QKeySequenceEdit(QWidget *parent) + : QKeySequenceEdit(*new QKeySequenceEditPrivate, parent, 0) { - Q_D(QKeySequenceEdit); - d->init(); } /*! Constructs a QKeySequenceEdit widget with the given \a keySequence and \a parent. */ -QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent) : - QWidget(*new QKeySequenceEditPrivate, parent, 0) +QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent) + : QKeySequenceEdit(parent) { - Q_D(QKeySequenceEdit); - d->init(); setKeySequence(keySequence); } diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 5db1013fd2..76713d9880 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -233,10 +233,8 @@ QLabel::QLabel(QWidget *parent, Qt::WindowFlags f) \sa setText(), setAlignment(), setFrameStyle(), setIndent() */ QLabel::QLabel(const QString &text, QWidget *parent, Qt::WindowFlags f) - : QFrame(*new QLabelPrivate(), parent, f) + : QLabel(parent, f) { - Q_D(QLabel); - d->init(); setText(text); } diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 543a7aee11..2703e5d8a3 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -338,11 +338,8 @@ static const char *getSegments(char ch) // gets list of segments f */ QLCDNumber::QLCDNumber(QWidget *parent) - : QFrame(*new QLCDNumberPrivate, parent) + : QLCDNumber(5, parent) { - Q_D(QLCDNumber); - d->ndigits = 5; - d->init(); } diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 499710d18e..9be20ebb74 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -260,10 +260,8 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const \sa setText(), setMaxLength() */ QLineEdit::QLineEdit(QWidget* parent) - : QWidget(*new QLineEditPrivate, parent,0) + : QLineEdit(QString(), parent) { - Q_D(QLineEdit); - d->init(QString()); } /*! @@ -1909,13 +1907,19 @@ void QLineEdit::paintEvent(QPaintEvent *) if (d->shouldShowPlaceholderText()) { if (!d->placeholderText.isEmpty()) { + const Qt::LayoutDirection layoutDir = d->placeholderText.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; + const Qt::Alignment alignPhText = QStyle::visualAlignment(layoutDir, QFlag(d->alignment)); QColor col = pal.text().color(); col.setAlpha(128); QPen oldpen = p.pen(); p.setPen(col); - QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); - p.drawText(lineRect, va, elidedText); + Qt::LayoutDirection oldLayoutDir = p.layoutDirection(); + p.setLayoutDirection(layoutDir); + + const QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); + p.drawText(lineRect, alignPhText, elidedText); p.setPen(oldpen); + p.setLayoutDirection(oldLayoutDir); } } diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 477bb92601..2d19780461 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -100,8 +100,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration(functionName); if (Q_UNLIKELY(!function)) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; + qWarning("Qt could not resolve function %s from " + "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()", + functionName.constData()); return function; } } //namespsace diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index 6c113b556f..b6c5179989 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -89,8 +89,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration(functionName); if (Q_UNLIKELY(!function)) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; + qWarning("Qt could not resolve function %s from " + "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()", + functionName.constData()); return function; } } //namespsace diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index b42ebe7e48..5f3aff5e10 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -2670,9 +2670,8 @@ void QMdiArea::paintEvent(QPaintEvent *paintEvent) { Q_D(QMdiArea); QPainter painter(d->viewport); - const QVector<QRect> &exposedRects = paintEvent->region().rects(); - for (int i = 0; i < exposedRects.size(); ++i) - painter.fillRect(exposedRects.at(i), d->background); + for (const QRect &exposedRect : paintEvent->region()) + painter.fillRect(exposedRect, d->background); } /*! diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 610cb1201f..afe87c6af9 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -412,6 +412,10 @@ bool ControlLabel::event(QEvent *event) { if (event->type() == QEvent::WindowIconChange) updateWindowIcon(); + else if (event->type() == QEvent::StyleChange) { + updateWindowIcon(); + setFixedSize(label.size()); + } #ifndef QT_NO_TOOLTIP else if (event->type() == QEvent::ToolTip) { QStyleOptionTitleBar options; @@ -480,7 +484,8 @@ void ControlLabel::updateWindowIcon() QIcon menuIcon = windowIcon(); if (menuIcon.isNull()) menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); - label = menuIcon.pixmap(16, 16); + const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, 0, parentWidget()); + label = menuIcon.pixmap(iconSize); update(); } @@ -556,7 +561,8 @@ QSize ControllerWidget::sizeHint() const ensurePolished(); QStyleOptionComplex opt; initStyleOption(&opt); - QSize size(48, 16); + const int buttonSize = style()->pixelMetric(QStyle::PM_TitleBarButtonSize, &opt, mdiArea); + QSize size(3 * buttonSize, buttonSize); return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea); } @@ -1769,7 +1775,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) +#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 274570b22a..c03c96333a 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1481,10 +1481,9 @@ QMenu::QMenu(QWidget *parent) \sa title */ QMenu::QMenu(const QString &title, QWidget *parent) - : QWidget(*new QMenuPrivate, parent, Qt::Popup) + : QMenu(parent) { Q_D(QMenu); - d->init(); d->menuAction->setText(title); } @@ -3353,17 +3352,6 @@ void QMenu::actionEvent(QActionEvent *e) d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators); } -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - if (!d->wce_menu) - d->wce_menu = new QMenuPrivate::QWceMenuPrivate; - if (e->type() == QEvent::ActionAdded) - d->wce_menu->addAction(e->action(), d->wce_menu->findAction(e->before())); - else if (e->type() == QEvent::ActionRemoved) - d->wce_menu->removeAction(e->action()); - else if (e->type() == QEvent::ActionChanged) - d->wce_menu->syncAction(e->action()); -#endif - if (isVisible()) { d->updateActionRects(); resize(sizeHint()); diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 7dda38456a..fd931e3d5b 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -45,9 +45,6 @@ #include <QtGui/qicon.h> #include <QtWidgets/qaction.h> -#ifdef Q_OS_WINCE -#include <windef.h> // for HMENU -#endif #ifdef Q_OS_OSX Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); #endif @@ -85,11 +82,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) @@ -208,9 +211,6 @@ public: QPlatformMenu *platformMenu(); void setPlatformMenu(QPlatformMenu *platformMenu); -#ifdef Q_OS_WINCE - HMENU wceMenu(); -#endif #ifdef Q_OS_OSX NSMenu* toNSMenu(); void setAsDockMenu(); @@ -249,10 +249,6 @@ protected: bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE; void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; -#ifdef Q_OS_WINCE - QAction* wceCommands(uint command); -#endif - private Q_SLOTS: void internalDelayedPopup(); diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index 29f5913b5d..d48041b385 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -62,8 +62,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration(functionName); if (Q_UNLIKELY(!function)) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; + qWarning("Qt could not resolve function %s from " + "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()", + functionName.constData()); return function; } } //namespsace diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 0705cd12ea..3ad7c3c7c5 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -68,15 +68,6 @@ QT_BEGIN_NAMESPACE class QTornOffMenu; class QEventLoop; -#ifdef Q_OS_WINCE -struct QWceMenuAction { - uint command; - QPointer<QAction> action; - HMENU menuHandle; - QWceMenuAction() : menuHandle(0), command(0) {} -}; -#endif - template <typename T> class QSetValueOnDestroy { @@ -301,19 +292,13 @@ public: #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), hasCheckableItems(0), doChildEffects(false), platformMenu(0) - -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - ,wce_menu(0) -#endif { } + ~QMenuPrivate() { delete scroll; if (!platformMenu.isNull() && !platformMenu->parent()) delete platformMenu.data(); -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - delete wce_menu; -#endif } void init(); void setPlatformMenu(QPlatformMenu *menu); @@ -473,31 +458,6 @@ public: QPointer<QAction> actionAboutToTrigger; -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - struct QWceMenuPrivate { - QList<QWceMenuAction*> actionItems; - HMENU menuHandle; - QWceMenuPrivate(); - ~QWceMenuPrivate(); - void addAction(QAction *, QWceMenuAction* =0); - void addAction(QWceMenuAction *, QWceMenuAction* =0); - void syncAction(QWceMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QWceMenuAction *); - void rebuild(); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QWceMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QWceMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *wce_menu; - HMENU wceMenu(); - QAction* wceCommands(uint command); -#endif QPointer<QWidget> noReplayFor; static QPointer<QMenu> previousMouseMenu; }; diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp deleted file mode 100644 index d7397746fc..0000000000 --- a/src/widgets/widgets/qmenu_wince.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//Native menubars are only supported for Windows Mobile not the standard SDK/generic WinCE -#ifdef Q_OS_WINCE -#include "qmenu.h" -#include "qt_windows.h" -#include "qapplication.h" -#include "qmainwindow.h" -#include "qtoolbar.h" -#include "qevent.h" -#include "qstyle.h" -#include "qdebug.h" -#include "qwidgetaction.h" -#include <private/qapplication_p.h> -#include <private/qmenu_p.h> -#include <private/qmenubar_p.h> - -#include "qmenu_wince_resource_p.h" - -#include <QtCore/qlibrary.h> -#include <commctrl.h> -#if Q_OS_WINCE_WM -# include <windowsm.h> -#endif - -#ifndef QT_NO_MENUBAR - -#ifndef SHCMBF_EMPTYBAR -#define SHCMBF_EMPTYBAR 0x0001 -#endif - -#ifndef SHCMBM_GETSUBMENU -#define SHCMBM_GETSUBMENU (WM_USER + 401) -#endif - -#ifdef Q_OS_WINCE_WM -# define SHMBOF_NODEFAULT 0x00000001 -# define SHMBOF_NOTIFY 0x00000002 -# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193) -#endif - -extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp -extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp - -QT_BEGIN_NAMESPACE - -static uint qt_wce_menu_static_cmd_id = 200; -static QList<QMenuBar*> nativeMenuBars; - -struct qt_SHMENUBARINFO -{ - DWORD cbSize; - HWND hwndParent; - DWORD dwFlags; - UINT nToolBarId; - HINSTANCE hInstRes; - int nBmpId; - int cBmpImages; - HWND hwndMB; - COLORREF clrBk; -}; - -typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*); -typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL); - -static bool aygResolved = false; -static AygCreateMenuBar ptrCreateMenuBar = 0; -static AygEnableSoftKey ptrEnableSoftKey = 0; - -static void resolveAygLibs() -{ - if (!aygResolved) { - aygResolved = true; - QLibrary aygLib(QLatin1String("aygshell")); - ptrCreateMenuBar = (AygCreateMenuBar) aygLib.resolve("SHCreateMenuBar"); - ptrEnableSoftKey = (AygEnableSoftKey) aygLib.resolve("SHEnableSoftkey"); - } -} - -static void qt_wce_enable_soft_key(HWND handle, uint command) -{ - resolveAygLibs(); - if (ptrEnableSoftKey) - ptrEnableSoftKey(handle, command, false, true); -} - -static void qt_wce_disable_soft_key(HWND handle, uint command) -{ - resolveAygLibs(); - if (ptrEnableSoftKey) - ptrEnableSoftKey(handle, command, false, false); -} - -static void qt_wce_delete_action_list(QList<QWceMenuAction*> *list) -{ - for(QList<QWceMenuAction*>::Iterator it = list->begin(); it != list->end(); ++it) { - QWceMenuAction *action = (*it); - delete action; - action = 0; - } - list->clear(); -} - -//search for first QuitRole in QMenuBar -static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems) -{ - QAction *returnAction = 0; - for (int i = 0; i < actionItems.size(); ++i) { - QAction *action = actionItems.at(i); - if (action->menuRole() == QAction::QuitRole) - returnAction = action; - else - if (action->menu()) - returnAction = qt_wce_get_quit_action(action->menu()->actions()); - if (returnAction) - return returnAction; //return first action found - } - return 0; //nothing found; -} - -static QAction* qt_wce_get_quit_action(QList<QWceMenuAction*> actionItems) -{ - for (int i = 0; i < actionItems.size(); ++i) { - if (actionItems.at(i)->action->menuRole() == QAction::QuitRole) - return actionItems.at(i)->action; - else if (actionItems.at(i)->action->menu()) { - QAction *returnAction = qt_wce_get_quit_action(actionItems.at(i)->action->menu()->actions()); - if (returnAction) - return returnAction; - } - } - return 0; -} - -static HMODULE qt_wce_get_module_handle() -{ - HMODULE module = 0; //handle to resources - if (!(module = GetModuleHandle(L"QtGui4"))) //release dynamic - if (!(module = GetModuleHandle(L"QtGuid4"))) //debug dynamic - module = (HINSTANCE)qWinAppInst(); //static - Q_ASSERT_X(module, "qt_wce_get_module_handle()", "cannot get handle to module?"); - return module; -} - -static void qt_wce_change_command(HWND menuHandle, int item, int command) -{ -TBBUTTONINFOA tbbi; - memset(&tbbi,0,sizeof(tbbi)); - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_COMMAND; - tbbi.idCommand = command; - SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi); -} - -static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText) -{ - TBBUTTONINFOA tbbi; - memset(&tbbi,0,sizeof(tbbi)); - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_TEXT; - QString text = newText; - text.remove(QChar::fromLatin1('&')); - tbbi.pszText = (LPSTR) text.utf16(); - SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi); -} - -static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0) -{ - resolveAygLibs(); - - if (ptrCreateMenuBar) { - qt_SHMENUBARINFO mbi; - memset(&mbi, 0, sizeof(qt_SHMENUBARINFO)); - mbi.cbSize = sizeof(qt_SHMENUBARINFO); - mbi.hwndParent = parentHandle; - mbi.hInstRes = resourceHandle; - mbi.dwFlags = flags; - mbi.nToolBarId = toolbarID; - - if (ptrCreateMenuBar(&mbi)) { -#ifdef Q_OS_WINCE_WM - // Tell the menu bar that we want to override hot key behaviour. - LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, - SHMBOF_NODEFAULT | SHMBOF_NOTIFY); - SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); -#endif - return mbi.hwndMB; - } - } - return 0; -} - -static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action) -{ - Q_ASSERT_X(menu, "AppendMenu", "menu is 0"); - if (action->action->isVisible()) { - int flags; - action->action->isEnabled() ? flags = MF_ENABLED : flags = MF_GRAYED; - - QString text = action->action->iconText(); - text.remove(QChar::fromLatin1('&')); - if (action->action->isSeparator()) { - AppendMenu (menu, MF_SEPARATOR , 0, 0); - } - else if (action->action->menu()) { - text.remove(QChar::fromLatin1('&')); - AppendMenu (menu, MF_STRING | flags | MF_POPUP, - (UINT) action->action->menu()->wceMenu(), reinterpret_cast<const wchar_t *> (text.utf16())); - } - else { - AppendMenu (menu, MF_STRING | flags, action->command, reinterpret_cast<const wchar_t *> (text.utf16())); - } - if (action->action->isCheckable()) - if (action->action->isChecked()) - CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_CHECKED); - else - CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_UNCHECKED); - } -} - -// Removes all items from the menu without destroying the handles. -static void qt_wce_clear_menu(HMENU hMenu) -{ - while (RemoveMenu(hMenu, 0, MF_BYPOSITION)); -} - -/*! - \internal - - This function refreshes the native Windows CE menu. -*/ - -void QMenuBar::wceRefresh() -{ - for (int i = 0; i < nativeMenuBars.size(); ++i) - nativeMenuBars.at(i)->d_func()->wceRefresh(); -} - -void QMenuBarPrivate::wceRefresh() -{ - DrawMenuBar(wce_menubar->menubarHandle); -} - -/*! - \internal - - This function sends native Windows CE commands to Qt menus. -*/ - -QAction* QMenu::wceCommands(uint command) -{ - Q_D(QMenu); - return d->wceCommands(command); -} - -/*! - \internal - - This function sends native Windows CE commands to Qt menu bars - and all their child menus. -*/ - -void QMenuBar::wceCommands(uint command) -{ - const HWND hwndActiveWindow = GetActiveWindow(); - for (int i = 0; i < nativeMenuBars.size(); ++i) { - QMenuBarPrivate* nativeMenuBar = nativeMenuBars.at(i)->d_func(); - if (hwndActiveWindow == nativeMenuBar->wce_menubar->parentWindowHandle) - nativeMenuBar->wceCommands(command); - } -} - -bool QMenuBarPrivate::wceEmitSignals(QList<QWceMenuAction*> actions, uint command) -{ - QAction *foundAction = 0; - for (int i = 0; i < actions.size(); ++i) { - QWceMenuAction *action = actions.at(i); - if (action->action->menu()) { - foundAction = action->action->menu()->wceCommands(command); - if (foundAction) - break; - } - else if (action->command == command) { - action->action->activate(QAction::Trigger); - return true; - } - } - if (foundAction) { - emit q_func()->triggered(foundAction); - return true; - } - return false; -} - -void QMenuBarPrivate::wceCommands(uint command) -{ - if (wceClassicMenu) { - for (int i = 0; i < wce_menubar->actionItemsClassic.size(); ++i) - wceEmitSignals(wce_menubar->actionItemsClassic.at(i), command); - } else { - if (wceEmitSignals(wce_menubar->actionItems, command)) { - return; - } - else if (wce_menubar->leftButtonIsMenu) {//check if command is on the left quick button - wceEmitSignals(wce_menubar->actionItemsLeftButton, command); - } - else if ((wce_menubar->leftButtonAction) && (command == wce_menubar->leftButtonCommand)) { - emit q_func()->triggered(wce_menubar->leftButtonAction); - wce_menubar->leftButtonAction->activate(QAction::Trigger); - } - } -} - -QAction *QMenuPrivate::wceCommands(uint command) -{ - QAction *foundAction = 0; - for (int i = 0; i < wce_menu->actionItems.size(); ++i) { - if (foundAction) - break; - QWceMenuAction *action = wce_menu->actionItems.at(i); - if (action->action->menu()) { - foundAction = action->action->menu()->d_func()->wceCommands(command); - } - else if (action->command == command) { - activateAction(action->action, QAction::Trigger); - return action->action; - } - } - if (foundAction) - emit q_func()->triggered(foundAction); - return foundAction; -} - -void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent) -{ - Q_Q(QMenuBar); - wce_menubar = new QWceMenuBarPrivate(this); - - wce_menubar->parentWindowHandle = parent ? QApplicationPrivate::getHWNDForWidget(parent) : - QApplicationPrivate::getHWNDForWidget(q); - wce_menubar->leftButtonAction = defaultAction; - - wce_menubar->menubarHandle = qt_wce_create_menubar(wce_menubar->parentWindowHandle, (HINSTANCE)qWinAppInst(), 0, SHCMBF_EMPTYBAR); - Q_ASSERT_X(wce_menubar->menubarHandle, "wceCreateMenuBar", "cannot create empty menu bar"); - DrawMenuBar(wce_menubar->menubarHandle); - nativeMenuBars.append(q); - wceClassicMenu = (!qt_wince_is_smartphone() && !qt_wince_is_pocket_pc()); -} - -void QMenuBarPrivate::wceDestroyMenuBar() -{ - Q_Q(QMenuBar); - int index = nativeMenuBars.indexOf(q); - nativeMenuBars.removeAt(index); - if (wce_menubar) { - delete wce_menubar; - wce_menubar = 0; - } -} - -QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate(QMenuBarPrivate *menubar) -: menubarHandle(0), menuHandle(0), leftButtonMenuHandle(0), - leftButtonAction(0), leftButtonIsMenu(false), d(menubar) -{ -} - -QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate() -{ - if (menubarHandle) - DestroyWindow(menubarHandle); - qt_wce_delete_action_list(&actionItems); - qt_wce_delete_action_list(&actionItemsLeftButton); - - for (int i=0; i<actionItemsClassic.size(); ++i) - if (!actionItemsClassic.value(i).empty()) - qt_wce_delete_action_list(&actionItemsClassic[i]); - actionItemsClassic.clear(); - - menubarHandle = 0; - menuHandle = 0; - leftButtonMenuHandle = 0; - leftButtonCommand = 0; - QMenuBar::wceRefresh(); -} - -QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate() -: menuHandle(0) -{ -} - -QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate() -{ - qt_wce_delete_action_list(&actionItems); - if (menuHandle) - DestroyMenu(menuHandle); -} - -void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before) -{ - QWceMenuAction *action = new QWceMenuAction; - action->action = a; - action->command = qt_wce_menu_static_cmd_id++; - addAction(action, before); -} - -void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) -{ - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - rebuild(); -} - -/*! - \internal - - This function will return the HMENU used to create the native - Windows CE menu bar bindings. -*/ - -HMENU QMenu::wceMenu() -{ - return d_func()->wceMenu(); -} - -HMENU QMenuPrivate::wceMenu() -{ - if (!wce_menu) - wce_menu = new QWceMenuPrivate; - if (!wce_menu->menuHandle) - wce_menu->rebuild(); - return wce_menu->menuHandle; -} - -void QMenuPrivate::QWceMenuPrivate::rebuild() -{ - if (!menuHandle) - menuHandle = CreatePopupMenu(); - else - qt_wce_clear_menu(menuHandle); - - for (int i = 0; i < actionItems.size(); ++i) { - QWceMenuAction *action = actionItems.at(i); - action->menuHandle = menuHandle; - qt_wce_insert_action(menuHandle, action); - } - QMenuBar::wceRefresh(); -} - -void QMenuPrivate::QWceMenuPrivate::syncAction(QWceMenuAction *) -{ - rebuild(); -} - -void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action) -{ - actionItems.removeAll(action); - delete action; - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before) -{ - QWceMenuAction *action = new QWceMenuAction; - action->action = a; - action->command = qt_wce_menu_static_cmd_id++; - addAction(action, findAction(before)); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) -{ - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::syncAction(QWceMenuAction*) -{ - QMenuBar::wceRefresh(); - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::removeAction(QWceMenuAction *action) -{ - actionItems.removeAll(action); - delete action; - rebuild(); -} - -void QMenuBarPrivate::_q_updateDefaultAction() -{ - if (wce_menubar) - wce_menubar->rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() -{ - d->q_func()->resize(0,0); - parentWindowHandle = d->q_func()->parentWidget() ? QApplicationPrivate::getHWNDForWidget(d->q_func()->parentWidget()) : - QApplicationPrivate::getHWNDForWidget(d->q_func()); - if (d->wceClassicMenu) { - QList<QAction*> actions = d->actions; - int maxEntries; - int resourceHandle; - if (actions.size() < 5) { - maxEntries = 4; - resourceHandle = IDR_MAIN_MENU3; - } else if (actions.size() < 7) { - maxEntries = 6; - resourceHandle = IDR_MAIN_MENU4; - } - else { - maxEntries = 8; - resourceHandle = IDR_MAIN_MENU5; - } - Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); - qt_wce_clear_menu(menuHandle); - DestroyWindow(menubarHandle); - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle); - Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource"); - DrawMenuBar(menubarHandle); - QList<int> menu_ids; - QList<int> item_ids; - menu_ids << IDM_MENU1 << IDM_MENU2 << IDM_MENU3 << IDM_MENU4 << IDM_MENU5 << IDM_MENU6 << IDM_MENU7 << IDM_MENU8; - item_ids << IDM_ITEM1 << IDM_ITEM2 << IDM_ITEM3 << IDM_ITEM4 << IDM_ITEM5 << IDM_ITEM6 << IDM_ITEM7 << IDM_ITEM8; - - for (int i = 0; i < actionItemsClassic.size(); ++i) - if (!actionItemsClassic.value(i).empty()) - qt_wce_delete_action_list(&actionItemsClassic[i]); - actionItemsClassic.clear(); - - for (int i = 0; i < actions.size(); ++i) { - qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), actions.at(i)->text()); - QList<QAction *> subActions = actions.at(i)->menu()->actions(); - HMENU subMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0 , menu_ids.at(i)); - DeleteMenu(subMenuHandle, item_ids.at(i), MF_BYCOMMAND); - for (int c = 0; c < subActions.size(); ++c) { - QList<QWceMenuAction*> list; - actionItemsClassic.append(list); - QWceMenuAction *action = new QWceMenuAction; - action->action = subActions.at(c); - action->command = qt_wce_menu_static_cmd_id++; - action->menuHandle = subMenuHandle; - actionItemsClassic.last().append(action); - qt_wce_insert_action(subMenuHandle, action); - } - } - for (int i = actions.size();i<maxEntries;++i) { - qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), QString()); - qt_wce_disable_soft_key(menubarHandle, menu_ids.at(i)); - } - } else { - leftButtonAction = d->defaultAction; - if (!leftButtonAction) - leftButtonAction = qt_wce_get_quit_action(actionItems); - - leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu()); - Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); - qt_wce_clear_menu(menuHandle); - DestroyWindow(menubarHandle); - if (leftButtonIsMenu) { - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2); - Q_ASSERT_X(menubarHandle, "rebuild !created left menubar", "cannot create menubar from resource"); - menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU); - Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?"); - DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND); - leftButtonMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_LEFTMENU); - Q_ASSERT_X(leftButtonMenuHandle, "rebuild !created", "IDM_LEFTMENU not found - invalid resource?"); - DeleteMenu(leftButtonMenuHandle, IDM_VIEW, MF_BYCOMMAND); - } else { - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU); - Q_ASSERT_X(menubarHandle, "rebuild !created no left menubar", "cannot create menubar from resource"); - menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU); - Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?"); - DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND); - leftButtonMenuHandle = 0; - leftButtonCommand = qt_wce_menu_static_cmd_id++; - qt_wce_change_command(menubarHandle, IDM_EXIT, leftButtonCommand); - } - - if (actionItems.size() == 0) { - qt_wce_rename_menu_item(menubarHandle, IDM_MENU, QLatin1String("")); - qt_wce_disable_soft_key(menubarHandle, IDM_MENU); - } - for (int i = 0; i < actionItems.size(); ++i) { - QWceMenuAction *action = actionItems.at(i); - action->menuHandle = menuHandle; - qt_wce_insert_action(menuHandle, action); - } - if (!leftButtonIsMenu) { - if (leftButtonAction) { - qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, leftButtonAction->text()); - qt_wce_enable_soft_key(menubarHandle, leftButtonCommand); - } else { - qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String("")); - qt_wce_disable_soft_key(menubarHandle, leftButtonCommand); - } - } else { - qt_wce_rename_menu_item(menubarHandle, IDM_LEFTMENU, leftButtonAction->text()); - QList<QAction *> actions = leftButtonAction->menu()->actions(); - qt_wce_delete_action_list(&actionItemsLeftButton); - for (int i=0; i<actions.size(); ++i) { - QWceMenuAction *action = new QWceMenuAction; - action->action = actions.at(i); - action->command = qt_wce_menu_static_cmd_id++; - action->menuHandle = leftButtonMenuHandle; - actionItemsLeftButton.append(action); - qt_wce_insert_action(leftButtonMenuHandle, action); - } - } - } - DrawMenuBar(menubarHandle); -} - -QT_END_NAMESPACE - -#endif //QT_NO_MENUBAR -#endif //Q_OS_WINCE diff --git a/src/widgets/widgets/qmenu_wince.rc b/src/widgets/widgets/qmenu_wince.rc deleted file mode 100644 index 0bcd32c7e5..0000000000 --- a/src/widgets/widgets/qmenu_wince.rc +++ /dev/null @@ -1,231 +0,0 @@ -#include "qmenu_wince_resource_p.h" - -#include <commctrl.h> -#include "winuser.h" - -#if defined (_DEBUG) && defined(QT_SHARED) -#include "Qt5Widgetsd_resource.rc" -#elif defined(QT_SHARED) -#include "Qt5Widgets_resource.rc" -#endif - -#define DIALOGEX DIALOG DISCARDABLE -#define SHMENUBAR RCDATA -#define I_IMAGENONE (-2) -#define NOMENU 0xFFFF - -IDR_MAIN_MENU MENU DISCARDABLE -BEGIN - POPUP "Menu" - BEGIN - MENUITEM "About", IDM_ABOUT - END -END - -IDR_MAIN_MENU2 MENU DISCARDABLE -BEGIN - POPUP "Menu" - BEGIN - MENUITEM "About", IDM_ABOUT - END - POPUP "Display" - BEGIN - MENUITEM "View", IDM_VIEW - END -END - - -IDR_MAIN_MENU3 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END -END - -IDR_MAIN_MENU4 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END - POPUP "Menu5" - BEGIN - MENUITEM "Item5", IDM_ITEM5 - END - POPUP "Menu6" - BEGIN - MENUITEM "Item6", IDM_ITEM6 - END -END - -IDR_MAIN_MENU5 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END - POPUP "Menu5" - BEGIN - MENUITEM "Item5", IDM_ITEM5 - END - POPUP "Menu6" - BEGIN - MENUITEM "Item6", IDM_ITEM6 - END - POPUP "Menu7" - BEGIN - MENUITEM "Item7", IDM_ITEM7 - END - POPUP "Menu8" - BEGIN - MENUITEM "Item8", IDM_ITEM8 - END -END - -STRINGTABLE -BEGIN - IDS_EXIT "Exit" - IDS_MENU "Menu" - IDS_LEFTMENU "Display" - IDS_MENU1 "Menu__1" - IDS_MENU2 "Menu__2" - IDS_MENU3 "Menu__3" - IDS_MENU4 "Menu__4" - IDS_MENU5 "Menu__5" - IDS_MENU6 "Menu__6" - IDS_MENU7 "Menu__7" - IDS_MENU8 "Menu__8" -END - -IDR_MAIN_MENU SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU, - 2, - - I_IMAGENONE, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, - IDS_EXIT, 0, NOMENU, - - I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU, 0, 0, -END - -IDR_MAIN_MENU2 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU2, - 2, - - I_IMAGENONE, IDM_LEFTMENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_LEFTMENU, 0, 1, - - I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU, 0, 0, -END - -IDR_MAIN_MENU3 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU3, - 4, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, -END - -IDR_MAIN_MENU4 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU4, - 6, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, - - I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU5, 0, 4, - - I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU6, 0, 5, -END - -IDR_MAIN_MENU5 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU5, - 8, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, - - I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU5, 0, 4, - - I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU6, 0, 5, - - I_IMAGENONE, IDM_MENU7, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU7, 0, 6, - - I_IMAGENONE, IDM_MENU8, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU8, 0, 7, -END diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h deleted file mode 100644 index 3bd83d934f..0000000000 --- a/src/widgets/widgets/qmenu_wince_resource_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - - -#define IDR_MAIN_MENU 102 -#define IDR_MAIN_MENU2 103 -#define IDR_MAIN_MENU3 104 -#define IDS_EXIT 105 -#define IDS_MENU 106 -#define IDS_LEFTMENU 107 -#define IDM_ABOUT 108 -#define IDM_VIEW 109 -#define IDM_ITEM1 108 -#define IDM_ITEM2 109 -#define IDM_ITEM3 110 -#define IDM_ITEM4 111 -#define IDM_ITEM5 112 -#define IDM_ITEM6 113 -#define IDM_ITEM7 114 -#define IDM_ITEM8 115 -#define IDS_MENU1 116 -#define IDS_MENU2 117 -#define IDS_MENU3 118 -#define IDS_MENU4 119 -#define IDS_MENU5 120 -#define IDS_MENU6 121 -#define IDS_MENU7 122 -#define IDS_MENU8 123 -#define IDR_MAIN_MENU4 124 -#define IDR_MAIN_MENU5 125 -#define IDM_EXIT 40000 -#define IDM_MENU 40001 -#define IDM_LEFTMENU 40002 -#define IDM_MENU1 40003 -#define IDM_MENU2 40004 -#define IDM_MENU3 40005 -#define IDM_MENU4 40006 -#define IDM_MENU5 40007 -#define IDM_MENU6 40008 -#define IDM_MENU7 40009 -#define IDM_MENU8 40010 - diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 85d0c54357..59cf9c9aee 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -64,10 +64,6 @@ #include "qmenubar_p.h" #include "qdebug.h" -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp -#endif - QT_BEGIN_NAMESPACE class QMenuBarExtension : public QToolButton @@ -701,16 +697,6 @@ void QMenuBarPrivate::init() if (platformMenuBar) q->hide(); -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) { - wceCreateMenuBar(q->parentWidget()); - if(wce_menubar) - q->hide(); - } - else { - QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); - } -#endif q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; handleReparent(); @@ -761,11 +747,6 @@ QMenuBar::~QMenuBar() Q_D(QMenuBar); delete d->platformMenuBar; d->platformMenuBar = 0; - -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - d->wceDestroyMenuBar(); -#endif } /*! @@ -1017,7 +998,7 @@ void QMenuBar::paintEvent(QPaintEvent *e) */ void QMenuBar::setVisible(bool visible) { -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) if (isNativeMenuBar()) { if (!visible) QWidget::setVisible(false); @@ -1234,11 +1215,7 @@ void QMenuBar::actionEvent(QActionEvent *e) d->itemsDirty = true; if (d->platformMenuBar) { -#if !defined(Q_OS_WINCE) QPlatformMenuBar *nativeMenuBar = d->platformMenuBar; -#else - QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar; -#endif if (!nativeMenuBar) return; @@ -1379,11 +1356,6 @@ void QMenuBarPrivate::handleReparent() platformMenuBar->handleReparent(0); } } - -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile() && wce_menubar) - wce_menubar->rebuild(); -#endif } /*! @@ -1563,7 +1535,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1619,7 +1591,7 @@ QSize QMenuBar::minimumSizeHint() const QSize QMenuBar::sizeHint() const { Q_D(const QMenuBar); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1677,7 +1649,7 @@ QSize QMenuBar::sizeHint() const int QMenuBar::heightForWidth(int) const { Q_D(const QMenuBar); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1862,55 +1834,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar() } /*! - \since 4.4 - - Sets the default action to \a act. - - The default action is assigned to the left soft key. The menu is assigned - to the right soft key. - - Currently there is only support for the default action on Windows - Mobile. On all other platforms this method is not available. - - \sa defaultAction() -*/ - -#ifdef Q_OS_WINCE -void QMenuBar::setDefaultAction(QAction *act) -{ - Q_D(QMenuBar); - if (d->defaultAction == act) - return; - if (qt_wince_is_mobile()) - if (d->defaultAction) { - disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); - disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); - } - d->defaultAction = act; - if (qt_wince_is_mobile()) - if (d->defaultAction) { - connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); - connect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); - } - if (d->wce_menubar) { - d->wce_menubar->rebuild(); - } -} - -/*! - \since 4.4 - - Returns the current default action. - - \sa setDefaultAction() -*/ -QAction *QMenuBar::defaultAction() const -{ - return d_func()->defaultAction; -} -#endif - -/*! \fn void QMenuBar::triggered(QAction *action) This signal is emitted when an action in a menu belonging to this menubar diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index d3f5e503ac..404bd13332 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -95,13 +95,6 @@ public: void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner); QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; -#ifdef Q_OS_WINCE - void setDefaultAction(QAction *); - QAction *defaultAction() const; - - static void wceCommands(uint command); - static void wceRefresh(); -#endif #ifdef Q_OS_OSX NSMenu* toNSMenu(); #endif @@ -141,10 +134,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int)) Q_PRIVATE_SLOT(d_func(), void _q_updateLayout()) -#ifdef Q_OS_WINCE - Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction()) -#endif - friend class QMenu; friend class QMenuPrivate; friend class QWindowsStyle; diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index 05b1878c20..8a01cb3233 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -66,17 +66,11 @@ public: QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0), closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0) + { } -#ifdef Q_OS_WINCE - , wce_menubar(0), wceClassicMenu(false) -#endif - { } ~QMenuBarPrivate() { delete platformMenuBar; -#ifdef Q_OS_WINCE - delete wce_menubar; -#endif } void init(); @@ -118,10 +112,6 @@ public: void _q_internalShortcutActivated(int); void _q_updateLayout(); -#ifdef Q_OS_WINCE - void _q_updateDefaultAction(); -#endif - //extra widgets in the menubar QPointer<QWidget> leftWidget, rightWidget; QMenuBarExtension *extension; @@ -146,47 +136,6 @@ public: QPlatformMenu *getPlatformMenu(QAction *action); inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); } - -#ifdef Q_OS_WINCE - void wceCreateMenuBar(QWidget *); - void wceDestroyMenuBar(); - struct QWceMenuBarPrivate { - QList<QWceMenuAction*> actionItems; - QList<QWceMenuAction*> actionItemsLeftButton; - QList<QList<QWceMenuAction*>> actionItemsClassic; - HMENU menuHandle; - HMENU leftButtonMenuHandle; - HWND menubarHandle; - HWND parentWindowHandle; - bool leftButtonIsMenu; - QPointer<QAction> leftButtonAction; - QMenuBarPrivate *d; - int leftButtonCommand; - - QWceMenuBarPrivate(QMenuBarPrivate *menubar); - ~QWceMenuBarPrivate(); - void addAction(QAction *, QAction *); - void addAction(QAction *, QWceMenuAction* =0); - void addAction(QWceMenuAction *, QWceMenuAction* =0); - void syncAction(QWceMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QWceMenuAction *); - void rebuild(); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QWceMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QWceMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *wce_menubar; - bool wceClassicMenu; - void wceCommands(uint command); - void wceRefresh(); - bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command); -#endif }; #endif // QT_NO_MENUBAR diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index a3bb06c063..5608a4aff9 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -254,11 +254,9 @@ QPushButton::QPushButton(QWidget *parent) */ QPushButton::QPushButton(const QString &text, QWidget *parent) - : QAbstractButton(*new QPushButtonPrivate, parent) + : QPushButton(parent) { - Q_D(QPushButton); setText(text); - d->init(); } @@ -270,12 +268,10 @@ QPushButton::QPushButton(const QString &text, QWidget *parent) */ QPushButton::QPushButton(const QIcon& icon, const QString &text, QWidget *parent) - : QAbstractButton(*new QPushButtonPrivate, parent) + : QPushButton(*new QPushButtonPrivate, parent) { - Q_D(QPushButton); setText(text); setIcon(icon); - d->init(); } /*! \internal diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index 55a584078a..284c5f56cf 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -155,10 +155,8 @@ QRadioButton::~QRadioButton() */ QRadioButton::QRadioButton(const QString &text, QWidget *parent) - : QAbstractButton(*new QRadioButtonPrivate, parent) + : QRadioButton(parent) { - Q_D(QRadioButton); - d->init(); setText(text); } diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 7dd41f6a0c..79bfedb8c4 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -348,10 +348,8 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const initial \l {QAbstractSlider::value} {value} of 0. */ QScrollBar::QScrollBar(QWidget *parent) - : QAbstractSlider(*new QScrollBarPrivate, parent) + : QScrollBar(Qt::Vertical, parent) { - d_func()->orientation = Qt::Vertical; - d_func()->init(); } /*! @@ -397,12 +395,6 @@ void QScrollBarPrivate::init() q->setSizePolicy(sp); q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); q->setAttribute(Qt::WA_OpaquePaintEvent); - -#if !defined(QT_NO_CONTEXTMENU) && defined(Q_OS_WINCE) - if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) { - q->setContextMenuPolicy(Qt::PreventContextMenu); - } -#endif } #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp index 7b675fccbd..744a43253a 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -284,10 +284,8 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) Constructs a vertical slider with the given \a parent. */ QSlider::QSlider(QWidget *parent) - : QAbstractSlider(*new QSliderPrivate, parent) + : QSlider(Qt::Vertical, parent) { - d_func()->orientation = Qt::Vertical; - d_func()->init(); } /*! diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index e3ca6b0a79..3f1fa2d015 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -941,11 +941,8 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) \sa setOrientation() */ QSplitter::QSplitter(QWidget *parent) - : QFrame(*new QSplitterPrivate, parent) + : QSplitter(Qt::Horizontal, parent) { - Q_D(QSplitter); - d->orient = Qt::Horizontal; - d->init(); } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 6c748c09bb..9cc44007bd 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2522,6 +2522,34 @@ QWidget *QTabBar::tabButton(int index, ButtonPosition position) const return d->tabList.at(index).rightWidget; } +#ifndef QT_NO_ACCESSIBILITY +/*! + Sets the accessibleName of the tab at position \a index to \a name. +*/ +void QTabBar::setAccessibleTabName(int index, const QString &name) +{ + Q_D(QTabBar); + if (QTabBarPrivate::Tab *tab = d->at(index)) { + tab->accessibleName = name; + QAccessibleEvent event(this, QAccessible::NameChanged); + event.setChild(index); + QAccessible::updateAccessibility(&event); + } +} + +/*! + Returns the accessibleName of the tab at position \a index, or an empty + string if \a index is out of range. +*/ +QString QTabBar::accessibleTabName(int index) const +{ + Q_D(const QTabBar); + if (const QTabBarPrivate::Tab *tab = d->at(index)) + return tab->accessibleName; + return QString(); +} +#endif // QT_NO_ACCESSIBILITY + CloseButton::CloseButton(QWidget *parent) : QAbstractButton(parent) { diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 138c5470c6..84b2d40aea 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -172,6 +172,11 @@ public: bool changeCurrentOnDrag() const; void setChangeCurrentOnDrag(bool change); +#ifndef QT_NO_ACCESSIBILITY + QString accessibleTabName(int index) const; + void setAccessibleTabName(int index, const QString &name); +#endif + public Q_SLOTS: void setCurrentIndex(int index); diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 48f235f050..7c50ebd235 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -131,6 +131,9 @@ public: QWidget *rightWidget; int lastTab; int dragOffset; +#ifndef QT_NO_ACCESSIBILITY + QString accessibleName; +#endif #ifndef QT_NO_ANIMATION ~Tab() { delete animation; } diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index c74372cfa4..b93cefd867 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -520,10 +520,8 @@ QToolBar::QToolBar(QWidget *parent) \sa setWindowTitle() */ QToolBar::QToolBar(const QString &title, QWidget *parent) - : QWidget(*new QToolBarPrivate, parent, 0) + : QToolBar(parent) { - Q_D(QToolBar); - d->init(); setWindowTitle(title); } @@ -1186,17 +1184,6 @@ bool QToolBar::event(QEvent *event) if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event))) return true; break; -#ifdef Q_OS_WINCE - case QEvent::ContextMenu: - { - QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event); - QWidget* child = childAt(contextMenuEvent->pos()); - QAbstractButton* button = qobject_cast<QAbstractButton*>(child); - if (button) - button->setDown(false); - } - break; -#endif case QEvent::Leave: if (d->state != 0 && d->state->dragging) { #ifdef Q_OS_WIN diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h index 774d47b913..c1d765598f 100644 --- a/src/widgets/widgets/qtoolbar.h +++ b/src/widgets/widgets/qtoolbar.h @@ -100,11 +100,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> QAction *addAction(const QString &text, Functor functor); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 784055ed62..abba3e0472 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -155,19 +155,3 @@ macx { widgets/qmacnativewidget_mac.mm \ widgets/qmaccocoaviewcontainer_mac.mm } - -wince { - SOURCES += widgets/qmenu_wince.cpp - HEADERS += widgets/qmenu_wince_resource_p.h - RC_FILE = widgets/qmenu_wince.rc - !static: QMAKE_WRITE_DEFAULT_RC = 1 - !isEmpty(QT_LIBINFIX) { - ORIG_RCFILE = $${TARGET}_resource.rc - copyrcc.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - copyrcc.input = ORIG_RCFILE - CONFIG(debug, debug|release):copyrcc.output = $${ORIG_TARGET}d_resource.rc - else:copyrcc.output = $${ORIG_TARGET}_resource.rc - copyrcc.CONFIG = target_predeps no_link - QMAKE_EXTRA_COMPILERS += copyrcc - } -} diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index bf416e11d3..7087176110 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -53,9 +53,7 @@ #include "qstring.h" #include "qvector.h" -#ifndef Q_OS_WINCE -# include <shlobj.h> -#endif +#include <shlobj.h> /* This file contains the code in the qtmain library for Windows. @@ -69,11 +67,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) -extern void __cdecl qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &); -#else extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &); -#endif QT_END_NAMESPACE @@ -84,12 +78,8 @@ QT_USE_NAMESPACE int qMain(int, char **); #define main qMain #else -#ifdef Q_OS_WINCE -extern "C" int __cdecl main(int, char **); -#else extern "C" int main(int, char **); #endif -#endif /* WinMain() - Initializes Windows and calls user's startup function main(). @@ -97,8 +87,6 @@ extern "C" int main(int, char **); application. */ -#ifndef Q_OS_WINCE - // Convert a wchar_t to char string, equivalent to QString::toLocal8Bit() // when passed CP_ACP. static inline char *wideToMulti(int codePage, const wchar_t *aw) @@ -126,48 +114,3 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int delete [] argv; return exitCode; } - -#else // !Q_OS_WINCE - -int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR /*wCmdParam*/, int cmdShow) -{ - QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit(); - - wchar_t appName[MAX_PATH]; - GetModuleFileName(0, appName, MAX_PATH); - cmdParam.prepend(QString(QLatin1String("\"%1\" ")).arg(QString::fromWCharArray(appName)).toLocal8Bit()); - - int argc = 0; - QVector<char *> argv(8); - qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv); - - wchar_t uniqueAppID[MAX_PATH]; - GetModuleFileName(0, uniqueAppID, MAX_PATH); - QString uid = QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"), QLatin1String("_")); - - // If there exists an other instance of this application - // it will be the owner of a mutex with the unique ID. - HANDLE mutex = CreateMutex(NULL, TRUE, (LPCWSTR)uid.utf16()); - if (mutex && ERROR_ALREADY_EXISTS == GetLastError()) { - CloseHandle(mutex); - - // The app is already running, so we use the unique - // ID to create a unique messageNo, which is used - // as the registered class name for the windows - // created. Set the first instance's window to the - // foreground, else just terminate. - // Use bitwise 0x01 OR to reactivate window state if - // it was hidden - UINT msgNo = RegisterWindowMessage((LPCWSTR)uid.utf16()); - HWND aHwnd = FindWindow((LPCWSTR)QString::number(msgNo).utf16(), 0); - if (aHwnd) - SetForegroundWindow((HWND)(((ULONG)aHwnd) | 0x01)); - return 0; - } - - int result = main(argc, argv.data()); - CloseHandle(mutex); - return result; -} - -#endif // Q_OS_WINCE diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index e8c9ace03b..828ef6cf5a 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -21,7 +21,7 @@ winrt { } else { SOURCES = qtmain_win.cpp - !wince: LIBS += -lshell32 + LIBS += -lshell32 } load(qt_installs) @@ -31,5 +31,3 @@ TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end load(qt_targets) load(qt_build_paths) load(qt_common) - -wince: QMAKE_POST_LINK = diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 320e0095d3..a8d64f1cd9 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -62,8 +62,8 @@ private slots: void tst_QParallelAnimationGroup::initTestCase() { qRegisterMetaType<QAbstractAnimation::State>("QAbstractAnimation::State"); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) - // give the mac/wince app start event queue time to clear +#if defined(Q_OS_DARWIN) + // give the Darwin app start event queue time to clear QTest::qWait(1000); #endif } diff --git a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro index 9f2e4f9c92..302d887fc7 100644 --- a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro +++ b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro @@ -1,4 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = test - -!wince: SUBDIRS += echo +SUBDIRS = test echo diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro index 2b0af4fa4c..214c706ca5 100644 --- a/tests/auto/corelib/global/qtendian/qtendian.pro +++ b/tests/auto/corelib/global/qtendian/qtendian.pro @@ -2,7 +2,3 @@ CONFIG += testcase TARGET = tst_qtendian QT = core testlib SOURCES = tst_qtendian.cpp -wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE - QMAKE_CFLAGS_RELEASE -= -O2 - QMAKE_CXXFLAGS_RELEASE -= -O2 -} diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 29717b3a1c..24c762ed84 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -35,7 +35,7 @@ SUBDIRS=\ qurlquery \ qwinoverlappedionotifier \ -!win32|wince* { +!win32 { SUBDIRS -=\ qwinoverlappedionotifier } diff --git a/tests/auto/corelib/io/largefile/largefile.pro b/tests/auto/corelib/io/largefile/largefile.pro index caef116684..6c1bb8d7ea 100644 --- a/tests/auto/corelib/io/largefile/largefile.pro +++ b/tests/auto/corelib/io/largefile/largefile.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_largefile QT = core testlib SOURCES = tst_largefile.cpp - -wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index e448093062..a19a5ce58d 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -39,18 +39,12 @@ #include <cstdio> #ifdef Q_OS_WIN - -#include <windows.h> - -#ifndef Q_OS_WINCE -#include <io.h> -#endif - -#ifndef FSCTL_SET_SPARSE +# include <qt_windows.h> +# include <io.h> +# ifndef FSCTL_SET_SPARSE // MinGW doesn't define this. -#define FSCTL_SET_SPARSE (0x900C4) -#endif - +# define FSCTL_SET_SPARSE (0x900C4) +# endif #endif // Q_OS_WIN class tst_LargeFile diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index f5a546ebf1..912d782ffa 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -35,8 +35,6 @@ #include <QtGui/QPainter> #include <QtGui/QPen> -#include "../../../qtest-config.h" - class tst_QDataStream : public QObject { Q_OBJECT @@ -65,7 +63,7 @@ private slots: void stream_QByteArray_data(); void stream_QByteArray(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void stream_QCursor_data(); void stream_QCursor(); #endif @@ -88,10 +86,8 @@ private slots: void stream_QPen_data(); void stream_QPen(); -#ifndef Q_OS_WINCE void stream_QPixmap_data(); void stream_QPixmap(); -#endif void stream_QPoint_data(); void stream_QPoint(); @@ -123,10 +119,8 @@ private slots: void stream_qint64_data(); void stream_qint64(); -#ifndef Q_OS_WINCE void stream_QIcon_data(); void stream_QIcon(); -#endif void stream_QEasingCurve_data(); void stream_QEasingCurve(); @@ -193,7 +187,7 @@ private: void writeQBrush(QDataStream *s); void writeQColor(QDataStream *s); void writeQByteArray(QDataStream *s); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void writeQCursor(QDataStream *s); #endif void writeQWaitCursor(QDataStream *s); @@ -222,7 +216,7 @@ private: void readQBrush(QDataStream *s); void readQColor(QDataStream *s); void readQByteArray(QDataStream *s); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void readQCursor(QDataStream *s); #endif void readQDate(QDataStream *s); @@ -1023,7 +1017,7 @@ void tst_QDataStream::readQByteArray(QDataStream *s) } // ************************************ -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR static QCursor qCursorData(int index) { switch (index) { @@ -1042,21 +1036,21 @@ static QCursor qCursorData(int index) } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QDataStream::stream_QCursor_data() { stream_data(9); } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QDataStream::stream_QCursor() { STREAM_IMPL(QCursor); } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QDataStream::writeQCursor(QDataStream *s) { QCursor d5(qCursorData(dataIndex(QTest::currentDataTag()))); @@ -1064,7 +1058,7 @@ void tst_QDataStream::writeQCursor(QDataStream *s) } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QDataStream::readQCursor(QDataStream *s) { QCursor test(qCursorData(dataIndex(QTest::currentDataTag()))); @@ -1542,24 +1536,16 @@ void tst_QDataStream::readQPen(QDataStream *s) // pixmap testing is currently limited to one pixmap only. // -#ifndef Q_OS_WINCE -// Test depends on more memory than available on Qt/CE void tst_QDataStream::stream_QPixmap_data() { stream_data(1); } -#endif -#ifndef Q_OS_WINCE -// Test depends on more memory than available on Qt/CE void tst_QDataStream::stream_QPixmap() { STREAM_IMPL(QPixmap); } -#endif -#ifndef Q_OS_WINCE -// Test depends on more memory than available on Qt/CE void tst_QDataStream::stream_QIcon_data() { stream_data(1); @@ -1569,7 +1555,6 @@ void tst_QDataStream::stream_QIcon() { STREAM_IMPL(QIcon); } -#endif void tst_QDataStream::writeQPixmap(QDataStream *s) { @@ -1844,7 +1829,7 @@ static QRegion qRegionData(int index) case 4: return QRegion(100, -100, 2048, 4096, QRegion::Rectangle); case 5: return QRegion(-100, 100, 4096, 2048, QRegion::Rectangle); case 6: return QRegion(0, 0, 0, 0, QRegion::Ellipse); -#if (!defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)) // all our Unix platforms use X regions. +#if !defined(Q_OS_UNIX) // all our Unix platforms use X regions. case 7: return QRegion(1, 2, 300, 400, QRegion::Ellipse); case 8: return QRegion(100, 100, 1024, 768, QRegion::Ellipse); case 9: return QRegion(-100, -100, 1024, 1024, QRegion::Ellipse); @@ -2496,12 +2481,10 @@ void tst_QDataStream::status_charptr_QByteArray_data() QTest::addColumn<int>("expectedStatus"); QTest::addColumn<QByteArray>("expectedString"); -#if !defined(Q_OS_WINCE) QByteArray oneMbMinus1(1024 * 1024 - 1, '\0'); for (int i = 0; i < oneMbMinus1.size(); ++i) oneMbMinus1[i] = 0x1 | (8 * ((uchar)i / 9)); QByteArray threeMbMinus1 = oneMbMinus1 + 'j' + oneMbMinus1 + 'k' + oneMbMinus1; -#endif // ok QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QByteArray(); @@ -2510,14 +2493,12 @@ void tst_QDataStream::status_charptr_QByteArray_data() QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x03jkl", 7) << (int) QDataStream::Ok << QByteArray("jkl"); QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x04jklm", 8) << (int) QDataStream::Ok << QByteArray("jklm"); QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x04jklmj", 8) << (int) QDataStream::Ok << QByteArray("jklm"); -#if !defined(Q_OS_WINCE) QTest::newRow("size 1MB-1") << QByteArray("\x00\x0f\xff\xff", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << oneMbMinus1; QTest::newRow("size 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "j"; QTest::newRow("size 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "jk"; QTest::newRow("size 3MB-1") << QByteArray("\x00\x2f\xff\xff", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << threeMbMinus1; QTest::newRow("size 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "j"; QTest::newRow("size 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "jk"; -#endif // past end QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QByteArray(); @@ -2530,12 +2511,10 @@ void tst_QDataStream::status_charptr_QByteArray_data() QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x02j", 5) << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x03jk", 6) << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x04jkl", 7) << (int) QDataStream::ReadPastEnd << QByteArray(); -#if !defined(Q_OS_WINCE) QTest::newRow("badsize 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray(); -#endif QTest::newRow("size -1") << QByteArray("\xff\xff\xff\xff", 4) << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QByteArray(); } @@ -2600,7 +2579,6 @@ void tst_QDataStream::status_QString_data() QTest::addColumn<int>("expectedStatus"); QTest::addColumn<QString>("expectedString"); -#if !defined(Q_OS_WINCE) QString oneMbMinus1; oneMbMinus1.resize(1024 * 1024 - 1); for (int i = 0; i < oneMbMinus1.size(); ++i) @@ -2609,7 +2587,6 @@ void tst_QDataStream::status_QString_data() QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1); QByteArray oneMbMinus1Data = qstring2qbytearray(oneMbMinus1); -#endif // ok QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QString(); @@ -2618,14 +2595,12 @@ void tst_QDataStream::status_QString_data() QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x06\x00j\x00k\x00l", 10) << (int) QDataStream::Ok << QString("jkl"); QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00m", 12) << (int) QDataStream::Ok << QString("jklm"); QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00mjj", 14) << (int) QDataStream::Ok << QString("jklm"); -#if !defined(Q_OS_WINCE) QTest::newRow("size 1MB-1") << QByteArray("\x00\x1f\xff\xfe", 4) + oneMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << oneMbMinus1; QTest::newRow("size 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "j"; QTest::newRow("size 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "jk"; QTest::newRow("size 3MB-1") << QByteArray("\x00\x5f\xff\xfe", 4) + threeMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << threeMbMinus1; QTest::newRow("size 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "j"; QTest::newRow("size 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "jk"; -#endif // past end QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QString(); @@ -2638,14 +2613,12 @@ void tst_QDataStream::status_QString_data() QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x04jj", 6) << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x06jjkk", 8) << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x08jjkkll", 10) << (int) QDataStream::ReadPastEnd << QString(); -#if !defined(Q_OS_WINCE) QTest::newRow("badsize 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("size MAX") << QByteArray("\x7f\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString(); -#endif // corrupt data QTest::newRow("corrupt1") << QByteArray("yyyy") << (int) QDataStream::ReadCorruptData << QString(); diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 703e9c5b07..3924716b55 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -35,7 +35,7 @@ #include <qregexp.h> #include <qstringlist.h> -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) #include <QtCore/private/qfsfileengine_p.h> #include "../../../network-settings.h" #endif @@ -163,9 +163,8 @@ private slots: void operator_eq(); -#ifndef Q_OS_WINCE void dotAndDotDot(); -#endif + void homePath(); void tempPath(); void rootPath(); @@ -316,7 +315,7 @@ void tst_QDir::setPath_data() QTest::addColumn<QString>("dir2"); QTest::newRow("data0") << QString(".") << QString(".."); -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("data1") << QString("c:/") << QDir::currentPath(); #endif } @@ -543,7 +542,7 @@ void tst_QDir::exists_data() QTest::newRow("simple dir") << (m_dataPath + "/resources") << true; QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << true; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -555,7 +554,7 @@ void tst_QDir::exists_data() QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << false; QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false; #endif -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("This drive should exist") << "C:/" << true; // find a non-existing drive and check if it does not exist #ifdef QT_BUILD_INTERNAL @@ -596,7 +595,7 @@ void tst_QDir::isRelativePath_data() QTest::addColumn<bool>("relative"); QTest::newRow("data0") << "../somedir" << true; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("data1") << "C:/sOmedir" << false; #endif QTest::newRow("data2") << "somedir" << true; @@ -802,12 +801,6 @@ void tst_QDir::entryList() QFile::remove(entrylistPath + "brokenlink.lnk"); QFile::remove(entrylistPath + "brokenlink"); - // WinCE does not have . and .. in the directory listing -#if defined(Q_OS_WINCE) - expected.removeAll("."); - expected.removeAll(".."); -#endif - #ifndef Q_NO_SYMLINKS #if defined(Q_OS_WIN) // ### Sadly, this is a platform difference right now. @@ -900,15 +893,10 @@ void tst_QDir::entryListSimple_data() QTest::addColumn<int>("countMin"); QTest::newRow("data2") << "do_not_expect_this_path_to_exist/" << 0; -#if defined(Q_OS_WINCE) - QTest::newRow("simple dir") << (m_dataPath + "/resources") << 0; - QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 0; -#else QTest::newRow("simple dir") << (m_dataPath + "/resources") << 2; QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 2; -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << 2; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << 2; @@ -1170,7 +1158,6 @@ tst_QDir::cleanPath_data() QTest::newRow("data2") << "/" << "/"; QTest::newRow("data3") << QDir::cleanPath("../.") << ".."; QTest::newRow("data4") << QDir::cleanPath("../..") << "../.."; -#if !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:/a/bc"; QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "d:/"; @@ -1178,17 +1165,14 @@ tst_QDir::cleanPath_data() QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:\\a\\bc\\def\\.."; QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << ".."; #endif -#endif QTest::newRow("data7") << ".//file1.txt" << "file1.txt"; QTest::newRow("data8") << "/foo/bar/..//file1.txt" << "/foo/file1.txt"; QTest::newRow("data9") << "//" << "/"; -#if !defined(Q_OS_WINCE) #if defined Q_OS_WIN QTest::newRow("data10") << "c:\\" << "c:/"; #else QTest::newRow("data10") << "/:/" << "/:"; #endif -#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QTest::newRow("data11") << "//foo//bar" << "//foo/bar"; #endif @@ -1350,7 +1334,7 @@ void tst_QDir::absolutePath_data() QTest::addColumn<QString>("expectedPath"); QTest::newRow("0") << "/machine/share/dir1" << "/machine/share/dir1"; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("1") << "\\machine\\share\\dir1" << "/machine/share/dir1"; QTest::newRow("2") << "//machine/share/dir1" << "//machine/share/dir1"; QTest::newRow("3") << "\\\\machine\\share\\dir1" << "//machine/share/dir1"; @@ -1399,7 +1383,7 @@ void tst_QDir::relativeFilePath_data() QTest::newRow("same path 1") << "/tmp" << "/tmp" << "."; QTest::newRow("same path 2") << "//tmp" << "/tmp/" << "."; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding"; QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong"; QTest::newRow("14") << "C:/foo/bar" << "/ding/dong" << "../../ding/dong"; @@ -1575,7 +1559,6 @@ void tst_QDir::operator_eq() dir1.setPath(".."); } -#ifndef Q_OS_WINCE // WinCE does not have . nor .. void tst_QDir::dotAndDotDot() { @@ -1585,7 +1568,6 @@ void tst_QDir::dotAndDotDot() entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces")); } -#endif void tst_QDir::homePath() { @@ -1829,16 +1811,9 @@ void tst_QDir::updateFileLists() QDir dir(fs.absoluteFilePath(dirName)); -#if defined(Q_OS_WINCE) - //no . and .. on these OS. - QCOMPARE(dir.count(), uint(4)); - QCOMPARE(dir.entryList().size(), 4); - QCOMPARE(dir.entryInfoList().size(), 4); -#else QCOMPARE(dir.count(), uint(6)); QCOMPARE(dir.entryList().size(), 6); QCOMPARE(dir.entryInfoList().size(), 6); -#endif dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); diff --git a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro index 2d8dfba996..b5ac614ad1 100644 --- a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro @@ -7,6 +7,4 @@ RESOURCES += qdiriterator.qrc TESTDATA += entrylist contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA -wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1 - win32: CONFIG += insignificant_test # Crashes on Windows in release builds diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 0fbce74055..6450e9af7b 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -41,7 +41,7 @@ #define Q_NO_SYMLINKS #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) # include "../../../network-settings.h" #endif @@ -103,7 +103,7 @@ private slots: void longPath(); void dirorder(); void relativePaths(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void uncPaths_data(); void uncPaths(); #endif @@ -196,7 +196,7 @@ void tst_QDirIterator::initTestCase() # endif #endif -#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) createDirectory("hiddenDirs_hiddenFiles"); createFile("hiddenDirs_hiddenFiles/normalFile"); createFile("hiddenDirs_hiddenFiles/.hiddenFile"); @@ -239,10 +239,8 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::NoFilter) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/.," "entrylist/..," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -257,9 +255,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::AllEntries | QDir::NoDot) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/..," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -274,9 +270,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::AllEntries | QDir::NoDotDot) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/.," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -305,12 +299,10 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks) << QDir::Filters(QDir::NoFilter) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/.," "entrylist/..," "entrylist/directory/.," "entrylist/directory/..," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -345,11 +337,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data() QTest::newRow("empty, default") << QString("empty") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::NoFilter) << QStringList("*") -#if defined(Q_OS_WINCE) - << QStringList(); -#else << QString("empty/.,empty/..").split(','); -#endif QTest::newRow("empty, QDir::NoDotAndDotDot") << QString("empty") << QDirIterator::IteratorFlags(0) @@ -562,13 +550,6 @@ void tst_QDirIterator::longPath() while (dir.exists(dirName) || dir.mkdir(dirName)) { ++n; dirName.append('x'); -#if defined(Q_OS_WINCE) && defined(WINCE_BROKEN_ITERATE) - // Some Windows CE devices/emulators are broken. - // though one can create directories of length <= 217, - // FindNextFile only reports entries until ~ 214. - if (n >= 210) - break; -#endif } QDirIterator it(dir.absolutePath(), QDir::NoDotAndDotDot|QDir::Dirs, QDirIterator::Subdirectories); @@ -606,7 +587,7 @@ void tst_QDirIterator::relativePaths() } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void tst_QDirIterator::uncPaths_data() { QTest::addColumn<QString>("dirName"); diff --git a/tests/auto/corelib/io/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro index 10c8d918f7..0735daedb3 100644 --- a/tests/auto/corelib/io/qfile/qfile.pro +++ b/tests/auto/corelib/io/qfile/qfile.pro @@ -1,7 +1,2 @@ TEMPLATE = subdirs -wince* { - SUBDIRS = test -} else { - SUBDIRS = test stdinprocess -} - +SUBDIRS = test stdinprocess diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index c9ba96cc1b..c0c4b9d5d2 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -6,7 +6,6 @@ else: DEFINES += QT_NO_NETWORK TARGET = ../tst_qfile SOURCES = ../tst_qfile.cpp -wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 411c73fb90..4c9986d50e 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -47,7 +47,7 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; QT_END_NAMESPACE #endif -#if !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK) +#if !defined(QT_NO_NETWORK) #include <QHostInfo> #endif #include <QProcess> @@ -66,8 +66,6 @@ QT_END_NAMESPACE # include <sys/mount.h> #elif defined(Q_OS_IRIX) # include <sys/statfs.h> -#elif defined(Q_OS_WINCE) -# include <qplatformdefs.h> #elif defined(Q_OS_VXWORKS) # include <fcntl.h> #if defined(_WRS_KERNEL) @@ -85,7 +83,7 @@ QT_END_NAMESPACE #include <stdio.h> #include <errno.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif @@ -135,11 +133,9 @@ private slots: void readAll_data(); void readAll(); void readAllBuffer(); -#if !defined(Q_OS_WINCE) void readAllStdin(); void readLineStdin(); void readLineStdin_lineByLine(); -#endif void text(); void missingEndOfLine(); void readBlock(); @@ -169,7 +165,7 @@ private slots: void writeTextFile_data(); void writeTextFile(); /* void largeFileSupport(); */ -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void largeUncFileSupport(); #endif void flush(); @@ -225,10 +221,8 @@ private slots: void mapWrittenFile_data(); void mapWrittenFile(); -#ifndef Q_OS_WINCE void openStandardStreamsFileDescriptors(); void openStandardStreamsBufferedStreams(); -#endif void resize_data(); void resize(); @@ -491,7 +485,7 @@ void tst_QFile::exists() file.remove(); QVERIFY(!file.exists()); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt"; QFile unc(uncPath); QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData()); @@ -543,7 +537,7 @@ void tst_QFile::open_data() << int(QIODevice::ReadOnly) << false << QFile::OpenError; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //opening devices requires administrative privileges (and elevation). HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hTest != INVALID_HANDLE_VALUE) { @@ -574,7 +568,7 @@ void tst_QFile::open() QSKIP("Running this test as root doesn't make sense"); #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort); #endif if (filename.isEmpty()) @@ -626,7 +620,7 @@ void tst_QFile::size_data() QTest::addColumn<qint64>("size"); QTest::newRow( "exist01" ) << m_testFile << (qint64)245; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Only test UNC on Windows./ QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34; #endif @@ -637,10 +631,6 @@ void tst_QFile::size() QFETCH( QString, filename ); QFETCH( qint64, size ); -#ifdef Q_OS_WINCE - filename = QFileInfo(filename).absoluteFilePath(); -#endif - { QFile f( filename ); QCOMPARE( f.size(), size ); @@ -660,9 +650,6 @@ void tst_QFile::size() fclose(stream); } - // Currently low level file I/O is not well supported on Windows CE, so - // skip this part of the test. -#ifndef Q_OS_WINCE { QFile f; @@ -675,7 +662,6 @@ void tst_QFile::size() f.close(); QT_CLOSE(fd); } -#endif } void tst_QFile::sizeNoExist() @@ -920,7 +906,6 @@ private: }; #endif // !QT_NO_PROCESS -#if !defined(Q_OS_WINCE) void tst_QFile::readAllStdin() { #ifdef QT_NO_PROCESS @@ -1011,7 +996,6 @@ void tst_QFile::readLineStdin_lineByLine() } #endif } -#endif void tst_QFile::text() { @@ -1112,7 +1096,7 @@ void tst_QFile::ungetChar() QCOMPARE(buf[2], '4'); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QString driveLetters() { wchar_t volumeName[MAX_PATH]; @@ -1149,7 +1133,7 @@ void tst_QFile::invalidFile_data() #if !defined(Q_OS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); #endif QTest::newRow( "colon3" ) << QString( ":failinvalid" ); @@ -1211,13 +1195,11 @@ void tst_QFile::permissions_data() QTest::newRow("data0") << QCoreApplication::instance()->applicationFilePath() << uint(QFile::ExeUser) << true << false; QTest::newRow("data1") << m_testSourceFile << uint(QFile::ReadUser) << true << false; QTest::newRow("readonly") << QString::fromLatin1("readonlyfile") << uint(QFile::WriteUser) << false << false; -#ifndef Q_OS_WINCE QTest::newRow("longfile") << QString::fromLatin1("longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName.txt") << uint(QFile::ReadUser) << true << true; -#endif QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ReadUser) << true << false; QTest::newRow("resource2") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::WriteUser) << false << false; QTest::newRow("resource3") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ExeUser) << false << false; @@ -1369,15 +1351,9 @@ void tst_QFile::copyFallback() QVERIFY(QFile::exists("file-copy-destination.txt")); QVERIFY(!file.isOpen()); -#ifdef Q_OS_WINCE - // Need to reset permissions on Windows to be able to delete - QVERIFY(QFile::setPermissions("file-copy-destination.txt", - QFile::WriteOther)); -#else // Need to reset permissions on Windows to be able to delete QVERIFY(QFile::setPermissions("file-copy-destination.txt", QFile::ReadOwner | QFile::WriteOwner)); -#endif QVERIFY(QFile::remove("file-copy-destination.txt")); // Fallback copy of open file. @@ -1398,7 +1374,7 @@ void tst_QFile::copyFallback() #endif #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static QString getWorkingDirectoryForLink(const QString &linkFileName) { bool neededCoInit = false; @@ -1457,7 +1433,7 @@ void tst_QFile::link() QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath())); #endif @@ -1595,7 +1571,7 @@ void tst_QFile::writeTextFile() QCOMPARE(file.readAll(), out); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QFile::largeUncFileSupport() { qint64 size = Q_INT64_C(8589934592); @@ -1674,11 +1650,7 @@ void tst_QFile::bufferedRead() file.write("abcdef"); file.close(); -#if defined(Q_OS_WINCE) - FILE *stdFile = fopen((QCoreApplication::applicationDirPath() + "/stdfile.txt").toLatin1() , "r"); -#else FILE *stdFile = fopen("stdfile.txt", "r"); -#endif QVERIFY(stdFile); char c; QCOMPARE(int(fread(&c, 1, 1, stdFile)), 1); @@ -1823,11 +1795,7 @@ void tst_QFile::FILEReadWrite() f.close(); } -#ifdef Q_OS_WINCE - FILE *fp = fopen(qPrintable(QCoreApplication::applicationDirPath() + "\\FILEReadWrite.txt"), "r+b"); -#else FILE *fp = fopen("FILEReadWrite.txt", "r+b"); -#endif QVERIFY(fp); QFile file; QVERIFY2(file.open(fp, QFile::ReadWrite), msgOpenFailed(file).constData()); @@ -2032,10 +2000,6 @@ void tst_QFile::longFileName() } { QFile file(fileName); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); - QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort); -#endif QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData()); QTextStream ts(&file); ts << fileName << endl; @@ -2303,7 +2267,7 @@ void tst_QFile::writeLargeDataBlock_data() QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd; QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK) // Some semi-randomness to avoid collisions. QTest::newRow("unc file") << QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt") @@ -2318,8 +2282,8 @@ static QByteArray getLargeDataBlock() if (array.isNull()) { -#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) - int resizeSize = 1024 * 1024; // WinCE does not have much space +#if defined(Q_OS_VXWORKS) + int resizeSize = 1024 * 1024; // VxWorks does not have much space #else int resizeSize = 64 * 1024 * 1024; #endif @@ -2447,9 +2411,7 @@ void tst_QFile::virtualFile() void tst_QFile::textFile() { -#if defined(Q_OS_WINCE) - FILE *fs = ::fopen((QCoreApplication::applicationDirPath() + "/writeabletextfile").toLatin1() , "wt"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) FILE *fs = ::fopen("writeabletextfile", "wt"); #else FILE *fs = ::fopen("writeabletextfile", "w"); @@ -2662,7 +2624,7 @@ void tst_QFile::appendAndRead() void tst_QFile::miscWithUncPathAsCurrentDir() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QString current = QDir::currentPath(); const QString path = QLatin1String("//") + QtNetworkSettings::winServerName() + QLatin1String("/testshare"); @@ -2686,7 +2648,6 @@ void tst_QFile::standarderror() void tst_QFile::handle() { int fd; -#if !defined(Q_OS_WINCE) QFile file(m_testSourceFile); QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData()); fd = int(file.handle()); @@ -2714,7 +2675,6 @@ void tst_QFile::handle() #endif QCOMPARE(c, '*'); -#endif //test round trip of adopted stdio file handle QFile file2; @@ -2957,10 +2917,6 @@ void tst_QFile::map() QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; -#ifdef Q_OS_WINCE - fileName = QFileInfo(fileName).absoluteFilePath(); -#endif - if (QFile::exists(fileName)) { QVERIFY(QFile::setPermissions(fileName, QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser)); @@ -3002,7 +2958,7 @@ void tst_QFile::map() QCOMPARE(file.error(), QFile::NoError); // hpux won't let you map multiple times. -#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) // exotic test to make sure that multiple maps work // note: windows ce does not reference count mutliple maps @@ -3125,10 +3081,6 @@ void tst_QFile::mapOpenMode() QVERIFY2(file.open(om), msgOpenFailed(om, file).constData()); uchar *memory = file.map(0, fileSize, QFileDevice::MemoryMapFlags(flags)); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("ReadOnly + MapPrivate" , "Windows CE does not support MapPrivateOption.", Abort); - QEXPECT_FAIL("ReadWrite + MapPrivate", "Windows CE does not support MapPrivateOption.", Abort); -#endif QVERIFY(memory); QVERIFY(memcmp(memory, pattern, fileSize) == 0); @@ -3161,10 +3113,6 @@ void tst_QFile::mapWrittenFile() QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; -#ifdef Q_OS_WINCE - fileName = QFileInfo(fileName).absoluteFilePath(); -#endif - if (QFile::exists(fileName)) { QVERIFY(QFile::setPermissions(fileName, QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser)); @@ -3263,10 +3211,6 @@ protected: bool MessageHandler::ok = true; QtMessageHandler MessageHandler::oldMessageHandler = 0; - //allthough Windows CE (not mobile!) has functions that allow redirecting - //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW) - //it does not have functions to simply open them like below . -#ifndef Q_OS_WINCE void tst_QFile::openStandardStreamsFileDescriptors() { @@ -3326,7 +3270,6 @@ void tst_QFile::openStandardStreamsBufferedStreams() QVERIFY(msgHandler.testPassed()); } -#endif void tst_QFile::writeNothing() { diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index 8aa81896cc..8d443c27ec 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -5,6 +5,6 @@ SOURCES = tst_qfileinfo.cpp RESOURCES += qfileinfo.qrc \ testdata.qrc -win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32 +win32:!winrt:LIBS += -ladvapi32 -lnetapi32 win32: CONFIG += insignificant_test # Crashes on Windows in release builds diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 8d62a38e6b..eea79406c3 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -49,13 +49,13 @@ #ifdef Q_OS_WIN #include <qt_windows.h> #include <qlibrary.h> -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) #include <lm.h> #endif #endif #include <qplatformdefs.h> #include <qdebug.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif #include <private/qfileinfo_p.h> @@ -256,7 +256,7 @@ private slots: void refresh(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void ntfsJunctionPointsAndSymlinks_data(); void ntfsJunctionPointsAndSymlinks(); void brokenShortcut(); @@ -273,7 +273,7 @@ private slots: void detachingOperations(); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) void owner(); #endif void group(); @@ -354,17 +354,8 @@ void tst_QFileInfo::copy() file.flush(); QTest::qWait(250); -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) - if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA || - QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - file.close(); -#endif -#if defined(Q_OS_WINCE) - // On Windows CE we need to close the file. - // Otherwise the content will be cached and not - // flushed to the storage, although we flushed it - // manually!!! CE has interim cache, we cannot influence. - QTest::qWait(5000); +#if defined(Q_OS_WIN) + file.close(); #endif info3.refresh(); privateInfo3 = getPrivate(info3); @@ -422,12 +413,12 @@ void tst_QFileInfo::isDir_data() QTest::newRow("broken link") << "brokenlink.lnk" << false; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("drive 1") << "c:" << true; QTest::newRow("drive 2") << "c:/" << true; //QTest::newRow("drive 2") << "t:s" << false; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -464,13 +455,13 @@ void tst_QFileInfo::isRoot_data() QTest::newRow("simple dir") << m_resourcesDir << false; QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << false; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("drive 1") << "c:" << false; QTest::newRow("drive 2") << "c:/" << true; QTest::newRow("drive 3") << "p:/" << false; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -519,7 +510,7 @@ void tst_QFileInfo::exists_data() QTest::newRow("simple dir") << m_resourcesDir << true; QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -554,7 +545,7 @@ void tst_QFileInfo::absolutePath_data() QTest::addColumn<QString>("filename"); QString drivePrefix; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) drivePrefix = QDir::currentPath().left(2); QString nonCurrentDrivePrefix = drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:"); @@ -573,7 +564,7 @@ void tst_QFileInfo::absolutePath_data() QTest::newRow("3") << "/usr/local/bin/" << drivePrefix + "/usr/local/bin" << ""; QTest::newRow("/test") << "/test" << drivePrefix + "/" << "test"; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/" << "autoexec.bat"; QTest::newRow("c:autoexec.bat") << QDir::currentPath().left(2) + "autoexec.bat" << QDir::currentPath() @@ -606,7 +597,7 @@ void tst_QFileInfo::absFilePath_data() QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt"; QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt"; QString drivePrefix; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QString curr = QDir::currentPath(); curr.remove(0, 2); // Make it a absolute path with no drive specifier: \depot\qt-4.2\tests\auto\qfileinfo @@ -774,7 +765,7 @@ void tst_QFileInfo::fileName_data() QTest::newRow("relativeFile") << "tmp.txt" << "tmp.txt"; QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << "tmp.txt"; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "tmp.txt"; QTest::newRow("driveWithNoSlash") << "c:tmp.txt" << "tmp.txt"; #else @@ -1024,7 +1015,7 @@ void tst_QFileInfo::size() void tst_QFileInfo::systemFiles() { -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) QSKIP("This is a Windows only test"); #endif QFileInfo fi("c:\\pagefile.sys"); @@ -1121,11 +1112,7 @@ void tst_QFileInfo::fileTimes_data() void tst_QFileInfo::fileTimes() { -#if defined(Q_OS_WINCE) - int sleepTime = 3000; -#else int sleepTime = 2000; -#endif QFETCH(QString, fileName); if (QFile::exists(fileName)) { QVERIFY(QFile::remove(fileName)); @@ -1133,10 +1120,6 @@ void tst_QFileInfo::fileTimes() QTest::qSleep(sleepTime); { QFile file(fileName); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("longfile", "No long filenames on WinCE", Abort); - QEXPECT_FAIL("longfile absolutepath", "No long filenames on WinCE", Abort); -#endif QVERIFY(file.open(QFile::WriteOnly | QFile::Text)); #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS) if (qIsLikelyToBeNfs(file.handle())) @@ -1162,7 +1145,7 @@ void tst_QFileInfo::fileTimes() { QFileInfo fileInfo(fileName); // On unix created() returns the same as lastModified(). -#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_UNIX) QVERIFY(fileInfo.created() < beforeWrite); #endif QVERIFY(fileInfo.lastModified() > beforeWrite); @@ -1174,7 +1157,7 @@ void tst_QFileInfo::fileTimes() } QFileInfo fileInfo(fileName); -#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_UNIX) QVERIFY(fileInfo.created() < beforeWrite); #endif //In Vista the last-access timestamp is not updated when the file is accessed/touched (by default). @@ -1193,9 +1176,7 @@ void tst_QFileInfo::fileTimes() RegCloseKey(key); } #endif -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue); -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue); #elif defined(Q_OS_QNX) QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue); @@ -1211,8 +1192,8 @@ void tst_QFileInfo::fileTimes() void tst_QFileInfo::fileTimes_oldFile() { - // This is not supported on WinCE or WinRT -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) + // This is not supported on WinRT +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // All files are opened in share mode (both read and write). DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; @@ -1310,7 +1291,7 @@ void tst_QFileInfo::isHidden_data() QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false; } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory")); QVERIFY(SetFileAttributesW(reinterpret_cast<LPCWSTR>(QString("./hidden-directory").utf16()),FILE_ATTRIBUTE_HIDDEN)); QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true; @@ -1413,7 +1394,7 @@ void tst_QFileInfo::isNativePath() void tst_QFileInfo::refresh() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WIN) +#if defined(Q_OS_WIN) int sleepTime = 3000; #else int sleepTime = 2000; @@ -1436,17 +1417,8 @@ void tst_QFileInfo::refresh() QCOMPARE(info.lastModified(), lastModified); QCOMPARE(info.size(), qint64(7)); -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) - if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA || - QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - file.close(); -#endif -#if defined(Q_OS_WINCE) - // On Windows CE we need to close the file. - // Otherwise the content will be cached and not - // flushed to the storage, although we flushed it - // manually!!! CE has interim cache, we cannot influence. - QTest::qWait(5000); +#if defined(Q_OS_WIN) + file.close(); #endif info.refresh(); QCOMPARE(info.size(), qint64(13)); @@ -1459,7 +1431,7 @@ void tst_QFileInfo::refresh() QCOMPARE(info2.size(), info.size()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() { QTest::addColumn<QString>("path"); @@ -1633,11 +1605,7 @@ void tst_QFileInfo::isWritable() tempfile.remove(); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -#ifdef Q_OS_WINCE - QFileInfo fi("\\Windows\\wince.nls"); -#else QFileInfo fi("c:\\pagefile.sys"); -#endif QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData()); QVERIFY(!fi.isWritable()); #endif @@ -1813,8 +1781,7 @@ void tst_QFileInfo::detachingOperations() QVERIFY(!info1.caching()); } -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -#if defined (Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) BOOL IsUserAdmin() { BOOL b; @@ -1835,14 +1802,14 @@ BOOL IsUserAdmin() return(b); } -#endif -#if defined(Q_OS_WIN) QT_BEGIN_NAMESPACE extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; QT_END_NAMESPACE -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT + +#ifndef Q_OS_WINRT void tst_QFileInfo::owner() { QString userName; @@ -1904,7 +1871,7 @@ void tst_QFileInfo::owner() qt_ntfs_permission_lookup = 0; #endif } -#endif +#endif // !Q_OS_WINRT void tst_QFileInfo::group() { diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 187f72d095..fe2a1a562d 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -146,12 +146,7 @@ void tst_QFileSystemWatcher::basicTest() // resolution of the modification time is system dependent, but it's at most 1 second when using // the polling engine. I've heard rumors that FAT32 has a 2 second resolution. So, we have to // wait a bit before we can modify the file (hrmph)... -#ifndef Q_OS_WINCE QTest::qWait(2000); -#else - // WinCE is always a little bit slower. Give it a little bit more time - QTest::qWait(5000); -#endif testFile.open(QIODevice::WriteOnly | QIODevice::Append); testFile.write(QByteArray("world")); @@ -309,9 +304,6 @@ void tst_QFileSystemWatcher::watchDirectory() QVERIFY(temporaryDir.rmdir(testDirName)); // waiting max 5 seconds for notification for directory removal to trigger -#ifdef Q_OS_WINCE - QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort); -#endif QTRY_COMPARE(changedSpy.count(), 2); QCOMPARE(changedSpy.at(0).count(), 1); QCOMPARE(changedSpy.at(1).count(), 1); @@ -553,9 +545,6 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QEXPECT_FAIL("", "See QTBUG-30943", Continue); #endif QCOMPARE(fileChangedSpyCount, 0); -#ifdef Q_OS_WINCE - QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort); -#endif QCOMPARE(dirChangedSpy.count(), 1); dirChangedSpy.clear(); diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 30eaa5aab9..5cb532f76b 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -100,9 +100,6 @@ void tst_QIODevice::getSetCheck() //---------------------------------------------------------------------------------- void tst_QIODevice::constructing_QTcpSocket() { -#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) - QSKIP("Networking tests in a WinCE emulator are unstable"); -#endif if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); @@ -205,9 +202,6 @@ void tst_QIODevice::read_QByteArray() //-------------------------------------------------------------------- void tst_QIODevice::unget() { -#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) - QSKIP("Networking tests in a WinCE emulator are unstable"); -#endif #if defined(Q_OS_MAC) QSKIP("The unget network test is unstable on Mac. See QTBUG-39983."); #endif diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 2e5cfb1053..afa3620b1a 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -34,7 +34,7 @@ #include <qsysinfo.h> #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS) #include <unistd.h> -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <qt_windows.h> #endif @@ -281,7 +281,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid() { #if defined(QT_NO_PROCESS) QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_WINRT) || defined(Q_OS_WINCE) || defined(Q_OS_IOS) +#elif defined(Q_OS_WINRT) || defined(Q_OS_IOS) QSKIP("We cannot retrieve information about other processes on this platform."); #else const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid"; @@ -455,7 +455,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(ProcessProperties) static inline ProcessProperties processProperties() { ProcessProperties result; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) HANDLE processToken = NULL; if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &processToken)) { DWORD elevation; // struct containing a DWORD, not present in some MinGW headers. @@ -484,7 +484,7 @@ void tst_QLockFile::noPermissionsWindows() { // Windows: Do the permissions test in a system directory in which // files cannot be created. -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) QSKIP("This test is for desktop Windows only"); #endif #ifdef Q_OS_WIN diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro index 6eb72343bc..7b83d5dbe8 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro @@ -4,4 +4,4 @@ TARGET = tst_qlockfile SOURCES += tst_qlockfile.cpp QT = core testlib concurrent -win32:!wince:!winrt:LIBS += -ladvapi32 +win32:!winrt:LIBS += -ladvapi32 diff --git a/tests/auto/corelib/io/qprocess/qprocess.pri b/tests/auto/corelib/io/qprocess/qprocess.pri index a43c823846..d5a7532ee1 100644 --- a/tests/auto/corelib/io/qprocess/qprocess.pri +++ b/tests/auto/corelib/io/qprocess/qprocess.pri @@ -10,13 +10,12 @@ SUBPROGRAMS = \ testProcessDeadWhileReading \ testProcessEOF \ testExitCodes \ + testForwarding \ testGuiProcess \ testDetached \ fileWriterProcess \ testSetWorkingDirectory \ testSoftExit -!contains(QMAKE_PLATFORM, wince): SUBPROGRAMS += testForwarding - !qtHaveModule(widgets): SUBPROGRAMS -= \ testGuiProcess diff --git a/tests/auto/corelib/io/qprocess/qprocess.pro b/tests/auto/corelib/io/qprocess/qprocess.pro index 6ba54b1e92..3867ac5741 100644 --- a/tests/auto/corelib/io/qprocess/qprocess.pro +++ b/tests/auto/corelib/io/qprocess/qprocess.pro @@ -8,7 +8,7 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \ testProcessSpacesArgs/twospaces.pro \ testSpaceInName -win32:!wince* { +win32 { SUBDIRS += \ testProcessEchoGui \ testSetNamedPipeHandleState diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp index 494d8147a7..0d40a9b83c 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp @@ -31,21 +31,10 @@ int main(int argc, char ** argv) { -#if defined(WINCE) || defined(_WIN32_WCE) - // No pipes on this "OS" - FILE* file = fopen("\\temp\\qprocess_args_test.txt","w+"); - for (int i = 0; i < argc; ++i) { - if (i) - fprintf(file, "|"); - fprintf(file, argv[i]); - } - fclose(file); -#else for (int i = 0; i < argc; ++i) { if (i) printf("|"); printf("%s", argv[i]); } -#endif return 0; } diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro index d19a631cae..80e8bcad98 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro +++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro @@ -1,6 +1,6 @@ win32 { SOURCES = main_win.cpp - !wince: LIBS += -luser32 + LIBS += -luser32 } unix { SOURCES = main_unix.cpp diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 1f0ace0dd3..0bc1e77925 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -64,7 +64,6 @@ private slots: void startDetached(); void crashTest(); void crashTest2(); -#ifndef Q_OS_WINCE void echoTest_data(); void echoTest(); void echoTest2(); @@ -110,7 +109,6 @@ private slots: void discardUnwantedOutput(); void setWorkingDirectory(); void setNonExistentWorkingDirectory(); -#endif // not Q_OS_WINCE void exitStatus_data(); void exitStatus(); @@ -154,11 +152,9 @@ protected slots: void readFromProcess(); void exitLoopSlot(); void processApplicationEvents(); -#ifndef Q_OS_WINCE void restartProcess(); void waitForReadyReadInAReadyReadSlotSlot(); void waitForBytesWrittenInABytesWrittenSlotSlot(); -#endif private: qint64 bytesAvailable; @@ -406,8 +402,6 @@ void tst_QProcess::crashTest2() QCOMPARE(process.exitStatus(), QProcess::CrashExit); } -#ifndef Q_OS_WINCE -//Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest_data() { QTest::addColumn<QByteArray>("input"); @@ -462,7 +456,6 @@ void tst_QProcess::echoTest() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif void tst_QProcess::exitLoopSlot() { @@ -474,8 +467,6 @@ void tst_QProcess::processApplicationEvents() QCoreApplication::processEvents(); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest2() { @@ -523,10 +514,8 @@ void tst_QProcess::echoTest2() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -// Reading and writing to a process is not supported on Qt/CE +#if defined(Q_OS_WIN) void tst_QProcess::echoTestGui() { QProcess process; @@ -555,10 +544,9 @@ void tst_QProcess::testSetNamedPipeHandleState() QCOMPARE(process.exitCode(), 0); QCOMPARE(process.exitStatus(), QProcess::NormalExit); } -#endif // !Q_OS_WINCE && Q_OS_WIN +#endif // Q_OS_WIN -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -// Batch files are not supported on Windows CE +#if defined(Q_OS_WIN) void tst_QProcess::batFiles_data() { QTest::addColumn<QString>("batFile"); @@ -585,7 +573,7 @@ void tst_QProcess::batFiles() QVERIFY(proc.readAll().startsWith(output)); } -#endif // !Q_OS_WINCE && Q_OS_WIN +#endif // Q_OS_WIN void tst_QProcess::exitStatus_data() { @@ -627,8 +615,6 @@ void tst_QProcess::exitStatus() } } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::loopBackTest() { @@ -649,10 +635,7 @@ void tst_QProcess::loopBackTest() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::readTimeoutAndThenCrash() { @@ -683,7 +666,6 @@ void tst_QProcess::readTimeoutAndThenCrash() QCOMPARE(spy2.count(), 1); QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy2.at(0).at(0).constData()), QProcess::Crashed); } -#endif void tst_QProcess::waitForFinished() { @@ -694,9 +676,6 @@ void tst_QProcess::waitForFinished() QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); -#if defined (Q_OS_WINCE) - QEXPECT_FAIL("", "Reading and writing to a process is not supported on Qt/CE", Continue); -#endif QString output = process.readAll(); QCOMPARE(output.count("\n"), 10*1024); @@ -705,8 +684,6 @@ void tst_QProcess::waitForFinished() QCOMPARE(process.error(), QProcess::FailedToStart); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::deadWhileReading() { QProcess process; @@ -724,10 +701,7 @@ void tst_QProcess::deadWhileReading() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::restartProcessDeadlock() { @@ -757,10 +731,7 @@ void tst_QProcess::restartProcess() QVERIFY(process); process->start("testProcessEcho/testProcessEcho"); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::closeWriteChannel() { QProcess more; @@ -786,10 +757,7 @@ void tst_QProcess::closeWriteChannel() QCOMPARE(more.exitStatus(), QProcess::NormalExit); QCOMPARE(more.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE" void tst_QProcess::closeReadChannel() { for (int i = 0; i < 10; ++i) { @@ -819,10 +787,7 @@ void tst_QProcess::closeReadChannel() QCOMPARE(proc.exitCode(), 0); } } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::openModes() { QProcess proc; @@ -863,10 +828,7 @@ void tst_QProcess::openModes() QVERIFY(!proc.isWritable()); QCOMPARE(proc.state(), QProcess::NotRunning); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() { @@ -900,17 +862,12 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); } -#endif void tst_QProcess::hardExit() { QProcess proc; -#if defined(Q_OS_WINCE) - proc.start("testSoftExit/testSoftExit"); -#else proc.start("testProcessEcho/testProcessEcho"); -#endif QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); @@ -937,9 +894,7 @@ void tst_QProcess::softExit() proc.start("testSoftExit/testSoftExit"); QVERIFY(proc.waitForStarted(10000)); -#if !defined(Q_OS_WINCE) QVERIFY(proc.waitForReadyRead(10000)); -#endif QVERIFY(proc.processId() > 0); @@ -950,8 +905,6 @@ void tst_QProcess::softExit() QCOMPARE(int(proc.error()), int(QProcess::UnknownError)); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE class SoftExitProcess : public QProcess { Q_OBJECT @@ -1073,10 +1026,7 @@ void tst_QProcess::softExitInSlots() QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000); QCOMPARE(proc.state(), QProcess::NotRunning); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::mergedChannels() { QProcess process; @@ -1099,10 +1049,6 @@ void tst_QProcess::mergedChannels() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif - -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::forwardedChannels_data() { @@ -1155,10 +1101,7 @@ void tst_QProcess::forwardedChannels() QCOMPARE(process.readAllStandardOutput(), outdata); QCOMPARE(process.readAllStandardError(), errdata); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::atEnd() { QProcess process; @@ -1180,7 +1123,6 @@ void tst_QProcess::atEnd() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif class TestThread : public QThread { @@ -1202,9 +1144,7 @@ protected: process.start("testProcessEcho/testProcessEcho"); -#if !defined(Q_OS_WINCE) QCOMPARE(process.write("abc\0", 4), qint64(4)); -#endif exitCode = exec(); } @@ -1253,8 +1193,6 @@ void tst_QProcess::processesInMultipleThreads() } } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForFinishedWithTimeout() { QProcess process; @@ -1268,10 +1206,7 @@ void tst_QProcess::waitForFinishedWithTimeout() QVERIFY(process.waitForFinished()); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForReadyReadInAReadyReadSlot() { QProcess process; @@ -1297,10 +1232,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() QCOMPARE(process.exitCode(), 0); QVERIFY(process.bytesAvailable() > bytesAvailable); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() { QProcess *process = qobject_cast<QProcess *>(sender()); @@ -1310,10 +1242,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() QVERIFY(process->waitForReadyRead(5000)); QTestEventLoop::instance().exitLoop(); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() { QProcess process; @@ -1336,10 +1265,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() { QProcess *process = qobject_cast<QProcess *>(sender()); @@ -1348,7 +1274,6 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() QVERIFY(process->waitForBytesWritten(5000)); QTestEventLoop::instance().exitLoop(); } -#endif void tst_QProcess::spaceArgsTest_data() { @@ -1427,14 +1352,12 @@ void tst_QProcess::spaceArgsTest() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); -#if !defined(Q_OS_WINCE) QStringList actual = QString::fromLatin1(process.readAll()).split("|"); QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); QCOMPARE(actual, args); -#endif if (program.contains(QLatin1Char(' '))) program = QLatin1Char('"') + program + QLatin1Char('"'); @@ -1451,14 +1374,12 @@ void tst_QProcess::spaceArgsTest() QVERIFY2(started, errorMessage.constData()); QVERIFY(process.waitForFinished(5000)); -#if !defined(Q_OS_WINCE) actual = QString::fromLatin1(process.readAll()).split("|"); QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); QCOMPARE(actual, args); -#endif } } @@ -1479,26 +1400,12 @@ void tst_QProcess::nativeArguments() QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); -#if defined(Q_OS_WINCE) - // WinCE test outputs to a file, so check that - FILE* file = fopen("\\temp\\qprocess_args_test.txt","r"); - QVERIFY(file); - char buf[256]; - fgets(buf, 256, file); - fclose(file); - QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|')); -#else QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|')); -#endif QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); QStringList expected; -#if defined(Q_OS_WINCE) - expected << "hello" << "kitty," << "\"*\"!"; // Weird, weird ... -#else expected << "hello" << "kitty," << "*!"; -#endif QCOMPARE(actual, expected); } @@ -1703,8 +1610,6 @@ void tst_QProcess::failToStartEmptyArgs() QCOMPARE(process.error(), QProcess::FailedToStart); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::removeFileWhileProcessIsRunning() { QFile file(m_temporaryDir.path() + QLatin1String("/removeFile.txt")); @@ -1722,9 +1627,7 @@ void tst_QProcess::removeFileWhileProcessIsRunning() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// OS doesn't support environment variables + void tst_QProcess::setEnvironment_data() { QTest::addColumn<QString>("name"); @@ -1799,9 +1702,7 @@ void tst_QProcess::setEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } } -#endif -#ifndef Q_OS_WINCE -// OS doesn't support environment variables + void tst_QProcess::setProcessEnvironment_data() { setEnvironment_data(); @@ -1839,25 +1740,16 @@ void tst_QProcess::setProcessEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } } -#endif void tst_QProcess::systemEnvironment() { -#if defined (Q_OS_WINCE) - // there is no concept of system variables on Windows CE as there is no console - QVERIFY(QProcess::systemEnvironment().isEmpty()); - QVERIFY(QProcessEnvironment::systemEnvironment().isEmpty()); -#else QVERIFY(!QProcess::systemEnvironment().isEmpty()); QVERIFY(!QProcessEnvironment::systemEnvironment().isEmpty()); QVERIFY(QProcessEnvironment::systemEnvironment().contains("PATH")); QVERIFY(!QProcess::systemEnvironment().filter(QRegExp("^PATH=", Qt::CaseInsensitive)).isEmpty()); -#endif } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::spaceInName() { QProcess process; @@ -1868,7 +1760,6 @@ void tst_QProcess::spaceInName() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif void tst_QProcess::lockupsInStartDetached() { @@ -1883,8 +1774,6 @@ void tst_QProcess::lockupsInStartDetached() QProcess::startDetached("yjhbrty"); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::atEnd2() { QProcess process; @@ -1899,7 +1788,6 @@ void tst_QProcess::atEnd2() } QCOMPARE(lines.size(), 7); } -#endif void tst_QProcess::waitForReadyReadForNonexistantProcess() { @@ -1929,8 +1817,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QCOMPARE(finishedSpy2.count(), 0); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardInputFile() { static const char data[] = "A bunch\1of\2data\3\4\5\6\7..."; @@ -1958,10 +1844,7 @@ void tst_QProcess::setStandardInputFile() all = process2.readAll(); QCOMPARE(all.size(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardOutputFile_data() { QTest::addColumn<int>("channelToTest"); @@ -2079,10 +1962,7 @@ void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() QCOMPARE(all, QByteArray::fromRawData(testdata, sizeof testdata - 1)); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardOutputProcess_data() { QTest::addColumn<bool>("merged"); @@ -2123,10 +2003,7 @@ void tst_QProcess::setStandardOutputProcess() else QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd")); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::fileWriterProcess() { const QByteArray line = QByteArrayLiteral(" -- testing testing 1 2 3\n"); @@ -2160,16 +2037,11 @@ void tst_QProcess::fileWriterProcess() QCOMPARE(QFile(fileName).size(), qint64(stdinStr.size())); } while (stopWatch.elapsed() < 3000); } -#endif void tst_QProcess::detachedWorkingDirectoryAndPid() { qint64 pid; -#ifdef Q_OS_WINCE - QTest::qSleep(1000); -#endif - QFile infoFile(m_temporaryDir.path() + QLatin1String("/detachedinfo.txt")); if (infoFile.exists()) QVERIFY(infoFile.remove()); @@ -2206,8 +2078,6 @@ void tst_QProcess::detachedWorkingDirectoryAndPid() QCOMPARE(actualPid, pid); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::switchReadChannels() { const char data[] = "ABCD"; @@ -2236,10 +2106,7 @@ void tst_QProcess::switchReadChannels() process.setReadChannel(QProcess::StandardOutput); QCOMPARE(process.read(1), QByteArray("D")); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::discardUnwantedOutput() { QProcess process; @@ -2257,11 +2124,8 @@ void tst_QProcess::discardUnwantedOutput() process.setReadChannel(QProcess::StandardError); QCOMPARE(process.bytesAvailable(), Q_INT64_C(0)); } -#endif -#ifndef Q_OS_WINCE // Q_OS_WIN - setWorkingDirectory will chdir before starting the process on unices -// Windows CE does not support working directory logic void tst_QProcess::setWorkingDirectory() { QProcess process; @@ -2297,7 +2161,6 @@ void tst_QProcess::setNonExistentWorkingDirectory() QVERIFY2(process.errorString().startsWith("chdir:"), process.errorString().toLocal8Bit()); #endif } -#endif void tst_QProcess::startFinishStartFinish() { @@ -2307,11 +2170,9 @@ void tst_QProcess::startFinishStartFinish() QCOMPARE(process.state(), QProcess::NotRunning); process.start("testProcessOutput/testProcessOutput"); -#if !defined(Q_OS_WINCE) QVERIFY(process.waitForReadyRead(10000)); QCOMPARE(QString::fromLatin1(process.readLine().trimmed()), QString("0 -this is a number")); -#endif if (process.state() != QProcess::NotRunning) { QVERIFY(process.waitForFinished(10000)); QCOMPARE(process.exitStatus(), QProcess::NormalExit); diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index a4a5d5b0c7..af5078a3dc 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -44,9 +44,7 @@ private slots: void caseSensitivity(); void systemEnvironment(); -#ifndef Q_OS_WINCE void putenv(); -#endif }; void tst_QProcessEnvironment::operator_eq() @@ -257,12 +255,6 @@ void tst_QProcessEnvironment::systemEnvironment() QVERIFY(nonexistant.isNull()); -#ifdef Q_OS_WINCE - // Windows CE has no environment - QVERIFY(path.isEmpty()); - QVERIFY(!system.contains("PATH")); - QVERIFY(system.isEmpty()); -#else // all other system have environments if (path.isEmpty()) QFAIL("Could not find the PATH environment variable -- please correct the test environment"); @@ -272,18 +264,15 @@ void tst_QProcessEnvironment::systemEnvironment() QVERIFY(!system.contains(envname)); -# ifdef Q_OS_WIN +#ifdef Q_OS_WIN // check case-insensitive too QVERIFY(system.contains("path")); QCOMPARE(system.value("path"), QString::fromLocal8Bit(path)); QVERIFY(!system.contains(QString(envname).toLower())); -# endif #endif } -#ifndef Q_OS_WINCE -//Windows CE has no environment void tst_QProcessEnvironment::putenv() { static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE"; @@ -317,7 +306,6 @@ void tst_QProcessEnvironment::putenv() QCOMPARE(eAfter.value(lower), QString("Hello, World")); # endif } -#endif QTEST_MAIN(tst_QProcessEnvironment) diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 87a801c9dd..60252a91de 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -1521,7 +1521,7 @@ void tst_QSettings::sync() // Now "some other app" will change other.software.org.ini QString userConfDir = settingsPath("__user__") + QDir::separator(); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) unlink((userConfDir + "other.software.org.ini").toLatin1()); rename((userConfDir + "software.org.ini").toLatin1(), (userConfDir + "other.software.org.ini").toLatin1()); diff --git a/tests/auto/corelib/io/qstorageinfo/BLACKLIST b/tests/auto/corelib/io/qstorageinfo/BLACKLIST new file mode 100644 index 0000000000..ab4f888dd9 --- /dev/null +++ b/tests/auto/corelib/io/qstorageinfo/BLACKLIST @@ -0,0 +1,2 @@ +[storageList] +opensuse-42.1 diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 72a57c5905..f0b9c05810 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -266,7 +266,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() void tst_QTemporaryDir::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -280,7 +280,7 @@ void tst_QTemporaryDir::openOnRootDrives() QVERIFY(dir.isValid()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetErrorMode(lastErrorMode); #endif } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 9645ca9ba2..921136e79b 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -374,9 +374,7 @@ void tst_QTemporaryFile::size() // On CE it takes more time for the filesystem to update // the information. Usually you have to close it or seek // to get latest information. flush() does not help either. -#if !defined(Q_OS_WINCE) QCOMPARE(file.size(), qint64(6)); -#endif file.seek(0); QCOMPARE(file.size(), qint64(6)); } @@ -395,7 +393,7 @@ void tst_QTemporaryFile::resize() void tst_QTemporaryFile::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -409,19 +407,14 @@ void tst_QTemporaryFile::openOnRootDrives() QVERIFY(file.open()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetErrorMode(lastErrorMode); #endif } void tst_QTemporaryFile::stressTest() { -#if defined(Q_OS_WINCE) - // 200 is still ok, first colision happens after ~30 - const int iterations = 200; -#else const int iterations = 1000; -#endif QSet<QString> names; for (int i = 0; i < iterations; ++i) { diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 104873b85e..9533989b9d 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -175,20 +175,16 @@ private slots: void octTest(); void zeroTermination(); void ws_manipulator(); -#ifndef Q_OS_WINCE void stillOpenWhenAtEnd(); -#endif void readNewlines_data(); void readNewlines(); void seek(); void pos(); void pos2(); void pos3LargeFile(); -#if !defined(Q_OS_WINCE) void readStdin(); void readAllFromStdin(); void readLineFromStdin(); -#endif void read(); void qbool(); void forcePoint(); @@ -1207,8 +1203,6 @@ void tst_QTextStream::ws_manipulator() } // ------------------------------------------------------------------------------ -#ifndef Q_OS_WINCE -// Qt/CE: Cannot test network on emulator void tst_QTextStream::stillOpenWhenAtEnd() { QFile file(QFINDTESTDATA("tst_qtextstream.cpp")); @@ -1229,7 +1223,6 @@ void tst_QTextStream::stillOpenWhenAtEnd() while (!stream2.readLine().isNull()) {} QVERIFY(socket.isOpen()); } -#endif // ------------------------------------------------------------------------------ void tst_QTextStream::readNewlines_data() @@ -1498,8 +1491,6 @@ void tst_QTextStream::pos3LargeFile() } // ------------------------------------------------------------------------------ -// Qt/CE has no stdin/out support for processes -#if !defined(Q_OS_WINCE) void tst_QTextStream::readStdin() { #ifdef QT_NO_PROCESS @@ -1527,7 +1518,6 @@ void tst_QTextStream::readStdin() } // ------------------------------------------------------------------------------ -// Qt/CE has no stdin/out support for processes void tst_QTextStream::readAllFromStdin() { #ifdef QT_NO_PROCESS @@ -1549,7 +1539,6 @@ void tst_QTextStream::readAllFromStdin() } // ------------------------------------------------------------------------------ -// Qt/CE has no stdin/out support for processes void tst_QTextStream::readLineFromStdin() { #ifdef QT_NO_PROCESS @@ -1572,7 +1561,6 @@ void tst_QTextStream::readLineFromStdin() QVERIFY(stdinProcess.waitForFinished(5000)); #endif } -#endif // ------------------------------------------------------------------------------ void tst_QTextStream::read() @@ -2799,12 +2787,7 @@ void tst_QTextStream::status_real_read() void tst_QTextStream::status_integer_read() { -#ifdef Q_OS_WINCE - QString text = QLatin1String("123 abc "); - QTextStream s(&text); -#else QTextStream s("123 abc "); -#endif int i; QString w; s >> i; @@ -2822,12 +2805,7 @@ void tst_QTextStream::status_integer_read() void tst_QTextStream::status_word_read() { -#ifdef Q_OS_WINCE - QString text = QLatin1String("abc "); - QTextStream s(&text); -#else QTextStream s("abc "); -#endif QString w; s >> w; QCOMPARE(s.status(), QTextStream::Ok); diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index 4b3f76a78e..6ea7a38137 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -239,18 +239,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) // Basic tree StandardItemModel QModelIndex parent; QVariant blue = QVariant(QColor(Qt::blue)); -#ifndef Q_OS_WINCE for (int i = 0; i < 4; ++i) { -#else - for (int i = 0; i < 2; ++i) { -#endif parent = model->index(0, 0, parent); model->insertRows(0, 26 + i, parent); -#ifndef Q_OS_WINCE - model->insertColumns(0, 26 + i, parent); -#else model->insertColumns(0, 4 + i, parent); -#endif // Fill in some values to make it easier to debug /* for (int x = 0; x < 26 + i; ++x) { @@ -272,18 +264,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) // Basic tree StandardItemModel QModelIndex parent; QVariant blue = QVariant(QColor(Qt::blue)); -#ifndef Q_OS_WINCE for (int i = 0; i < 4; ++i) { -#else - for (int i = 0; i < 2; ++i) { -#endif parent = realModel->index(0, 0, parent); realModel->insertRows(0, 26+i, parent); -#ifndef Q_OS_WINCE - realModel->insertColumns(0, 26+i, parent); -#else realModel->insertColumns(0, 4, parent); -#endif // Fill in some values to make it easier to debug /* for (int x = 0; x < 26+i; ++x) { @@ -324,11 +308,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QSqlQuery q; q.exec("CREATE TABLE test(id int primary key, name varchar(30))"); q.prepare("INSERT INTO test(id, name) values (?, ?)"); -#ifndef Q_OS_WINCE for (int i = 0; i < 1024; ++i) { -#else - for (int i = 0; i < 512; ++i) { -#endif q.addBindValue(i); q.addBindValue("Mr. Smith" + QString::number(i)); q.exec(); @@ -344,11 +324,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) } if (QListWidget *listWidget = qobject_cast<QListWidget *>(model->parent())) { -#ifndef Q_OS_WINCE - int items = 100; -#else int items = 50; -#endif while (items--) listWidget->addItem(QLatin1String("item ") + QString::number(items)); return QModelIndex(); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index a8de5b7a9a..0691297497 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -155,7 +155,7 @@ void tst_QCoreApplication::qAppName() void tst_QCoreApplication::argc() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) QSKIP("QCoreApplication::arguments() parses arguments from actual command line on this platform."); #endif { diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index 5cd043b584..50072dc612 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -3,6 +3,6 @@ TARGET = tst_qeventloop QT = core network testlib core-private SOURCES = $$PWD/tst_qeventloop.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index 1d4e647a4b..b5f1d0fe00 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -6,11 +6,11 @@ SOURCES = tst_qmetatype.cpp TESTDATA=./typeFlags.bin DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -win32-msvc*|wince|winrt { +win32-msvc*|winrt { # Prevents "fatal error C1128: number of sections exceeded object file format limit". QMAKE_CXXFLAGS += /bigobj # Reduce compile time - win32-msvc2012|wince|winrt { + win32-msvc2012|winrt { QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE -= -O2 } diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro index 125915047a..cc51b4c661 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro @@ -2,9 +2,6 @@ CONFIG -= app_bundle debug_and_release CONFIG += console DESTDIR = ./ QT = core -wince { - LIBS += coredll.lib -} HEADERS += signalbug.h SOURCES += signalbug.cpp diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 23f8ff5857..6898fa717e 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1572,11 +1572,7 @@ Q_DECLARE_METATYPE(PropertyObject::Priority) void tst_QObject::threadSignalEmissionCrash() { -#if defined(Q_OS_WINCE) - int loopCount = 100; -#else int loopCount = 1000; -#endif for (int i = 0; i < loopCount; ++i) { QTcpSocket socket; socket.connectToHost("localhost", 80); diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index b6f6d2a7f3..26caff4301 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -90,7 +90,7 @@ private slots: // extreme cases void useTooMuchMemory(); -#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) void attachTooMuch(); #endif @@ -516,8 +516,7 @@ void tst_QSharedMemory::useTooMuchMemory() attach before the system runs out of resources. */ // HPUX doesn't allow for multiple attaches per process. -// For WinCE, this test nearly kills the system, so skip it. -#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) void tst_QSharedMemory::attachTooMuch() { QSKIP("disabled"); @@ -576,9 +575,7 @@ void tst_QSharedMemory::simpleProducerConsumer() char *get = (char*)consumer.data(); // On Windows CE you always have ReadWrite access. Thus // ViewMapOfFile returns the same pointer -#if !defined(Q_OS_WINCE) QVERIFY(put != get); -#endif for (int i = 0; i < size; ++i) { put[i] = 'Q'; QCOMPARE(get[i], 'Q'); diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 6fd192c357..de7a3721d8 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -295,9 +295,6 @@ void tst_QTimer::livelock() QTRY_COMPARE(tester.timeoutsForFirst, 1); QCOMPARE(tester.timeoutsForExtra, 0); QTRY_COMPARE(tester.timeoutsForSecond, 1); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue); -#endif QVERIFY(tester.postEventAtRightTime); } diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro index 44bd0be14e..3e15861021 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro @@ -6,7 +6,6 @@ TARGET = mylib DESTDIR = ../ QT = core -wince: DEFINES += WIN32_MSVC win32-msvc: DEFINES += WIN32_MSVC # This project is testdata for tst_qlibrary diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro index d55747501c..bd73227b3d 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro @@ -7,7 +7,6 @@ DESTDIR = ../ VERSION = 2 QT = core -wince: DEFINES += WIN32_MSVC win32-msvc: DEFINES += WIN32_MSVC # Force a copy of the library to have an extension that is non-standard. diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index ed41ab51e1..dec8448ce3 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -189,7 +189,7 @@ void tst_QLibrary::load_data() QTest::newRow("ok (libmylib ver. 1)") << appDir + "/libmylib" <<true; #endif -# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +# if defined(Q_OS_WIN32) QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << true; QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << true; QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << true; @@ -346,11 +346,7 @@ void tst_QLibrary::errorString_data() QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*"); QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error"); -#ifdef Q_OS_WINCE - QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in .*: .*"); -#else QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in \\S+: .*"); -#endif QTest::newRow("good resolve") << (int)Resolve << appDir + "/mylib" << true << QString("Unknown error"); #ifdef Q_OS_WIN @@ -414,7 +410,7 @@ void tst_QLibrary::loadHints_data() QString appDir = QCoreApplication::applicationDirPath(); lh |= QLibrary::ResolveAllSymbolsHint; -# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +# if defined(Q_OS_WIN32) || defined(Q_OS_WINRT) QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << int(lh) << true; QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << int(lh) << true; QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true; @@ -467,13 +463,8 @@ void tst_QLibrary::fileName_data() QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib")) << sys_qualifiedLibraryName(QLatin1String("mylib")); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -#ifndef Q_OS_WINCE QTest::newRow( "ok03" ) << "user32" << "USER32.dll"; -#else - QTest::newRow( "ok03" ) << "coredll" - << "coredll.dll"; -#endif #endif } diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index bc853de24e..499d276ef8 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -140,11 +140,6 @@ void tst_QPluginLoader::cleanup() void tst_QPluginLoader::errorString() { -#if defined(Q_OS_WINCE) - // On WinCE we need an QCoreApplication object for current dir - int argc = 0; - QCoreApplication app(argc,0); -#endif const QString unknown(QLatin1String("Unknown error")); { diff --git a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp index 341bd21e5a..8597bf1a6d 100644 --- a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp +++ b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp @@ -350,15 +350,9 @@ const int AlphabetSize = sizeof(alphabet) - 1; const int BufferSize = 4096; // GCD of BufferSize and alphabet size must be 1 char buffer[BufferSize]; -#ifndef Q_OS_WINCE const int ProducerChunkSize = 3; const int ConsumerChunkSize = 7; const int Multiplier = 10; -#else -const int ProducerChunkSize = 2; -const int ConsumerChunkSize = 5; -const int Multiplier = 3; -#endif // note: the code depends on the fact that DataSize is a multiple of // ProducerChunkSize, ConsumerChunkSize, and BufferSize diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index b4d0866d01..06b27f79cd 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -95,9 +95,7 @@ private slots: void requestTermination(); -#ifndef Q_OS_WINCE void stressTest(); -#endif void quitLock(); }; @@ -664,7 +662,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data) #if defined Q_OS_UNIX const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this); Q_UNUSED(state); -#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WINRT) nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL); #elif defined Q_OS_WIN unsigned thrdid = 0; @@ -684,11 +682,7 @@ void NativeThreadWrapper::join() #if defined Q_OS_UNIX pthread_join(nativeThreadHandle, 0); #elif defined Q_OS_WIN -#ifndef Q_OS_WINCE WaitForSingleObjectEx(nativeThreadHandle, INFINITE, FALSE); -#else - WaitForSingleObject(nativeThreadHandle, INFINITE); -#endif CloseHandle(nativeThreadHandle); #endif } @@ -874,13 +868,8 @@ void tst_QThread::adoptedThreadExecFinished() void tst_QThread::adoptMultipleThreads() { #if defined(Q_OS_WIN) - // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already. -# if defined(Q_OS_WINCE) - const int numThreads = 20; -# else // need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher() const int numThreads = 200; -# endif #else const int numThreads = 5; #endif @@ -911,13 +900,8 @@ void tst_QThread::adoptMultipleThreads() void tst_QThread::adoptMultipleThreadsOverlap() { #if defined(Q_OS_WIN) - // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already. -# if defined(Q_OS_WINCE) - const int numThreads = 20; -# else // need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher() const int numThreads = 200; -# endif #else const int numThreads = 5; #endif @@ -950,7 +934,6 @@ void tst_QThread::adoptMultipleThreadsOverlap() QCOMPARE(recorder.activationCount.load(), numThreads); } -#ifndef Q_OS_WINCE // Disconnects on WinCE void tst_QThread::stressTest() { @@ -962,7 +945,6 @@ void tst_QThread::stressTest() t.wait(one_minute); } } -#endif class Syncronizer : public QObject { Q_OBJECT diff --git a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp index ba64bf2963..a9af182ed8 100644 --- a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp @@ -120,7 +120,7 @@ void tst_QThreadOnce::sameThread() void tst_QThreadOnce::multipleThreads() { -#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) +#if defined(Q_OS_VXWORKS) const int NumberOfThreads = 20; #else const int NumberOfThreads = 100; diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index f3eba5c823..4e582cc346 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -40,10 +40,8 @@ #include <pthread.h> #endif #ifdef Q_OS_WIN -#ifndef Q_OS_WINCE -#include <process.h> -#endif -#include <windows.h> +# include <process.h> +# include <qt_windows.h> #endif class tst_QThreadStorage : public QObject @@ -221,11 +219,7 @@ void tst_QThreadStorage::adoptedThreads() pthread_join(thread, 0); #elif defined Q_OS_WIN && !defined(Q_OS_WINRT) HANDLE thread; -#if defined(Q_OS_WINCE) - thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL); -#else thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers); -#endif QVERIFY(thread); WaitForSingleObject(thread, INFINITE); #endif diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 910d7abf51..586a4446b4 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -34,9 +34,6 @@ #include <qhash.h> #include <limits.h> #include <private/qtools_p.h> -#if defined(Q_OS_WINCE) -#include <qcoreapplication.h> -#endif class tst_QByteArray : public QObject { @@ -246,11 +243,7 @@ void tst_QByteArray::qCompress_data() { QTest::addColumn<QByteArray>("ba"); -#ifndef Q_OS_WINCE const int size1 = 1024*1024; -#else - const int size1 = 1024; -#endif QByteArray ba1( size1, 0 ); QTest::newRow( "00" ) << QByteArray(); @@ -267,11 +260,6 @@ void tst_QByteArray::qCompress_data() ba1.fill( 'A' ); QTest::newRow( "03" ) << ba1; -#if defined(Q_OS_WINCE) - int tmpArgc = 0; - char** tmpArgv = 0; - QCoreApplication app(tmpArgc, tmpArgv); -#endif QFile file( QFINDTESTDATA("rfc3252.txt") ); QVERIFY( file.open(QIODevice::ReadOnly) ); QTest::newRow( "04" ) << file.readAll(); @@ -728,7 +716,7 @@ void tst_QByteArray::qvsnprintf() memset(buf, 42, sizeof(buf)); #ifdef Q_OS_WIN // VS 2005 uses the Qt implementation of vsnprintf. -# if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) +# if defined(_MSC_VER) QCOMPARE(::qsnprintf(buf, 3, "%s", "bubu"), -1); QCOMPARE(static_cast<const char*>(buf), "bu"); # else diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index e51f5d4694..92585fd471 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -31,9 +31,6 @@ #include <qfile.h> #include <qstringlist.h> #include <private/qunicodetables_p.h> -#if defined(Q_OS_WINCE) -#include <qcoreapplication.h> -#endif class tst_QChar : public QObject { diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp index 36bc8621d2..30c7b1bf69 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp @@ -71,8 +71,12 @@ int main(int argc, char *argv[]) // A hidden option QCommandLineOption hiddenOption(QStringList() << QStringLiteral("hidden")); hiddenOption.setDescription(QStringLiteral("THIS SHOULD NEVER APPEAR")); - hiddenOption.setHidden(true); + hiddenOption.setFlags(QCommandLineOption::HiddenFromHelp); parser.addOption(hiddenOption); + QCommandLineOption hiddenOption2(QStringList() << QStringLiteral("hidden2")); + hiddenOption2.setDescription(QStringLiteral("NEITHER SHOULD THIS")); + hiddenOption2.setHidden(true); + parser.addOption(hiddenOption2); // This program supports different options depending on the "command" (first argument). // Call parse() to find out the positional arguments. diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 9552152136..a54ad3d9c9 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -450,6 +450,13 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes_data() << QStringList("abc") << QStringList("val"); QTest::newRow("implicitlylong_with_space") << QCommandLineParser::ParseAsCompactedShortOptions << (QStringList() << "-c" << "val") << QStringList("c") << QStringList("val"); + + QTest::newRow("forceshort_detached") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I" << "45") + << QStringList("I") << QStringList("45"); + QTest::newRow("forceshort_attached") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I46") + << QStringList("I") << QStringList("46"); + QTest::newRow("forceshort_mixed") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I45" << "-nn") + << (QStringList() << "I" << "nn") << QStringList("45"); } void tst_QCommandLineParser::testSingleDashWordOptionModes() @@ -468,6 +475,10 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes() parser.addOption(QCommandLineOption("b", QStringLiteral("b option."))); parser.addOption(QCommandLineOption(QStringList() << "c" << "abc", QStringLiteral("c option."), QStringLiteral("value"))); parser.addOption(QCommandLineOption("nn", QStringLiteral("nn option."))); + QCommandLineOption forceShort(QStringLiteral("I"), QStringLiteral("always short option"), + QStringLiteral("path"), QStringLiteral("default")); + forceShort.setFlags(QCommandLineOption::ShortOptionStyle); + parser.addOption(forceShort); QVERIFY(parser.parse(commandLine)); QCOMPARE(parser.optionNames(), expectedOptionNames); for (int i = 0; i < expectedOptionValues.count(); ++i) @@ -501,9 +512,6 @@ void tst_QCommandLineParser::testVersionOption() #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); #else -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE"); -#endif #if defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -570,9 +578,6 @@ void tst_QCommandLineParser::testHelpOption() #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); #else -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE"); -#endif #if defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #endif diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index cfec327319..3b791fec70 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -28,10 +28,7 @@ ****************************************************************************/ #include <QtTest/QtTest> -#ifndef Q_OS_WINCE #include <time.h> -#endif - #include <qdatetime.h> #include <private/qdatetime_p.h> @@ -108,10 +105,8 @@ private slots: void msecsTo(); void operator_eqeq_data(); void operator_eqeq(); -#ifndef Q_OS_WINCE void operator_insert_extract_data(); void operator_insert_extract(); -#endif void currentDateTime(); void currentDateTimeUtc(); void currentDateTimeUtc2(); @@ -259,9 +254,7 @@ void tst_QDateTime::initTestCase() void tst_QDateTime::init() { -#if defined(Q_OS_WINCE) - SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); -#elif defined(Q_OS_WIN32) +#if defined(Q_OS_WIN32) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif } @@ -1429,13 +1422,8 @@ void tst_QDateTime::msecsTo() void tst_QDateTime::currentDateTime() { -#if defined(Q_OS_WINCE) - __time64_t buf1, buf2; - ::_time64(&buf1); -#else time_t buf1, buf2; ::time(&buf1); -#endif QDateTime lowerBound; lowerBound.setTime_t(buf1); @@ -1443,11 +1431,8 @@ void tst_QDateTime::currentDateTime() QDateTime dt2 = QDateTime::currentDateTime().toLocalTime(); QDateTime dt3 = QDateTime::currentDateTime().toUTC(); -#if defined(Q_OS_WINCE) - ::_time64(&buf2); -#else ::time(&buf2); -#endif + QDateTime upperBound; upperBound.setTime_t(buf2); // Note we must add 2 seconds here because time() may return up to @@ -1482,13 +1467,9 @@ void tst_QDateTime::currentDateTime() void tst_QDateTime::currentDateTimeUtc() { -#if defined(Q_OS_WINCE) - __time64_t buf1, buf2; - ::_time64(&buf1); -#else time_t buf1, buf2; ::time(&buf1); -#endif + QDateTime lowerBound; lowerBound.setTime_t(buf1); @@ -1496,11 +1477,8 @@ void tst_QDateTime::currentDateTimeUtc() QDateTime dt2 = QDateTime::currentDateTimeUtc().toLocalTime(); QDateTime dt3 = QDateTime::currentDateTimeUtc().toUTC(); -#if defined(Q_OS_WINCE) - ::_time64(&buf2); -#else ::time(&buf2); -#endif + QDateTime upperBound; upperBound.setTime_t(buf2); // Note we must add 2 seconds here because time() may return up to @@ -1859,7 +1837,6 @@ void tst_QDateTime::operator_eqeq() } } -#ifndef Q_OS_WINCE Q_DECLARE_METATYPE(QDataStream::Version) void tst_QDateTime::operator_insert_extract_data() @@ -1988,7 +1965,6 @@ void tst_QDateTime::operator_insert_extract() qputenv("TZ", previousTimeZone.constData()); tzset(); } -#endif void tst_QDateTime::toString_strformat() { diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 4336d02b2c..1ec0924254 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -996,11 +996,7 @@ void tst_QHash::rehash_isnt_quadratic() // this test should be incredibly slow if rehash() is quadratic for (int j = 0; j < 5; ++j) { QHash<int, int> testHash; -#if defined(Q_OS_WINCE) // mobiles do not have infinite mem... - for (int i = 0; i < 50000; ++i) -#else for (int i = 0; i < 500000; ++i) -#endif testHash.insertMulti(1, 1); } } diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp index 1295a36c1a..3c22770fba 100644 --- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp +++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp @@ -35,10 +35,40 @@ class tst_QLatin1String : public QObject Q_OBJECT private Q_SLOTS: + void at(); + void midLeftRight(); void nullString(); void emptyString(); }; + +void tst_QLatin1String::at() +{ + const QLatin1String l1("Hello World"); + QCOMPARE(l1.at(0), QLatin1Char('H')); + QCOMPARE(l1.at(l1.size() - 1), QLatin1Char('d')); + QCOMPARE(l1[0], QLatin1Char('H')); + QCOMPARE(l1[l1.size() - 1], QLatin1Char('d')); +} + +void tst_QLatin1String::midLeftRight() +{ + const QLatin1String l1("Hello World"); + QCOMPARE(l1.mid(0), l1); + QCOMPARE(l1.mid(0, l1.size()), l1); + QCOMPARE(l1.left(l1.size()), l1); + QCOMPARE(l1.right(l1.size()), l1); + + QCOMPARE(l1.mid(6), QLatin1String("World")); + QCOMPARE(l1.mid(6, 5), QLatin1String("World")); + QCOMPARE(l1.right(5), QLatin1String("World")); + + QCOMPARE(l1.mid(6, 1), QLatin1String("W")); + QCOMPARE(l1.right(5).left(1), QLatin1String("W")); + + QCOMPARE(l1.left(5), QLatin1String("Hello")); +} + void tst_QLatin1String::nullString() { // default ctor diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index ee706e9f3d..8c9dc16ce7 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -52,15 +52,6 @@ # include <fenv.h> #endif -#ifdef Q_OS_WINCE -#include <windows.h> // needed for GetUserDefaultLCID -#define _control87 _controlfp -extern "C" DWORD GetThreadLocale(void) { - return GetUserDefaultLCID(); -} - -#endif - #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) # include <stdlib.h> #endif @@ -85,9 +76,7 @@ private slots: #endif void ctor(); -#if !defined(Q_OS_WINCE) void emptyCtor(); -#endif void legacyNames(); void unixLocaleName(); void matchingLocales(); @@ -394,10 +383,7 @@ void tst_QLocale::ctor() #undef TEST_CTOR } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) -// Not when Q_OS_WINCE is defined because the test uses unsupported -// Windows CE QProcess functionality (std streams, env) -// Also Qt needs to be compiled without QT_NO_PROCESS +#if !defined(QT_NO_PROCESS) static inline bool runSysApp(const QString &binary, const QStringList &env, QString *output, @@ -447,7 +433,6 @@ static inline bool runSysAppTest(const QString &binary, } #endif -#if !defined(Q_OS_WINCE) void tst_QLocale::emptyCtor() { #ifdef QT_NO_PROCESS @@ -517,7 +502,6 @@ void tst_QLocale::emptyCtor() #undef TEST_CTOR #endif } -#endif void tst_QLocale::legacyNames() { diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp index 2f285f3393..a98d37d733 100644 --- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp +++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp @@ -927,11 +927,7 @@ void tst_QRegExp::rainersSlowRegExpCopyBug() { // this test should take an extreme amount of time if QRegExp is broken QRegExp original(email); -#if defined(Q_OS_WINCE) - for (int i = 0; i < 100; ++i) { -#else for (int i = 0; i < 100000; ++i) { -#endif QRegExp copy = original; (void)copy.exactMatch("~"); QRegExp copy2 = original; @@ -980,13 +976,9 @@ void Thread::run() str += "abbbdekcz"; int x; -#if defined(Q_OS_WINCE) - for (int j = 0; j < 100; ++j) { -#else - for (int j = 0; j < 10000; ++j) { -#endif + for (int j = 0; j < 10000; ++j) x = rx.indexIn(str); - } + QCOMPARE(x, 3072); } @@ -1022,13 +1014,9 @@ void Thread2::run() str += "abbbdekcz"; int x; -#if defined(Q_OS_WINCE) - for (int j = 0; j < 100; ++j) { -#else - for (int j = 0; j < 10000; ++j) { -#endif + for (int j = 0; j < 10000; ++j) x = rx.indexIn(str); - } + QCOMPARE(x, 3072); } diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index 0cccdb8262..7bebe5e9e0 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -342,7 +342,7 @@ namespace QTest { "\n" "#ifdef Q_OS_WIN\n" "#include <windows.h>\n" - "#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)\n" + "#if defined(Q_CC_MSVC)\n" "#include <crtdbg.h>\n" "#endif\n" "static void q_test_setup()\n" @@ -358,7 +358,7 @@ namespace QTest { "#endif\n" "int main(int argc, char **argv)\n" "{\n" - "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) && !defined(Q_OS_WINCE)\n" + "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)\n" " _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook);\n" "#endif\n"; diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index b5912badf2..7998f7b7fd 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -57,11 +57,13 @@ private slots: void basics_data(); void basics(); void operators(); + void nullptrOps(); void swap(); void moveSemantics(); void useOfForwardDeclared(); void memoryManagement(); void dropLastReferenceOfForwardDeclared(); + void nonVirtualDestructors(); void lock(); void downCast(); void functionCallDownCast(); @@ -362,6 +364,30 @@ void tst_QSharedPointer::operators() QCOMPARE(qHash(p2), qHash(p2.data())); } +void tst_QSharedPointer::nullptrOps() +{ + QSharedPointer<char> p1(nullptr); + QSharedPointer<char> p2 = nullptr; + QSharedPointer<char> null; + + QVERIFY(p1 == null); + QVERIFY(p2 == null); + QVERIFY(!p1.data()); + QVERIFY(!p2.data()); + + QSharedPointer<char> p3 = p1; + QVERIFY(p3 == null); + QVERIFY(!p3.data()); + + p3 = nullptr; + + // check for non-ambiguity + QSharedPointer<char> p1_zero(0); + QSharedPointer<char> p2_zero = 0; + + p3 = 0; +} + void tst_QSharedPointer::swap() { QSharedPointer<int> p1, p2(new int(42)), control = p2; @@ -578,6 +604,56 @@ void tst_QSharedPointer::dropLastReferenceOfForwardDeclared() QCOMPARE(forwardDeclaredDestructorRunCount, 1); } +// NVD for "non-virtual destructor" +struct NVDData +{ + static int destructorCounter; + ~NVDData() { ++destructorCounter; } + + int dummy; +}; +int NVDData::destructorCounter; + +struct NVDDerivedData : NVDData +{ + static int destructorCounter; + ~NVDDerivedData() { ++destructorCounter; } +}; +int NVDDerivedData::destructorCounter; + +void tst_QSharedPointer::nonVirtualDestructors() +{ + NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0; + { + QSharedPointer<NVDData> ptr(new NVDData); + } + QCOMPARE(NVDData::destructorCounter, 1); + QCOMPARE(NVDDerivedData::destructorCounter, 0); + + NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0; + { + QSharedPointer<NVDDerivedData> ptr(new NVDDerivedData); + } + QCOMPARE(NVDData::destructorCounter, 1); + QCOMPARE(NVDDerivedData::destructorCounter, 1); + + NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0; + { + QSharedPointer<NVDData> bptr; + QSharedPointer<NVDDerivedData> ptr(new NVDDerivedData); + bptr = ptr; + } + QCOMPARE(NVDData::destructorCounter, 1); + QCOMPARE(NVDDerivedData::destructorCounter, 1); + + NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0; + { + QSharedPointer<NVDData> ptr(new NVDDerivedData); + } + QCOMPARE(NVDData::destructorCounter, 1); + QCOMPARE(NVDDerivedData::destructorCounter, 1); +} + void tst_QSharedPointer::lock() { QSharedPointer<int> sp = QSharedPointer<int>::create(); @@ -1310,6 +1386,18 @@ template<typename T> int CustomDeleter<T>::callCount = 0; void tst_QSharedPointer::customDeleter() { { + QSharedPointer<Data> ptr(0, &Data::doDelete); + QSharedPointer<Data> ptr2(0, &Data::alsoDelete); + QSharedPointer<Data> ptr3(0, &Data::virtualDelete); + } + safetyCheck(); + { + QSharedPointer<Data> ptr(nullptr, &Data::doDelete); + QSharedPointer<Data> ptr2(nullptr, &Data::alsoDelete); + QSharedPointer<Data> ptr3(nullptr, &Data::virtualDelete); + } + safetyCheck(); + { QSharedPointer<Data> ptr(new Data, &Data::doDelete); QSharedPointer<Data> ptr2(new Data, &Data::alsoDelete); QSharedPointer<Data> ptr3(new Data, &Data::virtualDelete); @@ -1492,6 +1580,33 @@ void tst_QSharedPointer::customDeleter() QCOMPARE(refcount, 2); safetyCheck(); + CustomDeleter<NVDData> nvdeleter; + nvdeleter.callCount = 0; + { + QSharedPointer<NVDData> ptr(new NVDData, nvdeleter); + } + QCOMPARE(nvdeleter.callCount, 1); + safetyCheck(); + + CustomDeleter<NVDDerivedData> nvderiveddeleter; + nvdeleter.callCount = 0; + nvderiveddeleter.callCount = 0; + { + QSharedPointer<NVDDerivedData> ptr(new NVDDerivedData, nvderiveddeleter); + } + QCOMPARE(nvdeleter.callCount, 0); + QCOMPARE(nvderiveddeleter.callCount, 1); + safetyCheck(); + + nvdeleter.callCount = 0; + nvderiveddeleter.callCount = 0; + { + QSharedPointer<NVDData> ptr(new NVDDerivedData, nvderiveddeleter); + } + QCOMPARE(nvdeleter.callCount, 0); + QCOMPARE(nvderiveddeleter.callCount, 1); + safetyCheck(); + // a custom deleter with a different pointer parameter { QSharedPointer<char> ptr(static_cast<char *>(malloc(1)), free); @@ -1771,13 +1886,11 @@ void tst_QSharedPointer::threadStressTest_data() QTest::newRow("1+1") << 1 << 1; QTest::newRow("2+10") << 2 << 10; -#ifndef Q_OS_WINCE - // Windows CE cannot run this many threads + QTest::newRow("5+10") << 5 << 10; QTest::newRow("5+30") << 5 << 30; QTest::newRow("100+100") << 100 << 100; -#endif } void tst_QSharedPointer::threadStressTest() @@ -1811,11 +1924,7 @@ void tst_QSharedPointer::threadStressTest() base.clear(); -#ifdef Q_OS_WINCE - srand(QDateTime::currentDateTime().toTime_t()); -#else srand(time(NULL)); -#endif // start threads for (int i = 0; i < allThreads.count(); ++i) if (allThreads[i]) allThreads[i]->start(); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 0a81e3f6bb..9dc564a361 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -37,10 +37,6 @@ # undef QT_ASCII_CAST_WARNINGS #endif -#if defined(Q_OS_WIN) && defined(Q_OS_WINCE) -#define Q_OS_WIN_AND_WINCE -#endif - #include <QtTest/QtTest> #include <qregexp.h> #include <qregularexpression.h> @@ -527,7 +523,7 @@ private slots: void integer_conversion(); void tortureSprintfDouble(); void toNum(); -#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) +#if !defined(Q_OS_WIN) void localeAwareCompare_data(); void localeAwareCompare(); #endif @@ -1053,10 +1049,6 @@ void tst_QString::acc_01() QVERIFY(a.isNull()); QVERIFY(*a.toLatin1().constData() == '\0'); { -#if defined(Q_OS_WINCE) - int argc = 0; - QCoreApplication app(argc, 0); -#endif QFile f("COMPARE.txt"); f.open(QIODevice::ReadOnly); QTextStream ts( &f ); @@ -5309,15 +5301,11 @@ void tst_QString::tortureSprintfDouble() #include <locale.h> -#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) -// On Q_OS_WIN others than Win CE, we cannot set the system or user locale +#if !defined(Q_OS_WIN) +// On Q_OS_WIN, we cannot set the system or user locale void tst_QString::localeAwareCompare_data() { -#ifdef Q_OS_WIN_AND_WINCE - QTest::addColumn<ulong>("locale"); -#else QTest::addColumn<QString>("locale"); -#endif QTest::addColumn<QString>("s1"); QTest::addColumn<QString>("s2"); QTest::addColumn<int>("result"); @@ -5327,15 +5315,9 @@ void tst_QString::localeAwareCompare_data() Latin-1-specific characters (I think). Compare with Swedish below. */ -#ifdef Q_OS_WIN_AND_WINCE // assume c locale to be english - QTest::newRow("c1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1; - QTest::newRow("c2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("c3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; -#else QTest::newRow("c1") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1; QTest::newRow("c2") << QString("C") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("c3") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; -#endif /* It's hard to test English, because it's treated differently @@ -5345,15 +5327,9 @@ void tst_QString::localeAwareCompare_data() comparison of Latin-1 values, although I'm not sure. So I just test digits to make sure that it's not totally broken. */ -#ifdef Q_OS_WIN_AND_WINCE - QTest::newRow("english1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("4") << 1; - QTest::newRow("english2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("4") << QString("6") << -1; - QTest::newRow("english3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("6") << -1; -#else QTest::newRow("english1") << QString("en_US") << QString("5") << QString("4") << 1; QTest::newRow("english2") << QString("en_US") << QString("4") << QString("6") << -1; QTest::newRow("english3") << QString("en_US") << QString("5") << QString("6") << -1; -#endif /* In Swedish, a with ring above (E5) comes before a with diaresis (E4), which comes before o diaresis (F6), which @@ -5364,11 +5340,6 @@ void tst_QString::localeAwareCompare_data() QTest::newRow("swedish2") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish3") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish4") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1; -#elif defined(Q_OS_WIN_AND_WINCE) - QTest::newRow("swedish1") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1; - QTest::newRow("swedish2") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("swedish3") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("swedish4") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1; #else QTest::newRow("swedish1") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1; QTest::newRow("swedish2") << QString("sv_SE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; @@ -5394,10 +5365,6 @@ void tst_QString::localeAwareCompare_data() QTest::newRow("german1") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; QTest::newRow("german2") << QString("de_DE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("german3") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1; -#elif defined(Q_OS_WIN_AND_WINCE) - QTest::newRow("german1") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; - QTest::newRow("german2") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("german3") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1; #else QTest::newRow("german1") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; QTest::newRow("german2") << QString("de_DE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; @@ -5407,11 +5374,7 @@ void tst_QString::localeAwareCompare_data() void tst_QString::localeAwareCompare() { -#ifdef Q_OS_WIN_AND_WINCE - QFETCH(ulong, locale); -#else QFETCH(QString, locale); -#endif QFETCH(QString, s1); QFETCH(QString, s2); QFETCH(int, result); @@ -5419,11 +5382,7 @@ void tst_QString::localeAwareCompare() QStringRef r1(&s1, 0, s1.length()); QStringRef r2(&s2, 0, s2.length()); -#ifdef Q_OS_WIN_AND_WINCE - DWORD oldLcid = GetUserDefaultLCID(); - SetUserDefaultLCID(locale); - QCOMPARE(locale, GetUserDefaultLCID()); -#elif defined (Q_OS_MAC) || defined(QT_USE_ICU) +#if defined (Q_OS_DARWIN) || defined(QT_USE_ICU) QSKIP("Setting the locale is not supported on OS X or ICU (you can set the C locale, but that won't affect localeAwareCompare)"); #else if (!locale.isEmpty()) { @@ -5485,14 +5444,10 @@ void tst_QString::localeAwareCompare() QVERIFY(testres == 0); } -#ifdef Q_OS_WIN_AND_WINCE - SetUserDefaultLCID(oldLcid); -#else if (!locale.isEmpty()) setlocale(LC_ALL, ""); -#endif } -#endif //!defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) +#endif //!defined(Q_OS_WIN) void tst_QString::reverseIterators() { diff --git a/tests/auto/corelib/tools/qstringapisymmetry/.gitignore b/tests/auto/corelib/tools/qstringapisymmetry/.gitignore new file mode 100644 index 0000000000..d28de05438 --- /dev/null +++ b/tests/auto/corelib/tools/qstringapisymmetry/.gitignore @@ -0,0 +1 @@ +tst_qstringapisymmetry diff --git a/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro new file mode 100644 index 0000000000..76e89c9acd --- /dev/null +++ b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qstringapisymmetry +QT = core testlib +SOURCES = tst_qstringapisymmetry.cpp +contains(QT_CONFIG,c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp new file mode 100644 index 0000000000..f6d2579074 --- /dev/null +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#undef QT_NO_CAST_FROM_ASCII +#undef QT_NO_CAST_TO_ASCII +#undef QT_ASCII_CAST_WARNINGS + +#include <QString> +#include <QChar> +#include <QStringRef> +#include <QLatin1String> + +#include <QTest> + +Q_DECLARE_METATYPE(QLatin1String) +Q_DECLARE_METATYPE(QStringRef) + +template <typename T> +QString toQString(const T &t) { return QString(t); } +QString toQString(const QStringRef &ref) { return ref.toString(); } + +class tst_QStringApiSymmetry : public QObject +{ + Q_OBJECT + + void compare_data(bool hasConceptOfNullAndEmpty=true); + template <typename LHS, typename RHS> + void compare_impl() const; + +private Q_SLOTS: + // test all combinations of {QChar, QStringRef, QString, QLatin1String} + void compare_QChar_QChar_data() { compare_data(false); } + void compare_QChar_QChar() { compare_impl<QChar, QChar>(); } + void compare_QChar_QStringRef_data() { compare_data(false); } + void compare_QChar_QStringRef() { compare_impl<QChar, QStringRef>(); } + void compare_QChar_QString_data() { compare_data(false); } + void compare_QChar_QString() { compare_impl<QChar, QString>(); } + void compare_QChar_QLatin1String_data() { compare_data(false); } + void compare_QChar_QLatin1String() { compare_impl<QChar, QLatin1String>(); } + + void compare_QStringRef_QChar_data() { compare_data(false); } + void compare_QStringRef_QChar() { compare_impl<QStringRef, QChar>(); } + void compare_QStringRef_QStringRef_data() { compare_data(); } + void compare_QStringRef_QStringRef() { compare_impl<QStringRef, QStringRef>(); } + void compare_QStringRef_QString_data() { compare_data(); } + void compare_QStringRef_QString() { compare_impl<QStringRef, QString>(); } + void compare_QStringRef_QLatin1String_data() { compare_data(); } + void compare_QStringRef_QLatin1String() { compare_impl<QStringRef, QLatin1String>(); } + + void compare_QString_QChar_data() { compare_data(false); } + void compare_QString_QChar() { compare_impl<QString, QChar>(); } + void compare_QString_QStringRef_data() { compare_data(); } + void compare_QString_QStringRef() { compare_impl<QString, QStringRef>(); } + void compare_QString_QString_data() { compare_data(); } + void compare_QString_QString() { compare_impl<QString, QString>(); } + void compare_QString_QLatin1String_data() { compare_data(); } + void compare_QString_QLatin1String() { compare_impl<QString, QLatin1String>(); } + + void compare_QLatin1String_QChar_data() { compare_data(false); } + void compare_QLatin1String_QChar() { compare_impl<QLatin1String, QChar>(); } + void compare_QLatin1String_QStringRef_data() { compare_data(); } + void compare_QLatin1String_QStringRef() { compare_impl<QLatin1String, QStringRef>(); } + void compare_QLatin1String_QString_data() { compare_data(); } + void compare_QLatin1String_QString() { compare_impl<QLatin1String, QString>(); } + void compare_QLatin1String_QLatin1String_data() { compare_data(); } + void compare_QLatin1String_QLatin1String() { compare_impl<QLatin1String, QLatin1String>(); } + +}; + +void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty) +{ + QTest::addColumn<QStringRef>("lhsUnicode"); + QTest::addColumn<QLatin1String>("lhsLatin1"); + QTest::addColumn<QStringRef>("rhsUnicode"); + QTest::addColumn<QLatin1String>("rhsLatin1"); + QTest::addColumn<int>("caseSensitiveCompareResult"); + QTest::addColumn<int>("caseInsensitiveCompareResult"); + + if (hasConceptOfNullAndEmpty) { + QTest::newRow("null <> null") << QStringRef() << QLatin1String() + << QStringRef() << QLatin1String() + << 0 << 0; + static const QString empty(""); + QTest::newRow("null <> empty") << QStringRef() << QLatin1String() + << QStringRef(&empty) << QLatin1String("") + << 0 << 0; + } + +#define ROW(lhs, rhs) \ + do { \ + static const QString pinned[] = { \ + QString(QLatin1String(lhs)), \ + QString(QLatin1String(rhs)), \ + }; \ + QTest::newRow("'" lhs "' <> '" rhs "'") \ + << QStringRef(&pinned[0]) << QLatin1String(lhs) \ + << QStringRef(&pinned[1]) << QLatin1String(rhs) \ + << qstrcmp(lhs, rhs) << qstricmp(lhs, rhs); \ + } while (false) + ROW("", "0"); + ROW("0", ""); + ROW("0", "1"); + ROW("0", "0"); +#undef ROW +} + +template <typename String> String make(const QStringRef &sf, QLatin1String l1); +template <> QChar make(const QStringRef &sf, QLatin1String) +{ return sf.isEmpty() ? QChar(QLatin1Char('\0')) : sf.at(0); } +template <> QStringRef make(const QStringRef &sf, QLatin1String) { return sf; } +template <> QString make(const QStringRef &sf, QLatin1String) { return sf.toString(); } +template <> QLatin1String make(const QStringRef &, QLatin1String l1) { return l1; } + +template <typename LHS, typename RHS> +void tst_QStringApiSymmetry::compare_impl() const +{ + QFETCH(QStringRef, lhsUnicode); + QFETCH(QLatin1String, lhsLatin1); + QFETCH(QStringRef, rhsUnicode); + QFETCH(QLatin1String, rhsLatin1); + QFETCH(int, caseSensitiveCompareResult); + + const LHS lhs = make<LHS>(lhsUnicode, lhsLatin1); + const RHS rhs = make<RHS>(rhsUnicode, rhsLatin1); + +#ifdef Q_COMPILER_NOEXCEPT +# define QVERIFY_NOEXCEPT(expr) QVERIFY(noexcept(expr)) +#else +# define QVERIFY_NOEXCEPT(expr) +#endif + +#define CHECK(op) \ + QVERIFY_NOEXCEPT(lhs op rhs); \ + do { if (caseSensitiveCompareResult op 0) { \ + QVERIFY(lhs op rhs); \ + } else { \ + QVERIFY(!(lhs op rhs)); \ + } } while (false) + + CHECK(==); + CHECK(!=); + CHECK(<); + CHECK(>); + CHECK(<=); + CHECK(>=); +#undef CHECK +} + +QTEST_APPLESS_MAIN(tst_QStringApiSymmetry) + +#include "tst_qstringapisymmetry.moc" diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index dc3547f9ba..0fdafd9b01 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -32,9 +32,6 @@ #include <qstringlist.h> #include <locale.h> -#ifdef Q_OS_WINCE -#include <windows.h> // needed for GetUserDefaultLCID -#endif class tst_QStringList : public QObject { @@ -205,13 +202,7 @@ void tst_QStringList::sort() list2 << "BETA" << "Gamma" << "alpha" << "beta" << "epsilon" << "gAmma" << "gamma"; QCOMPARE( list1, list2 ); -#ifdef Q_OS_WINCE - DWORD oldLcid = GetUserDefaultLCID(); - // Assume c locale to be english - SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); -#else char *current_locale = setlocale(LC_ALL, "C"); -#endif QStringList list3, list4; list3 << "alpha" << "beta" << "BETA" << "gamma" << "Gamma" << "gAmma" << "epsilon"; list3.sort(Qt::CaseInsensitive); @@ -224,11 +215,7 @@ void tst_QStringList::sort() QCOMPARE(list4.at(0), QString("alpha")); QVERIFY(list4.indexOf("epsilon") > 0); QVERIFY(list4.indexOf("epsilon") < (list4.count() - 1)); -#ifdef Q_OS_WINCE - SetUserDefaultLCID(oldLcid); -#else setlocale(LC_ALL, current_locale); -#endif } void tst_QStringList::replaceInStrings() diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index 83838570be..cd2cdab11b 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -68,11 +68,7 @@ protected: void tst_QTimeLine::range() { -#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - using longer times instead - QTimeLine timeLine(2000); -#else QTimeLine timeLine(200); -#endif QCOMPARE(timeLine.startFrame(), 0); QCOMPARE(timeLine.endFrame(), 0); timeLine.setFrameRange(0, 1); diff --git a/tests/auto/corelib/tools/qtimezone/BLACKLIST b/tests/auto/corelib/tools/qtimezone/BLACKLIST index 665e78bc08..d74ec33209 100644 --- a/tests/auto/corelib/tools/qtimezone/BLACKLIST +++ b/tests/auto/corelib/tools/qtimezone/BLACKLIST @@ -1,2 +1,3 @@ [tzTest] opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index 34d9256244..c37a15089a 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -29,6 +29,7 @@ #include <QtTest/QtTest> #include <QtCore/qversionnumber.h> +#include <QtCore/qlibraryinfo.h> class tst_QVersionNumber : public QObject { @@ -79,6 +80,7 @@ private slots: void serialize_data(); void serialize(); void moveSemantics(); + void qtVersion(); }; void tst_QVersionNumber::singleInstanceData() @@ -636,6 +638,17 @@ void tst_QVersionNumber::moveSemantics() #endif } +void tst_QVersionNumber::qtVersion() +{ + QVersionNumber v = QLibraryInfo::version(); + QVERIFY(!v.isNull()); + QCOMPARE(v.majorVersion(), QT_VERSION_MAJOR); + // we can't compare the minor and micro version: + // the library may change without the test being recompiled + + QCOMPARE(v.toString(), QString(qVersion())); +} + QTEST_APPLESS_MAIN(tst_QVersionNumber) #include "tst_qversionnumber.moc" diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index f9e1c454e7..5fe8c13e25 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -51,6 +51,7 @@ SUBDIRS=\ qstl \ qstring \ qstring_no_cast_from_bytearray \ + qstringapisymmetry \ qstringbuilder \ qstringiterator \ qstringlist \ diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro index b0442a0ee4..21e665fa37 100644 --- a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro +++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro @@ -7,8 +7,8 @@ QT = core-private dbus-private testlib contains(QT_CONFIG, dbus-linked) { DEFINES += QT_LINKED_LIBDBUS - LIBS += $$QT_LIBS_DBUS - QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS + LIBS += $$QMAKE_LIBS_DBUS + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS } else { SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp } diff --git a/tests/auto/dbus/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro index 17ae349675..e65b9ec5b3 100644 --- a/tests/auto/dbus/qdbustype/qdbustype.pro +++ b/tests/auto/dbus/qdbustype/qdbustype.pro @@ -4,8 +4,8 @@ QT = core-private dbus-private testlib SOURCES += tst_qdbustype.cpp contains(QT_CONFIG, dbus-linked) { DEFINES += QT_LINKED_LIBDBUS - LIBS += $$QT_LIBS_DBUS - QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS + LIBS += $$QMAKE_LIBS_DBUS + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS } else { SOURCES += ../../../../src/dbus/qdbus_symbols.cpp } diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index 485472c70c..46bfb2a586 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -3,14 +3,5 @@ TARGET = tst_qicoimageformat SOURCES+= tst_qicoimageformat.cpp QT += testlib -wince { - CONFIG(debug, debug|release):{ - addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll - } else { - addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll - } - addPlugins.path = imageformats - DEPLOYMENT += addPlugins -} TESTDATA += icons/* android:RESOURCES+=qicoimageformat.qrc diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 3c4610a892..b728d095d7 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -393,7 +393,6 @@ void tst_QIcon::addFile() icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png"), QSize(), QIcon::Selected); icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png"), QSize(), QIcon::Selected); -#ifndef Q_OS_WINCE QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() == QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage()); QVERIFY(icon.pixmap(32, QIcon::Normal).toImage() == @@ -406,13 +405,6 @@ void tst_QIcon::addFile() QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png")).toImage()); QVERIFY(icon.pixmap(128, QIcon::Selected).toImage() == QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png")).toImage()); -#else - // WinCE only includes the 16x16 images for size reasons - QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() == - QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage()); - QVERIFY(icon.pixmap(16, QIcon::Selected).toImage() == - QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-16.png")).toImage()); -#endif } static bool sizeLess(const QSize &a, const QSize &b) diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 91df1ca520..90b88d0992 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -195,6 +195,9 @@ private slots: void pixelColor(); void pixel(); + void ditherGradient_data(); + void ditherGradient(); + private: const QString m_prefix; }; @@ -290,17 +293,13 @@ void tst_QImage::swap() void tst_QImage::create() { bool cr = true; -#if !defined(Q_OS_WINCE) QT_TRY { -#endif //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian); QImage image(7000000, 7000000, QImage::Format_Indexed8); image.setColorCount(256); cr = !image.isNull(); -#if !defined(Q_OS_WINCE) } QT_CATCH (...) { } -#endif QVERIFY( !cr ); } @@ -1785,11 +1784,7 @@ void tst_QImage::smoothScale4() void tst_QImage::smoothScaleBig() { -#if defined(Q_OS_WINCE) - int bigValue = 2000; -#else int bigValue = 200000; -#endif QImage tall(4, bigValue, QImage::Format_ARGB32); tall.fill(0x0); @@ -3114,5 +3109,78 @@ void tst_QImage::pixel() } } +void tst_QImage::ditherGradient_data() +{ + QTest::addColumn<QImage>("image"); + QTest::addColumn<QImage::Format>("format"); + QTest::addColumn<int>("flags"); + QTest::addColumn<int>("minimumExpectedGradient"); + + QImage rgb32(256, 16, QImage::Format_RGB32); + QLinearGradient gradient(QRectF(rgb32.rect()).topLeft(), QRectF(rgb32.rect()).topRight()); + gradient.setColorAt(0.0, QColor(0, 0, 0)); + gradient.setColorAt(1.0, QColor(255, 255, 255)); + QPainter p; + p.begin(&rgb32); + p.fillRect(rgb32.rect(), gradient); + p.end(); + + QTest::newRow("rgb32 -> rgb444 (no dither)") << rgb32 << QImage::Format_RGB444 << 0 << 16; + QTest::newRow("rgb32 -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33; + QTest::newRow("rgb32 -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33; + QTest::newRow("rgb32 -> rgb16 (no dither)") << rgb32 << QImage::Format_RGB16 << 0 << 32; + QTest::newRow("rgb32 -> rgb16 (dithering)") << rgb32 << QImage::Format_RGB16 << int(Qt::PreferDither | Qt::OrderedDither) << 65; + QTest::newRow("rgb32 -> rgb666 (no dither)") << rgb32 << QImage::Format_RGB666 << 0 << 64; + QTest::newRow("rgb32 -> rgb666 (dithering)") << rgb32 << QImage::Format_RGB666 << int(Qt::PreferDither | Qt::OrderedDither) << 129; + + // Test we get the same results for opaque input in the ARGBPM implementation. + rgb32 = qMove(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied); + QTest::newRow("argb32pm -> argb4444pm (no dither)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << 0 << 16; + QTest::newRow("argb32pm -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33; + QTest::newRow("argb32pm -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33; + QTest::newRow("argb32pm -> argb8565pm (no dither)") << rgb32 << QImage::Format_ARGB8565_Premultiplied << 0 << 32; + QTest::newRow("argb32pm -> argb8565pm (dithering)") << rgb32 << QImage::Format_ARGB8565_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 65; + QTest::newRow("argb32pm -> argb6666pm (no dither)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << 0 << 64; + QTest::newRow("argb32pm -> argb6666pm (dithering)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 129; + + QImage rgb30(1024, 16, QImage::Format_RGB30); + QLinearGradient gradient30(QRectF(rgb30.rect()).topLeft(), QRectF(rgb30.rect()).topRight()); + gradient30.setColorAt(0.0, QColor(0, 0, 0)); + gradient30.setColorAt(1.0, QColor(255, 255, 255)); + p.begin(&rgb30); + p.fillRect(rgb30.rect(), gradient30); + p.end(); + + QTest::newRow("rgb30 -> rgb32 (no dither)") << rgb30 << QImage::Format_RGB32 << 0 << 256; + QTest::newRow("rgb30 -> rgb32 (dithering)") << rgb30 << QImage::Format_RGB32 << int(Qt::PreferDither | Qt::OrderedDither) << 513; + QTest::newRow("rgb30 -> rgb888 (no dither)") << rgb30 << QImage::Format_RGB888 << 0 << 256; + QTest::newRow("rgb30 -> rgb888 (dithering)") << rgb30 << QImage::Format_RGB888 << int(Qt::PreferDither | Qt::OrderedDither) << 513; +} + +void tst_QImage::ditherGradient() +{ + QFETCH(QImage, image); + QFETCH(QImage::Format, format); + QFETCH(int, flags); + QFETCH(int, minimumExpectedGradient); + + QImage converted = image.convertToFormat(format, (Qt::ImageConversionFlags)flags); + int observedGradientSteps = 0; + int lastTotal = -1; + for (int i = 0; i < converted.width(); ++i) { + int total = 0; + for (int j = 0; j < converted.height(); ++j) { + uint c = converted.pixel(i, j); + QCOMPARE(qAlpha(c), 255); + total += qRed(c); + } + if (total > lastTotal) { + observedGradientSteps++; + lastTotal = total; + } + } + QVERIFY(observedGradientSteps >= minimumExpectedGradient); +} + QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index c12c8a9cf4..f48fab4f0a 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -508,9 +508,6 @@ void tst_QImageWriter::saveToTemporaryFile() QVERIFY(writer.write(image)); else qWarning() << file.errorString(); -#if defined(Q_OS_WINCE) - file.reset(); -#endif QCOMPARE(QImage(writer.fileName()), image); } { @@ -529,9 +526,6 @@ void tst_QImageWriter::saveToTemporaryFile() QVERIFY2(file.open(), qPrintable(file.errorString())); QImageWriter writer(&file, "PNG"); QVERIFY(writer.write(image)); -#if defined(Q_OS_WINCE) - file.reset(); -#endif QCOMPARE(QImage(writer.fileName()), image); } { diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index a04ad73b80..4a741ec154 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -5,8 +5,8 @@ qtHaveModule(widgets): QT += widgets SOURCES += tst_qmovie.cpp MOC_DIR=tmp -!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF -!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG +contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF +contains(QT_CONFIG, jpeg):DEFINES += QTEST_HAVE_JPEG RESOURCES += resources.qrc TESTDATA += animations/* diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index 5a4656998a..e6a020af1a 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -5,9 +5,7 @@ QT += core-private gui-private testlib qtHaveModule(widgets): QT += widgets widgets-private SOURCES += tst_qpixmap.cpp -!wince:!winrt { - win32:LIBS += -lgdi32 -luser32 -} +win32:!winrt:LIBS += -lgdi32 -luser32 RESOURCES += qpixmap.qrc TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/* diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 6adfe05fb0..79d3a57d73 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -442,22 +442,16 @@ void tst_QPixmap::fill_data() QTest::newRow(("syscolor_" + QByteArray::number(color)).constData()) << uint(color) << true << false; -#if defined (Q_OS_WINCE) - QPixmap pixmap(1,1); - if (QApplication::desktop()->grab().depth() >= 24) { -#else - QPixmap pixmap(1, 1); { -#endif - QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false; - QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false; - QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false; - QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false; - QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false; - QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false; - QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false; - QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false; - QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false; - } + QPixmap pixmap(1, 1); + QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false; + QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false; + QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false; + QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false; + QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false; + QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false; + QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false; + QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false; + QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false; QTest::newRow("bitmap_color0") << uint(Qt::color0) << true << true; QTest::newRow("bitmap_color1") << uint(Qt::color1) << true << true; @@ -891,9 +885,6 @@ void tst_QPixmap::fromWinHBITMAP() HGDIOBJ old_brush = SelectObject(bitmap_dc, CreateSolidBrush(RGB(red, green, blue))); Rectangle(bitmap_dc, 0, 0, 100, 100); -#ifdef Q_OS_WINCE //the device context has to be deleted before QPixmap::fromWinHBITMAP() - DeleteDC(bitmap_dc); -#endif QPixmap pixmap = qt_pixmapFromWinHBITMAP(bitmap); QCOMPARE(pixmap.width(), 100); QCOMPARE(pixmap.height(), 100); @@ -906,9 +897,7 @@ void tst_QPixmap::fromWinHBITMAP() DeleteObject(SelectObject(bitmap_dc, old_brush)); DeleteObject(SelectObject(bitmap_dc, bitmap)); -#ifndef Q_OS_WINCE DeleteDC(bitmap_dc); -#endif ReleaseDC(0, display_dc); } @@ -1010,7 +999,6 @@ void tst_QPixmap::fromWinHICON_data() void tst_QPixmap::fromWinHICON() { -#ifndef Q_OS_WINCE QFETCH(int, width); QFETCH(int, height); QFETCH(QString, image); @@ -1028,7 +1016,6 @@ void tst_QPixmap::fromWinHICON() // between QImage::Format_ARGB32 and QImage::Format_ARGB32_Premultiplied, or elsewhere QVERIFY(compareImages(imageFromHICON, imageFromFile)); -#endif // Q_OS_WINCE } #endif // Q_OS_WIN && !Q_OS_WINRT diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index 5000e1a926..317d8c1ff9 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -25,7 +25,7 @@ SUBDIRS=\ qopenglwindow \ qrasterwindow -win32:!wince:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop +win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop !qtHaveModule(widgets): SUBDIRS -= \ qmouseevent_modal \ diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro index a42b359f29..5e4875d1e7 100644 --- a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro +++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro @@ -5,4 +5,4 @@ QT += core-private network gui-private testlib SOURCES += tst_noqteventloop.cpp -contains(QT_CONFIG,dynamicgl):win32:!wince*:!winrt: LIBS += -luser32 +contains(QT_CONFIG,dynamicgl):win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/gui/kernel/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp index 22f2aa3bb8..32e91a9939 100644 --- a/tests/auto/gui/kernel/qclipboard/copier/main.cpp +++ b/tests/auto/gui/kernel/qclipboard/copier/main.cpp @@ -33,11 +33,9 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); QString paste = QStringLiteral("testString.!"); -#ifndef Q_OS_WINCE const QStringList arguments = app.arguments(); if (arguments.size() > 1) paste = arguments.at(1); -#endif #ifndef QT_NO_CLIPBOARD QGuiApplication::clipboard()->setText(paste); #endif diff --git a/tests/auto/gui/kernel/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp index c96d903fb7..7fca8af1cb 100644 --- a/tests/auto/gui/kernel/qclipboard/paster/main.cpp +++ b/tests/auto/gui/kernel/qclipboard/paster/main.cpp @@ -66,13 +66,9 @@ int main(int argc, char **argv) return 0; } -#ifndef Q_OS_WINCE QString expected; if (parser.isSet(textOption)) expected = parser.value(textOption); -#else // !Q_OS_WINCE - const QString expected = QStringLiteral("testString.!"); -#endif // Q_OS_WINCE if (!expected.isEmpty()) { #ifndef QT_NO_CLIPBOARD const QString actual = QGuiApplication::clipboard()->text(); diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro index 40bf9c8d8e..59b77b11ba 100644 --- a/tests/auto/gui/kernel/qclipboard/test/test.pro +++ b/tests/auto/gui/kernel/qclipboard/test/test.pro @@ -13,10 +13,6 @@ win32 { } } -wince* { - DEPLOYMENT += rsc reg_resource -} - !winrt: TEST_HELPER_INSTALLS = \ ../copier/copier \ ../paster/paster diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 6bad45fefe..bfa15744c2 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -313,10 +313,6 @@ void tst_QClipboard::setMimeData() QMimeData *mimeData = new QMimeData; const QString TestName(QLatin1String("tst_QClipboard::setMimeData() mimeData")); mimeData->setObjectName(TestName); -#if defined(Q_OS_WINCE) - // need to set text on CE - mimeData->setText(QLatin1String("Qt/CE foo")); -#endif QGuiApplication::clipboard()->setMimeData(mimeData); QCOMPARE(QGuiApplication::clipboard()->mimeData(), (const QMimeData *)mimeData); diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index 8002303723..cca0e95c29 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -31,8 +31,6 @@ #include <QtGui> #include <QtTest/QtTest> -#include "../../../qtest-config.h" - Q_DECLARE_METATYPE(QMetaType::Type) class tst_QGuiMetaType: public QObject @@ -75,14 +73,14 @@ private slots: F(QVector4D, QVector4D) \ F(QQuaternion, QQuaternion) -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR # define FOR_EACH_GUI_METATYPE(F) \ FOR_EACH_GUI_METATYPE_BASE(F) \ F(QCursor, QCursor) -#else // !QTEST_NO_CURSOR +#else // !QT_NO_CURSOR # define FOR_EACH_GUI_METATYPE(F) \ FOR_EACH_GUI_METATYPE_BASE(F) -#endif // !QTEST_NO_CURSOR +#endif // !QT_NO_CURSOR namespace { @@ -131,7 +129,7 @@ template<> struct TypeComparator<QMetaType::QBitmap> { return v1.size() == v2.size(); } }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR template<> struct TypeComparator<QMetaType::QCursor> { static bool equal(const QCursor &v1, const QCursor &v2) @@ -176,7 +174,7 @@ template<> struct TestValueFactory<QMetaType::QRegion> { template<> struct TestValueFactory<QMetaType::QBitmap> { static QBitmap *create() { return new QBitmap(16, 32); } }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR template<> struct TestValueFactory<QMetaType::QCursor> { static QCursor *create() { return new QCursor(Qt::WaitCursor); } }; diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 8be7227c54..a057ec2207 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -52,8 +52,6 @@ #include "tst_qvariant_common.h" -#include "../../../../qtest-config.h" - class tst_QGuiVariant : public QObject { Q_OBJECT @@ -172,7 +170,7 @@ void tst_QGuiVariant::canConvert_data() var = QVariant::fromValue(QColor()); QTest::newRow("Color") << var << N << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR var = QVariant::fromValue(QCursor()); QTest::newRow("Cursor") << var << N << N << N << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N; @@ -508,7 +506,7 @@ void tst_QGuiVariant::writeToReadFromDataStream_data() QTest::newRow( "bitmap_valid" ) << QVariant::fromValue( bitmap ) << false; QTest::newRow( "brush_valid" ) << QVariant::fromValue( QBrush( Qt::red ) ) << false; QTest::newRow( "color_valid" ) << QVariant::fromValue( QColor( Qt::red ) ) << false; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QTest::newRow( "cursor_valid" ) << QVariant::fromValue( QCursor( Qt::PointingHandCursor ) ) << false; #endif QTest::newRow( "font_valid" ) << QVariant::fromValue( QFont( "times", 12 ) ) << false; @@ -716,14 +714,14 @@ void tst_QGuiVariant::implicitConstruction() F(Quaternion) \ F(PolygonF) -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR # define FOR_EACH_GUI_CLASS(F) \ FOR_EACH_GUI_CLASS_BASE(F) \ F(Cursor) -#else // !QTEST_NO_CURSOR +#else // !QT_NO_CURSOR # define FOR_EACH_GUI_CLASS(F) \ FOR_EACH_GUI_CLASS_BASE(F) -#endif // QTEST_NO_CURSOR +#endif // QT_NO_CURSOR #define CONSTRUCT(TYPE) \ { \ @@ -741,14 +739,14 @@ void tst_QGuiVariant::implicitConstruction() void tst_QGuiVariant::guiVariantAtExit() { // crash test, it should not crash at QGuiApplication exit -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR static QVariant cursor = QCursor(); #endif static QVariant point = QPoint(); static QVariant icon = QIcon(); static QVariant image = QImage(); static QVariant palette = QPalette(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Q_UNUSED(cursor); #endif Q_UNUSED(point); diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 0d0b6ae81e..6394a956bd 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -725,7 +725,7 @@ void tst_QKeySequence::listFromString() void tst_QKeySequence::translated_data() { -#if defined (Q_OS_MAC) || defined (Q_OS_WINCE) +#if defined (Q_OS_DARWIN) QSKIP("Test not applicable"); #endif @@ -756,7 +756,7 @@ void tst_QKeySequence::translated_data() void tst_QKeySequence::translated() { -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QFETCH(QString, transKey); QFETCH(QString, compKey); diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro index 08e1b1d3a0..f975e00ffa 100644 --- a/tests/auto/gui/kernel/qwindow/qwindow.pro +++ b/tests/auto/gui/kernel/qwindow/qwindow.pro @@ -5,4 +5,4 @@ QT += core-private gui-private testlib SOURCES += tst_qwindow.cpp -contains(QT_CONFIG,dynamicgl):win32:!wince:!winrt: LIBS += -luser32 +contains(QT_CONFIG,dynamicgl):win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 892dc0899f..1756dab70a 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -40,7 +40,7 @@ #if defined(Q_OS_QNX) #include <QOpenGLContext> -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <QtCore/qt_windows.h> #endif @@ -2079,7 +2079,7 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109() static bool isNativeWindowVisible(const QWindow *window) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) return IsWindowVisible(reinterpret_cast<HWND>(window->winId())); #else Q_UNIMPLEMENTED(); diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 8a97a9261f..d2cc7ce072 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -39,9 +39,7 @@ #include <qimage.h> #include <qthread.h> #include <limits.h> -#if !defined(Q_OS_WINCE) #include <math.h> -#endif #include <qpaintengine.h> #ifndef QT_NO_WIDGETS #include <qdesktopwidget.h> diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index d24435198e..6a297dbfc2 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -47,6 +47,7 @@ public: private slots: void moveSemantics(); void boundingRect(); + void rangeFor(); void rects(); void swap(); void setRects(); @@ -136,17 +137,34 @@ void tst_QRegion::boundingRect() } +void tst_QRegion::rangeFor() +{ + // compile-only test for range-for over QRegion, so really useless + // content otherwise: + QRect rect(10, -20, 30, 40); + QRegion region(rect); + int equal = 0; + for (const QRect &r : region) // check this compiles + equal += int(r == rect); // can't use QCOMPARE here b/c of the + // MSVC 201272013 parse bug re: + // do-while in range-for loops + QCOMPARE(equal, 1); +} + void tst_QRegion::rects() { { QRect rect; QRegion region(rect); QVERIFY(region.isEmpty()); + QCOMPARE(region.begin(), region.end()); QVERIFY(region.rects().isEmpty()); } { QRect rect(10, -20, 30, 40); QRegion region(rect); + QCOMPARE(region.end(), region.begin() + 1); + QCOMPARE(*region.begin(), rect); QCOMPARE(region.rects().count(), 1); QCOMPARE(region.rects()[0], rect); } @@ -192,6 +210,7 @@ void tst_QRegion::setRects() region.setRects(&rect, 0); QVERIFY(region.isEmpty()); QCOMPARE(region, QRegion()); + QCOMPARE(region.begin(), region.end()); QVERIFY(!region.boundingRect().isValid()); QVERIFY(region.rects().isEmpty()); } @@ -199,6 +218,7 @@ void tst_QRegion::setRects() QRegion region; QRect rect; region.setRects(&rect, 1); + QCOMPARE(region.begin(), region.end()); QVERIFY(!region.boundingRect().isValid()); QVERIFY(region.rects().isEmpty()); } @@ -206,8 +226,10 @@ void tst_QRegion::setRects() QRegion region; QRect rect(10, -20, 30, 40); region.setRects(&rect, 1); + QCOMPARE(region.end(), region.begin() + 1); QCOMPARE(region.rects().count(), 1); QCOMPARE(region.rects()[0], rect); + QCOMPARE(*region.begin(), rect); } } @@ -320,8 +342,12 @@ void tst_QRegion::emptyPolygonRegion() QRegion r(pa); QTEST(r.isEmpty(), "isEmpty"); + QTEST(int(std::distance(r.begin(), r.end())), "numRects"); + QVector<QRect> rects; + std::copy(r.begin(), r.end(), std::back_inserter(rects)); QTEST(r.rects().count(), "numRects"); QTEST(r.rects(), "rects"); + QCOMPARE(r.rects(), rects); } @@ -860,6 +886,7 @@ void tst_QRegion::isEmpty() QFETCH(QRegion, region); QVERIFY(region.isEmpty()); + QCOMPARE(region.begin(), region.end()); QCOMPARE(region, QRegion()); QCOMPARE(region.rectCount(), 0); QCOMPARE(region.boundingRect(), QRect()); @@ -892,6 +919,11 @@ void tst_QRegion::regionFromPath() path.addRect(0, 100, 100, 1000); QRegion rgn(path.toFillPolygon().toPolygon()); + + QCOMPARE(rgn.end(), rgn.begin() + 2); + QCOMPARE(rgn.begin()[0], QRect(0, 0, 10, 10)); + QCOMPARE(rgn.begin()[1], QRect(0, 100, 100, 1000)); + QCOMPARE(rgn.rects().size(), 2); QCOMPARE(rgn.rects().at(0), QRect(0, 0, 10, 10)); QCOMPARE(rgn.rects().at(1), QRect(0, 100, 100, 1000)); @@ -905,8 +937,14 @@ void tst_QRegion::regionFromPath() path.addRect(10, 10, 80, 80); QRegion rgn(path.toFillPolygon().toPolygon()); - QCOMPARE(rgn.rects().size(), 4); + QCOMPARE(rgn.end(), rgn.begin() + 4); + QCOMPARE(rgn.begin()[0], QRect(0, 0, 100, 10)); + QCOMPARE(rgn.begin()[1], QRect(0, 10, 10, 80)); + QCOMPARE(rgn.begin()[2], QRect(90, 10, 10, 80)); + QCOMPARE(rgn.begin()[3], QRect(0, 90, 100, 10)); + + QCOMPARE(rgn.rects().size(), 4); QCOMPARE(rgn.rects().at(0), QRect(0, 0, 100, 10)); QCOMPARE(rgn.rects().at(1), QRect(0, 10, 10, 80)); QCOMPARE(rgn.rects().at(2), QRect(90, 10, 10, 80)); diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp index e05d7dd022..a79526c434 100644 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp @@ -114,7 +114,7 @@ void tst_QWMatrix::mapping_data() << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( -300, -400, 300, 400 ) ); -#if (defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(M_PI) +#if defined(Q_OS_WIN) && !defined(M_PI) #define M_PI 3.14159265897932384626433832795f #endif diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index d3404e335a..9542d306ba 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -48,6 +48,8 @@ private slots: void getSetCheck(); void maximumBlockCount(); void anchorAt(); + void imageAt(); + void formatAt(); }; tst_QAbstractTextDocumentLayout::tst_QAbstractTextDocumentLayout() @@ -156,7 +158,7 @@ void tst_QAbstractTextDocumentLayout::anchorAt() // anchorAt on start returns link QRect linkBr = metrics.boundingRect("foo"); - QPointF linkPoint(linkBr.width() + blockStart.x(), (linkBr.height() / 2) + blockStart.y()); + QPointF linkPoint((linkBr.width() / 2) + blockStart.x(), (linkBr.height() / 2) + blockStart.y()); QCOMPARE(documentLayout->anchorAt(linkPoint), QString("link")); // anchorAt() on top of preedit at end should not assert @@ -171,5 +173,61 @@ void tst_QAbstractTextDocumentLayout::anchorAt() QCOMPARE(documentLayout->anchorAt(preeditPoint), QString()); } +void tst_QAbstractTextDocumentLayout::imageAt() +{ + QTextDocument doc; + doc.setHtml("foo<a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a>"); + QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); + QTextBlock firstBlock = doc.begin(); + QTextLayout *layout = firstBlock.layout(); + layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + + doc.setPageSize(QSizeF(1000, 1000)); + QFontMetrics metrics(layout->font()); + QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft(); + + QRect fooBr = metrics.boundingRect("foo"); + QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25); + // imageAt on image returns source + QCOMPARE(documentLayout->imageAt(imagePoint), QString("image")); + // anchorAt on image returns link + QCOMPARE(documentLayout->anchorAt(imagePoint), QString("link")); + + // imageAt on start returns nothing (there's the "foo" text) + QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + QCOMPARE(documentLayout->imageAt(fooPoint), QString()); +} + +void tst_QAbstractTextDocumentLayout::formatAt() +{ + QTextDocument doc; + doc.setHtml("foo<i><a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a></i>"); + QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); + QTextBlock firstBlock = doc.begin(); + QTextLayout *layout = firstBlock.layout(); + layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + + doc.setPageSize(QSizeF(1000, 1000)); + QFontMetrics metrics(layout->font()); + QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft(); + + QRect fooBr = metrics.boundingRect("foo"); + QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25); + + QTextFormat format = documentLayout->formatAt(imagePoint); + QVERIFY(format.isCharFormat()); + QVERIFY(format.toCharFormat().isAnchor()); + QVERIFY(format.toCharFormat().fontItalic()); + QVERIFY(format.isImageFormat()); + + // move over the unformatted "foo" text) + QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + format = documentLayout->formatAt(fooPoint); + QVERIFY(format.isCharFormat()); + QVERIFY(!format.toCharFormat().isAnchor()); + QVERIFY(!format.toCharFormat().fontItalic()); + QVERIFY(!format.isImageFormat()); +} + QTEST_MAIN(tst_QAbstractTextDocumentLayout) #include "tst_qabstracttextdocumentlayout.moc" diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro index 88d1fcfd2d..b92859d4fb 100644 --- a/tests/auto/gui/text/qcssparser/qcssparser.pro +++ b/tests/auto/gui/text/qcssparser/qcssparser.pro @@ -6,14 +6,6 @@ QT += xml gui-private testlib requires(contains(QT_CONFIG,private_tests)) DEFINES += SRCDIR=\\\"$$PWD\\\" -wince* { - addFiles.files = testdata - addFiles.path = . - timesFont.files = C:/Windows/Fonts/times.ttf - timesFont.path = . - DEPLOYMENT += addFiles timesFont -} - android { RESOURCES += \ testdata.qrc diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 847d6e2e2f..51e9bf646a 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -27,9 +27,6 @@ ****************************************************************************/ #include <QtTest/QtTest> #include <QtXml/QtXml> -#if defined(Q_OS_WINCE) -#include <QtGui/QFontDatabase> -#endif #include <QtGui/QFontInfo> #include <QtGui/QFontMetrics> @@ -39,10 +36,6 @@ class tst_QCssParser : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - private slots: void scanner_data(); void scanner(); @@ -85,33 +78,8 @@ private slots: void extractBorder(); void noTextDecoration(); void quotedAndUnquotedIdentifiers(); - -private: -#if defined(Q_OS_WINCE) - int m_timesFontId; -#endif }; -void tst_QCssParser::initTestCase() -{ -#if defined(Q_OS_WINCE) - QFontDatabase fontDB; - m_timesFontId = -1; - if (!fontDB.families().contains("Times New Roman")) { - m_timesFontId = QFontDatabase::addApplicationFont("times.ttf"); - QVERIFY(m_timesFontId != -1); - } -#endif -} - -void tst_QCssParser::cleanupTestCase() -{ -#if defined(Q_OS_WINCE) - if (m_timesFontId != -1) - QFontDatabase::removeApplicationFont(m_timesFontId); -#endif -} - void tst_QCssParser::scanner_data() { QTest::addColumn<QString>("input"); @@ -119,7 +87,7 @@ void tst_QCssParser::scanner_data() #if defined(Q_OS_ANDROID) QDir d(":/"); -#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) +#elif !defined(Q_OS_IRIX) QDir d(SRCDIR); #else QDir d(QDir::current()); diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST index d859dee03e..8890ec1ef3 100644 --- a/tests/auto/gui/text/qfont/BLACKLIST +++ b/tests/auto/gui/text/qfont/BLACKLIST @@ -1,2 +1,4 @@ [exactMatch] +# QTBUG-46054 opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 57530653c1..188c35c14c 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -656,11 +656,11 @@ void tst_QFont::defaultFamily_data() QTest::addColumn<QFont::StyleHint>("styleHint"); QTest::addColumn<QStringList>("acceptableFamilies"); - QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif")); - QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace")); - QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive")); - QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy")); - QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif")); + QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif").split(",")); + QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(",")); + QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive").split(",")); + QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy").split(",")); + QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif").split(",")); } void tst_QFont::defaultFamily() diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro index 5dba2fc06a..0aff8a3ac8 100644 --- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro +++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro @@ -3,12 +3,6 @@ TARGET = tst_qfontdatabase SOURCES += tst_qfontdatabase.cpp QT += testlib core-private gui-private -wince* { - additionalFiles.files = FreeMono.ttf - additionalFiles.path = . - DEPLOYMENT += additionalFiles -} - android { RESOURCES += testdata.qrc } diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro index 3abca8ce89..c08019a561 100644 --- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro +++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro @@ -6,12 +6,5 @@ SOURCES += \ tst_qglyphrun.cpp -wince* { - additionalFiles.files = test.ttf - additionalFiles.path = ../../../shared/resources/ - DEPLOYMENT += additionalFiles -} else { - RESOURCES += \ - testdata.qrc -} - +RESOURCES += \ + testdata.qrc diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 04e6bba91e..ea2b6a12f7 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -2899,15 +2899,28 @@ void tst_QTextDocument::testUndoBlocks() doc->undo(); QCOMPARE(doc->toPlainText(), QString("")); + cursor.insertText("town"); + cursor.beginEditBlock(); // Edit block 1 - Deletion/Insertion + cursor.setPosition(0, QTextCursor::KeepAnchor); + cursor.insertText("r"); + cursor.endEditBlock(); + cursor.insertText("est"); // Merged into edit block 1 + QCOMPARE(doc->toPlainText(), QString("rest")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("town")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); + + // This case would not happen in practice. If the user typed out this text, it would all be part of one + // edit block. This would cause the undo to clear all text. But for the purpose of testing the beginEditBlock + // and endEditBlock calls with respect to qtextdocument this is tested. cursor.insertText("quod"); - cursor.beginEditBlock(); + cursor.beginEditBlock(); // Edit block 1 - Insertion cursor.insertText(" erat"); cursor.endEditBlock(); - cursor.insertText(" demonstrandum"); + cursor.insertText(" demonstrandum"); // Merged into edit block 1 QCOMPARE(doc->toPlainText(), QString("quod erat demonstrandum")); doc->undo(); - QCOMPARE(doc->toPlainText(), QString("quod erat")); - doc->undo(); QCOMPARE(doc->toPlainText(), QString("quod")); doc->undo(); QCOMPARE(doc->toPlainText(), QString("")); diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro index ebcd6ec022..eb3de04da6 100644 --- a/tests/auto/gui/text/qzip/qzip.pro +++ b/tests/auto/gui/text/qzip/qzip.pro @@ -3,12 +3,6 @@ TARGET = tst_qzip QT += gui-private testlib SOURCES += tst_qzip.cpp -wince* { - addFiles.files = testdata - addFiles.path = . - DEPLOYMENT += addFiles -} - android { RESOURCES += \ testdata.qrc diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index 58164f1fa1..f57ed12ed3 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -46,7 +46,7 @@ void tst_qdesktopservices::openUrl() { // At the bare minimum check that they return false for invalid url's QCOMPARE(QDesktopServices::openUrl(QUrl()), false); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // this test is only valid on windows on other systems it might mean open a new document in the application handling .file const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\."); QVERIFY(messagePattern.isValid()); diff --git a/tests/auto/network/access/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro index 4294f27e74..6f1a4a7543 100644 --- a/tests/auto/network/access/qftp/qftp.pro +++ b/tests/auto/network/access/qftp/qftp.pro @@ -4,10 +4,3 @@ SOURCES += tst_qftp.cpp requires(contains(QT_CONFIG,private_tests)) QT = core network network-private testlib - -wince { - addFiles.files = rfc3252.txt - addFiles.path = . - DEPLOYMENT += addFiles -} - diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index edeb471401..a13fa86405 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -276,14 +276,9 @@ void tst_QFtp::init() inFileDirExistsFunction = false; -#if !defined(Q_OS_WINCE) srand(time(0)); uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QString::number((qulonglong)time(0)); -#else - srand(0); - uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QLatin1Char('0'); -#endif } void tst_QFtp::cleanup() @@ -1353,11 +1348,7 @@ void tst_QFtp::abort_data() QTest::newRow( "get_fluke02" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/rfc3252") << QByteArray(); // Qt/CE test environment has too little memory for this test -#if !defined(Q_OS_WINCE) QByteArray bigData( 10*1024*1024, 0 ); -#else - QByteArray bigData( 1*1024*1024, 0 ); -#endif bigData.fill( 'B' ); QTest::newRow( "put_fluke01" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/upload/abort_put") << bigData; } diff --git a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro index bd10c77252..d3a92436ac 100644 --- a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro +++ b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -!winrt:!wince: SUBDIRS += echo +!winrt:SUBDIRS += echo test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 21a84dfbb2..c679d1f108 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -205,6 +205,7 @@ private Q_SLOTS: void invalidProtocol(); void getFromData_data(); void getFromData(); + void getFromFile_data(); void getFromFile(); void getFromFileSpecial_data(); void getFromFileSpecial(); @@ -650,8 +651,10 @@ private slots: #endif void slotError(QAbstractSocket::SocketError err) { - Q_ASSERT(!client.isNull()); - qDebug() << "slotError" << err << client->errorString(); + if (client.isNull()) + qDebug() << "slotError" << err; + else + qDebug() << "slotError" << err << client->errorString(); } public slots: @@ -1674,14 +1677,26 @@ void tst_QNetworkReply::getFromData() QCOMPARE(reply->readAll(), expected); } +void tst_QNetworkReply::getFromFile_data() +{ + QTest::addColumn<bool>("backgroundAttribute"); + + QTest::newRow("no-background-attribute") << false; + QTest::newRow("background-attribute") << true; +} + void tst_QNetworkReply::getFromFile() { + QFETCH(bool, backgroundAttribute); + // create the file: QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX"); file.setAutoRemove(true); QVERIFY2(file.open(), qPrintable(file.errorString())); QNetworkRequest request(QUrl::fromLocalFile(file.fileName())); + if (backgroundAttribute) + request.setAttribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(true)); QNetworkReplyPtr reply; static const char fileData[] = "This is some data that is in the file.\r\n"; @@ -1691,6 +1706,7 @@ void tst_QNetworkReply::getFromFile() QCOMPARE(file.size(), qint64(data.size())); RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::GetOperation, request, reply)); + QVERIFY(waitForFinish(reply) != Timeout); QCOMPARE(reply->url(), request.url()); QCOMPARE(reply->error(), QNetworkReply::NoError); @@ -4319,9 +4335,6 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QSKIP("No qprocess support", SkipAll); #else -#if defined(Q_OS_WINCE) - QSKIP("Currently no stdin/out supported for Windows CE"); -#else #ifdef Q_OS_WIN if (qstrcmp(QTest::currentDataTag(), "small") == 0) QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, " @@ -4355,7 +4368,6 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QCOMPARE(file.size(), qint64(data.size())); QByteArray contents = file.readAll(); QCOMPARE(contents, data); -#endif #endif // QT_NO_PROCESS } @@ -6561,12 +6573,7 @@ void tst_QNetworkReply::getFromHttpIntoBuffer2() QFETCH(bool, useDownloadBuffer); // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results. -#if defined(Q_OS_WINCE_WM) - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else enum {UploadSize = 32*1024*1024}; // 32 MB -#endif GetFromHttpIntoBuffer2Server server(UploadSize, true, false); diff --git a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro index 19d74dfd9b..a79fa2f59d 100644 --- a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro +++ b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro @@ -5,10 +5,4 @@ SOURCES += tst_qhostaddress.cpp QT = core network testlib -win32: { -wince { - LIBS += -lws2 -} else { - LIBS += -lws2_32 -} -} +win32:LIBS += -lws2_32 diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index 4fb97fe1f2..419c781aab 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -62,6 +62,8 @@ private slots: void specialAddresses(); void compare_data(); void compare(); + void isEqual_data(); + void isEqual(); void assignment(); void scopeId(); void hashKey(); @@ -291,6 +293,7 @@ void tst_QHostAddress::compare_data() QTest::newRow("5") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::Broadcast) << false; QTest::newRow("6") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << false; QTest::newRow("7") << QHostAddress() << QHostAddress(QHostAddress::LocalHostIPv6) << false; + QTest::newRow("any4-any6") << QHostAddress(QHostAddress::AnyIPv4) << QHostAddress(QHostAddress::AnyIPv6) << false; Q_IPV6ADDR localhostv4mapped = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1 } }; QTest::newRow("v4-v4mapped") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("::ffff:127.0.0.1") << false; @@ -309,6 +312,53 @@ void tst_QHostAddress::compare() QCOMPARE(qHash(first), qHash(second)); } +void tst_QHostAddress::isEqual_data() +{ + QTest::addColumn<QHostAddress>("first"); + QTest::addColumn<QHostAddress>("second"); + QTest::addColumn<int>("flags"); + QTest::addColumn<bool>("result"); + + // QHostAddress::StrictConversion is already tested in compare() + QTest::newRow("localhost4to6-local") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertLocalHost << true; + QTest::newRow("localhost4to6-compat") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4CompatToIPv4 << false; + QTest::newRow("localhost4to6-mapped") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4MappedToIPv4 << false; + QTest::newRow("localhost4to6-unspec") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertUnspecifiedAddress << false; + QTest::newRow("0.0.0.1-::1-local") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertLocalHost << false; + QTest::newRow("v4-v4compat-local") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertLocalHost << false; + QTest::newRow("v4-v4mapped-local") << QHostAddress("192.168.1.1") << QHostAddress("::ffff:192.168.1.1") << (int)QHostAddress::ConvertLocalHost << false; + QTest::newRow("0.0.0.1-::1-unspec") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertUnspecifiedAddress << false; + QTest::newRow("v4-v4compat-unspec") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertUnspecifiedAddress << false; + QTest::newRow("v4-v4mapped-unspec") << QHostAddress("192.168.1.1") << QHostAddress("::ffff:192.168.1.1") << (int)QHostAddress::ConvertUnspecifiedAddress << false; + QTest::newRow("0.0.0.1-::1-compat") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4CompatToIPv4 << false; + QTest::newRow("v4-v4compat-compat") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertV4CompatToIPv4 << true; + QTest::newRow("v4-v4mapped-compat") << QHostAddress("192.168.1.1") << QHostAddress("::ffff:192.168.1.1") << (int)QHostAddress::ConvertV4CompatToIPv4 << false; + QTest::newRow("0.0.0.1-::1-mapped") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4MappedToIPv4 << false; + QTest::newRow("v4-v4compat-mapped") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertV4MappedToIPv4 << false; + QTest::newRow("v4-v4mapped-mapped") << QHostAddress("192.168.1.1") << QHostAddress("::FFFF:192.168.1.1") << (int)QHostAddress::ConvertV4MappedToIPv4 << true; + QTest::newRow("undef-any-local") << QHostAddress() << QHostAddress(QHostAddress::Any) << (int)QHostAddress::ConvertLocalHost << false; + QTest::newRow("undef-any-unspec") << QHostAddress() << QHostAddress(QHostAddress::Any) << (int)QHostAddress::ConvertUnspecifiedAddress << false; + QTest::newRow("anyv6-anyv4-compat") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertV4CompatToIPv4 << true; + QTest::newRow("anyv6-anyv4-mapped") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertV4MappedToIPv4 << false; + QTest::newRow("anyv6-anyv4-unspec") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertUnspecifiedAddress << true; + QTest::newRow("any-anyv4-unspec") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertUnspecifiedAddress << true; + QTest::newRow("any-anyv6-unspec") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv6) << (int)QHostAddress::ConvertUnspecifiedAddress << true; + QTest::newRow("anyv6-anyv4-local") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertLocalHost << false; + QTest::newRow("any-anyv4-local") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertLocalHost << false; + QTest::newRow("any-anyv6-local") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv6) << (int)QHostAddress::ConvertLocalHost << false; +} + +void tst_QHostAddress::isEqual() +{ + QFETCH(QHostAddress, first); + QFETCH(QHostAddress, second); + QFETCH(int, flags); + QFETCH(bool, result); + + QCOMPARE(first.isEqual(second, QHostAddress::ConversionModeFlag(flags)), result); + QCOMPARE(second.isEqual(first, QHostAddress::ConversionModeFlag(flags)), result); +} + void tst_QHostAddress::assignment() { QHostAddress address; diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro index 12858c97ee..4ea415c529 100644 --- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro @@ -6,11 +6,7 @@ SOURCES += tst_qhostinfo.cpp requires(contains(QT_CONFIG,private_tests)) QT = core-private network-private testlib -wince { - LIBS += ws2.lib -} else { - win32:LIBS += -lws2_32 -} +win32:LIBS += -lws2_32 # needed for getaddrinfo with official MinGW mingw:DEFINES += _WIN32_WINNT=0x0501 diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 13d4442ada..f6d9b71aa2 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -66,11 +66,7 @@ #include "private/qhostinfo_p.h" #if !defined(QT_NO_GETADDRINFO) -# if !defined(Q_OS_WINCE) # include <sys/types.h> -# else -# include <types.h> -# endif # if defined(Q_OS_UNIX) # include <sys/socket.h> # endif @@ -399,11 +395,7 @@ protected: void tst_QHostInfo::threadSafety() { const int nattempts = 5; -#if defined(Q_OS_WINCE) - const int runs = 10; -#else const int runs = 100; -#endif LookupThread thr[nattempts]; for (int j = 0; j < runs; ++j) { for (int i = 0; i < nattempts; ++i) diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri index a3b4e89450..6c7857ea1d 100644 --- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri +++ b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri @@ -4,13 +4,7 @@ QNETWORK_SRC = $$QT_SOURCE_TREE/src/network INCLUDEPATH += $$QNETWORK_SRC -win32 { - wince { - LIBS += -lws2 - } else { - LIBS += -lws2_32 - } -} +win32:LIBS += -lws2_32 unix:contains(QT_CONFIG, reduce_exports) { SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine_unix.cpp diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 041a0ce16c..d159d6d683 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -494,9 +494,6 @@ void tst_PlatformSocketEngine::readWriteBufferSize() qint64 bufferSize = device.receiveBufferSize(); QVERIFY(bufferSize != -1); device.setReceiveBufferSize(bufferSize + 1); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL(0, "Not supported by default on WinCE", Continue); -#endif QVERIFY(device.receiveBufferSize() > bufferSize); bufferSize = device.sendBufferSize(); @@ -649,7 +646,7 @@ void tst_PlatformSocketEngine::receiveUrgentData() QByteArray response; // Native OOB data test doesn't work on HP-UX or WinCE -#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) // The server sends an urgent message msg = 'Q'; QCOMPARE(int(::send(socketDescriptor, &msg, sizeof(msg), MSG_OOB)), 1); diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index 7237542e5c..68f3ea059b 100644 --- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -626,11 +626,7 @@ void tst_QHttpSocketEngine::downloadBigFile() QTime stopWatch; stopWatch.start(); -#if defined(Q_OS_WINCE) - QTestEventLoop::instance().enterLoop(240); -#else QTestEventLoop::instance().enterLoop(60); -#endif if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); diff --git a/tests/auto/network/socket/qlocalsocket/test/test.pro b/tests/auto/network/socket/qlocalsocket/test/test.pro index 6a5df7f9b6..ab9ed90b1d 100644 --- a/tests/auto/network/socket/qlocalsocket/test/test.pro +++ b/tests/auto/network/socket/qlocalsocket/test/test.pro @@ -2,13 +2,7 @@ CONFIG += testcase DEFINES += QLOCALSERVER_DEBUG DEFINES += QLOCALSOCKET_DEBUG - -wince* { - DEFINES += QT_LOCALSOCKET_TCP - DEFINES += SRCDIR=\\\"../\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/../\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/../\\\" QT = core network testlib diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index d0baa62e29..3112d7d62b 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -759,10 +759,8 @@ void tst_QLocalSocket::threadedConnection_data() QTest::newRow("1 client") << 1; QTest::newRow("2 clients") << 2; QTest::newRow("5 clients") << 5; -#ifndef Q_OS_WINCE QTest::newRow("10 clients") << 10; QTest::newRow("20 clients") << 20; -#endif } void tst_QLocalSocket::threadedConnection() diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index b4955df107..c945d77cda 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -785,11 +785,7 @@ void tst_QSocks5SocketEngine::downloadBigFile() QTime stopWatch; stopWatch.start(); -#if !defined(Q_OS_WINCE) QTestEventLoop::instance().enterLoop(60); -#else - QTestEventLoop::instance().enterLoop(180); -#endif if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); diff --git a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp index 8408e703c0..15e9228a04 100644 --- a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp +++ b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp @@ -40,16 +40,8 @@ int main(int argc, char *argv[]) return 1; } -#if defined(Q_OS_WINCE) - QFile file(QLatin1String("/test_signal.txt")); - file.open(QIODevice::WriteOnly); - file.write("Listening\n"); - file.flush(); - file.close(); -#else printf("Listening\n"); fflush(stdout); -#endif server.waitForNewConnection(5000); qFatal("Crash"); diff --git a/tests/auto/network/socket/qtcpserver/test/test.pro b/tests/auto/network/socket/qtcpserver/test/test.pro index f0abfbc085..4491523383 100644 --- a/tests/auto/network/socket/qtcpserver/test/test.pro +++ b/tests/auto/network/socket/qtcpserver/test/test.pro @@ -1,16 +1,7 @@ CONFIG += testcase SOURCES += ../tst_qtcpserver.cpp -win32: { -wince { - LIBS += -lws2 - crashApp.files = ../crashingServer/crashingServer.exe - crashApp.path = crashingServer - DEPLOYMENT += crashApp -} else { - LIBS += -lws2_32 -} -} +win32:LIBS += -lws2_32 TARGET = ../tst_qtcpserver diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 30aab3bf34..5a0baf73b5 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -106,6 +106,8 @@ private slots: void eagainBlockingAccept(); + void canAccessPendingConnectionsWhileNotListening(); + private: #ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; @@ -467,11 +469,7 @@ void tst_QTcpServer::waitForConnectionTest() ThreadConnector connector(findLocalIpSocket.localAddress(), server.serverPort()); connector.start(); -#if defined(Q_OS_WINCE) - QVERIFY(server.waitForNewConnection(9000, &timeout)); -#else QVERIFY(server.waitForNewConnection(3000, &timeout)); -#endif QVERIFY(!timeout); } @@ -562,21 +560,6 @@ void tst_QTcpServer::addressReusable() QSKIP("No proxy support"); #endif // QT_NO_NETWORKPROXY } -#if defined(Q_OS_WINCE) - QString signalName = QString::fromLatin1("/test_signal.txt"); - QFile::remove(signalName); - // The crashingServer process will crash once it gets a connection. - QProcess process; - QString processExe = crashingServerDir + "/crashingServer"; - process.start(processExe); - QVERIFY2(process.waitForStarted(), qPrintable( - QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString()))); - int waitCount = 5; - while (waitCount-- && !QFile::exists(signalName)) - QTest::qWait(1000); - QVERIFY(QFile::exists(signalName)); - QFile::remove(signalName); -#else // The crashingServer process will crash once it gets a connection. QProcess process; QString processExe = crashingServerDir + "/crashingServer"; @@ -584,7 +567,6 @@ void tst_QTcpServer::addressReusable() QVERIFY2(process.waitForStarted(), qPrintable( QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString()))); QVERIFY(process.waitForReadyRead(5000)); -#endif QTcpSocket socket; socket.connectToHost(QHostAddress::LocalHost, 49199); @@ -990,5 +972,22 @@ void tst_QTcpServer::eagainBlockingAccept() server.close(); } +class NonListeningTcpServer : public QTcpServer +{ +public: + void addSocketFromOutside(QTcpSocket* s) + { + addPendingConnection(s); + } +}; + +void tst_QTcpServer::canAccessPendingConnectionsWhileNotListening() +{ + NonListeningTcpServer server; + QTcpSocket socket; + server.addSocketFromOutside(&socket); + QCOMPARE(&socket, server.nextPendingConnection()); +} + QTEST_MAIN(tst_QTcpServer) #include "tst_qtcpserver.moc" diff --git a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro index fe6042b8a7..5686f4a697 100644 --- a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs SUBDIRS = test -!wince:!vxworks: SUBDIRS += stressTest +!vxworks: SUBDIRS += stressTest requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/socket/qtcpsocket/test/test.pro b/tests/auto/network/socket/qtcpsocket/test/test.pro index 325abcaab8..2dc1490256 100644 --- a/tests/auto/network/socket/qtcpsocket/test/test.pro +++ b/tests/auto/network/socket/qtcpsocket/test/test.pro @@ -2,13 +2,7 @@ CONFIG += testcase QT = core-private network-private testlib SOURCES += ../tst_qtcpsocket.cpp -win32: { -wince { - LIBS += -lws2 -} else { - LIBS += -lws2_32 -} -} +win32:LIBS += -lws2_32 TARGET = tst_qtcpsocket diff --git a/tests/auto/network/socket/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro index 8ad16c652d..efa50b21b4 100644 --- a/tests/auto/network/socket/qudpsocket/test/test.pro +++ b/tests/auto/network/socket/qudpsocket/test/test.pro @@ -15,12 +15,6 @@ win32 { DESTDIR = ../ } -wince* { - addApp.files = ../clientserver/clientserver.exe - addApp.path = clientserver - DEPLOYMENT += addApp -} - TARGET = tst_qudpsocket CONFIG+=insignificant_test # QTBUG-25367, QTBUG-25368 diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 8a0784f4e5..8c9d0d1b9f 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -434,13 +434,8 @@ void tst_QUdpSocket::ipv6Loop() char peterBuffer[16*1024]; char paulBuffer[16*1024]; -#if !defined(Q_OS_WINCE) - QVERIFY(peter.waitForReadyRead(5000)); - QVERIFY(paul.waitForReadyRead(5000)); -#else - QVERIFY(peter.waitForReadyRead(15000)); - QVERIFY(paul.waitForReadyRead(15000)); -#endif + QVERIFY(peter.waitForReadyRead(5000)); + QVERIFY(paul.waitForReadyRead(5000)); if (success) { QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length())); QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length())); @@ -937,9 +932,6 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() #ifdef QT_NO_PROCESS QSKIP("No qprocess support", SkipAll); #else -#if defined(Q_OS_WINCE) - QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); -#endif QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); @@ -1001,9 +993,6 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() #ifdef QT_NO_PROCESS QSKIP("No qprocess support", SkipAll); #else -#if defined(Q_OS_WINCE) - QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); -#endif QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); diff --git a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro index 87a210c051..7c1cd5b66b 100644 --- a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro +++ b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslcertificate.cpp -!wince:win32:LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslcertificate diff --git a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro index 4cb2dfebab..81ef2d8d9a 100644 --- a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro +++ b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslcipher.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslcipher diff --git a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro index e67b64b2b7..a180086c5e 100644 --- a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro +++ b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslellipticcurve.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslellipticcurve diff --git a/tests/auto/network/ssl/qsslerror/qsslerror.pro b/tests/auto/network/ssl/qsslerror/qsslerror.pro index 7737aae3f1..117fd4ac27 100644 --- a/tests/auto/network/ssl/qsslerror/qsslerror.pro +++ b/tests/auto/network/ssl/qsslerror/qsslerror.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslerror.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslerror diff --git a/tests/auto/network/ssl/qsslkey/qsslkey.pro b/tests/auto/network/ssl/qsslkey/qsslkey.pro index 7eb04793f3..52377a9005 100644 --- a/tests/auto/network/ssl/qsslkey/qsslkey.pro +++ b/tests/auto/network/ssl/qsslkey/qsslkey.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslkey.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib contains(QT_CONFIG, private_tests) { QT += core-private network-private diff --git a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro index de2be8e126..9a525408fd 100644 --- a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro +++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslsocket.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core core-private network-private testlib TARGET = tst_qsslsocket @@ -20,14 +20,6 @@ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { LIBS += $$OPENSSL_LIBS } -wince* { - DEFINES += SRCDIR=\\\"./\\\" - - certFiles.files = certs ssl.tar.gz - certFiles.path = . - DEPLOYMENT += certFiles -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index f8c5b8b67b..f1d66be442 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -229,6 +229,8 @@ private slots: void simplePskConnect(); void ephemeralServerKey_data(); void ephemeralServerKey(); + void allowedProtocolNegotiation(); + void pskServer(); #endif static void exitLoop() @@ -3035,8 +3037,12 @@ class PskProvider : public QObject Q_OBJECT public: + bool m_server; + QByteArray m_identity; + QByteArray m_psk; + explicit PskProvider(QObject *parent = 0) - : QObject(parent) + : QObject(parent), m_server(false) { } @@ -3055,7 +3061,11 @@ public slots: { QVERIFY(authenticator); QCOMPARE(authenticator->identityHint(), PSK_SERVER_IDENTITY_HINT); - QVERIFY(authenticator->maximumIdentityLength() > 0); + if (m_server) + QCOMPARE(authenticator->maximumIdentityLength(), 0); + else + QVERIFY(authenticator->maximumIdentityLength() > 0); + QVERIFY(authenticator->maximumPreSharedKeyLength() > 0); if (!m_identity.isEmpty()) { @@ -3068,12 +3078,61 @@ public slots: QCOMPARE(authenticator->preSharedKey(), m_psk); } } - -private: - QByteArray m_identity; - QByteArray m_psk; }; +class PskServer : public QTcpServer +{ + Q_OBJECT +public: + PskServer() + : socket(0), + config(QSslConfiguration::defaultConfiguration()), + ignoreSslErrors(true), + peerVerifyMode(QSslSocket::AutoVerifyPeer), + protocol(QSsl::TlsV1_0), + m_pskProvider() + { + m_pskProvider.m_server = true; + } + QSslSocket *socket; + QSslConfiguration config; + bool ignoreSslErrors; + QSslSocket::PeerVerifyMode peerVerifyMode; + QSsl::SslProtocol protocol; + QString ciphers; + PskProvider m_pskProvider; + +protected: + void incomingConnection(qintptr socketDescriptor) + { + socket = new QSslSocket(this); + socket->setSslConfiguration(config); + socket->setPeerVerifyMode(peerVerifyMode); + socket->setProtocol(protocol); + if (ignoreSslErrors) + connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); + + if (!ciphers.isEmpty()) { + socket->setCiphers(ciphers); + } + + QVERIFY(socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState)); + QVERIFY(!socket->peerAddress().isNull()); + QVERIFY(socket->peerPort() != 0); + QVERIFY(!socket->localAddress().isNull()); + QVERIFY(socket->localPort() != 0); + + connect(socket, &QSslSocket::preSharedKeyAuthenticationRequired, &m_pskProvider, &PskProvider::providePsk); + + socket->startServerEncryption(); + } + +protected slots: + void ignoreErrorSlot() + { + socket->ignoreSslErrors(); + } +}; void tst_QSslSocket::simplePskConnect_data() { QTest::addColumn<PskConnectTestType>("pskTestType"); @@ -3375,6 +3434,129 @@ void tst_QSslSocket::ephemeralServerKey() QCOMPARE(client->sslConfiguration().ephemeralServerKey().isNull(), emptyKey); } +void tst_QSslSocket::allowedProtocolNegotiation() +{ +#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) + + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + const QByteArray expectedNegotiated("cool-protocol"); + QList<QByteArray> serverProtos; + serverProtos << expectedNegotiated << "not-so-cool-protocol"; + QList<QByteArray> clientProtos; + clientProtos << "uber-cool-protocol" << expectedNegotiated << "not-so-cool-protocol"; + + + SslServer server; + server.config.setAllowedNextProtocols(serverProtos); + QVERIFY(server.listen()); + + QSslSocket clientSocket; + auto configuration = clientSocket.sslConfiguration(); + configuration.setAllowedNextProtocols(clientProtos); + clientSocket.setSslConfiguration(configuration); + + clientSocket.connectToHostEncrypted("127.0.0.1", server.serverPort()); + clientSocket.ignoreSslErrors(); + + QEventLoop loop; + QTimer::singleShot(5000, &loop, SLOT(quit())); + connect(&clientSocket, SIGNAL(encrypted()), &loop, SLOT(quit())); + loop.exec(); + + QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == + clientSocket.sslConfiguration().nextNegotiatedProtocol()); + QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated); + +#endif // OPENSSL_VERSION_NUMBER +} + +void tst_QSslSocket::pskServer() +{ + QFETCH_GLOBAL(bool, setProxy); + if (!QSslSocket::supportsSsl() || setProxy) + return; + + QSslSocket socket; + this->socket = &socket; + + QSignalSpy connectedSpy(&socket, SIGNAL(connected())); + QVERIFY(connectedSpy.isValid()); + + QSignalSpy disconnectedSpy(&socket, SIGNAL(disconnected())); + QVERIFY(disconnectedSpy.isValid()); + + QSignalSpy connectionEncryptedSpy(&socket, SIGNAL(encrypted())); + QVERIFY(connectionEncryptedSpy.isValid()); + + QSignalSpy pskAuthenticationRequiredSpy(&socket, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*))); + QVERIFY(pskAuthenticationRequiredSpy.isValid()); + + connect(&socket, SIGNAL(connected()), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(disconnected()), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop())); + connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop())); + + // force a PSK cipher w/o auth + socket.setCiphers(PSK_CIPHER_WITHOUT_AUTH); + + PskProvider provider; + provider.setIdentity(PSK_CLIENT_IDENTITY); + provider.setPreSharedKey(PSK_CLIENT_PRESHAREDKEY); + connect(&socket, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), &provider, SLOT(providePsk(QSslPreSharedKeyAuthenticator*))); + socket.setPeerVerifyMode(QSslSocket::VerifyNone); + + PskServer server; + server.m_pskProvider.setIdentity(provider.m_identity); + server.m_pskProvider.setPreSharedKey(provider.m_psk); + server.config.setPreSharedKeyIdentityHint(PSK_SERVER_IDENTITY_HINT); + QVERIFY(server.listen()); + + // Start connecting + socket.connectToHost(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort()); + enterLoop(5); + + // Entered connected state + QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); + QCOMPARE(socket.mode(), QSslSocket::UnencryptedMode); + QVERIFY(!socket.isEncrypted()); + QCOMPARE(connectedSpy.count(), 1); + QCOMPARE(disconnectedSpy.count(), 0); + + // Enter encrypted mode + socket.startClientEncryption(); + QCOMPARE(socket.mode(), QSslSocket::SslClientMode); + QVERIFY(!socket.isEncrypted()); + QCOMPARE(connectionEncryptedSpy.count(), 0); + + // Start handshake. + enterLoop(10); + + // We must get the PSK signal in all cases + QCOMPARE(pskAuthenticationRequiredSpy.count(), 1); + + QCOMPARE(connectionEncryptedSpy.count(), 1); + QVERIFY(socket.isEncrypted()); + QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); + + // check writing + socket.write("Hello from Qt TLS/PSK!"); + QVERIFY(socket.waitForBytesWritten()); + + // disconnect + socket.disconnectFromHost(); + enterLoop(10); + + QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState); + QCOMPARE(disconnectedSpy.count(), 1); +} + #endif // QT_NO_OPENSSL #endif // QT_NO_SSL diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro index ae911e43ed..4ea878f840 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro @@ -2,7 +2,7 @@ CONFIG += testcase testcase.timeout = 300 # this test is slow SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core core-private network-private testlib TARGET = tst_qsslsocket_onDemandCertificates_member @@ -15,10 +15,6 @@ win32 { } } -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro index 25e5a5d5c7..d69ea7fb3d 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core core-private network-private testlib TARGET = tst_qsslsocket_onDemandCertificates_static @@ -14,10 +14,6 @@ win32 { } } -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 7380398071..22c2e1fbc7 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -281,9 +281,6 @@ void tst_languageChange::retranslatability() fooFile.write("test"); fooFile.close(); dlg.setDirectory(temporaryDir.path()); -#ifdef Q_OS_WINCE - dlg.setDirectory("\\Windows"); -#endif dlg.setFileMode(QFileDialog::ExistingFiles); dlg.setViewMode(QFileDialog::Detail); stateMachine.start(); @@ -295,13 +292,8 @@ void tst_languageChange::retranslatability() // In case we use a Color dialog, we do not want to test for // strings non existing in the dialog and which do not get // translated. - if ((dialogType == ColorDialog) && -#ifndef Q_OS_WINCE - (qApp->desktop()->width() < 480 || qApp->desktop()->height() < 350) -#else - true // On Qt/WinCE we always use compact mode -#endif - ) { + const QSize desktopSize = QApplication::desktop()->size(); + if (dialogType == ColorDialog && (desktopSize.width() < 480 || desktopSize.height() < 350)) { expected.remove("QColorDialog::&Basic colors"); expected.remove("QColorDialog::&Custom colors"); expected.remove("QColorDialog::&Define Custom Colors >>"); diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 0e9f054a01..3b264e6b72 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -21,7 +21,6 @@ SUBDIRS=\ qsharedpointer_and_qwidget \ qprocess_and_guieventloop \ qtokenautomaton \ - windowsmobile \ toolsupport \ !qtHaveModule(gui): SUBDIRS -= \ @@ -52,7 +51,7 @@ cross_compile: SUBDIRS -= \ atwrapper \ compiler -wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility +!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility !contains(QT_CONFIG, accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux @@ -62,7 +61,7 @@ wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility macplist \ qaccessibilitymac -!embedded|wince: SUBDIRS -= \ +!embedded: SUBDIRS -= \ qdirectpainter winrt: SUBDIRS -= \ diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 7b3173798d..f697aee38f 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -7,12 +7,6 @@ HEADERS += accessiblewidgets.h unix:!darwin:!haiku:!integity: LIBS += -lm -wince { - accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll - accessneeded.path = accessible - DEPLOYMENT += accessneeded -} - win32 { !*g++:!winrt { include(../../../../src/3rdparty/iaccessible2/iaccessible2.pri) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 99e3fc5bf2..2f5936f1ad 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -68,20 +68,6 @@ static inline void setFrameless(QWidget *w) w->setWindowFlags(flags); } -#if defined(Q_OS_WINCE) -extern "C" bool SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni); -#define SPI_GETPLATFORMTYPE 257 -inline bool IsValidCEPlatform() { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(*tszPlatform), tszPlatform, 0)) { - QString platform = QString::fromWCharArray(tszPlatform); - if ((platform == QLatin1String("PocketPC")) || (platform == QLatin1String("Smartphone"))) - return false; - } - return true; -} -#endif - static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface, int index, const QRect &domain) { @@ -1315,6 +1301,16 @@ void tst_QAccessibility::tabTest() child2->actionInterface()->doAction(QAccessibleActionInterface::pressAction()); QCOMPARE(tabBar->currentIndex(), 1); + // Test that setAccessibleTabName changes a tab's accessible name + tabBar->setAccessibleTabName(0, "AccFoo"); + tabBar->setAccessibleTabName(1, "AccBar"); + QCOMPARE(child1->text(QAccessible::Name), QLatin1String("AccFoo")); + QCOMPARE(child2->text(QAccessible::Name), QLatin1String("AccBar")); + tabBar->setCurrentIndex(0); + QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccFoo")); + tabBar->setCurrentIndex(1); + QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccBar")); + delete tabBar; QTestAccessibility::clearEvents(); } @@ -1352,10 +1348,17 @@ void tst_QAccessibility::tabWidgetTest() QCOMPARE(tabButton1Interface->text(QAccessible::Name), QLatin1String("Tab 1")); QAccessibleInterface* tabButton2Interface = tabBarInterface->child(1); - QVERIFY(tabButton1Interface); + QVERIFY(tabButton2Interface); QCOMPARE(tabButton2Interface->role(), QAccessible::PageTab); QCOMPARE(tabButton2Interface->text(QAccessible::Name), QLatin1String("Tab 2")); + // Test that setAccessibleTabName changes a tab's accessible name + tabWidget->setCurrentIndex(0); + tabWidget->tabBar()->setAccessibleTabName(0, "Acc Tab"); + QCOMPARE(tabButton1Interface->role(), QAccessible::PageTab); + QCOMPARE(tabButton1Interface->text(QAccessible::Name), QLatin1String("Acc Tab")); + QCOMPARE(tabBarInterface->text(QAccessible::Name), QLatin1String("Acc Tab")); + QAccessibleInterface* tabButtonLeft = tabBarInterface->child(2); QVERIFY(tabButtonLeft); QCOMPARE(tabButtonLeft->role(), QAccessible::PushButton); @@ -1469,10 +1472,6 @@ void tst_QAccessibility::menuTest() QCOMPARE(iHelp->role(), QAccessible::MenuItem); QCOMPARE(iAction->role(), QAccessible::MenuItem); #ifndef Q_OS_MAC -#ifdef Q_OS_WINCE - if (!IsValidCEPlatform()) - QSKIP("Tests do not work on Mobile platforms due to native menus"); -#endif QCOMPARE(mw.mapFromGlobal(interface->rect().topLeft()), mw.menuBar()->geometry().topLeft()); QCOMPARE(interface->rect().size(), mw.menuBar()->size()); @@ -3561,10 +3560,6 @@ void tst_QAccessibility::dockWidgetTest() void tst_QAccessibility::comboBoxTest() { -#if defined(Q_OS_WINCE) - if (!IsValidCEPlatform()) - QSKIP("Test skipped on Windows Mobile test hardware"); -#endif { // not editable combobox QComboBox combo; combo.addItems(QStringList() << "one" << "two" << "three"); diff --git a/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp index cb69c80f37..b32b1226b2 100644 --- a/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp +++ b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp @@ -34,7 +34,7 @@ QT_BEGIN_NAMESPACE Basic::Token Basic::classifier3(const QChar *data) { - if (data[0] == 100) + if (data[0].unicode() == 100) { @@ -50,7 +50,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[0] == 97) + else if (data[0].unicode() == 97) { @@ -66,7 +66,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[0] == 103) + else if (data[0].unicode() == 103) { @@ -89,19 +89,19 @@ Basic::Token Basic::classifier3(const QChar *data) Basic::Token Basic::classifier4(const QChar *data) { - if (data[0] == 70) + if (data[0].unicode() == 70) { - if (data[1] == 70) + if (data[1].unicode() == 70) { - if (data[2] == 70) + if (data[2].unicode() == 70) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -111,7 +111,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -124,11 +124,11 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[2] == 71) + else if (data[2].unicode() == 71) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -138,7 +138,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -151,12 +151,12 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[2] == 76) + else if (data[2].unicode() == 76) { - if(data[3] == 77) + if (data[3].unicode() == 77) return FFLM; @@ -192,7 +192,7 @@ Basic::Token Basic::classifier3(const QChar *data) Basic::Token Basic::classifier14(const QChar *data) { - if (data[0] == 119) + if (data[0].unicode() == 119) { @@ -208,7 +208,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[0] == 99) + else if (data[0].unicode() == 99) { diff --git a/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp index 59164ea3f4..dace6be146 100644 --- a/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp +++ b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp @@ -36,7 +36,7 @@ using namespace BasicNamespace; Basic::Token Basic::classifier3(const QChar *data) { - if (data[0] == 100) + if (data[0].unicode() == 100) { @@ -52,7 +52,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[0] == 97) + else if (data[0].unicode() == 97) { @@ -68,7 +68,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[0] == 103) + else if (data[0].unicode() == 103) { @@ -91,19 +91,19 @@ Basic::Token Basic::classifier3(const QChar *data) Basic::Token Basic::classifier4(const QChar *data) { - if (data[0] == 70) + if (data[0].unicode() == 70) { - if (data[1] == 70) + if (data[1].unicode() == 70) { - if (data[2] == 70) + if (data[2].unicode() == 70) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -113,7 +113,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -126,11 +126,11 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[2] == 71) + else if (data[2].unicode() == 71) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -140,7 +140,7 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -153,12 +153,12 @@ Basic::Token Basic::classifier3(const QChar *data) } - else if (data[2] == 76) + else if (data[2].unicode() == 76) { - if(data[3] == 77) + if (data[3].unicode() == 77) return FFLM; diff --git a/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp index d005b64b8d..c24900eed0 100644 --- a/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp +++ b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp @@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE Boilerplate::Token Boilerplate::classifier3(const QChar *data) { - if (data[0] == 100) + if (data[0].unicode() == 100) { @@ -52,7 +52,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) } - else if (data[0] == 97) + else if (data[0].unicode() == 97) { @@ -68,7 +68,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) } - else if (data[0] == 103) + else if (data[0].unicode() == 103) { @@ -91,19 +91,19 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) Boilerplate::Token Boilerplate::classifier4(const QChar *data) { - if (data[0] == 70) + if (data[0].unicode() == 70) { - if (data[1] == 70) + if (data[1].unicode() == 70) { - if (data[2] == 70) + if (data[2].unicode() == 70) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -113,7 +113,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -126,11 +126,11 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) } - else if (data[2] == 71) + else if (data[2].unicode() == 71) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -140,7 +140,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -153,12 +153,12 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data) } - else if (data[2] == 76) + else if (data[2].unicode() == 76) { - if(data[3] == 77) + if (data[3].unicode() == 77) return FFLM; diff --git a/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp index 87632d83ff..879f55fa32 100644 --- a/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp +++ b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp @@ -34,7 +34,7 @@ QT_BEGIN_NAMESPACE NoNamespace::Token NoNamespace::classifier3(const QChar *data) { - if (data[0] == 100) + if (data[0].unicode() == 100) { @@ -50,7 +50,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[0] == 97) + else if (data[0].unicode() == 97) { @@ -66,7 +66,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[0] == 103) + else if (data[0].unicode() == 103) { @@ -89,19 +89,19 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) NoNamespace::Token NoNamespace::classifier4(const QChar *data) { - if (data[0] == 70) + if (data[0].unicode() == 70) { - if (data[1] == 70) + if (data[1].unicode() == 70) { - if (data[2] == 70) + if (data[2].unicode() == 70) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -111,7 +111,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -124,11 +124,11 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[2] == 71) + else if (data[2].unicode() == 71) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -138,7 +138,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -151,12 +151,12 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[2] == 76) + else if (data[2].unicode() == 76) { - if(data[3] == 77) + if (data[3].unicode() == 77) return FFLM; @@ -176,7 +176,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) NoNamespace::Token NoNamespace::classifier14(const QChar *data) { - if (data[0] == 119) + if (data[0].unicode() == 119) { @@ -192,7 +192,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data) } - else if (data[0] == 99) + else if (data[0].unicode() == 99) { diff --git a/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp index 68bd051afb..5be9b3879f 100644 --- a/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp +++ b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp @@ -36,7 +36,7 @@ using namespace NoToStringNS; NoToString::Token NoToString::classifier3(const QChar *data) { - if (data[0] == 100) + if (data[0].unicode() == 100) { @@ -52,7 +52,7 @@ NoToString::Token NoToString::classifier3(const QChar *data) } - else if (data[0] == 97) + else if (data[0].unicode() == 97) { @@ -68,7 +68,7 @@ NoToString::Token NoToString::classifier3(const QChar *data) } - else if (data[0] == 103) + else if (data[0].unicode() == 103) { @@ -91,19 +91,19 @@ NoToString::Token NoToString::classifier3(const QChar *data) NoToString::Token NoToString::classifier4(const QChar *data) { - if (data[0] == 70) + if (data[0].unicode() == 70) { - if (data[1] == 70) + if (data[1].unicode() == 70) { - if (data[2] == 70) + if (data[2].unicode() == 70) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -113,7 +113,7 @@ NoToString::Token NoToString::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -126,11 +126,11 @@ NoToString::Token NoToString::classifier3(const QChar *data) } - else if (data[2] == 71) + else if (data[2].unicode() == 71) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -140,7 +140,7 @@ NoToString::Token NoToString::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -153,12 +153,12 @@ NoToString::Token NoToString::classifier3(const QChar *data) } - else if (data[2] == 76) + else if (data[2].unicode() == 76) { - if(data[3] == 77) + if (data[3].unicode() == 77) return FFLM; diff --git a/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp index 0a452c5757..69c6de2f39 100644 --- a/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp +++ b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp @@ -36,7 +36,7 @@ using namespace TheNamespace; WithNamespace::Token WithNamespace::classifier3(const QChar *data) { - if (data[0] == 100) + if (data[0].unicode() == 100) { @@ -52,7 +52,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[0] == 97) + else if (data[0].unicode() == 97) { @@ -68,7 +68,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[0] == 103) + else if (data[0].unicode() == 103) { @@ -91,19 +91,19 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) WithNamespace::Token WithNamespace::classifier4(const QChar *data) { - if (data[0] == 70) + if (data[0].unicode() == 70) { - if (data[1] == 70) + if (data[1].unicode() == 70) { - if (data[2] == 70) + if (data[2].unicode() == 70) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -113,7 +113,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -126,11 +126,11 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[2] == 71) + else if (data[2].unicode() == 71) { - if (data[3] == 70) + if (data[3].unicode() == 70) { @@ -140,7 +140,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[3] == 71) + else if (data[3].unicode() == 71) { @@ -153,12 +153,12 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[2] == 76) + else if (data[2].unicode() == 76) { - if(data[3] == 77) + if (data[3].unicode() == 77) return FFLM; @@ -178,7 +178,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) WithNamespace::Token WithNamespace::classifier14(const QChar *data) { - if (data[0] == 119) + if (data[0].unicode() == 119) { @@ -194,7 +194,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data) } - else if (data[0] == 99) + else if (data[0].unicode() == 99) { diff --git a/tests/auto/other/windowsmobile/test/ddhelper.cpp b/tests/auto/other/windowsmobile/test/ddhelper.cpp deleted file mode 100644 index 3ce99a0ded..0000000000 --- a/tests/auto/other/windowsmobile/test/ddhelper.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifdef Q_OS_WINCE_WM - -#include <Ddraw.h> -#include <QDebug> - -static LPDIRECTDRAW g_pDD = NULL; // DirectDraw object -static LPDIRECTDRAWSURFACE g_pDDSSurface = NULL; // DirectDraw primary surface - -static DDSCAPS ddsCaps; -static DDSURFACEDESC ddsSurfaceDesc; -static void *buffer = NULL; - -static int width = 0; -static int height = 0; -static int pitch = 0; -static int bitCount = 0; -static int windowId = 0; - -static bool initialized = false; -static bool locked = false; - -void q_lock() -{ - if (locked) { - qWarning("Direct Painter already locked (QDirectPainter::lock())"); - return; - } - locked = true; - - - memset(&ddsSurfaceDesc, 0, sizeof(ddsSurfaceDesc)); - ddsSurfaceDesc.dwSize = sizeof(ddsSurfaceDesc); - - HRESULT h = g_pDDSSurface->Lock(0, &ddsSurfaceDesc, DDLOCK_WRITEONLY, 0); - if (h != DD_OK) - qDebug() << "GetSurfaceDesc failed!"; - - width = ddsSurfaceDesc.dwWidth; - height = ddsSurfaceDesc.dwHeight; - bitCount = ddsSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; - pitch = ddsSurfaceDesc.lPitch; - buffer = ddsSurfaceDesc.lpSurface; -} - -void q_unlock() -{ - if( !locked) { - qWarning("Direct Painter not locked (QDirectPainter::unlock()"); - return; - } - g_pDDSSurface->Unlock(0); - locked = false; -} - -void q_initDD() -{ - if (initialized) - return; - - DirectDrawCreate(NULL, &g_pDD, NULL); - - HRESULT h; - h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL); - - if (h != DD_OK) - qDebug() << "cooperation level failed"; - - h = g_pDD->TestCooperativeLevel(); - if (h != DD_OK) - qDebug() << "cooperation level failed test"; - - DDSURFACEDESC ddsd; - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - - ddsd.dwFlags = DDSD_CAPS; - - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL); - - if (h != DD_OK) - qDebug() << "CreateSurface failed!"; - - if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK) - qDebug() << "GetCaps failed"; - - q_lock(); - q_unlock(); - initialized = true; -} - -uchar* q_frameBuffer() -{ - return (uchar*) buffer; -} - -int q_screenDepth() -{ - return bitCount; -} - -int q_screenWidth() -{ - return width; -} - -int q_screenHeight() -{ - return height; -} - -int q_linestep() -{ - return pitch; -} - -#endif //Q_OS_WINCE_WM - - diff --git a/tests/auto/other/windowsmobile/test/ddhelper.h b/tests/auto/other/windowsmobile/test/ddhelper.h deleted file mode 100644 index ce68654b76..0000000000 --- a/tests/auto/other/windowsmobile/test/ddhelper.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef __DDHELPER__ -#define __DDHELPER__ - -extern uchar* q_frameBuffer(); - -extern int q_screenDepth(); - -extern int q_screenWidth(); - -extern int q_screenHeight(); - -extern int q_linestep(); - -extern void q_initDD(); - -extern void q_unlock(); - -extern void q_lock(); - -#endif //__DDHELPER__ - diff --git a/tests/auto/other/windowsmobile/test/test.pro b/tests/auto/other/windowsmobile/test/test.pro deleted file mode 100644 index 36dd15f60e..0000000000 --- a/tests/auto/other/windowsmobile/test/test.pro +++ /dev/null @@ -1,23 +0,0 @@ - -CONFIG += testcase -QT += widgets testlib -HEADERS += ddhelper.h -SOURCES += tst_windowsmobile.cpp ddhelper.cpp -RESOURCES += windowsmobile.qrc - -TARGET = ../tst_windowsmobile - -wincewm*: { - addFiles.files = $$OUT_PWD/../testQMenuBar/*.exe - - - addFiles.path = "\\Program Files\\tst_windowsmobile" - DEPLOYMENT += addFiles -} - -wincewm*: { - LIBS += Ddraw.lib -} - - - diff --git a/tests/auto/other/windowsmobile/test/testQMenuBar_current.png b/tests/auto/other/windowsmobile/test/testQMenuBar_current.png Binary files differdeleted file mode 100644 index f0042b8fe0..0000000000 --- a/tests/auto/other/windowsmobile/test/testQMenuBar_current.png +++ /dev/null diff --git a/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png Binary files differdeleted file mode 100644 index 8086c41ce9..0000000000 --- a/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png +++ /dev/null diff --git a/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp deleted file mode 100644 index 8d0e468bd6..0000000000 --- a/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtCore/QDate> -#include <QtCore/QDebug> -#include <QtCore/QObject> -#include <QtGui> -#ifdef Q_OS_WINCE_WM -#include <windows.h> -#include "ddhelper.h" -#endif - - - -class tst_WindowsMobile : public QObject -{ - Q_OBJECT -public: - tst_WindowsMobile() - { - qApp->setCursorFlashTime (24 * 3600 * 1000); // once a day - // qApp->setCursorFlashTime (INT_MAX); -#ifdef Q_OS_WINCE_WM - q_initDD(); -#endif - } - -#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501 - private slots: - void testMainWindowAndMenuBar(); - void testSimpleWidget(); -#endif -}; - -#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501 - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} - -void openMenu() -{ - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,450,630,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,450,630,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0); -} - -void compareScreenshots(const QString &image1, const QString &image2) -{ - QImage screenShot(image1); - QImage original(image2); - - // cut away the title bar before comparing - QDesktopWidget desktop; - QRect desktopFrameRect = desktop.frameGeometry(); - QRect desktopClientRect = desktop.availableGeometry(); - - QPainter p1(&screenShot); - QPainter p2(&original); - - //screenShot.save("scr1.png", "PNG"); - p1.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black); - p2.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black); - - //screenShot.save("scr2.png", "PNG"); - //original.save("orig1.png", "PNG"); - - QCOMPARE(original, screenShot); -} - -void takeScreenShot(const QString filename) -{ - q_lock(); - QImage image = QImage(( uchar *) q_frameBuffer(), q_screenWidth(), - q_screenHeight(), q_screenWidth() * q_screenDepth() / 8, QImage::Format_RGB16); - image.save(filename, "PNG"); - q_unlock(); -} - -void tst_WindowsMobile::testMainWindowAndMenuBar() -{ - if (qt_wince_is_smartphone()) - QSKIP("This test is only for Windows Mobile"); - - QProcess process; - process.start("testQMenuBar.exe"); - QCOMPARE(process.state(), QProcess::Running); - QTest::qWait(6000); - openMenu(); - QTest::qWait(1000); - takeScreenShot("testQMenuBar_current.png"); - process.close(); - compareScreenshots("testQMenuBar_current.png", ":/testQMenuBar_current.png"); -} - -void tst_WindowsMobile::testSimpleWidget() -{ - if (qt_wince_is_smartphone()) - QSKIP("This test is only for Windows Mobile"); - - QMenuBar menubar; - menubar.show(); - QWidget maximized; - QPalette pal = maximized.palette(); - pal.setColor(QPalette::Background, Qt::red); - maximized.setPalette(pal); - maximized.showMaximized(); - QWidget widget; - widget.setGeometry(100, 100, 200, 200); - widget.setWindowTitle("Widget"); - widget.show(); - qApp->processEvents(); - QTest::qWait(1000); - - QWidget widget2; - widget2.setGeometry(100, 380, 300, 200); - widget2.setWindowTitle("Widget 2"); - widget2.setWindowFlags(Qt::Popup); - widget2.show(); - - qApp->processEvents(); - QTest::qWait(1000); - takeScreenShot("testSimpleWidget_current.png"); - compareScreenshots("testSimpleWidget_current.png", ":/testSimpleWidget_current.png"); -} - - -#endif //Q_OS_WINCE_WM - - -QTEST_MAIN(tst_WindowsMobile) -#include "tst_windowsmobile.moc" - diff --git a/tests/auto/other/windowsmobile/test/windowsmobile.qrc b/tests/auto/other/windowsmobile/test/windowsmobile.qrc deleted file mode 100644 index 5d6f61459e..0000000000 --- a/tests/auto/other/windowsmobile/test/windowsmobile.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>testQMenuBar_current.png</file> - <file>testSimpleWidget_current.png</file> -</qresource> -</RCC> diff --git a/tests/auto/other/windowsmobile/testQMenuBar/main.cpp b/tests/auto/other/windowsmobile/testQMenuBar/main.cpp deleted file mode 100644 index 8d9071ff72..0000000000 --- a/tests/auto/other/windowsmobile/testQMenuBar/main.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtCore/QDate> -#include <QtCore/QDebug> -#include <QtCore/QObject> -#include <QtGui> -#include <windows.h> - -int main(int argc, char * argv[]) -{ - QList<QWidget*> widgets; - QApplication app(argc, argv); - - QMainWindow mainWindow; - mainWindow.setWindowTitle("Test"); - QMenu *fileMenu = mainWindow.menuBar()->addMenu("File"); - QMenu *editMenu = mainWindow.menuBar()->addMenu("Edit"); - QMenu *viewMenu = mainWindow.menuBar()->addMenu("View"); - QMenu *toolsMenu = mainWindow.menuBar()->addMenu("Tools"); - QMenu *optionsMenu = mainWindow.menuBar()->addMenu("Options"); - QMenu *helpMenu = mainWindow.menuBar()->addMenu("Help"); - - qApp->processEvents(); - - fileMenu->addAction("Open"); - QAction *close = fileMenu->addAction("Close"); - fileMenu->addSeparator(); - fileMenu->addAction("Exit"); - - close->setEnabled(false); - - editMenu->addAction("Cut"); - editMenu->addAction("Pase"); - editMenu->addAction("Copy"); - editMenu->addSeparator(); - editMenu->addAction("Find"); - - viewMenu->addAction("Hide"); - viewMenu->addAction("Show"); - viewMenu->addAction("Explore"); - QAction *visible = viewMenu->addAction("Visible"); - visible->setCheckable(true); - visible->setChecked(true); - - toolsMenu->addMenu("Hammer"); - toolsMenu->addMenu("Caliper"); - toolsMenu->addMenu("Helm"); - - optionsMenu->addMenu("Settings"); - optionsMenu->addMenu("Standard"); - optionsMenu->addMenu("Extended"); - - QMenu *subMenu = helpMenu->addMenu("Help"); - subMenu->addAction("Index"); - subMenu->addSeparator(); - subMenu->addAction("Vodoo Help"); - helpMenu->addAction("Contens"); - helpMenu->addSeparator(); - helpMenu->addAction("About"); - - QToolBar toolbar; - mainWindow.addToolBar(&toolbar); - toolbar.addAction(QIcon(qApp->style()->standardPixmap(QStyle::SP_FileIcon)), QString("textAction")); - - QTextEdit textEdit; - mainWindow.setCentralWidget(&textEdit); - - mainWindow.showMaximized(); - - app.exec(); -} diff --git a/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro b/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro deleted file mode 100644 index 12ef683c11..0000000000 --- a/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES += main.cpp -QT += widgets -TARGET = ../testQMenuBar - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/windowsmobile/windowsmobile.pro b/tests/auto/other/windowsmobile/windowsmobile.pro deleted file mode 100644 index 2e6b444d7b..0000000000 --- a/tests/auto/other/windowsmobile/windowsmobile.pro +++ /dev/null @@ -1,9 +0,0 @@ - -TEMPLATE = subdirs - -wincewm* { - SUBDIRS = testQMenuBar -} - SUBDIRS += test - - diff --git a/tests/auto/qtest-config.h b/tests/auto/qtest-config.h deleted file mode 100644 index b3696a1456..0000000000 --- a/tests/auto/qtest-config.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTEST_CONFIG_H -#define QTEST_CONFIG_H - -#include <qglobal.h> - -#ifndef QTEST_NO_CURSOR -# if defined(QT_NO_CURSOR) || defined(Q_OS_WINCE) || defined(MEEGO_EDITION_HARMATTAN) -# define QTEST_NO_CURSOR -# endif -#endif // QTEST_NO_CURSOR - -#endif // QTEST_CONFIG_H diff --git a/tests/auto/sql/kernel/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro index 71e2989572..1c7452cd73 100644 --- a/tests/auto/sql/kernel/qsql/qsql.pro +++ b/tests/auto/sql/kernel/qsql/qsql.pro @@ -3,9 +3,3 @@ TARGET = tst_qsql SOURCES += tst_qsql.cpp QT = core-private sql-private testlib - -wince { - DEPLOYMENT_PLUGIN += qsqlite -} -mingw: LIBS += -lws2_32 - diff --git a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro index 7da5b8bc8e..9ee414bf34 100644 --- a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro +++ b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro @@ -3,17 +3,3 @@ TARGET = tst_qsqldatabase SOURCES += tst_qsqldatabase.cpp QT = core sql testlib core-private sql-private - -win32: { - !wince: LIBS += -lws2_32 - else: LIBS += -lws2 -} - -wince { - DEPLOYMENT_PLUGIN += qsqlite - - testData.files = testdata - testData.path = . - - DEPLOYMENT += testData -} diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index 389d3abf85..701da7d346 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -43,20 +43,6 @@ #include <QtSql/private/qsqldriver_p.h> #include <QtTest/QtTest> -#if defined(Q_OS_WIN) -# include <qt_windows.h> -# if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) -# include <winsock2.h> -# endif -#else -#include <unistd.h> -#endif -#if defined(Q_OS_WINRT) - static inline int qgethostname(char *name, int) { qstrcpy(name, "localhost"); return 9; } -#else -# define qgethostname gethostname -#endif - #define CHECK_DATABASE( db ) \ if ( !db.isValid() ) { qFatal( "db is Invalid" ); } @@ -71,16 +57,10 @@ static QString qGetHostName() { static QString hostname; - if ( !hostname.isEmpty() ) - return hostname; - - char hn[257]; - - if ( qgethostname( hn, 255 ) == 0 ) { - hn[256] = '\0'; - hostname = QString::fromLatin1( hn ); - hostname.replace( QLatin1Char( '.' ), QLatin1Char( '_' ) ); - hostname.replace( QLatin1Char( '-' ), QLatin1Char( '_' ) ); + if (hostname.isEmpty()) { + hostname = QSysInfo::machineHostName(); + hostname.replace(QLatin1Char( '.' ), QLatin1Char( '_' )); + hostname.replace(QLatin1Char( '-' ), QLatin1Char( '_' )); } return hostname; diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index bd8fbcca0e..8126e72ad2 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -100,6 +100,8 @@ private slots: void eventNotificationIBase(); void eventNotificationPSQL_data() { generic_data("QPSQL"); } void eventNotificationPSQL(); + void eventNotificationSQLite_data() { generic_data("QSQLITE"); } + void eventNotificationSQLite(); //database specific 64 bit integer test void bigIntField_data() { generic_data(); } @@ -2109,6 +2111,35 @@ void tst_QSqlDatabase::eventNotificationPSQL() QVERIFY_SQL(driver, unsubscribeFromNotification(procedureName)); } +void tst_QSqlDatabase::eventNotificationSQLite() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + if (db.driverName().compare(QLatin1String("QSQLITE"), Qt::CaseInsensitive)) { + QSKIP("QSQLITE specific test"); + } + const QString tableName(qTableName("sqlitnotifytest", __FILE__, db)); + tst_Databases::safeDropTable(db, tableName); + + QSignalSpy notificationSpy(db.driver(), SIGNAL(notification(QString))); + QSignalSpy notificationSpyExt(db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant))); + QSqlQuery q(db); + QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER, realVal REAL)")); + db.driver()->subscribeToNotification(tableName); + QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)")); + QTRY_COMPARE(notificationSpy.count(), 1); + QTRY_COMPARE(notificationSpyExt.count(), 1); + QList<QVariant> arguments = notificationSpy.takeFirst(); + QCOMPARE(arguments.at(0).toString(), tableName); + arguments = notificationSpyExt.takeFirst(); + QCOMPARE(arguments.at(0).toString(), tableName); + db.driver()->unsubscribeFromNotification(tableName); + QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)")); + QTRY_COMPARE(notificationSpy.count(), 0); + QTRY_COMPARE(notificationSpyExt.count(), 0); +} + void tst_QSqlDatabase::sqlite_bindAndFetchUInt() { QFETCH(QString, dbName); diff --git a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro index 8bfe1da1ce..772dc89177 100644 --- a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro +++ b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro @@ -3,16 +3,3 @@ TARGET = tst_qsqldriver SOURCES += tst_qsqldriver.cpp QT = core sql testlib core-private sql-private - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - mingw { - LIBS += -lws2_32 - } else:win32 { - LIBS += ws2_32.lib - } -} diff --git a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro index a6be23892d..c7638f9c0b 100644 --- a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro +++ b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro @@ -4,12 +4,3 @@ CONFIG += testcase SOURCES += tst_qsqlquery.cpp QT = core sql testlib core-private sql-private - -win32:!wince: LIBS += -lws2_32 - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} diff --git a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro index 64d8c5ccfb..32e0f2228f 100644 --- a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro +++ b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro @@ -3,14 +3,3 @@ TARGET = tst_qsqlthread SOURCES += tst_qsqlthread.cpp QT = core sql testlib core-private sql-private - - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - win32:LIBS += -lws2_32 -} - diff --git a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro index 2576fbad71..05eb871694 100644 --- a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro @@ -3,11 +3,3 @@ TARGET = tst_qsqlquerymodel SOURCES += tst_qsqlquerymodel.cpp QT += widgets sql testlib core-private sql-private - -wince { - DEPLOYMENT_PLUGIN += qsqlite - LIBS += -lws2 -} else { - win32:LIBS += -lws2_32 -} - diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro index cade7c171d..5695c06b29 100644 --- a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro @@ -3,16 +3,3 @@ TARGET = tst_qsqlrelationaltablemodel SOURCES += tst_qsqlrelationaltablemodel.cpp QT = core sql testlib core-private sql-private - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - mingw { - LIBS += -lws2_32 - } else:win32 { - LIBS += ws2_32.lib - } -} diff --git a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro index 2af39b341f..958f0507bf 100644 --- a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro +++ b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro @@ -3,13 +3,3 @@ TARGET = tst_qsqltablemodel SOURCES += tst_qsqltablemodel.cpp QT = core core-private sql sql-private testlib - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - win32:LIBS += -lws2_32 -} - diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 204758f68a..9ada718682 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -128,6 +128,7 @@ private slots: void compare_registered_enums(); void compare_class_enums(); void compare_boolfuncs(); + void compare_to_nullptr(); void compare_pointerfuncs(); void compare_tostring(); void compare_tostring_data(); @@ -180,6 +181,24 @@ void tst_Cmptest::compare_boolfuncs() QCOMPARE(!boolfunc(), false); } +namespace { +template <typename T> +T *null() Q_DECL_NOTHROW { return nullptr; } +} + +void tst_Cmptest::compare_to_nullptr() +{ + QCOMPARE(null<int>(), nullptr); + QCOMPARE(null<const int>(), nullptr); + QCOMPARE(null<volatile int>(), nullptr); + QCOMPARE(null<const volatile int>(), nullptr); + + QCOMPARE(nullptr, null<int>()); + QCOMPARE(nullptr, null<const int>()); + QCOMPARE(nullptr, null<volatile int>()); + QCOMPARE(nullptr, null<const volatile int>()); +} + static int i = 0; static int *intptr() { return &i; } diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp index 6cfa023b7e..87b241f5e5 100644 --- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp +++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp @@ -44,7 +44,7 @@ private slots: void tst_Crashes::crash() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //we avoid the error dialogbox to appear on windows SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index 440429e430..d4ba020000 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -33,6 +33,10 @@ <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> </TestFunction> +<TestFunction name="compare_to_nullptr"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> <TestFunction name="compare_pointerfuncs"> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity index dea19b60b4..c64060fdf2 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.teamcity +++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity @@ -12,6 +12,8 @@ ##teamcity[testFinished name='compare_class_enums()'] ##teamcity[testStarted name='compare_boolfuncs()'] ##teamcity[testFinished name='compare_boolfuncs()'] +##teamcity[testStarted name='compare_to_nullptr()'] +##teamcity[testFinished name='compare_to_nullptr()'] ##teamcity[testStarted name='compare_pointerfuncs()'] ##teamcity[testFinished name='compare_pointerfuncs()'] ##teamcity[testStarted name='compare_tostring(int, string)'] diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 100fd5e8ef..ceee0f1efa 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -12,6 +12,7 @@ FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2 Loc: [tst_cmptest.cpp(168)] PASS : tst_Cmptest::compare_boolfuncs() +PASS : tst_Cmptest::compare_to_nullptr() PASS : tst_Cmptest::compare_pointerfuncs() FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same Actual (actual) : QVariant(int,123) @@ -109,5 +110,5 @@ FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. () FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42) Loc: [tst_cmptest.cpp(439)] PASS : tst_Cmptest::cleanupTestCase() -Totals: 11 passed, 28 failed, 0 skipped, 0 blacklisted, 247ms +Totals: 12 passed, 28 failed, 0 skipped, 0 blacklisted, 247ms ********* Finished testing of tst_Cmptest ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index f45d9ba1da..2eddfa67d9 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -35,6 +35,10 @@ <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> </TestFunction> +<TestFunction name="compare_to_nullptr"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> <TestFunction name="compare_pointerfuncs"> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml index ec2c3f023c..d044771b14 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="0" failures="28" tests="18" name="tst_Cmptest"> +<testsuite errors="0" failures="28" tests="19" name="tst_Cmptest"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -20,6 +20,7 @@ Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2" result="fail"/> </testcase> <testcase result="pass" name="compare_boolfuncs"/> + <testcase result="pass" name="compare_to_nullptr"/> <testcase result="pass" name="compare_pointerfuncs"/> <testcase result="fail" name="compare_tostring"> <failure tag="int, string" message="Compared values are not the same diff --git a/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro b/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro index 4bfa89a44e..fa232b323b 100644 --- a/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro +++ b/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro @@ -2,7 +2,7 @@ CONFIG += testcase QT = core testlib dbus TARGET = tst_qdbuscpp2xml -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS SOURCES += tst_qdbuscpp2xml.cpp \ diff --git a/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro b/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro index 8c29ff47c4..02910b0267 100644 --- a/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro +++ b/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro @@ -2,4 +2,4 @@ CONFIG += testcase QT = core testlib TARGET = tst_qdbusxml2cpp SOURCES += tst_qdbusxml2cpp.cpp -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index e6a0c5e86b..ac7ba02700 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -69,10 +69,8 @@ private slots: void showMaximized(); void showMinimized(); void showFullScreen(); -#ifndef Q_OS_WINCE void showAsTool(); void toolDialogPosition(); -#endif void deleteMainDefault(); void deleteInExec(); #ifndef QT_NO_SIZEGRIP @@ -358,8 +356,6 @@ void tst_QDialog::showFullScreen() QVERIFY(!dialog.isVisible()); } -// No real support for Qt::Tool on WinCE -#ifndef Q_OS_WINCE void tst_QDialog::showAsTool() { #if defined(Q_OS_UNIX) @@ -379,10 +375,7 @@ void tst_QDialog::showAsTool() QCOMPARE(dialog.wasActive(), false); } } -#endif -// No real support for Qt::Tool on WinCE -#ifndef Q_OS_WINCE // Verify that pos() returns the same before and after show() // for a dialog with the Tool window type. void tst_QDialog::toolDialogPosition() @@ -394,7 +387,6 @@ void tst_QDialog::toolDialogPosition() const QPoint afterShowPosition = dialog.pos(); QCOMPARE(afterShowPosition, beforeShowPosition); } -#endif class Dialog : public QDialog { diff --git a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro index 2a11a29420..4ea23a896f 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro +++ b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro @@ -8,18 +8,6 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qfiledialog.cpp -wince* { - addFiles.files = *.cpp - addFiles.path = . - filesInDir.files = *.pro - filesInDir.path = someDir - DEPLOYMENT += addFiles filesInDir -} - -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" linux*: CONFIG += insignificant_test # Crashes on different Linux distros diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index ef549d252b..b836cdf00b 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -183,9 +183,6 @@ void tst_QFiledialog::init() QFileDialogPrivate::setLastVisitedDirectory(QUrl()); // populate the sidebar with some default settings QNonNativeFileDialog fd; -#if defined(Q_OS_WINCE) - QTest::qWait(1000); -#endif } void tst_QFiledialog::cleanup() diff --git a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro index fb432a7d21..1b35b2e4ac 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro +++ b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro @@ -6,17 +6,4 @@ QT += core-private gui-private SOURCES += tst_qfiledialog2.cpp -wince* { - addFiles.files = *.cpp - addFiles.path = . - filesInDir.files = *.pro - filesInDir.path = someDir - DEPLOYMENT += addFiles filesInDir -} - -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 0648f8364c..f08d78acf7 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -54,7 +54,7 @@ #include <qpa/qplatformdialoghelper.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif @@ -118,7 +118,7 @@ private slots: #ifndef Q_OS_MAC void task227930_correctNavigationKeyboardBehavior(); #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void task226366_lowerCaseHardDriveWindows(); #endif void completionOnLevelAfterRoot(); @@ -148,9 +148,6 @@ private: tst_QFileDialog2::tst_QFileDialog2() : tempDir(QDir::tempPath() + "/tst_qfiledialog2.XXXXXX") { -#if defined(Q_OS_WINCE) - qApp->setAutoMaximizeThreshold(-1); -#endif } void tst_QFileDialog2::cleanupSettingsFile() @@ -177,9 +174,6 @@ void tst_QFileDialog2::init() QFileDialogPrivate::setLastVisitedDirectory(QUrl()); // populate the sidebar with some default settings QNonNativeFileDialog fd; -#if defined(Q_OS_WINCE) - QTest::qWait(1000); -#endif } void tst_QFileDialog2::cleanup() @@ -199,11 +193,7 @@ void tst_QFileDialog2::listRoot() fd.show(); QCOMPARE(qt_test_isFetchedRoot(),false); fd.setDirectory(""); -#ifdef Q_OS_WINCE - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QCOMPARE(qt_test_isFetchedRoot(),true); } #endif @@ -297,7 +287,7 @@ void tst_QFileDialog2::showNameFilterDetails() void tst_QFileDialog2::unc() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Only test UNC on Windows./ QString dir("\\\\" + QtNetworkSettings::winServerName() + "\\testsharewritable"); #else @@ -645,7 +635,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() } #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() { QNonNativeFileDialog fd; @@ -675,7 +665,7 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() void tst_QFileDialog2::completionOnLevelAfterRoot() { QNonNativeFileDialog fd; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) fd.setDirectory("C:/"); QDir current = fd.directory(); QStringList entryList = current.entryList(QStringList(), QDir::Dirs); @@ -719,7 +709,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot() fd.show(); QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit"); QTest::qWait(2000); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) //I love testlib :D for (int i = 0; i < 5; i++) QTest::keyClick(edit, testDir.at(i).toLower().toLatin1() - 'a' + Qt::Key_A); @@ -730,7 +720,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot() QTest::qWait(200); QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); QTest::qWait(200); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QCOMPARE(edit->text(), testDir); #else QTRY_COMPARE(edit->text(), QString("etc")); @@ -864,33 +854,21 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() fd.setDirectory(current.absolutePath()); fd.setViewMode(QFileDialog::Detail); fd.show(); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QTreeView *tree = fd.findChild<QTreeView*>("treeView"); tree->header()->setSortIndicator(3,Qt::DescendingOrder); QTest::qWait(200); QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox"); QPushButton *button = buttonBox->button(QDialogButtonBox::Open); QTest::mouseClick(button, Qt::LeftButton); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QNonNativeFileDialog fd2; fd2.setFileMode(QFileDialog::Directory); fd2.restoreState(fd.saveState()); current.cd("aaaaaaaaaaaaaaaaaa"); fd2.setDirectory(current.absolutePath()); fd2.show(); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QTreeView *tree2 = fd2.findChild<QTreeView*>("treeView"); tree2->setFocus(); @@ -900,22 +878,14 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open); fd2.selectFile("g"); QTest::mouseClick(button2, Qt::LeftButton); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g")); QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); fd3.restoreState(fd.saveState()); fd3.setFileMode(QFileDialog::Directory); fd3.show(); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QTreeView *tree3 = fd3.findChild<QTreeView*>("treeView"); tree3->setFocus(); @@ -924,11 +894,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() QDialogButtonBox *buttonBox3 = fd3.findChild<QDialogButtonBox*>("buttonBox"); QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open); QTest::mouseClick(button3, Qt::LeftButton); -#if defined(Q_OS_WINCE) - QTest::qWait(1500); -#else QTest::qWait(500); -#endif QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName()); current.cd("aaaaaaaaaaaaaaaaaa"); @@ -1010,11 +976,7 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries() sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath())); QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center()); // give the background processes more time on windows mobile -#ifdef Q_OS_WINCE - QTest::qWait(1000); -#else QTest::qWait(250); -#endif QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 17c10bb43e..f0241997bf 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -40,7 +40,7 @@ #include <QStyle> #include <QtGlobal> #include <QTemporaryDir> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) # include <qt_windows.h> // for SetFileAttributes #endif @@ -104,7 +104,7 @@ private slots: void caseSensitivity(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void Win32LongFileName(); #endif @@ -334,7 +334,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi return false; } file.close(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (initial_files.at(i)[0] == '.') { QString hiddenFile = QDir::toNativeSeparators(file.fileName()); wchar_t nativeHiddenFile[MAX_PATH]; @@ -371,14 +371,9 @@ void tst_QFileSystemModel::rowCount() QSignalSpy spy2(model, SIGNAL(rowsInserted(QModelIndex,int,int))); QSignalSpy spy3(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); -#if !defined(Q_OS_WINCE) QStringList files = QStringList() << "b" << "d" << "f" << "h" << "j" << ".a" << ".c" << ".e" << ".g"; QString l = "b,d,f,h,j,.a,.c,.e,.g"; -#else - // Cannot hide them on CE - QStringList files = QStringList() << "b" << "d" << "f" << "h" << "j"; - QString l = "b,d,f,h,j"; -#endif + QVERIFY(createFiles(tmp, files)); QModelIndex root = model->setRootPath(tmp); @@ -406,9 +401,6 @@ static inline QString lastEntry(const QModelIndex &root) void tst_QFileSystemModel::rowsInserted() { -#if defined(Q_OS_WINCE) - QSKIP("Watching directories does not work on CE(see #137910)"); -#endif QString tmp = flatDirTestPath; rowCount(); QModelIndex root = model->index(model->rootPath()); @@ -463,9 +455,6 @@ void tst_QFileSystemModel::rowsRemoved_data() void tst_QFileSystemModel::rowsRemoved() { -#if defined(Q_OS_WINCE) - QSKIP("Watching directories does not work on CE(see #137910)"); -#endif QString tmp = flatDirTestPath; rowCount(); QModelIndex root = model->index(model->rootPath()); @@ -554,7 +543,6 @@ void tst_QFileSystemModel::filters_data() QTest::addColumn<int>("dirFilters"); QTest::addColumn<QStringList>("nameFilters"); QTest::addColumn<int>("rowCount"); -#if !defined(Q_OS_WINCE) QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 2; QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1; QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1; @@ -576,30 +564,6 @@ void tst_QFileSystemModel::filters_data() (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1; QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1; -#else - QTest::qWait(3000); // We need to calm down a bit... - QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 0; - QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1; - QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1; - QTest::newRow("no dirs - dotanddotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 0; - QTest::newRow("one dir - dot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 2; - QTest::newRow("one dir - dotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 2; - QTest::newRow("one dir - dotanddotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1; - QTest::newRow("one dir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs) << QStringList() << 1; - QTest::newRow("no dir + hidden") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Hidden) << QStringList() << 0; - QTest::newRow("dir+hid+files") << (QStringList() << "a" << "b" << "c") << QStringList() << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 3; - QTest::newRow("dir+file+hid-dot .A") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".A") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4; - QTest::newRow("dir+files+hid+dot A") << (QStringList() << "a" << "b" << "c") << (QStringList() << "AFolder") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << (QStringList() << "A*") << 2; - QTest::newRow("dir+files+hid+dot+cas1") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "Z") << 1; - QTest::newRow("dir+files+hid+dot+cas2") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1; - QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << - (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1; -#endif QTest::newRow("case sensitive") << (QStringList() << "Antiguagdb" << "Antiguamtd" << "Antiguamtp" << "afghanistangdb" << "afghanistanmtd") @@ -902,7 +866,7 @@ void tst_QFileSystemModel::caseSensitivity() } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void tst_QFileSystemModel::Win32LongFileName() { QString tmp = flatDirTestPath; diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index b62f3e3344..07f3a41df3 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -1,4 +1,5 @@ [task256466_wrongStyle] opensuse-13.1 +opensuse-42.1 rhel-7.1 rhel-7.2 diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index d6b3ce07e8..d6c4841b22 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -395,11 +395,8 @@ void tst_QMessageBox::about() QVERIFY(closeHelper.done()); #endif -#if !defined(Q_OS_WINCE) const int keyToSend = Qt::Key_Enter; -#else - const keyToSend = Qt::Key_Escape; -#endif + closeHelper.start(keyToSend); QMessageBox::aboutQt(0, "Caption"); #ifdef Q_OS_MAC diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 2635a2ed82..016835f142 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -51,9 +51,6 @@ class tst_QWizard : public QObject { Q_OBJECT -public: - tst_QWizard(); - private slots: void cleanup(); void buttonText(); @@ -128,13 +125,6 @@ private slots: */ }; -tst_QWizard::tst_QWizard() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QWizard::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -962,9 +952,6 @@ void tst_QWizard::setOption_IndependentPages() void tst_QWizard::setOption_IgnoreSubTitles() { -#if defined(Q_OS_WINCE) - QSKIP("Skipped because of limited resources and potential crash. (Task: 166824)"); -#endif const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); const int kPixels = (availableGeometry.width() + 500) / 1000; const int frame = 50 * kPixels; @@ -1073,9 +1060,6 @@ void tst_QWizard::setOption_IgnoreSubTitles() void tst_QWizard::setOption_ExtendedWatermarkPixmap() { -#if defined(Q_OS_WINCE) - QSKIP("Skipped because of limited resources and potential crash. (Task: 166824)"); -#endif QPixmap watermarkPixmap(200, 400); watermarkPixmap.fill(Qt::black); @@ -2062,10 +2046,6 @@ void tst_QWizard::combinations_data() void tst_QWizard::combinations() { -#ifdef Q_OS_WINCE - QSKIP("Too much memory usage for testing on CE emulator"); -#endif - QFETCH(bool, ref); QFETCH(bool, testEquality); QFETCH(QList<Operation *>, operations); diff --git a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro index bf0f99598b..4fbe13cce7 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro +++ b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro @@ -5,10 +5,3 @@ QT += widgets widgets-private testlib QT += gui-private SOURCES += tst_qpixmapfilter.cpp - -wince { - addFiles.files = noise.png - addFiles.path = . - DEPLOYMENT += addFiles -} - diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 90ea2cb58b..f5b2269297 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -38,7 +38,6 @@ class tst_QGraphicsGridLayout : public QObject Q_OBJECT private slots: - void initTestCase(); void qgraphicsgridlayout_data(); void qgraphicsgridlayout(); void addItem_data(); @@ -294,16 +293,6 @@ Q_DECLARE_METATYPE(ItemList); typedef QList<QSizeF> SizeList; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsGridLayout::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsGridLayout::qgraphicsgridlayout_data() { } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 5bfa15db16..88526144fc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -5,4 +5,4 @@ QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index fc192560b4..56c2b6583e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -57,9 +57,7 @@ Q_DECLARE_METATYPE(QPainterPath) -#include "../../../qtest-config.h" - -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -279,9 +277,6 @@ class tst_QGraphicsItem : public QObject { Q_OBJECT -public slots: - void init(); - private slots: void construction(); void constructionWithParent(); @@ -355,7 +350,7 @@ private slots: void filtersChildEvents(); void filtersChildEvents2(); void ensureVisible(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); #endif //void textControlGetterSetter(); @@ -481,13 +476,6 @@ private: QList<QGraphicsItem *> paintedItems; }; -void tst_QGraphicsItem::init() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsItem::construction() { for (int i = 0; i < 7; ++i) { @@ -4187,7 +4175,7 @@ void tst_QGraphicsItem::ensureVisible() QTest::qWait(25); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsItem::cursor() { QGraphicsScene scene; @@ -4535,7 +4523,7 @@ protected: case QGraphicsItem::ItemSceneHasChanged: break; case QGraphicsItem::ItemCursorChange: -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR oldValues << cursor(); #endif break; diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index c93fc1288f..4cf602a548 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -33,8 +33,6 @@ #include <private/qgraphicsproxywidget_p.h> #include <private/qlayoutengine_p.h> // qSmartMin functions... -#include "../../../qtest-config.h" - static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton) { QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, button, 0); @@ -97,7 +95,7 @@ private slots: void focusNextPrevChild(); void focusOutEvent_data(); void focusOutEvent(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void hoverEnterLeaveEvent_data(); void hoverEnterLeaveEvent(); #endif @@ -140,7 +138,7 @@ private slots: void setFocus_complexTwoWidgets(); void popup_basic(); void popup_subwidget(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void changingCursor_basic(); #endif void tooltip_basic(); @@ -272,9 +270,6 @@ public: // It is only called once. void tst_QGraphicsProxyWidget::initTestCase() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif // Disable menu animations to prevent the alpha widget from getting in the way // in actionsContextMenu(). QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false); @@ -414,7 +409,7 @@ void tst_QGraphicsProxyWidget::setWidget() } QWidget *widget = new QWidget; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR widget->setCursor(Qt::IBeamCursor); #endif widget->setPalette(QPalette(Qt::magenta)); @@ -451,7 +446,7 @@ void tst_QGraphicsProxyWidget::setWidget() QVERIFY(subWidget->testAttribute(Qt::WA_DontShowOnScreen)); QVERIFY(!subWidget->testAttribute(Qt::WA_QuitOnClose)); QCOMPARE(proxy->acceptHoverEvents(), true); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QVERIFY(proxy->hasCursor()); // These should match @@ -934,7 +929,7 @@ protected: } }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data() { QTest::addColumn<bool>("hasWidget"); @@ -1522,7 +1517,7 @@ void tst_QGraphicsProxyWidget::setWidget_simple() // Properties // QCOMPARE(proxy.focusPolicy(), lineEdit->focusPolicy()); // QCOMPARE(proxy.palette(), lineEdit->palette()); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(proxy.cursor().shape(), lineEdit->cursor().shape()); #endif QCOMPARE(proxy.layoutDirection(), lineEdit->layoutDirection()); @@ -1571,7 +1566,7 @@ void tst_QGraphicsProxyWidget::resize_simple_data() QTest::addColumn<QSizeF>("size"); QTest::newRow("200, 200") << QSizeF(200, 200); -#if !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE) +#if !defined(Q_PROCESSOR_ARM) QTest::newRow("1000, 1000") << QSizeF(1000, 1000); // Since 4.5, 10000x10000 runs out of memory. // QTest::newRow("10000, 10000") << QSizeF(10000, 10000); @@ -2539,7 +2534,7 @@ void tst_QGraphicsProxyWidget::popup_subwidget() QCOMPARE(popup->size(), child->size().toSize()); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsProxyWidget::changingCursor_basic() { // Confirm that mouse events are working properly by checking that @@ -3645,7 +3640,7 @@ public slots: void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget() { -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(QTEST_NO_CURSOR) +#if defined(Q_OS_DARWIN) || defined(Q_OS_WIN) || defined(QT_NO_CURSOR) QSKIP("Test case unstable on this platform"); #endif QGraphicsView view; diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 986ba019b4..351cecd92e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -4,18 +4,9 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicsscene.cpp RESOURCES += images.qrc -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 -!wince: DEFINES += SRCDIR=\\\"$$PWD\\\" +DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_NO_CAST_TO_ASCII -wince* { - rootFiles.files = Ash_European.jpg graphicsScene_selection.data - rootFiles.path = . - renderFiles.files = testData\\render\\* - renderFiles.path = testData\\render - DEPLOYMENT += rootFiles renderFiles - DEFINES += SRCDIR=\\\".\\\" -} - RESOURCES += testdata.qrc diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index a346bb9d1f..38b4230409 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -28,9 +28,6 @@ #include <QtTest/QtTest> -#if defined(Q_OS_WINCE) -#include <ceconfig.h> -#endif #include <QtGui> #include <QtWidgets> @@ -41,7 +38,7 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -170,7 +167,6 @@ class tst_QGraphicsScene : public QObject { Q_OBJECT public slots: - void initTestCase(); void cleanup(); private slots: @@ -273,13 +269,6 @@ private slots: void taskQTBUG_16401_focusItem(); }; -void tst_QGraphicsScene::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsScene::cleanup() { // ensure not even skipped tests with custom input context leave it dangling @@ -1250,7 +1239,7 @@ void tst_QGraphicsScene::addText() void tst_QGraphicsScene::removeItem() { -#if (defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)) || defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) QSKIP("No mouse cursor support"); #endif QGraphicsScene scene; @@ -1587,11 +1576,7 @@ void tst_QGraphicsScene::hoverEvents_siblings() QGraphicsView view(&scene); view.setRenderHint(QPainter::Antialiasing, true); -#if defined(Q_OS_WINCE) - view.setMinimumSize(230, 200); -#else view.setMinimumSize(400, 300); -#endif view.rotate(10); view.scale(1.7, 1.7); view.show(); @@ -1660,11 +1645,7 @@ void tst_QGraphicsScene::hoverEvents_parentChild() QGraphicsView view(&scene); view.setRenderHint(QPainter::Antialiasing, true); -#if defined(Q_OS_WINCE) - view.setMinimumSize(230, 200); -#else view.setMinimumSize(400, 300); -#endif view.rotate(10); view.scale(1.7, 1.7); view.show(); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 10f5a9161e..2329db55e9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -54,7 +54,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" #include "tst_qgraphicsview.h" Q_DECLARE_METATYPE(ExpectedValueDescription) @@ -143,7 +142,6 @@ public: : platformName(QGuiApplication::platformName().toLower()) { } private slots: - void initTestCase(); void cleanup(); void construction(); void renderHints(); @@ -196,7 +194,7 @@ private slots: #ifndef QT_NO_WHEELEVENT void wheelEvent(); #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); void cursor2(); #endif @@ -260,7 +258,7 @@ private slots: void QTBUG_4151_clipAndIgnore_data(); void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void QTBUG_7438_cursor(); #endif void hoverLeave(); @@ -273,13 +271,6 @@ private: QString platformName; }; -void tst_QGraphicsView::initTestCase() -{ -#ifdef Q_OS_WINCE_WM - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QGraphicsView::cleanup() { // ensure not even skipped tests with custom input context leave it dangling @@ -694,7 +685,7 @@ void tst_QGraphicsView::dragMode_scrollHand() for (int i = 0; i < 2; ++i) { // ScrollHandDrag -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Qt::CursorShape cursorShape = view.viewport()->cursor().shape(); #endif int horizontalScrollBarValue = view.horizontalScrollBar()->value(); @@ -713,7 +704,7 @@ void tst_QGraphicsView::dragMode_scrollHand() QTRY_VERIFY(item->isSelected()); for (int k = 0; k < 4; ++k) { -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), Qt::ClosedHandCursor); #endif { @@ -756,7 +747,7 @@ void tst_QGraphicsView::dragMode_scrollHand() QTRY_VERIFY(item->isSelected()); QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue - 10); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue - 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -816,7 +807,7 @@ void tst_QGraphicsView::dragMode_rubberBand() for (int i = 0; i < 2; ++i) { // RubberBandDrag -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Qt::CursorShape cursorShape = view.viewport()->cursor().shape(); #endif int horizontalScrollBarValue = view.horizontalScrollBar()->value(); @@ -830,7 +821,7 @@ void tst_QGraphicsView::dragMode_rubberBand() QApplication::sendEvent(view.viewport(), &event); QVERIFY(event.isAccepted()); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -878,7 +869,7 @@ void tst_QGraphicsView::dragMode_rubberBand() } QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -1383,20 +1374,9 @@ void tst_QGraphicsView::fitInView() items[0]->setTransform(QTransform().rotate(30), true); items[1]->setTransform(QTransform().rotate(-30), true); -#if defined(Q_OS_WINCE) - //Is the standard scrollbar size - int scrollbarSize = qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 13; -#endif - QGraphicsView view(&scene); view.setSceneRect(-400, -400, 800, 800); - -#if defined(Q_OS_WINCE) - //We need to take in account the scrollbar size for the WindowsMobilStyle - view.setFixedSize(400 + scrollbarSize, 200 + scrollbarSize); -#else view.setFixedSize(400, 200); -#endif view.showNormal(); view.fitInView(scene.itemsBoundingRect(), Qt::IgnoreAspectRatio); @@ -1810,11 +1790,7 @@ void tst_QGraphicsView::mapToScene() QGraphicsView view(&topLevel); view.setScene(&scene); view.setSceneRect(-500, -500, 1000, 1000); -#if defined(Q_OS_WINCE) - QSize viewSize(200,200); -#else QSize viewSize(300,300); -#endif view.setFixedSize(viewSize); topLevel.show(); @@ -2221,7 +2197,7 @@ void tst_QGraphicsView::wheelEvent() } #endif // !QT_NO_WHEELEVENT -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsView::cursor() { QGraphicsScene scene; @@ -2245,7 +2221,7 @@ void tst_QGraphicsView::cursor() } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsView::cursor2() { QGraphicsScene scene; @@ -3740,7 +3716,7 @@ void tst_QGraphicsView::mouseTracking() QGraphicsView view(&scene); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -3750,7 +3726,7 @@ void tst_QGraphicsView::mouseTracking() // Adding an item to the scene before the scene is set on the view. QGraphicsScene scene(-10000, -10000, 20000, 20000); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -3767,7 +3743,7 @@ void tst_QGraphicsView::mouseTracking() QGraphicsView view3(&scene); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -4528,9 +4504,6 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() { -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE does not implement mouse tracking at this point"); -#endif QGraphicsScene scene(-100, -100, 200, 200); scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue)); @@ -4722,7 +4695,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QGraphicsView::QTBUG_7438_cursor() { QGraphicsScene scene; diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index ca9f866e81..9e390e45a6 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -42,8 +42,6 @@ #include <qstylefactory.h> #include <qscreen.h> -#include "../../../qtest-config.h" - typedef QList<QGraphicsItem *> QGraphicsItemList; class EventSpy : public QObject @@ -1112,9 +1110,7 @@ void tst_QGraphicsWidget::initStyleOption() bool hasFocus = option.state & QStyle::State_HasFocus; QCOMPARE(hasFocus, focus); bool isUnderMouse = option.state & QStyle::State_MouseOver; -#ifndef Q_OS_WINCE QCOMPARE(isUnderMouse, underMouse); -#endif // if (layoutDirection != Qt::LeftToRight) //QEXPECT_FAIL("", "QApplicaiton::layoutDirection doesn't propagate to QGraphicsWidget", Continue); //QCOMPARE(option.direction, layoutDirection); @@ -2938,8 +2934,8 @@ protected: void tst_QGraphicsWidget::respectHFW() { -#if defined(Q_OS_WINCE) || defined(Q_OS_MAC) - QSKIP("This test is platform dependent, it fails on wince and mac. Please fix."); +#if defined(Q_OS_DARWIN) + QSKIP("This test is platform dependent, it fails on Apple platforms. Please fix."); #else QGraphicsScene scene; HFWWidget *window = new HFWWidget; @@ -3184,7 +3180,7 @@ void tst_QGraphicsWidget::itemChangeEvents() valueDuringEvents.insert(QEvent::ParentChange, QVariant::fromValue(parentItem())); break; } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR case QEvent::CursorChange: { valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape())); break; @@ -3235,7 +3231,7 @@ void tst_QGraphicsWidget::itemChangeEvents() QVERIFY(!item->isVisible()); QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool()); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR // CursorChange should be triggered after the cursor has changed item->setCursor(Qt::PointingHandCursor); QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape())); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 89fb30557b..1050fa2561 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -197,7 +197,6 @@ public: void basic_tests(TestView *view); private slots: - void initTestCase(); void cleanup(); void getSetCheck(); void emptyModels_data(); @@ -356,13 +355,6 @@ void tst_QAbstractItemView::getSetCheck() QCOMPARE(16, obj1->autoScrollMargin()); } -void tst_QAbstractItemView::initTestCase() -{ -#ifdef Q_OS_WINCE_WM - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QAbstractItemView::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -1307,9 +1299,6 @@ void tst_QAbstractItemView::task250754_fontChange() void tst_QAbstractItemView::task200665_itemEntered() { -#ifdef Q_OS_WINCE_WM - QSKIP("On Windows Mobile the mouse tracking is unavailable at the moment"); -#endif //we test that view will emit entered //when the scrollbar move but not the mouse itself QStandardItemModel model(1000,1); diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index d717278be9..e6c4ab44f8 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -183,9 +183,6 @@ void tst_QColumnView::initTestCase() void tst_QColumnView::init() { qApp->setLayoutDirection(Qt::LeftToRight); -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif } void tst_QColumnView::rootIndex() diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 5190598701..ea4e9d4620 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -13,7 +13,7 @@ wince* { DEPLOYMENT += addit tests sourceFile } -android|wince { +android { DEFINES += SRCDIR=\\\"./\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 06019d4555..30109952c7 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -575,7 +575,7 @@ void tst_QDirModel::filePath() model.setResolveSymlinks(false); QModelIndex index = model.index(SRCDIR "test.lnk"); QVERIFY(index.isValid()); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) QString path = SRCDIR; #else QString path = QFileInfo(SRCDIR).absoluteFilePath(); diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index ca22eee514..99ec37fe2e 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -379,9 +379,6 @@ tst_QHeaderView::tst_QHeaderView() void tst_QHeaderView::initTestCase() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif m_tableview = new QTableView(); } @@ -552,11 +549,7 @@ void tst_QHeaderView::hidden() void tst_QHeaderView::stretch() { // Show before resize and setStretchLastSection -#if defined(Q_OS_WINCE) - QSize viewSize(200,300); -#else QSize viewSize(500, 500); -#endif view->resize(viewSize); view->setStretchLastSection(true); QCOMPARE(view->stretchLastSection(), true); @@ -616,12 +609,6 @@ void tst_QHeaderView::sectionSize() QFETCH(int, lastVisibleSectionSize); QFETCH(int, persistentSectionSize); -#ifdef Q_OS_WINCE - // We test on a device with doubled pixels. Therefore we need to specify - // different boundaries. - initialDefaultSize = qMax(view->minimumSectionSize(), 30); -#endif - // bounds check foreach (int val, boundsCheck) view->sectionSize(val); @@ -691,13 +678,7 @@ void tst_QHeaderView::visualIndexAt_data() QTest::addColumn<QList<int> >("visual"); QList<int> coordinateList; -#ifndef Q_OS_WINCE coordinateList << -1 << 0 << 31 << 91 << 99999; -#else - // We test on a device with doubled pixels. Therefore we need to specify - // different boundaries. - coordinateList << -1 << 0 << 33 << 97 << 99999; -#endif QTest::newRow("no hidden, no moved sections") << QList<int>() @@ -750,10 +731,6 @@ void tst_QHeaderView::visualIndexAt() void tst_QHeaderView::length() { -#if defined(Q_OS_WINCE) - QFont font(QLatin1String("Tahoma"), 7); - view->setFont(font); -#endif view->setStretchLastSection(true); topLevel->show(); QVERIFY(QTest::qWaitForWindowExposed(topLevel)); diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro index f7fb41e60c..9405c33a48 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro +++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro @@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate QT += widgets testlib SOURCES += tst_qitemdelegate.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 34713bdff9..e67edfcccb 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -53,7 +53,7 @@ Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) #include <windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index d3211eada8..1fd7b31e22 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp @@ -32,42 +32,13 @@ #include "viewstotest.cpp" #include <stdlib.h> -#if defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN) #include <time.h> #endif -#if defined(Q_OS_WIN) -#include <time.h> -#if defined(Q_OS_WINCE) -#include <aygshell.h> -#endif -#define random rand -#define srandom srand - -#if defined(Q_OS_WINCE) -#ifndef SPI_GETPLATFORMTYPE -#define SPI_GETPLATFORMTYPE 257 -#endif - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} -#endif +#if defined(Q_OS_WIN) +# define random rand +# define srandom srand #endif /*! @@ -305,10 +276,6 @@ void tst_QItemView::nonDestructiveBasicTest_data() */ void tst_QItemView::nonDestructiveBasicTest() { -#ifdef Q_OS_WINCE - QTest::qWait(400); -#endif - QFETCH(QString, viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); @@ -476,11 +443,7 @@ void tst_QItemView::spider() view->setModel(treeModel); view->show(); QVERIFY(QTest::qWaitForWindowActive(view)); -#if defined(Q_OS_WINCE) - srandom(0); -#else srandom(time(0)); -#endif touch(view->viewport(), Qt::NoModifier, Qt::Key_Left); touch(view->viewport(), Qt::ShiftModifier, Qt::Key_Enter); touch(view->viewport(), Qt::ControlModifier, Qt::Key_Backspace); diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index 509303b62e..44e25ded66 100644 --- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro +++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro @@ -2,5 +2,5 @@ CONFIG += testcase TARGET = tst_qlistview QT += widgets gui-private widgets-private core-private testlib SOURCES += tst_qlistview.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 linux*: CONFIG += insignificant_test # Crashes diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 651172e79f..8cefad37fc 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -45,13 +45,13 @@ #include <QtWidgets/QStyledItemDelegate> #include <QtWidgets/QStyleFactory> -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) # include <windows.h> # include <QtGui/QGuiApplication> #include <qpa/qplatformnativeinterface.h> #endif // Q_OS_WIN -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) static inline HWND getHWNDForWidget(const QWidget *widget) { QWindow *window = widget->windowHandle(); @@ -83,7 +83,6 @@ class tst_QListView : public QObject Q_OBJECT private slots: - void initTestCase(); void cleanup(); void getSetCheck(); void noDelegate(); @@ -111,7 +110,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 +#if defined(Q_OS_WIN) && WINVER >= 0x0500 void setCurrentIndexAfterAppendRowCrash(); #endif void emptyItemSize(); @@ -292,13 +291,6 @@ public: } }; -void tst_QListView::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QListView::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -983,25 +975,6 @@ void tst_QListView::selection_data() << QRect(300, 0, 1, 300) // selection rectangle << IntList(); // expected items -#if defined(Q_OS_WINCE) - // depending on whether the display is double-pixeld, we need - // to click at a different position - bool doubledSize = false; - int dpi = GetDeviceCaps(GetDC(0), LOGPIXELSX); - if ((dpi < 1000) && (dpi > 0)) { - doubledSize = true; - } - QTest::newRow("select inside contents, (on viewport)") - << 35 // itemCount - << int(QListView::ListMode) - << int(QListView::TopToBottom) - << true // wrapping - << 0 // spacing - << QSize() // gridSize - << IntList() // hiddenRows - << QRect(doubledSize?350:175,doubledSize?550:275, 1, 1)// selection rectangle - << IntList(); // expected items -#else QTest::newRow("select inside contents, (on viewport)") << 35 // itemCount << int(QListView::ListMode) @@ -1012,7 +985,6 @@ void tst_QListView::selection_data() << IntList() // hiddenRows << QRect(175, 275, 1, 1) // selection rectangle << IntList(); // expected items -#endif QTest::newRow("select a tall rect in LeftToRight flow, wrap items") << 70 // itemCount @@ -1137,17 +1109,7 @@ void tst_QListView::selection() v.setRowHidden(hiddenRows.at(j), true); } -#if defined(Q_OS_WINCE) - // If the device is double-pixeled then the scrollbars become - // 10 pixels wider than normal (Windows Style: 16, Windows Mobile Style: 26). - // So we have to make the window slightly bigger to have the same count of - // items in each row of the list view like in the other styles. - static const int dpi = ::GetDeviceCaps(GetDC(0), LOGPIXELSX); - if ((dpi < 1000) && (dpi > 0)) - v.resize(535,535); -#else v.resize(525,525); -#endif topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); @@ -1449,7 +1411,7 @@ void tst_QListView::wordWrap() QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog { Q_OBJECT @@ -1490,7 +1452,7 @@ private: }; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && WINVER >= 0x0500 +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && WINVER >= 0x0500 // This test only makes sense on windows 2000 and higher. void tst_QListView::setCurrentIndexAfterAppendRowCrash() { diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index f935d6eecf..445e5e7ac7 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -61,8 +61,6 @@ class tst_QTableView : public QObject Q_OBJECT private slots: - void initTestCase(); - void getSetCheck(); void noDelegate(); @@ -519,13 +517,6 @@ public: QSize hint; }; -void tst_QTableView::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QTableView::noDelegate() { QtTestTableModel model(3, 3); @@ -3995,10 +3986,6 @@ void tst_QTableView::mouseWheel_data() void tst_QTableView::mouseWheel() { -#ifdef Q_OS_WINCE - QSKIP("Since different Windows CE versions sport different taskbars, we skip this test"); -#endif - QFETCH(int, scrollMode); QFETCH(int, delta); QFETCH(int, horizontalPositon); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 938c8a47ac..81ce1deca4 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -118,8 +118,6 @@ public slots: void selectionOrderTest(); private slots: - void initTestCase(); - void getSetCheck(); // one test per QTreeView property @@ -390,13 +388,6 @@ public: mutable QMap<QModelIndex,QModelIndex> parentHash; }; -void tst_QTreeView::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - // Testing get/set functions void tst_QTreeView::getSetCheck() { diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro index 908aa846c0..92409e4bfe 100644 --- a/tests/auto/widgets/kernel/qapplication/test/test.pro +++ b/tests/auto/widgets/kernel/qapplication/test/test.pro @@ -11,7 +11,7 @@ TESTDATA = ../test/test.pro ../tmp/README !winrt { SUBPROGRAMS = desktopsettingsaware modal - win32:!wince: SUBPROGRAMS += wincmdline + win32:SUBPROGRAMS += wincmdline for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}" } diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index b7e8cded7a..f942f78b1d 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -52,15 +52,9 @@ #include <QtWidgets/private/qapplication_p.h> #include <QtWidgets/QStyle> -#ifdef Q_OS_WINCE -#include <windows.h> -#endif - #include <qpa/qwindowsysteminterface.h> #include <private/qhighdpiscaling_p.h> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt) { @@ -235,10 +229,6 @@ static char *argv0; tst_QApplication::tst_QApplication() : quitApplicationTriggered(false) { -#ifdef Q_OS_WINCE - // Clean up environment previously to launching test - qputenv("QT_PLUGIN_PATH", QByteArray()); -#endif } void tst_QApplication::cleanup() @@ -897,19 +887,8 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r) #define QT_TST_QAPP_DEBUG void tst_QApplication::libraryPaths() { -#ifndef Q_OS_WINCE const QString testDir = QFileInfo(QFINDTESTDATA("test/test.pro")).absolutePath(); QVERIFY(!testDir.isEmpty()); -#else // !Q_OS_WINCE - // On Windows CE we need QApplication object to have valid - // current Path. Therefore we need to identify it ourselves - // here for the test. - QFileInfo filePath; - wchar_t module_name[MAX_PATH]; - GetModuleFileName(0, module_name, MAX_PATH); - filePath = QString::fromWCharArray(module_name); - const QString testDir = filePath.path() + "/test"; -#endif // Q_OS_WINCE { QApplication::setLibraryPaths(QStringList() << testDir); QCOMPARE(QApplication::libraryPaths(), (QStringList() << testDir)); @@ -1000,11 +979,7 @@ void tst_QApplication::libraryPaths() QString appDirPath = app.applicationDirPath(); app.addLibraryPath(appDirPath); -#ifdef Q_OS_WINCE - app.addLibraryPath(appDirPath + "/../.."); -#else app.addLibraryPath(appDirPath + "/.."); -#endif #ifdef QT_TST_QAPP_DEBUG qDebug() << "appDirPath" << appDirPath; qDebug() << "After adding appDirPath && appDirPath + /..:" << app.libraryPaths(); @@ -1044,15 +1019,9 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() QByteArray nonExistentPath = "/nonexistent"; QByteArray pluginPath = validPath + ':' + nonExistentPath; #elif defined(Q_OS_WIN) -# ifdef Q_OS_WINCE - QByteArray validPath = "/Temp"; - QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ';' + nonExistentPath; -# else QByteArray validPath = "C:\\windows"; QByteArray nonExistentPath = "Z:\\nonexistent"; QByteArray pluginPath = validPath + ';' + nonExistentPath; -# endif #endif { @@ -1069,9 +1038,7 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() << QLibraryInfo::location(QLibraryInfo::PluginsPath) << QDir(app.applicationDirPath()).canonicalPath() << QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath(); -# ifdef Q_OS_WINCE - expected = QSet<QString>::fromList(expected).toList(); -# endif + QVERIFY2(isPathListIncluded(app.libraryPaths(), expected), qPrintable("actual:\n - " + app.libraryPaths().join("\n - ") + "\nexpected:\n - " + expected.join("\n - "))); @@ -1091,9 +1058,6 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() QStringList() << QLibraryInfo::location(QLibraryInfo::PluginsPath) << app.applicationDirPath(); -# ifdef Q_OS_WINCE - expected = QSet<QString>::fromList(expected).toList(); -# endif QVERIFY(isPathListIncluded(app.libraryPaths(), expected)); qputenv("QT_PLUGIN_PATH", QByteArray()); @@ -1479,10 +1443,6 @@ void tst_QApplication::desktopSettingsAware() } QVERIFY2(!path.isEmpty(), "Cannot locate desktopsettingsaware helper application"); path += "desktopsettingsaware"; -#ifdef Q_OS_WINCE - int argc = 0; - QApplication tmpApp(argc, 0); -#endif QProcess testProcess; testProcess.start(path); QVERIFY2(testProcess.waitForStarted(), @@ -2331,7 +2291,7 @@ Q_GLOBAL_STATIC(QPixmap, tst_qapp_pixmap); Q_GLOBAL_STATIC(QFont, tst_qapp_font); Q_GLOBAL_STATIC(QRegion, tst_qapp_region); Q_GLOBAL_STATIC(QFontDatabase, tst_qapp_fontDatabase); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR Q_GLOBAL_STATIC(QCursor, tst_qapp_cursor); #endif @@ -2356,7 +2316,7 @@ void tst_QApplication::globalStaticObjectDestruction() QVERIFY(tst_qapp_font()); QVERIFY(tst_qapp_region()); QVERIFY(tst_qapp_fontDatabase()); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QVERIFY(tst_qapp_cursor()); #endif } diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index a19f4aea56..b7ca5d21c7 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -84,6 +84,12 @@ private slots: void insertRow_QString_QLayout(); void insertRow_QWidget(); void insertRow_QLayout(); + void removeRow(); + void removeRow_QWidget(); + void removeRow_QLayout(); + void takeRow(); + void takeRow_QWidget(); + void takeRow_QLayout(); void setWidget(); void setLayout(); @@ -687,6 +693,237 @@ void tst_QFormLayout::insertRow_QLayout() // ### come back to this later } +void tst_QFormLayout::removeRow() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + layout->removeRow(1); + + QVERIFY(!w1); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + layout->removeRow(0); + + QVERIFY(!w2); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); +} + +void tst_QFormLayout::removeRow_QWidget() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + layout->removeRow(w1); + + QVERIFY(!w1); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + layout->removeRow(w2); + + QVERIFY(!w2); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QWidget *w3 = new QWidget; + layout->removeRow(w3); + delete w3; +} + +void tst_QFormLayout::removeRow_QLayout() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QHBoxLayout> l1 = new QHBoxLayout; + QPointer<QWidget> w1 = new QWidget; + l1->addWidget(w1); + QPointer<QHBoxLayout> l2 = new QHBoxLayout; + QPointer<QWidget> w2 = new QWidget; + l2->addWidget(w2); + + layout->addRow("test1", l1); + layout->addRow(l2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + layout->removeRow(l1); + + QVERIFY(!l1); + QVERIFY(!w1); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + layout->removeRow(l2); + + QVERIFY(!l2); + QVERIFY(!w2); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QHBoxLayout *l3 = new QHBoxLayout; + layout->removeRow(l3); + delete l3; +} + +void tst_QFormLayout::takeRow() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + QFormLayout::TakeRowResult result = layout->takeRow(1); + + QVERIFY(w2); + QVERIFY(result.fieldItem); + QVERIFY(result.labelItem); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + result = layout->takeRow(0); + + QVERIFY(w1); + QVERIFY(result.fieldItem); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + result = layout->takeRow(0); + + QVERIFY(!result.fieldItem); + QVERIFY(!result.labelItem); +} + +void tst_QFormLayout::takeRow_QWidget() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QWidget> w1 = new QWidget; + QPointer<QWidget> w2 = new QWidget; + + layout->addRow("test1", w1); + layout->addRow(w2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + QFormLayout::TakeRowResult result = layout->takeRow(w1); + + QVERIFY(w1); + QVERIFY(result.fieldItem); + QVERIFY(result.labelItem); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + result = layout->takeRow(w2); + + QVERIFY(w2); + QVERIFY(result.fieldItem); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QWidget *w3 = new QWidget; + result = layout->takeRow(w3); + delete w3; + + QVERIFY(!result.fieldItem); + QVERIFY(!result.labelItem); +} + +void tst_QFormLayout::takeRow_QLayout() +{ + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QPointer<QHBoxLayout> l1 = new QHBoxLayout; + QPointer<QWidget> w1 = new QWidget; + l1->addWidget(w1); + QPointer<QHBoxLayout> l2 = new QHBoxLayout; + QPointer<QWidget> w2 = new QWidget; + l2->addWidget(w2); + + layout->addRow("test1", l1); + layout->addRow(l2); + + QCOMPARE(layout->count(), 3); + QCOMPARE(layout->rowCount(), 2); + + QFormLayout::TakeRowResult result = layout->takeRow(l1); + + QVERIFY(l1); + QVERIFY(w1); + QVERIFY(result.fieldItem); + QVERIFY(result.labelItem); + QCOMPARE(layout->count(), 1); + QCOMPARE(layout->rowCount(), 1); + + result = layout->takeRow(l2); + + QVERIFY(l2); + QVERIFY(w2); + QVERIFY(result.fieldItem); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 0); + QCOMPARE(layout->rowCount(), 0); + + QHBoxLayout *l3 = new QHBoxLayout; + result = layout->takeRow(l3); + delete l3; + + QVERIFY(!result.fieldItem); + QVERIFY(!result.labelItem); +} + void tst_QFormLayout::setWidget() { QFormLayout layout; diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 07dcfca28f..3c4c1a1d41 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -56,7 +56,6 @@ class tst_QGridLayout : public QObject Q_OBJECT private slots: - void initTestCase(); void cleanup(); void getItemPosition(); void itemAtPosition(); @@ -81,17 +80,11 @@ private slots: void taskQTBUG_27420_takeAtShouldUnparentLayout(); void taskQTBUG_40609_addingWidgetToItsOwnLayout(); void taskQTBUG_40609_addingLayoutToItself(); + void taskQTBUG_52357_spacingWhenItemIsHidden(); void replaceWidget(); void dontCrashWhenExtendsToEnd(); }; -void tst_QGridLayout::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - static inline int visibleTopLevelWidgetCount() { int result= 0; @@ -603,19 +596,6 @@ void tst_QGridLayout::spacingsAndMargins_data() << QPoint( 20, child_offset_y) << QPoint( 20, child_offset_y + 100 + 6) ); -#if defined (Q_OS_WINCE) //There is not enough screenspace to run the test in original size on Windows CE. We use smaller widgets. - child_offset_y = 11 + 9 + 50 + 6 + 50 + 6 + 50 + 6; - QTest::newRow("1x3 grid") << 1 << 3 << QSize(50, 50) - << (PointList() // toplevel - << QPoint( 11, 11) - << QPoint( 11, 11 + 50 + 6) - << QPoint( 11, 11 + 50 + 6 + 50 + 6) - // children - << QPoint( 20, child_offset_y) - << QPoint( 20, child_offset_y + 50 + 6) - << QPoint( 20, child_offset_y + 50 + 6 + 50 + 6) - ); -#else child_offset_y = 11 + 9 + 100 + 6 + 100 + 6 + 100 + 6; QTest::newRow("1x3 grid") << 1 << 3 << QSize(100, 100) << (PointList() // toplevel @@ -627,7 +607,6 @@ void tst_QGridLayout::spacingsAndMargins_data() << QPoint( 20, child_offset_y + 100 + 6) << QPoint( 20, child_offset_y + 100 + 6 + 100 + 6) ); -#endif child_offset_y = 11 + 9 + 100 + 6 + 100 + 6; QTest::newRow("2x2 grid") << 2 << 2 << QSize(100, 100) @@ -1672,6 +1651,26 @@ void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){ QCOMPARE(layout.count(), 0); } +void tst_QGridLayout::taskQTBUG_52357_spacingWhenItemIsHidden() +{ + QWidget widget; + setFrameless(&widget); + QGridLayout layout(&widget); + layout.setMargin(0); + layout.setSpacing(5); + QPushButton button1; + layout.addWidget(&button1, 0, 0); + QPushButton button2; + layout.addWidget(&button2, 0, 1); + QPushButton button3; + layout.addWidget(&button3, 0, 2); + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + int tempWidth = button1.width() + button2.width() + button3.width() + 2 * layout.spacing(); + button2.hide(); + QTRY_COMPARE_WITH_TIMEOUT(tempWidth, button1.width() + button3.width() + layout.spacing(), 1000); +} + void tst_QGridLayout::replaceWidget() { QWidget wdg; diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 2213767950..d460785158 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -4,13 +4,7 @@ TARGET = tst_qlayout QT += widgets widgets-private testlib SOURCES += tst_qlayout.cpp -wince* { - addFiles.files = baseline - addFiles.path = . - DEPLOYMENT += addFiles -} else { - TESTDATA += baseline/* -} +TESTDATA += baseline/* android { RESOURCES += \ diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index a3fd622896..ba4e51a416 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -20,4 +20,4 @@ x11 { LIBS += $$QMAKE_LIBS_X11 } -win32:!wince:!winrt: LIBS += -luser32 -lgdi32 +win32:!winrt: LIBS += -luser32 -lgdi32 diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 1a9d7ec4d2..afc9e29864 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -67,15 +67,13 @@ #include <QtGui/qwindow.h> #include <qtimer.h> -#include "../../../qtest-config.h" - #if defined(Q_OS_MAC) #include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile. #endif #include <QtTest/QTest> -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !Q_OS_WINRT # include <QtCore/qt_windows.h> # include <QtGui/private/qguiapplication_p.h> #include <qpa/qplatformnativeinterface.h> @@ -91,49 +89,12 @@ static HWND winHandleOf(const QWidget *w) return 0; } -# ifdef Q_OS_WINCE -# define Q_CHECK_PAINTEVENTS -# ifdef Q_OS_WINCE_WM -# include <qguifunctions_wince.h> -// taken from qguifunctions_wce.cpp -# define SPI_GETPLATFORMTYPE 257 -static bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); } -# endif // Q_OS_WINCE_WM -# elif !defined(Q_OS_WINRT) // Q_OS_WINCE -# define Q_CHECK_PAINTEVENTS \ +# define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ QSKIP("desktop is not visible, this test would fail"); -# else // !Q_OS_WINCE && !Q_OS_WINRT -# define Q_CHECK_PAINTEVENTS -# endif // Q_OS_WINRT -#else // Q_OS_WIN + +#else // Q_OS_WIN && !Q_OS_WINRT # define Q_CHECK_PAINTEVENTS -#endif // else Q_OS_WIN - - -#if defined(Q_OS_WINCE_WM) -#include <qguifunctions_wince.h> -// taken from qguifunctions_wce.cpp -#define SPI_GETPLATFORMTYPE 257 -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} #endif #ifdef Q_OS_MAC @@ -163,7 +124,7 @@ static inline void centerOnScreen(QWidget *w) w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static inline void setWindowsAnimationsEnabled(bool enabled) { ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled }; @@ -176,10 +137,10 @@ static inline bool windowsAnimationsEnabled() SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0); return animation.iMinAnimate; } -#else // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#else // Q_OS_WIN && !Q_OS_WINRT inline void setWindowsAnimationsEnabled(bool) {} static inline bool windowsAnimationsEnabled() { return false; } -#endif // !Q_OS_WIN || Q_OS_WINCE || Q_OS_WINRT +#endif // !Q_OS_WIN || Q_OS_WINRT template <class T> static QByteArray msgComparisonFailed(T v1, const char *op, T v2) @@ -251,9 +212,7 @@ private slots: void hideWhenFocusWidgetIsChild(); void normalGeometry(); void setGeometry(); -#ifndef Q_OS_WINCE void windowOpacity(); -#endif void raise(); void lower(); void stackUnder(); @@ -315,7 +274,7 @@ private slots: void subtractOpaqueSiblings(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) void setGeometry_win(); #endif @@ -323,7 +282,7 @@ private slots: void deleteStyle(); void multipleToplevelFocusCheck(); void setFocus(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setCursor(); #endif void setToolTip(); @@ -340,9 +299,7 @@ private slots: void render_task188133(); void render_task211796(); void render_task217815(); -#ifndef Q_OS_WINCE void render_windowOpacity(); -#endif void render_systemClip(); void render_systemClip2_data(); void render_systemClip2(); @@ -358,9 +315,7 @@ private slots: void repaintWhenChildDeleted(); void hideOpaqueChildWhileHidden(); -#if !defined(Q_OS_WINCE) void updateWhileMinimized(); -#endif void alienWidgets(); void adjustSize(); void adjustSize_data(); @@ -396,7 +351,7 @@ private slots: void setClearAndResizeMask(); void maskedUpdate(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void syntheticEnterLeave(); void taskQTBUG_4055_sendSyntheticEnterLeave(); void underMouse(); @@ -408,9 +363,7 @@ private slots: void toplevelLineEditFocus(); void focusWidget_task254563(); -#ifndef Q_OS_WINCE_WM void rectOutsideCoordinatesLimit_task144779(); -#endif void setGraphicsEffect(); #ifdef QT_BUILD_INTERNAL @@ -613,7 +566,7 @@ void tst_QWidget::getSetCheck() QCOMPARE(true, obj1.autoFillBackground()); var1.reset(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP); @@ -657,9 +610,6 @@ private: void tst_QWidget::initTestCase() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif // Size of reference widget, 200 for < 2000, scale up for larger screens // to avoid Windows warnings about minimum size for decorated windows. int width = 200; @@ -1507,7 +1457,7 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) +#if !defined(Q_OS_QNX) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -1820,15 +1770,8 @@ void tst_QWidget::activation() { Q_CHECK_PAINTEVENTS -#if defined(Q_OS_WINCE) - int waitTime = 1000; -#else int waitTime = 100; -#endif -#ifdef Q_OS_WINCE - qApp->processEvents(); -#endif QWidget widget1; widget1.setObjectName("activation-Widget1"); widget1.setWindowTitle(widget1.objectName()); @@ -1876,10 +1819,6 @@ void tst_QWidget::windowState() size = QGuiApplication::primaryScreen()->size(); } else { pos = QPoint(10, 10); -#ifdef Q_OS_WINCE_WM - if (qt_wince_is_smartphone()) { //small screen - size = QSize(100,100); -#endif } QWidget widget1; @@ -2407,11 +2346,7 @@ void tst_QWidget::reparent() childTLW.show(); QVERIFY(QTest::qWaitForWindowExposed(&parent)); -#ifdef Q_OS_WINCE - parent.move(50, 50); -#else parent.move(parentPosition); -#endif QPoint childPos = parent.mapToGlobal(child.pos()); QPoint tlwPos = childTLW.pos(); @@ -2618,8 +2553,6 @@ void tst_QWidget::setGeometry() QCOMPARE(tlw.geometry(), tr); } -// Windows CE does not support windowOpacity. -#ifndef Q_OS_WINCE void tst_QWidget::windowOpacity() { QWidget widget; @@ -2650,7 +2583,6 @@ void tst_QWidget::windowOpacity() child.setWindowOpacity(-1.0); QCOMPARE(child.windowOpacity(), 1.0); } -#endif class UpdateWidget : public QWidget { @@ -2970,9 +2902,6 @@ void tst_QWidget::stackUnder() foreach (UpdateWidget *child, allChildren) { int expectedZOrderChangeEvents = child == child1 ? 1 : 0; if (child == child3) { -#ifdef Q_OS_WINCE - qApp->processEvents(); -#endif #ifndef Q_OS_MAC QEXPECT_FAIL(0, "See QTBUG-493", Continue); #endif @@ -3342,9 +3271,6 @@ void tst_QWidget::widgetAt() w2->setMask(rgn); qApp->processEvents(); QTest::qWait(10); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191 -#endif QTRY_VERIFY((wr = QApplication::widgetAt(testPos))); QTRY_COMPARE(wr->objectName(), w1->objectName()); @@ -3360,9 +3286,6 @@ void tst_QWidget::widgetAt() w2->setMask(bitmap); qApp->processEvents(); QTest::qWait(10); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191 -#endif QTRY_COMPARE(QApplication::widgetAt(testPos), w1.data()); QTRY_VERIFY(QApplication::widgetAt(testPos + QPoint(1, 1)) == w2.data()); } @@ -3698,7 +3621,7 @@ void tst_QWidget::optimizedResize_topLevel() topLevel.partial = false; topLevel.paintedRegion = QRegion(); -#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN32) topLevel.resize(topLevel.size() + QSize(10, 10)); #else // Static contents does not work when programmatically resizing @@ -3769,7 +3692,6 @@ void tst_QWidget::setMinimumSize() // Setting a minimum size larger than the desktop does not work on WinCE, // so skip this part of the test. -#ifndef Q_OS_WINCE QSize nonDefaultSize = defaultSize + QSize(5,5); w.setMinimumSize(nonDefaultSize); w.showNormal(); @@ -3778,7 +3700,6 @@ void tst_QWidget::setMinimumSize() msgComparisonFailed(w.height(), ">=", nonDefaultSize.height())); QVERIFY2(w.width() >= nonDefaultSize.width(), msgComparisonFailed(w.width(), ">=", nonDefaultSize.width())); -#endif } void tst_QWidget::setMaximumSize() @@ -4714,7 +4635,7 @@ void tst_QWidget::setWindowGeometry() } } -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QWidget::setGeometry_win() { QWidget widget; @@ -4735,7 +4656,7 @@ void tst_QWidget::setGeometry_win() QVERIFY2(rt.top <= m_availableTopLeft.y(), msgComparisonFailed(int(rt.top), "<=", m_availableTopLeft.y())); } -#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINRT) // Since X11 WindowManager operation are all async, and we have no way to know if the window // manager has finished playing with the window geometry, this test can't be reliable on X11. @@ -5060,12 +4981,8 @@ void tst_QWidget::moveChild() parent.setStyle(QStyleFactory::create(QLatin1String("Windows"))); ColorWidget child(&parent, Qt::Widget, Qt::blue); -#ifndef Q_OS_WINCE parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50), QSize(200, 200))); -#else - parent.setGeometry(60, 60, 150, 150); -#endif child.setGeometry(25, 25, 50, 50); #ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting QCursor::setPos(parent.geometry().topRight() + QPoint(50 , 50)); @@ -5503,7 +5420,7 @@ private: int m_count; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::setCursor() { { @@ -5646,8 +5563,6 @@ void tst_QWidget::setToolTip() QCOMPARE(widget.toolTip(), QString()); QCOMPARE(spy.count(), 2); - // Mouse over doesn't work on Windows mobile, so skip the rest of the test for that platform. -#ifndef Q_OS_WINCE_WM for (int pass = 0; pass < 2; ++pass) { QCursor::setPos(0, 0); QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup)); @@ -5675,7 +5590,6 @@ void tst_QWidget::setToolTip() QTest::qWait(2200); // delay is 2000 QTest::mouseMove(popupWindow); } -#endif } void tst_QWidget::testWindowIconChangeEventPropagation() @@ -6754,7 +6668,6 @@ void tst_QWidget::render_task217815() } // Window Opacity is not supported on Windows CE. -#ifndef Q_OS_WINCE void tst_QWidget::render_windowOpacity() { const qreal opacity = 0.5; @@ -6827,7 +6740,6 @@ void tst_QWidget::render_windowOpacity() QCOMPARE(result, expected); } } -#endif void tst_QWidget::render_systemClip() { @@ -7285,14 +7197,10 @@ void tst_QWidget::repaintWhenChildDeleted() } #endif ColorWidget w(0, Qt::FramelessWindowHint, Qt::red); -#if !defined(Q_OS_WINCE) QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft(); startPoint.rx() += 50; startPoint.ry() += 50; w.setGeometry(QRect(startPoint, QSize(100, 100))); -#else - w.setGeometry(60, 60, 110, 110); -#endif w.show(); QVERIFY(QTest::qWaitForWindowExposed(&w)); QTest::qWait(10); @@ -7316,14 +7224,10 @@ void tst_QWidget::repaintWhenChildDeleted() void tst_QWidget::hideOpaqueChildWhileHidden() { ColorWidget w(0, Qt::FramelessWindowHint, Qt::red); -#if !defined(Q_OS_WINCE) QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft(); startPoint.rx() += 50; startPoint.ry() += 50; w.setGeometry(QRect(startPoint, QSize(100, 100))); -#else - w.setGeometry(60, 60, 110, 110); -#endif ColorWidget child(&w, Qt::Widget, Qt::blue); child.setGeometry(10, 10, 80, 80); @@ -7352,7 +7256,6 @@ void tst_QWidget::hideOpaqueChildWhileHidden() } // This test doesn't make sense without support for showMinimized(). -#if !defined(Q_OS_WINCE) void tst_QWidget::updateWhileMinimized() { if (m_platform == QStringLiteral("wayland")) @@ -7390,7 +7293,6 @@ void tst_QWidget::updateWhileMinimized() QTRY_COMPARE(widget.numPaintEvents, 1); QCOMPARE(widget.paintedRegion, QRegion(0, 0, 50, 50)); } -#endif class PaintOnScreenWidget: public QWidget { @@ -7757,13 +7659,6 @@ void tst_QWidget::adjustSize() QVERIFY2(child->size().height() < sizeHint.height(), msgComparisonFailed(child->size().height(), "<", sizeHint.height())); } else { -#if defined (Q_OS_WINCE) - if (!haveParent) { - const QRect& desktopRect = qApp->desktop()->availableGeometry(); - expectedSize.setWidth(qMin(expectedSize.width(), desktopRect.width())); - expectedSize.setHeight(qMin(expectedSize.height(), desktopRect.height())); - } -#endif QCOMPARE(child->size(), expectedSize); } if (!haveParent) @@ -8848,7 +8743,7 @@ void tst_QWidget::maskedUpdate() QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update. } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::syntheticEnterLeave() { if (m_platform == QStringLiteral("wayland")) @@ -8954,7 +8849,7 @@ void tst_QWidget::syntheticEnterLeave() } #endif -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() { if (m_platform == QStringLiteral("wayland")) @@ -9169,10 +9064,9 @@ QWidgetBackingStore* backingStore(QWidget &widget) } // Tables of 5000 elements do not make sense on Windows Mobile. -#ifndef Q_OS_WINCE_WM void tst_QWidget::rectOutsideCoordinatesLimit_task144779() { -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs #endif QWidget main(0,Qt::FramelessWindowHint); //don't get confused by the size of the window frame @@ -9207,11 +9101,10 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32), correct.toImage().convertToFormat(QImage::Format_RGB32)); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif } -#endif void tst_QWidget::setGraphicsEffect() { @@ -10155,7 +10048,7 @@ void tst_QWidget::destroyedSignal() } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QWidget::underMouse() { // Move the mouse cursor to a safe location @@ -10439,7 +10332,7 @@ void tst_QWidget::taskQTBUG_27643_enterEvents() // Must only register only single enter on modal dialog's button after all said and done QCOMPARE(dialog.enters, 1); } -#endif // QTEST_NO_CURSOR +#endif // QT_NO_CURSOR class KeyboardWidget : public QWidget { diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 50445b9a45..a1e5a70a08 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -3,12 +3,6 @@ TARGET = tst_qstyle QT += widgets testlib SOURCES += tst_qstyle.cpp -wince* { - addPixmap.files = task_25863.png - addPixmap.path = . - DEPLOYMENT += addPixmap -} - android { RESOURCES += \ testdata.qrc diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index d4f398a61c..bafebc0dc6 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -56,20 +56,6 @@ #include <qlineedit.h> #include <qmdiarea.h> #include <qscrollarea.h> - -#ifdef Q_OS_WINCE_WM -#include <windows.h> - -static bool qt_wince_is_smartphone() { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (QString::fromLatin1("Smartphone").utf16()), tszPlatform)) - return true; - return false; -} -#endif - #include <qwidget.h> // Make a widget frameless to prevent size constraints of title bars @@ -90,7 +76,7 @@ public: private: bool testAllFunctions(QStyle *); - bool testScrollBarSubControls(QStyle *); + bool testScrollBarSubControls(); void testPainting(QStyle *style, const QString &platform); private slots: void drawItemPixmap(); @@ -109,12 +95,6 @@ private slots: #ifdef Q_OS_MAC void testMacStyle(); #endif -#ifdef Q_OS_WINCE - void testWindowsCEStyle(); -#endif -#ifdef Q_OS_WINCE_WM - void testWindowsMobileStyle(); -#endif void testStyleFactory(); void testProxyStyle(); void pixelMetric(); @@ -315,19 +295,11 @@ bool tst_QStyle::testAllFunctions(QStyle *style) style->itemPixmapRect(QRect(0, 0, 100, 100), Qt::AlignHCenter, QPixmap(200, 200)); style->itemTextRect(QFontMetrics(qApp->font()), QRect(0, 0, 100, 100), Qt::AlignHCenter, true, QString("Test")); - return testScrollBarSubControls(style); + return testScrollBarSubControls(); } -bool tst_QStyle::testScrollBarSubControls(QStyle* style) +bool tst_QStyle::testScrollBarSubControls() { - // WinCE SmartPhone doesn't have scrollbar subcontrols, so skip the rest of the test. -#ifdef Q_OS_WINCE_WM - if (style->inherits("QWindowsMobileStyle") && qt_wince_is_smartphone()) - return true; -#else - Q_UNUSED(style); -#endif - QScrollBar scrollBar; setFrameless(&scrollBar); scrollBar.show(); @@ -522,26 +494,6 @@ void tst_QStyle::testMacStyle() } #endif -#ifdef Q_OS_WINCE -// WindowsCEStyle style -void tst_QStyle::testWindowsCEStyle() -{ - QStyle *cstyle = QStyleFactory::create("WindowsCE"); - QVERIFY(testAllFunctions(cstyle)); - delete cstyle; -} -#endif - -#ifdef Q_OS_WINCE_WM -// WindowsMobileStyle style -void tst_QStyle::testWindowsMobileStyle() -{ - QStyle *cstyle = QStyleFactory::create("WindowsMobile"); - QVERIFY(testAllFunctions(cstyle)); - delete cstyle; -} -#endif - // Helper class... MyWidget::MyWidget( QWidget* parent, const char* name ) diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST index cf78fb47c2..61966e684f 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST +++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST @@ -1,2 +1,4 @@ [hoverColors] ubuntu-14.04 +opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index a107260d23..8d84addedb 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -34,8 +34,6 @@ #include <private/qstylesheetstyle_p.h> -#include "../../../qtest-config.h" - static inline void centerOnScreen(QWidget *w) { const QPoint offset = QPoint(w->width() / 2, w->height() / 2); @@ -76,7 +74,7 @@ private slots: void onWidgetDestroyed(); void fontPrecedence(); void focusColors(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void hoverColors(); #endif void background(); @@ -887,7 +885,7 @@ void tst_QStyleSheetStyle::focusColors() } } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QStyleSheetStyle::hoverColors() { #ifdef Q_OS_OSX diff --git a/tests/auto/widgets/styles/styles.pro b/tests/auto/widgets/styles/styles.pro index 0de9dfcdab..b679b70537 100644 --- a/tests/auto/widgets/styles/styles.pro +++ b/tests/auto/widgets/styles/styles.pro @@ -12,5 +12,5 @@ SUBDIRS=\ !mac:SUBDIRS -= \ qmacstyle \ -ios|android|qnx|wince: SUBDIRS -= \ +ios|android|qnx: SUBDIRS -= \ qstylesheetstyle \ diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index b2824c00ee..3a3e38ba75 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -585,10 +585,7 @@ void tst_QCompleter::directoryModel_data() if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; -#if defined(Q_OS_WINCE) - QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files"; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) QTest::newRow("()") << "C" << "" << "C:" << "C:"; QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) @@ -634,10 +631,7 @@ void tst_QCompleter::fileSystemModel_data() if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; -#if defined(Q_OS_WINCE) - QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files"; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) QTest::newRow("()") << "C" << "" << "C:" << "C:"; QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp index a932cf5984..616898c4c5 100644 --- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp @@ -107,9 +107,6 @@ void tst_QSystemTrayIcon::getSetCheck() void tst_QSystemTrayIcon::supportsMessages() { // ### fixme: Check platforms. -#if defined(Q_OS_WINCE) - QCOMPARE(QSystemTrayIcon::supportsMessages(), false); -#else const QString platform = QGuiApplication::platformName(); if (platform.compare(QStringLiteral("xcb"), Qt::CaseInsensitive) && platform.compare(QStringLiteral("windows"), Qt::CaseInsensitive) @@ -117,7 +114,6 @@ void tst_QSystemTrayIcon::supportsMessages() QEXPECT_FAIL("", "QTBUG-20978 QSystemTrayIcon is unimplemented for this platform", Abort); } QCOMPARE(QSystemTrayIcon::supportsMessages(), true); -#endif } void tst_QSystemTrayIcon::lastWindowClosed() diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 2a356f574c..1ae33ef7a1 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -78,9 +78,6 @@ class tst_QComboBox : public QObject public: tst_QComboBox() {} -public slots: - void init(); - private slots: void getSetCheck(); void ensureReturnIsIgnored(); @@ -395,13 +392,6 @@ private: }; -void tst_QComboBox::init() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QComboBox::setEditable() { TestWidget topLevel; @@ -2752,7 +2742,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QCOMPARE(combo.currentText(), QLatin1String("0")); // When calling cursor function, Windows CE responds with: This function is not supported on this system. -#if !defined Q_OS_WINCE && !defined Q_OS_QNX +#if !defined Q_OS_QNX // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: centerCursor(combo.view()); QTest::qWait(200); diff --git a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro index 411185ae2a..c4bc1cab21 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro +++ b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qdatetimeedit QT += widgets testlib core-private widgets-private SOURCES += tst_qdatetimeedit.cpp - -wincewm50smart-msvc2005: DEFINES += WINCE_NO_MODIFIER_KEYS diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 831d7257ba..28c2e92f78 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -84,30 +84,6 @@ Q_DECLARE_METATYPE(Qt::Key); Q_DECLARE_METATYPE(Qt::KeyboardModifiers); Q_DECLARE_METATYPE(Qt::KeyboardModifier); -#if defined(Q_OS_WINCE) -#ifndef SPI_GETPLATFORMTYPE -#define SPI_GETPLATFORMTYPE 257 -#endif - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} -#endif - class EditorDateEdit : public QDateTimeEdit { Q_OBJECT @@ -331,7 +307,7 @@ void tst_QDateTimeEdit::cleanupTestCase() void tst_QDateTimeEdit::init() { QLocale::setDefault(QLocale(QLocale::C)); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have @@ -3107,7 +3083,7 @@ void tst_QDateTimeEdit::nextPrevSection_data() // 1. mac doesn't do these, // 2. some WinCE devices do not have modifiers -#if !defined(Q_OS_MAC) && !defined(WINCE_NO_MODIFIER_KEYS) +#if !defined(Q_OS_DARWIN) QTest::newRow("ctrl-right") << Qt::Key_Right << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("56"); QTest::newRow("ctrl-left") << Qt::Key_Left << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("12"); #endif diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 598b518810..a4614d0a9d 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -70,8 +70,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE @@ -252,7 +250,7 @@ private slots: void noTextEditedOnClear(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); #endif @@ -3484,7 +3482,7 @@ void tst_QLineEdit::textMargin() QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QLineEdit::cursor() { QLineEdit *testWidget = ensureTestWidget(); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 5bd26c632c..9f8d4e4588 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -45,8 +45,6 @@ #include <private/qmainwindowlayout_p.h> #include <private/qdockarealayout_p.h> -#include "../../../qtest-config.h" - static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xc1, 0x0, 0x0, 0x1, 0x19}; static uchar restoreData42[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3, 0x8a, 0x0, 0x0, 0x2, 0x2b, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8}; static uchar restoreData43[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0xa0, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x53, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0xa5, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x0, 0xa0, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0x53, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0xa5, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x1, 0xa8, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0xd6, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x1, 0xa8, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xd6, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xb8, 0x0, 0x0, 0x0, 0xa0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0xfc, 0x0, 0x0, 0x0, 0x0}; @@ -131,7 +129,7 @@ private slots: void contentsMargins_data(); void contentsMargins(); void isSeparator(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setCursor(); #endif void addToolbarAfterShow(); @@ -595,9 +593,6 @@ void tst_QMainWindow::menuBar() mw.setMenuBar(mb1); QVERIFY(mw.menuBar() != 0); QCOMPARE(mw.menuBar(), (QMenuBar *)mb1); -#ifdef Q_OS_WINCE_WM - QSKIP("With native menubar integration the menubar is not a child"); -#endif QCOMPARE(mb1->parentWidget(), (QWidget *)&mw); mw.setMenuBar(0); @@ -1728,7 +1723,7 @@ class MainWindow : public QMainWindow { using QMainWindow::event; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QMainWindow::setCursor() { MainWindow mw; diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 607fc1625a..db7edb346d 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -228,7 +228,6 @@ class tst_QMdiArea : public QObject public: tst_QMdiArea(); public slots: - void initTestCase(); void cleanup(); protected slots: @@ -293,13 +292,6 @@ tst_QMdiArea::tst_QMdiArea() qRegisterMetaType<QMdiSubWindow *>(); } -void tst_QMdiArea::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QMdiArea::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -508,9 +500,6 @@ void tst_QMdiArea::subWindowActivated2() if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "showMinimized doesn't really minimize if you don't have access to the server", Abort); #endif -#ifdef Q_OS_WINCE - QSKIP("Not fixed yet. See Task 197453"); -#endif #ifdef Q_OS_MAC QSKIP("QTBUG-25298: This test is unstable on Mac."); #endif @@ -648,7 +637,7 @@ void tst_QMdiArea::changeWindowTitle() #else widget->setWindowState(Qt::WindowMaximized); #endif -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif @@ -657,7 +646,7 @@ void tst_QMdiArea::changeWindowTitle() mw->show(); QVERIFY(QTest::qWaitForWindowExposed(mw)); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif @@ -675,7 +664,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); widget->setWindowTitle( wc2 ); QCOMPARE( mw->windowTitle(), windowTitle(mwc, wc2) ); @@ -693,7 +682,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW @@ -702,7 +691,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowNoState); #endif qApp->processEvents(); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) QCOMPARE(mw->windowTitle(), mwc); #else QCOMPARE( mw->windowTitle(), mwc2 ); @@ -714,7 +703,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif @@ -763,7 +752,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( mw->isWindowModified(), false); QCOMPARE( widget->isWindowModified(), true); widget->setWindowState(Qt::WindowMaximized); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -773,7 +762,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( widget->isWindowModified(), true); widget->setWindowState(Qt::WindowMaximized); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -783,7 +772,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( widget->isWindowModified(), false); widget->setWindowModified(true); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -1597,9 +1586,7 @@ void tst_QMdiArea::tileSubWindows() qApp->processEvents(); } workspace.setActiveSubWindow(0); -#ifndef Q_OS_WINCE //See Task 197453 ToDo QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); -#endif QMdiSubWindow *window = windows.at(0); @@ -1723,9 +1710,6 @@ void tst_QMdiArea::tileSubWindows() frameWidth = workspace.style()->pixelMetric(QStyle::PM_DefaultFrameWidth); const int spacing = 2 * frameWidth + 2; const QSize expectedViewportSize(3 * minSize.width() + spacing, 3 * minSize.height() + spacing); -#ifdef Q_OS_WINCE - QSKIP("Not fixed yet! See task 197453"); -#endif QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); // Restore original scrollbar behavior for test below @@ -2004,7 +1988,7 @@ void tst_QMdiArea::delayedPlacement() void tst_QMdiArea::iconGeometryInMenuBar() { -#if !defined (Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QMainWindow mainWindow; QMenuBar *menuBar = mainWindow.menuBar(); menuBar->setNativeMenuBar(false); @@ -2062,11 +2046,7 @@ void tst_QMdiArea::resizeTimer() mdiArea.show(); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); -#ifndef Q_OS_WINCE int time = 250; -#else - int time = 1000; -#endif EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index fe5c3a14a0..086c1049ab 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -48,8 +48,6 @@ #include <QScreen> #include <QSizeGrip> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE #if !defined(Q_DEAD_CODE_FROM_QT4_WIN) extern bool qt_tab_all_widgets(); @@ -161,7 +159,7 @@ private slots: void showShaded(); void showNormal_data(); void showNormal(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setOpaqueResizeAndMove_data(); void setOpaqueResizeAndMove(); #endif @@ -184,7 +182,7 @@ private slots: void explicitlyHiddenWidget(); void resizeTimer(); void fixedMinMaxSize(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) void replaceMenuBarWhileMaximized(); void closeOnDoubleClick_data(); void closeOnDoubleClick(); @@ -361,7 +359,7 @@ void tst_QMdiSubWindow::mainWindowSupport() qApp->setActiveWindow(&mainWindow); // QMainWindow's window title is empty -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) { QCOMPARE(mainWindow.windowTitle(), QString()); QMdiSubWindow *window = workspace->addSubWindow(new QPushButton(QLatin1String("Test"))); @@ -413,7 +411,7 @@ void tst_QMdiSubWindow::mainWindowSupport() window->showMaximized(); qApp->processEvents(); QVERIFY(window->isMaximized()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QVERIFY(window->maximizedButtonsWidget()); QCOMPARE(window->maximizedButtonsWidget(), mainWindow.menuBar()->cornerWidget(Qt::TopRightCorner)); QVERIFY(window->maximizedSystemMenuIconWidget()); @@ -436,13 +434,13 @@ void tst_QMdiSubWindow::mainWindowSupport() QVERIFY(!nestedWindow->maximizedButtonsWidget()); QVERIFY(!nestedWindow->maximizedSystemMenuIconWidget()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) +#if !defined(Q_OS_DARWIN) && !defined(Q_OS_QNX) QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") .arg(originalWindowTitle, window->widget()->windowTitle())); #endif } -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) return; #endif @@ -576,10 +574,6 @@ void tst_QMdiSubWindow::showShaded() window->showNormal(); QTest::qWait(250); -#ifdef Q_OS_WINCE - QSKIP("Until we have a QEvent::WindowFlagsChange event, this will skip"); -#endif - const QSize minimumSizeHint = window->minimumSizeHint(); QVERIFY(minimumSizeHint.height() < 300); const int maxHeightDiff = 300 - minimumSizeHint.height(); @@ -670,7 +664,7 @@ private: int _count; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() { QTest::addColumn<bool>("opaqueMode"); @@ -1011,7 +1005,7 @@ void tst_QMdiSubWindow::setSystemMenu() systemMenu->hide(); QVERIFY(!qApp->activePopupWidget()); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) // System menu in menu bar. subWindow->showMaximized(); QVERIFY(subWindow->isMaximized()); @@ -1044,7 +1038,7 @@ void tst_QMdiSubWindow::setSystemMenu() systemMenu->hide(); QVERIFY(!qApp->activePopupWidget()); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) // System menu in menu bar in reverse mode. subWindow->showMaximized(); QVERIFY(subWindow->isMaximized()); @@ -1475,7 +1469,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner)); QMdiSubWindow *subWindow = mdiArea->addSubWindow(new QTextEdit); subWindow->showMaximized(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); #endif @@ -1490,7 +1484,7 @@ void tst_QMdiSubWindow::hideAndShow() // Show QMdiArea. tabWidget->setCurrentIndex(0); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); @@ -1512,7 +1506,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(subWindow); QCOMPARE(mdiArea->activeSubWindow(), subWindow); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); #if defined Q_OS_QNX QEXPECT_FAIL("", "QTBUG-38231", Abort); @@ -1540,7 +1534,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner)); subWindow->show(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); @@ -1554,7 +1548,7 @@ void tst_QMdiSubWindow::hideAndShow() // Show QMainWindow. mainWindow.show(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); @@ -1724,7 +1718,7 @@ void tst_QMdiSubWindow::fixedMinMaxSize() QCOMPARE(subWindow->size(), minimumSize); } -#if !defined( Q_OS_MAC) && !defined( Q_OS_WINCE) +#if !defined( Q_OS_DARWIN) void tst_QMdiSubWindow::replaceMenuBarWhileMaximized() { @@ -1911,7 +1905,7 @@ void tst_QMdiSubWindow::mdiArea() void tst_QMdiSubWindow::task_182852() { -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QMdiArea *workspace = new QMdiArea; QMainWindow mainWindow; diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index c3b432788b..654e1899f0 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -81,9 +81,7 @@ private slots: void overrideMenuAction(); void statusTip(); void widgetActionFocus(); -#ifndef Q_OS_WINCE void mouseActivation(); -#endif void tearOff(); void layoutDirection(); @@ -95,9 +93,7 @@ private slots: void task250673_activeMultiColumnSubMenuPosition(); void task256918_setFont(); void menuSizeHint(); -#ifndef Q_OS_WINCE void task258920_mouseBorder(); -#endif void setFixedWidth(); void deleteActionInTriggered(); void pushButtonPopulateOnAboutToShow(); @@ -292,8 +288,6 @@ void tst_QMenu::addActionsConnect() #endif // !QT_NO_SHORTCUT } -// We have a separate mouseActivation test for Windows mobile -#ifndef Q_OS_WINCE void tst_QMenu::mouseActivation() { QWidget topLevel; @@ -333,7 +327,6 @@ void tst_QMenu::mouseActivation() QVERIFY(submenu.isVisible()); #endif } -#endif void tst_QMenu::keyboardNavigation_data() { @@ -464,7 +457,7 @@ void tst_QMenu::overrideMenuAction() // On Mac and Windows CE, we need to create native key events to test menu // action activation, so skip this part of the test. -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QAction *aQuit = new QAction("Quit", &w); aQuit->setShortcut(QKeySequence("Ctrl+X")); m->addAction(aQuit); @@ -716,10 +709,8 @@ void tst_QMenu::activeSubMenuPosition() QVERIFY(sub->pos() != QPoint(0,0)); // well, it's enough to check the pos is not (0,0) but it's more safe // to check that submenu is to the right of the main menu too. -#ifndef Q_OS_WINCE_WM QVERIFY(sub->pos().x() > main->pos().x()); QCOMPARE(sub->activeAction(), subAction); -#endif } // QTBUG-49588, QTBUG-48396: activeSubMenuPositionExec() is the same as @@ -771,10 +762,8 @@ private: void tst_QMenu::activeSubMenuPositionExec() { -#ifndef Q_OS_WINCE SubMenuPositionExecMenu menu; menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center()); -#endif // !Q_OS_WINCE } void tst_QMenu::task242454_sizeHint() @@ -908,7 +897,6 @@ public: }; // Mouse move related signals for Windows Mobile unavailable -#ifndef Q_OS_WINCE void tst_QMenu::task258920_mouseBorder() { Menu258920 menu; @@ -937,7 +925,6 @@ void tst_QMenu::task258920_mouseBorder() QTRY_COMPARE(static_cast<QAction*>(0), menu.activeAction()); QTRY_VERIFY(menu.painted); } -#endif void tst_QMenu::setFixedWidth() { diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 3bcdea3137..436a8331f0 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -90,7 +90,7 @@ private slots: void count(); void insertItem_QString_QObject(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void accel(); void activatedCount(); void allowActiveAndDisabled(); @@ -113,7 +113,7 @@ private slots: void check_altPress(); void check_altClosePress(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void check_shortcutPress(); void check_menuPosition(); #endif @@ -308,7 +308,7 @@ inline TestMenu tst_QMenuBar::initWindowWithComplexMenuBar(QMainWindow &w) } // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::accel() { // create a popup menu with menu items set the accelerators later... @@ -326,7 +326,7 @@ void tst_QMenuBar::accel() #endif // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::activatedCount() { // create a popup menu with menu items set the accelerators later... @@ -517,7 +517,7 @@ void tst_QMenuBar::insertItem_QString_QObject() } // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_accelKeys() { QMainWindow w; @@ -590,7 +590,7 @@ void tst_QMenuBar::check_accelKeys() #endif // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys1() { QMainWindow w; @@ -624,7 +624,7 @@ void tst_QMenuBar::check_cursorKeys1() #endif // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys2() { QMainWindow w; @@ -657,7 +657,7 @@ void tst_QMenuBar::check_cursorKeys2() If a popupmenu is active you can use Left to move to the menu to the left of it. */ // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys3() { QMainWindow w; @@ -772,7 +772,7 @@ void tst_QMenuBar::check_endKey() */ // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_escKey() { QMainWindow w; @@ -917,7 +917,7 @@ void tst_QMenuBar::check_escKey() // QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count); // } -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::allowActiveAndDisabled() { QMenuBar menuBar; @@ -1007,7 +1007,7 @@ void tst_QMenuBar::check_altClosePress() } // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_shortcutPress() { QMainWindow w; @@ -1050,7 +1050,7 @@ private: }; // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_menuPosition() { QMainWindow w; @@ -1119,7 +1119,7 @@ void tst_QMenuBar::check_menuPosition() menu.close(); } -# ifndef QTEST_NO_CURSOR +# ifndef QT_NO_CURSOR // QTBUG-28031: Click at bottom-right corner. { w.move(400, 200); @@ -1133,7 +1133,7 @@ void tst_QMenuBar::check_menuPosition() QCOMPARE(menu.geometry().right() - 1, globalPos.x()); menu.close(); } -# endif // QTEST_NO_CURSOR +# endif // QT_NO_CURSOR } #endif @@ -1389,7 +1389,7 @@ void tst_QMenuBar::cornerWidgets() QFETCH(Qt::Corner, corner); -#if defined(Q_OS_OSX) || defined(Q_OS_WINCE) +#if defined(Q_OS_OSX) QSKIP("Test interferes with native menu bars on this platform"); #endif diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index 6ad13cd781..a6d3a84495 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -48,8 +48,6 @@ #include "qplaintextedit.h" #include "../../../shared/platformclipboard.h" -#include "../../../qtest-config.h" - //Used in copyAvailable typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType; typedef QList<keyPairType> pairListType; @@ -64,7 +62,6 @@ public: tst_QPlainTextEdit(); public slots: - void initTestCase(); void init(); void cleanup(); private slots: @@ -104,7 +101,7 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void mouseCursorShape(); #endif void implicitClear(); @@ -208,16 +205,8 @@ void tst_QPlainTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(Q_OS_WINCE) - // due to rounding error in qRound when qreal==float - // we cannot use INT_MAX for this check - obj1.setTabStopWidth(SHRT_MAX*2); - QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth()); -#else obj1.setTabStopWidth(INT_MAX); QCOMPARE(INT_MAX, obj1.tabStopWidth()); -#endif - } class QtTestDocumentLayout : public QAbstractTextDocumentLayout @@ -251,13 +240,6 @@ public: tst_QPlainTextEdit::tst_QPlainTextEdit() {} -void tst_QPlainTextEdit::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QPlainTextEdit::init() { ed = new QPlainTextEdit(0); @@ -896,7 +878,7 @@ void tst_QPlainTextEdit::lineWrapModes() delete window; } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QPlainTextEdit::mouseCursorShape() { // always show an IBeamCursor, see change 170146 diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 302d290c72..7bbbc46b5a 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -526,12 +526,6 @@ void tst_QPushButton::sizeHint_data() #if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista"); #endif -#if defined(Q_OS_WINCE) && !defined(QT_NO_STYLE_WINDOWSCE) - QTest::newRow("windowsce") << QString::fromLatin1("windowsce"); -#endif -#if defined(Q_OS_WINCE_WM) && !defined(QT_NO_STYLE_WINDOWSCE) - QTest::newRow("windowsmobile") << QString::fromLatin1("windowsmobile"); -#endif } void tst_QPushButton::sizeHint() diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro index 92c2f6cb7e..6523209c32 100644 --- a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro +++ b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro @@ -8,4 +8,4 @@ INCLUDEPATH += ../ HEADERS += SOURCES += tst_qtabwidget.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index f8125bf749..2a2331c3bf 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -35,7 +35,7 @@ #include <qlabel.h> #include <QtWidgets/qboxlayout.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <qt_windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -553,9 +553,7 @@ void tst_QTabWidget::paintEventCount() // Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point. static const int MaxInitialPaintCount = -#if defined(Q_OS_WINCE) - 4; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) 2; #elif defined(Q_OS_MAC) 5; diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index f1ebfda88b..7b26489b39 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -55,8 +55,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" - //Used in copyAvailable typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType; typedef QList<keyPairType> pairListType; @@ -125,7 +123,7 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void mouseCursorShape(); #endif void implicitClear(); @@ -276,15 +274,8 @@ void tst_QTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(Q_OS_WINCE) - // due to rounding error in qRound when qreal==float - // we cannot use INT_MAX for this check - obj1.setTabStopWidth(SHRT_MAX*2); - QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth()); -#else obj1.setTabStopWidth(INT_MAX); QCOMPARE(INT_MAX, obj1.tabStopWidth()); -#endif // bool QTextEdit::acceptRichText() // void QTextEdit::setAcceptRichText(bool) @@ -378,10 +369,6 @@ void tst_QTextEdit::cleanupTestCase() void tst_QTextEdit::init() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif - ed = new QTextEdit(0); rootFrameMargin = ed->document()->documentMargin(); } @@ -1230,7 +1217,7 @@ void tst_QTextEdit::lineWrapModes() QCOMPARE(ed->document()->pageSize().width(), qreal(1000)); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QTextEdit::mouseCursorShape() { // always show an IBeamCursor, see change 170146 diff --git a/tests/auto/xml/dom/qdom/qdom.pro b/tests/auto/xml/dom/qdom/qdom.pro index 3248b8e0e2..dd1fa1a75b 100644 --- a/tests/auto/xml/dom/qdom/qdom.pro +++ b/tests/auto/xml/dom/qdom/qdom.pro @@ -4,9 +4,4 @@ SOURCES += tst_qdom.cpp QT = core xml testlib -wince* { - wince*|qt_not_deployed { - DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs - } -} TESTDATA += testdata/* doubleNamespaces.xml umlaut.xml diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index 305f7318a4..3335ff8ffc 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -94,9 +94,6 @@ PlatformInfo PlatformInfo::localHostInfo() uname.start(QLS("uname"), QStringList() << QLS("-r")); if (uname.waitForFinished(3000)) pi.insert(PI_OSVersion, QString::fromLocal8Bit(uname.readAllStandardOutput().constData()).simplified()); -#elif defined(Q_OS_WINCE) - pi.insert(PI_OSName, QLS("WinCE")); - pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion())); #elif defined(Q_OS_WIN) pi.insert(PI_OSName, QLS("Windows")); pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion())); diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp index a9fd7fd5ec..cd5a83e547 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -59,10 +59,6 @@ private slots: void tst_qdiriterator::data() { -#if defined(Q_OS_WINCE) - QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath()); - qtdir += "/depot"; -#else #if defined(Q_OS_WIN) const char *qtdir = "C:\\depot\\qt\\main"; #else @@ -72,7 +68,6 @@ void tst_qdiriterator::data() fprintf(stderr, "QTDIR not set\n"); exit(1); } -#endif QTest::addColumn<QByteArray>("dirpath"); QByteArray ba = QByteArray(qtdir) + "/src/corelib"; diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index 3cfb0b44de..061b22a5d1 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -6,10 +6,3 @@ CONFIG += release SOURCES += main.cpp qfilesystemiterator.cpp HEADERS += qfilesystemiterator.h - -wince* { - corelibdir.files = $$QT_SOURCE_TREE/src/corelib - corelibdir.path = ./depot/src - DEPLOYMENT += corelibdir -} - diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 175dc74074..1966b30773 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -591,12 +591,7 @@ void tst_qfile::createSmallFiles() dir.cd("tst"); tmpDirName = dir.absolutePath(); -#if defined(Q_OS_WINCE) - for (int i = 0; i < 100; ++i) -#else - for (int i = 0; i < 1000; ++i) -#endif - { + for (int i = 0; i < 1000; ++i) { QFile f(tmpDirName + QLatin1Char('/') + QString::number(i)); f.open(QIODevice::WriteOnly); f.seek(511); diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 24a32a7c72..5180e7c29e 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -41,7 +41,7 @@ class qfileinfo : public QObject private slots: void existsTemporary(); void existsStatic(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void symLinkTargetPerformanceLNK(); void symLinkTargetPerformanceMounpoint(); #endif @@ -71,7 +71,7 @@ void qfileinfo::existsStatic() QBENCHMARK { QFileInfo::exists(appPath); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void qfileinfo::symLinkTargetPerformanceLNK() { QVERIFY(QFile::link("file","link.lnk")); diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp index d8792ed7ef..782cad94a1 100644 --- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp +++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp @@ -33,7 +33,7 @@ class tst_QProcess : public QObject { Q_OBJECT -#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_PROCESS) private slots: void echoTest_performance(); @@ -41,8 +41,7 @@ private slots: #endif // QT_NO_PROCESS }; -#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) -// Reading and writing to a process is not supported on Qt/CE +#if !defined(QT_NO_PROCESS) void tst_QProcess::echoTest_performance() { QProcess process; @@ -88,7 +87,7 @@ void tst_QProcess::echoTest_performance() QVERIFY(process.waitForFinished()); } -#endif // QT_NO_PROCESS && Q_OS_WINCE +#endif // QT_NO_PROCESS QTEST_MAIN(tst_QProcess) #include "tst_bench_qprocess.moc" diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp index 9ce8fffa8e..64d3dd5733 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -119,12 +119,7 @@ struct Large { // A "large" item type int x[1000]; }; -// Embedded devices typically have limited memory -#if defined(Q_OS_WINCE) -# define LARGE_MAX_SIZE 2000 -#else -# define LARGE_MAX_SIZE 20000 -#endif +#define LARGE_MAX_SIZE 20000 class tst_vector_vs_std : public QObject { diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp index 045beb17f3..5799b32b1c 100644 --- a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp +++ b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp @@ -34,15 +34,6 @@ #include <time.h> -#ifdef Q_OS_WINCE -// no C89 time() on Windows CE: -// http://blogs.msdn.com/b/cenet/archive/2006/04/29/time-h-on-windows-ce.aspx -uint time(void *) -{ - return uint(-1); -} -#endif - class tst_bench_QCryptographicHash : public QObject { Q_OBJECT diff --git a/tests/benchmarks/dbus/qdbustype/qdbustype.pro b/tests/benchmarks/dbus/qdbustype/qdbustype.pro index d30bad8ce7..8d2f45edf8 100644 --- a/tests/benchmarks/dbus/qdbustype/qdbustype.pro +++ b/tests/benchmarks/dbus/qdbustype/qdbustype.pro @@ -3,8 +3,8 @@ QT -= gui QT += core-private dbus-private testlib contains(QT_CONFIG, dbus-linked) { DEFINES += QT_LINKED_LIBDBUS - LIBS += $$QT_LIBS_DBUS - QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS + LIBS += $$QMAKE_LIBS_DBUS + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS } else { SOURCES += ../../../../src/dbus/qdbus_symbols.cpp } diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 7f52bb0eba..0064ecbaaf 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -401,9 +401,6 @@ void tst_QGraphicsView::chipTester_data() void tst_QGraphicsView::chipTester() { -#ifdef Q_OS_WINCE_WM - QSKIP("WinCE WM: Fails on Windows Mobile w/o OpenGL"); -#endif QFETCH(bool, antialias); QFETCH(bool, opengl); QFETCH(int, operation); diff --git a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro index 9e47f979e1..7da38e8e60 100644 --- a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro +++ b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro @@ -3,6 +3,6 @@ TARGET = tst_bench_imageConversion QT += testlib SOURCES += tst_qimageconversion.cpp -!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF -!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG +contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF +contains(QT_CONFIG, jpeg):DEFINES += QTEST_HAVE_JPEG contains(QT_CONFIG, c++11): CONFIG += c++11 diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro index e54e2ffce5..b60618d7ec 100644 --- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro +++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro @@ -5,22 +5,6 @@ TARGET = tst_bench_qimagereader SOURCES += tst_qimagereader.cpp -!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF -!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG +contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF +contains(QT_CONFIG, jpeg):DEFINES += QTEST_HAVE_JPEG QT += network - -wince { - addFiles.files = images - addFiles.path = . - - CONFIG(debug, debug|release):{ - imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*d4.dll - } - - CONFIG(release, debug|release):{ - imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*[^d]4.dll - } - imageFormatsPlugins.path = imageformats - DEPLOYMENT += addFiles imageFormatsPlugins -} - diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 73035be14f..dfa658df11 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -668,12 +668,8 @@ void tst_qnetworkreply::uploadPerformance() void tst_qnetworkreply::httpUploadPerformance() { -#if defined(Q_OS_WINCE_WM) - // Show some mercy for non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else enum {UploadSize = 128*1024*1024}; // 128 MB -#endif + ThreadedDataReaderHttpServer reader; FixedSizeDataGenerator generator(UploadSize); @@ -739,12 +735,9 @@ void tst_qnetworkreply::httpDownloadPerformance() { QFETCH(bool, serverSendsContentLength); QFETCH(bool, chunkedEncoding); -#if defined(Q_OS_WINCE_WM) - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else + enum {UploadSize = 128*1024*1024}; // 128 MB -#endif + HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding); QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1")); @@ -823,12 +816,7 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer() QFETCH(HttpDownloadPerformanceDownloadBufferTestType, testType); // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results. -#if defined(Q_OS_WINCE_WM) - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else enum {UploadSize = 32*1024*1024}; // 32 MB -#endif HttpDownloadPerformanceServer server(UploadSize, true, false); diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index 2e4a3b3fcd..3e731bec96 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -166,9 +166,6 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest() QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; -#if defined(Q_OS_WINCE_WM) - QSKIP("WinCE WM: Not yet supported"); -#endif QTcpServer server; if (!server.listen(QHostAddress::LocalHostIPv6, 0)) { diff --git a/tests/manual/diaglib/debugproxystyle.cpp b/tests/manual/diaglib/debugproxystyle.cpp index 667ec403b7..d4e62f5dd6 100644 --- a/tests/manual/diaglib/debugproxystyle.cpp +++ b/tests/manual/diaglib/debugproxystyle.cpp @@ -45,13 +45,36 @@ QDebug operator<<(QDebug debug, const QStyleOption *option) { #if QT_VERSION >= 0x050000 QDebugStateSaver saver(debug); +# if QT_VERSION >= 0x050400 + debug.noquote(); +# endif debug.nospace(); #endif - debug << "QStyleOption("; - if (option) - debug << "rec=" << option->rect; - else - debug << '0'; + if (!option) { + debug << "QStyleOption(0)"; + return debug; + } + if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { + debug << "QStyleOptionViewItem("; +#if QT_VERSION >= 0x050000 + debug << ivo->index; + if (const int textSize = ivo->text.size()) + debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"'; + debug << ", "; +#else // Qt 5 + Q_UNUSED(ivo) +#endif + } else { + debug << "QStyleOption("; + } + debug << "rect=" << option->rect.width() << 'x' << option->rect.height() + << forcesign << option->rect.x() << option->rect.y() << noforcesign; + if (option->state != QStyle::State_None) + debug << ", state=" << option->state; +#if QT_VERSION >= 0x050000 + if (option->styleObject && !option->styleObject->isWidgetType()) + debug << ", styleObject=" << option->styleObject; +#endif debug << ')'; return debug; } @@ -132,6 +155,15 @@ QRect DebugProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap & return result; } +int DebugProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, + QStyleHintReturn *returnData) const +{ + const int result = QProxyStyle::styleHint(hint, option, widget, returnData); + qDebug() << __FUNCTION__ << hint << option << widget << "returnData=" + << returnData << "returns" << result; + return result; +} + int DebugProxyStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { const int result = QProxyStyle::pixelMetric(metric, option, widget); diff --git a/tests/manual/diaglib/debugproxystyle.h b/tests/manual/diaglib/debugproxystyle.h index 74407e7f3e..01e1e6b6d1 100644 --- a/tests/manual/diaglib/debugproxystyle.h +++ b/tests/manual/diaglib/debugproxystyle.h @@ -48,6 +48,7 @@ public: QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const; QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp index 19c9ca30e9..4adb1da5f1 100644 --- a/tests/manual/diaglib/qwindowdump.cpp +++ b/tests/manual/diaglib/qwindowdump.cpp @@ -113,8 +113,6 @@ void formatWindowFlags(QTextStream &str, const Qt::WindowFlags flags) debugFlag(str, flags, Qt::WindowStaysOnBottomHint) debugFlag(str, flags, Qt::MacWindowToolBarButtonHint) debugFlag(str, flags, Qt::BypassGraphicsProxyWidget) - debugFlag(str, flags, Qt::WindowOkButtonHint) - debugFlag(str, flags, Qt::WindowCancelButtonHint) } #if QT_VERSION > 0x050000 diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 8777cc6e11..05988c2160 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -56,11 +56,7 @@ contains(QT_CONFIG, opengl) { contains(QT_CONFIG, egl): SUBDIRS += qopenglcontext } -win32 { - SUBDIRS -= network_remote_stresstest network_stresstest - # disable some tests on wince because of missing dependencies - wince: SUBDIRS -= lance windowmodality -} +win32: SUBDIRS -= network_remote_stresstest network_stresstest lessThan(QT_MAJOR_VERSION, 5): SUBDIRS -= bearerex lance qnetworkaccessmanager/qget qmimedatabase qnetworkreply \ qpainfo qscreen socketengine xembed-raster xembed-widgets windowtransparency \ diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp index 13458d27e5..57ce63adb3 100644 --- a/tests/manual/qsysinfo/main.cpp +++ b/tests/manual/qsysinfo/main.cpp @@ -57,13 +57,6 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v) CASE_VERSION(WV_WINDOWS10); case QSysInfo::WV_NT_based: // shouldn't happen break; - - CASE_VERSION(WV_CE); - CASE_VERSION(WV_CENET); - CASE_VERSION(WV_CE_5); - CASE_VERSION(WV_CE_6); - case QSysInfo::WV_CE_based: // shouldn't happen - break; } return "WinVersion(0x" + QByteArray::number(v, 16) + ')'; diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h index 82c807b3e3..73d7d6523c 100644 --- a/tests/shared/filesystem.h +++ b/tests/shared/filesystem.h @@ -36,7 +36,7 @@ #include <QDir> #include <QFile> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include <windows.h> #include <winioctl.h> #ifndef IO_REPARSE_TAG_MOUNT_POINT diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 59b8e4919b..40a4c1600e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -137,7 +137,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "QMAKESPEC_FROM" ] = "env"; } - dictionary[ "QCONFIG" ] = "full"; dictionary[ "EMBEDDED" ] = "no"; dictionary[ "BUILD_QMAKE" ] = "yes"; dictionary[ "QMAKE_INTERNAL" ] = "no"; @@ -240,7 +239,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "STATIC_RUNTIME" ] = "no"; - dictionary[ "ZLIB" ] = "auto"; + dictionary[ "SYSTEM_ZLIB" ] = "auto"; dictionary[ "PCRE" ] = "auto"; @@ -249,9 +248,9 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "ANGLE" ] = "auto"; dictionary[ "DYNAMICGL" ] = "auto"; - dictionary[ "GIF" ] = "auto"; - dictionary[ "JPEG" ] = "auto"; - dictionary[ "PNG" ] = "auto"; + dictionary[ "GIF" ] = "yes"; + dictionary[ "JPEG" ] = "yes"; + dictionary[ "PNG" ] = "yes"; dictionary[ "LIBJPEG" ] = "auto"; dictionary[ "LIBPNG" ] = "auto"; dictionary[ "DOUBLECONVERSION" ] = "auto"; @@ -261,7 +260,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "ACCESSIBILITY" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; - dictionary[ "OPENVG" ] = "no"; dictionary[ "SSL" ] = "auto"; dictionary[ "OPENSSL" ] = "auto"; dictionary[ "LIBPROXY" ] = "auto"; @@ -363,7 +361,6 @@ void Configure::parseCmdLine() int argCount = configCmdLine.size(); int i = 0; - const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg"; if (argCount < 1) // skip rest if no arguments ; @@ -414,12 +411,6 @@ void Configure::parseCmdLine() ++verbose; } - else if (configCmdLine.at(i) == "-qconfig") { - ++i; - if (i == argCount) - break; - dictionary[ "QCONFIG" ] = configCmdLine.at(i); - } else if (configCmdLine.at(i) == "-qreal") { ++i; if (i == argCount) @@ -556,24 +547,11 @@ void Configure::parseCmdLine() devOpt.append("\n").append(option); else devOpt = option; - } - - else if (configCmdLine.at(i) == "-no-zlib") { - // No longer supported since Qt 4.4.0 - // But save the information for later so that we can print a warning - // - // If you REALLY really need no zlib support, you can still disable - // it by doing the following: - // add "no-zlib" to mkspecs/qconfig.pri - // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h) - // - // There's no guarantee that Qt will build under those conditions - dictionary[ "ZLIB_FORCED" ] = "yes"; } else if (configCmdLine.at(i) == "-qt-zlib") { - dictionary[ "ZLIB" ] = "qt"; + dictionary[ "SYSTEM_ZLIB" ] = "no"; } else if (configCmdLine.at(i) == "-system-zlib") { - dictionary[ "ZLIB" ] = "system"; + dictionary[ "SYSTEM_ZLIB" ] = "yes"; } else if (configCmdLine.at(i) == "-qt-pcre") { @@ -695,89 +673,55 @@ void Configure::parseCmdLine() } } - // OpenVG Support ------------------------------------------- - else if (configCmdLine.at(i) == "-openvg") { - dictionary[ "OPENVG" ] = "yes"; - } else if (configCmdLine.at(i) == "-no-openvg") { - dictionary[ "OPENVG" ] = "no"; - } - // Databases ------------------------------------------------ - else if (configCmdLine.at(i) == "-qt-sql-mysql") + else if (configCmdLine.at(i) == "-sql-mysql" || configCmdLine.at(i) == "-plugin-sql-mysql") dictionary[ "SQL_MYSQL" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-mysql") - dictionary[ "SQL_MYSQL" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-mysql") dictionary[ "SQL_MYSQL" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-odbc") + else if (configCmdLine.at(i) == "-sql-odbc" || configCmdLine.at(i) == "-plugin-sql-odbc") dictionary[ "SQL_ODBC" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-odbc") - dictionary[ "SQL_ODBC" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-odbc") dictionary[ "SQL_ODBC" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-oci") + else if (configCmdLine.at(i) == "-sql-oci" || configCmdLine.at(i) == "-plugin-sql-oci") dictionary[ "SQL_OCI" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-oci") - dictionary[ "SQL_OCI" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-oci") dictionary[ "SQL_OCI" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-psql") + else if (configCmdLine.at(i) == "-sql-psql" || configCmdLine.at(i) == "-plugin-sql-psql") dictionary[ "SQL_PSQL" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-psql") - dictionary[ "SQL_PSQL" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-psql") dictionary[ "SQL_PSQL" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-tds") + else if (configCmdLine.at(i) == "-sql-tds" || configCmdLine.at(i) == "-plugin-sql-tds") dictionary[ "SQL_TDS" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-tds") - dictionary[ "SQL_TDS" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-tds") dictionary[ "SQL_TDS" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-db2") + else if (configCmdLine.at(i) == "-sql-db2") dictionary[ "SQL_DB2" ] = "yes"; else if (configCmdLine.at(i) == "-plugin-sql-db2") dictionary[ "SQL_DB2" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-db2") dictionary[ "SQL_DB2" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-sqlite") + else if (configCmdLine.at(i) == "-sql-sqlite" || configCmdLine.at(i) == "-plugin-sql-sqlite") dictionary[ "SQL_SQLITE" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-sqlite") - dictionary[ "SQL_SQLITE" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-sqlite") dictionary[ "SQL_SQLITE" ] = "no"; else if (configCmdLine.at(i) == "-system-sqlite") dictionary[ "SQL_SQLITE_LIB" ] = "system"; - else if (configCmdLine.at(i) == "-qt-sql-sqlite2") + else if (configCmdLine.at(i) == "-sql-sqlite2" || configCmdLine.at(i) == "-plugin-sql-sqlite2") dictionary[ "SQL_SQLITE2" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-sqlite2") - dictionary[ "SQL_SQLITE2" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-sqlite2") dictionary[ "SQL_SQLITE2" ] = "no"; - else if (configCmdLine.at(i) == "-qt-sql-ibase") + else if (configCmdLine.at(i) == "-sql-ibase" || configCmdLine.at(i) == "-plugin-sql-ibase") dictionary[ "SQL_IBASE" ] = "yes"; - else if (configCmdLine.at(i) == "-plugin-sql-ibase") - dictionary[ "SQL_IBASE" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-ibase") dictionary[ "SQL_IBASE" ] = "no"; - // Image formats -------------------------------------------- - else if (configCmdLine.at(i).startsWith("-qt-imageformat-") && - imageFormats.contains(configCmdLine.at(i).section('-', 3))) - dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes"; - else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") && - imageFormats.contains(configCmdLine.at(i).section('-', 3))) - dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin"; - else if (configCmdLine.at(i).startsWith("-no-imageformat-") && - imageFormats.contains(configCmdLine.at(i).section('-', 3))) - dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no"; - else if (configCmdLine.at(i) == "-no-incredibuild-xge") dictionary[ "INCREDIBUILD_XGE" ] = "no"; else if (configCmdLine.at(i) == "-incredibuild-xge") @@ -1275,10 +1219,6 @@ void Configure::parseCmdLine() dictionary["QT_INOTIFY"] = "no"; } - else if (configCmdLine.at(i) == "-largefile") { - dictionary["LARGE_FILE"] = "yes"; - } - else if (configCmdLine.at(i) == "-fontconfig") { dictionary["FONT_CONFIG"] = "yes"; } else if (configCmdLine.at(i) == "-no-fontconfig") { @@ -1462,35 +1402,6 @@ void Configure::parseCmdLine() void Configure::validateArgs() { - // Validate the specified config - QString cfgpath = sourcePath + "/src/corelib/global/qconfig-" + dictionary["QCONFIG"] + ".h"; - - // Try internal configurations first. - QStringList possible_configs = QStringList() - << "minimal" - << "small" - << "medium" - << "large" - << "full"; - int index = possible_configs.indexOf(dictionary["QCONFIG"]); - if (index >= 0) { - for (int c = 0; c <= index; c++) { - qtConfig += possible_configs[c] + "-config"; - } - if (dictionary["QCONFIG"] != "full") - dictionary["QCONFIG_PATH"] = cfgpath; - return; - } - - if (!QFileInfo::exists(cfgpath)) { - cfgpath = QFileInfo(dictionary["QCONFIG"]).absoluteFilePath(); - if (!QFileInfo::exists(cfgpath)) { - dictionary[ "DONE" ] = "error"; - cout << "No such configuration \"" << qPrintable(dictionary["QCONFIG"]) << "\"" << endl ; - return; - } - } - dictionary["QCONFIG_PATH"] = cfgpath; } // Output helper functions --------------------------------[ Start ]- @@ -1608,18 +1519,15 @@ void Configure::applySpecSpecifics() if (dictionary.value("XQMAKESPEC").startsWith("winphone") || dictionary.value("XQMAKESPEC").startsWith("winrt")) { dictionary[ "STYLE_WINDOWSXP" ] = "no"; dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; - dictionary[ "GIF" ] = "qt"; - dictionary[ "JPEG" ] = "qt"; dictionary[ "LIBJPEG" ] = "qt"; dictionary[ "LIBPNG" ] = "qt"; dictionary[ "FREETYPE" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; - dictionary[ "OPENVG" ] = "no"; dictionary[ "SSL" ] = "yes"; dictionary[ "OPENSSL" ] = "no"; dictionary[ "DBUS" ] = "no"; - dictionary[ "ZLIB" ] = "qt"; + dictionary[ "SYSTEM_ZLIB" ] = "no"; dictionary[ "PCRE" ] = "qt"; dictionary[ "ICU" ] = "qt"; dictionary[ "LARGE_FILE" ] = "no"; @@ -1795,8 +1703,6 @@ bool Configure::displayHelp() desc("", "no", "", " dynamic - Enable support for dynamically loaded OpenGL (either desktop or ES)", ' '); desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' '); - desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality."); - desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality.\n"); desc( "-force-asserts", "Activate asserts in release mode.\n"); desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n"); desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n"); @@ -1831,8 +1737,6 @@ bool Configure::displayHelp() desc("QT_EVENTFD", "yes", "-eventfd", "Enable eventfd(7) support in the UNIX event loop."); desc("QT_EVENTFD", "no", "-no-eventfd", "Disable eventfd(7) support in the UNIX event loop.\n"); - desc("LARGE_FILE", "yes", "-largefile", "Enables Qt to access files larger than 4 GB.\n"); - desc("POSIX_IPC", "yes", "-posix-ipc", "Enable POSIX IPC.\n"); desc("QT_GLIB", "yes", "-glib", "Compile Glib support.\n"); @@ -1857,8 +1761,8 @@ bool Configure::displayHelp() // 3rd party stuff options go below here -------------------------------------------------------------------------------- desc("Third Party Libraries:\n\n"); - desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt."); - desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); + desc("SYSTEM_ZLIB", "no", "-qt-zlib", "Use the zlib bundled with Qt."); + desc("SYSTEM_ZLIB", "yes", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt."); desc("PCRE", "system", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n"); @@ -2021,16 +1925,11 @@ QString Configure::locateFile(const QString &fileName) const QString Configure::defaultTo(const QString &option) { // We prefer using the system version of the 3rd party libs - if (option == "ZLIB" - || option == "PCRE" + if (option == "PCRE" || option == "LIBJPEG" || option == "LIBPNG") return "system"; - // PNG is always built-in, never a plugin - if (option == "PNG") - return "yes"; - // These database drivers and image formats can be built-in or plugins. // Prefer plugins when Qt is shared. if (dictionary[ "SHARED" ] == "yes") { @@ -2043,10 +1942,8 @@ QString Configure::defaultTo(const QString &option) || option == "SQL_DB2" || option == "SQL_SQLITE" || option == "SQL_SQLITE2" - || option == "SQL_IBASE" - || option == "JPEG" - || option == "GIF") - return "plugin"; + || option == "SQL_IBASE") + return "yes"; } // By default we do not want to compile OCI driver when compiling with @@ -2154,7 +2051,7 @@ bool Configure::checkAvailability(const QString &part) else if (part == "ATOMIC64-LIBATOMIC") available = tryCompileProject("common/atomic64", "LIBS+=-latomic"); - else if (part == "ZLIB") + else if (part == "SYSTEM_ZLIB") available = findFile("zlib.h"); else if (part == "PCRE") @@ -2192,11 +2089,11 @@ bool Configure::checkAvailability(const QString &part) if (dictionary[ "SQL_SQLITE_LIB" ] == "system") { if (platform() == QNX) { available = true; - dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3 -lz"; + dictionary[ "QMAKE_LIBS_SQLITE" ] += "-lsqlite3 -lz"; } else { available = findFile("sqlite3.h") && findFile("sqlite3.lib"); if (available) - dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib"; + dictionary[ "QMAKE_LIBS_SQLITE" ] += "sqlite3.lib"; } } else { available = true; @@ -2300,22 +2197,6 @@ void Configure::autoDetection() } } - if (!dictionary["QMAKESPEC"].contains("msvc")) { - if (tryCompileProject("common/c++default", QString(), false)) { - QFile iiFile(buildPath + "/config.tests/common/c++default/c++default.ii"); - if (iiFile.open(QIODevice::ReadOnly)) { - QString content = QString::fromUtf8(iiFile.readAll()); - QRegExp expr("\\b([0-9]+)L\\b"); - if (expr.indexIn(content) != -1) - dictionary["CFG_STDCXX_DEFAULT"] = expr.cap(1); - } - } - if (dictionary["CFG_STDCXX_DEFAULT"].isEmpty()) { - cout << "Could not determine the C++ standard the compiler uses by default, assuming C++98." << endl; - dictionary["CFG_STDCXX_DEFAULT"] = "199711"; - } - } - if (dictionary["ATOMIC64"] == "auto") dictionary["ATOMIC64"] = checkAvailability("ATOMIC64") ? "yes" : checkAvailability("ATOMIC64-LIBATOMIC") ? "libatomic" : "no"; @@ -2327,8 +2208,8 @@ void Configure::autoDetection() dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no"; // Compression detection - if (dictionary["ZLIB"] == "auto") - dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt"; + if (dictionary["SYSTEM_ZLIB"] == "auto") + dictionary["SYSTEM_ZLIB"] = checkAvailability("SYSTEM_ZLIB") ? "yes" : "no"; // PCRE detection if (dictionary["PCRE"] == "auto") @@ -2353,12 +2234,6 @@ void Configure::autoDetection() dictionary["DYNAMICGL"] = "no"; // Image format detection - if (dictionary["GIF"] == "auto") - dictionary["GIF"] = defaultTo("GIF"); - if (dictionary["JPEG"] == "auto") - dictionary["JPEG"] = defaultTo("JPEG"); - if (dictionary["PNG"] == "auto") - dictionary["PNG"] = defaultTo("PNG"); if (dictionary["LIBJPEG"] == "auto") dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt"; if (dictionary["LIBPNG"] == "auto") @@ -2667,8 +2542,6 @@ void Configure::generateOutputVars() qtConfig += "c++11 c++14"; else if (dictionary[ "C++STD" ] == "c++1z") qtConfig += "c++11 c++14 c++1z"; - if (!dictionary[ "CFG_STDCXX_DEFAULT" ].isEmpty()) - qmakeVars += "QT_COMPILER_STDCXX = " + dictionary[ "CFG_STDCXX_DEFAULT" ]; if (dictionary[ "USE_GOLD_LINKER" ] == "yes") qmakeConfig += "use_gold_linker"; @@ -2693,9 +2566,7 @@ void Configure::generateOutputVars() qtConfig += "no-widgets"; // Compression -------------------------------------------------- - if (dictionary[ "ZLIB" ] == "qt") - qtConfig += "zlib"; - else if (dictionary[ "ZLIB" ] == "system") + if (dictionary[ "SYSTEM_ZLIB" ] == "yes") qtConfig += "system-zlib"; // PCRE --------------------------------------------------------- @@ -2717,42 +2588,34 @@ void Configure::generateOutputVars() } // Image formates ----------------------------------------------- - if (dictionary[ "GIF" ] == "no") - qtConfig += "no-gif"; - else if (dictionary[ "GIF" ] == "yes") + if (dictionary[ "GIF" ] == "yes") qtConfig += "gif"; - if (dictionary[ "JPEG" ] == "no") - qtConfig += "no-jpeg"; - else if (dictionary[ "JPEG" ] == "yes") + if (dictionary[ "JPEG" ] == "yes") qtConfig += "jpeg"; if (dictionary[ "LIBJPEG" ] == "system") qtConfig += "system-jpeg"; - if (dictionary[ "PNG" ] == "no") - qtConfig += "no-png"; - else if (dictionary[ "PNG" ] == "yes") + if (dictionary[ "PNG" ] == "yes") qtConfig += "png"; if (dictionary[ "LIBPNG" ] == "system") qtConfig += "system-png"; // Double conversion ----------------------------------------------- - if (dictionary[ "DOUBLECONVERSION" ] == "qt") + if (dictionary[ "DOUBLECONVERSION" ] != "no") qtConfig += "doubleconversion"; - else if (dictionary[ "DOUBLECONVERSION" ] == "system") + if (dictionary[ "DOUBLECONVERSION" ] == "system") qtConfig += "system-doubleconversion"; - else if (dictionary[ "DOUBLECONVERSION" ] == "no") - qtConfig += "no-doubleconversion"; // Text rendering -------------------------------------------------- - if (dictionary[ "FREETYPE" ] == "yes") + if (dictionary[ "FREETYPE" ] != "no") qtConfig += "freetype"; - else if (dictionary[ "FREETYPE" ] == "system") + if (dictionary[ "FREETYPE" ] == "system") qtConfig += "system-freetype"; - if (dictionary[ "HARFBUZZ" ] == "qt") + if (dictionary[ "HARFBUZZ" ] != "no") qtConfig += "harfbuzz"; - else if (dictionary[ "HARFBUZZ" ] == "system") + if (dictionary[ "HARFBUZZ" ] == "system") qtConfig += "system-harfbuzz"; // Styles ------------------------------------------------------- @@ -2774,52 +2637,26 @@ void Configure::generateOutputVars() // Databases ---------------------------------------------------- if (dictionary[ "SQL_MYSQL" ] == "yes") qmakeSql += "mysql"; - else if (dictionary[ "SQL_MYSQL" ] == "plugin") - qmakeSqlPlugins += "mysql"; - if (dictionary[ "SQL_ODBC" ] == "yes") qmakeSql += "odbc"; - else if (dictionary[ "SQL_ODBC" ] == "plugin") - qmakeSqlPlugins += "odbc"; - if (dictionary[ "SQL_OCI" ] == "yes") qmakeSql += "oci"; - else if (dictionary[ "SQL_OCI" ] == "plugin") - qmakeSqlPlugins += "oci"; - if (dictionary[ "SQL_PSQL" ] == "yes") qmakeSql += "psql"; - else if (dictionary[ "SQL_PSQL" ] == "plugin") - qmakeSqlPlugins += "psql"; - if (dictionary[ "SQL_TDS" ] == "yes") qmakeSql += "tds"; - else if (dictionary[ "SQL_TDS" ] == "plugin") - qmakeSqlPlugins += "tds"; - if (dictionary[ "SQL_DB2" ] == "yes") qmakeSql += "db2"; - else if (dictionary[ "SQL_DB2" ] == "plugin") - qmakeSqlPlugins += "db2"; - + if (dictionary[ "SQL_SQLITE2" ] == "yes") + qmakeSql += "sqlite2"; + if (dictionary[ "SQL_IBASE" ] == "yes") + qmakeSql += "ibase"; if (dictionary[ "SQL_SQLITE" ] == "yes") qmakeSql += "sqlite"; - else if (dictionary[ "SQL_SQLITE" ] == "plugin") - qmakeSqlPlugins += "sqlite"; if (dictionary[ "SQL_SQLITE_LIB" ] == "system") qmakeConfig += "system-sqlite"; - if (dictionary[ "SQL_SQLITE2" ] == "yes") - qmakeSql += "sqlite2"; - else if (dictionary[ "SQL_SQLITE2" ] == "plugin") - qmakeSqlPlugins += "sqlite2"; - - if (dictionary[ "SQL_IBASE" ] == "yes") - qmakeSql += "ibase"; - else if (dictionary[ "SQL_IBASE" ] == "plugin") - qmakeSqlPlugins += "ibase"; - // Other options ------------------------------------------------ if (dictionary[ "BUILDALL" ] == "yes") { qtConfig += "build_all"; @@ -2864,8 +2701,8 @@ void Configure::generateOutputVars() if (!qmakeLibs.isEmpty()) qmakeVars += "LIBS += " + formatPaths(qmakeLibs); - if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty()) - qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"]; + if (!dictionary["QMAKE_LIBS_SQLITE"].isEmpty()) + qmakeVars += "QMAKE_LIBS_SQLITE += " + dictionary["QMAKE_LIBS_SQLITE"]; if (dictionary[ "OPENGL" ] == "yes") qtConfig += "opengl"; @@ -2875,11 +2712,6 @@ void Configure::generateOutputVars() qtConfig += "egl"; } - if (dictionary["OPENVG"] == "yes") { - qtConfig += "openvg"; - qtConfig += "egl"; - } - if (dictionary[ "SSL" ] == "yes") qtConfig += "ssl"; @@ -2926,9 +2758,9 @@ void Configure::generateOutputVars() if (dictionary["QT_CUPS"] == "yes") qtConfig += "cups"; - if (dictionary["QT_ICONV"] == "yes") + if (dictionary["QT_ICONV"] != "no") qtConfig += "iconv"; - else if (dictionary["QT_ICONV"] == "sun") + if (dictionary["QT_ICONV"] == "sun") qtConfig += "sun-libiconv"; else if (dictionary["QT_ICONV"] == "gnu") qtConfig += "gnu-libiconv"; @@ -3006,8 +2838,8 @@ void Configure::generateOutputVars() } if (dictionary[ "DBUS" ] == "linked") { if (!dbusPath.isEmpty()) { - qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath); - qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath); + qmakeVars += QString("QMAKE_CFLAGS_DBUS = -I%1/include").arg(dbusPath); + qmakeVars += QString("QMAKE_LIBS_DBUS = -L%1/lib").arg(dbusPath); if (dbusHostPath.isEmpty()) qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusPath); } @@ -3015,11 +2847,11 @@ void Configure::generateOutputVars() qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusHostPath); } if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty()) { - qmakeVars += QString("QT_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath); - qmakeVars += QString("QT_LFLAGS_MYSQL = -L%1/lib").arg(mysqlPath); + qmakeVars += QString("QMAKE_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath); + qmakeVars += QString("QMAKE_LIBS_MYSQL = -L%1/lib").arg(mysqlPath); } if (!psqlLibs.isEmpty()) - qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1); + qmakeVars += QString("QMAKE_LIBS_PSQL=") + psqlLibs.section("=", 1); if (!zlibLibs.isEmpty()) qmakeVars += zlibLibs; @@ -3030,13 +2862,11 @@ void Configure::generateOutputVars() if (!sybaseLibs.isEmpty()) lflagsTDS += sybaseLibs.section("=", 1); if (!lflagsTDS.isEmpty()) - qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(' '); + qmakeVars += QString("QMAKE_LIBS_TDS=") + lflagsTDS.join(' '); } if (!qmakeSql.isEmpty()) qmakeVars += QString("sql-drivers += ") + qmakeSql.join(' '); - if (!qmakeSqlPlugins.isEmpty()) - qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(' '); if (!qmakeStyles.isEmpty()) qmakeVars += QString("styles += ") + qmakeStyles.join(' '); if (!qmakeStylePlugins.isEmpty()) @@ -3070,11 +2900,6 @@ void Configure::generateCachefile() moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl; if (!skipModules.isEmpty()) moduleStream << "QT_SKIP_MODULES += " << skipModules.join(' ') << endl; - QString qcpath = dictionary["QCONFIG_PATH"]; - QString qlpath = sourcePath + "/src/corelib/global/"; - if (qcpath.startsWith(qlpath)) - qcpath.remove(0, qlpath.length()); - moduleStream << "QT_QCONFIG_PATH = " << qcpath << endl; moduleStream << endl; moduleStream << "host_build {" << endl; @@ -3558,18 +3383,6 @@ void Configure::generateConfigfiles() << "#define QT_VERSION_PATCH " << dictionary["VERSION_PATCH"] << endl << "#define QT_VERSION_STR \"" << dictionary["VERSION"] << "\"\n" << endl; - - if (dictionary[ "QCONFIG" ] == "full") { - tmpStream << "/* Everything */" << endl; - } else { - tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl; - QFile inFile(dictionary["QCONFIG_PATH"]); - if (inFile.open(QFile::ReadOnly)) { - tmpStream << QTextStream(&inFile).readAll(); - inFile.close(); - } - tmpStream << "#endif // QT_BOOTSTRAPPED" << endl; - } tmpStream << endl; if (dictionary[ "SHARED" ] == "no") { @@ -3622,19 +3435,12 @@ void Configure::generateConfigfiles() qconfigList += "QT_NO_STYLE_WINDOWSXP"; if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA"; - if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1"; if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; - if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG"; - if (dictionary["ZLIB"] == "no") { - qconfigList += "QT_NO_ZLIB"; - qconfigList += "QT_NO_COMPRESS"; - } if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY"; if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS"; if (dictionary["GUI"] == "no") qconfigList += "QT_NO_GUI"; if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL"; - if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG"; if (dictionary["SSL"] == "no") qconfigList += "QT_NO_SSL"; if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL"; if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL"; @@ -3646,15 +3452,6 @@ void Configure::generateConfigfiles() if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES"; if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2"; if (dictionary["DYNAMICGL"] == "yes") qconfigList += "QT_OPENGL_DYNAMIC"; - if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL"; - if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC"; - if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI"; - if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL"; - if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS"; - if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2"; - if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE"; - if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2"; - if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE"; if (dictionary["POSIX_IPC"] == "yes") qconfigList += "QT_POSIX_IPC"; @@ -3784,7 +3581,6 @@ void Configure::displayConfig() << (dictionary[ "AVX512" ].isEmpty() ? QString("<none>") : dictionary[ "AVX512" ].toUpper()) << endl; sout << "NEON support................" << dictionary[ "NEON" ] << endl; sout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl; - sout << "Large File support.........." << dictionary[ "LARGE_FILE" ] << endl; sout << "NIS support................." << dictionary[ "NIS" ] << endl; sout << "Iconv support..............." << dictionary[ "QT_ICONV" ] << endl; sout << "Evdev support..............." << dictionary[ "QT_EVDEV" ] << endl; @@ -3793,7 +3589,6 @@ void Configure::displayConfig() sout << "eventfd(7) support.........." << dictionary[ "QT_EVENTFD" ] << endl; sout << "Glib support................" << dictionary[ "QT_GLIB" ] << endl; sout << "CUPS support................" << dictionary[ "QT_CUPS" ] << endl; - sout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl; sout << "SSL support................." << dictionary[ "SSL" ] << endl; sout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl; sout << "libproxy support............" << dictionary[ "LIBPROXY" ] << endl; @@ -3812,10 +3607,10 @@ void Configure::displayConfig() sout << endl; sout << "Third Party Libraries:" << endl; - sout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl; + sout << " ZLIB support............" << (dictionary[ "SYSTEM_ZLIB" ] == QLatin1String("yes") ? QLatin1String("system") : QLatin1String("qt")) << endl; sout << " GIF support............." << dictionary[ "GIF" ] << endl; - sout << " JPEG support............" << dictionary[ "JPEG" ] << endl; - sout << " PNG support............." << dictionary[ "PNG" ] << endl; + sout << " JPEG support............" << dictionary[ "JPEG" ] << " (" << dictionary[ "LIBJPEG" ] << ")" << endl; + sout << " PNG support............." << dictionary[ "PNG" ] << " (" << dictionary[ "LIBPNG" ] << ")" << endl; sout << " DoubleConversion........" << dictionary[ "DOUBLECONVERSION" ] << endl; sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl; sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl; @@ -3908,17 +3703,6 @@ void Configure::displayConfig() sout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl; } } - if (dictionary[ "ZLIB_FORCED" ] == "yes") { - QString which_zlib = "supplied"; - if (dictionary[ "ZLIB" ] == "system") - which_zlib = "system"; - - sout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl - << endl - << "Qt now requires zlib support in all builds, so the -no-zlib" << endl - << "option was ignored. Qt will be built using the " << which_zlib - << "zlib" << endl; - } if (dictionary["OBSOLETE_ARCH_ARG"] == "yes") { sout << endl << "NOTE: The -arch option is obsolete." << endl |