summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-06-01 15:34:58 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2011-06-01 15:34:58 +0200
commit00ef07fe96f51cb309469454592daf5d4a92eb4b (patch)
tree59f34f603882644ba25fb4bbc893fcb64ea6b262
parentf05236a40d7ee9299c5855d70e542143a2d342c8 (diff)
parent7b6c3707dea3292b62cca02245a710f00db21427 (diff)
Merge remote-tracking branch 'base/master' into refactor
Conflicts: src/gui/embedded/qmousepc_qws.cpp src/gui/embedded/qwslock.cpp src/plugins/decorations/default/default.pro src/plugins/decorations/styled/styled.pro src/plugins/decorations/windows/windows.pro src/plugins/gfxdrivers/ahi/ahi.pro src/plugins/gfxdrivers/directfb/directfb.pro src/plugins/gfxdrivers/eglnullws/eglnullws.pro src/plugins/gfxdrivers/linuxfb/linuxfb.pro src/plugins/gfxdrivers/qvfb/qvfb.pro src/plugins/gfxdrivers/transformed/transformed.pro src/plugins/gfxdrivers/vnc/vnc.pro src/plugins/graphicssystems/meego/meego.pro src/plugins/graphicssystems/opengl/opengl.pro src/plugins/graphicssystems/openvg/openvg.pro src/plugins/graphicssystems/shivavg/shivavg.pro src/plugins/graphicssystems/trace/trace.pro src/plugins/kbddrivers/linuxinput/linuxinput.pro src/plugins/mousedrivers/linuxtp/linuxtp.pro src/plugins/mousedrivers/pc/pc.pro src/plugins/mousedrivers/tslib/tslib.pro src/plugins/platforms/minimal/minimal.pro tests/auto/qerrormessage/qerrormessage.pro
-rwxr-xr-xconfigure43
-rw-r--r--dist/changes-4.8.022
-rw-r--r--examples/opengl/cube/geometryengine.cpp2
-rw-r--r--examples/opengl/cube/mainwidget.cpp2
-rw-r--r--examples/opengl/cube/mainwidget.h3
-rw-r--r--examples/qtestlib/tutorial1/tutorial1.pro2
-rw-r--r--examples/qtestlib/tutorial2/tutorial2.pro2
-rw-r--r--examples/qtestlib/tutorial3/tutorial3.pro2
-rw-r--r--examples/qtestlib/tutorial4/tutorial4.pro2
-rw-r--r--examples/qtestlib/tutorial5/tutorial5.pro2
-rw-r--r--examples/widgets/applicationicon/applicationicon.svg22
-rw-r--r--examples/widgets/applicationicon/main.cpp14
-rw-r--r--examples/widgets/elidedlabel/elidedlabel.cpp71
-rw-r--r--examples/widgets/elidedlabel/elidedlabel.h36
-rw-r--r--examples/widgets/elidedlabel/main.cpp13
-rw-r--r--examples/widgets/elidedlabel/testwidget.cpp124
-rw-r--r--examples/widgets/elidedlabel/testwidget.h36
-rw-r--r--mkspecs/features/default_pre.prf6
-rw-r--r--mkspecs/features/designer.prf7
-rw-r--r--mkspecs/features/qmltestcase.prf16
-rw-r--r--mkspecs/features/qt.prf2
-rw-r--r--mkspecs/features/qt_plugin.prf41
-rw-r--r--qtbase.pro42
-rw-r--r--src/corelib/concurrent/qtconcurrentcompilertest.h14
-rw-r--r--src/corelib/concurrent/qtconcurrentfunctionwrappers.h11
-rw-r--r--src/corelib/concurrent/qtconcurrentrun.h75
-rw-r--r--src/corelib/concurrent/qtconcurrentstoredfunctioncall.h105
-rw-r--r--src/corelib/global/qendian.h5
-rw-r--r--src/corelib/global/qglobal.h17
-rw-r--r--src/corelib/global/qnamespace.qdoc4
-rw-r--r--src/corelib/io/io.pri3
-rw-r--r--src/corelib/io/qtldurl.cpp117
-rw-r--r--src/corelib/io/qtldurl_p.h66
-rw-r--r--src/corelib/io/qurl.cpp19
-rw-r--r--src/corelib/io/qurl.h3
-rw-r--r--src/corelib/io/qurltlds_p.h (renamed from src/network/access/qnetworkcookiejartlds_p.h)10
-rw-r--r--src/corelib/io/qurltlds_p.h.INFO (renamed from src/network/access/qnetworkcookiejartlds_p.h.INFO)8
-rw-r--r--src/corelib/plugin/quuid.cpp383
-rw-r--r--src/corelib/plugin/quuid.h6
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp4
-rw-r--r--src/gui/text/qtextengine.cpp69
-rw-r--r--src/gui/text/qtextengine_p.h2
-rw-r--r--src/gui/text/qtextlayout.cpp22
-rw-r--r--src/network/access/access.pri1
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp12
-rw-r--r--src/network/access/qnetworkcookiejar.cpp43
-rw-r--r--src/network/access/qnetworkcookiejar_p.h3
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp2
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h2
-rw-r--r--src/network/socket/qhttpsocketengine.cpp2
-rw-r--r--src/network/socket/qsocks5socketengine.cpp2
-rw-r--r--src/network/ssl/qsslcertificate.cpp46
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp18
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h6
-rw-r--r--src/opengl/qgl.cpp2
-rw-r--r--src/opengl/qglframebufferobject.cpp2
-rw-r--r--src/opengl/qglpixelbuffer.cpp2
-rw-r--r--src/plugins/accessible/widgets/widgets.pro2
-rw-r--r--src/plugins/bearer/connman/connman.pro2
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro2
-rw-r--r--src/plugins/bearer/generic/generic.pro2
-rw-r--r--src/plugins/bearer/icd/icd.pro2
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.pro2
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.pro2
-rw-r--r--src/plugins/bearer/nla/nla.pro2
-rw-r--r--src/plugins/bearer/symbian/symbian.pri2
-rw-r--r--src/plugins/codecs/cn/cn.pro2
-rw-r--r--src/plugins/codecs/jp/jp.pro2
-rw-r--r--src/plugins/codecs/kr/kr.pro2
-rw-r--r--src/plugins/codecs/tw/tw.pro2
-rw-r--r--src/plugins/generic/linuxinput/linuxinput.pro2
-rw-r--r--src/plugins/generic/tslib/tslib.pro2
-rw-r--r--src/plugins/imageformats/gif/gif.pro2
-rw-r--r--src/plugins/imageformats/ico/ico.pro2
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro2
-rw-r--r--src/plugins/imageformats/mng/mng.pro2
-rw-r--r--src/plugins/imageformats/tiff/tiff.pro2
-rw-r--r--src/plugins/inputmethods/imsw-multi/imsw-multi.pro2
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro2
-rw-r--r--src/plugins/platforms/directfb/directfb.pro2
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro2
-rw-r--r--src/plugins/platforms/externalplugin.pri2
-rw-r--r--src/plugins/platforms/fb_base/fb_base.pro2
-rw-r--r--src/plugins/platforms/linuxfb/linuxfb.pro2
-rw-r--r--src/plugins/platforms/minimal/minimal.pro3
-rw-r--r--src/plugins/platforms/openkode/openkode.pro2
-rw-r--r--src/plugins/platforms/openvglite/openvglite.pro2
-rw-r--r--src/plugins/platforms/qvfb/qvfb.pro2
-rw-r--r--src/plugins/platforms/uikit/uikit.pro2
-rw-r--r--src/plugins/platforms/vnc/vnc.pro2
-rw-r--r--src/plugins/platforms/wayland/qwaylanddisplay.cpp9
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp1
-rw-r--r--src/plugins/platforms/wayland/wayland.pro2
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h40
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp13
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h1
-rw-r--r--src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c3
-rw-r--r--src/plugins/platforms/xcb/xcb.pro2
-rw-r--r--src/plugins/platforms/xlib/xlib.pro2
-rw-r--r--src/plugins/qpluginbase.pri42
-rw-r--r--src/plugins/s60/s60pluginbase.pri2
-rw-r--r--src/plugins/sqldrivers/qsqldriverbase.pri2
-rw-r--r--src/testlib/qtestaccessible.h6
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.cpp7
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.h1
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h13
-rw-r--r--src/widgets/platforms/mac/qfontengine_coretext.mm7
-rw-r--r--src/widgets/platforms/mac/qpixmap_mac.cpp11
-rw-r--r--src/widgets/platforms/mac/qwidget_mac.mm12
-rw-r--r--src/widgets/platforms/x11/qfontdatabase_x11.cpp5
-rw-r--r--src/widgets/platforms/x11/qfontengine_x11.cpp2
-rw-r--r--src/widgets/to_be_moved/qlinecontrol.cpp4
-rw-r--r--src/widgets/to_be_moved/qtextcontrol.cpp6
-rw-r--r--tests/auto/macgui/macgui.pro2
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp13
-rw-r--r--tests/auto/qcompleter/qcompleter.pro8
-rw-r--r--tests/auto/qerrormessage/qerrormessage.pro9
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp12
-rw-r--r--tests/auto/qlist/tst_qlist.cpp3
-rw-r--r--tests/auto/qlocalsocket/lackey/lackey.pro6
-rw-r--r--tests/auto/qmessagebox/qmessagebox.pro4
-rw-r--r--tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp6
-rw-r--r--tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp4
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp18
-rw-r--r--tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem16
-rw-r--r--tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san5
-rwxr-xr-xtests/auto/qsslcertificate/certificates/gencertificates.sh10
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp32
-rw-r--r--tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp21
-rw-r--r--tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp67
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp42
-rw-r--r--tests/auto/qtipc/lackey/lackey.pro7
-rw-r--r--tests/auto/qurl/qurl.pro2
-rw-r--r--tests/auto/qurl/tst_qurl.cpp26
-rw-r--r--tests/auto/quuid/tst_quuid.cpp101
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp14
-rw-r--r--tests/auto/uic/uic.pro1
-rw-r--r--tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp125
-rw-r--r--tests/benchmarks/corelib/tools/qstring/main.cpp9
-rw-r--r--util/corelib/qurl-generateTLDs/main.cpp (renamed from util/network/cookiejar-generateTLDs/main.cpp)4
-rw-r--r--util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro (renamed from util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro)0
-rw-r--r--util/lexgen/tests/tests.pro3
144 files changed, 1898 insertions, 534 deletions
diff --git a/configure b/configure
index 625c3ff430..12b08aa9c8 100755
--- a/configure
+++ b/configure
@@ -8471,22 +8471,6 @@ fi
#-------------------------------------------------------------------------------
QTMODULE="$outpath/mkspecs/qmodule.pri"
-cat >>"$QTMODULE.tmp" <<EOF
-#paths
-QT_SOURCE_TREE = \$\$quote($relpath)
-QT_BUILD_TREE = \$\$quote($outpath)
-QT_BUILD_PARTS = $CFG_BUILD_PARTS
-
-#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
-QMAKE_MOC = \$\$QT_BUILD_TREE/bin/moc
-QMAKE_UIC = \$\$QT_BUILD_TREE/bin/uic
-QMAKE_RCC = \$\$QT_BUILD_TREE/bin/rcc
-QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
-QMAKE_INCDIR_QT = \$\$QT_BUILD_TREE/include
-QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib
-
-EOF
-
# Ensure we can link to uninistalled libraries
if [ "$XPLATFORM_MINGW" != "yes" ] && [ "$CFG_EMBEDDED" != "nacl" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
echo "QMAKE_LFLAGS = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
@@ -8537,13 +8521,6 @@ if [ "$CFG_MAC_XARCH" = "no" ]; then
echo "QMAKE_MAC_XARCH = no" >> "$QTMODULE.tmp"
fi
-#dump the qmake spec
-if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
- echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$QTMODULE.tmp"
-else
- echo "QMAKESPEC = $XPLATFORM" >> "$QTMODULE.tmp"
-fi
-
# cmdline args
cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
rm -f "$QMAKE_VARS_FILE" 2>/dev/null
@@ -8562,6 +8539,19 @@ fi
CACHEFILE="$outpath/.qmake.cache"
[ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
cat >>"$CACHEFILE.tmp" <<EOF
+#paths
+QT_SOURCE_TREE = \$\$quote($relpath)
+QT_BUILD_TREE = \$\$quote($outpath)
+QT_BUILD_PARTS = $CFG_BUILD_PARTS
+
+#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
+QMAKE_MOC = \$\$QT_BUILD_TREE/bin/moc
+QMAKE_UIC = \$\$QT_BUILD_TREE/bin/uic
+QMAKE_RCC = \$\$QT_BUILD_TREE/bin/rcc
+QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
+QMAKE_INCDIR_QT = \$\$QT_BUILD_TREE/include
+QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib
+
include(\$\$PWD/mkspecs/qmodule.pri)
CONFIG += $QMAKE_CONFIG dylib create_prl link_prl depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
@@ -8569,6 +8559,13 @@ QMAKE_MOC_SRC = \$\$QT_BUILD_TREE/src/moc
EOF
+#dump the qmake spec
+if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
+ echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
+else
+ echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
+fi
+
# incrementals
INCREMENTAL=""
[ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0
index b8cc62600e..170363352d 100644
--- a/dist/changes-4.8.0
+++ b/dist/changes-4.8.0
@@ -39,12 +39,29 @@ QtCore
- Removed support for QT_NO_THREAD define for QHostInfo.
- Optimized plugin loading on ELF platforms.
Print failure reason at runtime with QT_DEBUG_PLUGINS=1 in environment.
+ - QMutexLocker: improved performence of the non contended case by inlining some function
+ - QThreadStorage: Added possibility to store object by value instead of by pointer [QTBUG-15033]
+ - QThread: fixed few race conditions [QTBUG-17257, QTBUG-15030]
+ - QtConcurrent: added support for c++0x lambda in few functions
+ - QObject: Improved performence of the signal activation
+ - QObject: added ways to connect signals using QMetaMethod
+ - QObject: deprecated qFindChild and qFindChildren
+ - QObject: optimize constructions and destruction of objects
+ - QObject: Qt::BlockingQueuedConnection can handle the return value [QTBUG-10440]
+ - QList/QVector/QStringList: added C++0x initilizer lists constructors.
+ - QVarLenghtArray: added method for consistency with QVector
+ - QStringBuilder: added support for QByteArray
+ - qSwap now uses std::swap, specialized std::swap for our container to work better with stl algoritms
+ - QVariant: deprecated global function qVariantSetValue, qVariantValue, qVariantCanConvert, qVariantFromValue
QtGui
-----
- QTabBar: reduced minimumSizeHint if ElideMode is set.
- QComboBox: Fixed a color propagation issue with the lineedit. [QTBUG-5950]
+ - Deprecate qGenericMatrixFromMatrix4x4 and qGenericMatrixToMatrix4x4
+ - QListView diverses optimisations [QTBUG-11438]
+ - QTreeWidget/QListWidget: use localeAwareCompare for string comparisons [QTBUG-10839]
QtOpenGL
--------
@@ -54,6 +71,10 @@ QtGui
- Including <QtOpenGL> will not work in combination with GLEW, as
QGLFunctions will undefine GLEW's defines.
+QtScript
+--------
+ - Deprecated qScriptValueFromQMetaObject, qScriptValueToValue, qScriptValueFromValue
+
****************************************************************************
* Database Drivers *
@@ -136,6 +157,7 @@ Qt for Windows CE
- qtconfig
+ * removed Qt3support dependency
- qt3to4
diff --git a/examples/opengl/cube/geometryengine.cpp b/examples/opengl/cube/geometryengine.cpp
index 2f6f65948d..01a33f3bb7 100644
--- a/examples/opengl/cube/geometryengine.cpp
+++ b/examples/opengl/cube/geometryengine.cpp
@@ -21,6 +21,8 @@ GeometryEngine::~GeometryEngine()
void GeometryEngine::init()
{
+ initializeGLFunctions();
+
//! [0]
// Generate 2 VBOs
glGenBuffers(2, vboIds);
diff --git a/examples/opengl/cube/mainwidget.cpp b/examples/opengl/cube/mainwidget.cpp
index bead5f79ed..682ce5c9e7 100644
--- a/examples/opengl/cube/mainwidget.cpp
+++ b/examples/opengl/cube/mainwidget.cpp
@@ -78,6 +78,8 @@ void MainWidget::timerEvent(QTimerEvent *e)
void MainWidget::initializeGL()
{
+ initializeGLFunctions();
+
qglClearColor(Qt::black);
qDebug() << "Initializing shaders...";
diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h
index 595173b65d..75d069d2f6 100644
--- a/examples/opengl/cube/mainwidget.h
+++ b/examples/opengl/cube/mainwidget.h
@@ -2,6 +2,7 @@
#define MAINWIDGET_H
#include <QtOpenGL/QGLWidget>
+#include <QtOpenGL/QGLFunctions>
#include <QMatrix4x4>
#include <QQuaternion>
@@ -12,7 +13,7 @@ class QGLShaderProgram;
class GeometryEngine;
-class MainWidget : public QGLWidget
+class MainWidget : public QGLWidget, protected QGLFunctions
{
Q_OBJECT
public:
diff --git a/examples/qtestlib/tutorial1/tutorial1.pro b/examples/qtestlib/tutorial1/tutorial1.pro
index 2a9d032dd5..ca4c795fdb 100644
--- a/examples/qtestlib/tutorial1/tutorial1.pro
+++ b/examples/qtestlib/tutorial1/tutorial1.pro
@@ -1,5 +1,5 @@
SOURCES = testqstring.cpp
-CONFIG += qtestlib
+QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial1
diff --git a/examples/qtestlib/tutorial2/tutorial2.pro b/examples/qtestlib/tutorial2/tutorial2.pro
index b459d25b97..8ff0f4b818 100644
--- a/examples/qtestlib/tutorial2/tutorial2.pro
+++ b/examples/qtestlib/tutorial2/tutorial2.pro
@@ -1,5 +1,5 @@
SOURCES = testqstring.cpp
-CONFIG += qtestlib
+QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial2
diff --git a/examples/qtestlib/tutorial3/tutorial3.pro b/examples/qtestlib/tutorial3/tutorial3.pro
index 4985858d3d..732c7be6bd 100644
--- a/examples/qtestlib/tutorial3/tutorial3.pro
+++ b/examples/qtestlib/tutorial3/tutorial3.pro
@@ -1,5 +1,5 @@
SOURCES = testgui.cpp
-CONFIG += qtestlib
+QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial3
diff --git a/examples/qtestlib/tutorial4/tutorial4.pro b/examples/qtestlib/tutorial4/tutorial4.pro
index 02d9020b84..9fa2f110d3 100644
--- a/examples/qtestlib/tutorial4/tutorial4.pro
+++ b/examples/qtestlib/tutorial4/tutorial4.pro
@@ -1,5 +1,5 @@
SOURCES = testgui.cpp
-CONFIG += qtestlib
+QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial4
diff --git a/examples/qtestlib/tutorial5/tutorial5.pro b/examples/qtestlib/tutorial5/tutorial5.pro
index efdb1ce055..15a8b85956 100644
--- a/examples/qtestlib/tutorial5/tutorial5.pro
+++ b/examples/qtestlib/tutorial5/tutorial5.pro
@@ -1,5 +1,5 @@
SOURCES = benchmarking.cpp
-CONFIG += qtestlib
+QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial5
diff --git a/examples/widgets/applicationicon/applicationicon.svg b/examples/widgets/applicationicon/applicationicon.svg
new file mode 100644
index 0000000000..aa2835b08f
--- /dev/null
+++ b/examples/widgets/applicationicon/applicationicon.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" baseProfile="tiny" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 44 44">
+ <defs>
+ <linearGradient id="linearGradient2824" y2="1051.4" gradientUnits="userSpaceOnUse" x2="30.217" y1="1009.4" x1="15.109">
+ <stop stop-color="#41a200" offset="0"/>
+ <stop stop-color="#9be948" offset="0.63897"/>
+ <stop stop-color="#beff61" offset="1"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2848" y2="1009.4" gradientUnits="userSpaceOnUse" y1="1053.7" gradientTransform="matrix(0.85714286,0,0,0.85714286,2.1428572,146.19467)" x2="15.085" x1="31.027">
+ <stop stop-color="#41a200" offset="0"/>
+ <stop stop-color="#9be948" offset="0.88602"/>
+ <stop stop-color="#beff61" offset="1"/>
+ </linearGradient>
+ </defs>
+ <g id="layer1" transform="translate(0,-1008.3622)">
+ <path id="rect2816" d="m8.412,1009h27.18c4.106,0,7.412,3.306,7.412,7.412v27.18c0,4.106-3.306,7.412-7.412,7.412h-27.18c-4.106,0-7.412-3-7.412-7v-27.18c0-4.106,3.306-7.412,7.412-7.412z" stroke-linecap="round" stroke-miterlimit="4" stroke-width="0.64300001" fill="url(#linearGradient2824)"/>
+ <path id="rect2816-4" d="m9.353,1011h25.29c3.52,0,6.353,2.833,6.353,6.353v25.29c0,3.519-2.833,6.353-6.353,6.353h-25.29c-3.52-0.1-6.353-2.1-6.353-6.1v-25.29c0-3.519,2.833-6.353,6.353-6.353z" stroke-linecap="round" stroke-miterlimit="4" stroke-width="0.64300001" fill="url(#linearGradient2848)"/>
+ <g id="text2893" font-weight="normal" transform="translate(-1.100281,1010.3622)" font-style="normal" font-stretch="normal" font-size="48px" font-variant="normal" font-family="Cambria Math" fill="#e5ffd5">
+ <path id="path2908" fill="#e5ffd5" d="m11.92,35.44c1.359-1.719,2.672-3.828,3.938-6.328l7.522-14.742c-0.8-3.13-1.54-5.321-2.24-6.586-0.69-1.266-1.76-1.899-3.2-1.899-1.328,0.0000307-2.594,0.6563-3.797,1.969l-1.148-1.266c2.156-2.359,4.289-3.539,6.398-3.539,1.469,0.0000335,2.609,0.418,3.422,1.254,0.8125,0.836,1.492,2.168,2.039,3.996,0.5469,1.828,1.32,5.359,2.32,10.59,1.297,6.828,2.309,11.14,3.035,12.93,0.7265,1.789,1.59,2.684,2.59,2.684,0.7187,0.000002,1.383-0.25,1.992-0.75l0.8906,1.406c-1.547,1.203-2.938,1.805-4.172,1.805-1.75,0-3-0.8984-3.75-2.695-0.75-1.797-1.797-6.633-3.141-14.51h-0.1406c-2.658,5.391-5.258,11.001-7.798,16.831h-4.758z"/>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/examples/widgets/applicationicon/main.cpp b/examples/widgets/applicationicon/main.cpp
new file mode 100644
index 0000000000..099bdac218
--- /dev/null
+++ b/examples/widgets/applicationicon/main.cpp
@@ -0,0 +1,14 @@
+#include <QtGui/QApplication>
+#include <QtGui/QLabel>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ QLabel label(QObject::tr("Hello, world!"));
+#if defined(Q_WS_S60)
+ label.showMaximized();
+#else
+ label.show();
+#endif
+ return a.exec();
+}
diff --git a/examples/widgets/elidedlabel/elidedlabel.cpp b/examples/widgets/elidedlabel/elidedlabel.cpp
new file mode 100644
index 0000000000..4f3ac5e843
--- /dev/null
+++ b/examples/widgets/elidedlabel/elidedlabel.cpp
@@ -0,0 +1,71 @@
+#include "elidedlabel.h"
+
+#include <QPainter>
+#include <QTextLayout>
+#include <QDebug>
+
+//! [0]
+ElidedLabel::ElidedLabel(const QString &text, QWidget *parent)
+ : QFrame(parent)
+ , elided(false)
+ , content(text)
+{
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+}
+//! [0]
+
+//! [1]
+void ElidedLabel::setText(const QString &newText)
+{
+ content = newText;
+ update();
+}
+//! [1]
+
+//! [2]
+void ElidedLabel::paintEvent(QPaintEvent *event)
+{
+ QFrame::paintEvent(event);
+
+ QPainter painter(this);
+ QFontMetrics fontMetrics = painter.fontMetrics();
+
+ bool didElide = false;
+ int lineSpacing = fontMetrics.lineSpacing();
+ int y = 0;
+
+ QTextLayout textLayout(content, painter.font());
+ textLayout.beginLayout();
+ forever {
+ QTextLine line = textLayout.createLine();
+
+ if (!line.isValid())
+ break;
+
+ line.setLineWidth(width());
+ int nextLineY = y + lineSpacing;
+
+ if (height() >= nextLineY + lineSpacing) {
+ line.draw(&painter, QPoint(0, y));
+ y = nextLineY;
+ //! [2]
+ //! [3]
+ } else {
+ QString lastLine = content.mid(line.textStart());
+ QString elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width());
+ painter.drawText(QPoint(0, y + fontMetrics.ascent()), elidedLastLine);
+ line = textLayout.createLine();
+ didElide = line.isValid();
+ break;
+ }
+ }
+ textLayout.endLayout();
+ //! [3]
+
+ //! [4]
+ if (didElide != elided) {
+ elided = didElide;
+ emit elisionChanged(didElide);
+ }
+}
+//! [4]
diff --git a/examples/widgets/elidedlabel/elidedlabel.h b/examples/widgets/elidedlabel/elidedlabel.h
new file mode 100644
index 0000000000..b68f605248
--- /dev/null
+++ b/examples/widgets/elidedlabel/elidedlabel.h
@@ -0,0 +1,36 @@
+#ifndef ELIDEDLABEL_H
+#define ELIDEDLABEL_H
+
+#include <QFrame>
+#include <QRect>
+#include <QResizeEvent>
+#include <QString>
+#include <QWidget>
+
+//! [0]
+class ElidedLabel : public QFrame
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText)
+ Q_PROPERTY(bool isElided READ isElided)
+
+public:
+ ElidedLabel(const QString &text, QWidget *parent = 0);
+
+ void setText(const QString &text);
+ const QString & text() const { return content; }
+ bool isElided() const { return elided; }
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+signals:
+ void elisionChanged(bool elided);
+
+private:
+ bool elided;
+ QString content;
+};
+//! [0]
+
+#endif // TEXTWRAPPINGWIDGET_H
diff --git a/examples/widgets/elidedlabel/main.cpp b/examples/widgets/elidedlabel/main.cpp
new file mode 100644
index 0000000000..1346d25e24
--- /dev/null
+++ b/examples/widgets/elidedlabel/main.cpp
@@ -0,0 +1,13 @@
+#include "testwidget.h"
+
+#include <QtGui/QApplication>
+
+//! [0]
+int main( int argc, char *argv[] )
+{
+ QApplication application( argc, argv );
+ TestWidget w;
+ w.showFullScreen();
+ return application.exec();
+}
+//! [0]
diff --git a/examples/widgets/elidedlabel/testwidget.cpp b/examples/widgets/elidedlabel/testwidget.cpp
new file mode 100644
index 0000000000..d3bf521832
--- /dev/null
+++ b/examples/widgets/elidedlabel/testwidget.cpp
@@ -0,0 +1,124 @@
+#include "testwidget.h"
+#include "elidedlabel.h"
+
+#include <QLabel>
+#include <QPushButton>
+#include <QSizePolicy>
+#include <QGridLayout>
+
+//! [0]
+TestWidget::TestWidget(QWidget *parent):
+ QWidget(parent)
+{
+ const QString romeo = tr(
+ "But soft, what light through yonder window breaks? / "
+ "It is the east, and Juliet is the sun. / "
+ "Arise, fair sun, and kill the envious moon, / "
+ "Who is already sick and pale with grief / "
+ "That thou, her maid, art far more fair than she."
+ );
+
+ const QString macbeth = tr(
+ "To-morrow, and to-morrow, and to-morrow, / "
+ "Creeps in this petty pace from day to day, / "
+ "To the last syllable of recorded time; / "
+ "And all our yesterdays have lighted fools / "
+ "The way to dusty death. Out, out, brief candle! / "
+ "Life's but a walking shadow, a poor player, / "
+ "That struts and frets his hour upon the stage, / "
+ "And then is heard no more. It is a tale / "
+ "Told by an idiot, full of sound and fury, / "
+ "Signifying nothing."
+ );
+
+ const QString harry = tr("Feeling lucky, punk?");
+
+ textSamples << romeo << macbeth << harry;
+ //! [0]
+
+ //! [1]
+ sampleIndex = 0;
+ elidedText = new ElidedLabel(textSamples[sampleIndex], this);
+ elidedText->setFrameStyle(QFrame::Box);
+ //! [1]
+
+ //! [2]
+ QPushButton *switchButton = new QPushButton(tr("Switch text"));
+ connect(switchButton, SIGNAL(clicked(bool)), this, SLOT(switchText()));
+
+ QPushButton *exitButton = new QPushButton(tr("Exit"));
+ connect(exitButton, SIGNAL(clicked(bool)), this, SLOT(close()));
+
+ QLabel *label = new QLabel(tr("Elided"));
+ label->setVisible(elidedText->isElided());
+ connect(elidedText, SIGNAL(elisionChanged(bool)), label, SLOT(setVisible(bool)));
+ //! [2]
+
+ //! [3]
+ widthSlider = new QSlider(Qt::Horizontal);
+ widthSlider->setMinimum(0);
+ connect(widthSlider, SIGNAL(valueChanged(int)), this, SLOT(onWidthChanged(int)));
+
+ heightSlider = new QSlider(Qt::Vertical);
+ heightSlider->setInvertedAppearance(true);
+ heightSlider->setMinimum(0);
+ connect(heightSlider, SIGNAL(valueChanged(int)), this, SLOT(onHeightChanged(int)));
+ //! [3]
+
+ //! [4]
+ QGridLayout *layout = new QGridLayout();
+ layout->addWidget(label, 0, 1, Qt::AlignCenter);
+ layout->addWidget(switchButton, 0, 2);
+ layout->addWidget(exitButton, 0, 3);
+ layout->addWidget(widthSlider, 1, 1, 1, 3);
+ layout->addWidget(heightSlider, 2, 0);
+ layout->addWidget(elidedText, 2, 1, 1, 3, Qt::AlignTop | Qt::AlignLeft);
+
+ setLayout(layout);
+ //! [4]
+
+ //! [5]
+#ifdef Q_WS_MAEMO_5
+ setAttribute(Qt::WA_Maemo5AutoOrientation, true);
+#endif
+}
+//! [5]
+
+//! [6]
+void TestWidget::resizeEvent(QResizeEvent *event)
+{
+ Q_UNUSED(event)
+
+ int maxWidth = widthSlider->width();
+ widthSlider->setMaximum(maxWidth);
+ widthSlider->setValue(maxWidth / 2);
+
+ int maxHeight = heightSlider->height();
+ heightSlider->setMaximum(maxHeight);
+ heightSlider->setValue(maxHeight / 2);
+
+ elidedText->setFixedSize(widthSlider->value(), heightSlider->value());
+}
+//! [6]
+
+//! [7]
+void TestWidget::switchText()
+{
+ sampleIndex = (sampleIndex + 1) % textSamples.size();
+ elidedText->setText(textSamples.at(sampleIndex));
+}
+//! [7]
+
+//! [8]
+void TestWidget::onWidthChanged(int width)
+{
+ elidedText->setFixedWidth(width);
+}
+
+void TestWidget::onHeightChanged(int height)
+{
+ elidedText->setFixedHeight(height);
+}
+//! [8]
+
+
diff --git a/examples/widgets/elidedlabel/testwidget.h b/examples/widgets/elidedlabel/testwidget.h
new file mode 100644
index 0000000000..ed4de95107
--- /dev/null
+++ b/examples/widgets/elidedlabel/testwidget.h
@@ -0,0 +1,36 @@
+#ifndef TESTWIDGET_H
+#define TESTWIDGET_H
+
+#include <QWidget>
+#include <QStringList>
+#include <QSlider>
+#include <QComboBox>
+
+class ElidedLabel;
+
+//! [0]
+class TestWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ TestWidget(QWidget *parent = 0);
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+
+private slots:
+ void switchText();
+ void onWidthChanged(int width);
+ void onHeightChanged(int height);
+
+private:
+ int sampleIndex;
+ QStringList textSamples;
+ ElidedLabel *elidedText;
+ QSlider *heightSlider;
+ QSlider *widthSlider;
+};
+//! [0]
+
+#endif // TESTWIDGET_H
diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf
index adcdbb73e9..d451d29f7c 100644
--- a/mkspecs/features/default_pre.prf
+++ b/mkspecs/features/default_pre.prf
@@ -26,7 +26,11 @@ exists($$_PRO_FILE_PWD_/sync.profile) {
message("Running syncqt for $$PRO_BASENAME in $$OUT_PWD")
qtPrepareTool(QMAKE_SYNCQT, syncqt)
- system("$$QMAKE_SYNCQT $$QTFWD -outdir $$OUT_PWD $$_PRO_FILE_PWD_")
+ system("$$QMAKE_SYNCQT $$QTFWD -outdir $$OUT_PWD $$_PRO_FILE_PWD_") {
+ # success! Nothing to do
+ } else {
+ error("Failed to run: $$QMAKE_SYNCQT $$QTFWD -outdir $$OUT_PWD $$_PRO_FILE_PWD_")
+ }
unset(QTFWD)
unset(PRO_BASENAME)
}
diff --git a/mkspecs/features/designer.prf b/mkspecs/features/designer.prf
index 63a7e76a34..843a118a9a 100644
--- a/mkspecs/features/designer.prf
+++ b/mkspecs/features/designer.prf
@@ -1,7 +1,6 @@
-QT += xml
-contains(QT_CONFIG, script): QT += script
+QT += xml uilib
+!isEmpty(QT.script.name): QT += script
+!isEmpty(QT.designer.name): QT += designer
qt:load(qt)
plugin:DEFINES += QDESIGNER_EXPORT_WIDGETS
-
-qtAddLibrary(QtDesigner, true)
diff --git a/mkspecs/features/qmltestcase.prf b/mkspecs/features/qmltestcase.prf
index a3d66e659e..5e60185493 100644
--- a/mkspecs/features/qmltestcase.prf
+++ b/mkspecs/features/qmltestcase.prf
@@ -1,20 +1,6 @@
CONFIG += testcase
-!symbian {
- INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtQuickTest
-} else {
- load(data_caging_paths)
-
- INCLUDEPATH+=$$MW_LAYER_PUBLIC_EXPORT_PATH(QtQuickTest)
-}
-
-QT += declarative
-
-win32:CONFIG(debug, debug|release) {
- LIBS += -lQtQuickTest$${QT_LIBINFIX}d
-} else {
- LIBS += -lQtQuickTest$${QT_LIBINFIX}
-}
+QT += declarative qmltest
# If the .pro file specified an IMPORTPATH, then add that to
# the command-line when the test is run.
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index c611096147..3791c9565a 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -160,7 +160,7 @@ for(QTLIB, $$list($$lower($$unique(QT)))) {
# add include paths for all .depends, since module/application might need f.ex. template specializations etc.
QT_DEPENDS -= $$QT
-for(QTLIB, $$list($$lower($$unique(QT_DEPENDS)))):INCLUDEPATH += $$INCLUDEPATH $$eval(QT.$${QTLIB}.includes)
+for(QTLIB, $$list($$lower($$unique(QT_DEPENDS)))):INCLUDEPATH *= $$INCLUDEPATH $$eval(QT.$${QTLIB}.includes)
!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
new file mode 100644
index 0000000000..c4eaab8147
--- /dev/null
+++ b/mkspecs/features/qt_plugin.prf
@@ -0,0 +1,41 @@
+TEMPLATE = lib
+isEmpty(QT_MAJOR_VERSION) {
+ VERSION=5.0.0
+} else {
+ VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
+}
+CONFIG += qt plugin
+
+win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
+TARGET = $$qtLibraryTarget($$TARGET)
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+
+load(qt_targets)
+
+wince*:LIBS += $$QMAKE_LIBS_GUI
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY = All -Tcb
+ TARGET = $${TARGET}$${QT_LIBINFIX}
+ load(armcc_warnings)
+
+ # Make partial upgrade SIS file for Qt plugin dll's
+ # Partial upgrade SIS file
+ vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ " " \
+ "; Unique Vendor name" \
+ ":\"Nokia, Qt\"" \
+ " "
+ isEmpty(QT_LIBINFIX): PARTIAL_UPGRADE_UID = 0x2001E61C
+ else: PARTIAL_UPGRADE_UID = 0xE001E61C
+
+ pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \
+ "$${LITERAL_HASH}{\"$${TARGET}\"}, ($$PARTIAL_UPGRADE_UID), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU"
+ partial_upgrade.pkg_prerules = pu_header vendorinfo
+ partial_upgrade.files = $$QMAKE_LIBDIR_QT/$${TARGET}.dll
+ partial_upgrade.path = c:/sys/bin
+ DEPLOYMENT += partial_upgrade
+}
diff --git a/qtbase.pro b/qtbase.pro
index 375308a5cc..95f497fef4 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -10,26 +10,34 @@ cross_compile: CONFIG += nostrip
module_qtbase_tests.subdir = tests
module_qtbase_tests.target = module-qtbase-tests
module_qtbase_tests.depends = module_qtbase_src
-module_qtbase_tests.CONFIG = no_default_target no_default_install
+module_qtbase_tests.CONFIG = no_default_install
#process the projects
-for(PROJECT, $$list($$lower($$unique(QT_BUILD_PARTS)))) {
- isEqual(PROJECT, examples) {
- SUBDIRS += examples
- } else:isEqual(PROJECT, demos) {
- SUBDIRS += demos
- } else:isEqual(PROJECT, tests) {
- module_qtbase_tests.CONFIG -= no_default_target
- } else:isEqual(PROJECT, libs) {
- include(src/src.pro)
- } else:isEqual(PROJECT, qmake) {
-# SUBDIRS += qmake
- } else {
- message(Unknown PROJECT: $$PROJECT)
- }
+PROJECTS=$$eval($$list($$lower($$unique(QT_BUILD_PARTS))))
+# note that the order matters for these blocks!
+contains(PROJECTS, qmake) {
+ PROJECTS -= qmake
+ # nothing to be done
+}
+contains(PROJECTS, libs) {
+ PROJECTS -= libs
+ include(src/src.pro)
+}
+contains(PROJECTS, examples) {
+ PROJECTS -= examples
+ SUBDIRS += examples
+}
+contains(PROJECTS, demos) {
+ PROJECTS -= demos
+ SUBDIRS += demos
+}
+contains(PROJECTS, tests) {
+ PROJECTS -= tests
+ SUBDIRS += module_qtbase_tests
+}
+!isEmpty(PROJECTS) {
+ message(Unknown PROJECTS: $$PROJECTS)
}
-
-SUBDIRS += module_qtbase_tests
!symbian: confclean.depends += clean
confclean.commands =
diff --git a/src/corelib/concurrent/qtconcurrentcompilertest.h b/src/corelib/concurrent/qtconcurrentcompilertest.h
index 884badbfbd..c139c7a8b2 100644
--- a/src/corelib/concurrent/qtconcurrentcompilertest.h
+++ b/src/corelib/concurrent/qtconcurrentcompilertest.h
@@ -57,6 +57,20 @@ QT_MODULE(Core)
# define QT_TYPENAME typename
#endif
+namespace QtPrivate {
+
+template<class T>
+class HasResultType {
+ typedef char Yes;
+ typedef void *No;
+ template<typename U> static Yes test(int, const typename U::result_type * = 0);
+ template<typename U> static No test(double);
+public:
+ enum { Value = (sizeof(test<T>(0)) == sizeof(Yes)) };
+};
+
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h
index a79ad1c305..4bf2736e6c 100644
--- a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h
+++ b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h
@@ -195,17 +195,10 @@ QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func
return QtConcurrent::ConstMemberFunctionWrapper<T, C>(func);
}
-
-template<typename T>
-void *lazyResultType_helper(int, typename T::result_type * = 0);
-template<typename T>
-char lazyResultType_helper(double);
-
-template <typename Functor, bool foo = sizeof(lazyResultType_helper<Functor>(0)) != sizeof(void*)>
+template <typename Functor, bool foo = HasResultType<Functor>::Value>
struct LazyResultType { typedef typename Functor::result_type Type; };
template <typename Functor>
-struct LazyResultType<Functor, true> { typedef void Type; };
-
+struct LazyResultType<Functor, false> { typedef void Type; };
template <class T>
struct ReduceResultType;
diff --git a/src/corelib/concurrent/qtconcurrentrun.h b/src/corelib/concurrent/qtconcurrentrun.h
index 8611fba361..ef51b2adcb 100644
--- a/src/corelib/concurrent/qtconcurrentrun.h
+++ b/src/corelib/concurrent/qtconcurrentrun.h
@@ -71,63 +71,114 @@ namespace QtConcurrent {
template <typename T>
QFuture<T> run(T (*functionPointer)())
{
- return (new QT_TYPENAME SelectStoredFunctorCall0<T, T (*)()>::type(functionPointer))->start();
+ return (new StoredFunctorCall0<T, T (*)()>(functionPointer))->start();
}
template <typename T, typename Param1, typename Arg1>
QFuture<T> run(T (*functionPointer)(Param1), const Arg1 &arg1)
{
- return (new QT_TYPENAME SelectStoredFunctorCall1<T, T (*)(Param1), Arg1>::type(functionPointer, arg1))->start();
+ return (new StoredFunctorCall1<T, T (*)(Param1), Arg1>(functionPointer, arg1))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2>
QFuture<T> run(T (*functionPointer)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2)
{
- return (new QT_TYPENAME SelectStoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>::type(functionPointer, arg1, arg2))->start();
+ return (new StoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>(functionPointer, arg1, arg2))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3>
QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
- return (new QT_TYPENAME SelectStoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>::type(functionPointer, arg1, arg2, arg3))->start();
+ return (new StoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4>
QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
- return (new QT_TYPENAME SelectStoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>::type(functionPointer, arg1, arg2, arg3, arg4))->start();
+ return (new StoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5>
QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
- return (new QT_TYPENAME SelectStoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
+ return (new StoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
}
+#ifdef Q_COMPILER_DECLTYPE
+
+template <typename Functor>
+auto run(Functor functor) -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())> >::Type
+{
+ typedef decltype(functor()) result_type;
+ return (new StoredFunctorCall0<result_type, Functor>(functor))->start();
+}
+
+template <typename Functor, typename Arg1>
+auto run(Functor functor, const Arg1 &arg1)
+ -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))> >::Type
+{
+ typedef decltype(functor(arg1)) result_type;
+ return (new StoredFunctorCall1<result_type, Functor, Arg1>(functor, arg1))->start();
+}
+
+template <typename Functor, typename Arg1, typename Arg2>
+auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2)
+ -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))> >::Type
+{
+ typedef decltype(functor(arg1, arg2)) result_type;
+ return (new StoredFunctorCall2<result_type, Functor, Arg1, Arg2>(functor, arg1, arg2))->start();
+}
+
+template <typename Functor, typename Arg1, typename Arg2, typename Arg3>
+auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
+ -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))> >::Type
+{
+ typedef decltype(functor(arg1, arg2, arg3)) result_type;
+ return (new StoredFunctorCall3<result_type, Functor, Arg1, Arg2, Arg3>(functor, arg1, arg2, arg3))->start();
+}
+
+template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
+ -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))> >::Type
+{
+ typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type;
+ return (new StoredFunctorCall4<result_type, Functor, Arg1, Arg2, Arg3, Arg4>(functor, arg1, arg2, arg3, arg4))->start();
+}
+
+template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
+auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
+ -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))> >::Type
+{
+ typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type;
+ return (new StoredFunctorCall5<result_type, Functor, Arg1, Arg2, Arg3, Arg4, Arg5>(functor, arg1, arg2, arg3, arg4, arg5))->start();
+}
+
+#endif
+
template <typename FunctionObject>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject)
{
- return (new QT_TYPENAME SelectStoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>::type(functionObject))->start();
+ return (new StoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>(functionObject))->start();
}
template <typename FunctionObject, typename Arg1>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1)
{
- return (new QT_TYPENAME SelectStoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start();
+ return (new StoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>(functionObject, arg1))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2)
{
- return (new QT_TYPENAME SelectStoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start();
+ return (new StoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>(functionObject, arg1, arg2))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
- return (new QT_TYPENAME SelectStoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start();
+ return (new StoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>(functionObject, arg1, arg2, arg3))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
- return (new QT_TYPENAME SelectStoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start();
+ return (new StoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>(functionObject, arg1, arg2, arg3, arg4))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
- return (new QT_TYPENAME SelectStoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
+ return (new StoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename FunctionObject>
diff --git a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h
index c61f9b8014..9beb0b9c35 100644
--- a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h
+++ b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h
@@ -66,10 +66,10 @@ struct StoredFunctorCall0: public RunFunctionTask<T>
};
-template <typename T, typename FunctionPointer>
-struct VoidStoredFunctorCall0: public RunFunctionTask<T>
+template <typename FunctionPointer>
+struct StoredFunctorCall0<void, FunctionPointer>: public RunFunctionTask<void>
{
- inline VoidStoredFunctorCall0(FunctionPointer _function)
+ inline StoredFunctorCall0(FunctionPointer _function)
: function(_function) {}
void runFunctor() { function(); }
FunctionPointer function;
@@ -77,13 +77,6 @@ struct VoidStoredFunctorCall0: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer>
-struct SelectStoredFunctorCall0
-{
- typedef typename SelectSpecialization<T>::template
- Type<StoredFunctorCall0 <T, FunctionPointer>,
- VoidStoredFunctorCall0<T, FunctionPointer> >::type type;
-};
-template <typename T, typename FunctionPointer>
struct StoredFunctorPointerCall0: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall0(FunctionPointer * _function)
@@ -276,10 +269,10 @@ struct StoredFunctorCall1: public RunFunctionTask<T>
Arg1 arg1;
};
-template <typename T, typename FunctionPointer, typename Arg1>
-struct VoidStoredFunctorCall1: public RunFunctionTask<T>
+template <typename FunctionPointer, typename Arg1>
+struct StoredFunctorCall1<void, FunctionPointer, Arg1>: public RunFunctionTask<void>
{
- inline VoidStoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1)
+ inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1)
: function(_function), arg1(_arg1) {}
void runFunctor() { function(arg1); }
FunctionPointer function;
@@ -287,13 +280,6 @@ struct VoidStoredFunctorCall1: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer, typename Arg1>
-struct SelectStoredFunctorCall1
-{
- typedef typename SelectSpecialization<T>::template
- Type<StoredFunctorCall1 <T, FunctionPointer, Arg1>,
- VoidStoredFunctorCall1<T, FunctionPointer, Arg1> >::type type;
-};
-template <typename T, typename FunctionPointer, typename Arg1>
struct StoredFunctorPointerCall1: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1)
@@ -486,10 +472,10 @@ struct StoredFunctorCall2: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2;
};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
-struct VoidStoredFunctorCall2: public RunFunctionTask<T>
+template <typename FunctionPointer, typename Arg1, typename Arg2>
+struct StoredFunctorCall2<void, FunctionPointer, Arg1, Arg2>: public RunFunctionTask<void>
{
- inline VoidStoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2)
+ inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2)
: function(_function), arg1(_arg1), arg2(_arg2) {}
void runFunctor() { function(arg1, arg2); }
FunctionPointer function;
@@ -497,13 +483,6 @@ struct VoidStoredFunctorCall2: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
-struct SelectStoredFunctorCall2
-{
- typedef typename SelectSpecialization<T>::template
- Type<StoredFunctorCall2 <T, FunctionPointer, Arg1, Arg2>,
- VoidStoredFunctorCall2<T, FunctionPointer, Arg1, Arg2> >::type type;
-};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
struct StoredFunctorPointerCall2: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2)
@@ -696,10 +675,10 @@ struct StoredFunctorCall3: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
-struct VoidStoredFunctorCall3: public RunFunctionTask<T>
+template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
+struct StoredFunctorCall3<void, FunctionPointer, Arg1, Arg2, Arg3>: public RunFunctionTask<void>
{
- inline VoidStoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
+ inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {}
void runFunctor() { function(arg1, arg2, arg3); }
FunctionPointer function;
@@ -707,13 +686,6 @@ struct VoidStoredFunctorCall3: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
-struct SelectStoredFunctorCall3
-{
- typedef typename SelectSpecialization<T>::template
- Type<StoredFunctorCall3 <T, FunctionPointer, Arg1, Arg2, Arg3>,
- VoidStoredFunctorCall3<T, FunctionPointer, Arg1, Arg2, Arg3> >::type type;
-};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
struct StoredFunctorPointerCall3: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
@@ -906,10 +878,10 @@ struct StoredFunctorCall4: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-struct VoidStoredFunctorCall4: public RunFunctionTask<T>
+template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+struct StoredFunctorCall4<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4>: public RunFunctionTask<void>
{
- inline VoidStoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
+ inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {}
void runFunctor() { function(arg1, arg2, arg3, arg4); }
FunctionPointer function;
@@ -917,13 +889,6 @@ struct VoidStoredFunctorCall4: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-struct SelectStoredFunctorCall4
-{
- typedef typename SelectSpecialization<T>::template
- Type<StoredFunctorCall4 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4>,
- VoidStoredFunctorCall4<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4> >::type type;
-};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct StoredFunctorPointerCall4: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
@@ -1116,10 +1081,10 @@ struct StoredFunctorCall5: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
-struct VoidStoredFunctorCall5: public RunFunctionTask<T>
+template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
+struct StoredFunctorCall5<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>: public RunFunctionTask<void>
{
- inline VoidStoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
+ inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer function;
@@ -1127,13 +1092,6 @@ struct VoidStoredFunctorCall5: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
-struct SelectStoredFunctorCall5
-{
- typedef typename SelectSpecialization<T>::template
- Type<StoredFunctorCall5 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>,
- VoidStoredFunctorCall5<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5> >::type type;
-};
-template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
struct StoredFunctorPointerCall5: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
@@ -1316,6 +1274,33 @@ struct SelectStoredConstMemberFunctionPointerCall5
Type<StoredConstMemberFunctionPointerCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>,
VoidStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type;
};
+
+template <typename T, typename Functor>
+class StoredFunctorCall : public RunFunctionTask<T>
+{
+public:
+ StoredFunctorCall(const Functor &f) : functor(f) { }
+ void runFunctor()
+ {
+ this->result = functor();
+ }
+private:
+ Functor functor;
+};
+template <typename Functor>
+class StoredFunctorCall<void, Functor> : public RunFunctionTask<void>
+{
+public:
+ StoredFunctorCall(const Functor &f) : functor(f) { }
+ void runFunctor()
+ {
+ functor();
+ }
+private:
+ Functor functor;
+};
+
+
} //namespace QtConcurrent
#endif // qdoc
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 4e3f4e312f..8a17af55f2 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -363,6 +363,11 @@ template <typename T> inline void qToLittleEndian(T src, uchar *dest)
#endif // Q_BYTE_ORDER == Q_BIG_ENDIAN
+template <> inline quint8 qbswap<quint8>(quint8 source)
+{
+ return source;
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index fda58336eb..79defc4277 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -425,14 +425,11 @@ namespace QT_NAMESPACE {}
#if defined(Q_CC_MSVC) && _MSC_VER >= 1600
# define Q_COMPILER_RVALUE_REFS
-# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_LAMBDA
-//# define Q_COMPILER_VARIADIC_TEMPLATES
-//# define Q_COMPILER_CLASS_ENUM
-//# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
-//# define Q_COMPILER_UNICODE_STRINGS
-//# define Q_COMPILER_EXTERN_TEMPLATES
+# define Q_COMPILER_DECLTYPE
+// MSCV has std::initilizer_list, but do not support the braces initialization
+//# define Q_COMPILER_INITIALIZER_LISTS
# endif
@@ -524,6 +521,7 @@ namespace QT_NAMESPACE {}
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++0x features supported in GCC 4.3: */
# define Q_COMPILER_RVALUE_REFS
+# define Q_COMPILER_DECLTYPE
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++0x features supported in GCC 4.4: */
@@ -791,6 +789,7 @@ namespace QT_NAMESPACE {}
# if __INTEL_COMPILER >= 1100
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_EXTERN_TEMPLATES
+# define Q_COMPILER_DECLTYPE
# elif __INTEL_COMPILER >= 1200
# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
@@ -2792,6 +2791,12 @@ QT_LICENSED_MODULE(Sensors)
# define QT_NO_RAWFONT
#endif
+namespace QtPrivate {
+//like std::enable_if
+template <bool B, typename T = void> struct QEnableIf;
+template <typename T> struct QEnableIf<true, T> { typedef T Type; };
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 9f59c6e8e9..09611e67f4 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1121,7 +1121,7 @@
\value WA_X11NetWmWindowTypeToolBar Adds _NET_WM_WINDOW_TYPE_TOOLBAR to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automaticaly sets this
+ has no effect on non-X11 platforms. \note Qt automatically sets this
attribute for QToolBar.
\value WA_X11NetWmWindowTypeMenu Adds _NET_WM_WINDOW_TYPE_MENU to the
@@ -2593,7 +2593,7 @@
\value ImhFormattedNumbersOnly Only number input is allowed. This includes decimal point and minus sign.
\value ImhUppercaseOnly Only upper case letter input is allowed.
\value ImhLowercaseOnly Only lower case letter input is allowed.
- \value ImhDialableCharactersOnly Only characters suitable for phone dialling are allowed.
+ \value ImhDialableCharactersOnly Only characters suitable for phone dialing are allowed.
\value ImhEmailCharactersOnly Only characters suitable for email addresses are allowed.
\value ImhUrlCharactersOnly Only characters suitable for URLs are allowed.
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index f67600d750..e411f8f643 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -24,6 +24,8 @@ HEADERS += \
io/qresource_p.h \
io/qresource_iterator_p.h \
io/qurl.h \
+ io/qurltlds_p.h \
+ io/qtldurl_p.h \
io/qsettings.h \
io/qsettings_p.h \
io/qfsfileengine.h \
@@ -41,6 +43,7 @@ SOURCES += \
io/qbuffer.cpp \
io/qdatastream.cpp \
io/qdataurl.cpp \
+ io/qtldurl.cpp \
io/qdebug.cpp \
io/qdir.cpp \
io/qdiriterator.cpp \
diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp
new file mode 100644
index 0000000000..7db4bbddd5
--- /dev/null
+++ b/src/corelib/io/qtldurl.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatformdefs.h"
+#include "qurl.h"
+#include "private/qurltlds_p.h"
+#include "private/qtldurl_p.h"
+#include "QtCore/qstringlist.h"
+
+QT_BEGIN_NAMESPACE
+
+static bool containsTLDEntry(const QString &entry)
+{
+ int index = qHash(entry) % tldCount;
+ int currentDomainIndex = tldIndices[index];
+ while (currentDomainIndex < tldIndices[index+1]) {
+ QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex);
+ if (currentEntry == entry)
+ return true;
+ currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0
+ }
+ return false;
+}
+
+/*!
+ \internal
+
+ Return the top-level-domain per Qt's copy of the Mozilla public suffix list of
+ \a domain.
+*/
+
+Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain)
+{
+ QStringList sections = domain.toLower().split(QLatin1Char('.'), QString::SkipEmptyParts);
+ if (sections.isEmpty())
+ return QString();
+
+ QString level, tld;
+ for (int j = sections.count() - 1; j >= 0; --j) {
+ level.prepend(QLatin1Char('.') + sections.at(j));
+ if (qIsEffectiveTLD(level.right(level.size() - 1)))
+ tld = level;
+ }
+ return tld;
+}
+
+/*!
+ \internal
+
+ Return true if \a domain is a top-level-domain per Qt's copy of the Mozilla public suffix list.
+*/
+
+Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain)
+{
+ // for domain 'foo.bar.com':
+ // 1. return if TLD table contains 'foo.bar.com'
+ if (containsTLDEntry(domain))
+ return true;
+
+ if (domain.contains(QLatin1Char('.'))) {
+ int count = domain.size() - domain.indexOf(QLatin1Char('.'));
+ QString wildCardDomain;
+ wildCardDomain.reserve(count + 1);
+ wildCardDomain.append(QLatin1Char('*'));
+ wildCardDomain.append(domain.right(count));
+ // 2. if table contains '*.bar.com',
+ // test if table contains '!foo.bar.com'
+ if (containsTLDEntry(wildCardDomain)) {
+ QString exceptionDomain;
+ exceptionDomain.reserve(domain.size() + 1);
+ exceptionDomain.append(QLatin1Char('!'));
+ exceptionDomain.append(domain);
+ return (! containsTLDEntry(exceptionDomain));
+ }
+ }
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h
new file mode 100644
index 0000000000..152ffa0f63
--- /dev/null
+++ b/src/corelib/io/qtldurl_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTLDURL_P_H
+#define QTLDURL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qDecodeDataUrl. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "QtCore/qurl.h"
+#include "QtCore/qstring.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain);
+Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain);
+
+QT_END_NAMESPACE
+
+#endif // QDATAURL_P_H
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 92ce5ab794..881365678f 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -192,7 +192,9 @@
#if defined QT3_SUPPORT
#include "qfileinfo.h"
#endif
-
+#ifndef QT_BOOTSTRAPPED
+#include "qtldurl_p.h"
+#endif
#if defined(Q_OS_WINCE_WM)
#pragma optimize("g", off)
#endif
@@ -5593,6 +5595,21 @@ bool QUrl::hasFragment() const
}
/*!
+ \since 4.8
+
+ Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net).
+ Note that the return value is prefixed with a '.' unless the
+ URL does not contain a valid TLD, in which case the function returns
+ an empty string.
+*/
+#ifndef QT_BOOTSTRAPPED
+QString QUrl::topLevelDomain() const
+{
+ return qTopLevelDomain(host());
+}
+#endif
+
+/*!
Returns the result of the merge of this URL with \a relative. This
URL is used as a base to convert \a relative to an absolute URL.
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 96b23d179d..d57a0c77df 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -181,6 +181,9 @@ public:
void setEncodedFragment(const QByteArray &fragment);
QByteArray encodedFragment() const;
bool hasFragment() const;
+#ifndef QT_BOOTSTRAPPED
+ QString topLevelDomain() const;
+#endif
QUrl resolved(const QUrl &relative) const;
diff --git a/src/network/access/qnetworkcookiejartlds_p.h b/src/corelib/io/qurltlds_p.h
index b06d881131..f4f525ced7 100644
--- a/src/network/access/qnetworkcookiejartlds_p.h
+++ b/src/corelib/io/qurltlds_p.h
@@ -38,15 +38,15 @@
// the terms of any one of the MPL, the GPL or the LGPL.
//
-#ifndef QNETWORKCOOKIEJARTLD_P_H
-#define QNETWORKCOOKIEJARTLD_P_H
+#ifndef QURLTLD_P_H
+#define QURLTLD_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
-// of the Network Access framework. This header file may change from
+// of the Network Access and Core framework. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
// note to maintainer:
// this file should be updated before each release ->
// for instructions see the program at
-// util/network/cookiejar-generateTLDs
+// util/corelib/qurl-generateTLDs
static const quint16 tldCount = 3949;
static const quint16 tldIndices[] = {
@@ -6478,4 +6478,4 @@ static const char tldData[] = {
QT_END_NAMESPACE
-#endif // QNETWORKCOOKIEJARTLD_P_H
+#endif // QURLTLD_P_H
diff --git a/src/network/access/qnetworkcookiejartlds_p.h.INFO b/src/corelib/io/qurltlds_p.h.INFO
index 57a8d0e0cc..5781c2c678 100644
--- a/src/network/access/qnetworkcookiejartlds_p.h.INFO
+++ b/src/corelib/io/qurltlds_p.h.INFO
@@ -1,15 +1,15 @@
-The file qnetworkcookiejartlds_p.h is generated from the Public Suffix
+The file qurltlds_p.h is generated from the Public Suffix
List (see [1] and [2]), by the program residing at
-util/network/cookiejar-generateTLDs in the Qt source tree.
+util/corelib/qurl-generateTLDs in the Qt source tree.
That program generates a character array and an index array from the
list to provide fast lookups of elements within C++.
-Those arrays in qnetworkcookiejartlds_p.h are derived from the Public
+Those arrays in qurltlds_p.h are derived from the Public
Suffix List ([2]), which was originally provided by
Jo Hermans <jo.hermans@gmail.com>.
-The file qnetworkcookiejartlds_p.h was last generated Friday,
+The file qurltlds_p.h was last generated Friday,
November 19th 15:24 2010.
----
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 9cd353a7da..eb29e6eba8 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -42,9 +42,96 @@
#include "quuid.h"
#include "qdatastream.h"
+#include "qendian.h"
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_QUUID_STRING
+template <class Char, class Integral>
+void _q_toHex(Char *&dst, Integral value)
+{
+ static const char digits[] = "0123456789abcdef";
+
+ value = qToBigEndian(value);
+
+ const char* p = reinterpret_cast<const char*>(&value);
+
+ for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) {
+ uint j = (p[i] >> 4) & 0xf;
+ dst[0] = Char(digits[j]);
+ j = p[i] & 0xf;
+ dst[1] = Char(digits[j]);
+ }
+}
+
+template <class Char, class Integral>
+bool _q_fromHex(const Char *&src, Integral &value)
+{
+ value = 0;
+
+ for (uint i = 0; i < sizeof(Integral) * 2; ++i) {
+ int ch = *src++;
+ int tmp;
+ if (ch >= '0' && ch <= '9')
+ tmp = ch - '0';
+ else if (ch >= 'a' && ch <= 'f')
+ tmp = ch - 'a' + 10;
+ else if (ch >= 'A' && ch <= 'F')
+ tmp = ch - 'A' + 10;
+ else
+ return false;
+
+ value = value * 16 + tmp;
+ }
+
+ return true;
+}
+
+template <class Char>
+void _q_uuidToHex(Char *&dst, const uint &d1, const ushort &d2, const ushort &d3, const uchar (&d4)[8])
+{
+ *dst++ = Char('{');
+ _q_toHex(dst, d1);
+ *dst++ = Char('-');
+ _q_toHex(dst, d2);
+ *dst++ = Char('-');
+ _q_toHex(dst, d3);
+ *dst++ = Char('-');
+ for (int i = 0; i < 2; i++)
+ _q_toHex(dst, d4[i]);
+ *dst++ = Char('-');
+ for (int i = 2; i < 8; i++)
+ _q_toHex(dst, d4[i]);
+ *dst = Char('}');
+}
+
+template <class Char>
+bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&d4)[8])
+{
+ if (*src == Char('{'))
+ src++;
+ if (!_q_fromHex(src, d1)
+ || *src++ != Char('-')
+ || !_q_fromHex(src, d2)
+ || *src++ != Char('-')
+ || !_q_fromHex(src, d3)
+ || *src++ != Char('-')
+ || !_q_fromHex(src, d4[0])
+ || !_q_fromHex(src, d4[1])
+ || *src++ != Char('-')
+ || !_q_fromHex(src, d4[2])
+ || !_q_fromHex(src, d4[3])
+ || !_q_fromHex(src, d4[4])
+ || !_q_fromHex(src, d4[5])
+ || !_q_fromHex(src, d4[6])
+ || !_q_fromHex(src, d4[7])) {
+ return false;
+ }
+
+ return true;
+}
+#endif
+
/*!
\class QUuid
\brief The QUuid class stores a Universally Unique Identifier (UUID).
@@ -231,60 +318,112 @@ QT_BEGIN_NAMESPACE
*/
QUuid::QUuid(const QString &text)
{
- bool ok;
- if (text.isEmpty()) {
+ if (text.length() < 36) {
*this = QUuid();
return;
}
- QString temp = text.toUpper();
- if (temp[0] != QLatin1Char('{'))
- temp = QLatin1Char('{') + text;
- if (text[(int)text.length()-1] != QLatin1Char('}'))
- temp += QLatin1Char('}');
-
- data1 = temp.mid(1, 8).toULongLong(&ok, 16);
- if (!ok) {
+
+ const ushort *data = reinterpret_cast<const ushort *>(text.unicode());
+
+ if (*data == '{' && text.length() < 37) {
*this = QUuid();
return;
}
- data2 = temp.mid(10, 4).toUInt(&ok, 16);
- if (!ok) {
+ if (!_q_uuidFromHex(data, data1, data2, data3, data4)) {
*this = QUuid();
return;
}
- data3 = temp.mid(15, 4).toUInt(&ok, 16);
- if (!ok) {
+}
+
+/*!
+ \internal
+*/
+QUuid::QUuid(const char *text)
+{
+ if (!text) {
*this = QUuid();
return;
}
- data4[0] = temp.mid(20, 2).toUInt(&ok, 16);
- if (!ok) {
+
+ if (!_q_uuidFromHex(text, data1, data2, data3, data4)) {
*this = QUuid();
return;
}
- data4[1] = temp.mid(22, 2).toUInt(&ok, 16);
- if (!ok) {
+}
+
+/*!
+ Creates a QUuid object from the QByteArray \a text, which must be
+ formatted as five hex fields separated by '-', e.g.,
+ "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex
+ digit. The curly braces shown here are optional, but it is normal to
+ include them. If the conversion fails, a null UUID is created. See
+ toByteArray() for an explanation of how the five hex fields map to the
+ public data members in QUuid.
+
+ \since 4.8
+
+ \sa toByteArray(), QUuid()
+*/
+QUuid::QUuid(const QByteArray &text)
+{
+ if (text.length() < 36) {
*this = QUuid();
return;
}
- for (int i = 2; i<8; i++) {
- data4[i] = temp.mid(25 + (i-2)*2, 2).toUShort(&ok, 16);
- if (!ok) {
- *this = QUuid();
- return;
- }
+
+ const char *data = text.constData();
+
+ if (*data == '{' && text.length() < 37) {
+ *this = QUuid();
+ return;
+ }
+
+ if (!_q_uuidFromHex(data, data1, data2, data3, data4)) {
+ *this = QUuid();
+ return;
}
}
+#endif
/*!
- \internal
+ Creates a QUuid object from the binary representation of the UUID, as
+ specified by RFC 4122 section 4.1.2. See toRfc4122() for a further
+ explanation of the order of bytes required.
+
+ The byte array accepted is NOT a human readable format.
+
+ If the conversion fails, a null UUID is created.
+
+ \since 4.8
+
+ \sa toRfc4122(), QUuid()
*/
-QUuid::QUuid(const char *text)
+QUuid QUuid::fromRfc4122(const QByteArray &bytes)
{
- *this = QUuid(QString::fromLatin1(text));
+ if (bytes.isEmpty() || bytes.length() != 16)
+ return QUuid();
+
+ uint d1;
+ ushort d2, d3;
+ uchar d4[8];
+
+ const uchar *data = reinterpret_cast<const uchar *>(bytes.constData());
+
+ d1 = qFromBigEndian<quint32>(data);
+ data += sizeof(quint32);
+ d2 = qFromBigEndian<quint16>(data);
+ data += sizeof(quint16);
+ d3 = qFromBigEndian<quint16>(data);
+ data += sizeof(quint16);
+
+ for (int i = 0; i < 8; ++i) {
+ d4[i] = *(data);
+ data++;
+ }
+
+ return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
}
-#endif
/*!
\fn bool QUuid::operator==(const QUuid &other) const
@@ -308,11 +447,6 @@ QUuid::QUuid(const char *text)
\sa toString()
*/
-static QString uuidhex(uint data, int digits)
-{
- return QString::number(data, 16).rightJustified(digits, QLatin1Char('0'));
-}
-
/*!
Returns the string representation of this QUuid. The string is
formatted as five hex fields separated by '-' and enclosed in
@@ -349,25 +483,114 @@ static QString uuidhex(uint data, int digits)
*/
QString QUuid::toString() const
{
- QString result;
-
- QChar dash = QLatin1Char('-');
- result = QLatin1Char('{') + uuidhex(data1,8);
- result += dash;
- result += uuidhex(data2,4);
- result += dash;
- result += uuidhex(data3,4);
- result += dash;
- result += uuidhex(data4[0],2);
- result += uuidhex(data4[1],2);
- result += dash;
- for (int i = 2; i < 8; i++)
- result += uuidhex(data4[i],2);
+ QString result(38, Qt::Uninitialized);
+ ushort *data = (ushort *)result.unicode();
+
+ _q_uuidToHex(data, data1, data2, data3, data4);
- return result + QLatin1Char('}');
+ return result;
+}
+
+/*!
+ Returns the binary representation of this QUuid. The byte array is
+ formatted as five hex fields separated by '-' and enclosed in
+ curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where
+ 'x' is a hex digit. From left to right, the five hex fields are
+ obtained from the four public data members in QUuid as follows:
+
+ \table
+ \header
+ \o Field #
+ \o Source
+
+ \row
+ \o 1
+ \o data1
+
+ \row
+ \o 2
+ \o data2
+
+ \row
+ \o 3
+ \o data3
+
+ \row
+ \o 4
+ \o data4[0] .. data4[1]
+
+ \row
+ \o 5
+ \o data4[2] .. data4[7]
+
+ \endtable
+
+ \since 4.8
+*/
+QByteArray QUuid::toByteArray() const
+{
+ QByteArray result(38, Qt::Uninitialized);
+ char *data = result.data();
+
+ _q_uuidToHex(data, data1, data2, data3, data4);
+
+ return result;
}
#endif
+/*!
+ Returns the binary representation of this QUuid. The byte array is in big
+ endian format, and formatted according to RFC 4122, section 4.1.2 -
+ "Layout and byte order".
+
+ The order is as follows:
+
+ \table
+ \header
+ \o Field #
+ \o Source
+
+ \row
+ \o 1
+ \o data1
+
+ \row
+ \o 2
+ \o data2
+
+ \row
+ \o 3
+ \o data3
+
+ \row
+ \o 4
+ \o data4[0] .. data4[7]
+
+ \endtable
+
+ \since 4.8
+*/
+QByteArray QUuid::toRfc4122() const
+{
+ // we know how many bytes a UUID has, I hope :)
+ QByteArray bytes(16, Qt::Uninitialized);
+ uchar *data = reinterpret_cast<uchar*>(bytes.data());
+
+ qToBigEndian(data1, data);
+ data += sizeof(quint32);
+ qToBigEndian(data2, data);
+ data += sizeof(quint16);
+ qToBigEndian(data3, data);
+ data += sizeof(quint16);
+
+ for (int i = 0; i < 8; ++i) {
+ *(data) = data4[i];
+ data++;
+ }
+
+ return bytes;
+}
+
#ifndef QT_NO_DATASTREAM
/*!
\relates QUuid
@@ -375,11 +598,30 @@ QString QUuid::toString() const
*/
QDataStream &operator<<(QDataStream &s, const QUuid &id)
{
- s << (quint32)id.data1;
- s << (quint16)id.data2;
- s << (quint16)id.data3;
- for (int i = 0; i < 8; i++)
- s << (quint8)id.data4[i];
+ QByteArray bytes;
+ if (s.byteOrder() == QDataStream::BigEndian) {
+ bytes = id.toRfc4122();
+ } else {
+ // we know how many bytes a UUID has, I hope :)
+ bytes = QByteArray(16, Qt::Uninitialized);
+ uchar *data = reinterpret_cast<uchar*>(bytes.data());
+
+ qToLittleEndian(id.data1, data);
+ data += sizeof(quint32);
+ qToLittleEndian(id.data2, data);
+ data += sizeof(quint16);
+ qToLittleEndian(id.data3, data);
+ data += sizeof(quint16);
+
+ for (int i = 0; i < 8; ++i) {
+ *(data) = id.data4[i];
+ data++;
+ }
+ }
+
+ if (s.writeRawData(bytes.data(), 16) != 16) {
+ s.setStatus(QDataStream::WriteFailed);
+ }
return s;
}
@@ -389,19 +631,30 @@ QDataStream &operator<<(QDataStream &s, const QUuid &id)
*/
QDataStream &operator>>(QDataStream &s, QUuid &id)
{
- quint32 u32;
- quint16 u16;
- quint8 u8;
- s >> u32;
- id.data1 = u32;
- s >> u16;
- id.data2 = u16;
- s >> u16;
- id.data3 = u16;
- for (int i = 0; i < 8; i++) {
- s >> u8;
- id.data4[i] = u8;
+ QByteArray bytes(16, Qt::Uninitialized);
+ if (s.readRawData(bytes.data(), 16) != 16) {
+ s.setStatus(QDataStream::ReadPastEnd);
+ return s;
}
+
+ if (s.byteOrder() == QDataStream::BigEndian) {
+ id = QUuid::fromRfc4122(bytes);
+ } else {
+ const uchar *data = reinterpret_cast<const uchar *>(bytes.constData());
+
+ id.data1 = qFromLittleEndian<quint32>(data);
+ data += sizeof(quint32);
+ id.data2 = qFromLittleEndian<quint16>(data);
+ data += sizeof(quint16);
+ id.data3 = qFromLittleEndian<quint16>(data);
+ data += sizeof(quint16);
+
+ for (int i = 0; i < 8; ++i) {
+ id.data4[i] = *(data);
+ data++;
+ }
+ }
+
return s;
}
#endif // QT_NO_DATASTREAM
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index f42ca91270..832d5bc5c6 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -108,8 +108,12 @@ struct Q_CORE_EXPORT QUuid
QUuid(const QString &);
QUuid(const char *);
QString toString() const;
- operator QString() const { return toString(); }
+ operator QString() const { return toString(); } // ### Qt5 remove
+ QUuid(const QByteArray &);
+ QByteArray toByteArray() const;
#endif
+ QByteArray toRfc4122() const;
+ static QUuid fromRfc4122(const QByteArray &);
bool isNull() const;
bool operator==(const QUuid &orig) const
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index e6f041fe3c..4eb05d63b6 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -641,6 +641,8 @@ Q_OUTOFLINE_TEMPLATE QList<T> QList<T>::mid(int pos, int alength) const
if (pos == 0 && alength == size())
return *this;
QList<T> cpy;
+ if (alength <= 0)
+ return cpy;
cpy.reserve(alength);
cpy.d->end = alength;
QT_TRY {
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 192ddb41e0..ad8c6c9ab5 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -879,10 +879,10 @@ QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteA
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
if (os2) {
quint32 unicodeRange[4] = {
- os2->ulUnicodeRange1, os2->ulUnicodeRange2, os2->ulUnicodeRange3, os2->ulUnicodeRange4
+ static_cast<quint32>(os2->ulUnicodeRange1), static_cast<quint32>(os2->ulUnicodeRange2), static_cast<quint32>(os2->ulUnicodeRange3), static_cast<quint32>(os2->ulUnicodeRange4)
};
quint32 codePageRange[2] = {
- os2->ulCodePageRange1, os2->ulCodePageRange2
+ static_cast<quint32>(os2->ulCodePageRange1), static_cast<quint32>(os2->ulCodePageRange2)
};
writingSystems = qt_determine_writing_systems_from_truetype_bits(unicodeRange, codePageRange);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 9c0feebbc8..dfe3e410f6 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2825,6 +2825,75 @@ QFixed QTextEngine::offsetInLigature(const QScriptItem *si, int pos, int max, in
return 0;
}
+// Scan in logClusters[from..to-1] for glyph_pos
+int QTextEngine::getClusterLength(unsigned short *logClusters,
+ const HB_CharAttributes *attributes,
+ int from, int to, int glyph_pos, int *start)
+{
+ int clusterLength = 0;
+ for (int i = from; i < to; i++) {
+ if (logClusters[i] == glyph_pos && attributes[i].charStop) {
+ if (*start < 0)
+ *start = i;
+ clusterLength++;
+ }
+ else if (clusterLength)
+ break;
+ }
+ return clusterLength;
+}
+
+int QTextEngine::positionInLigature(const QScriptItem *si, int end,
+ QFixed x, QFixed edge, int glyph_pos,
+ bool cursorOnCharacter)
+{
+ unsigned short *logClusters = this->logClusters(si);
+ int clusterStart = -1;
+ int clusterLength = 0;
+
+ if (si->analysis.script != QUnicodeTables::Common &&
+ si->analysis.script != QUnicodeTables::Greek) {
+ if (glyph_pos == -1)
+ return si->position + end;
+ else {
+ int i;
+ for (i = 0; i < end; i++)
+ if (logClusters[i] == glyph_pos)
+ break;
+ return si->position + i;
+ }
+ }
+
+ if (glyph_pos == -1 && end > 0)
+ glyph_pos = logClusters[end - 1];
+ else {
+ if (x <= edge)
+ glyph_pos--;
+ }
+
+ const HB_CharAttributes *attrs = attributes();
+ clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart);
+
+ if (clusterLength) {
+ const QGlyphLayout &glyphs = shapedGlyphs(si);
+ QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos);
+ // the approximate width of each individual element of the ligature
+ QFixed perItemWidth = glyphWidth / clusterLength;
+ QFixed left = x > edge ? edge : edge - glyphWidth;
+ int n = ((x - left) / perItemWidth).floor().toInt();
+ QFixed dist = x - left - n * perItemWidth;
+ int closestItem = dist > (perItemWidth / 2) ? n + 1 : n;
+ if (cursorOnCharacter && closestItem > 0)
+ closestItem--;
+ int pos = si->position + clusterStart + closestItem;
+ // Jump to the next charStop
+ while (!attrs[pos].charStop && pos < end)
+ pos++;
+ return pos;
+ }
+ return si->position + end;
+}
+
int QTextEngine::previousLogicalPosition(int oldPos) const
{
const HB_CharAttributes *attrs = attributes();
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index ef322bd6ee..21f36aee7f 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -620,6 +620,7 @@ public:
QFixed leadingSpaceWidth(const QScriptLine &line);
QFixed offsetInLigature(const QScriptItem *si, int pos, int max, int glyph_pos);
+ int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter);
int previousLogicalPosition(int oldPos) const;
int nextLogicalPosition(int oldPos) const;
int lineNumberForTextPosition(int pos);
@@ -642,6 +643,7 @@ private:
void resolveAdditionalFormats() const;
int endOfLine(int lineNum);
int beginningOfLine(int lineNum);
+ int getClusterLength(unsigned short *logClusters, const HB_CharAttributes *attributes, int from, int to, int glyph_pos, int *start);
};
class Q_GUI_EXPORT QStackTextEngine : public QTextEngine {
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index b9f29df1fe..a88b46625a 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2607,8 +2607,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
} else {
bool rtl = eng->isRightToLeft();
bool visual = eng->visualCursorMovement();
+ int end = qMin(lineEnd, si->position + l) - si->position;
if (reverse) {
- int end = qMin(lineEnd, si->position + l) - si->position;
int glyph_end = end == l ? si->num_glyphs : logClusters[end];
int glyph_start = glyph_pos;
if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem)))
@@ -2624,7 +2624,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
for (int i = glyph_start; i <= glyph_end; i++)
x += glyphs.effectiveAdvance(i);
}
- x += eng->offsetInLigature(si, pos, line.length, glyph_pos);
+ x += eng->offsetInLigature(si, pos, end, glyph_pos);
}
*cursorPos = pos + si->position;
@@ -2739,6 +2739,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
}
int glyph_pos = -1;
+ QFixed edge;
// has to be inside run
if (cpos == QTextLine::CursorOnCharacter) {
if (si.analysis.bidiLevel % 2) {
@@ -2749,6 +2750,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (pos < x)
break;
glyph_pos = gs;
+ edge = pos;
break;
}
pos -= glyphs.effectiveAdvance(gs);
@@ -2761,6 +2763,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (pos > x)
break;
glyph_pos = gs;
+ edge = pos;
}
pos += glyphs.effectiveAdvance(gs);
++gs;
@@ -2774,6 +2777,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (gs <= ge) {
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
+ edge = pos;
dist = qAbs(x-pos);
}
pos -= glyphs.effectiveAdvance(gs);
@@ -2783,6 +2787,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (ge >= gs) {
if (glyphs.attributes[ge].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = ge;
+ edge = pos;
dist = qAbs(x-pos);
}
pos += glyphs.effectiveAdvance(ge);
@@ -2794,6 +2799,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (gs <= ge) {
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
+ edge = pos;
dist = qAbs(x-pos);
}
pos += glyphs.effectiveAdvance(gs);
@@ -2805,6 +2811,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
pos += glyphs.effectiveAdvance(gs);
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
+ edge = pos;
dist = qAbs(x-pos);
}
++gs;
@@ -2821,16 +2828,13 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (rtl && nchars > 0)
return insertionPoints[lastLine ? nchars : nchars - 1];
}
- return si.position + end;
+ return eng->positionInLigature(&si, end, x, pos, -1,
+ cpos == QTextLine::CursorOnCharacter);
}
}
Q_ASSERT(glyph_pos != -1);
- int j;
- for (j = 0; j < eng->length(item); ++j)
- if (logClusters[j] == glyph_pos)
- break;
-// qDebug("at pos %d (in run: %d)", si.position + j, j);
- return si.position + j;
+ return eng->positionInLigature(&si, end, x, edge, glyph_pos,
+ cpos == QTextLine::CursorOnCharacter);
}
}
// right of last item
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index 0f901b873d..3d5558d334 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -21,7 +21,6 @@ HEADERS += \
access/qnetworkcookie_p.h \
access/qnetworkcookiejar.h \
access/qnetworkcookiejar_p.h \
- access/qnetworkcookiejartlds_p.h \
access/qnetworkrequest.h \
access/qnetworkrequest_p.h \
access/qnetworkreply.h \
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 33124fdd67..d950af4ee2 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -261,7 +261,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
// set the host
value = request.headerField("host");
if (value.isEmpty()) {
- QByteArray host = QUrl::toAce(hostName);
+ QHostAddress add;
+ QByteArray host;
+ if (add.setAddress(hostName)) {
+ if (add.protocol() == QAbstractSocket::IPv6Protocol)
+ host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way
+ else
+ host = hostName.toAscii();
+
+ } else {
+ host = QUrl::toAce(hostName);
+ }
int port = request.url().port();
if (port != -1) {
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 291bdec0cf..a2fa689256 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -40,12 +40,12 @@
****************************************************************************/
#include "qnetworkcookiejar.h"
-#include "qnetworkcookiejartlds_p.h"
#include "qnetworkcookiejar_p.h"
#include "QtNetwork/qnetworkcookie.h"
#include "QtCore/qurl.h"
#include "QtCore/qdatetime.h"
+#include "private/qtldurl_p.h"
QT_BEGIN_NAMESPACE
@@ -216,7 +216,7 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis
// the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2
// redundant; the "leading dot" rule has been relaxed anyway, see above
// we remove the leading dot for this check
- if (QNetworkCookieJarPrivate::isEffectiveTLD(domain.remove(0, 1)))
+ if (qIsEffectiveTLD(domain.remove(0, 1)))
continue; // not accepted
}
@@ -304,43 +304,4 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const
return result;
}
-bool QNetworkCookieJarPrivate::isEffectiveTLD(const QString &domain)
-{
- // for domain 'foo.bar.com':
- // 1. return if TLD table contains 'foo.bar.com'
- if (containsTLDEntry(domain))
- return true;
-
- if (domain.contains(QLatin1Char('.'))) {
- int count = domain.size() - domain.indexOf(QLatin1Char('.'));
- QString wildCardDomain;
- wildCardDomain.reserve(count + 1);
- wildCardDomain.append(QLatin1Char('*'));
- wildCardDomain.append(domain.right(count));
- // 2. if table contains '*.bar.com',
- // test if table contains '!foo.bar.com'
- if (containsTLDEntry(wildCardDomain)) {
- QString exceptionDomain;
- exceptionDomain.reserve(domain.size() + 1);
- exceptionDomain.append(QLatin1Char('!'));
- exceptionDomain.append(domain);
- return (! containsTLDEntry(exceptionDomain));
- }
- }
- return false;
-}
-
-bool QNetworkCookieJarPrivate::containsTLDEntry(const QString &entry)
-{
- int index = qHash(entry) % tldCount;
- int currentDomainIndex = tldIndices[index];
- while (currentDomainIndex < tldIndices[index+1]) {
- QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex);
- if (currentEntry == entry)
- return true;
- currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0
- }
- return false;
-}
-
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h
index 912847b8f0..34858d9c92 100644
--- a/src/network/access/qnetworkcookiejar_p.h
+++ b/src/network/access/qnetworkcookiejar_p.h
@@ -63,9 +63,6 @@ class QNetworkCookieJarPrivate: public QObjectPrivate
public:
QList<QNetworkCookie> allCookies;
- static bool Q_AUTOTEST_EXPORT isEffectiveTLD(const QString &domain);
- static bool containsTLDEntry(const QString &entry);
-
Q_DECLARE_PUBLIC(QNetworkCookieJar)
};
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index 338cf59c02..54cd898c67 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -488,7 +488,7 @@ void QNetworkConfigurationManagerPrivate::enablePolling()
++forcedPolling;
if (forcedPolling == 1)
- startPolling();
+ QMetaObject::invokeMethod(this, "startPolling");
}
void QNetworkConfigurationManagerPrivate::disablePolling()
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
index 02e00b9a95..04cce202c5 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_p.h
@@ -107,7 +107,7 @@ private Q_SLOTS:
void pollEngines();
private:
- void startPolling();
+ Q_INVOKABLE void startPolling();
QTimer *pollTimer;
private:
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 5f5db17072..5c672ec227 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -149,6 +149,8 @@ bool QHttpSocketEngine::connectInternal()
// Handshake isn't done. If unconnected, start connecting.
if (d->state == None && d->socket->state() == QAbstractSocket::UnconnectedState) {
setState(QAbstractSocket::ConnectingState);
+ //limit buffer in internal socket, data is buffered in the external socket under application control
+ d->socket->setReadBufferSize(65536);
d->socket->connectToHost(d->proxy.hostName(), d->proxy.port());
}
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 575c0bc73e..ab757987f6 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1126,6 +1126,8 @@ bool QSocks5SocketEngine::connectInternal()
if (d->socks5State == QSocks5SocketEnginePrivate::Uninitialized
&& d->socketState != QAbstractSocket::ConnectingState) {
setState(QAbstractSocket::ConnectingState);
+ //limit buffer in internal socket, data is buffered in the external socket under application control
+ d->data->controlSocket->setReadBufferSize(65536);
d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port());
return false;
}
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 328c5c228c..76b7d41e46 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -127,7 +127,7 @@
QT_BEGIN_NAMESPACE
// forward declaration
-static QMap<QString, QString> _q_mapFromOnelineName(char *name);
+static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name);
/*!
Constructs a QSslCertificate by reading \a format encoded data
@@ -324,7 +324,7 @@ QString QSslCertificate::issuerInfo(SubjectInfo info) const
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
- _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0));
+ _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
return d->issuerInfo.value(_q_SubjectInfoToString(info));
}
@@ -341,7 +341,7 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
- _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0));
+ _q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
return d->issuerInfo.value(QString::fromLatin1(tag));
}
@@ -360,7 +360,7 @@ QString QSslCertificate::subjectInfo(SubjectInfo info) const
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
- _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0));
+ _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
return d->subjectInfo.value(_q_SubjectInfoToString(info));
}
@@ -376,7 +376,7 @@ QString QSslCertificate::subjectInfo(const QByteArray &tag) const
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
- _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0));
+ _q_mapFromX509Name(q_X509_get_subject_name(d->x509));
return d->subjectInfo.value(QString::fromLatin1(tag));
}
@@ -666,37 +666,17 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi
return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n";
}
-static QMap<QString, QString> _q_mapFromOnelineName(char *name)
+static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name)
{
QMap<QString, QString> info;
- QString infoStr = QString::fromLocal8Bit(name);
- q_CRYPTO_free(name);
-
- // ### The right-hand encoding seems to allow hex (Regulierungsbeh\xC8orde)
- //entry.replace(QLatin1String("\\x"), QLatin1String("%"));
- //entry = QUrl::fromPercentEncoding(entry.toLatin1());
- // ### See RFC-4630 for more details!
-
- QRegExp rx(QLatin1String("/([A-Za-z]+)=(.+)"));
-
- int pos = 0;
- while ((pos = rx.indexIn(infoStr, pos)) != -1) {
- const QString name = rx.cap(1);
-
- QString value = rx.cap(2);
- const int valuePos = rx.pos(2);
-
- const int next = rx.indexIn(value);
- if (next == -1) {
- info.insert(name, value);
- break;
- }
-
- value = value.left(next);
- info.insert(name, value);
- pos = valuePos + value.length();
+ for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) {
+ X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i);
+ const char *obj = q_OBJ_nid2sn(q_OBJ_obj2nid(q_X509_NAME_ENTRY_get_object(e)));
+ unsigned char *data = 0;
+ int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e));
+ info[QString::fromUtf8(obj)] = QString::fromUtf8((char*)data, size);
+ q_CRYPTO_free(data);
}
-
return info;
}
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index a730eb2a39..a4cc3c493d 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -101,6 +101,7 @@ DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c,
DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return)
DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
+DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return);
DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return)
DEFINEFUNC(BIO *, BIO_new, BIO_METHOD *a, a, return 0, return)
@@ -248,7 +249,10 @@ DEFINEFUNC4(void *, X509_get_ext_d2i, X509 *a, a, int b, b, int *c, c, int *d, d
DEFINEFUNC(X509_NAME *, X509_get_issuer_name, X509 *a, a, return 0, return)
DEFINEFUNC(X509_NAME *, X509_get_subject_name, X509 *a, a, return 0, return)
DEFINEFUNC(int, X509_verify_cert, X509_STORE_CTX *a, a, return -1, return)
-DEFINEFUNC3(char *, X509_NAME_oneline, X509_NAME *a, a, char *b, b, int c, c, return 0, return)
+DEFINEFUNC(int, X509_NAME_entry_count, X509_NAME *a, a, return 0, return)
+DEFINEFUNC2(X509_NAME_ENTRY *, X509_NAME_get_entry, X509_NAME *a, a, int b, b, return 0, return)
+DEFINEFUNC(ASN1_STRING *, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY *a, a, return 0, return)
+DEFINEFUNC(ASN1_OBJECT *, X509_NAME_ENTRY_get_object, X509_NAME_ENTRY *a, a, return 0, return)
DEFINEFUNC(EVP_PKEY *, X509_PUBKEY_get, X509_PUBKEY *a, a, return 0, return)
DEFINEFUNC(void, X509_STORE_free, X509_STORE *a, a, return, DUMMYARG)
DEFINEFUNC(X509_STORE *, X509_STORE_new, DUMMYARG, DUMMYARG, return 0, return)
@@ -518,6 +522,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(ASN1_INTEGER_get, 48, libs.second )
RESOLVEFUNC(ASN1_STRING_data, 71, libs.second )
RESOLVEFUNC(ASN1_STRING_length, 76, libs.second )
+ RESOLVEFUNC(ASN1_STRING_to_UTF8, 86, libs.second )
RESOLVEFUNC(BIO_ctrl, 184, libs.second )
RESOLVEFUNC(BIO_free, 209, libs.second )
RESOLVEFUNC(BIO_new, 222, libs.second )
@@ -608,7 +613,10 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(SSLv23_server_method, 191, libs.first )
RESOLVEFUNC(TLSv1_server_method, 200, libs.first )
RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.first )
- RESOLVEFUNC(X509_NAME_oneline, 1830, libs.second )
+ RESOLVEFUNC(X509_NAME_entry_count, 1821, libs.second )
+ RESOLVEFUNC(X509_NAME_get_entry, 1823, libs.second )
+ RESOLVEFUNC(X509_NAME_ENTRY_get_data, 1808, libs.second )
+ RESOLVEFUNC(X509_NAME_ENTRY_get_object, 1809, libs.second )
RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second )
RESOLVEFUNC(X509_STORE_free, 1939, libs.second )
RESOLVEFUNC(X509_STORE_new, 1942, libs.second )
@@ -647,6 +655,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(ASN1_INTEGER_get)
RESOLVEFUNC(ASN1_STRING_data)
RESOLVEFUNC(ASN1_STRING_length)
+ RESOLVEFUNC(ASN1_STRING_to_UTF8)
RESOLVEFUNC(BIO_ctrl)
RESOLVEFUNC(BIO_free)
RESOLVEFUNC(BIO_new)
@@ -736,7 +745,10 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(SSLv3_server_method)
RESOLVEFUNC(SSLv23_server_method)
RESOLVEFUNC(TLSv1_server_method)
- RESOLVEFUNC(X509_NAME_oneline)
+ RESOLVEFUNC(X509_NAME_entry_count)
+ RESOLVEFUNC(X509_NAME_get_entry)
+ RESOLVEFUNC(X509_NAME_ENTRY_get_data)
+ RESOLVEFUNC(X509_NAME_ENTRY_get_object)
RESOLVEFUNC(X509_PUBKEY_get)
RESOLVEFUNC(X509_STORE_free)
RESOLVEFUNC(X509_STORE_new)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index e20deb80a7..c0a3b4da6a 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -204,6 +204,7 @@ bool q_resolveOpenSslSymbols();
long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
+int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
int q_BIO_free(BIO *a);
BIO *q_BIO_new(BIO_METHOD *a);
@@ -360,7 +361,10 @@ void *q_X509_get_ext_d2i(X509 *a, int b, int *c, int *d);
X509_NAME *q_X509_get_issuer_name(X509 *a);
X509_NAME *q_X509_get_subject_name(X509 *a);
int q_X509_verify_cert(X509_STORE_CTX *ctx);
-char *q_X509_NAME_oneline(X509_NAME *a, char *b, int c);
+int q_X509_NAME_entry_count(X509_NAME *a);
+X509_NAME_ENTRY *q_X509_NAME_get_entry(X509_NAME *a,int b);
+ASN1_STRING *q_X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *a);
+ASN1_OBJECT *q_X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *a);
EVP_PKEY *q_X509_PUBKEY_get(X509_PUBKEY *a);
void q_X509_STORE_free(X509_STORE *store);
X509_STORE *q_X509_STORE_new();
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index fd1269ef3e..dc07a6f77d 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1795,7 +1795,7 @@ static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, boo
img = img.mirrored();
}
-QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
+Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
{
QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 0af8108f03..682c26255d 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
-extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
+extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
#define QGL_FUNC_CONTEXT const QGLContext *ctx = d_ptr->fbo_guard.context();
#define QGL_FUNCP_CONTEXT const QGLContext *ctx = fbo_guard.context();
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 3afb3b1fae..45e7cdd875 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -113,7 +113,7 @@ extern void qgl_cleanup_glyph_cache(QGLContext *);
void qgl_cleanup_glyph_cache(QGLContext *) {}
#endif
-extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
+extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
QGLContext* QGLPBufferGLPaintDevice::context() const
diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro
index 8fb42fbb03..6dd7e5022b 100644
--- a/src/plugins/accessible/widgets/widgets.pro
+++ b/src/plugins/accessible/widgets/widgets.pro
@@ -1,5 +1,5 @@
TARGET = qtaccessiblewidgets
-include(../../qpluginbase.pri)
+load(qt_plugin)
include (../qaccessiblebase.pri)
QT += core-private gui-private widgets-private
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index f57a0c930b..25243f8e0a 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -1,5 +1,5 @@
TARGET = qconnmanbearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core network-private dbus
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index adc1625c3d..0d11b1e9d3 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -1,5 +1,5 @@
TARGET = qcorewlanbearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core-private network-private
LIBS += -framework Foundation -framework SystemConfiguration
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index 94fefaf6c2..4f86c2a38c 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -1,5 +1,5 @@
TARGET = qgenericbearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core-private network-private
diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro
index 4737045ae7..3f5753409d 100644
--- a/src/plugins/bearer/icd/icd.pro
+++ b/src/plugins/bearer/icd/icd.pro
@@ -1,5 +1,5 @@
TARGET = qicdbearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core network dbus
diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro
index ba02f37d23..ec86cc0b93 100644
--- a/src/plugins/bearer/nativewifi/nativewifi.pro
+++ b/src/plugins/bearer/nativewifi/nativewifi.pro
@@ -1,5 +1,5 @@
TARGET = qnativewifibearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core-private network-private
diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro
index a9de1561fd..262f60a69c 100644
--- a/src/plugins/bearer/networkmanager/networkmanager.pro
+++ b/src/plugins/bearer/networkmanager/networkmanager.pro
@@ -1,5 +1,5 @@
TARGET = qnmbearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core network-private dbus
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
index ecf958f559..76da098dbf 100644
--- a/src/plugins/bearer/nla/nla.pro
+++ b/src/plugins/bearer/nla/nla.pro
@@ -1,5 +1,5 @@
TARGET = qnlabearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core network
diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri
index 5d2ae1a5cd..c4b3c6d09d 100644
--- a/src/plugins/bearer/symbian/symbian.pri
+++ b/src/plugins/bearer/symbian/symbian.pri
@@ -1,5 +1,5 @@
TARGET = qsymbianbearer
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT = core network
diff --git a/src/plugins/codecs/cn/cn.pro b/src/plugins/codecs/cn/cn.pro
index 51a2f41372..fc2e94b5a6 100644
--- a/src/plugins/codecs/cn/cn.pro
+++ b/src/plugins/codecs/cn/cn.pro
@@ -1,5 +1,5 @@
TARGET = qcncodecs
-include(../../qpluginbase.pri)
+load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
diff --git a/src/plugins/codecs/jp/jp.pro b/src/plugins/codecs/jp/jp.pro
index e6b7a4bb7f..834ca31ad6 100644
--- a/src/plugins/codecs/jp/jp.pro
+++ b/src/plugins/codecs/jp/jp.pro
@@ -1,5 +1,5 @@
TARGET = qjpcodecs
-include(../../qpluginbase.pri)
+load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
diff --git a/src/plugins/codecs/kr/kr.pro b/src/plugins/codecs/kr/kr.pro
index 14c162c6e8..f5aea6554f 100644
--- a/src/plugins/codecs/kr/kr.pro
+++ b/src/plugins/codecs/kr/kr.pro
@@ -1,5 +1,5 @@
TARGET = qkrcodecs
-include(../../qpluginbase.pri)
+load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
diff --git a/src/plugins/codecs/tw/tw.pro b/src/plugins/codecs/tw/tw.pro
index b0d5a2b68a..f76cba4dbc 100644
--- a/src/plugins/codecs/tw/tw.pro
+++ b/src/plugins/codecs/tw/tw.pro
@@ -1,5 +1,5 @@
TARGET = qtwcodecs
-include(../../qpluginbase.pri)
+load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
diff --git a/src/plugins/generic/linuxinput/linuxinput.pro b/src/plugins/generic/linuxinput/linuxinput.pro
index d4dc4bbbcb..a771ee9734 100644
--- a/src/plugins/generic/linuxinput/linuxinput.pro
+++ b/src/plugins/generic/linuxinput/linuxinput.pro
@@ -1,5 +1,5 @@
TARGET = qlinuxinputplugin
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic
target.path = $$[QT_INSTALL_PLUGINS]/generic
diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro
index 485152181c..d9726b6d3a 100644
--- a/src/plugins/generic/tslib/tslib.pro
+++ b/src/plugins/generic/tslib/tslib.pro
@@ -1,5 +1,5 @@
TARGET = qlinuxinputplugin
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic
target.path = $$[QT_INSTALL_PLUGINS]/generic
diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro
index 4b72cae6e4..b8d260e43c 100644
--- a/src/plugins/imageformats/gif/gif.pro
+++ b/src/plugins/imageformats/gif/gif.pro
@@ -1,5 +1,5 @@
TARGET = qgif
-include(../../qpluginbase.pri)
+load(qt_plugin)
include(../../../gui/image/qgifhandler.pri)
SOURCES += $$PWD/main.cpp
diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro
index cef92cedc8..e0109c6a32 100644
--- a/src/plugins/imageformats/ico/ico.pro
+++ b/src/plugins/imageformats/ico/ico.pro
@@ -1,5 +1,5 @@
TARGET = qico
-include(../../qpluginbase.pri)
+load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)"
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index 1e6c24d061..aa489729a1 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -1,5 +1,5 @@
TARGET = qjpeg
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT += core-private
diff --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro
index 01dc418c1b..72dc506cf9 100644
--- a/src/plugins/imageformats/mng/mng.pro
+++ b/src/plugins/imageformats/mng/mng.pro
@@ -1,5 +1,5 @@
TARGET = qmng
-include(../../qpluginbase.pri)
+load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-mng)"
diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
index e4eb21b1e7..012c49ecf1 100644
--- a/src/plugins/imageformats/tiff/tiff.pro
+++ b/src/plugins/imageformats/tiff/tiff.pro
@@ -1,5 +1,5 @@
TARGET = qtiff
-include(../../qpluginbase.pri)
+load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-tiff)"
diff --git a/src/plugins/inputmethods/imsw-multi/imsw-multi.pro b/src/plugins/inputmethods/imsw-multi/imsw-multi.pro
index e37212abee..c67be02ba4 100644
--- a/src/plugins/inputmethods/imsw-multi/imsw-multi.pro
+++ b/src/plugins/inputmethods/imsw-multi/imsw-multi.pro
@@ -1,5 +1,5 @@
TARGET = qimsw-multi
-include(../../qpluginbase.pri)
+load(qt_plugin)
CONFIG += warn_on
QT += widgets
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 5d751631a9..117dbe46d9 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -1,5 +1,5 @@
TARGET = qcocoa
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
OBJECTIVE_SOURCES = main.mm \
diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index 4a637463ef..f830177dcb 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -1,5 +1,5 @@
TARGET = qdirectfb
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
isEmpty(DIRECTFB_LIBS) {
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index 3692e38e1b..471cf63dd8 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -2,7 +2,7 @@ TARGET = qeglfs
TEMPLATE = lib
CONFIG += plugin
-QT += opengl
+QT += opengl core-private gui-private opengl-private
DESTDIR = $$QT.gui.plugins/platforms
diff --git a/src/plugins/platforms/externalplugin.pri b/src/plugins/platforms/externalplugin.pri
index 54da4d957c..9b00acb4e9 100644
--- a/src/plugins/platforms/externalplugin.pri
+++ b/src/plugins/platforms/externalplugin.pri
@@ -26,4 +26,4 @@
QT_SOURCE_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE)
QT_BUILD_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_BUILD_TREE)
-include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri)
+load(qt_plugin)
diff --git a/src/plugins/platforms/fb_base/fb_base.pro b/src/plugins/platforms/fb_base/fb_base.pro
index 4445516cc7..4ebd53b407 100644
--- a/src/plugins/platforms/fb_base/fb_base.pro
+++ b/src/plugins/platforms/fb_base/fb_base.pro
@@ -6,7 +6,7 @@
#QT -= core gui
TARGET = fb_base
-#include(../../qpluginbase.pri)
+#load(qt_plugin)
DESTDIR = $$QT.gui.plugins/graphicssystems
diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro
index 4e4fe6ff4b..ce6814ecc1 100644
--- a/src/plugins/platforms/linuxfb/linuxfb.pro
+++ b/src/plugins/platforms/linuxfb/linuxfb.pro
@@ -1,5 +1,5 @@
TARGET = qlinuxfbgraphicssystem
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro
index 5c8b55478a..d51b6b2ed0 100644
--- a/src/plugins/platforms/minimal/minimal.pro
+++ b/src/plugins/platforms/minimal/minimal.pro
@@ -1,6 +1,5 @@
TARGET = qminimal
-include(../../qpluginbase.pri)
-QT += gui-private core-private
+load(qt_plugin)
QT = core-private gui-private
DESTDIR = $$QT.gui.plugins/platforms
diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro
index a6e7d7665a..ad17a3bc78 100644
--- a/src/plugins/platforms/openkode/openkode.pro
+++ b/src/plugins/platforms/openkode/openkode.pro
@@ -1,5 +1,5 @@
TARGET = qopenkodeintegration
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT += opengl
diff --git a/src/plugins/platforms/openvglite/openvglite.pro b/src/plugins/platforms/openvglite/openvglite.pro
index 11e867d998..bb7efe9bf3 100644
--- a/src/plugins/platforms/openvglite/openvglite.pro
+++ b/src/plugins/platforms/openvglite/openvglite.pro
@@ -1,5 +1,5 @@
TARGET = qvglitegraphicssystem
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT += openvg
diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro
index bc17525104..5db8533264 100644
--- a/src/plugins/platforms/qvfb/qvfb.pro
+++ b/src/plugins/platforms/qvfb/qvfb.pro
@@ -1,5 +1,5 @@
TARGET = qvfbintegration
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
diff --git a/src/plugins/platforms/uikit/uikit.pro b/src/plugins/platforms/uikit/uikit.pro
index 6f5947f2c0..45a48dc92a 100644
--- a/src/plugins/platforms/uikit/uikit.pro
+++ b/src/plugins/platforms/uikit/uikit.pro
@@ -1,5 +1,5 @@
TARGET = quikit
-include(../../qpluginbase.pri)
+load(qt_plugin)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += opengl
diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro
index a7b8ca540a..85bffb0637 100644
--- a/src/plugins/platforms/vnc/vnc.pro
+++ b/src/plugins/platforms/vnc/vnc.pro
@@ -1,5 +1,5 @@
TARGET = qvncgraphicssystem
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT += network
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
index 2a71f3ee04..f1c9ccc18f 100644
--- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp
+++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
@@ -139,6 +139,11 @@ QWaylandDisplay::QWaylandDisplay(void)
#ifdef QT_WAYLAND_GL_SUPPORT
mEglIntegration = QWaylandGLIntegration::createGLIntegration(this);
#endif
+
+#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
+ mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
+#endif
+
blockingReadEvents();
qRegisterMetaType<uint32_t>("uint32_t");
@@ -147,10 +152,6 @@ QWaylandDisplay::QWaylandDisplay(void)
mEglIntegration->initialize();
#endif
-#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
- mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
-#endif
-
connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests()));
mFd = wl_display_get_fd(mDisplay, sourceUpdate, this);
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index e8919d7047..1232df6d52 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -68,6 +68,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid());
+ mDisplay->windowManagerIntegration()->authenticateWithToken();
#endif
mSurface = mDisplay->createSurface(this);
diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro
index e49c73bfae..5bf751b6e9 100644
--- a/src/plugins/platforms/wayland/wayland.pro
+++ b/src/plugins/platforms/wayland/wayland.pro
@@ -1,5 +1,5 @@
TARGET = qwayland
-include(../../qpluginbase.pri)
+load(qt_plugin)
QT+=gui-private core-private opengl-private
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h
index ec776c5f87..73673aef6f 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h
+++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanager-client-protocol.h
@@ -36,16 +36,37 @@ struct wl_client;
struct wl_windowmanager;
+struct wl_proxy;
+
+extern void
+wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
+extern struct wl_proxy *
+wl_proxy_create(struct wl_proxy *factory,
+ const struct wl_interface *interface);
+extern struct wl_proxy *
+wl_proxy_create_for_id(struct wl_display *display,
+ const struct wl_interface *interface, uint32_t id);
+extern void
+wl_proxy_destroy(struct wl_proxy *proxy);
+
+extern int
+wl_proxy_add_listener(struct wl_proxy *proxy,
+ void (**implementation)(void), void *data);
+
+extern void
+wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
+
+extern void *
+wl_proxy_get_user_data(struct wl_proxy *proxy);
+
extern const struct wl_interface wl_windowmanager_interface;
-#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
+#define wl_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
+#define wl_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1
static inline struct wl_windowmanager *
-wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/)
+wl_windowmanager_create(struct wl_display *display, uint32_t id)
{
- // ### does not run without latest wayland. must be enabled later
- //wl_display_bind(display, id, "wl_windowmanager", version);
-
return (struct wl_windowmanager *)
wl_proxy_create_for_id(display, &wl_windowmanager_interface, id);
}
@@ -72,7 +93,14 @@ static inline void
wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid)
{
wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
- WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
+ wl_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
+}
+
+static inline void
+wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *wl_authentication_token)
+{
+ wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
+ wl_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, wl_authentication_token);
}
#ifdef __cplusplus
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
index bf8342308e..4236f395cb 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
+++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
@@ -68,12 +68,11 @@ struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const
return mWaylandWindowManager;
}
-void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface,
- uint32_t version, void *data)
+void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data)
{
if (strcmp(interface, "wl_windowmanager") == 0) {
QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data);
- integration->mWaylandWindowManager = wl_windowmanager_create(display,id, version);
+ integration->mWaylandWindowManager = wl_windowmanager_create(display, id);
}
}
@@ -83,3 +82,11 @@ void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId)
wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId);
}
+void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token)
+{
+ QByteArray authToken = token;
+ if (authToken.isEmpty())
+ authToken = qgetenv("WL_AUTHENTICATION_TOKEN");
+ if (mWaylandWindowManager)
+ wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData());
+}
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h
index 01b814f22a..0e3781dbe2 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h
+++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.h
@@ -56,6 +56,7 @@ public:
void mapSurfaceToProcess(struct wl_surface *surface, long long processId);
void mapClientToProcess(long long processId);
+ void authenticateWithToken(const QByteArray &token = QByteArray());
private:
static void wlHandleListenerGlobal(wl_display *display, uint32_t id,
diff --git a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c
index 48049d8571..0250801b1f 100644
--- a/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c
+++ b/src/plugins/platforms/wayland/windowmanager_integration/wayland-windowmanager-protocol.c
@@ -26,7 +26,8 @@
#include "wayland-util.h"
static const struct wl_message wl_windowmanager_requests[] = {
- { "map_client_to_process", "u", NULL },
+ { "map_client_to_process", "u" },
+ { "authenticate_with_token", "s" },
};
WL_EXPORT const struct wl_interface wl_windowmanager_interface = {
diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro
index 04db369f48..b78844a8d4 100644
--- a/src/plugins/platforms/xcb/xcb.pro
+++ b/src/plugins/platforms/xcb/xcb.pro
@@ -1,6 +1,6 @@
TARGET = xcb
-include(../../qpluginbase.pri)
+load(qt_plugin)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private
diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro
index 902d379ee2..2cba5513d5 100644
--- a/src/plugins/platforms/xlib/xlib.pro
+++ b/src/plugins/platforms/xlib/xlib.pro
@@ -1,6 +1,6 @@
TARGET = qxlib
-include(../../qpluginbase.pri)
+load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
QT += core-private gui-private opengl-private
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
index 2dd96bf7f2..b22a527761 100644
--- a/src/plugins/qpluginbase.pri
+++ b/src/plugins/qpluginbase.pri
@@ -1,41 +1 @@
-TEMPLATE = lib
-isEmpty(QT_MAJOR_VERSION) {
- VERSION=5.0.0
-} else {
- VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
-}
-CONFIG += qt plugin
-
-win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
-TARGET = $$qtLibraryTarget($$TARGET)
-contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
-
-include(../qt_targets.pri)
-
-wince*:LIBS += $$QMAKE_LIBS_GUI
-
-symbian: {
- TARGET.EPOCALLOWDLLDATA=1
- TARGET.CAPABILITY = All -Tcb
- TARGET = $${TARGET}$${QT_LIBINFIX}
- load(armcc_warnings)
-
- # Make partial upgrade SIS file for Qt plugin dll's
- # Partial upgrade SIS file
- vendorinfo = \
- "; Localised Vendor name" \
- "%{\"Nokia\"}" \
- " " \
- "; Unique Vendor name" \
- ":\"Nokia, Qt\"" \
- " "
- isEmpty(QT_LIBINFIX): PARTIAL_UPGRADE_UID = 0x2001E61C
- else: PARTIAL_UPGRADE_UID = 0xE001E61C
-
- pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \
- "$${LITERAL_HASH}{\"$${TARGET}\"}, ($$PARTIAL_UPGRADE_UID), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU"
- partial_upgrade.pkg_prerules = pu_header vendorinfo
- partial_upgrade.files = $$QMAKE_LIBDIR_QT/$${TARGET}.dll
- partial_upgrade.path = c:/sys/bin
- DEPLOYMENT += partial_upgrade
-}
+load(qt_plugin)
diff --git a/src/plugins/s60/s60pluginbase.pri b/src/plugins/s60/s60pluginbase.pri
index 0cde7d2277..41d4b27db2 100644
--- a/src/plugins/s60/s60pluginbase.pri
+++ b/src/plugins/s60/s60pluginbase.pri
@@ -1,6 +1,6 @@
# Note: These version based 'plugins' are not an actual Qt plugins,
# they are just regular runtime loaded libraries
-include(../qpluginbase.pri)
+load(qt_plugin)
CONFIG -= plugin
diff --git a/src/plugins/sqldrivers/qsqldriverbase.pri b/src/plugins/sqldrivers/qsqldriverbase.pri
index 7399c659da..45638fcd4f 100644
--- a/src/plugins/sqldrivers/qsqldriverbase.pri
+++ b/src/plugins/sqldrivers/qsqldriverbase.pri
@@ -1,4 +1,4 @@
-include(../qpluginbase.pri)
+load(qt_plugin)
QT = core sql-private
DESTDIR = $$QT.sql.plugins/sqldrivers
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index 9df54ce438..a58ed2ff69 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -49,8 +49,6 @@
#ifndef QT_NO_ACCESSIBILITY
-#define QTEST_ACCESSIBILITY
-
#define QVERIFY_EVENT(object, child, event) \
QVERIFY(QTestAccessibility::verifyEvent(object, child, (int)event))
@@ -131,9 +129,9 @@ private:
if (object) {
QApplication* app = qobject_cast<QApplication*>(object);
if ( !app )
- qWarning("QTEST_ACCESSIBILITY: root Object is not a QApplication!");
+ qWarning("%s: root Object is not a QApplication!", Q_FUNC_INFO);
} else {
- qWarning("QTEST_ACCESSIBILITY: root Object called with 0 pointer");
+ qWarning("%s: root Object called with 0 pointer", Q_FUNC_INFO);
}
}
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp
index 16a87c8d7b..c4613e20ae 100644
--- a/src/tools/uic/cpp/cppwriteincludes.cpp
+++ b/src/tools/uic/cpp/cppwriteincludes.cpp
@@ -82,7 +82,7 @@ static inline QString moduleHeader(const QString &module, const QString &header)
namespace CPP {
WriteIncludes::WriteIncludes(Uic *uic)
- : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false)
+ : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false), m_laidOut(false)
{
// When possible (no namespace) use the "QtModule/QClass" convention
// and create a re-mapping of the old header "qclass.h" to it. Do not do this
@@ -106,6 +106,7 @@ WriteIncludes::WriteIncludes(Uic *uic)
void WriteIncludes::acceptUI(DomUI *node)
{
m_scriptsActivated = false;
+ m_laidOut = false;
m_localIncludes.clear();
m_globalIncludes.clear();
m_knownClasses.clear();
@@ -144,6 +145,7 @@ void WriteIncludes::acceptWidget(DomWidget *node)
void WriteIncludes::acceptLayout(DomLayout *node)
{
add(node->attributeClass());
+ m_laidOut = true;
TreeWalker::acceptLayout(node);
}
@@ -220,6 +222,9 @@ void WriteIncludes::add(const QString &className, bool determineHeader, const QS
m_knownClasses.insert(className);
+ if (!m_laidOut && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox")))
+ add(QLatin1String("QLayout")); // spacing property of QToolBox)
+
if (className == QLatin1String("Line")) { // ### hmm, deprecate me!
add(QLatin1String("QFrame"));
return;
diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h
index 39b1ddf897..e8215364b9 100644
--- a/src/tools/uic/cpp/cppwriteincludes.h
+++ b/src/tools/uic/cpp/cppwriteincludes.h
@@ -107,6 +107,7 @@ private:
StringMap m_oldHeaderToNewHeader;
bool m_scriptsActivated;
+ bool m_laidOut;
};
} // namespace CPP
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 8660991b17..72da6db457 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1452,7 +1452,7 @@ void WriteInitialization::writeProperties(const QString &varName,
case DomProperty::Url: {
const DomUrl* u = p->elementUrl();
- propertyValue = QString::fromLatin1("QUrl(%1)")
+ propertyValue = QString::fromLatin1("QUrl(QString::fromUtf8(%1))")
.arg(fixString(u->elementString()->text(), m_dindent));
break;
}
diff --git a/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h b/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
index e2539aaaf1..f5a93d98d2 100644
--- a/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
@@ -199,19 +199,6 @@ QT_END_NAMESPACE
[super setInitialFirstResponder:view];
}
-- (void)setInitialFirstResponder:(NSView *)view
-{
- // This method is called the first time the window is placed on screen and
- // is the earliest point in time we can connect OpenGL contexts to NSViews.
- QWidget *qwidget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
- if (qwidget) {
- qt_event_request_window_change(qwidget);
- qt_mac_send_posted_gl_updates(qwidget);
- }
-
- [super setInitialFirstResponder:view];
-}
-
- (BOOL)makeFirstResponder:(NSResponder *)responder
{
// For some reason Cocoa wants to flip the first responder
diff --git a/src/widgets/platforms/mac/qfontengine_coretext.mm b/src/widgets/platforms/mac/qfontengine_coretext.mm
index 24bd750e80..737edc3a8c 100644
--- a/src/widgets/platforms/mac/qfontengine_coretext.mm
+++ b/src/widgets/platforms/mac/qfontengine_coretext.mm
@@ -100,7 +100,12 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const QCFString &name, const
QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithNameAndSize(name, fontDef.pixelSize);
QCFType<CTFontRef> baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pixelSize, &transform);
- ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits);
+ ctfont = NULL;
+ // There is a side effect in Core Text: if we apply 0 as symbolic traits to a font in normal weight,
+ // we will get the light version of that font (while the way supposed to work doesn't:
+ // setting kCTFontWeightTrait to some value between -1.0 to 0.0 has no effect on font selection)
+ if (fontDef.weight != QFont::Normal || symbolicTraits)
+ ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits);
// CTFontCreateCopyWithSymbolicTraits returns NULL if we ask for a trait that does
// not exist for the given font. (for example italic)
diff --git a/src/widgets/platforms/mac/qpixmap_mac.cpp b/src/widgets/platforms/mac/qpixmap_mac.cpp
index 7e31f5b80b..cb3016177d 100644
--- a/src/widgets/platforms/mac/qpixmap_mac.cpp
+++ b/src/widgets/platforms/mac/qpixmap_mac.cpp
@@ -54,6 +54,7 @@
#include <private/qpaintengine_mac_p.h>
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
+#include <private/qapplication_p.h>
#include <limits.h>
#include <string.h>
@@ -73,12 +74,18 @@ static int qt_pixmap_serial = 0;
Q_GUI_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix)
{
- return static_cast<QMacPixmapData*>(pix->data.data())->pixels;
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+ return reinterpret_cast<quint32 *>(static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bits());
+ else
+ return static_cast<QMacPixmapData*>(pix->data.data())->pixels;
}
Q_GUI_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix)
{
- return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow;
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+ return static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bytesPerLine();
+ else
+ return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow;
}
void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t)
diff --git a/src/widgets/platforms/mac/qwidget_mac.mm b/src/widgets/platforms/mac/qwidget_mac.mm
index 9a873f32ac..3a025e9237 100644
--- a/src/widgets/platforms/mac/qwidget_mac.mm
+++ b/src/widgets/platforms/mac/qwidget_mac.mm
@@ -4541,6 +4541,11 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
QPoint oldp = q->pos();
QSize olds = q->size();
+ // Apply size restrictions, applicable for Windows & Widgets.
+ if (QWExtra *extra = extraData()) {
+ w = qBound(extra->minw, w, extra->maxw);
+ h = qBound(extra->minh, h, extra->maxh);
+ }
const bool isResize = (olds != QSize(w, h));
if (!realWindow && !isResize && QPoint(x, y) == oldp)
@@ -4550,13 +4555,6 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
data.window_state = data.window_state & ~Qt::WindowMaximized;
const bool visible = q->isVisible();
- // Apply size restrictions, applicable for Windows & Widgets.
- if (QWExtra *extra = extraData()) {
- w = qMin(w, extra->maxw);
- h = qMin(h, extra->maxh);
- w = qMax(w, extra->minw);
- h = qMax(h, extra->minh);
- }
data.crect = QRect(x, y, w, h);
if (realWindow) {
diff --git a/src/widgets/platforms/x11/qfontdatabase_x11.cpp b/src/widgets/platforms/x11/qfontdatabase_x11.cpp
index 8a13d91fbb..a5fdcb5216 100644
--- a/src/widgets/platforms/x11/qfontdatabase_x11.cpp
+++ b/src/widgets/platforms/x11/qfontdatabase_x11.cpp
@@ -1996,6 +1996,11 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
QFontCache::instance()->insertEngine(key, fe);
}
+// Needed for fontconfig version < 2.2.97
+#ifndef FC_FAMILYLANG
+#define FC_FAMILYLANG "familylang"
+#endif
+
static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
{
#if defined(QT_NO_FONTCONFIG)
diff --git a/src/widgets/platforms/x11/qfontengine_x11.cpp b/src/widgets/platforms/x11/qfontengine_x11.cpp
index 099704894c..e3bfa5df46 100644
--- a/src/widgets/platforms/x11/qfontengine_x11.cpp
+++ b/src/widgets/platforms/x11/qfontengine_x11.cpp
@@ -1205,7 +1205,9 @@ QFontEngine *QFontEngineX11FT::cloneWithSize(qreal pixelSize) const
delete fe;
return 0;
} else {
+#ifndef QT_NO_XRENDER
fe->xglyph_format = xglyph_format;
+#endif
return fe;
}
}
diff --git a/src/widgets/to_be_moved/qlinecontrol.cpp b/src/widgets/to_be_moved/qlinecontrol.cpp
index ee7d7fb126..bf36033c08 100644
--- a/src/widgets/to_be_moved/qlinecontrol.cpp
+++ b/src/widgets/to_be_moved/qlinecontrol.cpp
@@ -435,6 +435,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
m_cursor += event->replacementStart();
+ if (m_cursor < 0)
+ m_cursor = 0;
// insert commit string
if (event->replacementLength()) {
@@ -447,7 +449,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
cursorPositionChanged = true;
}
- m_cursor = qMin(c, m_text.length());
+ m_cursor = qBound(0, c, m_text.length());
for (int i = 0; i < event->attributes().size(); ++i) {
const QInputMethodEvent::Attribute &a = event->attributes().at(i);
diff --git a/src/widgets/to_be_moved/qtextcontrol.cpp b/src/widgets/to_be_moved/qtextcontrol.cpp
index 149c29213e..ab294b9e0d 100644
--- a/src/widgets/to_be_moved/qtextcontrol.cpp
+++ b/src/widgets/to_be_moved/qtextcontrol.cpp
@@ -677,7 +677,7 @@ void QTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qrea
const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();
- if (mouseXPosition < wordStartX || mouseXPosition > wordEndX)
+ if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
return;
// keep the already selected word even when moving to the left
@@ -1579,8 +1579,10 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con
emit q->cursorPositionChanged();
_q_updateCurrentCharFormatAndSelection();
} else {
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
selectionChanged();
}
repaintOldAndNewSelection(oldSelection);
diff --git a/tests/auto/macgui/macgui.pro b/tests/auto/macgui/macgui.pro
index 0ed2350a48..7e40d81808 100644
--- a/tests/auto/macgui/macgui.pro
+++ b/tests/auto/macgui/macgui.pro
@@ -7,5 +7,7 @@ INCLUDEPATH += .
SOURCES += tst_macgui.cpp guitest.cpp
HEADERS += guitest.h
+QT = core-private gui-private
+
requires(mac)
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index 6c0e2611c0..03b2d79bba 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -947,21 +947,16 @@ void tst_QAccessibility::doAction()
void tst_QAccessibility::applicationTest()
{
-#ifdef QTEST_ACCESSIBILITY
QLatin1String name = QLatin1String("My Name");
qApp->setApplicationName(name);
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(qApp);
QCOMPARE(interface->text(QAccessible::Name, 0), name);
QCOMPARE(interface->role(0), QAccessible::Application);
delete interface;
-#else
- QSKIP("Test needs accessibility support.", SkipAll);
-#endif
}
void tst_QAccessibility::mainWindowTest()
{
-#ifdef QTEST_ACCESSIBILITY
QMainWindow mw;
mw.resize(300, 200);
mw.show(); // triggers layout
@@ -974,10 +969,6 @@ void tst_QAccessibility::mainWindowTest()
QCOMPARE(interface->text(QAccessible::Name, 0), name);
QCOMPARE(interface->role(0), QAccessible::Window);
delete interface;
-
-#else
- QSKIP("Test needs accessibility support.", SkipAll);
-#endif
}
class CounterButton : public QPushButton {
@@ -1295,7 +1286,6 @@ void tst_QAccessibility::tabTest()
void tst_QAccessibility::tabWidgetTest()
{
-#ifdef QTEST_ACCESSIBILITY
QTabWidget *tabWidget = new QTabWidget();
tabWidget->show();
@@ -1381,9 +1371,6 @@ void tst_QAccessibility::tabWidgetTest()
delete interface;
delete tabWidget;
QTestAccessibility::clearEvents();
-#else
- QSKIP("Test needs accessibility support.", SkipAll);
-#endif
}
void tst_QAccessibility::menuTest()
diff --git a/tests/auto/qcompleter/qcompleter.pro b/tests/auto/qcompleter/qcompleter.pro
index d23e1eb366..cde64ec672 100644
--- a/tests/auto/qcompleter/qcompleter.pro
+++ b/tests/auto/qcompleter/qcompleter.pro
@@ -1,6 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 26 13:53:24 2006
-######################################################################
load(qttest_p4)
TEMPLATE = app
TARGET = tst_qcompleter
@@ -8,10 +5,5 @@ QT += widgets
DEPENDPATH += .
INCLUDEPATH += . ..
-CONFIG += console qtestlib
-
# Input
SOURCES += tst_qcompleter.cpp
-
-
-
diff --git a/tests/auto/qerrormessage/qerrormessage.pro b/tests/auto/qerrormessage/qerrormessage.pro
index 4ac8466127..363d085cbf 100644
--- a/tests/auto/qerrormessage/qerrormessage.pro
+++ b/tests/auto/qerrormessage/qerrormessage.pro
@@ -1,15 +1,10 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 26 13:53:24 2006
-######################################################################
load(qttest_p4)
TEMPLATE = app
TARGET = tst_qerrormessage
DEPENDPATH += .
INCLUDEPATH += .
+
QT += widgets
-CONFIG += console qtestlib
+
# Input
SOURCES += tst_qerrormessage.cpp
-
-
-
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index 74b71ad455..93c08cdc6b 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -316,16 +316,16 @@ void tst_QHostInfo::lookupIPv6_data()
QTest::addColumn<QString>("addresses");
QTest::addColumn<int>("err");
- QTest::newRow("ipv6-net") << "www.ipv6-net.org" << "62.93.217.177 2001:618:1401:0:0:0:0:4" << int(QHostInfo::NoError);
- QTest::newRow("ipv6-test") << "ipv6-test.dev.troll.no" << "2001:638:a00:2:0:0:0:2" << int(QHostInfo::NoError);
- QTest::newRow("dns6-test") << "dns6-test-dev.troll.no" << "2001:470:1f01:115:0:0:0:10" << int(QHostInfo::NoError);
- QTest::newRow("multi-dns6") << "multi-dns6-test-dev.troll.no" << "2001:470:1f01:115:0:0:0:11 2001:470:1f01:115:0:0:0:12" << int(QHostInfo::NoError);
- QTest::newRow("dns46-test") << "dns46-test-dev.troll.no" << "10.3.4.90 2001:470:1f01:115:0:0:0:13" << int(QHostInfo::NoError);
+ QTest::newRow("ipv6-net") << "www.ipv6-net.org" << "62.93.217.177 2001:618:1401::4" << int(QHostInfo::NoError);
+ QTest::newRow("ipv6-test") << "ipv6-test.dev.troll.no" << "2001:638:a00:2::2" << int(QHostInfo::NoError);
+ QTest::newRow("dns6-test") << "dns6-test-dev.troll.no" << "2001:470:1f01:115::10" << int(QHostInfo::NoError);
+ QTest::newRow("multi-dns6") << "multi-dns6-test-dev.troll.no" << "2001:470:1f01:115::11 2001:470:1f01:115::12" << int(QHostInfo::NoError);
+ QTest::newRow("dns46-test") << "dns46-test-dev.troll.no" << "10.3.4.90 2001:470:1f01:115::13" << int(QHostInfo::NoError);
// avoid using real IPv6 addresses here because this will do a DNS query
// real addresses are between 2000:: and 3fff:ffff:ffff:ffff:ffff:ffff:ffff
QTest::newRow("literal_ip6") << "f001:6b0:1:ea:202:a5ff:fecd:13a6" << "f001:6b0:1:ea:202:a5ff:fecd:13a6" << int(QHostInfo::NoError);
- QTest::newRow("literal_shortip6") << "f001:618:1401::4" << "f001:618:1401:0:0:0:0:4" << int(QHostInfo::NoError);
+ QTest::newRow("literal_shortip6") << "f001:618:1401::4" << "f001:618:1401::4" << int(QHostInfo::NoError);
}
void tst_QHostInfo::lookupIPv6()
diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp
index 496f3d9170..3901b6ffe8 100644
--- a/tests/auto/qlist/tst_qlist.cpp
+++ b/tests/auto/qlist/tst_qlist.cpp
@@ -200,6 +200,9 @@ void tst_QList::mid() const
QCOMPARE(list.mid(3, 3),
QList<QString>() << "bak" << "buck" << "hello");
+
+ QList<int> list1;
+ QCOMPARE(list1.mid(1, 1).length(), 0);
}
void tst_QList::at() const
diff --git a/tests/auto/qlocalsocket/lackey/lackey.pro b/tests/auto/qlocalsocket/lackey/lackey.pro
index 6af58b122a..2573222c8b 100644
--- a/tests/auto/qlocalsocket/lackey/lackey.pro
+++ b/tests/auto/qlocalsocket/lackey/lackey.pro
@@ -1,10 +1,6 @@
#include(../src/src.pri)
-QT = core script network
-
-requires(contains(QT_CONFIG,script))
-
-CONFIG += qtestlib
+QT = core script network testlib
DESTDIR = ./
diff --git a/tests/auto/qmessagebox/qmessagebox.pro b/tests/auto/qmessagebox/qmessagebox.pro
index cbec1db9b5..bc1402e615 100644
--- a/tests/auto/qmessagebox/qmessagebox.pro
+++ b/tests/auto/qmessagebox/qmessagebox.pro
@@ -1,6 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 26 13:53:24 2006
-######################################################################
load(qttest_p4)
TEMPLATE = app
TARGET = tst_qmessagebox
@@ -8,7 +5,6 @@ QT += widgets
DEPENDPATH += .
INCLUDEPATH += .
-CONFIG += console qtestlib
# Input
SOURCES += tst_qmessagebox.cpp
diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
index 2b11219aa4..d29ef77347 100644
--- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
@@ -357,7 +357,7 @@ void tst_QNetworkConfigurationManager::usedInThread()
connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
thread.start();
QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread
- QVERIFY(thread.isFinished());
+ QVERIFY(!QTestEventLoop::instance().timeout());
qDebug() << "prescan:" << thread.preScanConfigs.count();
qDebug() << "postscan:" << thread.configs.count();
@@ -368,7 +368,9 @@ void tst_QNetworkConfigurationManager::usedInThread()
QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
QList<QNetworkConfiguration> configs = manager.allConfigurations();
QCOMPARE(thread.configs, configs);
- QCOMPARE(thread.preScanConfigs, preScanConfigs);
+ //Don't compare pre scan configs, because these may be cached and therefore give different results
+ //which makes the test unstable. The post scan results should have all configurations every time
+ //QCOMPARE(thread.preScanConfigs, preScanConfigs);
#endif
}
diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index d59a5105ae..1b4256bb00 100644
--- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -42,7 +42,7 @@
#include <QtTest/QtTest>
#include <QtNetwork/QNetworkCookieJar>
-#include "private/qnetworkcookiejar_p.h"
+#include "private/qtldurl_p.h"
class tst_QNetworkCookieJar: public QObject
{
@@ -438,7 +438,7 @@ void tst_QNetworkCookieJar::effectiveTLDs()
#endif
QFETCH(QString, domain);
QFETCH(bool, isTLD);
- QCOMPARE(QNetworkCookieJarPrivate::isEffectiveTLD(domain), isTLD);
+ QCOMPARE(qIsEffectiveTLD(domain), isTLD);
}
QTEST_MAIN(tst_QNetworkCookieJar)
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 4f5bd193c5..67b6e5c5b4 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -457,9 +457,9 @@ public:
: client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6),
multiple(false), totalConnections(0)
{
- if( useipv6 ){
+ if (useipv6) {
listen(QHostAddress::AnyIPv6);
- }else{
+ } else {
listen();
}
if (thread) {
@@ -2338,8 +2338,9 @@ void tst_QNetworkReply::connectToIPv6Address_data()
QTest::addColumn<QUrl>("url");
QTest::addColumn<QNetworkReply::NetworkError>("error");
QTest::addColumn<QByteArray>("dataToSend");
- QTest::addColumn<QByteArray>("serverVerifyData");
- QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("\r\nHost: [::1]\r\n");
+ QTest::addColumn<QByteArray>("hostfield");
+ QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("[::1]");
+ //QTest::newRow("ipv4localhost") << QUrl(QByteArray("http://127.0.0.1")) << QNetworkReply::NoError<< QByteArray("ipv4localhost") << QByteArray("127.0.0.1");
//to add more test data here
}
@@ -2348,7 +2349,7 @@ void tst_QNetworkReply::connectToIPv6Address()
QFETCH(QUrl, url);
QFETCH(QNetworkReply::NetworkError, error);
QFETCH(QByteArray, dataToSend);
- QFETCH(QByteArray, serverVerifyData);
+ QFETCH(QByteArray, hostfield);
QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: ");
httpResponse += QByteArray::number(dataToSend.size());
@@ -2366,10 +2367,9 @@ void tst_QNetworkReply::connectToIPv6Address()
QTestEventLoop::instance().enterLoop(10);
QVERIFY(!QTestEventLoop::instance().timeout());
QByteArray content = reply->readAll();
- if( !serverVerifyData.isEmpty()){
- //qDebug() << server.receivedData;
- //QVERIFY(server.receivedData.contains(serverVerifyData)); //got a bug here
- }
+ //qDebug() << server.receivedData;
+ QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n";
+ QVERIFY(server.receivedData.contains(hostinfo));
QVERIFY(content == dataToSend);
QCOMPARE(reply->url(), request.url());
QVERIFY(reply->error() == error);
diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem
new file mode 100644
index 0000000000..e1b731d69b
--- /dev/null
+++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICkTCCAfqgAwIBAgIJAL1nF+PLAF2KMA0GCSqGSIb3DQEBBQUAMGkxKzApBgNV
+BAoMIkjElcSCxrLDvyDKjeG6v8qI4bq34bi7IFLDqWPDtnJkxZ0xFTATBgNVBAsM
+DOOIp0HjiYHvvatCQzEWMBQGA1UEAwwNSm9obm55IEd1aXRhcjELMAkGA1UEBhMC
+Tk8wHhcNMTEwNTA1MDgxMzEwWhcNMTEwNjA0MDgxMzEwWjBpMSswKQYDVQQKDCJI
+xJXEgsayw78gyo3hur/KiOG6t+G4uyBSw6ljw7ZyZMWdMRUwEwYDVQQLDAzjiKdB
+44mB772rQkMxFjAUBgNVBAMMDUpvaG5ueSBHdWl0YXIxCzAJBgNVBAYTAk5PMIGf
+MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2zSxS17I6596dJE/VAmGz+06D9S8n
+3C0hnIGNVu+LwbgDJTvOw0SzNj4UP72UGgd3UI1KLBg5XWIsRNmE3COJMMh6syjI
+L1Ept+tVXxGL6n4gl+0nZ7dkUyxJmeFtigYrL+qCH1yd5rmf3sC3jO4IosuAiG66
+IDkJEVo64NT8ZQIDAQABo0EwPzA9BgNVHREENjA0gQ9hcm5lQGZvb2Jhci5vcmeC
+Dnd3dy5mb29iYXIub3JngRFiamFybmVAZm9vYmFyLm9yZzANBgkqhkiG9w0BAQUF
+AAOBgQAqVhbC0/EUFdnKlYV3PrknwGX1dPEPGJuIQHa0KpoicvNiOhs1HxBDYbzc
+F6wcAMEynq4YwGKhcQLZOs2mo0LreAjA9rU/yBnqrnUW/4gxtUUvmJKK+62IjfLp
+eO1L+1NcEMJiaZf8fip4VXhXdOYUhgE8WUZ1UJRC6w3T/yAgcQ==
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san
new file mode 100644
index 0000000000..f46a637da4
--- /dev/null
+++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san
@@ -0,0 +1,5 @@
+[subj_alt_name]
+subjectAltName=\
+ email:arne@foobar.org,\
+ DNS:www.foobar.org,\
+ email:bjarne@foobar.org
diff --git a/tests/auto/qsslcertificate/certificates/gencertificates.sh b/tests/auto/qsslcertificate/certificates/gencertificates.sh
index 9f873d9c1b..0bac191326 100755
--- a/tests/auto/qsslcertificate/certificates/gencertificates.sh
+++ b/tests/auto/qsslcertificate/certificates/gencertificates.sh
@@ -90,5 +90,15 @@ openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \
-config san.cnf -extensions subj_alt_name
/bin/cp san.cnf $outname.san
+#--- Non-ASCII Subject ---------------------------------------------------------------------
+echo -e "\n generating self signed root cert. with Subject containing UTF-8 characters ..."
+outname=cert-ss-san-utf8.pem
+#subject="/O=HĕĂƲÿ ʍếʈặḻ Récördŝ/OU=㈧A㉁ォBC/CN=Johnny Guitar/C=NO"
+subject=$'/O=H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba\xb7\xe1\xb8\xbb R\xc3\xa9c\xc3\xb6rd\xc5\x9d/OU=\xe3\x88\xa7A\xe3\x89\x81\xef\xbd\xabBC/CN=Johnny Guitar/C=NO'
+openssl req -out req-san.pem -new -key rsa-pri-1024.pem -utf8 -subj "$subject"
+openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \
+ -config san.cnf -extensions subj_alt_name -nameopt multiline,utf8,-esc_msb
+/bin/cp san.cnf $outname.san
+
echo -e "\n cleaning up ..."
/bin/rm rsa-pri-1024.pem rsa-pub-1024.* req*.pem
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index c38147d417..9276685928 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -96,6 +96,7 @@ private slots:
void digest_data();
void digest();
void alternateSubjectNames_data();
+ void utf8SubjectNames();
void alternateSubjectNames();
void publicKey_data();
void publicKey();
@@ -407,6 +408,27 @@ void tst_QSslCertificate::alternateSubjectNames()
}
}
+void tst_QSslCertificate::utf8SubjectNames()
+{
+ QSslCertificate cert = QSslCertificate::fromPath("certificates/cert-ss-san-utf8.pem", QSsl::Pem,
+ QRegExp::FixedString).first();
+ QVERIFY(!cert.isNull());
+
+ // O is "Heavy Metal Records" with heavy use of "decorations" like accents, umlauts etc.,
+ // OU uses arabian / asian script letters near codepoint 64K.
+ // strings split where the compiler would otherwise find three-digit hex numbers
+ static const char *o = "H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba"
+ "\xb7\xe1\xb8\xbb R\xc3\xa9" "c" "\xc3\xb6rd\xc5\x9d";
+ static const char *ou = "\xe3\x88\xa7" "A" "\xe3\x89\x81\xef\xbd\xab" "BC";
+
+ // the following two tests should help find "\x"-literal encoding bugs in the test itself
+ QCOMPARE(cert.subjectInfo("O").length(), QString::fromUtf8(o).length());
+ QCOMPARE (cert.subjectInfo("O").toUtf8().toHex(), QByteArray(o).toHex());
+
+ QCOMPARE(cert.subjectInfo("O"), QString::fromUtf8(o));
+ QCOMPARE(cert.subjectInfo("OU"), QString::fromUtf8(ou));
+}
+
void tst_QSslCertificate::publicKey_data()
{
QTest::addColumn<QString>("certFilePath");
@@ -519,13 +541,13 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"certificates/*\" fixed der") << QString("certificates/*") << int(QRegExp::FixedString) << false << 0;
QTest::newRow("\"certificates/*\" regexp pem") << QString("certificates/*") << int(QRegExp::RegExp) << true << 0;
QTest::newRow("\"certificates/*\" regexp der") << QString("certificates/*") << int(QRegExp::RegExp) << false << 0;
- QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 4;
+ QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 5;
QTest::newRow("\"certificates/*\" wildcard der") << QString("certificates/*") << int(QRegExp::Wildcard) << false << 0;
QTest::newRow("\"c*/c*.pem\" fixed pem") << QString("c*/c*.pem") << int(QRegExp::FixedString) << true << 0;
QTest::newRow("\"c*/c*.pem\" fixed der") << QString("c*/c*.pem") << int(QRegExp::FixedString) << false << 0;
QTest::newRow("\"c*/c*.pem\" regexp pem") << QString("c*/c*.pem") << int(QRegExp::RegExp) << true << 0;
QTest::newRow("\"c*/c*.pem\" regexp der") << QString("c*/c*.pem") << int(QRegExp::RegExp) << false << 0;
- QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 4;
+ QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 5;
QTest::newRow("\"c*/c*.pem\" wildcard der") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << false << 0;
QTest::newRow("\"d*/c*.pem\" fixed pem") << QString("d*/c*.pem") << int(QRegExp::FixedString) << true << 0;
QTest::newRow("\"d*/c*.pem\" fixed der") << QString("d*/c*.pem") << int(QRegExp::FixedString) << false << 0;
@@ -535,7 +557,7 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"d*/c*.pem\" wildcard der") << QString("d*/c*.pem") << int(QRegExp::Wildcard) << false << 0;
QTest::newRow("\"c.*/c.*.pem\" fixed pem") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << true << 0;
QTest::newRow("\"c.*/c.*.pem\" fixed der") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << false << 0;
- QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 4;
+ QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 5;
QTest::newRow("\"c.*/c.*.pem\" regexp der") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << false << 0;
QTest::newRow("\"c.*/c.*.pem\" wildcard pem") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0;
QTest::newRow("\"c.*/c.*.pem\" wildcard der") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0;
@@ -546,7 +568,7 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0;
QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0;
#ifdef Q_OS_LINUX
- QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 4;
+ QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 5;
#endif
QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1;
@@ -769,7 +791,7 @@ void tst_QSslCertificate::nulInCN()
QString cn = cert.subjectInfo(QSslCertificate::CommonName);
QVERIFY(cn != "www.bank.com");
- static const char realCN[] = "www.bank.com\\x00.badguy.com";
+ static const char realCN[] = "www.bank.com\0.badguy.com";
QCOMPARE(cn, QString::fromLatin1(realCN, sizeof realCN - 1));
}
diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 74ffff2db7..74a254cbf4 100644
--- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -146,6 +146,15 @@ void tst_QtConcurrentMap::map()
QCOMPARE(numberList, QList<Number>() << 2 << 4 << 6);
QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished();
QCOMPARE(numberList, QList<Number>() << 4 << 8 << 12);
+
+#ifdef Q_COMPILER_LAMBDA
+ // lambda
+ QtConcurrent::map(list, [](int &x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 128 << 256 << 384);
+ QtConcurrent::map(list.begin(), list.end(), [](int &x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 256 << 512 << 768);
+#endif
+
}
// functors don't take arguments by reference, making these no-ops
@@ -170,6 +179,14 @@ void tst_QtConcurrentMap::map()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QtConcurrent::map(list.begin(), list.end(), multiplyBy2Immutable).waitForFinished();
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+
+#ifdef Q_COMPILER_LAMBDA
+ // lambda
+ QtConcurrent::map(list, [](int x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QtConcurrent::map(list.begin(), list.end(), [](int x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+#endif
}
// Linked lists and forward iterators
@@ -2303,6 +2320,10 @@ void tst_QtConcurrentMap::stlContainers()
{
#ifdef QT_NO_STL
QSKIP("Qt compiled without STL support", SkipAll);
+#elif defined(Q_COMPILER_RVALUE_REFS)
+ //mapped uses &Container::push_back, but in c++0x, std::vector has two overload of it
+ // meaning it is not possible to take the address of that function anymore.
+ QSKIP("mapped do not work with c++0x stl vector", SkipAll);
#else
std::vector<int> vector;
vector.push_back(1);
diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
index e4e9479a13..cacb09aae1 100644
--- a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -67,6 +67,8 @@ private slots:
#if 0
void createFunctor();
#endif
+ void functor();
+ void lambda();
};
#if 0
@@ -444,6 +446,71 @@ void tst_QtConcurrentRun::createFunctor()
}
#endif
+struct Functor {
+ int operator()() { return 42; }
+ double operator()(double a, double b) { return a/b; }
+ int operator()(int a, int b) { return a/b; }
+ void operator()(int) { }
+ void operator()(int, int, int) { }
+ void operator()(int, int, int, int) { }
+ void operator()(int, int, int, int, int) { }
+ void operator()(int, int, int, int, int, int) { }
+};
+
+void tst_QtConcurrentRun::functor()
+{
+ //this test functor without result_type, decltype need to be supported by the compiler
+#ifndef Q_COMPILER_DECLTYPE
+ QSKIP("Compiler do not suport decltype", SkipAll);
+#else
+ Functor f;
+ {
+ QFuture<int> fut = QtConcurrent::run(f);
+ QCOMPARE(fut.result(), 42);
+ }
+ {
+ QFuture<double> fut = QtConcurrent::run(f, 8.5, 1.8);
+ QCOMPARE(fut.result(), (8.5/1.8));
+ }
+ {
+ QFuture<int> fut = QtConcurrent::run(f, 19, 3);
+ QCOMPARE(fut.result(), int(19/3));
+ }
+ {
+ QtConcurrent::run(f, 1).waitForFinished();
+ QtConcurrent::run(f, 1,2).waitForFinished();
+ QtConcurrent::run(f, 1,2,3).waitForFinished();
+ QtConcurrent::run(f, 1,2,3,4).waitForFinished();
+ QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
+ }
+#endif
+}
+
+
+void tst_QtConcurrentRun::lambda()
+{
+#ifndef Q_COMPILER_LAMBDA
+ QSKIP("Compiler do not suport lambda", SkipAll);
+#else
+
+ QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
+ QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
+ QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
+ QCOMPARE(QtConcurrent::run([](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5);
+
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+ {
+ QString str { "Hello World Foo" };
+ QFuture<QStringList> f1 = QtConcurrent::run([&](){ return str.split(' '); });
+ auto r = f1.result();
+ QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
+ }
+#endif
+
+#endif
+}
+
+
#include "tst_qtconcurrentrun.moc"
#else
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index b6adc2b8a0..2414ab3e37 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -127,6 +127,8 @@ private slots:
void textWithSurrogates_qtbug15679();
void textWidthWithStackedTextEngine();
void textWidthWithLineSeparator();
+ void cursorInLigatureWithMultipleLines();
+ void xToCursorForLigatures();
private:
QFont testFont;
@@ -1460,5 +1462,45 @@ void tst_QTextLayout::textWidthWithLineSeparator()
QCOMPARE(line1.naturalTextWidth(), line2.naturalTextWidth());
}
+void tst_QTextLayout::cursorInLigatureWithMultipleLines()
+{
+#if !defined(Q_WS_MAC)
+ QSKIP("This test can not be run on Mac", SkipAll);
+#endif
+ QTextLayout layout("first line finish", QFont("Times", 20));
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(70);
+ line = layout.createLine();
+ layout.endLayout();
+
+ // The second line will be "finish", with "fi" as a ligature
+ QVERIFY(line.cursorToX(0) != line.cursorToX(1));
+}
+
+void tst_QTextLayout::xToCursorForLigatures()
+{
+#if !defined(Q_WS_MAC)
+ QSKIP("This test can not be run on Mac", SkipAll);
+#endif
+ QTextLayout layout("fi", QFont("Times", 20));
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QVERIFY(line.xToCursor(0) != line.xToCursor(line.naturalTextWidth() / 2));
+
+ // U+0061 U+0308
+ QTextLayout layout2(QString::fromUtf8("\x61\xCC\x88"), QFont("Times", 20));
+
+ layout2.beginLayout();
+ line = layout2.createLine();
+ layout2.endLayout();
+
+ qreal width = line.naturalTextWidth();
+ QVERIFY(line.xToCursor(0) == line.xToCursor(width / 2) ||
+ line.xToCursor(width) == line.xToCursor(width / 2));
+}
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qtipc/lackey/lackey.pro b/tests/auto/qtipc/lackey/lackey.pro
index 2fa364c4c9..91659d701e 100644
--- a/tests/auto/qtipc/lackey/lackey.pro
+++ b/tests/auto/qtipc/lackey/lackey.pro
@@ -1,17 +1,12 @@
include(../qsharedmemory/src/src.pri)
-QT = core script
-QT += core-private
-
-CONFIG += qtestlib
+QT = core-private script testlib
DESTDIR = ./
win32: CONFIG += console
mac:CONFIG -= app_bundle
-requires(contains(QT_CONFIG,script))
-
DEFINES += QSHAREDMEMORY_DEBUG
DEFINES += QSYSTEMSEMAPHORE_DEBUG
diff --git a/tests/auto/qurl/qurl.pro b/tests/auto/qurl/qurl.pro
index a5c39a5a98..a43a57e002 100644
--- a/tests/auto/qurl/qurl.pro
+++ b/tests/auto/qurl/qurl.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
SOURCES += tst_qurl.cpp
-QT = core
+QT = core core-private
symbian: TARGET.CAPABILITY = NetworkServices
CONFIG += parallel_test
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 30f1a10717..4aa7185c17 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -49,6 +49,7 @@
#include <qurl.h>
#include <qtextcodec.h>
#include <qmap.h>
+#include "private/qtldurl_p.h"
// For testsuites
#define IDNA_ACE_PREFIX "xn--"
@@ -88,6 +89,8 @@ public slots:
void init();
void cleanup();
private slots:
+ void effectiveTLDs_data();
+ void effectiveTLDs();
void getSetCheck();
void constructing();
void assignment();
@@ -3994,5 +3997,28 @@ void tst_QUrl::taskQTBUG_8701()
QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString());
}
+void tst_QUrl::effectiveTLDs_data()
+{
+ QTest::addColumn<QUrl>("domain");
+ QTest::addColumn<QString>("TLD");
+
+ QTest::newRow("yes0") << QUrl::fromEncoded("http://test.co.uk") << ".co.uk";
+ QTest::newRow("yes1") << QUrl::fromEncoded("http://test.com") << ".com";
+ QTest::newRow("yes2") << QUrl::fromEncoded("http://www.test.de") << ".de";
+ QTest::newRow("yes3") << QUrl::fromEncoded("http://test.ulm.museum") << ".ulm.museum";
+ QTest::newRow("yes4") << QUrl::fromEncoded("http://www.com.krodsherad.no") << ".krodsherad.no";
+ QTest::newRow("yes5") << QUrl::fromEncoded("http://www.co.uk.1.bg") << ".1.bg";
+ QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn";
+ QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws";
+ QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum";
+}
+
+void tst_QUrl::effectiveTLDs()
+{
+ QFETCH(QUrl, domain);
+ QFETCH(QString, TLD);
+ QCOMPARE(domain.topLevelDomain(), TLD);
+}
+
QTEST_MAIN(tst_QUrl)
#include "tst_qurl.moc"
diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp
index 6333e837d5..4948312fd4 100644
--- a/tests/auto/quuid/tst_quuid.cpp
+++ b/tests/auto/quuid/tst_quuid.cpp
@@ -60,7 +60,14 @@ public:
tst_QUuid();
private slots:
+ void fromChar();
void toString();
+ void fromString();
+ void toByteArray();
+ void fromByteArray();
+ void toRfc4122();
+ void fromRfc4122();
+ void check_QDataStream();
void isNull();
void equal();
void notEqual();
@@ -83,16 +90,106 @@ public:
tst_QUuid::tst_QUuid()
{
- uuidA = "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}";
- uuidB = "{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
+ //"{fc69b59e-cc34-4436-a43c-ee95d128b8c5}";
+ uuidA = QUuid(0xfc69b59e, 0xcc34 ,0x4436 ,0xa4 ,0x3c ,0xee ,0x95 ,0xd1 ,0x28 ,0xb8 ,0xc5);
+
+ //"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
+ uuidB = QUuid(0x1ab6e93a ,0xb1cb ,0x4a87 ,0xba ,0x47 ,0xec ,0x7e ,0x99 ,0x03 ,0x9a ,0x7b);
}
+void tst_QUuid::fromChar()
+{
+ QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+ QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+ QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5"));
+ QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5"));
+ QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c"));
+ QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34"));
+ QCOMPARE(QUuid(), QUuid("fc69b59e-cc34-"));
+ QCOMPARE(QUuid(), QUuid("fc69b59e-cc34"));
+ QCOMPARE(QUuid(), QUuid("cc34"));
+ QCOMPARE(QUuid(), QUuid(NULL));
+
+ QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+}
void tst_QUuid::toString()
{
QCOMPARE(uuidA.toString(), QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+
+ QCOMPARE(uuidB.toString(), QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"));
+}
+
+void tst_QUuid::fromString()
+{
+ QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(QUuid(), QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c")));
+
+ QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+}
+
+void tst_QUuid::toByteArray()
+{
+ QCOMPARE(uuidA.toByteArray(), QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+
+ QCOMPARE(uuidB.toByteArray(), QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"));
+}
+
+void tst_QUuid::fromByteArray()
+{
+ QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(QUuid(), QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c")));
+
+ QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+}
+
+void tst_QUuid::toRfc4122()
+{
+ QCOMPARE(uuidA.toRfc4122(), QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5"));
+
+ QCOMPARE(uuidB.toRfc4122(), QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b"));
}
+void tst_QUuid::fromRfc4122()
+{
+ QCOMPARE(uuidA, QUuid::fromRfc4122(QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5")));
+
+ QCOMPARE(uuidB, QUuid::fromRfc4122(QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b")));
+}
+
+void tst_QUuid::check_QDataStream()
+{
+ QUuid tmp;
+ QByteArray ar;
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ out.setByteOrder(QDataStream::BigEndian);
+ out << uuidA;
+ }
+ {
+ QDataStream in(&ar,QIODevice::ReadOnly);
+ in.setByteOrder(QDataStream::BigEndian);
+ in >> tmp;
+ QCOMPARE(uuidA, tmp);
+ }
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ out.setByteOrder(QDataStream::LittleEndian);
+ out << uuidA;
+ }
+ {
+ QDataStream in(&ar,QIODevice::ReadOnly);
+ in.setByteOrder(QDataStream::LittleEndian);
+ in >> tmp;
+ QCOMPARE(uuidA, tmp);
+ }
+}
void tst_QUuid::isNull()
{
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 1d3591d757..a795e89762 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -67,6 +67,7 @@
#include <QtGui/qpaintengine.h>
#include <private/qbackingstore_p.h>
#include <qmenubar.h>
+#include <qtableview.h>
#include <QtWidgets/QGraphicsView>
#include <QtWidgets/QGraphicsProxyWidget>
@@ -399,6 +400,7 @@ private slots:
void taskQTBUG_11373();
#endif // QT_MAC_USE_COCOA
#endif
+ void taskQTBUG_17333_ResizeInfiniteRecursion();
void nativeChildFocus();
@@ -10217,6 +10219,18 @@ void tst_QWidget::taskQTBUG_11373()
#endif // QT_MAC_USE_COCOA
#endif
+void tst_QWidget::taskQTBUG_17333_ResizeInfiniteRecursion()
+{
+ QTableView tb;
+ const char *s = "border: 1px solid;";
+ tb.setStyleSheet(s);
+ tb.show();
+
+ QTest::qWaitForWindowShown(&tb);
+ tb.setGeometry(QRect(100, 100, 0, 100));
+ // No crash, it works.
+}
+
void tst_QWidget::nativeChildFocus()
{
QWidget w;
diff --git a/tests/auto/uic/uic.pro b/tests/auto/uic/uic.pro
index 355cb56cea..0045015457 100644
--- a/tests/auto/uic/uic.pro
+++ b/tests/auto/uic/uic.pro
@@ -1,6 +1,5 @@
load(qttest_p4)
-CONFIG += qtestlib
SOURCES += tst_uic.cpp
TARGET = tst_uic
diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
index dbec65ca42..a035cf3627 100644
--- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
@@ -53,6 +53,18 @@ public:
private slots:
void createUuid();
+ void fromChar();
+ void toString();
+ void fromString();
+ void toByteArray();
+ void fromByteArray();
+ void toRfc4122();
+ void fromRfc4122();
+ void toDataStream();
+ void fromDataStream();
+ void isNull();
+ void operatorLess();
+ void operatorMore();
};
void tst_bench_QUuid::createUuid()
@@ -62,5 +74,118 @@ void tst_bench_QUuid::createUuid()
}
}
+void tst_bench_QUuid::fromChar()
+{
+ QBENCHMARK {
+ QUuid uuid("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}");
+ }
+}
+
+void tst_bench_QUuid::toString()
+{
+ QUuid uuid = QUuid::createUuid();
+ QBENCHMARK {
+ uuid.toString();
+ }
+}
+
+void tst_bench_QUuid::fromString()
+{
+ QString string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}";
+ QBENCHMARK {
+ QUuid uuid(string);
+ }
+}
+
+void tst_bench_QUuid::toByteArray()
+{
+ QUuid uuid = QUuid::createUuid();
+ QBENCHMARK {
+ uuid.toByteArray();
+ }
+}
+
+void tst_bench_QUuid::fromByteArray()
+{
+ QByteArray string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}";
+ QBENCHMARK {
+ QUuid uuid(string);
+ }
+}
+
+void tst_bench_QUuid::toRfc4122()
+{
+ QUuid uuid = QUuid::createUuid();
+ QBENCHMARK {
+ uuid.toRfc4122();
+ }
+}
+
+void tst_bench_QUuid::fromRfc4122()
+{
+ QByteArray string = QByteArray::fromHex("67C8770B44F1410AAB9AF9B5446F13EE");
+ QBENCHMARK {
+ QUuid uuid = QUuid::fromRfc4122(string);
+ }
+}
+
+void tst_bench_QUuid::toDataStream()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ QByteArray ar;
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ QBENCHMARK {
+ out << uuid1;
+ }
+ }
+}
+
+void tst_bench_QUuid::fromDataStream()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ QByteArray ar;
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ out << uuid1;
+ }
+ {
+ QDataStream in(&ar,QIODevice::ReadOnly);
+ QBENCHMARK {
+ in >> uuid2;
+ }
+ }
+}
+
+void tst_bench_QUuid::isNull()
+{
+ QUuid uuid = QUuid();
+ QBENCHMARK {
+ uuid.isNull();
+ }
+}
+
+void tst_bench_QUuid::operatorLess()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ uuid2 = QUuid::createUuid();
+ QBENCHMARK {
+ uuid1 < uuid2;
+ }
+}
+
+void tst_bench_QUuid::operatorMore()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ uuid2 = QUuid::createUuid();
+ QBENCHMARK {
+ uuid1 > uuid2;
+ }
+}
+
QTEST_MAIN(tst_bench_QUuid);
#include "tst_quuid.moc"
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp
index d62cdac9bb..95aaad3a25 100644
--- a/tests/benchmarks/corelib/tools/qstring/main.cpp
+++ b/tests/benchmarks/corelib/tools/qstring/main.cpp
@@ -53,6 +53,11 @@
#include <unistd.h>
#endif
+// MAP_ANON is deprecated on Linux, and MAP_ANONYMOUS is not present on Mac
+#ifndef MAP_ANONYMOUS
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+
#include <private/qsimd_p.h>
#include "data.h"
@@ -772,7 +777,7 @@ static void __attribute__((noinline)) equals2_selftest()
void *page1, *page3;
ushort *page2;
page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
+ page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize);
@@ -1329,7 +1334,7 @@ void tst_QString::ucstrncmp() const
void *page1, *page3;
ushort *page2;
page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
+ page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize);
diff --git a/util/network/cookiejar-generateTLDs/main.cpp b/util/corelib/qurl-generateTLDs/main.cpp
index b369ecee88..861546ce9e 100644
--- a/util/network/cookiejar-generateTLDs/main.cpp
+++ b/util/corelib/qurl-generateTLDs/main.cpp
@@ -77,7 +77,7 @@ int main(int argc, char **argv) {
printf(" wget http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -O effective_tld_names.dat\n");
printf(" grep '^[^\\/\\/]' effective_tld_names.dat > effective_tld_names.dat.trimmed\n");
printf(" %s effective_tld_names.dat.trimmed effective_tld_names.dat.qt\n\n", argv[0]);
- printf("Now copy the data from effective_tld_names.dat.qt to the file src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n\n");
+ printf("Now copy the data from effective_tld_names.dat.qt to the file src/corelib/io/qurltlds_p.h in your Qt repo\n\n");
exit(1);
}
QFile file(argv[1]);
@@ -156,6 +156,6 @@ int main(int argc, char **argv) {
outFile.write(outDataBufferBA);
outFile.write("};\n");
outFile.close();
- printf("data generated to %s . Now copy the data from this file to src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n", argv[2]);
+ printf("data generated to %s . Now copy the data from this file to src/corelib/io/qurltlds_p.h in your Qt repo\n", argv[2]);
exit(0);
}
diff --git a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro
index 9d5f1cf7f9..9d5f1cf7f9 100644
--- a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro
+++ b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro
diff --git a/util/lexgen/tests/tests.pro b/util/lexgen/tests/tests.pro
index eb04439a13..1a1e51d8c9 100644
--- a/util/lexgen/tests/tests.pro
+++ b/util/lexgen/tests/tests.pro
@@ -1,6 +1,5 @@
-CONFIG += qtestlib
SOURCES += tst_lexgen.cpp
TARGET = tst_lexgen
include(../lexgen.pri)
-QT = core
+QT = core testlib
DEFINES += SRCDIR=\\\"$$PWD\\\"