summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure44
-rw-r--r--doc/global/externalsites/qch-urls.qdoc95
-rw-r--r--doc/global/externalsites/qtcreator.qdoc8
-rw-r--r--examples/corelib/threads/doc/src/waitconditions.qdoc2
-rw-r--r--mkspecs/common/g++-macx.conf2
-rw-r--r--mkspecs/features/create_cmake.prf2
-rw-r--r--mkspecs/features/win32/windeployqt.prf3
-rw-r--r--mkspecs/freebsd-g++/qmake.conf1
-rw-r--r--mkspecs/freebsd-g++46/qmake.conf1
-rw-r--r--mkspecs/macx-ios-clang/features/default_post.prf15
-rw-r--r--mkspecs/macx-ios-clang/qmake.conf2
-rw-r--r--mkspecs/unsupported/freebsd-clang/qmake.conf1
-rw-r--r--qmake/Makefile.win322
-rw-r--r--qmake/doc/src/qmake-manual.qdoc17
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp10
-rw-r--r--qmake/generators/makefile.cpp30
-rw-r--r--qmake/generators/unix/unixmake2.cpp15
-rw-r--r--qmake/generators/win32/mingw_make.cpp10
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp1
-rw-r--r--qmake/generators/win32/winmakefile.cpp8
-rw-r--r--qmake/library/qmakeevaluator.cpp57
-rw-r--r--src/3rdparty/zlib.pri2
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtSurface.java2
-rw-r--r--src/corelib/doc/src/external-resources.qdoc11
-rw-r--r--src/corelib/global/global.pri2
-rw-r--r--src/corelib/global/qcompilerdetection.h6
-rw-r--r--src/corelib/global/qendian.h12
-rw-r--r--src/corelib/global/qglobal.cpp78
-rw-r--r--src/corelib/global/qlibraryinfo.cpp7
-rw-r--r--src/corelib/global/qnamespace.qdoc2
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm1
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h6
-rw-r--r--src/corelib/kernel/qobject.cpp10
-rw-r--r--src/corelib/kernel/qvariant.cpp49
-rw-r--r--src/corelib/kernel/qvariant.h6
-rw-r--r--src/corelib/thread/qatomic.cpp86
-rw-r--r--src/corelib/thread/qatomic.h96
-rw-r--r--src/corelib/thread/qthread.cpp4
-rw-r--r--src/corelib/tools/qbytearray.cpp3
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp2
-rw-r--r--src/corelib/tools/qdatetime.cpp42
-rw-r--r--src/corelib/tools/qfreelist_p.h2
-rw-r--r--src/corelib/tools/qlocale_p.h6
-rw-r--r--src/corelib/tools/qmargins.cpp2
-rw-r--r--src/corelib/tools/qvsnprintf.cpp1
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
-rw-r--r--src/dbus/doc/src/qtdbus-index.qdoc17
-rw-r--r--src/dbus/qdbus_symbols.cpp4
-rw-r--r--src/dbus/qdbus_symbols_p.h5
-rw-r--r--src/dbus/qdbusconnection.cpp2
-rw-r--r--src/dbus/qdbusintegrator.cpp9
-rw-r--r--src/dbus/qdbusserver.cpp3
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp2
-rw-r--r--src/gui/image/qjpeghandler.cpp6
-rw-r--r--src/gui/kernel/qopenglcontext.cpp14
-rw-r--r--src/gui/kernel/qplatformservices.cpp3
-rw-r--r--src/gui/kernel/qplatformservices.h1
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/painting/qpathclipper_p.h32
-rw-r--r--src/gui/text/qfontmetrics.cpp8
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/network/access/qnetworkreply.cpp2
-rw-r--r--src/network/kernel/qhostaddress.cpp36
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp15
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp3
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp3
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp5
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm8
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp52
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp556
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h88
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglwindow.cpp20
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglwindow.h4
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h4
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm6
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm19
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm17
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.h1
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm11
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.h14
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm117
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm19
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp17
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h1
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp36
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp44
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h5
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp41
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbxsettings.cpp8
-rw-r--r--src/printsupport/kernel/qprint_p.h2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp2
-rw-r--r--src/printsupport/kernel/qprinter.cpp5
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp12
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp43
-rw-r--r--src/sql/kernel/qsqlquery.cpp1
-rw-r--r--src/testlib/qbenchmark_p.h1
-rw-r--r--src/testlib/qtest.h3
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc2
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp56
-rw-r--r--src/widgets/dialogs/qcolordialog.h1
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h14
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp4
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/layout.qdoc2
-rw-r--r--src/widgets/kernel/qwidget.cpp11
-rw-r--r--src/widgets/styles/qfusionstyle.cpp3
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp12
-rw-r--r--src/widgets/widgets/qdockwidget.cpp5
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp3
-rwxr-xr-xtests/auto/android/runtests_androiddeployqt.pl41
-rw-r--r--tests/auto/corelib/io/qdatastream/qdatastream.pro5
-rw-r--r--tests/auto/corelib/io/qdatastream/testdata.qrc5
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp8
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc6
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro6
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp45
-rw-r--r--tests/auto/corelib/kernel/qtranslator/android_testdata.qrc7
-rw-r--r--tests/auto/corelib/kernel/qtranslator/qtranslator.pro4
-rw-r--r--tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp20
-rw-r--r--tests/auto/corelib/tools/qbytearray/android_testdata.qrc5
-rw-r--r--tests/auto/corelib/tools/qbytearray/qbytearray.pro5
-rw-r--r--tests/auto/corelib/tools/qchar/qchar.pro5
-rw-r--r--tests/auto/corelib/tools/qchar/testdata.qrc5
-rw-r--r--tests/auto/corelib/tools/qcollator/tst_qcollator.cpp5
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp9
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro5
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/testdata.qrc6
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp8
-rw-r--r--tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro5
-rw-r--r--tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc8
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp60
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp23
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp10
-rw-r--r--tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp22
-rw-r--r--tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp23
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp10
-rw-r--r--tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp22
-rw-r--r--tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp9
-rw-r--r--tests/auto/dbus/qdbusmarshall/common.h4
-rw-r--r--tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp5
-rw-r--r--tests/auto/dbus/qdbusmarshall/test/test.pro9
-rw-r--r--tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp82
-rw-r--r--tests/auto/dbus/qdbustype/qdbustype.pro9
-rw-r--r--tests/auto/dbus/qdbustype/tst_qdbustype.cpp26
-rw-r--r--tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpgbin0 -> 911 bytes
-rw-r--r--tests/auto/gui/image/qimage/qimage.pro2
-rw-r--r--tests/auto/gui/image/qimage/qimage.qrc22
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp33
-rw-r--r--tests/auto/gui/image/qimagereader/android_testdata.qrc6
-rw-r--r--tests/auto/gui/image/qimagereader/qimagereader.pro4
-rw-r--r--tests/auto/gui/image/qimagewriter/qimagewriter.pro2
-rw-r--r--tests/auto/gui/image/qimagewriter/qimagewriter.qrc16
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp30
-rw-r--r--tests/auto/gui/image/qpixmap/qpixmap.qrc28
-rw-r--r--tests/auto/gui/painting/qpainter/qpainter.pro5
-rw-r--r--tests/auto/gui/painting/qpainter/testdata.qrc186
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp18
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp42
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp62
-rw-r--r--tests/auto/network-settings.h1
-rw-r--r--tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp18
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp6
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp4
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp12
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h2
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp102
-rwxr-xr-xtests/auto/test.pl41
-rw-r--r--tests/auto/testlib/selftests/datetime/tst_datetime.cpp2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.lightxml2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.txt2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xml2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xunitxml2
-rw-r--r--tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro6
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/testdata.qrc11
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp34
-rw-r--r--tests/auto/widgets/kernel/qlayout/qlayout.pro5
-rw-r--r--tests/auto/widgets/kernel/qlayout/testdata.qrc5
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp4
-rw-r--r--tests/auto/widgets/styles/qstyle/qstyle.pro5
-rw-r--r--tests/auto/widgets/styles/qstyle/testdata.qrc20
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp33
-rw-r--r--tests/benchmarks/benchmarks.pro2
-rw-r--r--tests/benchmarks/dbus/qdbustype/main.cpp12
-rw-r--r--tests/benchmarks/dbus/qdbustype/qdbustype.pro11
-rw-r--r--tests/manual/diaglib/eventfilter.cpp74
-rw-r--r--tests/manual/qscreen/main.cpp5
-rw-r--r--tests/manual/qscreen/propertyfield.cpp7
-rw-r--r--tests/manual/qscreen/propertyfield.h1
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp5
-rw-r--r--tools/configure/configureapp.cpp7
200 files changed, 2403 insertions, 1282 deletions
diff --git a/configure b/configure
index 32a2e5abde..793e0c76db 100755
--- a/configure
+++ b/configure
@@ -660,7 +660,7 @@ CFG_TSLIB=auto
CFG_NIS=auto
CFG_CUPS=auto
CFG_ICONV=auto
-CFG_DBUS=auto
+CFG_DBUS=runtime
CFG_GLIB=auto
CFG_QGTKSTYLE=auto
CFG_LARGEFILE=auto
@@ -1913,10 +1913,10 @@ while [ "$#" -gt 0 ]; do
fi
;;
dbus)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
+ if [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then
CFG_DBUS="$VAL"
- elif [ "$VAL" = "runtime" ]; then
- CFG_DBUS="yes"
+ elif [ "$VAL" = "yes" ]; then
+ CFG_DBUS="runtime"
else
UNKNOWN_OPT=yes
fi
@@ -3978,13 +3978,16 @@ fi
if [ -z "$PKG_CONFIG" ]; then
# See if PKG_CONFIG is set in the mkspec:
PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`"
+ [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG"
fi
if [ -z "$PKG_CONFIG" ]; then
PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
+ [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from \$PATH: $PKG_CONFIG"
fi
if [ "$CFG_PKGCONFIG" = "no" ]; then
PKG_CONFIG=
+ [ "$OPT_VERBOSE" = "yes" ] && echo "pkg-config support disabled."
elif [ "$CFG_PKGCONFIG" = "force" ]; then
echo >&2 ""
echo >&2 "You have asked to use pkg-config. Please make sure you have"
@@ -4049,7 +4052,13 @@ compileTest()
path=config.tests/$1
name=$2
shift 2
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@"
+ # allow config tests which behave differently depending on the type of
+ # library being built (shared/static) e.g. see config.tests/unix/icu
+ test_config="$QMAKE_CONFIG shared"
+ if [ "$CFG_SHARED" = "no" ]; then
+ test_config="$QMAKE_CONFIG static"
+ fi
+ "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@"
}
compileTestWithPkgConfig()
@@ -4779,7 +4788,7 @@ if [ "$CFG_ICONV" != "no" ]; then
fi
# auto-detect libdbus-1 support
-if [ "$CFG_DBUS" != "no" ]; then
+if [ "$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`
@@ -4787,7 +4796,6 @@ if [ "$CFG_DBUS" != "no" ]; then
QT_LIBS_DBUS="-ldbus-1"
fi
if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
- [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
# Try find correct host configuration for dbus tools when cross-compiling
@@ -4797,12 +4805,9 @@ if [ "$CFG_DBUS" != "no" ]; then
fi
QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
else
- if [ "$CFG_DBUS" != "linked" ]; then
- CFG_DBUS=runtime
- elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- # CFG_DBUS is "yes" or "linked" here
-
+ if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
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."
@@ -4824,6 +4829,7 @@ if [ "$CFG_GLIB" != "no" ]; then
else
if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "Glib support cannot be enabled due to functionality tests!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
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."
@@ -4851,6 +4857,7 @@ if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
else
if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "GTK theme support cannot be enabled due to functionality tests!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
echo " Turn on verbose messaging (-v) to $0 to see the fin al report."
echo " If you believe this message is in error you may use the continue"
echo " switch (-continue) to $0 to continue."
@@ -4895,6 +4902,7 @@ if [ "$CFG_PULSEAUDIO" != "no" ]; then
else
if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "PulseAudio support cannot be enabled due to functionality tests!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
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."
@@ -5012,6 +5020,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then
compileTestWithPkgConfig glesv2 unix/opengles2 "OpenGL ES 2.0" OPENGL_ES2
if [ $? != "0" ]; then
echo "The OpenGL ES 2.0 functionality test failed!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
echo " You might need to modify the include and library search paths by editing"
echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
echo " ${XQMAKESPEC}."
@@ -5085,6 +5094,7 @@ if [ "$CFG_LIBUDEV" != "no" ]; then
QT_CONFIG="$QT_CONFIG libudev"
elif [ "$CFG_LIBUDEV" = "yes" ]; then
echo "The libudev functionality test failed!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
exit 1
else
CFG_LIBUDEV=no
@@ -5280,6 +5290,7 @@ if [ "$CFG_XCB" != "no" ]; then
else
if [ "$CFG_XCB" != "auto" ]; then
echo "The test for linking against libxcb failed!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
echo " You might need to install dependency packages for libxcb."
echo " See src/plugins/platforms/xcb/README."
exit 1
@@ -5296,6 +5307,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then
CFG_DIRECTFB=yes
elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo " DirectFB support cannot be enabled due to functionality tests!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
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."
@@ -5352,6 +5364,7 @@ if [ "$CFG_XCB" != "no" ]; then
elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo " xkbcommon support cannot be enabled because either xkbcommon or "
echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!"
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
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."
@@ -5412,6 +5425,7 @@ if [ "$CFG_EGL" != "no" ]; then
fi
elif [ "$CFG_EGL" = "yes" ]; then
echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
+ [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
echo " You might need to modify the include and library search paths by editing"
echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
exit 1
@@ -5962,8 +5976,8 @@ fi
[ "$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"
-[ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
-[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
+[ "$CFG_DBUS" != "no" ] && QT_CONFIG="$QT_CONFIG dbus"
+[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus-linked"
[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
[ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
[ "$CFG_XCB" != "no" ] && QT_CONFIG="$QT_CONFIG xcb"
@@ -6764,7 +6778,7 @@ fi
# Qt modules
echo
echo "Qt modules and options:"
-report_support " Qt D-Bus ..............." "$CFG_DBUS" yes "loading dbus-1 at runtime" linked "linked to dbus-1"
+report_support " Qt D-Bus ..............." "$CFG_DBUS" runtime "loading dbus-1 at runtime" linked "linked to dbus-1"
report_support " Qt Concurrent .........." "$CFG_CONCURRENT"
report_support " Qt GUI ................." "$CFG_GUI"
report_support " Qt Widgets ............." "$CFG_WIDGETS"
diff --git a/doc/global/externalsites/qch-urls.qdoc b/doc/global/externalsites/qch-urls.qdoc
deleted file mode 100644
index 53ab94091e..0000000000
--- a/doc/global/externalsites/qch-urls.qdoc
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \externalpage http://doc.qt.digia.com/qtcreator/creator-qml-application.html
- \title external: Developing Qt Quick Applications with Creator
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtcreator/creator-visual-editor.html
- \title external: Developing Qt Quick Applications
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtcreator/creator-publish-ovi.html
- \title external: Publishing Applications to Ovi Store
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator
- \title external: Qt Creator Manual
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtmobility/index.html
- \title external: Qt Mobility Manual
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtmobility/qml-plugins.html
- \title external: Qt Mobility QML Plugins
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-project-managing.html
- \title external: Creating Qt Projects in Creator
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-building-running.html
- \title external: Building and Running Applications in Creator
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-running-targets.html
- \title external: Set Compiler Targets in Creator
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-build-settings.html
- \title external: Build Settings in Creator
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-run-settings.html
- \title external: Run Settings in Creator
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-using-qt-designer.html
- \title external: Designer in Creator
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-debugging.html
- \title external: Debugging Applications in Creator
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtmobility/multimedia.html
- \title external: Mobility Multimedia
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtmobility/location-overview.html
- \title external: Mobility Location
-*/
-/*!
- \externalpage http://doc.qt.digia.com/qtmobility/all-examples.html
- \title external: Qt Mobility Examples
-*/
-/*!
- \externalpage http://doc.qt.io/qtcreator/creator-overview.html
- \title external: Qt Creator Overview
-*/
diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc
index c2eed07c6d..c96920a689 100644
--- a/doc/global/externalsites/qtcreator.qdoc
+++ b/doc/global/externalsites/qtcreator.qdoc
@@ -392,6 +392,14 @@
\title Qt Creator: Adding New Custom Wizards
*/
/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-json.html
+ \title Qt Creator: Adding JSON-Based Wizards
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-xml.html
+ \title Qt Creator: Adding XML-Based Wizards
+*/
+/*!
\externalpage http://doc.qt.io/qtcreator/creator-projects-autotools.html
\title Qt Creator: Setting Up an Autotools Project
*/
diff --git a/examples/corelib/threads/doc/src/waitconditions.qdoc b/examples/corelib/threads/doc/src/waitconditions.qdoc
index aff6997b55..3d15f0d4bf 100644
--- a/examples/corelib/threads/doc/src/waitconditions.qdoc
+++ b/examples/corelib/threads/doc/src/waitconditions.qdoc
@@ -136,7 +136,7 @@
byte in the buffer, \c numUsedBytes is \c BufferSize - 1 and the
\c bufferNotEmpty condition is signalled. At that point, two
things can happen: Either the consumer thread takes over and
- reads that byte, or the consumer gets to produce a second byte.
+ reads that byte, or the producer gets to produce a second byte.
The producer-consumer model presented in this example makes it
possible to write highly concurrent multithreaded applications.
diff --git a/mkspecs/common/g++-macx.conf b/mkspecs/common/g++-macx.conf
index 086510dd96..0ee8130828 100644
--- a/mkspecs/common/g++-macx.conf
+++ b/mkspecs/common/g++-macx.conf
@@ -14,8 +14,6 @@ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2
-QMAKE_LFLAGS_STATIC_LIB += -all_load
-
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42
QMAKE_OBJCFLAGS_PRECOMPILE = -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 8beeba3f39..3b0e03755d 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -179,7 +179,7 @@ CMAKE_MODULE_DEPS = $$cmakeModuleList($$sort_depends(QT.$${MODULE}.depends, QT.)
CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::")
!isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5::$${CMAKE_PARTIAL_MODULE_DEPS}"
-CMAKE_QT_STEM = Qt$$eval(QT.$${MODULE}.MAJOR_VERSION)$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
+CMAKE_QT_STEM = Qt$$QT_MAJOR_VERSION$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
mac {
!isEmpty(CMAKE_STATIC_TYPE) {
diff --git a/mkspecs/features/win32/windeployqt.prf b/mkspecs/features/win32/windeployqt.prf
index 22253f6299..fb5b2c4234 100644
--- a/mkspecs/features/win32/windeployqt.prf
+++ b/mkspecs/features/win32/windeployqt.prf
@@ -15,5 +15,6 @@ build_pass {
QMAKE_DISTCLEAN += $$WINDEPLOYQT_OUTPUT
} else {
windeployqt.CONFIG += recursive
+ windeployqt_clean.CONFIG += recursive
}
-QMAKE_EXTRA_TARGETS += windeployqt
+QMAKE_EXTRA_TARGETS += windeployqt windeployqt_clean
diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf
index 3d2a0e9090..47505fc06a 100644
--- a/mkspecs/freebsd-g++/qmake.conf
+++ b/mkspecs/freebsd-g++/qmake.conf
@@ -17,6 +17,7 @@ QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
+QMAKE_LIBS_EXECINFO = -lexecinfo
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
diff --git a/mkspecs/freebsd-g++46/qmake.conf b/mkspecs/freebsd-g++46/qmake.conf
index b15e689cde..277997ab28 100644
--- a/mkspecs/freebsd-g++46/qmake.conf
+++ b/mkspecs/freebsd-g++46/qmake.conf
@@ -17,6 +17,7 @@ QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
+QMAKE_LIBS_EXECINFO = -lexecinfo
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf
index aa849eb8b1..f1f23dd716 100644
--- a/mkspecs/macx-ios-clang/features/default_post.prf
+++ b/mkspecs/macx-ios-clang/features/default_post.prf
@@ -174,6 +174,21 @@ macx-xcode {
ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY
QMAKE_MAC_XCODE_SETTINGS += ios_device_family
+ # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an
+ # AppIcon.appiconset, we configure Xcode to use it for app icons.
+ for(bundle_data, QMAKE_BUNDLE_DATA) {
+ for(bundle_file, $${bundle_data}.files) {
+ !contains(bundle_file, .*\.xcassets$): next()
+ !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
+
+ asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
+ asset_catalog_appicon.value = "AppIcon"
+ QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
+ break()
+ }
+ !isEmpty(asset_catalog_appicon.name): break()
+ }
+
# Set up default 4-inch iPhone/iPod launch image so that our apps
# support the full screen resolution of those devices.
launch_image = Default-568h@2x.png
diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf
index 0c083edf80..0dd761760c 100644
--- a/mkspecs/macx-ios-clang/qmake.conf
+++ b/mkspecs/macx-ios-clang/qmake.conf
@@ -7,7 +7,7 @@ CONFIG += app_bundle reduce_exports incremental global_init_link
QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_MACOSX_DEPLOYMENT_TARGET =
-QMAKE_IOS_DEPLOYMENT_TARGET = 5.0
+QMAKE_IOS_DEPLOYMENT_TARGET = 5.1.1
INCLUDEPATH += $$PWD/ios
DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG
diff --git a/mkspecs/unsupported/freebsd-clang/qmake.conf b/mkspecs/unsupported/freebsd-clang/qmake.conf
index 2cfd763688..92b7c47590 100644
--- a/mkspecs/unsupported/freebsd-clang/qmake.conf
+++ b/mkspecs/unsupported/freebsd-clang/qmake.conf
@@ -18,6 +18,7 @@ QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
+QMAKE_LIBS_EXECINFO = -lexecinfo
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index a049b28b5f..e1c2d98f06 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -40,7 +40,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS
-CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS)
+CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS)
CXXFLAGS_BARE = $(CFLAGS_BARE)
CXXFLAGS = $(CFLAGS)
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 202df7e03c..b78a742999 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -122,10 +122,10 @@
configuration options to fine tune the build process. For more information,
see \l{Building Common Project Types}.
- You can use the \l{external: Qt Creator Manual}{Qt Creator} new project
- wizard to create the project file. You choose the project template, and Qt
- Creator creates a project file with default values that enable you to build
- and run the project. You can modify the project file to suit your purposes.
+ You can use the \l{Qt Creator: Creating Projects}{Qt Creator new project wizard} to create the project file.
+ You choose the project template, and Qt Creator creates a project file with
+ default values that enable you to build and run the project. You can modify
+ the project file to suit your purposes.
You can also use qmake to generate project files. For a full description of
qmake command line options, see \l{Running qmake}.
@@ -1464,6 +1464,15 @@
executable needs to be specified as long as it is on a path contained
in the \c PATH variable when the Makefile is processed.
+ \section1 QMAKE_CFLAGS
+
+ Specifies the C compiler flags for building
+ a project. The value of this variable is typically handled by
+ qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
+ needs to be modified. The flags specific to debug and release modes can be
+ adjusted by modifying the \c QMAKE_CFLAGS_DEBUG and
+ \c QMAKE_CFLAGS_RELEASE variables, respectively.
+
\target QMAKE_CFLAGS_DEBUG
\section1 QMAKE_CFLAGS_DEBUG
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 0ff42500de..8f24c20712 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -739,13 +739,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
mkt << "DEFINES = "
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
<< varGlue("DEFINES","-D"," -D","") << endl;
- mkt << "INCPATH = -I" << specdir();
- if(!project->isActiveConfig("no_include_pwd")) {
- QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
- if(pwd.isEmpty())
- pwd = ".";
- mkt << " -I" << pwd;
- }
+ mkt << "INCPATH =";
{
const ProStringList &incs = project->values("INCLUDEPATH");
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit)
@@ -1497,7 +1491,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";\n"
<< "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";\n";
}
- t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";\n"
+ t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH"), SettingsAsList, 5) << ";\n"
<< "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";\n"
<< "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"),
!project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";\n";
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 3b807c4ccf..a9f22d8597 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -444,6 +444,25 @@ MakefileGenerator::init()
setSystemIncludes(v["QMAKE_DEFAULT_INCDIRS"]);
+ ProStringList &incs = project->values("INCLUDEPATH");
+ if (!project->isActiveConfig("no_include_pwd")) {
+ if (Option::output_dir != qmake_getpwd()) {
+ // Pretend that the build dir is the source dir for #include purposes,
+ // consistently with the "transparent shadow builds" strategy. This is
+ // also consistent with #include "foo.h" falling back to #include <foo.h>
+ // behavior if it doesn't find the file in the source dir.
+ incs.prepend(Option::output_dir);
+ }
+ // This makes #include <foo.h> work if the header lives in the source dir.
+ // The benefit of that is questionable, as generally the user should use the
+ // correct include style, and extra compilers that put stuff in the source dir
+ // should add the dir themselves.
+ // More importantly, it makes #include "foo.h" work with MSVC when shadow-building,
+ // as this compiler looks files up relative to %CD%, not the source file's parent.
+ incs.prepend(qmake_getpwd());
+ }
+ incs.append(project->specDir());
+
const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 };
for (int i = 0; cacheKeys[i]; ++i) {
if (v[cacheKeys[i]].isEmpty())
@@ -793,12 +812,6 @@ MakefileGenerator::init()
ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"];
if(project->isActiveConfig("depend_includepath"))
incDirs += v["INCLUDEPATH"];
- if(!project->isActiveConfig("no_include_pwd")) {
- QString pwd = qmake_getpwd();
- if(pwd.isEmpty())
- pwd = ".";
- incDirs += pwd;
- }
QList<QMakeLocalFileName> deplist;
for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it)
deplist.append(QMakeLocalFileName(unescapeFilePath((*it).toQString())));
@@ -850,11 +863,6 @@ MakefileGenerator::init()
(*it) = Option::fixPathToLocalOS((*it).toQString());
}
- if(!project->isActiveConfig("no_include_pwd")) { //get the output_dir into the pwd
- if(Option::output_dir != qmake_getpwd())
- project->values("INCLUDEPATH").append(".");
- }
-
//fix up the target deps
static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 };
for (int path = 0; fixpaths[path]; path++) {
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 8270f02feb..469f23340d 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -184,13 +184,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< varGlue("DEFINES","-D"," -D","") << endl;
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n";
t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n";
- t << "INCPATH = -I" << specdir();
- if(!project->isActiveConfig("no_include_pwd")) {
- QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
- if(pwd.isEmpty())
- pwd = ".";
- t << " -I" << pwd;
- }
+ t << "INCPATH =";
{
QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
const ProStringList &incs = project->values("INCLUDEPATH");
@@ -1019,8 +1013,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t-$(DEL_FILE) -r " << bundlePath << endl;
} else if(project->isActiveConfig("compile_libtool")) {
t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n";
- } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() &&
- !project->isActiveConfig("plugin")) {
+ } else if (project->isActiveConfig("staticlib")) {
+ t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
+ } else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) {
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
if (!project->isActiveConfig("unversioned_libname")) {
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
@@ -1029,7 +1024,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t-$(DEL_FILE) $(TARGETA)\n";
}
} else {
- t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
+ t << "\t-$(DEL_FILE) $(TARGET) \n";
}
t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
{
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 42431f0131..247c53986e 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -311,13 +311,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
{
t << "INCPATH = ";
- if (!project->isActiveConfig("no_include_pwd")) {
- QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
- if (pwd.isEmpty())
- pwd = ".";
- t << "-I" << pwd << " ";
- }
-
QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
const ProStringList &incs = project->values("INCLUDEPATH");
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
@@ -331,8 +324,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
t << "-I";
t << quote << inc << quote << " ";
}
- t << "-I" << quote << specdir() << quote
- << endl;
+ t << endl;
}
void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 61c0cda89e..4c228be310 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1620,7 +1620,6 @@ void VcprojGenerator::initOld()
inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already
project->values("MSVCPROJ_INCPATH").append("-I" + inc);
}
- project->values("MSVCPROJ_INCPATH").append("-I" + specdir());
QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT");
project->values("MSVCPROJ_TARGET") = ProStringList(dest);
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index b6bcdbf366..a0b5a7f35f 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -546,12 +546,13 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
const QString del_statement("-$(DEL_FILE)");
if(project->isActiveConfig("no_delete_multiple_files")) {
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
- t << "\n\t" << del_statement << " " << escapeFilePath((*it));
+ t << "\n\t" << del_statement
+ << ' ' << escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
} else {
QString files, file;
const int commandlineLimit = 2047; // NT limit, expanded
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
- file = " " + escapeFilePath((*it));
+ file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
if(del_statement.length() + files.length() +
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
t << "\n\t" << del_statement << files;
@@ -614,8 +615,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t)
if(!inc.isEmpty())
t << "-I\"" << inc << "\" ";
}
- t << "-I\"" << specdir() << "\""
- << endl;
+ t << endl;
}
void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index e6d666f1b7..68304c2030 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -980,6 +980,45 @@ void QMakeEvaluator::setTemplate()
}
}
+#if defined(Q_CC_MSVC)
+static ProString msvcBinDirToQMakeArch(QString subdir)
+{
+ int idx = subdir.indexOf(QLatin1Char('\\'));
+ if (idx == -1)
+ return ProString("x86");
+ subdir.remove(0, idx + 1);
+ idx = subdir.indexOf(QLatin1Char('_'));
+ if (idx >= 0)
+ subdir.remove(0, idx + 1);
+ subdir = subdir.toLower();
+ if (subdir == QStringLiteral("amd64"))
+ return ProString("x86_64");
+ return ProString(subdir);
+}
+
+static ProString defaultMsvcArchitecture()
+{
+ return ProString("x86");
+}
+
+static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pathVar)
+{
+ if (vcInstallDir.isEmpty())
+ return defaultMsvcArchitecture();
+ QString vcBinDir = vcInstallDir;
+ if (vcBinDir.endsWith(QLatin1Char('\\')))
+ vcBinDir.chop(1);
+ foreach (const QString &dir, pathVar.split(QLatin1Char(';'))) {
+ if (!dir.startsWith(vcBinDir, Qt::CaseInsensitive))
+ continue;
+ const ProString arch = msvcBinDirToQMakeArch(dir.mid(vcBinDir.length() + 1));
+ if (!arch.isEmpty())
+ return arch;
+ }
+ return defaultMsvcArchitecture();
+}
+#endif // defined(Q_CC_MSVC)
+
void QMakeEvaluator::loadDefaults()
{
ProValueMap &vars = m_valuemapStack.top();
@@ -1041,21 +1080,9 @@ void QMakeEvaluator::loadDefaults()
vars[ProKey("QMAKE_HOST.arch")] << archStr;
# if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake
- QLatin1Char backslash('\\');
- QString paths = m_option->getEnv(QLatin1String("PATH"));
- QString vcBin64 = m_option->getEnv(QLatin1String("VCINSTALLDIR"));
- if (!vcBin64.endsWith(backslash))
- vcBin64.append(backslash);
- vcBin64.append(QLatin1String("bin\\amd64"));
- QString vcBinX86_64 = m_option->getEnv(QLatin1String("VCINSTALLDIR"));
- if (!vcBinX86_64.endsWith(backslash))
- vcBinX86_64.append(backslash);
- vcBinX86_64.append(QLatin1String("bin\\x86_amd64"));
- if (paths.contains(vcBin64, Qt::CaseInsensitive)
- || paths.contains(vcBinX86_64, Qt::CaseInsensitive))
- vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86_64");
- else
- vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86");
+ vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture(
+ m_option->getEnv(QLatin1String("VCINSTALLDIR")),
+ m_option->getEnv(QLatin1String("PATH")));
# endif
#elif defined(Q_OS_UNIX)
struct utsname name;
diff --git a/src/3rdparty/zlib.pri b/src/3rdparty/zlib.pri
index a7073d5c3a..868d1c71bb 100644
--- a/src/3rdparty/zlib.pri
+++ b/src/3rdparty/zlib.pri
@@ -1,5 +1,5 @@
wince*: DEFINES += NO_ERRNO_H
-INCLUDEPATH += $$PWD/zlib
+INCLUDEPATH = $$PWD/zlib $$INCLUDEPATH
SOURCES+= \
$$PWD/zlib/adler32.c \
$$PWD/zlib/compress.c \
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
index 34fc31b222..516671739e 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
@@ -45,7 +45,6 @@ package org.qtproject.qt5.android;
import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
-import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
@@ -87,7 +86,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
@Override
public void surfaceCreated(SurfaceHolder holder)
{
- QtNative.setSurface(getId(), holder.getSurface(), getWidth(), getHeight());
}
@Override
diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc
index a4f1b8723a..03af1d81bf 100644
--- a/src/corelib/doc/src/external-resources.qdoc
+++ b/src/corelib/doc/src/external-resources.qdoc
@@ -55,3 +55,14 @@
\externalpage http://www.iana.org/assignments/character-sets/character-sets.xml
\title IANA character-sets encoding file
*/
+
+/*!
+ \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html
+ \title Using a Designer UI File in Your Application
+*/
+
+/*!
+ \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor
+ \title Qt Designer's Widget Editing Mode#The Property Editor
+*/
+*/
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 86621364ec..0b1374a3bb 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -35,6 +35,8 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
# Only used on platforms with CONFIG += precompile_header
PRECOMPILED_HEADER = global/qt_pch.h
+# qlogging.cpp uses backtrace(3), which is in a separate library on the BSDs.
+
if(linux*|hurd*):!cross_compile:!static:!*-armcc* {
QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate
prog=$$quote(if (/program interpreter: (.*)]/) { print $1; })
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 77f6c48857..2881a0fcbd 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -142,6 +142,10 @@
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC */
# define Q_CC_INTEL (__INTEL_COMPILER)
+# ifdef __clang__
+/* Intel C++ masquerades as Clang masquerading as GCC */
+# define Q_CC_CLANG 305
+# endif
# define Q_ASSUME_IMPL(expr) __assume(expr)
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if __INTEL_COMPILER >= 1300 && !defined(__APPLE__)
@@ -537,9 +541,11 @@
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_RAW_STRINGS
# define Q_COMPILER_REF_QUALIFIERS
+# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_UNRESTRICTED_UNIONS
# endif
# if __INTEL_COMPILER >= 1500
+# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 7c643f7592..0e383c18d2 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian<qint8>(const uchar *src)
*/
template <typename T> T qbswap(T source);
+#ifdef __has_builtin
+# define QT_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define QT_HAS_BUILTIN(x) 0
+#endif
+
// GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8;
// Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one
-#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206)
+#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32)
template <> inline quint64 qbswap<quint64>(quint64 source)
{
return __builtin_bswap64(source);
@@ -306,7 +312,7 @@ template <> inline quint32 qbswap<quint32>(quint32 source)
| ((source & 0xff000000) >> 24);
}
#endif // GCC & Clang intrinsics
-#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302)
+#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16)
template <> inline quint16 qbswap<quint16>(quint16 source)
{
return __builtin_bswap16(source);
@@ -320,6 +326,8 @@ template <> inline quint16 qbswap<quint16>(quint16 source)
}
#endif // GCC & Clang intrinsics
+#undef QT_HAS_BUILTIN
+
// signed specializations
template <> inline qint64 qbswap<qint64>(qint64 source)
{
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 4895bf6dd9..0a9e2f97db 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -41,6 +41,8 @@
#include "qdatetime.h"
#include <private/qlocale_tools_p.h>
+#include <private/qsystemlibrary_p.h>
+
#ifndef QT_NO_QOBJECT
#include <private/qthread_p.h>
#endif
@@ -1876,6 +1878,70 @@ QT_BEGIN_INCLUDE_NAMESPACE
QT_END_INCLUDE_NAMESPACE
#ifndef Q_OS_WINRT
+
+# ifndef Q_OS_WINCE
+
+// Determine Windows versions >= 8 by querying the version of kernel32.dll.
+static inline bool determineWinOsVersionPost8(OSVERSIONINFO *result)
+{
+ typedef WORD (WINAPI* PtrGetFileVersionInfoSizeW)(LPCWSTR, LPDWORD);
+ typedef BOOL (WINAPI* PtrVerQueryValueW)(LPCVOID, LPCWSTR, LPVOID, PUINT);
+ typedef BOOL (WINAPI* PtrGetFileVersionInfoW)(LPCWSTR, DWORD, DWORD, LPVOID);
+
+ QSystemLibrary versionLib(QStringLiteral("version"));
+ if (!versionLib.load())
+ return false;
+ PtrGetFileVersionInfoSizeW getFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)versionLib.resolve("GetFileVersionInfoSizeW");
+ PtrVerQueryValueW verQueryValueW = (PtrVerQueryValueW)versionLib.resolve("VerQueryValueW");
+ PtrGetFileVersionInfoW getFileVersionInfoW = (PtrGetFileVersionInfoW)versionLib.resolve("GetFileVersionInfoW");
+ if (!getFileVersionInfoSizeW || !verQueryValueW || !getFileVersionInfoW)
+ return false;
+
+ const wchar_t kernel32Dll[] = L"kernel32.dll";
+ DWORD handle;
+ const DWORD size = getFileVersionInfoSizeW(kernel32Dll, &handle);
+ if (!size)
+ return false;
+ QScopedArrayPointer<BYTE> versionInfo(new BYTE[size]);
+ if (!getFileVersionInfoW(kernel32Dll, handle, size, versionInfo.data()))
+ return false;
+ UINT uLen;
+ VS_FIXEDFILEINFO *fileInfo = Q_NULLPTR;
+ if (!verQueryValueW(versionInfo.data(), L"\\", (LPVOID *)&fileInfo, &uLen))
+ return false;
+ const DWORD fileVersionMS = fileInfo->dwFileVersionMS;
+ const DWORD fileVersionLS = fileInfo->dwFileVersionLS;
+ result->dwMajorVersion = HIWORD(fileVersionMS);
+ result->dwMinorVersion = LOWORD(fileVersionMS);
+ result->dwBuildNumber = HIWORD(fileVersionLS);
+ return true;
+}
+
+// Fallback for determining Windows versions >= 8 by looping using the
+// version check macros. Note that it will return build number=0 to avoid
+// inefficient looping.
+static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result)
+{
+ result->dwBuildNumber = 0;
+ DWORDLONG conditionMask = 0;
+ VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
+ OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0,
+ result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
+ for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion)
+ result->dwMajorVersion = checkVersion.dwMajorVersion;
+ conditionMask = 0;
+ checkVersion.dwMajorVersion = result->dwMajorVersion;
+ checkVersion.dwMinorVersion = 0;
+ VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL);
+ VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
+ for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
+ result->dwMinorVersion = checkVersion.dwMinorVersion;
+}
+
+# endif // !Q_OS_WINCE
+
static inline OSVERSIONINFO winOsVersion()
{
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
@@ -1891,16 +1957,8 @@ static inline OSVERSIONINFO winOsVersion()
# endif
# ifndef Q_OS_WINCE
if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
- // This could be Windows 8.1 or higher. Note that as of Windows 9,
- // the major version needs to be checked as well.
- DWORDLONG conditionMask = 0;
- VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
- OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion,
- result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
- for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
- result.dwMinorVersion = checkVersion.dwMinorVersion;
+ if (!determineWinOsVersionPost8(&result))
+ determineWinOsVersionFallbackPost8(&result);
}
# endif // !Q_OS_WINCE
return result;
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index c60ca7e9b0..575da452b9 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -116,10 +116,11 @@ QLibrarySettings::QLibrarySettings()
QStringList children = settings->childGroups();
#ifdef QT_BOOTSTRAPPED
haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths"));
- haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths"));
#else
- haveEffectivePaths = children.contains(QLatin1String("EffectivePaths"));
+ // EffectiveSourcePaths is for the Qt build only, so needs no backwards compat trickery.
+ bool haveEffectiveSourcePaths = false;
#endif
+ haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths"));
// Backwards compat: an existing but empty file is claimed to contain the Paths section.
havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection)))
|| children.contains(QLatin1String("Paths"));
@@ -128,9 +129,7 @@ QLibrarySettings::QLibrarySettings()
settings.reset(0);
#else
} else {
-#ifdef QT_BOOTSTRAPPED
haveEffectiveSourcePaths = false;
-#endif
haveEffectivePaths = false;
havePaths = false;
#endif
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 4b582642f3..c8aa53aced 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -592,7 +592,7 @@
string, "ddd MMM d yyyy". See QDate::toString() for more information.
\value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or
- \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00)
+ \c{YYYY-MM-DDTHH:mm:ss}, \c{YYYY-MM-DDTHH:mm:ssTZD} (e.g., 1997-07-16T19:20:30+01:00)
for combined dates and times.
\value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index 4cd71d7d52..9d5d6de6ad 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -173,6 +173,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case TempLocation:
return QDir::tempPath();
case GenericDataLocation:
+ case AppDataLocation:
case AppLocalDataLocation:
case GenericCacheLocation:
case CacheLocation:
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 47b7744e81..6035993500 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -45,7 +45,7 @@
// We mean it.
//
-#include <qdatetime.h>
+#include <qelapsedtimer.h>
#include <qthread.h>
#include <qmutex.h>
#include <qwaitcondition.h>
@@ -83,7 +83,7 @@ public:
{
if (totalTimeOut == -1)
return SLEEPMAX;
- return qMax(totalTimeOut - timer.elapsed(), 0);
+ return qMax(int(totalTimeOut - timer.elapsed()), 0);
}
bool hasTimedOut() const
@@ -99,7 +99,7 @@ public:
}
private:
- QTime timer;
+ QElapsedTimer timer;
int totalTimeOut;
int nextSleep;
};
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 223de0c8e0..84aa2e3184 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2741,9 +2741,9 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
You can check if the QMetaObject::Connection is valid by casting it to a bool.
This function works in the same way as
- connect(const QObject *sender, const char *signal,
+ \c {connect(const QObject *sender, const char *signal,
const QObject *receiver, const char *method,
- Qt::ConnectionType type)
+ Qt::ConnectionType type)}
but it uses QMetaMethod to specify signal and method.
\sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
@@ -2996,7 +2996,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
otherwise returns \c false.
This function provides the same possibilities like
- disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
+ \c {disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) }
but uses QMetaMethod to represent the signal and the method to be disconnected.
Additionally this function returnsfalse and no signals and slots disconnected
@@ -4112,7 +4112,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
This macro associates extra information to the class, which is available
using QObject::metaObject(). Qt makes only limited use of this feature, in
- the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML} modules.
+ the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML module}{Qt QML}.
The extra information takes the form of a \a Name string and a \a Value
literal string.
@@ -4124,7 +4124,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
\sa QMetaObject::classInfo()
\sa QAxFactory
\sa {Using Qt D-Bus Adaptors}
- \sa {Extending QML - Default Property Example}
+ \sa {Extending QML}
*/
/*!
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 3f958138b3..f7b8fe5ca5 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -4001,6 +4001,13 @@ void QAssociativeIterable::const_iterator::end()
m_impl.end();
}
+void find(QAssociativeIterable::const_iterator &it, const QVariant &key)
+{
+ Q_ASSERT(key.userType() == it.m_impl._metaType_id_key);
+ const QtMetaTypePrivate::VariantData dkey(key.userType(), key.constData(), 0 /*key.flags()*/);
+ it.m_impl.find(dkey);
+}
+
/*!
Returns a QAssociativeIterable::const_iterator for the beginning of the container. This
can be used in stl-style iteration.
@@ -4028,27 +4035,37 @@ QAssociativeIterable::const_iterator QAssociativeIterable::end() const
}
/*!
+ \internal
+
+ Returns a QAssociativeIterable::const_iterator for the given key \a key
+ in the container, if the types are convertible.
+
+ If the key is not found, returns end().
+
+ This can be used in stl-style iteration.
+
+ \sa begin(), end(), value()
+*/
+QAssociativeIterable::const_iterator find(const QAssociativeIterable &iterable, const QVariant &key)
+{
+ QAssociativeIterable::const_iterator it(iterable, new QAtomicInt(0));
+ QVariant key_ = key;
+ if (key_.canConvert(iterable.m_impl._metaType_id_key) && key_.convert(iterable.m_impl._metaType_id_key))
+ find(it, key_);
+ else
+ it.end();
+ return it;
+}
+
+/*!
Returns the value for the given \a key in the container, if the types are convertible.
*/
QVariant QAssociativeIterable::value(const QVariant &key) const
{
- QVariant key_ = key;
- if (!key_.canConvert(m_impl._metaType_id_key))
- return QVariant();
- if (!key_.convert(m_impl._metaType_id_key))
+ const const_iterator it = find(*this, key);
+ if (it == end())
return QVariant();
- const QtMetaTypePrivate::VariantData dkey(key_.userType(), key_.constData(), 0 /*key.flags()*/);
- QtMetaTypePrivate::QAssociativeIterableImpl impl = m_impl;
- impl.find(dkey);
- QtMetaTypePrivate::QAssociativeIterableImpl endIt = m_impl;
- endIt.end();
- if (impl.equal(endIt))
- return QVariant();
- const QtMetaTypePrivate::VariantData d = impl.getCurrentValue();
- QVariant v(d.metaTypeId, d.data, d.flags);
- if (d.metaTypeId == qMetaTypeId<QVariant>())
- return *reinterpret_cast<const QVariant*>(d.data);
- return v;
+ return *it;
}
/*!
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 7bee756fa5..c33ac834c0 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -633,6 +633,9 @@ public:
void begin();
void end();
+ // ### Qt 5.5: make find() (1st one) a member function
+ friend void find(const_iterator &it, const QVariant &key);
+ friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key);
public:
~const_iterator();
const_iterator(const const_iterator &other);
@@ -662,6 +665,9 @@ public:
const_iterator begin() const;
const_iterator end() const;
+private: // ### Qt 5.5: make it a public find() member function:
+ friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key);
+public:
QVariant value(const QVariant &key) const;
diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp
index 2ac32d5d6b..0f4c8efb03 100644
--- a/src/corelib/thread/qatomic.cpp
+++ b/src/corelib/thread/qatomic.cpp
@@ -250,7 +250,7 @@
/*!
- \fn int QAtomicInteger::load() const
+ \fn T QAtomicInteger::load() const
Atomically loads the value of this QAtomicInteger using relaxed memory
ordering. The value is not modified in any way, but note that there's no
@@ -260,7 +260,7 @@
*/
/*!
- \fn int QAtomicInteger::loadAcquire() const
+ \fn T QAtomicInteger::loadAcquire() const
Atomically loads the value of this QAtomicInteger using the "Acquire" memory
ordering. The value is not modified in any way, but note that there's no
@@ -270,7 +270,7 @@
*/
/*!
- \fn void QAtomicInteger::store(int newValue)
+ \fn void QAtomicInteger::store(T newValue)
Atomically stores the \a newValue value into this atomic type, using
relaxed memory ordering.
@@ -279,7 +279,7 @@
*/
/*!
- \fn void QAtomicInteger::storeRelease(int newValue)
+ \fn void QAtomicInteger::storeRelease(T newValue)
Atomically stores the \a newValue value into this atomic type, using
the "Release" memory ordering.
@@ -288,7 +288,7 @@
*/
/*!
- \fn QAtomicInteger::operator int() const
+ \fn QAtomicInteger::operator T() const
\since 5.3
Atomically loads the value of this QAtomicInteger using a sequentially
@@ -300,7 +300,7 @@
*/
/*!
- \fn QAtomicInteger &QAtomicInteger::operator=(int newValue)
+ \fn QAtomicInteger &QAtomicInteger::operator=(T newValue)
\since 5.3
Atomically stores the \a newValue value into this atomic type using a
@@ -335,7 +335,7 @@
*/
/*!
- \fn int QAtomicInteger::operator++()
+ \fn T QAtomicInteger::operator++()
\since 5.3
Atomically pre-increments the value of this QAtomicInteger. Returns the new
@@ -348,7 +348,7 @@
*/
/*!
- \fn int QAtomicInteger::operator++(int)
+ \fn T QAtomicInteger::operator++(int)
\since 5.3
Atomically post-increments the value of this QAtomicInteger. Returns the old
@@ -373,7 +373,7 @@
*/
/*!
- \fn int QAtomicInteger::operator--()
+ \fn T QAtomicInteger::operator--()
\since 5.3
Atomically pre-decrements the value of this QAtomicInteger. Returns the new
@@ -386,7 +386,7 @@
*/
/*!
- \fn int QAtomicInteger::operator--(int)
+ \fn T QAtomicInteger::operator--(int)
\since 5.3
Atomically post-decrements the value of this QAtomicInteger. Returns the old
@@ -409,7 +409,7 @@
Returns \c true if atomic test-and-set is wait-free, false otherwise.
*/
-/*! \fn bool QAtomicInteger::testAndSetRelaxed(int expectedValue, int newValue)
+/*! \fn bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue)
Atomic test-and-set.
@@ -423,7 +423,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn bool QAtomicInteger::testAndSetAcquire(int expectedValue, int newValue)
+/*! \fn bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue)
Atomic test-and-set.
@@ -438,7 +438,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn bool QAtomicInteger::testAndSetRelease(int expectedValue, int newValue)
+/*! \fn bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue)
Atomic test-and-set.
@@ -453,7 +453,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn bool QAtomicInteger::testAndSetOrdered(int expectedValue, int newValue)
+/*! \fn bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue)
Atomic test-and-set.
@@ -480,7 +480,7 @@
otherwise.
*/
-/*! \fn int QAtomicInteger::fetchAndStoreRelaxed(int newValue)
+/*! \fn T QAtomicInteger::fetchAndStoreRelaxed(T newValue)
Atomic fetch-and-store.
@@ -492,7 +492,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn int QAtomicInteger::fetchAndStoreAcquire(int newValue)
+/*! \fn T QAtomicInteger::fetchAndStoreAcquire(T newValue)
Atomic fetch-and-store.
@@ -505,7 +505,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn int QAtomicInteger::fetchAndStoreRelease(int newValue)
+/*! \fn T QAtomicInteger::fetchAndStoreRelease(T newValue)
Atomic fetch-and-store.
@@ -518,7 +518,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn int QAtomicInteger::fetchAndStoreOrdered(int newValue)
+/*! \fn T QAtomicInteger::fetchAndStoreOrdered(T newValue)
Atomic fetch-and-store.
@@ -543,7 +543,7 @@
otherwise.
*/
-/*! \fn int QAtomicInteger::fetchAndAddRelaxed(int valueToAdd)
+/*! \fn T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd)
Atomic fetch-and-add.
@@ -557,7 +557,7 @@
\sa operator+=(), fetchAndSubRelaxed()
*/
-/*! \fn int QAtomicInteger::fetchAndAddAcquire(int valueToAdd)
+/*! \fn T QAtomicInteger::fetchAndAddAcquire(T valueToAdd)
Atomic fetch-and-add.
@@ -572,7 +572,7 @@
\sa operator+=(), fetchAndSubAcquire()
*/
-/*! \fn int QAtomicInteger::fetchAndAddRelease(int valueToAdd)
+/*! \fn T QAtomicInteger::fetchAndAddRelease(T valueToAdd)
Atomic fetch-and-add.
@@ -587,7 +587,7 @@
\sa operator+=(), fetchAndSubRelease()
*/
-/*! \fn int QAtomicInteger::fetchAndAddOrdered(int valueToAdd)
+/*! \fn T QAtomicInteger::fetchAndAddOrdered(T valueToAdd)
Atomic fetch-and-add.
@@ -602,7 +602,7 @@
\sa operator+=(), fetchAndSubOrdered()
*/
-/*! \fn int QAtomicInteger::operator+=(int valueToAdd)
+/*! \fn T QAtomicInteger::operator+=(T valueToAdd)
\since 5.3
Atomic add-and-fetch.
@@ -616,7 +616,7 @@
\sa fetchAndAddOrdered(), operator-=()
*/
-/*! \fn int QAtomicInteger::fetchAndSubRelaxed(int valueToSub)
+/*! \fn T QAtomicInteger::fetchAndSubRelaxed(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -631,7 +631,7 @@
\sa operator-=(), fetchAndAddRelaxed()
*/
-/*! \fn int QAtomicInteger::fetchAndSubAcquire(int valueToSub)
+/*! \fn T QAtomicInteger::fetchAndSubAcquire(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -647,7 +647,7 @@
\sa operator-=(), fetchAndAddAcquire()
*/
-/*! \fn int QAtomicInteger::fetchAndSubRelease(int valueToSub)
+/*! \fn T QAtomicInteger::fetchAndSubRelease(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -663,7 +663,7 @@
\sa operator-=(), fetchAndAddRelease()
*/
-/*! \fn int QAtomicInteger::fetchAndSubOrdered(int valueToSub)
+/*! \fn T QAtomicInteger::fetchAndSubOrdered(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -679,7 +679,7 @@
\sa operator-=(), fetchAndAddOrdered()
*/
-/*! \fn int QAtomicInteger::operator-=(int valueToSub)
+/*! \fn T QAtomicInteger::operator-=(T valueToSub)
\since 5.3
Atomic sub-and-fetch.
@@ -693,7 +693,7 @@
\sa fetchAndSubOrdered(), operator+=()
*/
-/*! \fn int QAtomicInteger::fetchAndOrRelaxed(int valueToOr)
+/*! \fn T QAtomicInteger::fetchAndOrRelaxed(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -708,7 +708,7 @@
\sa operator|=()
*/
-/*! \fn int QAtomicInteger::fetchAndOrAcquire(int valueToOr)
+/*! \fn T QAtomicInteger::fetchAndOrAcquire(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -724,7 +724,7 @@
\sa operator|=()
*/
-/*! \fn int QAtomicInteger::fetchAndOrRelease(int valueToOr)
+/*! \fn T QAtomicInteger::fetchAndOrRelease(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -740,7 +740,7 @@
\sa operator|=()
*/
-/*! \fn int QAtomicInteger::fetchAndOrOrdered(int valueToOr)
+/*! \fn T QAtomicInteger::fetchAndOrOrdered(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -756,7 +756,7 @@
\sa operator|=()
*/
-/*! \fn int QAtomicInteger::operator|=(int valueToOr)
+/*! \fn T QAtomicInteger::operator|=(T valueToOr)
\since 5.3
Atomic or-and-fetch.
@@ -770,7 +770,7 @@
\sa fetchAndOrOrdered()
*/
-/*! \fn int QAtomicInteger::fetchAndXorRelaxed(int valueToXor)
+/*! \fn T QAtomicInteger::fetchAndXorRelaxed(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -785,7 +785,7 @@
\sa operator^=()
*/
-/*! \fn int QAtomicInteger::fetchAndXorAcquire(int valueToXor)
+/*! \fn T QAtomicInteger::fetchAndXorAcquire(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -801,7 +801,7 @@
\sa operator^=()
*/
-/*! \fn int QAtomicInteger::fetchAndXorRelease(int valueToXor)
+/*! \fn T QAtomicInteger::fetchAndXorRelease(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -817,7 +817,7 @@
\sa operator^=()
*/
-/*! \fn int QAtomicInteger::fetchAndXorOrdered(int valueToXor)
+/*! \fn T QAtomicInteger::fetchAndXorOrdered(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -833,7 +833,7 @@
\sa operator^=()
*/
-/*! \fn int QAtomicInteger::operator^=(int valueToXor)
+/*! \fn T QAtomicInteger::operator^=(T valueToXor)
\since 5.3
Atomic xor-and-fetch.
@@ -847,7 +847,7 @@
\sa fetchAndXorOrdered()
*/
-/*! \fn int QAtomicInteger::fetchAndAndRelaxed(int valueToAnd)
+/*! \fn T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -862,7 +862,7 @@
\sa operator&=()
*/
-/*! \fn int QAtomicInteger::fetchAndAndAcquire(int valueToAnd)
+/*! \fn T QAtomicInteger::fetchAndAndAcquire(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -878,7 +878,7 @@
\sa operator&=()
*/
-/*! \fn int QAtomicInteger::fetchAndAndRelease(int valueToAnd)
+/*! \fn T QAtomicInteger::fetchAndAndRelease(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -894,7 +894,7 @@
\sa operator&=()
*/
-/*! \fn int QAtomicInteger::fetchAndAndOrdered(int valueToAnd)
+/*! \fn T QAtomicInteger::fetchAndAndOrdered(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -910,7 +910,7 @@
\sa operator&=()
*/
-/*! \fn int QAtomicInteger::operator&=(int valueToAnd)
+/*! \fn T QAtomicInteger::operator&=(T valueToAnd)
\since 5.3
Atomic add-and-fetch.
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index a665746db4..c273973472 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -73,13 +73,13 @@ public:
}
#ifdef Q_QDOC
- int load() const;
- int loadAcquire() const;
- void store(int newValue);
- void storeRelease(int newValue);
+ T load() const;
+ T loadAcquire() const;
+ void store(T newValue);
+ void storeRelease(T newValue);
- operator int() const;
- QAtomicInteger &operator=(int);
+ operator T() const;
+ QAtomicInteger &operator=(T);
static Q_DECL_CONSTEXPR bool isReferenceCountingNative();
static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree();
@@ -90,56 +90,56 @@ public:
static Q_DECL_CONSTEXPR bool isTestAndSetNative();
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree();
- bool testAndSetRelaxed(int expectedValue, int newValue);
- bool testAndSetAcquire(int expectedValue, int newValue);
- bool testAndSetRelease(int expectedValue, int newValue);
- bool testAndSetOrdered(int expectedValue, int newValue);
+ bool testAndSetRelaxed(T expectedValue, T newValue);
+ bool testAndSetAcquire(T expectedValue, T newValue);
+ bool testAndSetRelease(T expectedValue, T newValue);
+ bool testAndSetOrdered(T expectedValue, T newValue);
static Q_DECL_CONSTEXPR bool isFetchAndStoreNative();
static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree();
- int fetchAndStoreRelaxed(int newValue);
- int fetchAndStoreAcquire(int newValue);
- int fetchAndStoreRelease(int newValue);
- int fetchAndStoreOrdered(int newValue);
+ T fetchAndStoreRelaxed(T newValue);
+ T fetchAndStoreAcquire(T newValue);
+ T fetchAndStoreRelease(T newValue);
+ T fetchAndStoreOrdered(T newValue);
static Q_DECL_CONSTEXPR bool isFetchAndAddNative();
static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree();
- int fetchAndAddRelaxed(int valueToAdd);
- int fetchAndAddAcquire(int valueToAdd);
- int fetchAndAddRelease(int valueToAdd);
- int fetchAndAddOrdered(int valueToAdd);
-
- int fetchAndSubRelaxed(int valueToSub);
- int fetchAndSubAcquire(int valueToSub);
- int fetchAndSubRelease(int valueToSub);
- int fetchAndSubOrdered(int valueToSub);
-
- int fetchAndOrRelaxed(int valueToOr);
- int fetchAndOrAcquire(int valueToOr);
- int fetchAndOrRelease(int valueToOr);
- int fetchAndOrOrdered(int valueToOr);
-
- int fetchAndAndRelaxed(int valueToAnd);
- int fetchAndAndAcquire(int valueToAnd);
- int fetchAndAndRelease(int valueToAnd);
- int fetchAndAndOrdered(int valueToAnd);
-
- int fetchAndXorRelaxed(int valueToXor);
- int fetchAndXorAcquire(int valueToXor);
- int fetchAndXorRelease(int valueToXor);
- int fetchAndXorOrdered(int valueToXor);
-
- int operator++();
- int operator++(int);
- int operator--();
- int operator--(int);
- int operator+=(int value);
- int operator-=(int value);
- int operator|=(int value);
- int operator&=(int value);
- int operator^=(int value);
+ T fetchAndAddRelaxed(T valueToAdd);
+ T fetchAndAddAcquire(T valueToAdd);
+ T fetchAndAddRelease(T valueToAdd);
+ T fetchAndAddOrdered(T valueToAdd);
+
+ T fetchAndSubRelaxed(T valueToSub);
+ T fetchAndSubAcquire(T valueToSub);
+ T fetchAndSubRelease(T valueToSub);
+ T fetchAndSubOrdered(T valueToSub);
+
+ T fetchAndOrRelaxed(T valueToOr);
+ T fetchAndOrAcquire(T valueToOr);
+ T fetchAndOrRelease(T valueToOr);
+ T fetchAndOrOrdered(T valueToOr);
+
+ T fetchAndAndRelaxed(T valueToAnd);
+ T fetchAndAndAcquire(T valueToAnd);
+ T fetchAndAndRelease(T valueToAnd);
+ T fetchAndAndOrdered(T valueToAnd);
+
+ T fetchAndXorRelaxed(T valueToXor);
+ T fetchAndXorAcquire(T valueToXor);
+ T fetchAndXorRelease(T valueToXor);
+ T fetchAndXorOrdered(T valueToXor);
+
+ T operator++();
+ T operator++(int);
+ T operator--();
+ T operator--(int);
+ T operator+=(T value);
+ T operator-=(T value);
+ T operator|=(T value);
+ T operator&=(T value);
+ T operator^=(T value);
#endif
};
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 3caad7c4b2..933fd06afa 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -178,7 +178,7 @@ QThreadPrivate::~QThreadPrivate()
event loop by calling exec() and runs a Qt event loop inside the thread.
You can use worker objects by moving them to the thread using
- QObject::moveToThread.
+ QObject::moveToThread().
\snippet code/src_corelib_thread_qthread.cpp worker
@@ -256,7 +256,7 @@ QThreadPrivate::~QThreadPrivate()
\l{Mandelbrot Example}, as that is the name of the QThread subclass).
Note that this is currently not available with release builds on Windows.
- \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads}
+ \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads},
{Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example}
*/
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index a267dc6f7b..a683a36f61 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -45,6 +45,7 @@
#include <qmath.h>
#ifndef QT_NO_COMPRESS
+#include <zconf.h>
#include <zlib.h>
#endif
#include <ctype.h>
@@ -4017,7 +4018,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size)
copies of it exist that have not been modified.
This function can be used instead of fromRawData() to re-use
- existings QByteArray objects to save memory re-allocations.
+ existing QByteArray objects to save memory re-allocations.
\sa fromRawData(), data(), constData()
*/
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index f14d941c27..82f012be66 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -256,7 +256,7 @@ static int qFindByteArrayBoyerMoore(
#define REHASH(a) \
if (sl_minus_1 < sizeof(uint) * CHAR_BIT) \
- hashHaystack -= (a) << sl_minus_1; \
+ hashHaystack -= uint(a) << sl_minus_1; \
hashHaystack <<= 1
/*!
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 3326044b43..b95ccc0874 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -182,7 +182,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
int minOffset = 0;
bool positiveOffset = false;
- // Matches "Wdy, DD Mon YYYY HH:MM:SS ±hhmm" (Wdy, being optional)
+ // Matches "Wdy, DD Mon YYYY HH:mm:ss ±hhmm" (Wdy, being optional)
QRegExp rex(QStringLiteral("^(?:[A-Z][a-z]+,)?[ \\t]*(\\d{1,2})[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d)(?::(\\d\\d))?)?[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?"));
if (s.indexOf(rex) == 0) {
if (dd) {
@@ -203,7 +203,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
if (utcOffset)
*utcOffset = ((hourOffset * 60 + minOffset) * (positiveOffset ? 60 : -60));
} else {
- // Matches "Wdy Mon DD HH:MM:SS YYYY"
+ // Matches "Wdy Mon DD HH:mm:ss YYYY"
QRegExp rex(QStringLiteral("^[A-Z][a-z]+[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d):(\\d\\d))?[ \\t]+(\\d\\d\\d\\d)[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?"));
if (s.indexOf(rex) == 0) {
if (dd) {
@@ -233,7 +233,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
}
#endif // QT_NO_DATESTRING
-// Return offset in [+-]HH:MM format
+// Return offset in [+-]HH:mm format
// Qt::ISODate puts : between the hours and minutes, but Qt:TextDate does not
static QString toOffsetString(Qt::DateFormat format, int offset)
{
@@ -248,7 +248,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
.arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0'));
}
-// Parse offset in [+-]HH[:]MM format
+// Parse offset in [+-]HH[[:]mm] format
static int fromOffsetString(const QStringRef &offsetString, bool *valid)
{
*valid = false;
@@ -272,7 +272,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid)
// Split the hour and minute parts
QVector<QStringRef> parts = offsetString.mid(1).split(QLatin1Char(':'));
if (parts.count() == 1) {
- // [+-]HHMM format
+ // [+-]HHmm or [+-]HH format
parts.append(parts.first().mid(2));
parts[0] = parts.first().left(2);
}
@@ -282,7 +282,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid)
if (!ok)
return 0;
- const int minute = parts.at(1).toInt(&ok);
+ const int minute = (parts.at(1).isEmpty()) ? 0 : parts.at(1).toInt(&ok);
if (!ok || minute < 0 || minute > 59)
return 0;
@@ -1598,12 +1598,12 @@ int QTime::msec() const
Returns the time as a string. The \a format parameter determines
the format of the string.
- If \a format is Qt::TextDate, the string format is HH:MM:SS;
+ If \a format is Qt::TextDate, the string format is HH:mm:ss;
e.g. 1 second before midnight would be "23:59:59".
If \a format is Qt::ISODate, the string format corresponds to the
ISO 8601 extended specification for representations of dates,
- which is also HH:MM:SS.
+ which is also HH:mm:ss.
If the \a format is Qt::SystemLocaleShortDate or
Qt::SystemLocaleLongDate, the string format depends on the locale
@@ -1925,13 +1925,13 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format,
int msec = 0;
if (size == 5) {
- // HH:MM format
+ // HH:mm format
second = 0;
msec = 0;
} else if (string.at(5) == QLatin1Char(',') || string.at(5) == QLatin1Char('.')) {
if (format == Qt::TextDate)
return QTime();
- // ISODate HH:MM.SSSSSS format
+ // ISODate HH:mm.ssssss format
// We only want 5 digits worth of fraction of minute. This follows the existing
// behavior that determines how milliseconds are read; 4 millisecond digits are
// read and then rounded to 3. If we read at most 5 digits for fraction of minute,
@@ -1951,7 +1951,7 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format,
second = secondNoMs;
msec = qMin(qRound(secondFraction * 1000.0), 999);
} else {
- // HH:MM:SS or HH:MM:SS.sssss
+ // HH:mm:ss or HH:mm:ss.zzz
second = string.mid(6, 2).toInt(&ok);
if (!ok)
return QTime();
@@ -3294,8 +3294,8 @@ bool QDateTime::isDaylightTime() const
}
/*!
- Sets the date part of this datetime to \a date.
- If no time is set, it is set to midnight.
+ Sets the date part of this datetime to \a date. If no time is set yet, it
+ is set to midnight. If \a date is invalid, this QDateTime becomes invalid.
\sa date(), setTime(), setTimeSpec()
*/
@@ -3307,7 +3307,14 @@ void QDateTime::setDate(const QDate &date)
}
/*!
- Sets the time part of this datetime to \a time.
+ Sets the time part of this datetime to \a time. If \a time is not valid,
+ this function sets it to midnight. Therefore, it's possible to clear any
+ set time in a QDateTime by setting it to a default QTime:
+
+ \code
+ QDateTime dt = QDateTime::currentDateTime();
+ dt.setTime(QTime());
+ \endcode
\sa time(), setDate(), setTimeSpec()
*/
@@ -3533,7 +3540,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
If the \a format is Qt::ISODate, the string format corresponds
to the ISO 8601 extended specification for representations of
- dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM],
+ dates and times, taking the form YYYY-MM-DDTHH:mm:ss[Z|[+|-]HH:mm],
depending on the timeSpec() of the QDateTime. If the timeSpec()
is Qt::UTC, Z will be appended to the string; if the timeSpec() is
Qt::OffsetFromUTC, the offset in hours and minutes from UTC will
@@ -4452,15 +4459,14 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
isoString = isoString.right(isoString.length() - 11);
int offset = 0;
- // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:MM for Offset
+ // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:mm for Offset
if (isoString.endsWith(QLatin1Char('Z'))) {
spec = Qt::UTC;
isoString = isoString.left(isoString.size() - 1);
} else {
// the loop below is faster but functionally equal to:
// const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]")));
- const int sizeOfTimeZoneString = 4;
- int signIndex = isoString.size() - sizeOfTimeZoneString - 1;
+ int signIndex = isoString.size() - 1;
bool found = false;
{
const QChar plus = QLatin1Char('+');
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index bfb03fb723..189140016c 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -171,7 +171,7 @@ class QFreeList
// take the current serial number from \a o, increment it, and store it in \a n
static inline int incrementserial(int o, int n)
{
- return (n & ConstantsType::IndexMask) | ((o + ConstantsType::SerialCounter) & ConstantsType::SerialMask);
+ return int((uint(n) & ConstantsType::IndexMask) | ((uint(o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask));
}
// the blocks
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index c5e62027c4..4e3022478a 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -418,9 +418,9 @@ Q_STATIC_ASSERT(!ascii_isspace('\0'));
Q_STATIC_ASSERT(!ascii_isspace('\a'));
Q_STATIC_ASSERT(!ascii_isspace('a'));
Q_STATIC_ASSERT(!ascii_isspace('\177'));
-Q_STATIC_ASSERT(!ascii_isspace('\200'));
-Q_STATIC_ASSERT(!ascii_isspace('\xA0'));
-Q_STATIC_ASSERT(!ascii_isspace('\377'));
+Q_STATIC_ASSERT(!ascii_isspace(uchar('\200')));
+Q_STATIC_ASSERT(!ascii_isspace(uchar('\xA0')));
+Q_STATIC_ASSERT(!ascii_isspace(uchar('\377')));
#endif
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index 419551aaca..265e44bfcf 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QMargins &m) {
/*!
\fn bool QMarginsF::isNull() const
- Returns \c true if all margins are is 0; otherwise returns
+ Returns \c true if all margins are 0; otherwise returns
false.
*/
diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp
index cf595b8f31..be92e20fac 100644
--- a/src/corelib/tools/qvsnprintf.cpp
+++ b/src/corelib/tools/qvsnprintf.cpp
@@ -97,6 +97,7 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap)
#endif
/*!
+ \target bytearray-qsnprintf
\relates QByteArray
A portable snprintf() function, calls qvsnprintf.
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 9928098a33..fe3c4049ad 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -726,7 +726,7 @@ static const short QXmlStreamReader_tokenTypeString_indices[] = {
/*!
\property QXmlStreamReader::namespaceProcessing
- the namespace-processing flag of the stream reader
+ The namespace-processing flag of the stream reader
This property controls whether or not the stream reader processes
namespaces. If enabled, the reader processes namespaces, otherwise
@@ -3306,7 +3306,7 @@ QTextCodec *QXmlStreamWriter::codec() const
/*!
\property QXmlStreamWriter::autoFormatting
\since 4.4
- the auto-formatting flag of the stream writer
+ The auto-formatting flag of the stream writer
This property controls whether or not the stream writer
automatically formats the generated XML data. If enabled, the
diff --git a/src/dbus/doc/src/qtdbus-index.qdoc b/src/dbus/doc/src/qtdbus-index.qdoc
index 2249924ada..d534ea9140 100644
--- a/src/dbus/doc/src/qtdbus-index.qdoc
+++ b/src/dbus/doc/src/qtdbus-index.qdoc
@@ -212,5 +212,22 @@
\li \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
\li \l{Qt D-Bus C++ Classes}
\li \l{Qt D-Bus Examples}
+ \li \l{D-Bus Viewer}
\endlist
*/
+
+/*!
+ \page qdbusviewer.html
+ \title D-Bus Viewer
+ \keyword qdbusviewer
+
+ The Qt D-Bus Viewer is a tool that lets you introspect D-Bus objects and messages. You can
+ choose between the system bus and the session bus. Click on any service on the list
+ on the left side to see all the exported objects.
+
+ You can invoke methods by double-clicking on them. If a method takes one or more IN parameters,
+ a property editor opens.
+
+ Right-click on a signal to connect to it. All emitted signals including their parameters
+ are output in the message view on the lower side of the window.
+*/
diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp
index e475a23f48..67643098d9 100644
--- a/src/dbus/qdbus_symbols.cpp
+++ b/src/dbus/qdbus_symbols.cpp
@@ -86,9 +86,9 @@ bool qdbus_loadLibDBus()
static int majorversions[] = { 3, 2, -1 };
const QString baseNames[] = {
#ifdef Q_OS_WIN
- QStringLiteral("dbus-1"),
+ QLatin1String("dbus-1"),
#endif
- QStringLiteral("libdbus-1")
+ QLatin1String("libdbus-1")
};
lib->unload();
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index 6175e3ccde..cfa3442518 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -183,6 +183,9 @@ DEFINEFUNC(dbus_bool_t , dbus_connection_add_filter, (DBusConnection
void *user_data,
DBusFreeFunction free_data_function),
(connection, function, user_data, free_data_function), return)
+DEFINEFUNC(dbus_bool_t , dbus_connection_can_send_type, (DBusConnection *connection,
+ int type),
+ (connection, type), return)
DEFINEFUNC(void , dbus_connection_close, (DBusConnection *connection),
(connection), return)
DEFINEFUNC(DBusDispatchStatus , dbus_connection_dispatch, (DBusConnection *connection),
@@ -396,6 +399,8 @@ DEFINEFUNC(void , dbus_pending_call_unref, (DBusPendingCall
/* dbus-server.h */
DEFINEFUNC(dbus_bool_t , dbus_server_allocate_data_slot, (dbus_int32_t *slot_p),
(slot_p), return)
+DEFINEFUNC(void , dbus_server_free_data_slot, (dbus_int32_t *slot_p),
+ (slot_p), return)
DEFINEFUNC(void , dbus_server_disconnect, (DBusServer *server),
(server), )
DEFINEFUNC(char* , dbus_server_get_address, (DBusServer *server),
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 4f58d640ff..d25c620b58 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -947,7 +947,7 @@ bool QDBusConnection::isConnected() const
*/
QDBusError QDBusConnection::lastError() const
{
- return d ? d->lastError : QDBusError();
+ return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected."));
}
/*!
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index c88194b918..b741e97894 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -66,6 +66,9 @@
QT_BEGIN_NAMESPACE
+// used with dbus_server_allocate_data_slot
+static dbus_int32_t server_slot = -1;
+
static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
#define qDBusDebug if (::isDebugging == 0); else qDebug
@@ -1084,8 +1087,10 @@ void QDBusConnectionPrivate::closeConnection()
mode = InvalidMode; // prevent reentrancy
baseService.clear();
- if (server)
+ if (server) {
q_dbus_server_disconnect(server);
+ q_dbus_server_free_data_slot(&server_slot);
+ }
if (oldMode == ClientMode || oldMode == PeerMode) {
if (connection) {
@@ -1651,8 +1656,6 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg)
handleSignal(key, msg); // third try
}
-static dbus_int32_t server_slot = -1;
-
void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error)
{
mode = ServerMode;
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index 54b38ee848..3fec7c9111 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -110,6 +110,7 @@ QDBusServer::~QDBusServer()
}
d->serverConnectionNames.clear();
}
+ d->deleteLater();
}
/*!
@@ -129,7 +130,7 @@ bool QDBusServer::isConnected() const
*/
QDBusError QDBusServer::lastError() const
{
- return d->lastError;
+ return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected."));
}
/*!
diff --git a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
index f43bba1324..a691c24ce0 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
@@ -48,7 +48,7 @@ static const char * const start_xpm[]={
//! [1]
QPixmap myPixmap;
-myPixmap->setMask(myPixmap->createHeuristicMask());
+myPixmap.setMask(myPixmap.createHeuristicMask());
//! [1]
//! [2]
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index eb580c81f1..b07e1e28d3 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -825,10 +825,10 @@ static int getExifOrientation(QByteArray &exifData)
quint16 tag;
quint16 type;
quint32 components;
- quint32 value;
-
- stream >> tag >> type >> components >> value;
+ quint16 value;
+ quint16 dummy;
+ stream >> tag >> type >> components >> value >> dummy;
if (tag == 0x0112) { // Tag Exif.Image.Orientation
if (components !=1)
return -1;
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 1cd67b19d2..3fccd6ba9a 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -518,8 +518,9 @@ void QOpenGLContext::setScreen(QScreen *screen)
in addition. Therefore \a handle is variant containing a platform-specific
value type. These classes can be found in the QtPlatformHeaders module.
- When create() is called with native handles set, the handles' ownership are
- not taken, meaning that \c destroy() will not destroy the native context.
+ When create() is called with native handles set, QOpenGLContext does not
+ take ownership of the handles, so destroying the QOpenGLContext does not
+ destroy the native context.
\note Some frameworks track the current context and surfaces internally.
Making the adopted QOpenGLContext current via Qt will have no effect on such
@@ -582,8 +583,8 @@ QVariant QOpenGLContext::nativeHandle() const
Returns \c true if the native context was successfully created and is ready to
be used with makeCurrent(), swapBuffers(), etc.
- \note If the context is already created, this function will first call
- \c destroy(), and then create a new OpenGL context.
+ \note If the context already exists, this function destroys the existing
+ context first, and then creates a new one.
\sa makeCurrent(), format()
*/
@@ -606,6 +607,8 @@ bool QOpenGLContext::create()
}
/*!
+ \internal
+
Destroy the underlying platform context associated with this context.
If any other context is directly or indirectly sharing resources with this
@@ -659,8 +662,7 @@ void QOpenGLContext::destroy()
/*!
Destroys the QOpenGLContext object.
- This implicitly calls \c destroy(), so if this is the current context for the
- thread, doneCurrent() is also called.
+ If this is the current context for the thread, doneCurrent() is also called.
*/
QOpenGLContext::~QOpenGLContext()
{
diff --git a/src/gui/kernel/qplatformservices.cpp b/src/gui/kernel/qplatformservices.cpp
index e11a1858f6..2188920c86 100644
--- a/src/gui/kernel/qplatformservices.cpp
+++ b/src/gui/kernel/qplatformservices.cpp
@@ -49,6 +49,9 @@ QT_BEGIN_NAMESPACE
\brief The QPlatformServices provides the backend for desktop-related functionality.
*/
+QPlatformServices::QPlatformServices()
+{ }
+
bool QPlatformServices::openUrl(const QUrl &url)
{
qWarning("This plugin does not support QPlatformServices::openUrl() for '%s'.",
diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h
index 00a87d51f5..005748d18c 100644
--- a/src/gui/kernel/qplatformservices.h
+++ b/src/gui/kernel/qplatformservices.h
@@ -52,6 +52,7 @@ class QUrl;
class Q_GUI_EXPORT QPlatformServices
{
public:
+ QPlatformServices();
virtual ~QPlatformServices() { }
virtual bool openUrl(const QUrl &url);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 0c3ea37b29..f5e6f7cca6 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1075,9 +1075,9 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
}
}
-bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &t) const
+bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const
{
- return t.type() >= QTransform::TxProject;
+ return false;
}
bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index 5475503f22..5fc8bbaf09 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -414,22 +414,6 @@ inline void QPathSegments::addIntersection(int index, const Intersection &inters
}
}
-inline void QWingedEdge::TraversalStatus::flipDirection()
-{
- direction = QWingedEdge::flip(direction);
-}
-
-inline void QWingedEdge::TraversalStatus::flipTraversal()
-{
- traversal = QWingedEdge::flip(traversal);
-}
-
-inline void QWingedEdge::TraversalStatus::flip()
-{
- flipDirection();
- flipTraversal();
-}
-
inline int QWingedEdge::edgeCount() const
{
return m_edges.size();
@@ -471,11 +455,27 @@ inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal)
return traversal == QPathEdge::RightTraversal ? QPathEdge::LeftTraversal : QPathEdge::RightTraversal;
}
+inline void QWingedEdge::TraversalStatus::flipTraversal()
+{
+ traversal = QWingedEdge::flip(traversal);
+}
+
inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction)
{
return direction == QPathEdge::Forward ? QPathEdge::Backward : QPathEdge::Forward;
}
+inline void QWingedEdge::TraversalStatus::flipDirection()
+{
+ direction = QWingedEdge::flip(direction);
+}
+
+inline void QWingedEdge::TraversalStatus::flip()
+{
+ flipDirection();
+ flipTraversal();
+}
+
QT_END_NAMESPACE
#endif // QPATHCLIPPER_P_H
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 9610482145..e010dd62ae 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -647,7 +647,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
- If you want to know the advance width of the string (to layout
+ If you want to know the advance width of the string (to lay out
a set of strings next to each other), use width() instead.
Newline characters are processed as normal characters, \e not as
@@ -817,7 +817,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
- If you want to know the advance width of the string (to layout
+ If you want to know the advance width of the string (to lay out
a set of strings next to each other), use width() instead.
Newline characters are processed as normal characters, \e not as
@@ -1432,7 +1432,7 @@ qreal QFontMetricsF::width(QChar ch) const
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
- If you want to know the advance width of the string (to layout
+ If you want to know the advance width of the string (to lay out
a set of strings next to each other), use width() instead.
Newline characters are processed as normal characters, \e not as
@@ -1606,7 +1606,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
- If you want to know the advance width of the string (to layout
+ If you want to know the advance width of the string (to lay out
a set of strings next to each other), use width() instead.
Newline characters are processed as normal characters, \e not as
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 1502758ee8..ab4b10522a 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -305,7 +305,7 @@ uint QTextFormatPrivate::recalcHash() const
{
hashValue = 0;
for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it)
- hashValue += (it->key << 16) + variantHash(it->value);
+ hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
hashDirty = false;
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index d9b3acdd92..1710af723f 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -606,7 +606,7 @@ QList<QByteArray> QNetworkReply::rawHeaderList() const
/*!
Returns the attribute associated with the code \a code. If the
- attribute has not been set, it returns an invalid QVariant (type QMetaType::Unknown).
+ attribute has not been set, it returns an invalid QVariant (type QMetaType::UnknownType).
You can expect the default values listed in
QNetworkRequest::Attribute to be applied to the values returned by
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 10fdf2f97d..b68f6adfff 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -778,18 +778,34 @@ bool QHostAddress::operator==(const QHostAddress &other) const
bool QHostAddress::operator ==(SpecialAddress other) const
{
QT_ENSURE_PARSED(this);
- QHostAddress otherAddress(other);
- QT_ENSURE_PARSED(&otherAddress);
+ switch (other) {
+ case Null:
+ return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol;
- if (d->protocol == QAbstractSocket::IPv4Protocol)
- return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a;
- if (d->protocol == QAbstractSocket::IPv6Protocol) {
- return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol
- && memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0;
+ case Broadcast:
+ return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_BROADCAST;
+
+ case LocalHost:
+ return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_LOOPBACK;
+
+ case Any:
+ return d->protocol == QAbstractSocket::AnyIPProtocol;
+
+ case AnyIPv4:
+ return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_ANY;
+
+ case LocalHostIPv6:
+ case AnyIPv6:
+ if (d->protocol == QAbstractSocket::IPv6Protocol) {
+ Q_IPV6ADDR ip6 = { { 0 } };
+ ip6[15] = quint8(other == LocalHostIPv6); // 1 for localhost, 0 for any
+ return memcmp(&d->a6, &ip6, sizeof ip6) == 0;
+ }
+ return false;
}
- if (d->protocol == QAbstractSocket::AnyIPProtocol)
- return other == QHostAddress::Any;
- return int(other) == int(Null);
+
+ Q_UNREACHABLE();
+ return false;
}
/*!
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 7d262467c3..a1ac349949 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -221,18 +221,29 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
int enabled;
if (CFNumberGetValue(pacEnabled, kCFNumberIntType, &enabled) && enabled) {
// PAC is enabled
- CFStringRef cfPacLocation = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
+ // kSCPropNetProxiesProxyAutoConfigURLString returns the URL string
+ // as entered in the system proxy configuration dialog
+ CFStringRef pacLocationSetting = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
+ QCFType<CFStringRef> cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL,
+ kCFStringEncodingUTF8);
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
QCFType<CFDataRef> pacData;
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
+ if (!pacUrl) {
+ qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
+ return result;
+ }
SInt32 errorCode;
if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
QString pacLocation = QCFString::toQString(cfPacLocation);
qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
return result;
}
-
+ if (!pacData) {
+ qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
+ return result;
+ }
QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
if (!pacScript) {
// This should never happen, but the documentation says it may return NULL if there was a problem creating the object.
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index ad170e187c..eed1b70025 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -567,9 +567,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16
return false;
}
- localPort = port;
- localAddress = address;
-
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true",
address.toString().toLatin1().constData(), port);
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index f5943d657f..184add15c3 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -852,9 +852,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port)
return false;
}
- localPort = port;
- localAddress = address;
-
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true",
address.toString().toLatin1().constData(), port);
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index f129bb40dd..f2e2ded3f5 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -530,6 +530,11 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin
break;
}
+ if (QGuiApplication::platformNativeInterface()->nativeResourceForScreen("nofonthinting",
+ QGuiApplication::primaryScreen())) {
+ return QFontEngine::HintNone;
+ }
+
if (useXftConf) {
void *hintStyleResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index ac73cd04ad..4244719b34 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -177,6 +177,8 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
QCoreTextFontDatabase::~QCoreTextFontDatabase()
{
+ foreach (CTFontDescriptorRef ref, m_systemFontDescriptors)
+ CFRelease(ref);
}
static CFArrayRef availableFamilyNames()
@@ -810,7 +812,11 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
CTFontDescriptorRef fontDesc = fontDescriptorFromTheme(f);
FontDescription fd;
getFontDescription(fontDesc, &fd);
- m_systemFontDescriptors.insert(fontDesc);
+
+ if (!m_systemFontDescriptors.contains(fontDesc))
+ m_systemFontDescriptors.insert(fontDesc);
+ else
+ CFRelease(fontDesc);
QFont *font = new QFont(fd.familyName, fd.pixelSize, fd.weight, fd.style == QFont::StyleItalic);
return font;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index f0977b4735..f52b9d4b4d 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -125,7 +125,6 @@ void QNetworkManagerEngine::setupConfigurations()
activeConnectionsList.insert(acPath.path(), activeConnection);
connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
- activeConnection->setConnections();
QStringList devices = activeConnection->devices();
if (!devices.isEmpty()) {
@@ -180,7 +179,7 @@ void QNetworkManagerEngine::connectToId(const QString &id)
NMDeviceType connectionType = connection->getType();
QString dbusDevicePath;
- const QString settingsPath = connection->connectionInterface()->path();
+ const QString settingsPath = connection->path();
QString specificPath = configuredAccessPoints.key(settingsPath);
if (isConnectionActive(settingsPath))
@@ -277,7 +276,6 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVari
connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
- activeConnection->setConnections();
}
const QString id = activeConnection->connection().path();
@@ -373,10 +371,10 @@ void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connecti
{
QMutexLocker locker(&mutex);
for (int i = 0; i < connections.count(); ++i) {
- if (connectionsList.contains(connections.at(i)->connectionInterface()->path()))
+ if (connectionsList.contains(connections.at(i)->path()))
continue;
- const QString settingsPath = connections.at(i)->connectionInterface()->path();
+ const QString settingsPath = connections.at(i)->path();
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(settingsPath);
@@ -399,11 +397,10 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
connect(iDevice,SIGNAL(connectionsChanged(QStringList)),
this,SLOT(deviceConnectionsChanged(QStringList)));
- iDevice->setConnections();
interfaceDevices.insert(path.path(),iDevice);
if (iDevice->deviceType() == DEVICE_TYPE_WIFI) {
QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
- new QNetworkManagerInterfaceDeviceWireless(iDevice->connectionInterface()->path(),this);
+ new QNetworkManagerInterfaceDeviceWireless(iDevice->path(),this);
connect(wirelessDevice, SIGNAL(accessPointAdded(QString)),
this, SLOT(newAccessPoint(QString)));
@@ -417,9 +414,9 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
if (iDevice->deviceType() == DEVICE_TYPE_ETHERNET) {
QNetworkManagerInterfaceDeviceWired *wiredDevice =
- new QNetworkManagerInterfaceDeviceWired(iDevice->connectionInterface()->path(),this);
+ new QNetworkManagerInterfaceDeviceWired(iDevice->path(),this);
connect(wiredDevice,SIGNAL(carrierChanged(bool)),this,SLOT(wiredCarrierChanged(bool)));
- wiredDevices.insert(iDevice->connectionInterface()->path(), wiredDevice);
+ wiredDevices.insert(iDevice->path(), wiredDevice);
}
}
@@ -454,7 +451,7 @@ void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
if (connection->getType() == DEVICE_TYPE_ETHERNET
- && settingsPath.path() == connection->connectionInterface()->path()) {
+ && settingsPath.path() == connection->path()) {
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(settingsPath.path());
@@ -486,9 +483,9 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
}
QNetworkManagerSettingsConnection *connection =
- new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(),
+ new QNetworkManagerSettingsConnection(settings->service(),
path.path(),this);
- const QString settingsPath = connection->connectionInterface()->path();
+ const QString settingsPath = connection->path();
if (accessPointConfigurations.contains(settingsPath)) {
return;
}
@@ -506,7 +503,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
for (int i = 0; i < accessPoints.count(); ++i) {
if (connection->getSsid() == accessPoints.at(i)->ssid()) {
// remove the corresponding accesspoint from configurations
- apPath = accessPoints.at(i)->connectionInterface()->path();
+ apPath = accessPoints.at(i)->path();
QNetworkConfigurationPrivatePointer ptr
= accessPointConfigurations.take(apPath);
if (ptr) {
@@ -533,7 +530,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
i.next();
if (i.value()->deviceType() == deviceType) {
QNetworkManagerInterfaceDeviceWired *wiredDevice
- = wiredDevices.value(i.value()->connectionInterface()->path());
+ = wiredDevices.value(i.value()->path());
if (wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
}
@@ -564,7 +561,7 @@ bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath);
if (settingsConnection->getType() == DEVICE_TYPE_MODEM) {
- return isActiveContext(settingsConnection->connectionInterface()->path());
+ return isActiveContext(settingsConnection->path());
}
return false;
@@ -611,7 +608,7 @@ void QNetworkManagerEngine::updateConnection()
qobject_cast<QNetworkManagerSettingsConnection *>(sender());
if (!connection)
return;
- const QString settingsPath = connection->connectionInterface()->path();
+ const QString settingsPath = connection->path();
QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings());
@@ -682,20 +679,19 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path)
bool okToAdd = true;
for (int i = 0; i < accessPoints.count(); ++i) {
- if (accessPoints.at(i)->connectionInterface()->path() == path) {
+ if (accessPoints.at(i)->path() == path) {
okToAdd = false;
}
}
if (okToAdd) {
accessPoints.append(accessPoint);
- accessPoint->setConnections();
}
// Check if configuration exists for connection.
if (!accessPoint->ssid().isEmpty()) {
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
- const QString settingsPath = connection->connectionInterface()->path();
+ const QString settingsPath = connection->path();
if (accessPoint->ssid() == connection->getSsid()) {
if (!configuredAccessPoints.contains(path)) {
@@ -741,18 +737,18 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path)
QMutexLocker locker(&mutex);
for (int i = 0; i < accessPoints.count(); ++i) {
QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i);
- if (accessPoint->connectionInterface()->path() == path) {
+ if (accessPoint->path() == path) {
accessPoints.removeOne(accessPoint);
- if (configuredAccessPoints.contains(accessPoint->connectionInterface()->path())) {
+ if (configuredAccessPoints.contains(accessPoint->path())) {
// find connection and change state to Defined
- configuredAccessPoints.remove(accessPoint->connectionInterface()->path());
+ configuredAccessPoints.remove(accessPoint->path());
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
if (accessPoint->ssid() == connection->getSsid()) {//might not have bssid yet
- const QString settingsPath = connection->connectionInterface()->path();
+ const QString settingsPath = connection->path();
const QString connectionId = settingsPath;
QNetworkConfigurationPrivatePointer ptr =
@@ -804,7 +800,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
QNetworkManagerInterfaceDevice device(devicePath.path(),this);
if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
- QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.connectionInterface()->path());
+ QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.path());
if (wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
break;
@@ -819,10 +815,10 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
if (connectionSsid == accessPoints.at(i)->ssid()
&& map.value("802-11-wireless").value("seen-bssids").toStringList().contains(accessPoints.at(i)->hwAddress())) {
cpPriv->state |= QNetworkConfiguration::Discovered;
- if (!configuredAccessPoints.contains(accessPoints.at(i)->connectionInterface()->path())) {
- configuredAccessPoints.insert(accessPoints.at(i)->connectionInterface()->path(),settingsPath);
+ if (!configuredAccessPoints.contains(accessPoints.at(i)->path())) {
+ configuredAccessPoints.insert(accessPoints.at(i)->path(),settingsPath);
- const QString accessPointId = accessPoints.at(i)->connectionInterface()->path();
+ const QString accessPointId = accessPoints.at(i)->path();
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(accessPointId);
@@ -881,7 +877,7 @@ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const
{
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
- if (id == connection->connectionInterface()->path())
+ if (id == connection->path())
return connection;
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 9f4ae55e78..16a7e475e0 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -47,32 +47,24 @@
#ifndef QT_NO_DBUS
+#define DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
+
QT_BEGIN_NAMESPACE
-class QNetworkManagerInterfacePrivate
-{
-public:
- QDBusInterface *connectionInterface;
- bool valid;
-};
QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerInterfacePrivate();
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- QLatin1String(NM_DBUS_PATH),
- QLatin1String(NM_DBUS_INTERFACE),
- QDBusConnection::systemBus(),parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ NM_DBUS_INTERFACE,
+ QDBusConnection::systemBus(),parent)
+{
+ if (!isValid()) {
return;
}
- d->valid = true;
- QDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
+ PropertiesDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
QLatin1String(NM_DBUS_PATH),
- QLatin1String("org.freedesktop.DBus.Properties"),
+ DBUS_PROPERTIES_INTERFACE,
QDBusConnection::systemBus());
QList<QVariant> argumentList;
argumentList << QLatin1String(NM_DBUS_INTERFACE);
@@ -81,13 +73,17 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
argumentList);
if (!propsReply.isError()) {
propertyMap = propsReply.value();
+ } else {
+ qWarning() << Q_FUNC_INFO << "propsReply"<<propsReply.error().message();
}
QDBusPendingReply<QList <QDBusObjectPath> > nmReply
- = d->connectionInterface->call(QLatin1String("GetDevices"));
+ = call(QLatin1String("GetDevices"));
nmReply.waitForFinished();
if (!nmReply.isError()) {
devicesPathList = nmReply.value();
+ } else {
+ qWarning() << Q_FUNC_INFO <<"nmReply"<<nmReply.error().message();
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
@@ -99,13 +95,6 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
QNetworkManagerInterface::~QNetworkManagerInterface()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerInterface::isValid()
-{
- return d->valid;
}
bool QNetworkManagerInterface::setConnections()
@@ -138,16 +127,11 @@ bool QNetworkManagerInterface::setConnections()
return allOk;
}
-QDBusInterface *QNetworkManagerInterface::connectionInterface() const
-{
- return d->connectionInterface;
-}
-
QList <QDBusObjectPath> QNetworkManagerInterface::getDevices()
{
if (devicesPathList.isEmpty()) {
//qWarning() << "using blocking call!";
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetDevices"));
+ QDBusReply<QList<QDBusObjectPath> > reply = call(QLatin1String("GetDevices"));
devicesPathList = reply.value();
}
return devicesPathList;
@@ -157,7 +141,7 @@ void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath
QDBusObjectPath devicePath,
QDBusObjectPath specificObject)
{
- QDBusPendingCall pendingCall = d->connectionInterface->asyncCall(QLatin1String("ActivateConnection"),
+ QDBusPendingCall pendingCall = asyncCall(QLatin1String("ActivateConnection"),
QVariant::fromValue(connectionPath),
QVariant::fromValue(devicePath),
QVariant::fromValue(specificObject));
@@ -167,9 +151,9 @@ void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath
this, SIGNAL(activationFinished(QDBusPendingCallWatcher*)));
}
-void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const
+void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath)
{
- d->connectionInterface->asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
+ asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
}
bool QNetworkManagerInterface::wirelessEnabled() const
@@ -245,73 +229,38 @@ void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
}
}
-class QNetworkManagerInterfaceAccessPointPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerInterfaceAccessPointPrivate();
- d->path = dbusPathName;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
- QDBusConnection::systemBus(),parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ dbusPathName,
+ NM_DBUS_INTERFACE_ACCESS_POINT,
+ QDBusConnection::systemBus(),parent)
+{
+ if (!isValid()) {
return;
}
- QDBusInterface accessPointPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String("org.freedesktop.DBus.Properties"),
+ PropertiesDBusInterface *accessPointPropertiesInterface = new PropertiesDBusInterface(QLatin1String(NM_DBUS_SERVICE),
+ dbusPathName,
+ DBUS_PROPERTIES_INTERFACE,
QDBusConnection::systemBus());
QList<QVariant> argumentList;
argumentList << QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT);
QDBusPendingReply<QVariantMap> propsReply
- = accessPointPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
+ = accessPointPropertiesInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
argumentList);
if (!propsReply.isError()) {
propertyMap = propsReply.value();
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ dbusPathName,
QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-
- d->valid = true;
-
}
QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerInterfaceAccessPoint::isValid()
-{
- return d->valid;
-}
-
-bool QNetworkManagerInterfaceAccessPoint::setConnections()
-{
- if (!isValid())
- return false;
-
- return true;
-}
-
-QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const
-{
- return d->connectionInterface;
}
quint32 QNetworkManagerInterfaceAccessPoint::flags() const
@@ -386,31 +335,19 @@ void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap<QString,QVariant>
}
}
-class QNetworkManagerInterfaceDevicePrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
- : QObject(parent)
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ deviceObjectPath,
+ NM_DBUS_INTERFACE_DEVICE,
+ QDBusConnection::systemBus(),parent)
{
- d = new QNetworkManagerInterfaceDevicePrivate();
- d->path = deviceObjectPath;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE),
- QDBusConnection::systemBus(),parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ if (!isValid()) {
return;
}
- QDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String("org.freedesktop.DBus.Properties"),
+ PropertiesDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
+ deviceObjectPath,
+ DBUS_PROPERTIES_INTERFACE,
QDBusConnection::systemBus(),parent);
QList<QVariant> argumentList;
@@ -424,35 +361,14 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ deviceObjectPath,
QLatin1String(NM_DBUS_INTERFACE_DEVICE),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
- d->valid = true;
}
QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerInterfaceDevice::isValid()
-{
- return d->valid;
-}
-
-bool QNetworkManagerInterfaceDevice::setConnections()
-{
- if (!isValid())
- return false;
-
- return true;
-}
-
-QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const
-{
- return d->connectionInterface;
}
QString QNetworkManagerInterfaceDevice::udi() const
@@ -519,31 +435,19 @@ void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
Q_EMIT propertiesChanged(map);
}
-class QNetworkManagerInterfaceDeviceWiredPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerInterfaceDeviceWiredPrivate();
- d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
- QDBusConnection::systemBus(), parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ ifaceDevicePath,
+ NM_DBUS_INTERFACE_DEVICE_WIRED,
+ QDBusConnection::systemBus(), parent)
+{
+ if (!isValid()) {
return;
}
- QDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String("org.freedesktop.DBus.Properties"),
- QDBusConnection::systemBus(),parent);
+ PropertiesDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
+ ifaceDevicePath,
+ DBUS_PROPERTIES_INTERFACE,
+ QDBusConnection::systemBus(),parent);
QList<QVariant> argumentList;
argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED);
@@ -556,36 +460,14 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ ifaceDevicePath,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
-
- d->valid = true;
}
QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerInterfaceDeviceWired::isValid()
-{
-
- return d->valid;
-}
-
-bool QNetworkManagerInterfaceDeviceWired::setConnections()
-{
- if (!isValid())
- return false;
- return true;
-}
-
-QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const
-{
- return d->connectionInterface;
}
QString QNetworkManagerInterfaceDeviceWired::hwAddress() const
@@ -639,39 +521,27 @@ void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant>
Q_EMIT propertiesChanged(map);
}
-class QNetworkManagerInterfaceDeviceWirelessPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerInterfaceDeviceWirelessPrivate();
- d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QDBusConnection::systemBus(), parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ ifaceDevicePath,
+ NM_DBUS_INTERFACE_DEVICE_WIRELESS,
+ QDBusConnection::systemBus(), parent)
+{
+ if (!isValid()) {
return;
}
-
+ interfacePath = ifaceDevicePath;
QDBusPendingReply<QList <QDBusObjectPath> > nmReply
- = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
+ = call(QLatin1String("GetAccessPoints"));
if (!nmReply.isError()) {
accessPointsList = nmReply.value();
}
- QDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String("org.freedesktop.DBus.Properties"),
+ PropertiesDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
+ interfacePath,
+ DBUS_PROPERTIES_INTERFACE,
QDBusConnection::systemBus(),parent);
QList<QVariant> argumentList;
@@ -684,31 +554,21 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ interfacePath,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
QDBusPendingReply<QList<QDBusObjectPath> > reply
- = d->connectionInterface->asyncCall(QLatin1String("GetAccessPoints"));
+ = asyncCall(QLatin1String("GetAccessPoints"));
QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(reply);
connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
this, SLOT(accessPointsFinished(QDBusPendingCallWatcher*)));
-
-
- d->valid = true;
}
QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerInterfaceDeviceWireless::isValid()
-{
- return d->valid;
}
void QNetworkManagerInterfaceDeviceWireless::slotAccessPointAdded(QDBusObjectPath path)
@@ -732,16 +592,16 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
bool allOk = true;
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
- QLatin1String("AccessPointAdded"),
- this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
+ interfacePath,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("AccessPointAdded"),
+ this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
allOk = false;
}
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ interfacePath,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
QLatin1String("AccessPointRemoved"),
this, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
@@ -749,7 +609,7 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
}
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ interfacePath,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
QLatin1String("ScanDone"),
this, SLOT(scanIsDone()))) {
@@ -771,17 +631,12 @@ void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCa
}
}
-QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const
-{
- return d->connectionInterface;
-}
-
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
{
if (accessPointsList.isEmpty()) {
//qWarning() << "Using blocking call!";
QDBusReply<QList<QDBusObjectPath> > reply
- = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
+ = call(QLatin1String("GetAccessPoints"));
accessPointsList = reply.value();
}
return accessPointsList;
@@ -829,7 +684,7 @@ void QNetworkManagerInterfaceDeviceWireless::scanIsDone()
void QNetworkManagerInterfaceDeviceWireless::requestScan()
{
- d->connectionInterface->asyncCall(QLatin1String("RequestScan"));
+ asyncCall(QLatin1String("RequestScan"));
}
void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVariant> map)
@@ -844,29 +699,17 @@ void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVarian
}
}
-class QNetworkManagerInterfaceDeviceModemPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerInterfaceDeviceModemPrivate();
- d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
- QDBusConnection::systemBus(), parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ ifaceDevicePath,
+ NM_DBUS_INTERFACE_DEVICE_MODEM,
+ QDBusConnection::systemBus(), parent)
+{
+ if (!isValid()) {
return;
}
- QDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ PropertiesDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
+ ifaceDevicePath,
QLatin1String("org.freedesktop.DBus.Properties"),
QDBusConnection::systemBus(),parent);
@@ -880,36 +723,14 @@ QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const Q
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ ifaceDevicePath,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
- d->valid = true;
}
QNetworkManagerInterfaceDeviceModem::~QNetworkManagerInterfaceDeviceModem()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerInterfaceDeviceModem::isValid()
-{
-
- return d->valid;
-}
-
-bool QNetworkManagerInterfaceDeviceModem::setConnections()
-{
- if (!isValid() )
- return false;
-
- return true;
-}
-
-QDBusInterface *QNetworkManagerInterfaceDeviceModem::connectionInterface() const
-{
- return d->connectionInterface;
}
QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::modemCapabilities() const
@@ -936,59 +757,39 @@ void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap<QString,QVariant>
Q_EMIT propertiesChanged(map);
}
-class QNetworkManagerSettingsPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerSettingsPrivate();
- d->path = settingsService;
- d->connectionInterface = new QDBusInterface(settingsService,
- QLatin1String(NM_DBUS_PATH_SETTINGS),
- QLatin1String(NM_DBUS_IFACE_SETTINGS),
- QDBusConnection::systemBus());
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(settingsService,
+ NM_DBUS_PATH_SETTINGS,
+ NM_DBUS_IFACE_SETTINGS,
+ QDBusConnection::systemBus(), parent)
+{
+ if (!isValid()) {
return;
}
-
+ interfacePath = settingsService;
QDBusPendingReply<QList <QDBusObjectPath> > nmReply
- = d->connectionInterface->call(QLatin1String("ListConnections"));
+ = call(QLatin1String("ListConnections"));
if (!nmReply.isError()) {
connectionsList = nmReply.value();
}
-
- d->valid = true;
}
QNetworkManagerSettings::~QNetworkManagerSettings()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerSettings::isValid()
-{
- return d->valid;
}
bool QNetworkManagerSettings::setConnections()
{
bool allOk = true;
-
- if (!QDBusConnection::systemBus().connect(d->path,
+ if (!QDBusConnection::systemBus().connect(interfacePath,
QLatin1String(NM_DBUS_PATH_SETTINGS),
QLatin1String(NM_DBUS_IFACE_SETTINGS),
QLatin1String("NewConnection"),
this, SIGNAL(newConnection(QDBusObjectPath)))) {
allOk = false;
+ qWarning() << Q_FUNC_INFO << "NewConnection could not be connected";
}
return allOk;
@@ -999,7 +800,7 @@ QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
if (connectionsList.isEmpty()) {
//qWarning() << "Using blocking call!";
QDBusReply<QList<QDBusObjectPath> > reply
- = d->connectionInterface->call(QLatin1String("ListConnections"));
+ = call(QLatin1String("ListConnections"));
connectionsList = reply.value();
}
return connectionsList;
@@ -1010,59 +811,30 @@ QString QNetworkManagerSettings::getConnectionByUuid(const QString &uuid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(uuid);
- QDBusReply<QDBusObjectPath > reply = d->connectionInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList);
+ QDBusReply<QDBusObjectPath > reply = callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList);
return reply.value().path();
}
-QDBusInterface *QNetworkManagerSettings::connectionInterface() const
-{
- return d->connectionInterface;
-}
-
-
-class QNetworkManagerSettingsConnectionPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- QString service;
- QNmSettingsMap settingsMap;
- bool valid;
-};
-
QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent)
- : QObject(parent)
+ : QDBusAbstractInterface(settingsService,
+ connectionObjectPath,
+ NM_DBUS_IFACE_SETTINGS_CONNECTION,
+ QDBusConnection::systemBus(), parent)
{
qDBusRegisterMetaType<QNmSettingsMap>();
- d = new QNetworkManagerSettingsConnectionPrivate();
- d->path = connectionObjectPath;
- d->service = settingsService;
- d->connectionInterface = new QDBusInterface(settingsService,
- d->path,
- QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
- QDBusConnection::systemBus(), parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ if (!isValid()) {
return;
}
- d->valid = true;
-
+ interfacepath = connectionObjectPath;
QDBusPendingReply<QNmSettingsMap> nmReply
- = d->connectionInterface->call(QLatin1String("GetSettings"));
+ = call(QLatin1String("GetSettings"));
if (!nmReply.isError()) {
- d->settingsMap = nmReply.value();
+ settingsMap = nmReply.value();
}
}
QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerSettingsConnection::isValid()
-{
- return d->valid;
}
bool QNetworkManagerSettingsConnection::setConnections()
@@ -1072,16 +844,16 @@ bool QNetworkManagerSettingsConnection::setConnections()
QDBusConnection dbusConnection = QDBusConnection::systemBus();
bool allOk = true;
- if (!dbusConnection.connect(d->service,
- d->path,
+ if (!dbusConnection.connect(service(),
+ interfacepath,
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
QLatin1String("Updated"),
this, SIGNAL(updated()))) {
allOk = false;
}
- if (!dbusConnection.connect(d->service,
- d->path,
+ if (!dbusConnection.connect(service(),
+ interfacepath,
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
QLatin1String("Removed"),
this, SIGNAL(slotSettingsRemoved()))) {
@@ -1092,28 +864,23 @@ bool QNetworkManagerSettingsConnection::setConnections()
void QNetworkManagerSettingsConnection::slotSettingsRemoved()
{
- Q_EMIT removed(d->path);
-}
-
-QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
-{
- return d->connectionInterface;
+ Q_EMIT removed(interfacepath);
}
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
{
- if (d->settingsMap.isEmpty()) {
+ if (settingsMap.isEmpty()) {
//qWarning() << "Using blocking call!";
- QDBusReply<QNmSettingsMap> reply = d->connectionInterface->call(QLatin1String("GetSettings"));
- d->settingsMap = reply.value();
+ QDBusReply<QNmSettingsMap> reply = call(QLatin1String("GetSettings"));
+ settingsMap = reply.value();
}
- return d->settingsMap;
+ return settingsMap;
}
NMDeviceType QNetworkManagerSettingsConnection::getType()
{
const QString devType =
- d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString();
+ settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString();
if (devType == QLatin1String("802-3-ethernet"))
return DEVICE_TYPE_ETHERNET;
@@ -1128,7 +895,7 @@ NMDeviceType QNetworkManagerSettingsConnection::getType()
bool QNetworkManagerSettingsConnection::isAutoConnect()
{
const QVariant autoConnect =
- d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect"));
+ settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect"));
// NetworkManager default is to auto connect
if (!autoConnect.isValid())
@@ -1139,27 +906,27 @@ bool QNetworkManagerSettingsConnection::isAutoConnect()
quint64 QNetworkManagerSettingsConnection::getTimestamp()
{
- return d->settingsMap.value(QLatin1String("connection"))
+ return settingsMap.value(QLatin1String("connection"))
.value(QLatin1String("timestamp")).toUInt();
}
QString QNetworkManagerSettingsConnection::getId()
{
- return d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString();
+ return settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString();
}
QString QNetworkManagerSettingsConnection::getUuid()
{
- const QString id = d->settingsMap.value(QLatin1String("connection"))
+ const QString id = settingsMap.value(QLatin1String("connection"))
.value(QLatin1String("uuid")).toString();
// is no uuid, return the connection path
- return id.isEmpty() ? d->connectionInterface->path() : id;
+ return id.isEmpty() ? path() : id;
}
QString QNetworkManagerSettingsConnection::getSsid()
{
- return d->settingsMap.value(QLatin1String("802-11-wireless"))
+ return settingsMap.value(QLatin1String("802-11-wireless"))
.value(QLatin1String("ssid")).toString();
}
@@ -1168,10 +935,10 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
NMDeviceType type = getType();
if (type == DEVICE_TYPE_ETHERNET) {
- return d->settingsMap.value(QLatin1String("802-3-ethernet"))
+ return settingsMap.value(QLatin1String("802-3-ethernet"))
.value(QLatin1String("mac-address")).toString();
} else if (type == DEVICE_TYPE_WIFI) {
- return d->settingsMap.value(QLatin1String("802-11-wireless"))
+ return settingsMap.value(QLatin1String("802-11-wireless"))
.value(QLatin1String("mac-address")).toString();
} else {
return QString();
@@ -1181,36 +948,24 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
QStringList QNetworkManagerSettingsConnection::getSeenBssids()
{
if (getType() == DEVICE_TYPE_WIFI) {
- return d->settingsMap.value(QLatin1String("802-11-wireless"))
+ return settingsMap.value(QLatin1String("802-11-wireless"))
.value(QLatin1String("seen-bssids")).toStringList();
} else {
return QStringList();
}
}
-class QNetworkManagerConnectionActivePrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &activeConnectionObjectPath, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerConnectionActivePrivate();
- d->path = activeConnectionObjectPath;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
- QDBusConnection::systemBus(), parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ activeConnectionObjectPath,
+ NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
+ QDBusConnection::systemBus(), parent)
+{
+ if (!isValid()) {
return;
}
- QDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ PropertiesDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
+ activeConnectionObjectPath,
QLatin1String("org.freedesktop.DBus.Properties"),
QDBusConnection::systemBus());
@@ -1228,35 +983,14 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
- d->path,
+ activeConnectionObjectPath,
QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
- d->valid = true;
}
QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerConnectionActive::isValid()
-{
- return d->valid;
-}
-
-bool QNetworkManagerConnectionActive::setConnections()
-{
- if (!isValid())
- return false;
-
- return true;
-}
-
-QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const
-{
- return d->connectionInterface;
}
QDBusObjectPath QNetworkManagerConnectionActive::connection() const
@@ -1327,44 +1061,24 @@ void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
}
}
-class QNetworkManagerIp4ConfigPrivate
-{
-public:
- QDBusInterface *connectionInterface;
- QString path;
- bool valid;
-};
-
QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent)
- : QObject(parent)
-{
- d = new QNetworkManagerIp4ConfigPrivate();
- d->path = deviceObjectPath;
- d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
- d->path,
- QLatin1String(NM_DBUS_INTERFACE_IP4_CONFIG),
- QDBusConnection::systemBus(), parent);
- if (!d->connectionInterface->isValid()) {
- d->valid = false;
+ : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
+ deviceObjectPath,
+ NM_DBUS_INTERFACE_IP4_CONFIG,
+ QDBusConnection::systemBus(), parent)
+{
+ if (!isValid()) {
return;
}
- d->valid = true;
}
QNetworkManagerIp4Config::~QNetworkManagerIp4Config()
{
- delete d->connectionInterface;
- delete d;
-}
-
-bool QNetworkManagerIp4Config::isValid()
-{
- return d->valid;
}
QStringList QNetworkManagerIp4Config::domains() const
{
- return d->connectionInterface->property("Domains").toStringList();
+ return property("Domains").toStringList();
}
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
index e645159d71..f945532603 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
@@ -55,6 +55,7 @@
#include <QtDBus/QDBusPendingCallWatcher>
#include <QtDBus/QDBusObjectPath>
#include <QtDBus/QDBusContext>
+#include <QtDBus/QDBusAbstractInterface>
#include <QMap>
#ifndef QT_NO_DBUS
@@ -128,8 +129,7 @@ Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ServerThing))
QT_BEGIN_NAMESPACE
-class QNetworkManagerInterfacePrivate;
-class QNetworkManagerInterface : public QObject
+class QNetworkManagerInterface : public QDBusAbstractInterface
{
Q_OBJECT
@@ -151,10 +151,9 @@ public:
QList <QDBusObjectPath> getDevices();
void activateConnection(QDBusObjectPath connection,QDBusObjectPath device, QDBusObjectPath specificObject);
- void deactivateConnection(QDBusObjectPath connectionPath) const;
+ void deactivateConnection(QDBusObjectPath connectionPath);
QDBusObjectPath path() const;
- QDBusInterface *connectionInterface() const;
bool wirelessEnabled() const;
bool wirelessHardwareEnabled() const;
@@ -162,7 +161,6 @@ public:
NMState state();
QString version() const;
bool setConnections();
- bool isValid();
Q_SIGNALS:
void deviceAdded(QDBusObjectPath);
@@ -177,14 +175,12 @@ private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
- QNetworkManagerInterfacePrivate *d;
QVariantMap propertyMap;
QList<QDBusObjectPath> devicesPathList;
};
-class QNetworkManagerInterfaceAccessPointPrivate;
-class QNetworkManagerInterfaceAccessPoint : public QObject
+class QNetworkManagerInterfaceAccessPoint : public QDBusAbstractInterface
{
Q_OBJECT
@@ -229,8 +225,6 @@ public:
explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerInterfaceAccessPoint();
- QDBusInterface *connectionInterface() const;
-
quint32 flags() const;
quint32 wpaFlags() const;
quint32 rsnFlags() const;
@@ -240,8 +234,7 @@ public:
quint32 mode() const;
quint32 maxBitrate() const;
quint32 strength() const;
- bool setConnections();
- bool isValid();
+ // bool setConnections();
Q_SIGNALS:
void propertiesChanged(QMap <QString,QVariant>);
@@ -251,12 +244,10 @@ private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
- QNetworkManagerInterfaceAccessPointPrivate *d;
QVariantMap propertyMap;
};
-class QNetworkManagerInterfaceDevicePrivate;
-class QNetworkManagerInterfaceDevice : public QObject
+class QNetworkManagerInterfaceDevice : public QDBusAbstractInterface
{
Q_OBJECT
@@ -267,14 +258,11 @@ public:
QString udi() const;
QString networkInterface() const;
- QDBusInterface *connectionInterface() const;
quint32 ip4Address() const;
quint32 state() const;
quint32 deviceType() const;
QDBusObjectPath ip4config() const;
- bool setConnections();
- bool isValid();
Q_SIGNALS:
void stateChanged(const QString &, quint32);
@@ -284,12 +272,10 @@ Q_SIGNALS:
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
- QNetworkManagerInterfaceDevicePrivate *d;
QVariantMap propertyMap;
};
-class QNetworkManagerInterfaceDeviceWiredPrivate;
-class QNetworkManagerInterfaceDeviceWired : public QObject
+class QNetworkManagerInterfaceDeviceWired : public QDBusAbstractInterface
{
Q_OBJECT
@@ -299,12 +285,9 @@ public:
QObject *parent = 0);
~QNetworkManagerInterfaceDeviceWired();
- QDBusInterface *connectionInterface() const;
QString hwAddress() const;
quint32 speed() const;
bool carrier() const;
- bool setConnections();
- bool isValid();
QStringList availableConnections();
Q_SIGNALS:
@@ -316,12 +299,10 @@ private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
- QNetworkManagerInterfaceDeviceWiredPrivate *d;
QVariantMap propertyMap;
};
-class QNetworkManagerInterfaceDeviceWirelessPrivate;
-class QNetworkManagerInterfaceDeviceWireless : public QObject
+class QNetworkManagerInterfaceDeviceWireless : public QDBusAbstractInterface
{
Q_OBJECT
@@ -343,7 +324,6 @@ public:
QDBusObjectPath path() const;
QList <QDBusObjectPath> getAccessPoints();
- QDBusInterface *connectionInterface() const;
QString hwAddress() const;
quint32 mode() const;
@@ -351,7 +331,6 @@ public:
QDBusObjectPath activeAccessPoint() const;
quint32 wirelessCapabilities() const;
bool setConnections();
- bool isValid();
void requestScan();
Q_SIGNALS:
@@ -372,13 +351,12 @@ private Q_SLOTS:
void accessPointsFinished(QDBusPendingCallWatcher *watcher);
private:
- QNetworkManagerInterfaceDeviceWirelessPrivate *d;
QVariantMap propertyMap;
QList <QDBusObjectPath> accessPointsList;
+ QString interfacePath;
};
-class QNetworkManagerInterfaceDeviceModemPrivate;
-class QNetworkManagerInterfaceDeviceModem : public QObject
+class QNetworkManagerInterfaceDeviceModem : public QDBusAbstractInterface
{
Q_OBJECT
@@ -397,12 +375,6 @@ public:
QObject *parent = 0);
~QNetworkManagerInterfaceDeviceModem();
- QDBusObjectPath path() const;
- QDBusInterface *connectionInterface() const;
-
- bool setConnections();
- bool isValid();
-
ModemCapabilities modemCapabilities() const;
ModemCapabilities currentCapabilities() const;
@@ -414,14 +386,12 @@ private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
- QNetworkManagerInterfaceDeviceModemPrivate *d;
QVariantMap propertyMap;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkManagerInterfaceDeviceModem::ModemCapabilities)
-class QNetworkManagerSettingsPrivate;
-class QNetworkManagerSettings : public QObject
+class QNetworkManagerSettings : public QDBusAbstractInterface
{
Q_OBJECT
@@ -430,22 +400,19 @@ public:
explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
~QNetworkManagerSettings();
- QDBusInterface *connectionInterface() const;
QList <QDBusObjectPath> listConnections();
QString getConnectionByUuid(const QString &uuid);
bool setConnections();
- bool isValid();
Q_SIGNALS:
void newConnection(QDBusObjectPath);
void connectionsListReady();
private:
- QNetworkManagerSettingsPrivate *d;
QList <QDBusObjectPath> connectionsList;
+ QString interfacePath;
};
-class QNetworkManagerSettingsConnectionPrivate;
-class QNetworkManagerSettingsConnection : public QObject
+class QNetworkManagerSettingsConnection : public QDBusAbstractInterface
{
Q_OBJECT
@@ -454,7 +421,6 @@ public:
QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0);
~QNetworkManagerSettingsConnection();
- QDBusInterface *connectionInterface() const;
QNmSettingsMap getSettings();
bool setConnections();
NMDeviceType getType();
@@ -465,7 +431,6 @@ public:
QString getSsid();
QString getMacAddress();
QStringList getSeenBssids();
- bool isValid();
Q_SIGNALS:
void updated();
@@ -474,13 +439,12 @@ Q_SIGNALS:
private Q_SLOTS:
void slotSettingsRemoved();
-
private:
- QNetworkManagerSettingsConnectionPrivate *d;
+ QNmSettingsMap settingsMap;
+ QString interfacepath;
};
-class QNetworkManagerConnectionActivePrivate;
-class QNetworkManagerConnectionActive : public QObject
+class QNetworkManagerConnectionActive : public QDBusAbstractInterface
{
Q_OBJECT
@@ -495,15 +459,12 @@ public:
explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
~ QNetworkManagerConnectionActive();
- QDBusInterface *connectionInterface() const;
QDBusObjectPath connection() const;
QDBusObjectPath specificObject() const;
QStringList devices() const;
quint32 state() const;
bool defaultRoute() const;
bool default6Route() const;
- bool setConnections();
- bool isValid();
Q_SIGNALS:
@@ -514,12 +475,10 @@ private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
- QNetworkManagerConnectionActivePrivate *d;
QVariantMap propertyMap;
};
-class QNetworkManagerIp4ConfigPrivate;
-class QNetworkManagerIp4Config : public QObject
+class QNetworkManagerIp4Config : public QDBusAbstractInterface
{
Q_OBJECT
@@ -528,10 +487,17 @@ public:
~QNetworkManagerIp4Config();
QStringList domains() const;
- bool isValid();
+};
- private:
- QNetworkManagerIp4ConfigPrivate *d;
+class PropertiesDBusInterface : public QDBusAbstractInterface
+{
+public:
+ PropertiesDBusInterface(const QString &service, const QString &path,
+ const QString &interface, const QDBusConnection &connection,
+ QObject *parent = 0)
+ : QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent)
+ {}
+ ~PropertiesDBusInterface() = default;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index df0a8c56cb..ab653860f3 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -376,8 +376,6 @@ namespace QtAndroid
const auto &it = m_surfaces.find(surfaceId);
if (it != m_surfaces.end())
m_surfaces.remove(surfaceId);
- if (m_surfaces.isEmpty())
- m_surfaceId = 1;
QJNIEnvironmentPrivate env;
if (!env)
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index 5781f0d7c6..4c38178343 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -50,8 +50,10 @@ QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceForma
void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
{
- if (surface->surface()->surfaceClass() == QSurface::Window)
- static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig());
+ if (surface->surface()->surfaceClass() == QSurface::Window &&
+ static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig())) {
+ QEGLPlatformContext::makeCurrent(surface);
+ }
QEGLPlatformContext::swapBuffers(surface);
}
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
index 8dc8e84f0a..de7f1f6990 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
@@ -138,19 +138,19 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
return m_eglSurface;
}
-void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
+bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
{
QMutexLocker lock(&m_surfaceMutex);
if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid())
- return;
+ return false; // makeCurrent is NOT needed.
createEgl(config);
-
// we've create another surface, the window should be repainted
QRect availableGeometry = screen()->availableGeometry();
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size())));
+ return true; // makeCurrent is needed!
}
void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state)
@@ -209,15 +209,19 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac
Q_UNUSED(jniEnv);
Q_UNUSED(w);
Q_UNUSED(h);
+
lockSurface();
m_androidSurfaceObject = surface;
- m_surfaceWaitCondition.wakeOne();
+ if (surface) // wait until we have a valid surface to draw into
+ m_surfaceWaitCondition.wakeOne();
unlockSurface();
- // repaint the window
- QRect availableGeometry = screen()->availableGeometry();
- if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size())));
+ if (surface) {
+ // repaint the window, when we have a valid surface
+ QRect availableGeometry = screen()->availableGeometry();
+ if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
+ QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size())));
+ }
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h
index 71787edee1..6d6548fc6a 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h
@@ -54,7 +54,7 @@ public:
EGLSurface eglSurface(EGLConfig config);
QSurfaceFormat format() const;
- void checkNativeSurface(EGLConfig config);
+ bool checkNativeSurface(EGLConfig config);
void applicationStateChanged(Qt::ApplicationState);
@@ -66,7 +66,7 @@ protected:
void clearEgl();
private:
- EGLDisplay m_eglDisplay;
+ EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
EGLSurface m_eglSurface = EGL_NO_SURFACE;
EGLNativeWindowType m_nativeWindow = nullptr;
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index 940add3a38..a4e82a29ef 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -391,7 +391,7 @@ Qt::ScreenOrientation QAndroidPlatformScreen::nativeOrientation() const
void QAndroidPlatformScreen::surfaceChanged(JNIEnv *env, jobject surface, int w, int h)
{
lockSurface();
- if (surface && w && h) {
+ if (surface && w > 0 && h > 0) {
releaseSurface();
m_nativeSurface = ANativeWindow_fromSurface(env, surface);
QMetaObject::invokeMethod(this, "setDirty", Qt::QueuedConnection, Q_ARG(QRect, QRect(0, 0, w, h)));
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index ffa616f968..c36634db74 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -48,7 +48,7 @@ class QCocoaBackingStore;
class QCocoaGLContext;
QT_END_NAMESPACE
-Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
+Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
@interface QT_MANGLE_NAMESPACE(QNSView) : NSView <NSTextInputClient> {
QImage m_backingStore;
@@ -72,7 +72,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
bool m_shouldSetGLContextinDrawRect;
#endif
NSString *m_inputSource;
- QNSViewMouseMoveHelper *m_mouseMoveHelper;
+ QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
bool m_resendKeyEvent;
bool m_scrolling;
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 2f4dcd2a8c..9c24851115 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -83,7 +83,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
- (CGFloat)deviceDeltaZ;
@end
-@interface QNSViewMouseMoveHelper : NSObject
+@interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject
{
QNSView *view;
}
@@ -97,7 +97,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
@end
-@implementation QNSViewMouseMoveHelper
+@implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)
- (id)initWithView:(QNSView *)theView
{
@@ -158,7 +158,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
currentCustomDragTypes = 0;
m_sendUpAsRightButton = false;
m_inputSource = 0;
- m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self];
+ m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
m_resendKeyEvent = false;
m_scrolling = false;
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index 76c02d939f..6e56f47954 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -75,9 +75,7 @@ static QUIView *focusView()
- (id)initWithQIOSInputContext:(QIOSInputContext *)context
{
- id originalSelf = self;
if (self = [super initWithTarget:self action:@selector(gestureStateChanged:)]) {
- Q_ASSERT(self == originalSelf);
m_context = context;
@@ -505,7 +503,22 @@ void QIOSInputContext::scroll(int y)
[rootView.layer addAnimation:animation forKey:@"AnimateSubLayerTransform"];
rootView.layer.sublayerTransform = translationTransform;
- [rootView.qtViewController updateProperties];
+ bool keyboardScrollIsActive = y != 0;
+
+ // Raise all known windows to above the status-bar if we're scrolling the screen,
+ // while keeping the relative window level between the windows the same.
+ NSArray *applicationWindows = [[UIApplication sharedApplication] windows];
+ static QHash<UIWindow *, UIWindowLevel> originalWindowLevels;
+ for (UIWindow *window in applicationWindows) {
+ if (keyboardScrollIsActive && !originalWindowLevels.contains(window))
+ originalWindowLevels.insert(window, window.windowLevel);
+
+ UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0;
+ window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment;
+
+ if (!keyboardScrollIsActive)
+ originalWindowLevels.remove(window);
+ }
}
completion:^(BOOL){
if (self) {
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index 4af2a4965f..712bf0098b 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -46,6 +46,7 @@
#include <qpa/qwindowsysteminterface.h>
#include "qiosapplicationdelegate.h"
#include "qiosviewcontroller.h"
+#include "quiview.h"
#include <sys/sysctl.h>
@@ -244,6 +245,22 @@ void QIOSScreen::updateProperties()
m_geometry = fromCGRect([rootView convertRect:m_uiScreen.bounds fromView:m_uiWindow]).toRect();
m_availableGeometry = fromCGRect([rootView convertRect:m_uiScreen.applicationFrame fromView:m_uiWindow]).toRect();
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 && ![m_uiWindow.rootViewController shouldAutorotate]) {
+ // Setting the statusbar orientation (content orientation) on iOS8+ will result in the UIScreen
+ // updating its geometry and available geometry, which in the case of content orientation is not
+ // what we want. We want to reflect the screen geometry based on the locked orientation, and
+ // adjust the available geometry based on the repositioned status bar for the current status
+ // bar orientation.
+
+ Qt::ScreenOrientation lockedOrientation = toQtScreenOrientation(UIDeviceOrientation(rootView.qtViewController.lockedOrientation));
+ Qt::ScreenOrientation contenOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation));
+
+ QTransform transform = screen()->transformBetween(lockedOrientation, contenOrientation, m_geometry).inverted();
+
+ m_geometry = transform.mapRect(m_geometry);
+ m_availableGeometry = transform.mapRect(m_availableGeometry);
+ }
+
if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry) {
const qreal millimetersPerInch = 25.4;
m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch;
diff --git a/src/plugins/platforms/ios/qiostextresponder.h b/src/plugins/platforms/ios/qiostextresponder.h
index 118ab8958a..21b61bf8da 100644
--- a/src/plugins/platforms/ios/qiostextresponder.h
+++ b/src/plugins/platforms/ios/qiostextresponder.h
@@ -51,6 +51,7 @@ class QIOSInputContext;
QIOSInputContext *m_inputContext;
QString m_markedText;
BOOL m_inSendEventToFocusObject;
+ BOOL m_inSelectionChange;
}
- (id)initWithInputContext:(QIOSInputContext *)context;
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index bebc7577f8..15fade0838 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -171,6 +171,7 @@
return self;
m_inSendEventToFocusObject = NO;
+ m_inSelectionChange = NO;
m_inputContext = inputContext;
QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap();
@@ -302,6 +303,7 @@
return;
if (updatedProperties & (Qt::ImCursorPosition | Qt::ImAnchorPosition)) {
+ QScopedValueRollback<BOOL> rollback(m_inSelectionChange, true);
[self.inputDelegate selectionWillChange:self];
[self.inputDelegate selectionDidChange:self];
}
@@ -349,6 +351,15 @@
- (void)setSelectedTextRange:(UITextRange *)range
{
+ if (m_inSelectionChange) {
+ // After [UITextInputDelegate selectionWillChange], UIKit will cancel
+ // any ongoing auto correction (if enabled) and ask us to set an empty selection.
+ // This is contradictory to our current attempt to set a selection, so we ignore
+ // the callback. UIKit will be re-notified of the new selection after
+ // [UITextInputDelegate selectionDidChange].
+ return;
+ }
+
QUITextRange *r = static_cast<QUITextRange *>(range);
QList<QInputMethodEvent::Attribute> attrs;
attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, r.range.location, r.range.length, 0);
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h
index 586edd589d..df7ce0ff4a 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.h
+++ b/src/plugins/platforms/ios/qiosviewcontroller.h
@@ -35,15 +35,17 @@
class QIOSScreen;
-@interface QIOSViewController : UIViewController {
- QIOSScreen *m_screen;
-}
+@interface QIOSViewController : UIViewController
-@property (nonatomic, assign) BOOL changingOrientation;
+- (id)initWithQIOSScreen:(QIOSScreen *)screen;
+- (void)updateProperties;
+
+@property (nonatomic, assign) UIInterfaceOrientation lockedOrientation;
+
+// UIViewController
+@property (nonatomic, assign) BOOL shouldAutorotate;
@property (nonatomic, assign) BOOL prefersStatusBarHidden;
@property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation;
-- (id)initWithQIOSScreen:(QIOSScreen *)screen;
-- (void)updateProperties;
@end
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index a2d81e3b6c..01bc84ae68 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -41,6 +41,8 @@
#import "qiosviewcontroller.h"
+#include <QtCore/qscopedvaluerollback.h>
+
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
#include <QtGui/QScreen>
@@ -119,6 +121,13 @@
// -------------------------------------------------------------------------
+@interface QIOSViewController () {
+ QIOSScreen *m_screen;
+ BOOL m_updatingProperties;
+}
+@property (nonatomic, assign) BOOL changingOrientation;
+@end
+
@implementation QIOSViewController
- (id)initWithQIOSScreen:(QIOSScreen *)screen
@@ -147,6 +156,7 @@
#endif
self.changingOrientation = NO;
+ self.shouldAutorotate = [super shouldAutorotate];
// Status bar may be initially hidden at startup through Info.plist
self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false);
@@ -173,6 +183,10 @@
[center addObserver:self selector:@selector(willChangeStatusBarFrame:)
name:UIApplicationWillChangeStatusBarFrameNotification
object:[UIApplication sharedApplication]];
+
+ [center addObserver:self selector:@selector(didChangeStatusBarOrientation:)
+ name:UIApplicationDidChangeStatusBarOrientationNotification
+ object:[UIApplication sharedApplication]];
}
- (void)viewDidUnload
@@ -183,19 +197,16 @@
// -------------------------------------------------------------------------
--(BOOL)shouldAutorotate
-{
- // Until a proper orientation and rotation API is in place, we always auto rotate.
- // If auto rotation is not wanted, you would need to switch it off manually from Info.plist.
- return YES;
-}
-
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0)
-(NSUInteger)supportedInterfaceOrientations
{
- // We need to tell iOS that we support all orientations in order to set
- // status bar orientation when application content orientation changes.
- return UIInterfaceOrientationMaskAll;
+ // As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated:
+ // only works if the supportedInterfaceOrientations of the view controller is 0, making
+ // us responsible for ensuring that the status bar orientation is consistent. We enter
+ // this mode when auto-rotation is disabled due to an explicit content orientation being
+ // set on the focus window. Note that this is counter to what the documentation for
+ // supportedInterfaceOrientations says, which states that the method should not return 0.
+ return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0;
}
#endif
@@ -203,7 +214,7 @@
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
Q_UNUSED(interfaceOrientation);
- return YES;
+ return [self shouldAutorotate];
}
#endif
@@ -250,6 +261,22 @@
}];
}
+- (void)didChangeStatusBarOrientation:(NSNotification *)notification
+{
+ Q_UNUSED(notification);
+
+ if (self.view.window.screen != [UIScreen mainScreen])
+ return;
+
+ // If the statusbar changes orientation due to auto-rotation we don't care,
+ // there will be re-layout anyways. Only if the statusbar changes due to
+ // reportContentOrientation, we need to update the window layout.
+ if (self.changingOrientation)
+ return;
+
+ [self.view setNeedsLayout];
+}
+
- (void)viewWillLayoutSubviews
{
if (!QCoreApplication::instance())
@@ -265,6 +292,15 @@
if (!isQtApplication())
return;
+ // Prevent recursion caused by updating the status bar appearance (position
+ // or visibility), which in turn may cause a layout of our subviews, and
+ // a reset of window-states, which themselves affect the view controller
+ // properties such as the statusbar visibilty.
+ if (m_updatingProperties)
+ return;
+
+ QScopedValueRollback<BOOL> updateRollback(m_updatingProperties, YES);
+
QWindow *focusWindow = QGuiApplication::focusWindow();
// If we don't have a focus window we leave the statusbar
@@ -281,14 +317,10 @@
// All decisions are based on the the top level window
focusWindow = qt_window_private(focusWindow)->topLevelWindow();
- bool hasScrolledRootViewDueToVirtualKeyboard =
- !CATransform3DIsIdentity(self.view.layer.sublayerTransform);
+ UIApplication *uiApplication = [UIApplication sharedApplication];
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
- self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen
- || hasScrolledRootViewDueToVirtualKeyboard;
- self.preferredStatusBarUpdateAnimation = hasScrolledRootViewDueToVirtualKeyboard ?
- UIStatusBarAnimationFade : UIStatusBarAnimationNone;
+ self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
@@ -297,13 +329,60 @@
} else
#endif
{
- [[UIApplication sharedApplication]
- setStatusBarHidden:self.prefersStatusBarHidden
+ [uiApplication setStatusBarHidden:self.prefersStatusBarHidden
withAnimation:self.preferredStatusBarUpdateAnimation];
}
[self.view setNeedsLayout];
}
+
+
+ // -------------- Content orientation ---------------
+
+ static BOOL kAnimateContentOrientationChanges = YES;
+
+ Qt::ScreenOrientation contentOrientation = focusWindow->contentOrientation();
+ if (contentOrientation != Qt::PrimaryOrientation) {
+ // An explicit content orientation has been reported for the focus window,
+ // so we keep the status bar in sync with content orientation. This will ensure
+ // that the task bar (and associated gestures) are also rotated accordingly.
+
+ if (self.shouldAutorotate) {
+ // We are moving from Qt::PrimaryOrientation to an explicit orientation,
+ // so we need to store the current statusbar orientation, as we need it
+ // later when mapping screen coordinates for QScreen and for returning
+ // to Qt::PrimaryOrientation.
+ self.lockedOrientation = uiApplication.statusBarOrientation;
+
+ // Calling setStatusBarOrientation only has an effect when auto-rotation is
+ // disabled, which makes sense when there's an explicit content orientation.
+ self.shouldAutorotate = NO;
+ }
+
+ [uiApplication setStatusBarOrientation:
+ UIInterfaceOrientation(fromQtScreenOrientation(contentOrientation))
+ animated:kAnimateContentOrientationChanges];
+
+ } else {
+ // The content orientation is set to Qt::PrimaryOrientation, meaning
+ // that auto-rotation should be enabled. But we may be coming out of
+ // a state of locked orientation, which needs some cleanup before we
+ // can enable auto-rotation again.
+ if (!self.shouldAutorotate) {
+ // First we need to restore the statusbar to what it was at the
+ // time of locking the orientation, otherwise iOS will be very
+ // confused when it starts doing auto-rotation again.
+ [uiApplication setStatusBarOrientation:
+ UIInterfaceOrientation(self.lockedOrientation)
+ animated:kAnimateContentOrientationChanges];
+
+ // Then we can re-enable auto-rotation
+ self.shouldAutorotate = YES;
+
+ // And finally let iOS rotate the root view to match the device orientation
+ [UIViewController attemptRotationToDeviceOrientation];
+ }
+ }
}
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 480062e4de..6c4614408d 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -75,6 +75,15 @@ QIOSWindow::QIOSWindow(QWindow *window)
setWindowState(window->windowState());
setOpacity(window->opacity());
+
+ Qt::ScreenOrientation initialOrientation = window->contentOrientation();
+ if (initialOrientation != Qt::PrimaryOrientation) {
+ // Start up in portrait, then apply possible content orientation,
+ // as per Apple's documentation.
+ dispatch_async(dispatch_get_main_queue(), ^{
+ handleContentOrientationChange(initialOrientation);
+ });
+ }
}
QIOSWindow::~QIOSWindow()
@@ -322,10 +331,12 @@ void QIOSWindow::updateWindowLevel()
void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{
- // Keep the status bar in sync with content orientation. This will ensure
- // that the task bar (and associated gestures) are aligned correctly:
- UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation));
- [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO];
+ // Update the QWindow representation straight away, so that
+ // we can update the statusbar orientation based on the new
+ // content orientation.
+ qt_window_private(window())->contentOrientation = orientation;
+
+ [m_view.qtViewController updateProperties];
}
void QIOSWindow::applicationStateChanged(Qt::ApplicationState)
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index d10c7fdb20..9a42b7712d 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -126,13 +126,15 @@ HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, const QPoint &
// Create a cursor from image and mask of the format QImage::Format_Mono.
static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits,
- QPoint hotSpot = QPoint(),
+ QPoint hotSpot = QPoint(-1, -1),
bool invb = false, bool invm = false)
{
const int width = bbits.width();
const int height = bbits.height();
- if (hotSpot.isNull())
- hotSpot = QPoint(width / 2, height / 2);
+ if (hotSpot.x() < 0)
+ hotSpot.setX(width / 2);
+ 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]);
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index fce60c3169..d3eb049269 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
const QPlatformDropQtResponse response =
QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(),
m_lastPoint / QWindowsScaling::factor(),
- translateToQDragDropActions(*pdwEffect));
+ translateToQDragDropActions(m_chosenEffect));
if (response.isAccepted()) {
const Qt::DropAction action = response.acceptedAction();
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index f8747a741e..5c241b1fc8 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -511,8 +511,9 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
const QTransform &xform)
{
glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform);
- int width = (metrics.width + margin * 2 + 4).ceil().toInt() ;
- int height = (metrics.height + margin * 2 + 4).ceil().toInt();
+ // This needs to be kept in sync with alphaMapBoundingBox
+ int width = (metrics.width + margin * 2).ceil().toInt() ;
+ int height = (metrics.height + margin * 2).ceil().toInt();
UINT16 glyphIndex = t;
FLOAT glyphAdvance = metrics.xoff.toReal();
@@ -695,6 +696,18 @@ QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyN
return QSettings(QLatin1String(keyC), QSettings::NativeFormat).value(familyName, familyName).toString();
}
+glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph, QFixed pos, const QTransform &matrix, GlyphFormat format)
+{
+ Q_UNUSED(pos);
+ int margin = 0;
+ if (format == QFontEngine::Format_A32 || format == QFontEngine::Format_ARGB)
+ margin = glyphMargin(QFontEngine::Format_A32);
+ glyph_metrics_t gm = QFontEngine::boundingBox(glyph, matrix);
+ gm.width += margin * 2;
+ gm.height += margin * 2;
+ return gm;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_DIRECTWRITE
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
index 2addb90de3..e0466c138d 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
@@ -75,6 +75,7 @@ public:
glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
glyph_metrics_t boundingBox(glyph_t g);
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat);
QFixed ascent() const;
QFixed descent() const;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index b7de580c44..5d94ec3c38 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1298,21 +1298,7 @@ void QWindowsWindow::setGeometryDp(const QRect &rectIn)
const QMargins margins = frameMarginsDp();
rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top()));
}
- const QSize oldSize = m_data.geometry.size();
m_data.geometry = rect;
- const QSize newSize = rect.size();
- // Check on hint.
- if (newSize != oldSize) {
- const QWindowsGeometryHint hint(window(), m_data.customMargins);
- if (!hint.validSize(newSize)) {
- qWarning("%s: Attempt to set a size (%dx%d) violating the constraints"
- "(%dx%d - %dx%d) on window %s/'%s'.", __FUNCTION__,
- newSize.width(), newSize.height(),
- hint.minimumSize.width(), hint.minimumSize.height(),
- hint.maximumSize.width(), hint.maximumSize.height(),
- window()->metaObject()->className(), qPrintable(window()->objectName()));
- }
- }
if (m_data.hwnd) {
// A ResizeEvent with resulting geometry will be sent. If we cannot
// achieve that size (for example, window title minimal constraint),
@@ -1625,17 +1611,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
setFlag(FrameDirty);
- if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
- if (visible && !(newState == Qt::WindowMinimized)) {
- setFlag(WithinMaximize);
- if (newState == Qt::WindowFullScreen)
- setFlag(MaximizeToFullScreen);
- ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
- clearFlag(WithinMaximize);
- clearFlag(MaximizeToFullScreen);
- }
- }
-
if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) {
#ifdef Q_OS_WINCE
HWND handle = FindWindow(L"HHTaskBar", L"");
@@ -1715,6 +1690,15 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
m_savedStyle = 0;
m_savedFrameGeometry = QRect();
}
+ } else if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
+ if (visible && !(newState == Qt::WindowMinimized)) {
+ setFlag(WithinMaximize);
+ if (newState == Qt::WindowFullScreen)
+ setFlag(MaximizeToFullScreen);
+ ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
+ clearFlag(WithinMaximize);
+ clearFlag(MaximizeToFullScreen);
+ }
}
if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) {
@@ -1761,6 +1745,8 @@ void QWindowsWindow::windowEvent(QEvent *event)
case QEvent::WindowBlocked: // Blocked by another modal window.
setEnabled(false);
setFlag(BlockedByModal);
+ if (hasMouseCapture())
+ ReleaseCapture();
break;
case QEvent::WindowUnblocked:
setEnabled(true);
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 74d73d7cdf..bbde948090 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -181,8 +181,6 @@ void QXcbShmImage::destroy()
if (segmentSize && m_shm_info.shmaddr)
Q_XCB_CALL(xcb_shm_detach(xcb_connection(), m_shm_info.shmseg));
- xcb_image_destroy(m_xcb_image);
-
if (segmentSize) {
if (m_shm_info.shmaddr) {
shmdt(m_shm_info.shmaddr);
@@ -192,6 +190,8 @@ void QXcbShmImage::destroy()
}
}
+ xcb_image_destroy(m_xcb_image);
+
if (m_gc)
Q_XCB_CALL(xcb_free_gc(xcb_connection(), m_gc));
delete m_graphics_buffer;
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 956b0f83d2..05035a5b1e 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -71,7 +71,8 @@ static int resourceType(const QByteArray &key)
QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"),
QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"),
QByteArrayLiteral("rootwindow"),
- QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled")
+ QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled"),
+ QByteArrayLiteral("nofonthinting")
};
const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
const QByteArray *result = std::find(names, end, key);
@@ -281,6 +282,9 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
case GetTimestamp:
result = getTimestamp(xcbScreen);
break;
+ case NoFontHinting:
+ result = xcbScreen->noFontHinting() ? this : 0; //qboolptr...
+ break;
default:
break;
}
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index b2044e6ee9..1db2d1cf83 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -65,7 +65,8 @@ public:
X11Screen,
RootWindow,
ScreenSubpixelType,
- ScreenAntialiasingEnabled
+ ScreenAntialiasingEnabled,
+ NoFontHinting
};
QXcbNativeInterface();
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index def6e2ce9a..0f25d10aac 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -53,7 +53,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
, m_screen(scr)
, m_crtc(output ? output->crtc : 0)
, m_outputName(outputName)
- , m_sizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
+ , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
, m_virtualSize(scr->width_in_pixels, scr->height_in_pixels)
, m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters)
, m_orientation(Qt::PrimaryOrientation)
@@ -62,6 +62,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
, m_forcedDpi(-1)
, m_devicePixelRatio(1)
, m_hintStyle(QFontEngine::HintStyle(-1))
+ , m_noFontHinting(false)
, m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1))
, m_antialiasingEnabled(-1)
, m_xSettings(0)
@@ -71,18 +72,27 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
updateGeometry(output ? output->timestamp : 0);
updateRefreshRate();
+
const int dpr = int(devicePixelRatio());
// On VNC, it can be that physical size is unknown while
// virtual size is known (probably back-calculated from DPI and resolution)
if (m_sizeMillimeters.isEmpty())
m_sizeMillimeters = m_virtualSizeMillimeters;
- if (m_geometry.isEmpty())
+ if (m_geometry.isEmpty()) {
m_geometry = QRect(QPoint(), m_virtualSize/dpr);
+ m_nativeGeometry = QRect(QPoint(), m_virtualSize);
+ }
if (m_availableGeometry.isEmpty())
m_availableGeometry = m_geometry;
readXResources();
+ // disable font hinting when we do UI scaling
+ static bool dpr_scaling_enabled = (qgetenv("QT_DEVICE_PIXEL_RATIO").toInt() > 1
+ || qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto");
+ if (dpr_scaling_enabled)
+ m_noFontHinting = true;
+
#ifdef Q_XCB_DEBUG
qDebug();
qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number);
@@ -93,6 +103,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height());
qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height());
qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y());
+ qDebug(" orientation....: %d", m_orientation);
qDebug(" pixel ratio....: %d", m_devicePixelRatio);
qDebug(" depth..........: %d", screen()->root_depth);
qDebug(" white pixel....: %x", screen()->white_pixel);
@@ -313,8 +324,14 @@ QDpi QXcbScreen::logicalDpi() const
if (m_forcedDpi > 0)
return QDpi(m_forcedDpi/dpr, m_forcedDpi/dpr);
- return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr,
- Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr);
+ static const bool auto_dpr = qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto";
+ if (auto_dpr) {
+ return QDpi(Q_MM_PER_INCH * m_geometry.width() / m_sizeMillimeters.width(),
+ Q_MM_PER_INCH * m_geometry.height() / m_sizeMillimeters.height());
+ } else {
+ return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr,
+ Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr);
+ }
}
@@ -413,6 +430,24 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
if (crtc) {
xGeometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height);
xAvailableGeometry = xGeometry;
+ switch (crtc->rotation) {
+ case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal
+ m_orientation = Qt::LandscapeOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters;
+ break;
+ case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left
+ m_orientation = Qt::PortraitOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters.transposed();
+ break;
+ case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted
+ m_orientation = Qt::InvertedLandscapeOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters;
+ break;
+ case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right
+ m_orientation = Qt::InvertedPortraitOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters.transposed();
+ break;
+ }
free(crtc);
}
}
@@ -441,6 +476,7 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
m_devicePixelRatio = qRound(dpi/96);
const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio
m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr);
+ m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size());
m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr);
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 4d0ae9847a..652d64c105 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -63,6 +63,7 @@ public:
QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE;
QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; }
+ QRect nativeGeometry() const { return m_nativeGeometry; }
QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;}
int depth() const Q_DECL_OVERRIDE { return m_screen->root_depth; }
QImage::Format format() const Q_DECL_OVERRIDE;
@@ -98,6 +99,7 @@ public:
void readXResources();
QFontEngine::HintStyle hintStyle() const { return m_hintStyle; }
+ bool noFontHinting() const { return m_noFontHinting; }
QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; }
int antialiasingEnabled() const { return m_antialiasingEnabled; }
@@ -112,8 +114,10 @@ private:
xcb_screen_t *m_screen;
xcb_randr_crtc_t m_crtc;
QString m_outputName;
+ QSizeF m_outputSizeMillimeters;
QSizeF m_sizeMillimeters;
QRect m_geometry;
+ QRect m_nativeGeometry;
QRect m_availableGeometry;
QSize m_virtualSize;
QSizeF m_virtualSizeMillimeters;
@@ -130,6 +134,7 @@ private:
int m_forcedDpi;
int m_devicePixelRatio;
QFontEngine::HintStyle m_hintStyle;
+ bool m_noFontHinting;
QFontEngine::SubpixelAntialiasingType m_subpixelType;
int m_antialiasingEnabled;
QXcbXSettings *m_xSettings;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 4d14dd14a3..4676133777 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -142,7 +142,7 @@ static inline QRect mapToNative(const QRect &qtRect, int dpr)
return QRect(qtRect.x() * dpr, qtRect.y() * dpr, qtRect.width() * dpr, qtRect.height() * dpr);
}
-// When converting native rects to Qt rects: round top/left towards the origin and
+// When mapping expose events to Qt rects: round top/left towards the origin and
// bottom/right away from the origin, making sure that we cover the whole widget
static inline QPoint dpr_floor(const QPoint &p, int dpr)
@@ -155,11 +155,15 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr)
return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr);
}
-static inline QRect mapFromNative(const QRect &xRect, int dpr)
+static inline QRect mapExposeFromNative(const QRect &xRect, int dpr)
{
return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr));
}
+static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr)
+{
+ return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr);
+}
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
static inline bool isTransient(const QWindow *w)
@@ -1670,7 +1674,7 @@ public:
return false;
if (expose->count == 0)
m_pending = false;
- *m_region |= mapFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr);
+ *m_region |= mapExposeFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr);
return true;
}
@@ -1698,7 +1702,7 @@ void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event)
{
const int dpr = int(devicePixelRatio());
QRect x_rect(event->x, event->y, event->width, event->height);
- QRect rect = mapFromNative(x_rect, dpr);
+ QRect rect = mapExposeFromNative(x_rect, dpr);
if (m_exposeRegion.isEmpty())
m_exposeRegion = rect;
@@ -1783,6 +1787,23 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
}
}
+// Temporary workaround for bug in QPlatformScreen::screenForNativeGeometry
+// we need the native geometries to detect our screen, but that's not
+// available in cross-platform code. Will be fixed properly when highDPI
+// support is refactored to expose the native coordinate system.
+
+QPlatformScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const
+{
+ QXcbScreen *currentScreen = static_cast<QXcbScreen*>(screen());
+ if (!parent() && !currentScreen->nativeGeometry().intersects(newGeometry)) {
+ Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
+ if (static_cast<QXcbScreen*>(screen)->nativeGeometry().intersects(newGeometry))
+ return screen;
+ }
+ }
+ return currentScreen;
+}
+
void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event)
{
bool fromSendEvent = (event->response_type & 0x80);
@@ -1799,15 +1820,23 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
}
}
- QRect rect = mapFromNative(QRect(pos, QSize(event->width, event->height)), int(devicePixelRatio()));
+ const int dpr = devicePixelRatio();
+ const QRect nativeRect = QRect(pos, QSize(event->width, event->height));
+ const QRect rect = mapGeometryFromNative(nativeRect, dpr);
QPlatformWindow::setGeometry(rect);
QWindowSystemInterface::handleGeometryChange(window(), rect);
- QPlatformScreen *newScreen = screenForGeometry(rect);
+ QPlatformScreen *newScreen = screenForNativeGeometry(nativeRect);
if (newScreen != m_screen) {
m_screen = static_cast<QXcbScreen*>(newScreen);
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
+ int newDpr = devicePixelRatio();
+ if (newDpr != dpr) {
+ QRect newRect = mapGeometryFromNative(nativeRect, newDpr);
+ QPlatformWindow::setGeometry(newRect);
+ QWindowSystemInterface::handleGeometryChange(window(), newRect);
+ }
}
m_configureNotifyPending = false;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 340070e882..b78bf779d0 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -151,6 +151,8 @@ public:
virtual void create();
virtual void destroy();
+ QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const;
+
public Q_SLOTS:
void updateSyncRequestCounter();
diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp
index 13d42832db..a1dadb0e54 100644
--- a/src/plugins/platforms/xcb/qxcbxsettings.cpp
+++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp
@@ -36,7 +36,9 @@
#include <QtCore/QByteArray>
#include <QtCore/QtEndian>
+#ifdef XCB_USE_XLIB
#include <X11/extensions/XIproto.h>
+#endif //XCB_USE_XLIB
QT_BEGIN_NAMESPACE
/* Implementation of http://standards.freedesktop.org/xsettings-spec/xsettings-0.5.html */
@@ -138,6 +140,7 @@ public:
return value + 4 - remainder;
}
+#ifdef XCB_USE_XLIB
void populateSettings(const QByteArray &xSettings)
{
if (xSettings.length() < 12)
@@ -212,6 +215,7 @@ public:
}
}
+#endif //XCB_USE_XLIB
QXcbScreen *screen;
xcb_window_t x_settings_window;
@@ -258,8 +262,10 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen)
const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE };
xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask);
+#ifdef XCB_USE_XLIB
d_ptr->populateSettings(d_ptr->getSettings());
d_ptr->initialized = true;
+#endif //XCB_USE_XLIB
}
QXcbXSettings::~QXcbXSettings()
@@ -279,7 +285,9 @@ void QXcbXSettings::handlePropertyNotifyEvent(const xcb_property_notify_event_t
Q_D(QXcbXSettings);
if (event->window != d->x_settings_window)
return;
+#ifdef XCB_USE_XLIB
d->populateSettings(d->getSettings());
+#endif //XCB_USE_XLIB
}
void QXcbXSettings::registerCallbackForProperty(const QByteArray &property, QXcbXSettings::PropertyChangeFunc func, void *handle)
diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h
index 504a0d6e20..ebb165190e 100644
--- a/src/printsupport/kernel/qprint_p.h
+++ b/src/printsupport/kernel/qprint_p.h
@@ -143,7 +143,7 @@ namespace QPrint {
QPrint::OutputBinId id;
};
-};
+}
struct InputSlotMap {
QPrint::InputSlotId id;
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 4e0a3e0795..69f74ef775 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -931,6 +931,8 @@ void QWin32PrintEnginePrivate::initHDC()
default:
break;
}
+
+ updateMetrics();
}
void QWin32PrintEnginePrivate::release()
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 437a68e609..8ed2732c1e 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -1224,7 +1224,10 @@ void QPrinter::setPageSize(PageSize newPageSize)
void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit)
{
- setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
+ if (unit == QPrinter::DevicePixel)
+ setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point));
+ else
+ setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
}
/*!
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index d9b31c7702..9462df8f97 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -393,10 +393,20 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
colSize*sizeof(SQLTCHAR),
&lengthIndicator);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
- if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) {
+ if (lengthIndicator == SQL_NULL_DATA) {
fieldVal.clear();
break;
}
+ // starting with ODBC Native Client 2012, SQL_NO_TOTAL is returned
+ // instead of the length (which sometimes was wrong in older versions)
+ // see link for more info: http://msdn.microsoft.com/en-us/library/jj219209.aspx
+ // if length indicator equals SQL_NO_TOTAL, indicating that
+ // more data can be fetched, but size not known, collect data
+ // and fetch next block
+ if (lengthIndicator == SQL_NO_TOTAL) {
+ fieldVal += fromSQLTCHAR(buf, colSize);
+ continue;
+ }
// if SQL_SUCCESS_WITH_INFO is returned, indicating that
// more data can be fetched, the length indicator does NOT
// contain the number of bytes returned - it contains the
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 52b96a5456..455e1f46ca 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -426,11 +426,8 @@ QVariant QPSQLResult::data(int i)
#ifndef QT_NO_DATESTRING
if (str.isEmpty())
return QVariant(QTime());
- if (str.at(str.length() - 3) == QLatin1Char('+') || str.at(str.length() - 3) == QLatin1Char('-'))
- // strip the timezone
- // TODO: fix this when timestamp support comes into QDateTime
- return QVariant(QTime::fromString(str.left(str.length() - 3), Qt::ISODate));
- return QVariant(QTime::fromString(str, Qt::ISODate));
+ else
+ return QVariant(QTime::fromString(str, Qt::ISODate));
#else
return QVariant(str);
#endif
@@ -438,19 +435,13 @@ QVariant QPSQLResult::data(int i)
case QVariant::DateTime: {
QString dtval = QString::fromLatin1(val);
#ifndef QT_NO_DATESTRING
- if (dtval.length() < 10)
- return QVariant(QDateTime());
- // remove the timezone
- // TODO: fix this when timestamp support comes into QDateTime
- if (dtval.at(dtval.length() - 3) == QLatin1Char('+') || dtval.at(dtval.length() - 3) == QLatin1Char('-'))
- dtval.chop(3);
- // milliseconds are sometimes returned with 2 digits only
- if (dtval.at(dtval.length() - 3).isPunct())
- dtval += QLatin1Char('0');
- if (dtval.isEmpty())
+ if (dtval.length() < 10) {
return QVariant(QDateTime());
- else
- return QVariant(QDateTime::fromString(dtval, Qt::ISODate));
+ } else {
+ QChar sign = dtval[dtval.size() - 3];
+ if (sign == QLatin1Char('-') || sign == QLatin1Char('+')) dtval += QLatin1String(":00");
+ return QVariant(QDateTime::fromString(dtval, Qt::ISODate).toLocalTime());
+ }
#else
return QVariant(dtval);
#endif
@@ -536,6 +527,11 @@ QSqlRecord QPSQLResult::record() const
int precision = PQfmod(d->result, i);
switch (ptype) {
+ case QTIMESTAMPOID:
+ case QTIMESTAMPTZOID:
+ precision = 3;
+ break;
+
case QNUMERICOID:
if (precision != -1) {
len = (precision >> 16);
@@ -1263,15 +1259,10 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
case QVariant::DateTime:
#ifndef QT_NO_DATESTRING
if (field.value().toDateTime().isValid()) {
- QDate dt = field.value().toDateTime().date();
- QTime tm = field.value().toDateTime().time();
- // msecs need to be right aligned otherwise psql interprets them wrong
- r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-')
- + QString::number(dt.month()).rightJustified(2, QLatin1Char('0')) + QLatin1Char('-')
- + QString::number(dt.day()).rightJustified(2, QLatin1Char('0')) + QLatin1Char(' ')
- + tm.toString() + QLatin1Char('.')
- + QString::number(tm.msec()).rightJustified(3, QLatin1Char('0'))
- + QLatin1Char('\'');
+ // we force the value to be considered with a timezone information, and we force it to be UTC
+ // this is safe since postgresql stores only the UTC value and not the timezone offset (only used
+ // while parsing), so we have correct behavior in both case of with timezone and without tz
+ r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + field.value().toDateTime().toUTC().toString(QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + QLatin1Char('Z') + QLatin1Char('\'');
} else {
r = QLatin1String("NULL");
}
diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp
index 98e262a7e2..2808587d96 100644
--- a/src/sql/kernel/qsqlquery.cpp
+++ b/src/sql/kernel/qsqlquery.cpp
@@ -1060,6 +1060,7 @@ bool QSqlQuery::exec()
*/
bool QSqlQuery::execBatch(BatchExecutionMode mode)
{
+ d->sqlResult->resetBindCount();
return d->sqlResult->execBatch(mode == ValuesAsColumns);
}
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 889798e862..5bf3760f66 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -105,6 +105,7 @@ public:
QBenchmarkResult()
: value(-1)
, iterations(-1)
+ , metric(QTest::FramesPerSecond)
, setByMacro(true)
, valid(false)
{ }
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 40d9eac46d..0c00e47afc 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -91,8 +91,7 @@ template<> inline char *toString(const QDate &date)
template<> inline char *toString(const QDateTime &dateTime)
{
return dateTime.isValid()
- ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) +
- (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))))
+ ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz[t]"))))
: qstrdup("Invalid QDateTime");
}
#endif // QT_NO_DATESTRING
diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
index 446b441675..9f5ef59e94 100644
--- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
@@ -805,7 +805,7 @@
{QWidget::addAction}().
\endquotation
- If you don't include the function name with the \b{\\overlaod}
+ If you don't include the function name with the \b{\\overload}
command, then instead of the "This function overloads..." line
with the link to the documentation for the primary version, you
get the old standard line:
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index aa1b4b1023..5fffe61877 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -57,6 +57,7 @@
#include "qdialogbuttonbox.h"
#include "qscreen.h"
#include "qcursor.h"
+#include "qtimer.h"
#include <algorithm>
@@ -1539,8 +1540,18 @@ void QColorDialogPrivate::_q_pickScreenColor()
#else
q->grabMouse();
#endif
+
+#ifdef Q_OS_WIN32 // excludes WinCE and WinRT
+ // On Windows mouse tracking doesn't work over other processes's windows
+ updateTimer->start(30);
+
+ // HACK: Because mouse grabbing doesn't work across processes, we have to have a dummy,
+ // invisible window to catch the mouse click, otherwise we will click whatever we clicked
+ // and loose focus.
+ dummyTransparentWindow.show();
+#endif
q->grabKeyboard();
- /* With setMouseTracking(true) the desired color can be more precisedly picked up,
+ /* With setMouseTracking(true) the desired color can be more precisely picked up,
* and continuously pushing the mouse button is not necessary.
*/
q->setMouseTracking(true);
@@ -1567,6 +1578,10 @@ void QColorDialogPrivate::releaseColorPicking()
cp->setCrossVisible(true);
q->removeEventFilter(colorPickingEventFilter);
q->releaseMouse();
+#ifdef Q_OS_WIN32
+ updateTimer->stop();
+ dummyTransparentWindow.setVisible(false);
+#endif
q->releaseKeyboard();
q->setMouseTracking(false);
lblScreenColorInfo->setText(QLatin1String("\n"));
@@ -1593,6 +1608,10 @@ void QColorDialogPrivate::init(const QColor &initial)
#ifdef Q_WS_MAC
delegate = 0;
#endif
+#ifdef Q_OS_WIN32
+ dummyTransparentWindow.resize(1, 1);
+ dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint);
+#endif
q->setCurrentColor(initial);
}
@@ -1733,6 +1752,10 @@ void QColorDialogPrivate::initWidgets()
cancel = buttons->addButton(QDialogButtonBox::Cancel);
QObject::connect(cancel, SIGNAL(clicked()), q, SLOT(reject()));
+#ifdef Q_OS_WIN32
+ updateTimer = new QTimer(q);
+ QObject::connect(updateTimer, SIGNAL(timeout()), q, SLOT(_q_updateColorPicking()));
+#endif
retranslateStrings();
}
@@ -2138,18 +2161,41 @@ void QColorDialog::changeEvent(QEvent *e)
QDialog::changeEvent(e);
}
-bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e)
+void QColorDialogPrivate::_q_updateColorPicking()
{
- // If the cross is visible the grabbed color will be black most of the times
- cp->setCrossVisible(!cp->geometry().contains(e->pos()));
+#ifndef QT_NO_CURSOR
+ Q_Q(QColorDialog);
+ static QPoint lastGlobalPos;
+ QPoint newGlobalPos = QCursor::pos();
+ if (lastGlobalPos == newGlobalPos)
+ return;
+ lastGlobalPos = newGlobalPos;
- const QPoint globalPos = e->globalPos();
+ if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) { // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called
+ updateColorPicking(newGlobalPos);
+#ifdef Q_OS_WIN32
+ dummyTransparentWindow.setPosition(newGlobalPos);
+#endif
+ }
+#endif // ! QT_NO_CURSOR
+}
+
+void QColorDialogPrivate::updateColorPicking(const QPoint &globalPos)
+{
const QColor color = grabScreenColor(globalPos);
// QTBUG-39792, do not change standard, custom color selectors while moving as
// otherwise it is not possible to pre-select a custom cell for assignment.
setCurrentColor(color, ShowColor);
updateColorLabelText(globalPos);
+}
+
+bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e)
+{
+ // If the cross is visible the grabbed color will be black most of the times
+ cp->setCrossVisible(!cp->geometry().contains(e->pos()));
+
+ updateColorPicking(e->globalPos());
return true;
}
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 22ff907e7a..87e62be81f 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -112,6 +112,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int))
Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int))
Q_PRIVATE_SLOT(d_func(), void _q_pickScreenColor())
+ Q_PRIVATE_SLOT(d_func(), void _q_updateColorPicking())
friend class QColorShower;
};
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index 7e6c8b1231..cf8bb33d94 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -49,6 +49,7 @@
#include "private/qdialog_p.h"
#include "qcolordialog.h"
#include "qsharedpointer.h"
+#include "qwindow.h"
#ifndef QT_NO_COLORDIALOG
@@ -63,6 +64,7 @@ class QVBoxLayout;
class QPushButton;
class QWellArray;
class QColorPickingEventFilter;
+class QTimer;
class QColorDialogPrivate : public QDialogPrivate
{
@@ -75,7 +77,11 @@ public:
SetColorAll = ShowColor | SelectColor
};
- QColorDialogPrivate() : options(new QColorDialogOptions) {}
+ QColorDialogPrivate() : options(new QColorDialogOptions)
+#ifdef Q_OS_WIN32
+ , updateTimer(0)
+#endif
+ {}
QPlatformColorDialogHelper *platformColorDialogHelper() const
{ return static_cast<QPlatformColorDialogHelper *>(platformHelper()); }
@@ -104,7 +110,9 @@ public:
void _q_newCustom(int, int);
void _q_newStandard(int, int);
void _q_pickScreenColor();
+ void _q_updateColorPicking();
void updateColorLabelText(const QPoint &);
+ void updateColorPicking(const QPoint &pos);
void releaseColorPicking();
bool handleColorPickingMouseMove(QMouseEvent *e);
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
@@ -137,6 +145,10 @@ public:
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
+#ifdef Q_OS_WIN32
+ QTimer *updateTimer;
+ QWindow dummyTransparentWindow;
+#endif
#ifdef Q_WS_MAC
void openCocoaColorPanel(const QColor &initial,
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index c6d1df04aa..3f178189b9 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -110,10 +110,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
{
Q_Q(QProgressDialog);
label = new QLabel(labelText, q);
- int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q);
- label->setAlignment(Qt::Alignment(align));
bar = new QProgressBar(q);
bar->setRange(min, max);
+ int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q);
+ label->setAlignment(Qt::Alignment(align));
autoClose = true;
autoReset = true;
forceHide = false;
diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
index f581df4cb3..7e2e79fc5d 100644
--- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
@@ -219,7 +219,7 @@
\section1 Custom Widgets in Layouts
When you make your own widget class, you should also communicate its layout
- properties. If the widget has a one of Qt's layouts, this is already taken
+ properties. If the widget uses one of Qt's layouts, this is already taken
care of. If the widget does not have any child widgets, or uses manual
layout, you can change the behavior of the widget using any or all of the
following mechanisms:
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 7b7600fdc3..40ecc8d184 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -7233,7 +7233,7 @@ QByteArray QWidget::saveGeometry() const
/*!
\since 4.2
- Restores the geometry and state top-level widgets stored in the
+ Restores the geometry and state of top-level widgets stored in the
byte array \a geometry. Returns \c true on success; otherwise
returns \c false.
@@ -12390,10 +12390,9 @@ static void releaseMouseGrabOfWidget(QWidget *widget)
\note Only visible widgets can grab mouse input. If isVisible()
returns \c false for a widget, that widget cannot call grabMouse().
- \note \b{(Mac OS X developers)} For \e Cocoa, calling
- grabMouse() on a widget only works when the mouse is inside the
- frame of that widget. For \e Carbon, it works outside the widget's
- frame as well, like for Windows and X11.
+ \note On Windows, grabMouse() only works when the mouse is inside a window
+ owned by the process.
+ On OS X, grabMouse() only works when the mouse is inside the frame of that widget.
\sa releaseMouse(), grabKeyboard(), releaseKeyboard()
*/
@@ -12414,7 +12413,7 @@ void QWidget::grabMouse()
\warning Grabbing the mouse might lock the terminal.
- \note \b{(Mac OS X developers)} See the note in QWidget::grabMouse().
+ \note See the note in QWidget::grabMouse().
\sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor()
*/
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 94b6000436..6ae0bde20a 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -514,6 +514,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
break;
}
arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation);
+ if (arrow.isNull())
+ break;
+
QRect rect = option->rect;
QRect arrowRect;
int imageMax = qMin(arrow.height(), arrow.width());
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 282416971b..ea51d4989e 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3397,8 +3397,10 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
state = QIcon::On;
QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
- int labelWidth = pixmap.width();
- int labelHeight = pixmap.height();
+ int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio();
+ int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio();
+ int labelWidth = pixmapWidth;
+ int labelHeight = pixmapHeight;
int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint()
int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width();
if (!button->text.isEmpty())
@@ -3407,15 +3409,15 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
//Determine label alignment:
if (textAlignment & Qt::AlignLeft) { /*left*/
iconRect = QRect(textRect.x(), textRect.y() + (textRect.height() - labelHeight) / 2,
- pixmap.width(), pixmap.height());
+ pixmapWidth, pixmapHeight);
} else if (textAlignment & Qt::AlignHCenter) { /* center */
iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2,
textRect.y() + (textRect.height() - labelHeight) / 2,
- pixmap.width(), pixmap.height());
+ pixmapWidth, pixmapHeight);
} else { /*right*/
iconRect = QRect(textRect.x() + textRect.width() - labelWidth,
textRect.y() + (textRect.height() - labelHeight) / 2,
- pixmap.width(), pixmap.height());
+ pixmapWidth, pixmapHeight);
}
iconRect = visualRect(button->direction, textRect, iconRect);
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 01a1f5046e..4121074e2e 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -930,12 +930,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
initDrag(event->pos(), true);
if (state == 0)
break;
-#ifdef Q_WS_WIN
- // On Windows, NCA mouse events don't contain modifier info
- state->ctrlDrag = GetKeyState(VK_CONTROL) & 0x8000;
-#else
state->ctrlDrag = event->modifiers() & Qt::ControlModifier;
-#endif
startDrag();
break;
case QEvent::NonClientAreaMouseMove:
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 72a556db7c..e56fd111e5 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -288,8 +288,7 @@ void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int c
if (changeStartBlock == changeEndBlock && newBlockCount == d->blockCount) {
QTextBlock block = changeStartBlock;
- int blockLineCount = block.layout()->lineCount();
- if (block.isValid() && blockLineCount) {
+ if (block.isValid() && block.length()) {
QRectF oldBr = blockBoundingRect(block);
layoutBlock(block);
QRectF newBr = blockBoundingRect(block);
diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl
index fe67257b4b..8e9376da35 100755
--- a/tests/auto/android/runtests_androiddeployqt.pl
+++ b/tests/auto/android/runtests_androiddeployqt.pl
@@ -40,6 +40,8 @@ use File::Temp 'tempdir';
use File::Path 'remove_tree';
use Getopt::Long;
use Pod::Usage;
+use XML::Simple;
+use Term::ANSIColor;
### default options
my @stack = cwd;
@@ -53,6 +55,7 @@ my $testsubset = "";
my $man = 0;
my $help = 0;
my $make_clean = 0;
+my $stop_on_fail = 0;
my $time_out=400;
my $android_toolchain_version = "4.8";
my $host_arch = "linux-x86";
@@ -89,6 +92,7 @@ GetOptions('h|help' => \$help
, 'strip=s' => \$strip_tool
, 'readelf=s' => \$readelf_tool
, 'testcase=s' => \$testcase
+ , 'f|fail' => sub { $stop_on_fail = 1 }
, 'silent' => sub { $silent = 1 }
, 'ci' => sub { $ci_use = 1 }
, 'uninstall' => sub { $uninstall = 1 }
@@ -311,6 +315,37 @@ if ($output =~ m/.*\[ro.build.version.sdk\]: \[(\d+)\]/)
$sdk_api=9 if ($sdk_api>9);
}
+sub checkXMLOutput
+{
+ print color 'bold red';
+ my $fileName = shift;
+ my $XMLOutput = eval { XMLin($fileName, ForceArray => 1) };
+ if (!defined($XMLOutput)) {
+ print "Can't parse the $fileName file, probably the test crased.\n";
+ print color 'reset';
+ die "Stopping\n" if $stop_on_fail;
+ return;
+ }
+ my $testName = $XMLOutput->{name};
+ my $fail = 0;
+ while (my($node_key, $node_valule) = each (%{$XMLOutput})) {
+ next if $node_key ne "TestFunction";
+ while (my($function_key, $function_valule) = each (%{$node_valule})) {
+ while (my($test_key, $test_valule) = each (%{$function_valule})) {
+ next if $test_key ne "Incident";
+ for my $incident (@{$test_valule}) {
+ if ($incident->{type} ne "pass") {
+ print "test $testName::$function_key failed $incident->{file}:$incident->{line}\n";
+ $fail = 1;
+ }
+ }
+ }
+ }
+ }
+ print color 'reset';
+ die "Stopping\n" if $stop_on_fail and $fail;
+}
+
sub startTest
{
my $testName = shift;
@@ -352,6 +387,7 @@ sub startTest
sleep(3);
system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file.xml") if ($get_xml);
+
system("$adb_tool $device_serial pull /data/data/$packageName/output.txt $output_dir/$output_file.txt") if ($get_txt);
if ($get_txt){
print "Tesresults for $packageName:\n";
@@ -359,6 +395,8 @@ sub startTest
print_output("$output_dir/$output_file.txt", $packageName, $insignificance);
}
system("$adb_tool $device_serial uninstall $packageName") if ($uninstall);
+
+ checkXMLOutput("$output_dir/$output_file.xml") if ($get_xml);
return 1;
}
@@ -439,6 +477,9 @@ runtests.pl [options]
=head1 OPTIONS
=over 8
+=item B<-f --fail>
+
+Stop the script when test fails. Default 0
=item B<-s --serial = serial>
diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro
index 25c29b83ee..9ab2b0948d 100644
--- a/tests/auto/corelib/io/qdatastream/qdatastream.pro
+++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qdatastream.cpp
TESTDATA += datastream.q42
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/io/qdatastream/testdata.qrc b/tests/auto/corelib/io/qdatastream/testdata.qrc
new file mode 100644
index 0000000000..fb63cb3438
--- /dev/null
+++ b/tests/auto/corelib/io/qdatastream/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>datastream.q42</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
index e4b5d9ab8f..5d1a743dd9 100644
--- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
@@ -50,10 +50,10 @@ int main(int argc, char *argv[])
option = QString::fromLocal8Bit(argv[2]);
if (option == "-crash") {
- QLockFile *lockFile = new QLockFile(lockName);
- lockFile->lock();
- // leak the lockFile on purpose, so that the lock remains!
- return 0;
+ QLockFile lockFile(lockName);
+ lockFile.lock();
+ // exit on purpose, so that the lock remains!
+ exit(0);
} else if (option == "-busy") {
QLockFile lockFile(lockName);
lockFile.lock();
diff --git a/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc
new file mode 100644
index 0000000000..f30290c262
--- /dev/null
+++ b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/android_testdata">
+ <file>tst_qtemporaryfile.cpp</file>
+ <file>resources/test.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
index 8a91340e5f..c16a729ad0 100644
--- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
@@ -5,4 +5,8 @@ QT = core testlib
SOURCES = tst_qtemporaryfile.cpp
TESTDATA += tst_qtemporaryfile.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-RESOURCES += qtemporaryfile.qrc \ No newline at end of file
+RESOURCES += qtemporaryfile.qrc
+
+android:!android-no-sdk {
+ RESOURCES += android_testdata.qrc
+}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index a08a0ae777..29a3c4e18a 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -92,6 +92,24 @@ void tst_QTemporaryFile::initTestCase()
// For QTBUG_4796
QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX"));
QCoreApplication::setApplicationName("tst_qtemporaryfile");
+
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString sourceDir(":/android_testdata/");
+ QDirIterator it(sourceDir, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo sourceFileInfo = it.fileInfo();
+ if (!sourceFileInfo.isDir()) {
+ QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length()));
+
+ if (!destinationFileInfo.exists()) {
+ QVERIFY(QDir().mkpath(destinationFileInfo.path()));
+ QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath()));
+ }
+ }
+ }
+#endif
}
void tst_QTemporaryFile::cleanupTestCase()
@@ -253,20 +271,21 @@ void tst_QTemporaryFile::autoRemove()
QVERIFY(!QFile::exists(fileName));
}
+struct ChdirOnReturn
+{
+ ChdirOnReturn(const QString& d) : dir(d) {}
+ ~ChdirOnReturn() {
+ QDir::setCurrent(dir);
+ }
+ QString dir;
+};
+
void tst_QTemporaryFile::nonWritableCurrentDir()
{
#ifdef Q_OS_UNIX
if (::geteuid() == 0)
QSKIP("not valid running this test as root");
- struct ChdirOnReturn
- {
- ChdirOnReturn(const QString& d) : dir(d) {}
- ~ChdirOnReturn() {
- QDir::setCurrent(dir);
- }
- QString dir;
- };
ChdirOnReturn cor(QDir::currentPath());
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
@@ -443,6 +462,12 @@ void tst_QTemporaryFile::rename()
void tst_QTemporaryFile::renameFdLeak()
{
#ifdef Q_OS_UNIX
+
+# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ ChdirOnReturn cor(QDir::currentPath());
+ QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
+# endif
+
const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__));
QVERIFY(!sourceFile.isEmpty());
// Test this on Unix only
@@ -646,7 +671,11 @@ void tst_QTemporaryFile::createNativeFile_data()
QTest::addColumn<bool>("valid");
QTest::addColumn<QByteArray>("content");
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt");
+#else
const QString nativeFilePath = QFINDTESTDATA("resources/test.txt");
+#endif
QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray();
QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray();
diff --git a/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc
new file mode 100644
index 0000000000..b33995ef21
--- /dev/null
+++ b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/android_testdata">
+ <file>hellotr_la.qm</file>
+ <file>msgfmt_from_po.qm</file>
+ <file>dependencies_la.qm</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro
index 41c3dea924..e588f44370 100644
--- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro
+++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro
@@ -4,4 +4,6 @@ QT = core testlib
SOURCES = tst_qtranslator.cpp
RESOURCES += qtranslator.qrc
-TESTDATA += hellotr_la.qm msgfmt_from_po.qm
+android:!android-no-sdk: RESOURCES += android_testdata.qrc
+else: TESTDATA += hellotr_la.qm msgfmt_from_po.qm
+
diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
index 802d649496..077da6fce8 100644
--- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
+++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
@@ -68,6 +68,26 @@ tst_QTranslator::tst_QTranslator()
void tst_QTranslator::initTestCase()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString sourceDir(":/android_testdata/");
+ QDirIterator it(sourceDir, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo sourceFileInfo = it.fileInfo();
+ if (!sourceFileInfo.isDir()) {
+ QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length()));
+
+ if (!destinationFileInfo.exists()) {
+ QVERIFY(QDir().mkpath(destinationFileInfo.path()));
+ QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath()));
+ }
+ }
+ }
+
+ QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
+#endif
+
// chdir into the directory containing our testdata,
// to make the code simpler (load testdata via relative paths)
QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath();
diff --git a/tests/auto/corelib/tools/qbytearray/android_testdata.qrc b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc
new file mode 100644
index 0000000000..5d42f0f627
--- /dev/null
+++ b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>rfc3252.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro
index 8d2efce0be..22104f817f 100644
--- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro
+++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro
@@ -10,3 +10,8 @@ mac {
OBJECTIVE_SOURCES += tst_qbytearray_mac.mm
LIBS += -framework Foundation
}
+
+android: !android-no-sdk {
+ RESOURCES += \
+ android_testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro
index 0738abad3a..a72f16fa49 100644
--- a/tests/auto/corelib/tools/qchar/qchar.pro
+++ b/tests/auto/corelib/tools/qchar/qchar.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qchar.cpp
TESTDATA += data/NormalizationTest.txt
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qchar/testdata.qrc b/tests/auto/corelib/tools/qchar/testdata.qrc
new file mode 100644
index 0000000000..7b3fb2461c
--- /dev/null
+++ b/tests/auto/corelib/tools/qchar/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/NormalizationTest.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
index f55e2eac42..96c7064d23 100644
--- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
+++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
@@ -170,6 +170,11 @@ void tst_QCollator::compare()
QCollator collator(locale);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ if (collator.locale() != QLocale())
+ QSKIP("Posix implementation of collation only supports default locale");
+#endif
+
if (numericMode)
collator.setNumericMode(true);
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index 7062d4cad9..ff9b63703c 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -472,6 +472,10 @@ void tst_QCommandLineParser::testVersionOption()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE");
#endif
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Deploying executable applications to file system on Android not supported.");
+#endif
+
QCoreApplication app(empty_argc, empty_argv);
QProcess process;
process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "--version");
@@ -537,6 +541,9 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE");
#endif
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Deploying executable applications to file system on Android not supported.");
+#endif
QFETCH(QCommandLineParser::SingleDashWordOptionMode, parsingMode);
QFETCH(QString, expectedHelpOutput);
@@ -581,6 +588,8 @@ void tst_QCommandLineParser::testQuoteEscaping()
{
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Deploying executable applications to file system on Android not supported.");
#else
QCoreApplication app(empty_argc, empty_argv);
QProcess process;
diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro
index f7725ab188..941a068f8e 100644
--- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro
+++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qcryptographichash.cpp
TESTDATA += data/*
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qcryptographichash/testdata.qrc b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc
new file mode 100644
index 0000000000..8f7bcea63c
--- /dev/null
+++ b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/2c1517dad3678f03917f15849b052fd5.md5</file>
+ <file>data/d41d8cd98f00b204e9800998ecf8427e.md5</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 8876bb3d34..e992c41bc1 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -1903,6 +1903,14 @@ void tst_QDateTime::fromStringDateFormat_data()
<< Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
QTest::newRow("ISO +00:00") << QString::fromLatin1("1970-01-01T00:12:34+00:00")
<< Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
+ QTest::newRow("ISO -03") << QString::fromLatin1("2014-12-15T12:37:09-03")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC);
+ QTest::newRow("ISO zzz-03") << QString::fromLatin1("2014-12-15T12:37:09.745-03")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC);
+ QTest::newRow("ISO -3") << QString::fromLatin1("2014-12-15T12:37:09-3")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC);
+ QTest::newRow("ISO zzz-3") << QString::fromLatin1("2014-12-15T12:37:09.745-3")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC);
// No time specified - defaults to Qt::LocalTime.
QTest::newRow("ISO data3") << QString::fromLatin1("2002-10-01")
<< Qt::ISODate << QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0), Qt::LocalTime);
diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
index 498d8f9c40..29b9854ebb 100644
--- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
+++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qtextboundaryfinder.cpp
TESTDATA += data
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc
new file mode 100644
index 0000000000..0cc4ccaa57
--- /dev/null
+++ b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/GraphemeBreakTest.txt</file>
+ <file>data/LineBreakTest.txt</file>
+ <file>data/SentenceBreakTest.txt</file>
+ <file>data/WordBreakTest.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index f97b8a4df8..0f7c42c122 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -109,14 +109,35 @@ void tst_QVersionNumber::singleInstanceData()
QTest::newRow("0.1.2alpha") << (QVector<int>() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2alpha") << 5 << false;
QTest::newRow("0.1.2-alpha") << (QVector<int>() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2-alpha") << 5 << false;
QTest::newRow("0.1.2.alpha") << (QVector<int>() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2.alpha") << 5 << false;
+ QTest::newRow("0.1.2.3alpha") << (QVector<int>() << 0 << 1 << 2 << 3) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3alpha") << 7 << false;
+ QTest::newRow("0.1.2.3.alpha") << (QVector<int>() << 0 << 1 << 2 << 3) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3.alpha") << 7 << false;
QTest::newRow("0.1.2.3.4.alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4.alpha") << 9 << false;
QTest::newRow("0.1.2.3.4 alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alpha") << 9 << false;
QTest::newRow("0.1.2.3.4 alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alp ha") << 9 << false;
QTest::newRow("0.1.2.3.4alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alp ha") << 9 << false;
QTest::newRow("0.1.2.3.4alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alpha ") << 9 << false;
+ QTest::newRow("0.1.2.3.4.5alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5) << QStringLiteral("0.1.2.3.4.5") << QStringLiteral("0.1.2.3.4.5alpha ") << 11 << false;
+ QTest::newRow("0.1.2.3.4.5.6alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QStringLiteral("0.1.2.3.4.5.6") << QStringLiteral("0.1.2.3.4.5.6alpha ") << 13 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QStringLiteral("0.1.2.3.4.5.6.7") << QStringLiteral("0.1.2.3.4.5.6.7alpha ") << 15 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alpha ") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8.alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8.alpha") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8 alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alpha") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8 alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alp ha") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alp ha") << 17 << false;
QTest::newRow("10.09") << (QVector<int>() << 10 << 9) << QVersionNumber(QVector<int>() << 10 << 9) << QStringLiteral("10.9") << QStringLiteral("10.09") << 5 << false;
QTest::newRow("10.0x") << (QVector<int>() << 10 << 0) << QVersionNumber(QVector<int>() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0x") << 4 << false;
QTest::newRow("10.0xTest") << (QVector<int>() << 10 << 0) << QVersionNumber(QVector<int>() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0xTest") << 4 << false;
+ QTest::newRow("127.09") << (QVector<int>() << 127 << 9) << QVersionNumber(QVector<int>() << 127 << 9) << QStringLiteral("127.9") << QStringLiteral("127.09") << 6 << false;
+ QTest::newRow("127.0x") << (QVector<int>() << 127 << 0) << QVersionNumber(QVector<int>() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0x") << 5 << false;
+ QTest::newRow("127.0xTest") << (QVector<int>() << 127 << 0) << QVersionNumber(QVector<int>() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0xTest") << 5 << false;
+ QTest::newRow("128.09") << (QVector<int>() << 128 << 9) << QVersionNumber(QVector<int>() << 128 << 9) << QStringLiteral("128.9") << QStringLiteral("128.09") << 6 << false;
+ QTest::newRow("128.0x") << (QVector<int>() << 128 << 0) << QVersionNumber(QVector<int>() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0x") << 5 << false;
+ QTest::newRow("128.0xTest") << (QVector<int>() << 128 << 0) << QVersionNumber(QVector<int>() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0xTest") << 5 << false;
+}
+
+namespace UglyOperator {
+// ugh, but the alternative (operator <<) is even worse...
+static inline QVector<int> operator+(QVector<int> v, int i) { v.push_back(i); return qMove(v); }
}
void tst_QVersionNumber::comparisonData()
@@ -141,6 +162,7 @@ void tst_QVersionNumber::comparisonData()
QTest::newRow("1.0, 1.0") << QVersionNumber(1, 0) << QVersionNumber(1, 0) << true << false << false << true << false << true << 0 << true << QVersionNumber(1, 0);
QTest::newRow("1, 1.0") << QVersionNumber(1) << QVersionNumber(1, 0) << false << true << true << true << false << false << -1 << true << QVersionNumber(1);
QTest::newRow("1.0, 1") << QVersionNumber(1, 0) << QVersionNumber(1) << false << true << false << false << true << true << 1 << false << QVersionNumber(1);
+
QTest::newRow("0.1.2, 0.1") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 1);
QTest::newRow("0.1, 0.1.2") << QVersionNumber(0, 1) << QVersionNumber(0, 1, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 1);
QTest::newRow("0.1.2, 0.1.2") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 1, 2);
@@ -152,6 +174,44 @@ void tst_QVersionNumber::comparisonData()
QTest::newRow("0.-1, 0.1") << QVersionNumber(0, -1) << QVersionNumber(0, 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(0);
QTest::newRow("0.-1, 0") << QVersionNumber(0, -1) << QVersionNumber(0) << false << true << true << true << false << false << -1 << false << QVersionNumber(0);
QTest::newRow("0, 0.-1") << QVersionNumber(0) << QVersionNumber(0, -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(0);
+
+ QTest::newRow("0.127.2, 0.127") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 127);
+ QTest::newRow("0.127, 0.127.2") << QVersionNumber(0, 127) << QVersionNumber(0, 127, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 127);
+ QTest::newRow("0.127.2, 0.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 127, 2);
+ QTest::newRow("0.127.2, 127.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(127, 127, 2) << false << true << true << true << false << false << -127 << false << QVersionNumber();
+ QTest::newRow("127.127.2, 0.127.2") << QVersionNumber(127, 127, 2) << QVersionNumber(0, 127, 2) << false << true << false << false << true << true << 127 << false << QVersionNumber();
+ QTest::newRow("127, -128") << QVersionNumber(127) << QVersionNumber(-128) << false << true << false << false << true << true << 255 << false << QVersionNumber();
+ QTest::newRow("-128, 127") << QVersionNumber(-128) << QVersionNumber(127) << false << true << true << true << false << false << -255 << false << QVersionNumber();
+ QTest::newRow("0.127, 0.-128") << QVersionNumber(0, 127) << QVersionNumber(0, -128) << false << true << false << false << true << true << 255 << false << QVersionNumber(0);
+ QTest::newRow("0.-128, 0.127") << QVersionNumber(0, -128) << QVersionNumber(0, 127) << false << true << true << true << false << false << -255 << false << QVersionNumber(0);
+ QTest::newRow("0.-128, 0") << QVersionNumber(0, -128) << QVersionNumber(0) << false << true << true << true << false << false << -128 << false << QVersionNumber(0);
+ QTest::newRow("0, 0.-128") << QVersionNumber(0) << QVersionNumber(0, -128) << false << true << false << false << true << true << 128 << true << QVersionNumber(0);
+
+ QTest::newRow("0.128.2, 0.128") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 128);
+ QTest::newRow("0.128, 0.128.2") << QVersionNumber(0, 128) << QVersionNumber(0, 128, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 128);
+ QTest::newRow("0.128.2, 0.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 128, 2);
+ QTest::newRow("0.128.2, 128.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(128, 128, 2) << false << true << true << true << false << false << -128 << false << QVersionNumber();
+ QTest::newRow("128.128.2, 0.128.2") << QVersionNumber(128, 128, 2) << QVersionNumber(0, 128, 2) << false << true << false << false << true << true << 128 << false << QVersionNumber();
+ QTest::newRow("128, -129") << QVersionNumber(128) << QVersionNumber(-129) << false << true << false << false << true << true << 257 << false << QVersionNumber();
+ QTest::newRow("-129, 128") << QVersionNumber(-129) << QVersionNumber(128) << false << true << true << true << false << false << -257 << false << QVersionNumber();
+ QTest::newRow("0.128, 0.-129") << QVersionNumber(0, 128) << QVersionNumber(0, -129) << false << true << false << false << true << true << 257 << false << QVersionNumber(0);
+ QTest::newRow("0.-129, 0.128") << QVersionNumber(0, -129) << QVersionNumber(0, 128) << false << true << true << true << false << false << -257 << false << QVersionNumber(0);
+ QTest::newRow("0.-129, 0") << QVersionNumber(0, -129) << QVersionNumber(0) << false << true << true << true << false << false << -129 << false << QVersionNumber(0);
+ QTest::newRow("0, 0.-129") << QVersionNumber(0) << QVersionNumber(0, -129) << false << true << false << false << true << true << 129 << true << QVersionNumber(0);
+
+ const QVector<int> common = QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6;
+ using namespace UglyOperator;
+ QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0 + 1);
+ QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + 1 + 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(common + 0 + 1);
+ QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(common + 0 + 1 + 2);
+ QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.1.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 1 + 1 + 2) << false << true << true << true << false << false << -1 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.1.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 1 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << false << true << false << false << true << true << 1 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.1, 0.1.2.3.4.5.6.-1") << QVersionNumber(common + 1) << QVersionNumber(common + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.-1, 0.1.2.3.4.5.6.1") << QVersionNumber(common + -1) << QVersionNumber(common + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0);
+ QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0 + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common + 0);
+ QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0) << false << true << true << true << false << false << -1 << false << QVersionNumber(common + 0);
+ QTest::newRow("0.1.2.3.4.5.6.0, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(common + 0);
}
void tst_QVersionNumber::initTestCase()
diff --git a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
index c680d93dab..2f39857d2d 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
@@ -72,9 +72,17 @@ public slots:
return QDBusServer::address();
}
- bool isConnected() const
+ void waitForConnected()
{
- return m_conn.isConnected();
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ sendErrorReply(QDBusError::NotSupported, "One call already pending!");
+ return;
+ }
+ if (m_conn.isConnected())
+ return;
+ // not connected, we'll reply later
+ setDelayedReply(true);
+ callPendingReply = message();
}
Q_NOREPLY void requestSync(const QString &seq)
@@ -133,6 +141,11 @@ public slots:
valueSpy.clear();
}
+ void quit()
+ {
+ qApp->quit();
+ }
+
signals:
Q_SCRIPTABLE void syncReceived(const QString &sequence);
@@ -141,10 +154,16 @@ private slots:
{
m_conn = con;
con.registerObject(objectPath, this, QDBusConnection::ExportScriptableSignals);
+
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ QDBusConnection::sessionBus().send(callPendingReply.createReply());
+ callPendingReply = QDBusMessage();
+ }
}
private:
QDBusConnection m_conn;
+ QDBusMessage callPendingReply;
MyObject* obj;
};
diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index 971c939aad..b7ecdef16e 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -496,6 +496,7 @@ void tst_QDBusAbstractAdaptor::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qmyserver/qmyserver" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -513,16 +514,17 @@ void tst_QDBusAbstractAdaptor::initTestCase()
QDBusConnection peercon = QDBusConnection::connectToPeer(address, "peer");
QVERIFY(peercon.isConnected());
- QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected");
+ QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected");
QDBusMessage rpl2 = QDBusConnection::sessionBus().call(req2);
- QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage);
- QVERIFY(rpl2.arguments().at(0).toBool());
+ QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1());
}
void tst_QDBusAbstractAdaptor::cleanupTestCase()
{
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
+ proc.waitForFinished(200);
proc.close();
- proc.kill();
}
void tst_QDBusAbstractAdaptor::methodCalls_data()
diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
index 49462d388c..e681d06102 100644
--- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
+++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
@@ -59,9 +59,17 @@ public slots:
return QDBusServer::address();
}
- bool isConnected() const
+ void waitForConnected()
{
- return m_conn.isConnected();
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ sendErrorReply(QDBusError::NotSupported, "One call already pending!");
+ return;
+ }
+ if (m_conn.isConnected())
+ return;
+ // not connected, we'll reply later
+ setDelayedReply(true);
+ callPendingReply = message();
}
void reset()
@@ -87,16 +95,26 @@ public slots:
emit targetObj.complexSignal(reg);
}
+ void quit()
+ {
+ qApp->quit();
+ }
+
private slots:
void handleConnection(const QDBusConnection& con)
{
m_conn = con;
m_conn.registerObject("/", &targetObj, QDBusConnection::ExportScriptableContents);
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ QDBusConnection::sessionBus().send(callPendingReply.createReply());
+ callPendingReply = QDBusMessage();
+ }
}
private:
Interface targetObj;
QDBusConnection m_conn;
+ QDBusMessage callPendingReply;
};
int main(int argc, char *argv[])
diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
index 0cb29d121b..0b33f9b1cf 100644
--- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
+++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
@@ -236,6 +236,7 @@ void tst_QDBusAbstractInterface::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qpinger/qpinger" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -252,19 +253,10 @@ void tst_QDBusAbstractInterface::initTestCase()
void tst_QDBusAbstractInterface::cleanupTestCase()
{
- // Kill peer, resetting the object exported by a separate process
-#ifdef Q_OS_WIN
- proc.kill(); // non-GUI processes don't respond to QProcess::terminate()
-#else
- proc.terminate();
-#endif
- QVERIFY(proc.waitForFinished() || proc.state() == QProcess::NotRunning);
-
- // Wait until the service is certainly not registered
- QDBusConnection con = QDBusConnection::sessionBus();
- if (con.isConnected()) {
- QTRY_VERIFY(!con.interface()->isServiceRegistered(serviceName));
- }
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
+ proc.waitForFinished(200);
+ proc.close();
}
void tst_QDBusAbstractInterface::init()
@@ -276,10 +268,9 @@ void tst_QDBusAbstractInterface::init()
QDBusConnection peercon = QDBusConnection::connectToPeer(peerAddress, "peer");
QVERIFY(peercon.isConnected());
- QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected");
+ QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected");
QDBusMessage rpl2 = con.call(req2);
- QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage);
- QVERIFY(rpl2.arguments().at(0).toBool());
+ QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1());
}
void tst_QDBusAbstractInterface::cleanup()
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index 7e6e742e28..70794a52f5 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -246,7 +246,7 @@ void tst_QDBusConnection::connectToBus()
QDBusConnection con2("foo");
QVERIFY(!con2.isConnected());
- QVERIFY(!con2.lastError().isValid());
+ QVERIFY(con2.lastError().isValid());
con2 = con;
QVERIFY(con.isConnected());
@@ -274,7 +274,7 @@ void tst_QDBusConnection::connectToBus()
{
QDBusConnection con("bubu");
QVERIFY(!con.isConnected());
- QVERIFY(!con.lastError().isValid());
+ QVERIFY(con.lastError().isValid());
}
QByteArray address = qgetenv("DBUS_SESSION_BUS_ADDRESS");
@@ -294,6 +294,7 @@ void tst_QDBusConnection::connectToPeer()
"", "newconn");
QVERIFY(!con.isConnected());
QVERIFY(con.lastError().isValid());
+ QDBusConnection::disconnectFromPeer("newconn");
}
QDBusServer server;
@@ -303,6 +304,7 @@ void tst_QDBusConnection::connectToPeer()
"unix:abstract=/tmp/dbus-XXXXXXXXXX,guid=00000000000000000000000000000000", "newconn2");
QVERIFY(!con.isConnected());
QVERIFY(con.lastError().isValid());
+ QDBusConnection::disconnectFromPeer("newconn2");
}
{
@@ -314,7 +316,7 @@ void tst_QDBusConnection::connectToPeer()
QDBusConnection con2("foo");
QVERIFY(!con2.isConnected());
- QVERIFY(!con2.lastError().isValid());
+ QVERIFY(con2.lastError().isValid());
con2 = con;
QVERIFY(con.isConnected());
@@ -342,7 +344,7 @@ void tst_QDBusConnection::connectToPeer()
{
QDBusConnection con("bubu");
QVERIFY(!con.isConnected());
- QVERIFY(!con.lastError().isValid());
+ QVERIFY(con.lastError().isValid());
}
}
diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
index 7a22fe90ad..8da9068541 100644
--- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
+++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
@@ -63,9 +63,17 @@ public slots:
return QDBusServer::address();
}
- bool isConnected() const
+ void waitForConnected()
{
- return m_conn.isConnected();
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ sendErrorReply(QDBusError::NotSupported, "One call already pending!");
+ return;
+ }
+ if (m_conn.isConnected())
+ return;
+ // not connected, we'll reply later
+ setDelayedReply(true);
+ callPendingReply = message();
}
void emitSignal(const QString &interface, const QString &name, const QString &arg)
@@ -88,7 +96,6 @@ public slots:
QVariantList callArgs()
{
- qDebug() << "callArgs" << MyObject::callArgs.count();
return MyObject::callArgs;
}
@@ -112,6 +119,10 @@ public slots:
return obj.m_complexProp;
}
+ void quit()
+ {
+ qApp->quit();
+ }
private slots:
void handleConnection(const QDBusConnection& con)
@@ -120,10 +131,15 @@ private slots:
m_conn.registerObject("/", &obj, QDBusConnection::ExportAllProperties
| QDBusConnection::ExportAllSlots
| QDBusConnection::ExportAllInvokables);
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ QDBusConnection::sessionBus().send(callPendingReply.createReply());
+ callPendingReply = QDBusMessage();
+ }
}
private:
QDBusConnection m_conn;
+ QDBusMessage callPendingReply;
MyObject obj;
};
diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
index 04992c9f28..fce5868980 100644
--- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
@@ -271,6 +271,7 @@ void tst_QDBusInterface::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qmyserver/qmyserver" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -289,16 +290,18 @@ void tst_QDBusInterface::initTestCase()
QDBusConnection peercon = QDBusConnection::connectToPeer(address, "peer");
QVERIFY(peercon.isConnected());
- QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected");
+ QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected");
QDBusMessage rpl2 = con.call(req2);
QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage);
- QVERIFY(rpl2.arguments().at(0).toBool());
+ QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1());
}
void tst_QDBusInterface::cleanupTestCase()
{
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
+ proc.waitForFinished(200);
proc.close();
- proc.kill();
}
void tst_QDBusInterface::notConnected()
diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h
index 76fe0e4bfb..323b54a137 100644
--- a/tests/auto/dbus/qdbusmarshall/common.h
+++ b/tests/auto/dbus/qdbusmarshall/common.h
@@ -30,7 +30,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <math.h> // isnan
+#include <qmath.h> // qIsNan
#include <qvariant.h>
#ifdef Q_OS_UNIX
@@ -320,7 +320,7 @@ bool compare(const QVariant &v1, const QVariant &v2);
bool compare(double d1, double d2)
{
- if (isnan(d1) && isnan(d2))
+ if (qIsNaN(d1) && qIsNaN(d2))
return true;
return d1 == d2;
}
diff --git a/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp
index bb8aab3d21..11cd4f05ce 100644
--- a/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp
+++ b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp
@@ -49,6 +49,11 @@ public slots:
if (!QDBusConnection::sessionBus().send(msg.createReply(msg.arguments())))
exit(1);
}
+
+ void quit()
+ {
+ qApp->quit();
+ }
};
int main(int argc, char *argv[])
diff --git a/tests/auto/dbus/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro
index 658cc52fde..4999080453 100644
--- a/tests/auto/dbus/qdbusmarshall/test/test.pro
+++ b/tests/auto/dbus/qdbusmarshall/test/test.pro
@@ -5,8 +5,13 @@ DESTDIR = ./
QT = core-private dbus-private testlib
-LIBS += $$QT_LIBS_DBUS
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+contains(QT_CONFIG, dbus-linked) {
+ DEFINES += QT_LINKED_LIBDBUS
+ LIBS += $$QT_LIBS_DBUS
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+} else {
+ SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp
+}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
index 4d12522a68..6507b34c97 100644
--- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
+++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
@@ -37,7 +37,8 @@
#include "common.h"
#include <limits>
-#include <dbus/dbus.h>
+#include <QtDBus/private/qdbusutil_p.h>
+#include <QtDBus/private/qdbusconnection_p.h>
#define QT_LINKED_LIBDBUS
#include <QtDBus/private/qdbusutil_p.h>
@@ -136,6 +137,7 @@ void tst_QDBusMarshall::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qpong/qpong" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -143,9 +145,10 @@ void tst_QDBusMarshall::initTestCase()
void tst_QDBusMarshall::cleanupTestCase()
{
- proc.close();
- proc.terminate();
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
proc.waitForFinished(200);
+ proc.close();
}
int tst_QDBusMarshall::fileDescriptorForTest()
@@ -1031,23 +1034,31 @@ struct DisconnectRawDBus {
{
if (!connection)
return;
- dbus_connection_close(connection);
- dbus_connection_unref(connection);
+ q_dbus_connection_close(connection);
+ q_dbus_connection_unref(connection);
+ }
+};
+struct UnrefDBusMessage
+{
+ static void cleanup(DBusMessage *type)
+ {
+ if (!type) return;
+ q_dbus_message_unref(type);
}
};
-template <typename T, void (*unref)(T *)> struct GenericUnref
+struct UnrefDBusPendingCall
{
- static void cleanup(T *type)
+ static void cleanup(DBusPendingCall *type)
{
if (!type) return;
- unref(type);
+ q_dbus_pending_call_unref(type);
}
};
// use these scoped types to avoid memory leaks if QVERIFY or QCOMPARE fails
typedef QScopedPointer<DBusConnection, DisconnectRawDBus> ScopedDBusConnection;
-typedef QScopedPointer<DBusMessage, GenericUnref<DBusMessage, dbus_message_unref> > ScopedDBusMessage;
-typedef QScopedPointer<DBusPendingCall, GenericUnref<DBusPendingCall, dbus_pending_call_unref> > ScopedDBusPendingCall;
+typedef QScopedPointer<DBusMessage, UnrefDBusMessage> ScopedDBusMessage;
+typedef QScopedPointer<DBusPendingCall, UnrefDBusPendingCall> ScopedDBusPendingCall;
template <typename T> struct SetResetValue
{
@@ -1072,12 +1083,12 @@ void tst_QDBusMarshall::receiveUnknownType()
// this needs to be implemented in raw
// open a new connection to the bus daemon
DBusError error;
- dbus_error_init(&error);
- ScopedDBusConnection rawcon(dbus_bus_get_private(DBUS_BUS_SESSION, &error));
+ q_dbus_error_init(&error);
+ ScopedDBusConnection rawcon(q_dbus_bus_get_private(DBUS_BUS_SESSION, &error));
QVERIFY2(rawcon.data(), error.name);
// check if this bus supports passing file descriptors
- if (!dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD))
+ if (!q_dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD))
QSKIP("Your session bus does not allow sending Unix file descriptors");
// make sure this QDBusConnection won't handle Unix file descriptors
@@ -1088,18 +1099,20 @@ void tst_QDBusMarshall::receiveUnknownType()
// create a call back to us containing a file descriptor
QDBusMessageSpy spy;
con.registerObject("/spyObject", &spy, QDBusConnection::ExportAllSlots);
- ScopedDBusMessage msg(dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot"));
+ ScopedDBusMessage msg(q_dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot"));
int fd = fileno(stdout);
- dbus_message_append_args(msg.data(), DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID);
+ DBusMessageIter iter;
+ q_dbus_message_iter_init_append(msg.data(), &iter);
+ q_dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
// try to send to us
DBusPendingCall *pending_ptr;
- dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000);
+ q_dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000);
ScopedDBusPendingCall pending(pending_ptr);
// check that it got sent
- while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
+ while (q_dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
;
// now spin our event loop. We don't catch this call, so let's get the reply
@@ -1108,7 +1121,7 @@ void tst_QDBusMarshall::receiveUnknownType()
loop.exec();
// now try to receive the reply
- dbus_pending_call_block(pending.data());
+ q_dbus_pending_call_block(pending.data());
// check that the spy received what it was supposed to receive
QCOMPARE(spy.list.size(), 1);
@@ -1116,48 +1129,49 @@ void tst_QDBusMarshall::receiveUnknownType()
QFETCH(int, receivedTypeId);
QCOMPARE(spy.list.at(0).arguments().at(0).userType(), receivedTypeId);
- msg.reset(dbus_pending_call_steal_reply(pending.data()));
+ msg.reset(q_dbus_pending_call_steal_reply(pending.data()));
QVERIFY(msg);
- QCOMPARE(dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN);
- QCOMPARE(dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING);
+ QCOMPARE(q_dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN);
+ QCOMPARE(q_dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING);
int retval;
- QVERIFY(dbus_message_get_args(msg.data(), &error, DBUS_TYPE_INT32, &retval, DBUS_TYPE_INVALID));
+ QVERIFY(q_dbus_message_iter_init(msg.data(), &iter));
+ q_dbus_message_iter_get_basic(&iter, &retval);
QCOMPARE(retval, 42);
} else {
// create a signal that we'll emit
static const char signalName[] = "signalName";
static const char interfaceName[] = "local.interface.name";
- ScopedDBusMessage msg(dbus_message_new_signal("/", interfaceName, signalName));
- con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop()));
+ ScopedDBusMessage msg(q_dbus_message_new_signal("/", interfaceName, signalName));
+ con.connect(q_dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop()));
QDBusMessageSpy spy;
- con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage)));
+ con.connect(q_dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage)));
DBusMessageIter iter;
- dbus_message_iter_init_append(msg.data(), &iter);
+ q_dbus_message_iter_init_append(msg.data(), &iter);
int fd = fileno(stdout);
if (qstrcmp(QTest::currentDataTag(), "type-naked") == 0) {
// send naked
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
+ q_dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
} else {
DBusMessageIter subiter;
if (qstrcmp(QTest::currentDataTag(), "type-variant") == 0)
- dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
+ q_dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
else if (qstrcmp(QTest::currentDataTag(), "type-array") == 0)
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
+ q_dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
else if (qstrcmp(QTest::currentDataTag(), "type-struct") == 0)
- dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter);
- dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd);
- dbus_message_iter_close_container(&iter, &subiter);
+ q_dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter);
+ q_dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd);
+ q_dbus_message_iter_close_container(&iter, &subiter);
}
// send it
- dbus_connection_send(rawcon.data(), msg.data(), 0);
+ q_dbus_connection_send(rawcon.data(), msg.data(), 0);
// check that it got sent
- while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
+ while (q_dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
;
// now let's see what happens
diff --git a/tests/auto/dbus/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro
index 1e6335aa3b..21df33d2c7 100644
--- a/tests/auto/dbus/qdbustype/qdbustype.pro
+++ b/tests/auto/dbus/qdbustype/qdbustype.pro
@@ -2,6 +2,11 @@ CONFIG += testcase
TARGET = tst_qdbustype
QT = core-private dbus-private testlib
SOURCES += tst_qdbustype.cpp
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
-LIBS_PRIVATE += $$QT_LIBS_DBUS
+contains(QT_CONFIG, dbus-linked) {
+ DEFINES += QT_LINKED_LIBDBUS
+ LIBS += $$QT_LIBS_DBUS
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+} else {
+ SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
+}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp
index 791a42dcc4..e674b6d686 100644
--- a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp
+++ b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp
@@ -35,8 +35,18 @@
#include <QtCore/QCoreApplication>
#include <QtDBus/private/qdbusutil_p.h>
-
-#include <dbus/dbus.h>
+#include <QtDBus/private/qdbus_symbols_p.h>
+
+DEFINEFUNC(dbus_bool_t, dbus_signature_validate, (const char *signature,
+ DBusError *error),
+ (signature, error), return)
+DEFINEFUNC(dbus_bool_t, dbus_signature_validate_single, (const char *signature,
+ DBusError *error),
+ (signature, error), return)
+DEFINEFUNC(dbus_bool_t, dbus_type_is_basic, (int typecode),
+ (typecode), return)
+DEFINEFUNC(dbus_bool_t, dbus_type_is_fixed, (int typecode),
+ (typecode), return)
class tst_QDBusType : public QObject
{
@@ -182,7 +192,7 @@ void tst_QDBusType::isValidFixedType()
int type = data.at(0).unicode();
if (isValid)
- QCOMPARE(bool(dbus_type_is_fixed(type)), result);
+ QCOMPARE(bool(q_dbus_type_is_fixed(type)), result);
QCOMPARE(QDBusUtil::isValidFixedType(type), result);
}
@@ -204,7 +214,7 @@ void tst_QDBusType::isValidBasicType()
int type = data.at(0).unicode();
if (isValid)
- QCOMPARE(bool(dbus_type_is_basic(type)), result);
+ QCOMPARE(bool(q_dbus_type_is_basic(type)), result);
QCOMPARE(QDBusUtil::isValidBasicType(type), result);
}
@@ -220,7 +230,7 @@ void tst_QDBusType::isValidSingleSignature()
QFETCH(QString, data);
QFETCH(bool, result);
- QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
}
@@ -236,11 +246,11 @@ void tst_QDBusType::isValidArray()
QFETCH(bool, result);
data.prepend("a");
- QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
data.prepend("a");
- QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
}
@@ -256,7 +266,7 @@ void tst_QDBusType::isValidSignature()
data.append(data);
if (data.at(0).unicode())
- QCOMPARE(bool(dbus_signature_validate(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSignature(data), result);
}
diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg
new file mode 100644
index 0000000000..0aa164b78b
--- /dev/null
+++ b/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg
Binary files differ
diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro
index 117e34653d..42280d3bd4 100644
--- a/tests/auto/gui/image/qimage/qimage.pro
+++ b/tests/auto/gui/image/qimage/qimage.pro
@@ -6,4 +6,6 @@ SOURCES += tst_qimage.cpp
QT += core-private gui-private testlib
contains(QT_CONFIG, c++11): CONFIG += c++11
+android:!android-no-sdk:RESOURCES+=qimage.qrc
+
TESTDATA += images/*
diff --git a/tests/auto/gui/image/qimage/qimage.qrc b/tests/auto/gui/image/qimage/qimage.qrc
new file mode 100644
index 0000000000..e5de27faf8
--- /dev/null
+++ b/tests/auto/gui/image/qimage/qimage.qrc
@@ -0,0 +1,22 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/image.bmp</file>
+ <file>images/image.gif</file>
+ <file>images/image.ico</file>
+ <file>images/image.jpg</file>
+ <file>images/image.pbm</file>
+ <file>images/image.pgm</file>
+ <file>images/image.png</file>
+ <file>images/image.ppm</file>
+ <file>images/image.xbm</file>
+ <file>images/image.xpm</file>
+ <file>images/jpeg_exif_orientation_value_1.jpg</file>
+ <file>images/jpeg_exif_orientation_value_2.jpg</file>
+ <file>images/jpeg_exif_orientation_value_3.jpg</file>
+ <file>images/jpeg_exif_orientation_value_4.jpg</file>
+ <file>images/jpeg_exif_orientation_value_5.jpg</file>
+ <file>images/jpeg_exif_orientation_value_6.jpg</file>
+ <file>images/jpeg_exif_orientation_value_7.jpg</file>
+ <file>images/jpeg_exif_orientation_value_8.jpg</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 676f8084a1..c61f5f38ca 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -173,6 +173,7 @@ private slots:
void invertPixelsRGB_data();
void invertPixelsRGB();
+ void exifOrientation_data();
void exifOrientation();
void cleanupFunctions();
@@ -2641,20 +2642,34 @@ void tst_QImage::invertPixelsRGB()
QCOMPARE(qBlue(pixel) >> 4, (255 - 96) >> 4);
}
+void tst_QImage::exifOrientation_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow("Orientation 1, Intel format") << m_prefix + "jpeg_exif_orientation_value_1.jpg";
+ QTest::newRow("Orientation 2, Intel format") << m_prefix + "jpeg_exif_orientation_value_2.jpg";
+ QTest::newRow("Orientation 3, Intel format") << m_prefix + "jpeg_exif_orientation_value_3.jpg";
+ QTest::newRow("Orientation 4, Intel format") << m_prefix + "jpeg_exif_orientation_value_4.jpg";
+ QTest::newRow("Orientation 5, Intel format") << m_prefix + "jpeg_exif_orientation_value_5.jpg";
+ QTest::newRow("Orientation 6, Intel format") << m_prefix + "jpeg_exif_orientation_value_6.jpg";
+ QTest::newRow("Orientation 6, Motorola format") << m_prefix + "jpeg_exif_orientation_value_6_motorola.jpg";
+ QTest::newRow("Orientation 7, Intel format") << m_prefix + "jpeg_exif_orientation_value_7.jpg";
+ QTest::newRow("Orientation 8, Intel format") << m_prefix + "jpeg_exif_orientation_value_8.jpg";
+}
+
void tst_QImage::exifOrientation()
{
- for (unsigned int i = 1; i <= 8; ++i) {
- QImage img;
- QRgb px;
+ QFETCH(QString, fileName);
- QVERIFY(img.load(m_prefix + QString::fromLatin1("jpeg_exif_orientation_value_%1.jpg").arg(i)));
+ QImage img;
+ QRgb px;
- px = img.pixel(0, 0);
- QVERIFY(qRed(px) > 250 && qGreen(px) < 5 && qBlue(px) < 5);
+ QVERIFY(img.load(fileName));
- px = img.pixel(img.width() - 1, 0);
- QVERIFY(qRed(px) < 5 && qGreen(px) < 5 && qBlue(px) > 250);
- }
+ px = img.pixel(0, 0);
+ QVERIFY(qRed(px) > 250 && qGreen(px) < 5 && qBlue(px) < 5);
+
+ px = img.pixel(img.width() - 1, 0);
+ QVERIFY(qRed(px) < 5 && qGreen(px) < 5 && qBlue(px) > 250);
}
static void cleanupFunction(void* info)
diff --git a/tests/auto/gui/image/qimagereader/android_testdata.qrc b/tests/auto/gui/image/qimagereader/android_testdata.qrc
new file mode 100644
index 0000000000..bba32781fa
--- /dev/null
+++ b/tests/auto/gui/image/qimagereader/android_testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/trans.gif</file>
+ <file>images/kollada-noext</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro
index 7686643b3a..76fb4d8bfc 100644
--- a/tests/auto/gui/image/qimagereader/qimagereader.pro
+++ b/tests/auto/gui/image/qimagereader/qimagereader.pro
@@ -5,6 +5,10 @@ MOC_DIR=tmp
QT += core-private gui-private network testlib
RESOURCES += qimagereader.qrc
+android: !android-no-sdk {
+ RESOURCES += android_testdata.qrc
+}
+
win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300
diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro
index f77ff0659b..ce6707ec92 100644
--- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro
+++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro
@@ -5,5 +5,5 @@ SOURCES += tst_qimagewriter.cpp
MOC_DIR=tmp
win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
-
+android:!android-no-sdk:RESOURCES+= qimagewriter.qrc
TESTDATA += images/*
diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.qrc b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc
new file mode 100644
index 0000000000..29b036e303
--- /dev/null
+++ b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/beavis.jpg</file>
+ <file>images/colorful.bmp</file>
+ <file>images/earth.gif</file>
+ <file>images/font.bmp</file>
+ <file>images/gnus.xbm</file>
+ <file>images/kollada.png</file>
+ <file>images/marble.xpm</file>
+ <file>images/ship63.pbm</file>
+ <file>images/teapot.ppm</file>
+ <file>images/trolltech.gif</file>
+ <file>images/YCbCr_cmyk.jpg</file>
+ <file>images/YCbCr_rgb.jpg</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index 7e826310a1..f1045a8cf7 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -90,6 +90,7 @@ private slots:
void saveToTemporaryFile();
private:
QString prefix;
+ QString writePrefix;
};
// helper to skip an autotest when the given image format is not supported
@@ -114,6 +115,11 @@ void tst_QImageWriter::initTestCase()
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ writePrefix = QDir::homePath();
+#else
+ writePrefix = prefix;
+#endif
}
// Testing get/set functions
@@ -212,7 +218,7 @@ void tst_QImageWriter::writeImage()
QVERIFY2(!image.isNull(), qPrintable(reader.errorString()));
}
{
- QImageWriter writer(prefix + "gen-" + fileName, format);
+ QImageWriter writer(writePrefix + "gen-" + fileName, format);
QVERIFY(writer.write(image));
}
@@ -224,11 +230,11 @@ void tst_QImageWriter::writeImage()
#endif
if (!skip) {
// Shouldn't be able to write to read-only file
- QFile sourceFile(prefix + "gen-" + fileName);
+ QFile sourceFile(writePrefix + "gen-" + fileName);
QFile::Permissions permissions = sourceFile.permissions();
QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther));
- QImageWriter writer(prefix + "gen-" + fileName, format);
+ QImageWriter writer(writePrefix + "gen-" + fileName, format);
QVERIFY(!writer.write(image));
QVERIFY(sourceFile.setPermissions(permissions));
@@ -237,7 +243,7 @@ void tst_QImageWriter::writeImage()
QImage image2;
{
- QImageReader reader(prefix + "gen-" + fileName);
+ QImageReader reader(writePrefix + "gen-" + fileName);
image2 = reader.read();
QVERIFY(!image2.isNull());
}
@@ -456,7 +462,7 @@ void tst_QImageWriter::supportsOption()
<< QImageIOHandler::Animation
<< QImageIOHandler::BackgroundColor;
- QImageWriter writer(prefix + fileName);
+ QImageWriter writer(writePrefix + fileName);
for (int i = 0; i < options.size(); ++i) {
QVERIFY(writer.supportsOption(QImageIOHandler::ImageOption(options.at(i))));
allOptions.remove(QImageIOHandler::ImageOption(options.at(i)));
@@ -472,13 +478,13 @@ void tst_QImageWriter::saveWithNoFormat_data()
QTest::addColumn<QByteArray>("format");
QTest::addColumn<QImageWriter::ImageWriterError>("error");
- QTest::newRow("garble") << prefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError;
- QTest::newRow("bmp") << prefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0);
- QTest::newRow("xbm") << prefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0);
- QTest::newRow("xpm") << prefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0);
- QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0);
- QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0);
- QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("garble") << writePrefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError;
+ QTest::newRow("bmp") << writePrefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("xbm") << writePrefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("xpm") << writePrefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("png") << writePrefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("ppm") << writePrefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("pbm") << writePrefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0);
}
void tst_QImageWriter::saveWithNoFormat()
diff --git a/tests/auto/gui/image/qpixmap/qpixmap.qrc b/tests/auto/gui/image/qpixmap/qpixmap.qrc
index 99fde61a29..3965622dba 100644
--- a/tests/auto/gui/image/qpixmap/qpixmap.qrc
+++ b/tests/auto/gui/image/qpixmap/qpixmap.qrc
@@ -1,5 +1,27 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
+<RCC>
+ <qresource>
+ <file>loadFromData/designer_argb32.png</file>
+ <file>loadFromData/designer_indexed8_no_alpha_animated.gif</file>
+ <file>loadFromData/designer_indexed8_no_alpha.gif</file>
+ <file>loadFromData/designer_indexed8_no_alpha.png</file>
+ <file>loadFromData/designer_indexed8_with_alpha_animated.gif</file>
+ <file>loadFromData/designer_indexed8_with_alpha.gif</file>
+ <file>loadFromData/designer_indexed8_with_alpha.png</file>
+ <file>loadFromData/designer_rgb32.jpg</file>
+ <file>loadFromData/designer_rgb32.png</file>
+ <file>convertFromImage/task31722_1/img1.png</file>
+ <file>convertFromImage/task31722_1/img2.png</file>
+ <file>convertFromToHICON/icon_8bpp_16x16.png</file>
+ <file>convertFromToHICON/icon_8bpp_32x32.png</file>
+ <file>convertFromToHICON/icon_8bpp_48x48.png</file>
+ <file>convertFromToHICON/icon_8bpp.ico</file>
+ <file>convertFromToHICON/icon_32bpp_16x16.png</file>
+ <file>convertFromToHICON/icon_32bpp_32x32.png</file>
+ <file>convertFromToHICON/icon_32bpp_48x48.png</file>
+ <file>convertFromToHICON/icon_32bpp_256x256.png</file>
+ <file>convertFromToHICON/icon_32bpp.ico</file>
+ <file>convertFromImage/task31722_0/img1.png</file>
+ <file>convertFromImage/task31722_0/img2.png</file>
<file>images/designer.png</file>
<file>images/dx_0_dy_0_50_50_100_100.png</file>
<file>images/dx_0_dy_0_null.png</file>
@@ -25,5 +47,5 @@
<file>images/dx_-128_dy_-128_x_y_w_h.png</file>
<file>images/dx_128_dy_128_x_y_w_h.png</file>
<file>images/dx_1_dy_0_null.png</file>
-</qresource>
+ </qresource>
</RCC>
diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro
index 752f9be1f4..7e9d438e1b 100644
--- a/tests/auto/gui/painting/qpainter/qpainter.pro
+++ b/tests/auto/gui/painting/qpainter/qpainter.pro
@@ -10,3 +10,8 @@ SOURCES += tst_qpainter.cpp
TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \
task217400.png
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/gui/painting/qpainter/testdata.qrc b/tests/auto/gui/painting/qpainter/testdata.qrc
new file mode 100644
index 0000000000..a7b8c222e5
--- /dev/null
+++ b/tests/auto/gui/painting/qpainter/testdata.qrc
@@ -0,0 +1,186 @@
+<RCC>
+ <qresource prefix="/">
+ <file>task217400.png</file>
+ <file>drawEllipse/10x10SizeAt0x0.png</file>
+ <file>drawEllipse/10x10SizeAt100x100.png</file>
+ <file>drawEllipse/10x10SizeAt200x200.png</file>
+ <file>drawEllipse/13x100SizeAt0x0.png</file>
+ <file>drawEllipse/13x100SizeAt100x100.png</file>
+ <file>drawEllipse/13x100SizeAt200x200.png</file>
+ <file>drawEllipse/200x200SizeAt0x0.png</file>
+ <file>drawEllipse/200x200SizeAt100x100.png</file>
+ <file>drawEllipse/200x200SizeAt200x200.png</file>
+ <file>drawLine_rop_bitmap/dst.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_AndNotROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_AndROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_ClearROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_CopyROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NandROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NopROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NorROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotAndROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotCopyROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotOrROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotXorROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_OrNotROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_OrROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_SetROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_XorROP.xbm</file>
+ <file>drawPixmap_rop/dst1.png</file>
+ <file>drawPixmap_rop/dst2.png</file>
+ <file>drawPixmap_rop/dst3.png</file>
+ <file>drawPixmap_rop/src1.xbm</file>
+ <file>drawPixmap_rop/src2-mask.xbm</file>
+ <file>drawPixmap_rop/src2.xbm</file>
+ <file>drawPixmap_rop/src3.xbm</file>
+ <file>drawPixmap_rop/res/res_AndNotROP0.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP1.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP2.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP3.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP4.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP5.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP6.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP7.png</file>
+ <file>drawPixmap_rop/res/res_AndROP0.png</file>
+ <file>drawPixmap_rop/res/res_AndROP1.png</file>
+ <file>drawPixmap_rop/res/res_AndROP2.png</file>
+ <file>drawPixmap_rop/res/res_AndROP3.png</file>
+ <file>drawPixmap_rop/res/res_AndROP4.png</file>
+ <file>drawPixmap_rop/res/res_AndROP5.png</file>
+ <file>drawPixmap_rop/res/res_AndROP6.png</file>
+ <file>drawPixmap_rop/res/res_AndROP7.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP0.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP1.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP2.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP3.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP4.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP5.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP6.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP7.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP0.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP1.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP2.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP3.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP4.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP5.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP6.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP7.png</file>
+ <file>drawPixmap_rop/res/res_NandROP0.png</file>
+ <file>drawPixmap_rop/res/res_NandROP1.png</file>
+ <file>drawPixmap_rop/res/res_NandROP2.png</file>
+ <file>drawPixmap_rop/res/res_NandROP3.png</file>
+ <file>drawPixmap_rop/res/res_NandROP4.png</file>
+ <file>drawPixmap_rop/res/res_NandROP5.png</file>
+ <file>drawPixmap_rop/res/res_NandROP6.png</file>
+ <file>drawPixmap_rop/res/res_NandROP7.png</file>
+ <file>drawPixmap_rop/res/res_NopROP0.png</file>
+ <file>drawPixmap_rop/res/res_NopROP1.png</file>
+ <file>drawPixmap_rop/res/res_NopROP2.png</file>
+ <file>drawPixmap_rop/res/res_NopROP3.png</file>
+ <file>drawPixmap_rop/res/res_NopROP4.png</file>
+ <file>drawPixmap_rop/res/res_NopROP5.png</file>
+ <file>drawPixmap_rop/res/res_NopROP6.png</file>
+ <file>drawPixmap_rop/res/res_NopROP7.png</file>
+ <file>drawPixmap_rop/res/res_NorROP0.png</file>
+ <file>drawPixmap_rop/res/res_NorROP1.png</file>
+ <file>drawPixmap_rop/res/res_NorROP2.png</file>
+ <file>drawPixmap_rop/res/res_NorROP3.png</file>
+ <file>drawPixmap_rop/res/res_NorROP4.png</file>
+ <file>drawPixmap_rop/res/res_NorROP5.png</file>
+ <file>drawPixmap_rop/res/res_NorROP6.png</file>
+ <file>drawPixmap_rop/res/res_NorROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP7.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP0.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP1.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP2.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP3.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP4.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP5.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP6.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP7.png</file>
+ <file>drawPixmap_rop/res/res_OrROP0.png</file>
+ <file>drawPixmap_rop/res/res_OrROP1.png</file>
+ <file>drawPixmap_rop/res/res_OrROP2.png</file>
+ <file>drawPixmap_rop/res/res_OrROP3.png</file>
+ <file>drawPixmap_rop/res/res_OrROP4.png</file>
+ <file>drawPixmap_rop/res/res_OrROP5.png</file>
+ <file>drawPixmap_rop/res/res_OrROP6.png</file>
+ <file>drawPixmap_rop/res/res_OrROP7.png</file>
+ <file>drawPixmap_rop/res/res_SetROP0.png</file>
+ <file>drawPixmap_rop/res/res_SetROP1.png</file>
+ <file>drawPixmap_rop/res/res_SetROP2.png</file>
+ <file>drawPixmap_rop/res/res_SetROP3.png</file>
+ <file>drawPixmap_rop/res/res_SetROP4.png</file>
+ <file>drawPixmap_rop/res/res_SetROP5.png</file>
+ <file>drawPixmap_rop/res/res_SetROP6.png</file>
+ <file>drawPixmap_rop/res/res_SetROP7.png</file>
+ <file>drawPixmap_rop/res/res_XorROP0.png</file>
+ <file>drawPixmap_rop/res/res_XorROP1.png</file>
+ <file>drawPixmap_rop/res/res_XorROP2.png</file>
+ <file>drawPixmap_rop/res/res_XorROP3.png</file>
+ <file>drawPixmap_rop/res/res_XorROP4.png</file>
+ <file>drawPixmap_rop/res/res_XorROP5.png</file>
+ <file>drawPixmap_rop/res/res_XorROP6.png</file>
+ <file>drawPixmap_rop/res/res_XorROP7.png</file>
+ <file>drawPixmap_rop_bitmap/dst.xbm</file>
+ <file>drawPixmap_rop_bitmap/src1-mask.xbm</file>
+ <file>drawPixmap_rop_bitmap/src1.xbm</file>
+ <file>drawPixmap_rop_bitmap/src2.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_AndNotROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_AndROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_ClearROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_CopyROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NandROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NopROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NorROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotAndROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotOrROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotXorROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_OrNotROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_OrROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_SetROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_XorROP.xbm</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 5072aa96c3..e23f7d41c5 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -289,7 +289,7 @@ private slots:
void blendARGBonRGB();
void RasterOp_NotDestination();
-
+ void drawTextNoHinting();
private:
void fillData();
void setPenColor(QPainter& p);
@@ -730,6 +730,7 @@ void tst_QPainter::initFrom()
pal.setColor(QPalette::Foreground, QColor(255, 0, 0));
pal.setBrush(QPalette::Background, QColor(0, 255, 0));
widget->setPalette(pal);
+ widget->show();
QFont font = widget->font();
font.setPointSize(26);
@@ -4813,6 +4814,21 @@ void tst_QPainter::RasterOp_NotDestination()
QCOMPARE(pixel, 0xff00ffff);
}
+void tst_QPainter::drawTextNoHinting()
+{
+ {
+ QImage image(250, 250, QImage::Format_RGB32);
+ QPainter p(&image);
+ QFont font("Arial", 8);
+ font.setHintingPreference(QFont::PreferNoHinting);
+ font.setStyleStrategy(QFont::PreferAntialias);
+ p.setFont(font);
+ p.drawText(image.rect(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz");
+ }
+ // Testing for a crash when DirectWrite is used on Windows
+ QVERIFY(true);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index df7de2b3b7..8cb32dabd1 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -307,24 +307,22 @@ void tst_QRawFont::advances()
bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions();
QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices);
- // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs
- // when full hinting is used (default on Windows).
- bool mayFail = false;
-#if defined (Q_OS_WIN)
- mayFail = font_d->fontEngine->type() == QFontEngine::Freetype
- && (hintingPreference == QFont::PreferFullHinting
- || hintingPreference == QFont::PreferDefaultHinting);
-#elif defined(Q_OS_QNX)
- mayFail = font_d->fontEngine->type() == QFontEngine::Freetype
- && hintingPreference == QFont::PreferFullHinting;
-#endif
+ bool mayDiffer = font_d->fontEngine->type() == QFontEngine::Freetype
+ && (hintingPreference == QFont::PreferFullHinting
+ || hintingPreference == QFont::PreferDefaultHinting);
for (int i = 0; i < glyphIndices.size(); ++i) {
- if (mayFail && (i == 0 || i == 5)) {
- QEXPECT_FAIL("", "FreeType engine reports unexpected advance "
- "for some glyphs (9 instead of 8)", Continue);
+ if ((i == 0 || i == 5) && mayDiffer) {
+ QVERIFY2(qRound(advances.at(i).x()) == 8
+ || qRound(advances.at(i).x()) == 9,
+ qPrintable(QStringLiteral("%1 != %2 && %1 != %3")
+ .arg(qRound(advances.at(i).x()))
+ .arg(8)
+ .arg(9)));
+ } else {
+ QCOMPARE(qRound(advances.at(i).x()), 8);
}
- QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
+
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
@@ -342,11 +340,17 @@ void tst_QRawFont::advances()
QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs));
for (int i = 0; i < glyphIndices.size(); ++i) {
- if (mayFail && (i == 0 || i == 5)) {
- QEXPECT_FAIL("", "FreeType engine reports unexpected advance "
- "for some glyphs (9 instead of 8)", Continue);
+ if ((i == 0 || i == 5) && mayDiffer) {
+ QVERIFY2(qRound(advances.at(i).x()) == 8
+ || qRound(advances.at(i).x()) == 9,
+ qPrintable(QStringLiteral("%1 != %2 && %1 != %3")
+ .arg(qRound(advances.at(i).x()))
+ .arg(8)
+ .arg(9)));
+ } else {
+ QCOMPARE(qRound(advances.at(i).x()), 8);
}
- QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
+
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 4b2970cd17..4fa8575153 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -1280,6 +1280,13 @@ void tst_QTextLayout::smallTextLengthWrapAtWordBoundaryOrAnywhere()
void tst_QTextLayout::testDefaultTabs()
{
QTextLayout layout("Foo\tBar\ta slightly longer text\tend.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
layout.beginLayout();
QTextLine line = layout.createLine();
@@ -1322,6 +1329,13 @@ void tst_QTextLayout::testDefaultTabs()
void tst_QTextLayout::testTabs()
{
QTextLayout layout("Foo\tBar.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
QTextOption option = layout.textOption();
option.setTabStop(150);
@@ -1339,6 +1353,13 @@ void tst_QTextLayout::testTabs()
void tst_QTextLayout::testMultilineTab()
{
QTextLayout layout("Lorem ipsum dolor sit\tBar.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
// test if this works on the second line.
layout.beginLayout();
@@ -1348,12 +1369,20 @@ void tst_QTextLayout::testMultilineTab()
line.setLineWidth(220.);
layout.endLayout();
+
QCOMPARE(line.cursorToX(22), 80.);
}
void tst_QTextLayout::testMultiTab()
{
QTextLayout layout("Foo\t\t\tBar.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
layout.beginLayout();
QTextLine line = layout.createLine();
@@ -1367,6 +1396,13 @@ void tst_QTextLayout::testTabsInAlignedParag()
{
QTextLayout layout("Foo\tsome more words", testFont);
layout.setCacheEnabled(true);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
QTextOption option = layout.textOption();
// right
option.setAlignment(Qt::AlignRight);
@@ -1426,6 +1462,12 @@ void tst_QTextLayout::testRightTab()
*/
layout.setCacheEnabled(true);
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
QTextOption option = layout.textOption();
QList<QTextOption::Tab> tabs;
QTextOption::Tab tab;
@@ -1463,6 +1505,13 @@ void tst_QTextLayout::testRightTab()
void tst_QTextLayout::testCenteredTab()
{
QTextLayout layout("Foo\tBar", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
// test if centering the tab works. We expect the center of 'Bar.' to be at the tab point.
QTextOption option = layout.textOption();
@@ -1484,6 +1533,13 @@ void tst_QTextLayout::testCenteredTab()
void tst_QTextLayout::testDelimiterTab()
{
QTextLayout layout("Foo\tBar. Barrabas", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
// try the different delimiter characters to see if the alignment works there.
QTextOption option = layout.textOption();
@@ -1537,6 +1593,12 @@ void tst_QTextLayout::tabsForRtl()
*/
layout.setCacheEnabled(true);
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
QTextOption option = layout.textOption();
QList<QTextOption::Tab> tabs;
QTextOption::Tab tab;
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index e06744b44e..e46189dd7d 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -116,6 +116,7 @@ public:
return false;
}
}
+ ::close(s);
#endif
return true;
}
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
index cc8dd2105f..e7f30f8940 100644
--- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
+++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
@@ -200,6 +200,12 @@ void tst_QDnsLookup::lookup()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
+
+#if defined(Q_OS_ANDROID)
+ if (lookup.errorString() == QStringLiteral("Not yet supported on Android"))
+ QEXPECT_FAIL("", "Not yet supported on Android", Abort);
+#endif
+
QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString()));
if (error == QDnsLookup::NoError)
QVERIFY(lookup.errorString().isEmpty());
@@ -295,6 +301,12 @@ void tst_QDnsLookup::lookupReuse()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
+
+#if defined(Q_OS_ANDROID)
+ if (lookup.errorString() == QStringLiteral("Not yet supported on Android"))
+ QEXPECT_FAIL("", "Not yet supported on Android", Abort);
+#endif
+
QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError));
QVERIFY(!lookup.hostAddressRecords().isEmpty());
QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single"));
@@ -333,6 +345,12 @@ void tst_QDnsLookup::lookupAbortRetry()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
+
+#if defined(Q_OS_ANDROID)
+ if (lookup.errorString() == QStringLiteral("Not yet supported on Android"))
+ QEXPECT_FAIL("", "Not yet supported on Android", Abort);
+#endif
+
QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError));
QVERIFY(!lookup.hostAddressRecords().isEmpty());
QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single"));
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 60ac54856c..db09ec4486 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1062,7 +1062,7 @@ void tst_QUdpSocket::multicastTtlOption_data()
QTest::addColumn<int>("expected");
QList<QHostAddress> addresses;
- addresses += QHostAddress(QHostAddress::Any);
+ addresses += QHostAddress(QHostAddress::AnyIPv4);
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
@@ -1103,7 +1103,7 @@ void tst_QUdpSocket::multicastLoopbackOption_data()
QTest::addColumn<int>("expected");
QList<QHostAddress> addresses;
- addresses += QHostAddress(QHostAddress::Any);
+ addresses += QHostAddress(QHostAddress::AnyIPv4);
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
@@ -1216,7 +1216,7 @@ void tst_QUdpSocket::setMulticastInterface()
// bind initializes the socket
bool bound = udpSocket.bind((address.protocol() == QAbstractSocket::IPv6Protocol
? QHostAddress(QHostAddress::AnyIPv6)
- : QHostAddress(QHostAddress::Any)),
+ : QHostAddress(QHostAddress::AnyIPv4)),
0);
if (!bound)
QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::setMulticastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState");
diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
index 8321f4fee1..a44afcbe8f 100644
--- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
+++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
@@ -45,6 +45,10 @@ private slots:
void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Not supported on Android");
+#endif
+
// based on testcase provided in QTBUG-39488
QByteArray msg = "Hello World";
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 78aa0af43d..62bd9828ba 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -526,7 +526,7 @@ void tst_QPrinter::testCustomPageSizes()
{
QPrinter p;
- QSizeF customSize(8.5, 11.0);
+ QSizeF customSize(7.0, 11.0);
p.setPaperSize(customSize, QPrinter::Inch);
QSizeF paperSize = p.paperSize(QPrinter::Inch);
@@ -538,6 +538,16 @@ void tst_QPrinter::testCustomPageSizes()
paperSize = p.paperSize(QPrinter::Inch);
QCOMPARE(paperSize.width(), customSize.width());
QCOMPARE(paperSize.height(), customSize.height());
+
+ const QSizeF sizeInPixels = p.paperSize(QPrinter::DevicePixel);
+ QPrinter p3;
+ p3.setPaperSize(sizeInPixels, QPrinter::DevicePixel);
+ paperSize = p3.paperSize(QPrinter::Inch);
+ QCOMPARE(paperSize.width(), customSize.width());
+ QCOMPARE(paperSize.height(), customSize.height());
+ QPageSize pageSize = p3.pageLayout().pageSize();
+ QCOMPARE(pageSize.key(), QString("Custom.504x792"));
+ QCOMPARE(pageSize.name(), QString("Custom (504pt x 792pt)"));
}
void tst_QPrinter::customPaperSizeAndMargins_data()
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
index af6dc6b9f4..8b080324d5 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -493,7 +493,7 @@ public:
{
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL)
- return QLatin1String("timestamp");
+ return QLatin1String("timestamptz");
if (dbType == QSqlDriver::Oracle && getOraVersion(db) >= 9)
return QLatin1String("timestamp(0)");
return QLatin1String("datetime");
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index f5d71a75cf..ecf3a9b050 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -147,6 +147,8 @@ private slots:
void invalidQuery();
void batchExec_data() { generic_data(); }
void batchExec();
+ void QTBUG_43874_data() { generic_data(); }
+ void QTBUG_43874();
void oraArrayBind_data() { generic_data(); }
void oraArrayBind();
void lastInsertId_data() { generic_data(); }
@@ -224,6 +226,9 @@ private slots:
void QTBUG_2192_data() { generic_data(); }
void QTBUG_2192();
+ void QTBUG_36211_data() { generic_data("QPSQL"); }
+ void QTBUG_36211();
+
void sqlite_constraint_data() { generic_data("QSQLITE"); }
void sqlite_constraint();
@@ -335,6 +340,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName("blobstest", __FILE__, db)
<< qTableName("oraRowId", __FILE__, db)
<< qTableName("qtest_batch", __FILE__, db)
+ << qTableName("bug43874", __FILE__, db)
<< qTableName("bug6421", __FILE__, db).toUpper()
<< qTableName("bug5765", __FILE__, db)
<< qTableName("bug6852", __FILE__, db)
@@ -2182,6 +2188,33 @@ void tst_QSqlQuery::batchExec()
QVERIFY( q.value( 3 ).isNull() );
}
+void tst_QSqlQuery::QTBUG_43874()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlQuery q(db);
+ const QString tableName = qTableName("bug43874", __FILE__, db);
+
+ QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INT)"));
+ QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)"));
+
+ for (int i = 0; i < 2; ++i) {
+ QVariantList ids;
+ ids << i;
+ q.addBindValue(ids);
+ QVERIFY_SQL(q, execBatch());
+ }
+ QVERIFY_SQL(q, exec("SELECT id FROM " + tableName + " ORDER BY id"));
+
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 0);
+
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 1);
+}
+
void tst_QSqlQuery::oraArrayBind()
{
QFETCH( QString, dbName );
@@ -3558,6 +3591,45 @@ void tst_QSqlQuery::QTBUG_2192()
}
}
+void tst_QSqlQuery::QTBUG_36211()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) {
+ const QString tableName(qTableName("bug36211", __FILE__, db));
+ tst_Databases::safeDropTable( db, tableName );
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dtwtz timestamptz, dtwotz timestamp)").arg(tableName)));
+
+ QTimeZone l_tzBrazil("BRT");
+ QTimeZone l_tzChina("CST");
+ QDateTime dt = QDateTime(QDate(2014, 10, 30), QTime(14, 12, 02, 357));
+ QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (dtwtz, dtwotz) VALUES (:dt, :dt)"));
+ q.bindValue(":dt", dt);
+ QVERIFY_SQL(q, exec());
+ q.bindValue(":dt", dt.toTimeZone(l_tzBrazil));
+ QVERIFY_SQL(q, exec());
+ q.bindValue(":dt", dt.toTimeZone(l_tzChina));
+ QVERIFY_SQL(q, exec());
+
+ QVERIFY_SQL(q, exec("SELECT dtwtz, dtwotz FROM " + tableName));
+
+ for (int i = 0; i < 3; ++i) {
+ QVERIFY_SQL(q, next());
+
+ for (int j = 0; j < 2; ++j) {
+ // Check if retrieved value preserves reported precision
+ int precision = qMax(0, q.record().field(j).precision());
+ int diff = qAbs(q.value(j).toDateTime().msecsTo(dt));
+ int keep = qMin(1000, (int)qPow(10.0, precision));
+ QVERIFY(diff <= 1000 - keep);
+ }
+ }
+ }
+}
+
void tst_QSqlQuery::oraOCINumber()
{
QFETCH( QString, dbName );
@@ -3822,21 +3894,25 @@ void tst_QSqlQuery::aggregateFunctionTypes()
QCOMPARE(q.value(0).toDouble(), 2.5);
QCOMPARE(q.record().field(0).type(), QVariant::Double);
- // PSQL does not have support for the round() function
- if (dbType != QSqlDriver::PostgreSQL) {
- QVERIFY_SQL(q, exec("SELECT ROUND(id, 1) FROM " + tableName + " WHERE id=1.5"));
- QVERIFY(q.next());
- QCOMPARE(q.value(0).toDouble(), 1.5);
- QCOMPARE(q.record().field(0).type(), QVariant::Double);
+ QString field = "id";
- QVERIFY_SQL(q, exec("SELECT ROUND(id, 0) FROM " + tableName + " WHERE id=2.5"));
- QVERIFY(q.next());
- if (dbType == QSqlDriver::MySqlServer)
- QCOMPARE(q.value(0).toDouble(), 2.0);
- else
- QCOMPARE(q.value(0).toDouble(), 3.0);
- QCOMPARE(q.record().field(0).type(), QVariant::Double);
+ // PSQL does not have the round() function with real type
+ if (dbType == QSqlDriver::PostgreSQL) {
+ field += "::NUMERIC";
}
+
+ QVERIFY_SQL(q, exec("SELECT ROUND(" + field + ", 1) FROM " + tableName + " WHERE id=1.5"));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 1.5);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT ROUND(" + field + ", 0) FROM " + tableName + " WHERE id=2.5"));
+ QVERIFY(q.next());
+ if (dbType == QSqlDriver::MySqlServer)
+ QCOMPARE(q.value(0).toDouble(), 2.0);
+ else
+ QCOMPARE(q.value(0).toDouble(), 3.0);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
}
{
const QString tableName(qTableName("stringFunctions", __FILE__, db));
diff --git a/tests/auto/test.pl b/tests/auto/test.pl
index 7c3708472c..48166e1c30 100755
--- a/tests/auto/test.pl
+++ b/tests/auto/test.pl
@@ -138,35 +138,22 @@ sub handleDir {
my ($dir) = @_;
my $currentDir = getcwd();
- chdir($dir) || die("Could not chdir to $dir");
- my @components;
- my $command;
- @components = split(/\//, $dir);
- my $component = $components[$#components];
-
- $command = "tst_".$component;
-
- if ( -e $command.$EXE_SUFFIX )
- {
- executeTestCurrentDir($command);
- } else {
- opendir(DIR, $dir);
- my @files = readdir(DIR);
- closedir DIR;
- my $file;
- foreach $file (@files)
- {
- #skip hidden files
- next if (substr($file,0,1) eq ".");
-
- if ( -d $dir."/".$file)
- {
- handleDir($dir."/".$file)
- }
-
+ opendir(DIR, $dir);
+ my @files = readdir(DIR);
+ closedir DIR;
+ my $file;
+ foreach $file (@files) {
+ #skip hidden files
+ next if (substr($file,0,1) eq ".");
+
+ if ( -d $dir."/".$file) {
+ handleDir($dir."/".$file)
+ } elsif ( $file =~ /^tst_/ and -x $dir."/".$file ) {
+ chdir($dir) || die("Could not chdir to $dir");
+ executeTestCurrentDir($file);
+ chdir($currentDir);
}
}
- chdir($currentDir);
}
sub executeTestCurrentDir {
diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
index d684f46f16..95bc72298e 100644
--- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
+++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
@@ -52,7 +52,7 @@ private slots:
void tst_DateTime::dateTime() const
{
const QDateTime utc(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::UTC);
- const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::LocalTime);
+ const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::OffsetFromUTC, 120 /* 2 minutes */);
QCOMPARE(local, utc);
}
diff --git a/tests/auto/testlib/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml
index 48ad0933f7..1aeac37e42 100644
--- a/tests/auto/testlib/selftests/expected_datetime.lightxml
+++ b/tests/auto/testlib/selftests/expected_datetime.lightxml
@@ -10,7 +10,7 @@
<TestFunction name="dateTime">
<Incident type="fail" file="tst_datetime.cpp" line="65">
<Description><![CDATA[Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.txt b/tests/auto/testlib/selftests/expected_datetime.txt
index 1139c70ab8..c29fa050a1 100644
--- a/tests/auto/testlib/selftests/expected_datetime.txt
+++ b/tests/auto/testlib/selftests/expected_datetime.txt
@@ -2,7 +2,7 @@
Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_DateTime::initTestCase()
FAIL! : tst_DateTime::dateTime() Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]
Loc: [tst_datetime.cpp(65)]
PASS : tst_DateTime::qurl(empty urls)
diff --git a/tests/auto/testlib/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml
index 30afde60ec..4c5bb0525b 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xml
+++ b/tests/auto/testlib/selftests/expected_datetime.xml
@@ -12,7 +12,7 @@
<TestFunction name="dateTime">
<Incident type="fail" file="tst_datetime.cpp" line="65">
<Description><![CDATA[Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml
index 901462b6bf..6fc95719f3 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xunitxml
+++ b/tests/auto/testlib/selftests/expected_datetime.xunitxml
@@ -8,7 +8,7 @@
<testcase result="pass" name="initTestCase"/>
<testcase result="fail" name="dateTime">
<failure message="Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]" result="fail"/>
</testcase>
<testcase result="fail" name="qurl">
diff --git a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp
index f6e4e3bdd9..c850da4629 100644
--- a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp
+++ b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp
@@ -34,7 +34,9 @@
#include <QtTest/QtTest>
#include <QtCore/QProcess>
#include <QtCore/QRegularExpression>
-#include <dbus/dbus.h>
+
+// We just need the DBUS_TYPE_* constants, so use our own copy
+#include "../../../../src/dbus/dbus_minimal_p.h"
class tst_qdbusxml2cpp : public QObject
{
diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
index 3ed8e1e88e..273be1d9c3 100644
--- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
+++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
@@ -113,6 +113,12 @@ void tst_QSidebar::addUrls()
QAbstractItemModel *model = qsidebar.model();
QDir testDir = QDir::home();
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ // temp and home is the same directory on Android
+ testDir.mkdir(QStringLiteral("test"));
+ QVERIFY(testDir.cd(QStringLiteral("test")));
+#endif
+
// default
QCOMPARE(model->rowCount(), 0);
diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
index 680286d1e4..79848ac22c 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
+++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
@@ -13,9 +13,13 @@ wince* {
DEPLOYMENT += addit tests sourceFile
}
-wince*: {
+android|wince*: {
DEFINES += SRCDIR=\\\"./\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc
new file mode 100644
index 0000000000..e0ef4203fe
--- /dev/null
+++ b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/android_testdata">
+ <file>dirtest/test1/dummy</file>
+ <file>dirtest/test1/test</file>
+ <file>test/file01.tst</file>
+ <file>test/file02.tst</file>
+ <file>test/file03.tst</file>
+ <file>test/file04.tst</file>
+ <file>tst_qdirmodel.cpp</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
index 4fee5fb1e5..56a8d1f1f4 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
@@ -42,6 +42,7 @@ class tst_QDirModel : public QObject
{
Q_OBJECT
public slots:
+ void initTestCase();
void cleanupTestCase();
void init();
private slots:
@@ -113,6 +114,29 @@ void tst_QDirModel::getSetCheck()
QCOMPARE(true, obj1.lazyChildCount());
}
+void tst_QDirModel::initTestCase()
+{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString dataPath = SRCDIR;
+ QString resourceSourcePath = QStringLiteral(":/android_testdata");
+ QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo fileInfo = it.fileInfo();
+ if (!fileInfo.isDir()) {
+ QString destination = dataPath + QLatin1Char('/') + fileInfo.filePath().mid(resourceSourcePath.length());
+ QFileInfo destinationFileInfo(destination);
+ if (!destinationFileInfo.exists()) {
+ QDir().mkpath(destinationFileInfo.path());
+ if (!QFile::copy(fileInfo.filePath(), destination))
+ qWarning("Failed to copy %s", qPrintable(fileInfo.filePath()));
+ }
+ }
+ }
+#endif
+}
+
void tst_QDirModel::cleanupTestCase()
{
QDir current;
@@ -556,10 +580,12 @@ void tst_QDirModel::filePath()
model.setResolveSymlinks(false);
QModelIndex index = model.index(SRCDIR "test.lnk");
QVERIFY(index.isValid());
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID)
QString path = SRCDIR;
#else
- QString path = QFileInfo(SRCDIR).absoluteFilePath() + "/";
+ QString path = QFileInfo(SRCDIR).absoluteFilePath();
+ if (!path.endsWith("/"))
+ path += "/";
#endif
QCOMPARE(model.filePath(index), path + QString( "test.lnk"));
model.setResolveSymlinks(true);
@@ -592,6 +618,10 @@ void tst_QDirModel::task196768_sorting()
view.setSortingEnabled(true);
index2 = model.index(path);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QEXPECT_FAIL("", "QTBUG-43818", Continue);
+#endif
+
QCOMPARE(index.data(), index2.data());
}
diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro
index 4a5db512c8..8bdbde9282 100644
--- a/tests/auto/widgets/kernel/qlayout/qlayout.pro
+++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro
@@ -11,3 +11,8 @@ wince* {
} else {
TESTDATA += baseline/*
}
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/widgets/kernel/qlayout/testdata.qrc b/tests/auto/widgets/kernel/qlayout/testdata.qrc
new file mode 100644
index 0000000000..24e8e56263
--- /dev/null
+++ b/tests/auto/widgets/kernel/qlayout/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>baseline/smartmaxsize</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index c889643524..0bdc71e55b 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -345,6 +345,10 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
void tst_QLayout::testRetainSizeWhenHidden()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Test does not work on platforms which default to showMaximized()");
+#endif
+
QWidget widget;
QBoxLayout layout(QBoxLayout::TopToBottom, &widget);
diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro
index 4d18971cc6..b4546aa760 100644
--- a/tests/auto/widgets/styles/qstyle/qstyle.pro
+++ b/tests/auto/widgets/styles/qstyle/qstyle.pro
@@ -10,3 +10,8 @@ wince* {
addPixmap.path = .
DEPLOYMENT += addPixmap
}
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/widgets/styles/qstyle/testdata.qrc b/tests/auto/widgets/styles/qstyle/testdata.qrc
new file mode 100644
index 0000000000..c16b9be775
--- /dev/null
+++ b/tests/auto/widgets/styles/qstyle/testdata.qrc
@@ -0,0 +1,20 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/mac/button.png</file>
+ <file>images/mac/combobox.png</file>
+ <file>images/mac/lineedit.png</file>
+ <file>images/mac/mdi.png</file>
+ <file>images/mac/menu.png</file>
+ <file>images/mac/radiobutton.png</file>
+ <file>images/mac/slider.png</file>
+ <file>images/mac/spinbox.png</file>
+ <file>images/vista/button.png</file>
+ <file>images/vista/combobox.png</file>
+ <file>images/vista/lineedit.png</file>
+ <file>images/vista/menu.png</file>
+ <file>images/vista/radiobutton.png</file>
+ <file>images/vista/slider.png</file>
+ <file>images/vista/spinbox.png</file>
+ <file>task_25863.png</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
index d8e7fb7a99..cf495e2238 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
@@ -148,6 +148,7 @@ private slots:
#endif
void layoutAfterMultiLineRemove();
void undoCommandRemovesAndReinsertsBlock();
+ void taskQTBUG_43562_lineCountCrash();
private:
void createSelection();
@@ -1629,5 +1630,37 @@ void tst_QPlainTextEdit::undoCommandRemovesAndReinsertsBlock()
}
+class ContentsChangedFunctor {
+public:
+ ContentsChangedFunctor(QPlainTextEdit *t) : textEdit(t) {}
+ void operator()(int, int, int)
+ {
+ QTextCursor c(textEdit->textCursor());
+ c.beginEditBlock();
+ c.movePosition(QTextCursor::Start);
+ c.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
+ c.setCharFormat(QTextCharFormat());
+ c.endEditBlock();
+ }
+
+private:
+ QPlainTextEdit *textEdit;
+};
+
+void tst_QPlainTextEdit::taskQTBUG_43562_lineCountCrash()
+{
+ connect(ed->document(), &QTextDocument::contentsChange, ContentsChangedFunctor(ed));
+ // Don't crash
+ QTest::keyClicks(ed, "Some text");
+ QTest::keyClick(ed, Qt::Key_Left);
+ QTest::keyClick(ed, Qt::Key_Right);
+ QTest::keyClick(ed, Qt::Key_A);
+ QTest::keyClick(ed, Qt::Key_Left);
+ QTest::keyClick(ed, Qt::Key_Right);
+ QTest::keyClick(ed, Qt::Key_Space);
+ QTest::keyClicks(ed, "nd some more");
+ disconnect(ed->document(), SIGNAL(contentsChange(int, int, int)), 0, 0);
+}
+
QTEST_MAIN(tst_QPlainTextEdit)
#include "tst_qplaintextedit.moc"
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index e5a6f5d7d2..8ee8d017ab 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -1,12 +1,12 @@
TEMPLATE = subdirs
SUBDIRS = \
corelib \
- gui \
sql \
# removed-by-refactor qtHaveModule(opengl): SUBDIRS += opengl
qtHaveModule(dbus): SUBDIRS += dbus
qtHaveModule(network): SUBDIRS += network
+qtHaveModule(gui): SUBDIRS += gui
check-trusted.CONFIG += recursive
QMAKE_EXTRA_TARGETS += check-trusted
diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp
index b405df99d5..ae7eb6582a 100644
--- a/tests/benchmarks/dbus/qdbustype/main.cpp
+++ b/tests/benchmarks/dbus/qdbustype/main.cpp
@@ -35,8 +35,11 @@
#include <QtCore/QCoreApplication>
#include <QtDBus/private/qdbusutil_p.h>
+#include <QtDBus/private/qdbus_symbols_p.h>
-#include <dbus/dbus.h>
+DEFINEFUNC(dbus_bool_t, dbus_signature_validate, (const char *signature,
+ DBusError *error),
+ (signature, error), return)
class tst_QDBusType: public QObject
{
@@ -48,7 +51,8 @@ private Q_SLOTS:
static inline void benchmarkAddRow(const char *name, const char *data)
{
- QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true;
+ if (qdbus_loadLibDBus())
+ QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true;
QTest::newRow(name) << data << false;
}
@@ -84,9 +88,9 @@ void tst_QDBusType::benchmarkSignature()
bool result;
if (useNative) {
- dbus_signature_validate(data.toLatin1(), 0);
+ q_dbus_signature_validate(data.toLatin1(), 0);
QBENCHMARK {
- result = dbus_signature_validate(data.toLatin1(), 0);
+ result = q_dbus_signature_validate(data.toLatin1(), 0);
}
} else {
QDBusUtil::isValidSignature(data);
diff --git a/tests/benchmarks/dbus/qdbustype/qdbustype.pro b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
index 0307dda4a0..1437e4d9eb 100644
--- a/tests/benchmarks/dbus/qdbustype/qdbustype.pro
+++ b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
@@ -1,8 +1,13 @@
TARGET = tst_bench_qdbustype
QT -= gui
-QT += dbus dbus-private testlib
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
-LIBS_PRIVATE += $$QT_LIBS_DBUS
+QT += core-private dbus-private testlib
+contains(QT_CONFIG, dbus-linked) {
+ DEFINES += QT_LINKED_LIBDBUS
+ LIBS += $$QT_LIBS_DBUS
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+} else {
+ SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
+}
SOURCES += main.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp
index 23a6d44fef..0a815fd883 100644
--- a/tests/manual/diaglib/eventfilter.cpp
+++ b/tests/manual/diaglib/eventfilter.cpp
@@ -36,6 +36,28 @@
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
+#if QT_VERSION >= 0x050000
+# if defined(QT_WIDGETS_LIB)
+# define HAVE_APPLICATION
+# endif
+# if defined(QT_GUI_LIB)
+# define HAVE_GUI_APPLICATION
+# endif
+#else // Qt 5
+# if defined(QT_GUI_LIB)
+# define HAVE_APPLICATION
+# endif
+#endif
+
+#ifdef HAVE_APPLICATION
+# include <QApplication>
+# include <QWidget>
+#endif
+#ifdef HAVE_GUI_APPLICATION
+# include <QtGui/QGuiApplication>
+# include <QtGui/QWindow>
+#endif
+
namespace QtDiag {
EventFilter::EventFilter(EventCategories eventCategories, QObject *p)
@@ -131,16 +153,60 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types)
return types & EventFilter::OtherType;
}
+static void formatObject(const QObject *o, QDebug debug)
+{
+ if (o) {
+ debug << o->metaObject()->className();
+ const QString on = o->objectName();
+ if (!on.isEmpty())
+ debug << '/' << on;
+ } else {
+ debug << "null";
+ }
+}
+
+static void formatApplicationState(QDebug debug)
+{
+#if defined(HAVE_APPLICATION)
+ if (const QWidget *mw = QApplication::activeModalWidget()) {
+ debug << "\n QApplication::activeModalWidget = ";
+ formatObject(mw, debug);
+ }
+ if (const QWidget *pw = QApplication::activePopupWidget()) {
+ debug << "\n QApplication::activePopupWidget = ";
+ formatObject(pw, debug);
+ }
+ debug << "\n QApplication::activeWindow = ";
+ formatObject(QApplication::activeWindow(), debug);
+#endif // HAVE_APPLICATION
+#if defined(HAVE_GUI_APPLICATION)
+ if (const QWindow *mw = QGuiApplication::modalWindow()) {
+ debug << "\n QGuiApplication::modalWindow = ";
+ formatObject(mw, debug);
+ }
+ debug << "\n QGuiApplication::focusWindow = ";
+ formatObject(QGuiApplication::focusWindow(), debug);
+#endif // HAVE_GUI_APPLICATION
+}
+
bool EventFilter::eventFilter(QObject *o, QEvent *e)
{
static int n = 0;
if (matchesType(o, m_objectTypes) && m_eventTypes.contains(e->type())) {
QDebug debug = qDebug().nospace();
- const QString on = o->objectName();
- debug << '#' << n++ << ' ' << o->metaObject()->className();
- if (!on.isEmpty())
- debug << '/' << on;
+ debug << '#' << n++ << ' ';
+ formatObject(o, debug);
debug << ' ' << e;
+ switch (e->type()) {
+#if QT_VERSION >= 0x050000
+ case QEvent::FocusAboutToChange:
+#endif
+ case QEvent::FocusIn:
+ formatApplicationState(debug);
+ break;
+ default:
+ break;
+ }
}
return false;
}
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 487e95266b..dc1e0e08c0 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -80,8 +80,11 @@ void screenAdded(QScreen* screen)
// But this works as long as the screens are all virtual siblings
w->show();
QRect geom = w->geometry();
+ geom.setSize(w->sizeHint());
+ if (geom.height() > screen->geometry().height())
+ geom.setHeight(screen->geometry().height() * 9 / 10);
geom.moveCenter(screen->geometry().center());
- w->move(geom.topLeft());
+ w->setGeometry(geom);
props->insert(screen, w);
diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp
index e6392465f2..f1e5e22ec9 100644
--- a/tests/manual/qscreen/propertyfield.cpp
+++ b/tests/manual/qscreen/propertyfield.cpp
@@ -34,8 +34,9 @@
#include "propertyfield.h"
#include <QDebug>
-PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) :
- QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent)
+ : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+ , m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text))
{
setReadOnly(true);
if (prop.hasNotifySignal()) {
@@ -99,7 +100,7 @@ void PropertyField::propertyChanged()
setText(text);
m_lastText = text;
m_lastTextShowing = text;
- modPalette.setBrush(QPalette::Text, Qt::black);
+ modPalette.setBrush(QPalette::Text, m_defaultBrush);
}
setPalette(modPalette);
}
diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h
index 2738a215a6..f76ac7fc6b 100644
--- a/tests/manual/qscreen/propertyfield.h
+++ b/tests/manual/qscreen/propertyfield.h
@@ -63,6 +63,7 @@ private:
QString m_lastTextShowing;
QTime m_lastChangeTime;
const QMetaProperty m_prop;
+ QBrush m_defaultBrush;
};
#endif // PROPERTYFIELD_H
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 2981bb9bf1..9975bc9673 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -137,7 +137,10 @@ void ControllerWindow::updatePreview()
parentWindow->hide();
}
- previewWidget->setWindowFlags(flags);
+ if (previewWidgetButton->isChecked())
+ previewWindow->setWindowFlags(flags);
+ else
+ previewDialog->setWindowFlags(flags);
if (fixedSizeWindowCheckBox->isChecked()) {
previewWidget->setFixedSize(300, 300);
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index f75917ca0c..3226e52279 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -2102,6 +2102,11 @@ bool Configure::checkAngleAvailability(QString *errorMessage /* = 0 */) const
// it is also present in MinGW.
const QString directXSdk = Environment::detectDirectXSdk();
const Compiler compiler = Environment::compilerFromQMakeSpec(dictionary[QStringLiteral("QMAKESPEC")]);
+ if (compiler >= CC_MSVC2005 && compiler <= CC_MSVC2008) {
+ if (errorMessage)
+ *errorMessage = QStringLiteral("ANGLE is no longer supported for this compiler.");
+ return false;
+ }
if (compiler < CC_MSVC2012 && directXSdk.isEmpty()) {
if (errorMessage)
*errorMessage = QStringLiteral("There is no Direct X SDK installed or the environment variable \"DXSDK_DIR\" is not set.");
@@ -3173,7 +3178,7 @@ void Configure::detectArch()
if (!exe.open(QFile::ReadOnly)) { // no Text, this is binary
exe.setFileName("arch");
if (!exe.open(QFile::ReadOnly)) {
- cout << "Could not find output file: " << qPrintable(exe.errorString()) << endl;
+ cout << "Could not find output file '" << qPrintable(arch_exe) << "' or 'arch' in " << qPrintable(newpwd) << " : " << qPrintable(exe.errorString()) << endl;
dictionary["DONE"] = "error";
return;
}