summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-25 10:11:49 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-08-25 12:48:52 +0200
commit04d0a9626ce61b2e05a40f9562c2bcf12e234639 (patch)
treef1643f829aedc9ac51fcc260f7df2639dfe08360
parent17f3451daa286b88a52f18c802d7b158dfb653b2 (diff)
parentbdc417b3828737334723eae23097c85f70c23a33 (diff)
Merge branch 'master' into refactor
Conflicts: src/gui/kernel/qapplication_qpa.cpp src/gui/kernel/qcursor_qpa.cpp src/gui/kernel/qwindowsysteminterface_qpa.cpp src/gui/kernel/qwindowsysteminterface_qpa.h src/gui/kernel/qwindowsysteminterface_qpa_p.h src/gui/text/qtextcontrol.cpp src/plugins/platforms/wayland/wayland.pro src/widgets/accessible/qaccessible2.h src/widgets/widgets/qwidgetlinecontrol_p.h Change-Id: I5e6f4eb184159dccc67e8f13673edb884d179c74
-rw-r--r--.gitignore44
-rwxr-xr-xbin/qtmodule-configtests2
-rwxr-xr-xbin/syncqt4
-rwxr-xr-xconfigure38
-rw-r--r--dist/changes-4.8.011
-rw-r--r--dist/changes-5.0.04
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qobject.cpp15
-rw-r--r--examples/opengl/cube/mainwidget.h2
-rw-r--r--examples/widgets/orientation/mainwindow.h2
-rw-r--r--mkspecs/features/default_post.prf8
-rw-r--r--mkspecs/features/qt_module_config.prf2
-rw-r--r--mkspecs/features/qt_plugin.prf2
-rw-r--r--src/corelib/arch/qatomic_armv6.h2
-rw-r--r--src/corelib/global/qnamespace.h6
-rw-r--r--src/corelib/global/qnamespace.qdoc7
-rw-r--r--src/corelib/io/qfileinfo.cpp36
-rw-r--r--src/corelib/io/qfileinfo.h2
-rw-r--r--src/corelib/kernel/qobject.cpp50
-rw-r--r--src/corelib/kernel/qobject.h16
-rw-r--r--src/corelib/thread/qthread.h8
-rw-r--r--src/corelib/tools/qmap.h4
-rw-r--r--src/dbus/dbus.pro6
-rw-r--r--src/dbus/qdbusconnection.cpp52
-rw-r--r--src/dbus/qdbusconnection.h16
-rw-r--r--src/dbus/qdbusconnection_p.h13
-rw-r--r--src/dbus/qdbusintegrator.cpp18
-rw-r--r--src/dbus/qdbusinternalfilters.cpp8
-rw-r--r--src/dbus/qdbusvirtualobject.cpp97
-rw-r--r--src/dbus/qdbusvirtualobject.h (renamed from src/xml/stream/qxmlstream.h)50
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp12
-rw-r--r--src/gui/kernel/qguiapplication.cpp12
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp8
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h8
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h12
-rw-r--r--src/gui/painting/qbezier_p.h36
-rw-r--r--src/gui/painting/qbrush.cpp8
-rw-r--r--src/gui/painting/qbrush.h2
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp3
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qfontmetrics.cpp30
-rw-r--r--src/gui/text/qfontmetrics.h4
-rw-r--r--src/gui/text/qglyphrun.cpp45
-rw-r--r--src/gui/text/qglyphrun.h3
-rw-r--r--src/gui/text/qglyphrun_p.h2
-rw-r--r--src/gui/text/qtextcontrol.cpp24
-rw-r--r--src/gui/text/qtextcontrol_p.h3
-rw-r--r--src/gui/text/qtextengine.cpp44
-rw-r--r--src/gui/text/qtextlayout.cpp63
-rw-r--r--src/gui/text/qtextobject.cpp17
-rw-r--r--src/gui/text/qtextobject.h2
-rw-r--r--src/network/kernel/qauthenticator.cpp4
-rw-r--r--src/network/ssl/qssl.cpp6
-rw-r--r--src/network/ssl/qssl.h6
-rw-r--r--src/network/ssl/qsslcertificate.cpp8
-rw-r--r--src/network/ssl/qsslcertificate.h8
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h2
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp12
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp1029
-rw-r--r--src/plugins/accessible/widgets/itemviews.h319
-rw-r--r--src/plugins/accessible/widgets/main.cpp22
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp132
-rw-r--r--src/plugins/accessible/widgets/rangecontrols.cpp18
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp57
-rw-r--r--src/plugins/accessible/widgets/widgets.pro22
-rw-r--r--src/plugins/platforms/wayland/qwaylandclipboard.cpp20
-rw-r--r--src/plugins/platforms/wayland/qwaylandclipboard.h4
-rw-r--r--src/plugins/platforms/wayland/qwaylandmime.cpp83
-rw-r--r--src/plugins/platforms/wayland/qwaylandmime.h55
-rw-r--r--src/plugins/platforms/wayland/wayland.pro6
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp10
-rw-r--r--src/sql/kernel/qsqlerror.cpp20
-rw-r--r--src/sql/kernel/qsqlerror.h2
-rw-r--r--src/testlib/qtestcase.cpp25
-rw-r--r--src/testlib/qtestsystem.h5
-rw-r--r--src/tools/uic/ui4.cpp3479
-rw-r--r--src/tools/uic/ui4.h204
-rw-r--r--src/uitools/uitools.pro3
-rw-r--r--src/widgets/accessible/qaccessible.cpp5
-rw-r--r--src/widgets/accessible/qaccessible.h10
-rw-r--r--src/widgets/accessible/qaccessible2.cpp112
-rw-r--r--src/widgets/accessible/qaccessible2.h112
-rw-r--r--src/widgets/accessible/qaccessible_mac.mm2
-rw-r--r--src/widgets/accessible/qaccessible_unix.cpp11
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp11
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp32
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h4
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp95
-rw-r--r--src/widgets/itemviews/qabstractitemview.h1
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h1
-rw-r--r--src/widgets/itemviews/qlistview.cpp12
-rw-r--r--src/widgets/itemviews/qtableview.cpp17
-rw-r--r--src/widgets/itemviews/qtableview_p.h5
-rw-r--r--src/widgets/itemviews/qtreeview.cpp52
-rw-r--r--src/widgets/itemviews/qtreeview.h3
-rw-r--r--src/widgets/itemviews/qtreeview_p.h6
-rw-r--r--src/widgets/itemviews/qwidgetitemdata_p.h2
-rw-r--r--src/widgets/kernel/qwidget.cpp4
-rw-r--r--src/widgets/platforms/mac/qeventdispatcher_mac_p.h2
-rw-r--r--src/widgets/widgets/qcombobox.cpp18
-rw-r--r--src/widgets/widgets/qlabel.cpp7
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp47
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h39
-rw-r--r--src/xml/stream/stream.pri9
-rw-r--r--src/xml/xml.pro1
-rw-r--r--tests/auto/macgui/macgui.pro1
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp6
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp490
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp4
-rw-r--r--tests/auto/qcssparser/tst_qcssparser.cpp8
-rw-r--r--tests/auto/qdbusconnection/tst_qdbusconnection.cpp202
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp71
-rw-r--r--tests/auto/qeventloop/qeventloop.pro2
-rw-r--r--tests/auto/qeventloop/tst_qeventloop.cpp25
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp2
-rw-r--r--tests/auto/qfocusevent/qfocusevent.pro2
-rw-r--r--tests/auto/qfont/tst_qfont.cpp4
-rw-r--r--tests/auto/qfontdatabase/tst_qfontdatabase.cpp15
-rw-r--r--tests/auto/qfontdialog/qfontdialog.pro2
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp13
-rw-r--r--tests/auto/qftp/qftp.pro2
-rw-r--r--tests/auto/qglthreads/tst_qglthreads.cpp37
-rw-r--r--tests/auto/qglyphrun/tst_qglyphrun.cpp18
-rw-r--r--tests/auto/qgraphicseffect/qgraphicseffect.pro2
-rw-r--r--tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro2
-rw-r--r--tests/auto/qgraphicsitem/qgraphicsitem.pro2
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp32
-rw-r--r--tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro2
-rw-r--r--tests/auto/qgraphicsscene/qgraphicsscene.pro1
-rw-r--r--tests/auto/qgraphicstransform/qgraphicstransform.pro2
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp2
-rw-r--r--tests/auto/qgraphicsview/qgraphicsview.pro1
-rw-r--r--tests/auto/qgraphicswidget/qgraphicswidget.pro1
-rw-r--r--tests/auto/qgridlayout/tst_qgridlayout.cpp2
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp2
-rw-r--r--tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro2
-rw-r--r--tests/auto/qlistview/qlistview.pro2
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp20
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp3
-rw-r--r--tests/auto/qobject/tst_qobject.cpp95
-rw-r--r--tests/auto/qpainter/qpainter.pro1
-rw-r--r--tests/auto/qpainterpath/tst_qpainterpath.cpp21
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp6
-rw-r--r--tests/auto/qprinter/tst_qprinter.cpp4
-rw-r--r--tests/auto/qrawfont/tst_qrawfont.cpp24
-rw-r--r--tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp7
-rw-r--r--tests/auto/qsqlerror/tst_qsqlerror.cpp16
-rw-r--r--tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem76
-rw-r--r--tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem74
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp25
-rw-r--r--tests/auto/qsslcertificate/verify-certs/cacert.pem30
-rw-r--r--tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem74
-rw-r--r--tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem56
-rw-r--r--tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem56
-rw-r--r--tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem74
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp1
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp1
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp42
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp20
-rw-r--r--tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp4
-rw-r--r--tests/auto/qtableview/qtableview.pro1
-rw-r--r--tests/auto/qtcpsocket/test/test.pro2
-rw-r--r--tests/auto/qtextedit/qtextedit.pro2
-rw-r--r--tests/auto/qtextlayout/qtextlayout.pro1
-rw-r--r--tests/auto/qtipc/qtipc.pro9
-rw-r--r--tests/auto/qtreeview/qtreeview.pro2
-rw-r--r--tests/auto/qundogroup/qundogroup.pro2
-rw-r--r--tests/auto/qundogroup/tst_qundogroup.cpp5
-rw-r--r--tests/auto/qundostack/qundostack.pro2
-rw-r--r--tests/auto/qundostack/tst_qundostack.cpp5
-rw-r--r--tests/auto/qwindowsurface/tst_qwindowsurface.cpp3
-rw-r--r--tests/auto/selftests/tst_selftests.cpp2
-rw-r--r--tests/manual/qgraphicslayout/flicker/window.h15
-rw-r--r--tools/uilib/abstractformbuilder.cpp2
-rw-r--r--tools/uilib/ui4.cpp3479
-rw-r--r--tools/uilib/ui4_p.h204
176 files changed, 5594 insertions, 6879 deletions
diff --git a/.gitignore b/.gitignore
index 0db34fab52..47bd28227d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -269,3 +269,47 @@ src/xml/lib/
*.dep
*.map
work
+
+
+#generated module def and version header files
+mkspecs/modules/qt_*.pri
+mkspecs/qmodule.pri
+src/uitools/qtuitoolsversion.h
+tools/uilib/qtdesignerversion.h
+
+
+#unit tests executables
+selftests/assert/assert
+selftests/badxml/badxml
+selftests/benchlibcallgrind/benchlibcallgrind
+selftests/benchlibeventcounter/benchlibeventcounter
+selftests/benchliboptions/benchliboptions
+selftests/benchlibtickcounter/benchlibtickcounter
+selftests/benchlibwalltime/benchlibwalltime
+selftests/cmptest/cmptest
+selftests/commandlinedata/commandlinedata
+selftests/crashes/crashes
+selftests/datatable/datatable
+selftests/datetime/datetime
+selftests/differentexec/differentexec
+selftests/exceptionthrow/exceptionthrow
+selftests/expectfail/expectfail
+selftests/failinit/failinit
+selftests/failinitdata/failinitdata
+selftests/fetchbogus/fetchbogus
+selftests/globaldata/globaldata
+selftests/longstring/longstring
+selftests/maxwarnings/maxwarnings
+selftests/multiexec/multiexec
+selftests/qexecstringlist/qexecstringlist
+selftests/singleskip/singleskip
+selftests/skip/skip
+selftests/skipglobal/skipglobal
+selftests/skipinit/skipinit
+selftests/skipinitdata/skipinitdata
+selftests/sleep/sleep
+selftests/strcmp/strcmp
+selftests/subtest/subtest
+selftests/waitwithoutgui/waitwithoutgui
+selftests/warnings/warnings
+selftests/xunit/xunit
diff --git a/bin/qtmodule-configtests b/bin/qtmodule-configtests
index f6cc2052da..0552f8e614 100755
--- a/bin/qtmodule-configtests
+++ b/bin/qtmodule-configtests
@@ -262,7 +262,7 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
$| = 1;
# Now run the configuration tests
- print "Configuration tests:\n";
+ print "Configuration tests:\n" if (%configtests);
while ((my $testName, my $testParameters) = each %configtests) {
printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up
diff --git a/bin/syncqt b/bin/syncqt
index 0dcbc4d58e..4eab929b30 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -777,8 +777,8 @@ die "Cannot automatically detect/use provided path to QtBase's build directory!\
# if we have no $basedir we cannot be sure which sources you want, so die
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
-my @ignore_headers = ();
my $class_lib_map_contents = "";
+our @ignore_headers = ();
our @ignore_for_master_contents = ();
our @ignore_for_include_check = ();
our @ignore_for_qt_begin_header_check = ();
@@ -900,7 +900,7 @@ foreach my $lib (@modules_to_sync) {
# FIXME: this creates a file in the source location for shadow-builds
my $moduleversionheader = "$modules{$lib}/" . lc($lib) . "version.h";
my $modulehexstring = sprintf("0x%02X%02X%02X", int($module_major_version), int($module_minor_version), int($module_patch_version));
- open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader";
+ open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader" or die "Can't open $moduleversionheader for writing";
print MODULE_VERSION_HEADER_FILE "/* This file was generated by syncqt with the info from sync.profile. */\n";
print MODULE_VERSION_HEADER_FILE "#ifndef QT_". uc($lib) . "_VERSION_H\n";
print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n";
diff --git a/configure b/configure
index 441989566b..987242e537 100755
--- a/configure
+++ b/configure
@@ -2508,23 +2508,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye
echo
fi
-# detect build style
-if [ "$CFG_DEBUG" = "auto" ]; then
- if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
- CFG_DEBUG_RELEASE=yes
- CFG_DEBUG=yes
- elif [ "$CFG_DEV" = "yes" ]; then
- CFG_DEBUG_RELEASE=no
- CFG_DEBUG=yes
- else
- CFG_DEBUG_RELEASE=no
- CFG_DEBUG=no
- fi
-fi
-if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG build_all"
-fi
-
if [ "$CFG_SILENT" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG silent"
fi
@@ -3241,6 +3224,23 @@ fi
# tests that don't need qmake (must be run before displaying help)
#-------------------------------------------------------------------------------
+# detect build style
+if [ "$CFG_DEBUG" = "auto" ]; then
+ if [ "$CFG_ARCH" = "macosx" -o "$XPLATFORM_MINGW" = "yes" ]; then
+ CFG_DEBUG_RELEASE=yes
+ CFG_DEBUG=yes
+ elif [ "$CFG_DEV" = "yes" ]; then
+ CFG_DEBUG_RELEASE=no
+ CFG_DEBUG=yes
+ else
+ CFG_DEBUG_RELEASE=no
+ CFG_DEBUG=no
+ fi
+fi
+if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
+ QMAKE_CONFIG="$QMAKE_CONFIG build_all"
+fi
+
if [ -z "$PKG_CONFIG" ]; then
# See if PKG_CONFIG is set in the mkspec:
PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
@@ -7068,10 +7068,10 @@ fi
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
QMakeVar add QMAKE_CFLAGS -g
QMakeVar add QMAKE_CXXFLAGS -g
- QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
+ QT_CONFIG="$QT_CONFIG separate_debug_info"
fi
if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
- QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy"
+ QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
fi
[ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0
index 1dcb56cd4e..7bd61556ef 100644
--- a/dist/changes-4.8.0
+++ b/dist/changes-4.8.0
@@ -72,6 +72,17 @@ QtGui
like UltraLight. [QTBUG-19366]
- Visual text cursor movement behavior is added to QTextEdit and QLineEdit controls,
which can be used as an optional mode for bi-directional text editing. [QTBUG-13859]
+ - Accessibility: Fix potential crash in QDockWidget.
+ - Accessibility: Fix crash when asking for relations of child accessibles.
+ - Accessibility: More consistency in reporting names (especially when widget is invisible).
+ - Accessibility: Make focus handling more consistent.
+ - Accessibility: Send updates when text changes.
+ - Accessibility: Add IAccessible2 events.
+ - Accessibility: Fix crash when accessing ItemViews during initialization.
+ - Accessibility: Make QTabWidget child hierarchy consistent.
+ - Accessibility: Report correct window title and application name.
+ - Accessibility: Return text attributes for QTextEdit.
+
QtNetwork
---------
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index 523d649573..32ca8dbd66 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -20,6 +20,10 @@ information about a particular change.
- QLibrary::resolve() now returns a function pointer instead of a void
pointer.
+- QSslCertificate::alternateSubjectNames() is deprecated (but can be enabled
+ via QT_DISABLE_DEPRECATED_BEFORE), use
+ QSslCertificate::subjectAlternativeNames() instead.
+
****************************************************************************
* General *
****************************************************************************
diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
index afb9460983..086c62893d 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
@@ -434,6 +434,21 @@ hostNameLabel->setText(tr("Name:"));
QString example = tr("Example");
//! [40]
+//! [41]
+QPushButton *button = parentWidget->findChild<QPushButton *>("button1", Qt::FindDirectChildOnly);
+//! [41]
+
+
+//! [42]
+QListWidget *list = parentWidget->findChild<QListWidget *>(QString(), Qt::FindDirectChildOnly);
+//! [42]
+
+
+//! [43]
+QList<QPushButton *> childButtons = parentWidget.findChildren<QPushButton *>(QString(), Qt::FindDirectChildOnly);
+//! [43]
+
+
//! [meta data]
//: This is a comment for the translator.
//= qtn_foo_bar
diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h
index c6da29faa5..eb509d0d40 100644
--- a/examples/opengl/cube/mainwidget.h
+++ b/examples/opengl/cube/mainwidget.h
@@ -48,8 +48,10 @@
#include <QQuaternion>
#include <QVector2D>
+QT_BEGIN_NAMESPACE
class QBasicTimer;
class QGLShaderProgram;
+QT_END_NAMESPACE
class GeometryEngine;
diff --git a/examples/widgets/orientation/mainwindow.h b/examples/widgets/orientation/mainwindow.h
index 400a6a5a7f..45907c31be 100644
--- a/examples/widgets/orientation/mainwindow.h
+++ b/examples/widgets/orientation/mainwindow.h
@@ -46,7 +46,9 @@
#include "ui_landscape.h"
#include "ui_portrait.h"
+QT_BEGIN_NAMESPACE
class QAbstractButton;
+QT_END_NAMESPACE
//! [0]
class MainWindow : public QWidget
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index 3f93220cc4..b16492b324 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -99,10 +99,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
# Let every project have a standard GNU `check' target
!contains(QMAKE_EXTRA_TARGETS, check) {
# `make check' should iterate through all subdirs
+ # (except those with no_default_target)
contains(TEMPLATE, subdirs) {
check.CONFIG = recursive
- check.recurse = $$SUBDIRS
check.recurse_target = check
+
+ for(subdir, SUBDIRS) {
+ subdir_config=$$eval($${subdir}.CONFIG)
+ !contains(subdir_config, no_default_target):check.recurse += $$subdir
+ unset(subdir_config)
+ }
}
# `make check' should imply building the project
else {
diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf
index 7b5b5ad304..e110de0c5b 100644
--- a/mkspecs/features/qt_module_config.prf
+++ b/mkspecs/features/qt_module_config.prf
@@ -59,6 +59,8 @@ linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
contains(QT_CONFIG, largefile):CONFIG += largefile
+contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
+contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
#mac frameworks
mac:!static:contains(QT_CONFIG, qt_framework) {
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
index c4eaab8147..824729ba52 100644
--- a/mkspecs/features/qt_plugin.prf
+++ b/mkspecs/features/qt_plugin.prf
@@ -9,6 +9,8 @@ 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
+contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
+contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
load(qt_targets)
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index 96b561e742..dd465db18b 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -152,6 +152,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
asm volatile("0:\n"
"ldrex %[result], [%[_q_value]]\n"
"eors %[result], %[result], %[expectedValue]\n"
+ "itt eq\n"
"strexeq %[result], %[newValue], [%[_q_value]]\n"
"teqeq %[result], #1\n"
"beq 0b\n"
@@ -210,6 +211,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
asm volatile("0:\n"
"ldrex %[result], [%[_q_value]]\n"
"eors %[result], %[result], %[expectedValue]\n"
+ "itt eq\n"
"strexeq %[result], %[newValue], [%[_q_value]]\n"
"teqeq %[result], #1\n"
"beq 0b\n"
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 44e59e6cf8..2fc82c55ca 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1288,7 +1288,11 @@ public:
AnchorBottom
};
-
+ enum FindChildOption {
+ FindDirectChildrenOnly = 0x0,
+ FindChildrenRecursively = 0x1
+ };
+ Q_DECLARE_FLAGS(FindChildOptions, FindChildOption)
enum DropAction {
CopyAction = 0x1,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 9dd7cda24f..08df79af28 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2111,6 +2111,13 @@
*/
/*!
+ \enum Qt::FindChildOption
+
+ \value FindDirectChildrenOnly Looks only at the direct children of the object.
+ \value FindChildrenRecursively Looks at all children of the object (recursive search).
+*/
+
+/*!
\enum Qt::DropAction
\value CopyAction Copy the data to the target.
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index f54818e0a6..c83c39195a 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -366,7 +366,7 @@ QFileInfo::~QFileInfo()
}
/*!
- \fn bool QFileInfo::operator!=(const QFileInfo &fileinfo)
+ \fn bool QFileInfo::operator!=(const QFileInfo &fileinfo) const
Returns true if this QFileInfo object refers to a different file
than the one specified by \a fileinfo; otherwise returns false.
@@ -380,7 +380,19 @@ QFileInfo::~QFileInfo()
*/
/*!
- \overload
+ Returns true if this QFileInfo object refers to a file in the same
+ location as \a fileinfo; otherwise returns false.
+
+ Note that the result of comparing two empty QFileInfo objects,
+ containing no file references, is undefined.
+
+ \warning This will not compare two different symbolic links
+ pointing to the same file.
+
+ \warning Long and short file names that refer to the same file on Windows
+ are treated as if they referred to different files.
+
+ \sa operator!=()
*/
bool QFileInfo::operator==(const QFileInfo &fileinfo) const
{
@@ -410,26 +422,6 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const
}
/*!
- Returns true if this QFileInfo object refers to a file in the same
- location as \a fileinfo; otherwise returns false.
-
- Note that the result of comparing two empty QFileInfo objects,
- containing no file references, is undefined.
-
- \warning This will not compare two different symbolic links
- pointing to the same file.
-
- \warning Long and short file names that refer to the same file on Windows
- are treated as if they referred to different files.
-
- \sa operator!=()
-*/
-bool QFileInfo::operator==(const QFileInfo &fileinfo)
-{
- return const_cast<const QFileInfo *>(this)->operator==(fileinfo);
-}
-
-/*!
Makes a copy of the given \a fileinfo and assigns it to this QFileInfo.
*/
QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo)
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index 6ca0ae79e0..ab3d2dc847 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -75,9 +75,7 @@ public:
inline QFileInfo&operator=(QFileInfo &&other)
{ qSwap(d_ptr, other.d_ptr); return *this; }
#endif
- bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me
bool operator==(const QFileInfo &fileinfo) const;
- inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); } // 5.0 - remove me
inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); }
void setFile(const QString &file);
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 7652ec4871..2d280f14f7 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1029,8 +1029,8 @@ QObjectPrivate::Connection::~Connection()
\brief the name of this object
- You can find an object by name (and type) using findChild(). You can
- find a set of objects with findChildren().
+ You can find an object by name (and type) using findChild().
+ You can find a set of objects with findChildren().
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 5
@@ -1546,12 +1546,13 @@ void QObject::killTimer(int id)
/*!
- \fn T *QObject::findChild(const QString &name) const
+ \fn T *QObject::findChild(const QString &name, Qt::FindChildOptions options) const
Returns the child of this object that can be cast into type T and
that is called \a name, or 0 if there is no such object.
Omitting the \a name argument causes all object names to be matched.
- The search is performed recursively.
+ The search is performed recursively, unless \a options specifies the
+ option FindDirectChildrenOnly.
If there is more than one child matching the search, the most
direct ancestor is returned. If there are several direct
@@ -1559,7 +1560,8 @@ void QObject::killTimer(int id)
case, findChildren() should be used.
This example returns a child \l{QPushButton} of \c{parentWidget}
- named \c{"button1"}:
+ named \c{"button1"}, even if the button isn't a direct child of
+ the parent:
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 10
@@ -1567,16 +1569,27 @@ void QObject::killTimer(int id)
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 11
+ This example returns a child \l{QPushButton} of \c{parentWidget}
+ (its direct parent) named \c{"button1"}:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 41
+
+ This example returns a \l{QListWidget} child of \c{parentWidget},
+ its direct parent:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 42
+
\sa findChildren()
*/
/*!
- \fn QList<T> QObject::findChildren(const QString &name) const
+ \fn QList<T> QObject::findChildren(const QString &name, Qt::FindChildOptions options) const
Returns all children of this object with the given \a name that can be
cast to type T, or an empty list if there are no such objects.
Omitting the \a name argument causes all object names to be matched.
- The search is performed recursively.
+ The search is performed recursively, unless \a options specifies the
+ option FindDirectChildrenOnly.
The following example shows how to find a list of child \l{QWidget}s of
the specified \c{parentWidget} named \c{widgetname}:
@@ -1587,11 +1600,15 @@ void QObject::killTimer(int id)
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 13
+ This example returns all \c{QPushButton}s that are immediate children of \c{parentWidget}:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 43
+
\sa findChild()
*/
/*!
- \fn QList<T> QObject::findChildren(const QRegExp &regExp) const
+ \fn QList<T> QObject::findChildren(const QRegExp &regExp, Qt::FindChildOptions options) const
\overload findChildren()
Returns the children of this object that can be cast to type T
@@ -1651,7 +1668,7 @@ void QObject::killTimer(int id)
\internal
*/
void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
- const QMetaObject &mo, QList<void*> *list)
+ const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options)
{
if (!parent || !list)
return;
@@ -1668,13 +1685,14 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const Q
list->append(obj);
}
}
- qt_qFindChildren_helper(obj, name, re, mo, list);
+ if (options & Qt::FindChildrenRecursively)
+ qt_qFindChildren_helper(obj, name, re, mo, list, options);
}
}
/*! \internal
*/
-QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo)
+QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
{
if (!parent)
return 0;
@@ -1686,10 +1704,12 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const
if (mo.cast(obj) && (name.isNull() || obj->objectName() == name))
return obj;
}
- for (i = 0; i < children.size(); ++i) {
- obj = qt_qFindChild_helper(children.at(i), name, mo);
- if (obj)
- return obj;
+ if (options & Qt::FindChildrenRecursively) {
+ for (i = 0; i < children.size(); ++i) {
+ obj = qt_qFindChild_helper(children.at(i), name, mo, options);
+ if (obj)
+ return obj;
+ }
}
return 0;
}
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 1c367eb8d1..591c5c88bf 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -78,8 +78,8 @@ class QObjectUserData;
typedef QList<QObject*> QObjectList;
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
- const QMetaObject &mo, QList<void *> *list);
-Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo);
+ const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
+Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options);
class
#if defined(__INTEL_COMPILER) && defined(Q_OS_WIN)
@@ -157,11 +157,11 @@ public:
void killTimer(int id);
template<typename T>
- inline T findChild(const QString &aName = QString()) const
- { return static_cast<T>(qt_qFindChild_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject)); }
+ inline T findChild(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
+ { return static_cast<T>(qt_qFindChild_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject, options)); }
template<typename T>
- inline QList<T> findChildren(const QString &aName = QString()) const
+ inline QList<T> findChildren(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{
QList<T> list;
union {
@@ -169,13 +169,13 @@ public:
QList<void *> *voidList;
} u;
u.typedList = &list;
- qt_qFindChildren_helper(this, aName, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList);
+ qt_qFindChildren_helper(this, aName, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
return list;
}
#ifndef QT_NO_REGEXP
template<typename T>
- inline QList<T> findChildren(const QRegExp &re) const
+ inline QList<T> findChildren(const QRegExp &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{
QList<T> list;
union {
@@ -183,7 +183,7 @@ public:
QList<void *> *voidList;
} u;
u.typedList = &list;
- qt_qFindChildren_helper(this, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList);
+ qt_qFindChildren_helper(this, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
return list;
}
#endif
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index bc529fd53b..89a3ad8b1f 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -101,6 +101,10 @@ public:
// default argument causes thread to block indefinately
bool wait(unsigned long time = ULONG_MAX);
+ static void sleep(unsigned long);
+ static void msleep(unsigned long);
+ static void usleep(unsigned long);
+
Q_SIGNALS:
void started();
void finished();
@@ -112,10 +116,6 @@ protected:
static void setTerminationEnabled(bool enabled = true);
- static void sleep(unsigned long);
- static void msleep(unsigned long);
- static void usleep(unsigned long);
-
protected:
QThread(QThreadPrivate &dd, QObject *parent = 0);
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 36d8eefbdb..771959a3bf 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -352,8 +352,8 @@ public:
// ### Qt 5: not sure this is necessary anymore
#ifdef QT_STRICT_ITERATORS
private:
- inline bool operator==(const iterator &o) { return operator==(const_iterator(o)); }
- inline bool operator!=(const iterator &o) { return operator!=(const_iterator(o)); }
+ inline bool operator==(const iterator &o) const { return operator==(const_iterator(o)); }
+ inline bool operator!=(const iterator &o) const { return operator!=(const_iterator(o)); }
#endif
private:
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index c91c2f6ad7..8669bb003a 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -52,7 +52,8 @@ PUB_HEADERS = qdbusargument.h \
qdbusmetatype.h \
qdbuspendingcall.h \
qdbuspendingreply.h \
- qdbuscontext.h
+ qdbuscontext.h \
+ qdbusvirtualobject.h
HEADERS += $$PUB_HEADERS \
qdbusconnection_p.h \
qdbusmessage_p.h \
@@ -95,4 +96,5 @@ SOURCES += qdbusconnection.cpp \
qdbuspendingreply.cpp \
qdbus_symbols.cpp \
qdbusservicewatcher.cpp \
- qdbusunixfiledescriptor.cpp
+ qdbusunixfiledescriptor.cpp \
+ qdbusvirtualobject.cpp
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 9656903846..a55ff14fcf 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -222,6 +222,18 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP
*/
/*!
+ \internal
+ \since 4.8
+ \enum QDBusConnection::VirtualObjectRegisterOption
+ Specifies the options for registering virtual objects with the connection. The possible values are:
+
+ \value SingleNode register a virtual object to handle one path only
+ \value SubPath register a virtual object so that it handles all sub paths
+
+ \sa registerVirtualObject(), QDBusVirtualObject
+*/
+
+/*!
\enum QDBusConnection::UnregisterMode
The mode for unregistering an object path:
@@ -801,9 +813,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
// this node exists
// consider it free if there's no object here and the user is not trying to
// replace the object sub-tree
- if ((options & ExportChildObjects && !node->children.isEmpty()) || node->obj)
+ if (node->obj)
return false;
+ if (options & QDBusConnectionPrivate::VirtualObject) {
+ // technically the check for children needs to go even deeper
+ if (options & SubPath) {
+ foreach (const QDBusConnectionPrivate::ObjectTreeNode &child, node->children) {
+ if (child.obj)
+ return false;
+ }
+ }
+ } else {
+ if ((options & ExportChildObjects && !node->children.isEmpty()))
+ return false;
+ }
// we can add the object here
node->obj = object;
node->flags = options;
@@ -813,6 +837,13 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
return true;
}
+ // if a virtual object occupies this path, return false
+ if (node->obj && (node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) {
+ qDebug("Cannot register object at %s because QDBusVirtualObject handles all sub-paths.",
+ qPrintable(path));
+ return false;
+ }
+
// find the position where we'd insert the node
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i));
@@ -841,6 +872,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
}
/*!
+ \internal
+ \since 4.8
+ Registers a QDBusTreeNode for a path. It can handle a path including all child paths, thus
+ handling multiple DBus nodes.
+
+ To unregister a QDBusTreeNode use the unregisterObject() function with its path.
+*/
+bool QDBusConnection::registerVirtualObject(const QString &path, QDBusVirtualObject *treeNode,
+ VirtualObjectRegisterOption options)
+{
+ int opts = options | QDBusConnectionPrivate::VirtualObject;
+ return registerObject(path, (QObject*) treeNode, (RegisterOptions) opts);
+}
+
+/*!
Unregisters an object that was registered with the registerObject() at the object path given by
\a path and, if \a mode is QDBusConnection::UnregisterTree, all of its sub-objects too.
@@ -905,6 +951,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
while (node) {
if (pathComponents.count() == i)
return node->obj;
+ if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
+ return node->obj;
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
@@ -917,6 +965,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
return 0;
}
+
+
/*!
Returns a QDBusConnectionInterface object that represents the
D-Bus server interface on this connection.
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index 4bdd055f52..8b126af77e 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -69,6 +69,7 @@ class QDBusError;
class QDBusMessage;
class QDBusPendingCall;
class QDBusConnectionInterface;
+class QDBusVirtualObject;
class QObject;
class QDBusConnectionPrivate;
@@ -104,8 +105,8 @@ public:
// Qt 4.2 had a misspelling here
ExportAllSignal = ExportAllSignals,
#endif
-
ExportChildObjects = 0x1000
+ // Reserved = 0xff000000
};
enum UnregisterMode {
UnregisterNode,
@@ -113,6 +114,15 @@ public:
};
Q_DECLARE_FLAGS(RegisterOptions, RegisterOption)
+ enum VirtualObjectRegisterOption {
+ SingleNode = 0x0,
+ SubPath = 0x1
+ // Reserved = 0xff000000
+ };
+#ifndef Q_QDOC
+ Q_DECLARE_FLAGS(VirtualObjectRegisterOptions, VirtualObjectRegisterOption)
+#endif
+
enum ConnectionCapability {
UnixFileDescriptorPassing = 0x0001
};
@@ -163,6 +173,9 @@ public:
void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode);
QObject *objectRegisteredAt(const QString &path) const;
+ bool registerVirtualObject(const QString &path, QDBusVirtualObject *object,
+ VirtualObjectRegisterOption options = SingleNode);
+
bool registerService(const QString &serviceName);
bool unregisterService(const QString &serviceName);
@@ -192,6 +205,7 @@ private:
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::VirtualObjectRegisterOptions)
QT_END_NAMESPACE
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 12bcb21d9f..d481cf16ba 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -129,6 +129,11 @@ public:
QByteArray matchRule;
};
+ enum TreeNodeType {
+ Object = 0x0,
+ VirtualObject = 0x01000000
+ };
+
struct ObjectTreeNode
{
typedef QVector<ObjectTreeNode> DataList;
@@ -143,8 +148,12 @@ public:
{ return QStringRef(&name) < other; }
QString name;
- QObject* obj;
+ union {
+ QObject *obj;
+ QDBusVirtualObject *treeNode;
+ };
int flags;
+
DataList children;
};
@@ -333,7 +342,7 @@ extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
// in qdbusinternalfilters.cpp
-extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node);
+extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path);
extern QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg);
extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index f3f3d0b8b2..2cde07ea47 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -57,6 +57,7 @@
#include "qdbusabstractadaptor.h"
#include "qdbusabstractadaptor_p.h"
#include "qdbusutil_p.h"
+#include "qdbusvirtualobject.h"
#include "qdbusmessage_p.h"
#include "qdbuscontext_p.h"
#include "qdbuspendingcall_p.h"
@@ -442,7 +443,11 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
// walk the object tree
const QDBusConnectionPrivate::ObjectTreeNode *node = root;
- while (start < length && node && !(node->flags & QDBusConnection::ExportChildObjects)) {
+ while (start < length && node) {
+ if (node->flags & QDBusConnection::ExportChildObjects)
+ break;
+ if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
+ break;
int end = fullpath.indexOf(QLatin1Char('/'), start);
end = (end == -1 ? length : end);
QStringRef pathComponent(&fullpath, start, end - start);
@@ -1328,7 +1333,7 @@ bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node,
if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) {
if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) {
//qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg;
- QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node));
+ QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path()));
send(reply);
return true;
}
@@ -1375,6 +1380,15 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
// object may be null
+ if (node.flags & QDBusConnectionPrivate::VirtualObject) {
+ if (node.treeNode->handleMessage(msg, q(this))) {
+ return;
+ } else {
+ if (activateInternalFilters(node, msg))
+ return;
+ }
+ }
+
if (pathStartPos != msg.path().length()) {
node.flags &= ~QDBusConnection::ExportAllSignals;
node.obj = findChildObject(&node, msg.path(), pathStartPos);
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 2b142a72b8..b874a64644 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -56,6 +56,7 @@
#include "qdbusmetatype_p.h"
#include "qdbusmessage_p.h"
#include "qdbusutil_p.h"
+#include "qdbusvirtualobject.h"
#ifndef QT_NO_DBUS
@@ -108,7 +109,7 @@ static QString generateSubObjectXml(QObject *object)
// declared as extern in qdbusconnection_p.h
-QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node)
+QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)
{
// object may be null
@@ -155,6 +156,11 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
}
}
+ // is it a virtual node that handles introspection itself?
+ if (node.flags & QDBusConnectionPrivate::VirtualObject) {
+ xml_data += node.treeNode->introspect(path);
+ }
+
xml_data += QLatin1String( propertiesInterfaceXml );
}
diff --git a/src/dbus/qdbusvirtualobject.cpp b/src/dbus/qdbusvirtualobject.cpp
new file mode 100644
index 0000000000..992ccbf229
--- /dev/null
+++ b/src/dbus/qdbusvirtualobject.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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 QtDBus module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdbusvirtualobject.h"
+
+#ifndef QT_NO_DBUS
+
+QT_BEGIN_NAMESPACE
+
+QDBusVirtualObject::QDBusVirtualObject(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QDBusVirtualObject::~QDBusVirtualObject()
+{
+}
+
+QT_END_NAMESPACE
+
+
+/*!
+ \internal
+ \class QDBusVirtualObject
+ \inmodule QtDBus
+ \since 4.8
+
+ \brief The QDBusVirtualObject class is used to handle several DBus paths with one class.
+*/
+
+/*!
+ \internal
+ \fn bool QDBusVirtualObject::handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0
+
+ This function needs to handle all messages to the path of the
+ virtual object, when the SubPath option is specified.
+ The service, path, interface and methos are all part of the message.
+ Must return true when the message is handled, otherwise false (will generate dbus error message).
+*/
+
+
+/*!
+ \internal
+ \fn QString QDBusVirtualObject::introspect(const QString &path) const
+
+ This function needs to handle the introspection of the
+ virtual object. It must return xml of the form:
+
+ \code
+<interface name="com.trolltech.QtDBus.MyObject" >
+ <property access="readwrite" type="i" name="prop1" />
+</interface>
+ \endcode
+
+ If you pass the SubPath option, this introspection has to include all child nodes.
+ Otherwise QDBus handles the introspection of the child nodes.
+*/
+
+#endif // QT_NO_DBUS
diff --git a/src/xml/stream/qxmlstream.h b/src/dbus/qdbusvirtualobject.h
index 7023ab236b..be323de720 100644
--- a/src/xml/stream/qxmlstream.h
+++ b/src/dbus/qdbusvirtualobject.h
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtXml module of the Qt Toolkit.
+** This file is part of the QtDBus module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,35 +39,43 @@
**
****************************************************************************/
-#ifndef OLD_QXMLSTREAM_H
-#define OLD_QXMLSTREAM_H
+#ifndef QDBUSTREENODE_H
+#define QDBUSTREENODE_H
-#include <QtCore/qxmlstream.h>
+#include <QtDBus/qdbusmacros.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qobject.h>
+
+#ifndef QT_NO_DBUS
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Xml)
+QT_MODULE(DBus)
-#if 0
-// make syncqt generate forwarding headers for this file too
-#pragma qt_class(QXmlStreamAttribute)
-#pragma qt_class(QXmlStreamAttributes)
-#pragma qt_class(QXmlStreamEntityDeclaration)
-#pragma qt_class(QXmlStreamEntityDeclarations)
-#pragma qt_class(QXmlStreamEntityResolver)
-#pragma qt_class(QXmlStreamNamespaceDeclaration)
-#pragma qt_class(QXmlStreamNamespaceDeclarations)
-#pragma qt_class(QXmlStreamNotationDeclaration)
-#pragma qt_class(QXmlStreamNotationDeclarations)
-#pragma qt_class(QXmlStreamReader)
-#pragma qt_class(QXmlStreamStringRef)
-#pragma qt_class(QXmlStreamWriter)
-#endif
+class QDBusMessage;
+class QDBusConnection;
+
+class QDBusVirtualObjectPrivate;
+class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QDBusVirtualObject(QObject *parent = 0);
+ virtual ~QDBusVirtualObject();
+
+ virtual QString introspect(const QString &path) const = 0;
+ virtual bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0;
+
+private:
+ Q_DECLARE_PRIVATE(QDBusVirtualObject)
+ Q_DISABLE_COPY(QDBusVirtualObject)
+};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // OLD_QXMLSTREAM_H
+#endif // QT_NO_DBUS
+#endif
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index a2927601a9..65d5b0f650 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -108,19 +108,11 @@ void QCursorData::update()
#endif //QT_NO_CURSOR
-extern int qt_last_x;
-extern int qt_last_y;
+extern qreal qt_last_x,qt_last_y;
QPoint QCursor::pos()
{
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- int cursorCount = cursors.count();
- for (int i = 0; i < cursorCount; ++i) {
- const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
- if (cursor)
- return cursor.data()->pos();
- }
- return QPoint(qt_last_x, qt_last_y);
+ return QPointF(qt_last_x, qt_last_y).toPoint();
}
void QCursor::setPos(int x, int y)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1bcbb3651b..a9af27aba0 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -91,8 +91,8 @@ bool QGuiApplicationPrivate::app_do_modal = false;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
-int qt_last_x = 0;
-int qt_last_y = 0;
+qreal qt_last_x = 0;
+qreal qt_last_y = 0;
Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton;
ulong QGuiApplicationPrivate::mousePressTime = 0;
@@ -554,7 +554,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QEvent::Type type;
// move first
Qt::MouseButtons stateChange = e->buttons ^ buttons;
- if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
+ if (e->globalPos != QPointF(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent =
new QWindowSystemInterfacePrivate::MouseEvent(e->window.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
@@ -563,8 +563,8 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QWindow *window = e->window.data();
- QPoint localPoint = e->localPos;
- QPoint globalPoint = e->globalPos;
+ QPointF localPoint = e->localPos;
+ QPointF globalPoint = e->globalPos;
Qt::MouseButton button = Qt::NoButton;
@@ -629,7 +629,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
if (!e->window)
return;
- QPoint globalPoint = e->globalPos;
+ QPointF globalPoint = e->globalPos;
qt_last_x = globalPoint.x();
qt_last_y = globalPoint.y();
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 9b3d691805..d6f94b6261 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -114,12 +114,12 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *tlw)
*/
-void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) {
+void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleMouseEvent(w, time, local, global, b);
}
-void QWindowSystemInterface::handleMouseEvent(QWindow *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+void QWindowSystemInterface::handleMouseEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b)
{
QWindowSystemInterfacePrivate::MouseEvent * e =
new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b);
@@ -162,12 +162,12 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) {
+void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleWheelEvent(w, time, local, global, d, o);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o)
{
QWindowSystemInterfacePrivate::WheelEvent *e =
new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index dcfd7f1651..2f3f8a171e 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -62,8 +62,8 @@ QT_MODULE(Gui)
class Q_GUI_EXPORT QWindowSystemInterface
{
public:
- static void handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
- static void handleMouseEvent(QWindow *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
+ static void handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b);
+ static void handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b);
static void handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
@@ -79,8 +79,8 @@ public:
const QString& text = QString(), bool autorep = false,
ushort count = 1);
- static void handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
- static void handleWheelEvent(QWindow *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
+ static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o);
+ static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o);
struct TouchPoint {
int id; // for application use
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 1e772eb2b8..352092d066 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -135,20 +135,20 @@ public:
class MouseEvent : public UserEvent {
public:
- MouseEvent(QWindow * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+ MouseEvent(QWindow * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b)
: UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { }
- QPoint localPos;
- QPoint globalPos;
+ QPointF localPos;
+ QPointF globalPos;
Qt::MouseButtons buttons;
};
class WheelEvent : public UserEvent {
public:
- WheelEvent(QWindow *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+ WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o)
: UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { }
int delta;
- QPoint localPos;
- QPoint globalPos;
+ QPointF localPos;
+ QPointF globalPos;
Qt::Orientation orient;
};
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index 399dd89140..f1f7eb155a 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -162,27 +162,27 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &
inline QPointF QBezier::pointAt(qreal t) const
{
-#if 1
- qreal a, b, c, d;
- coefficients(t, a, b, c, d);
- return QPointF(a*x1 + b*x2 + c*x3 + d*x4, a*y1 + b*y2 + c*y3 + d*y4);
-#else
// numerically more stable:
+ qreal x, y;
+
qreal m_t = 1. - t;
- qreal a = x1*m_t + x2*t;
- qreal b = x2*m_t + x3*t;
- qreal c = x3*m_t + x4*t;
- a = a*m_t + b*t;
- b = b*m_t + c*t;
- qreal x = a*m_t + b*t;
- qreal a = y1*m_t + y2*t;
- qreal b = y2*m_t + y3*t;
- qreal c = y3*m_t + y4*t;
- a = a*m_t + b*t;
- b = b*m_t + c*t;
- qreal y = a*m_t + b*t;
+ {
+ qreal a = x1*m_t + x2*t;
+ qreal b = x2*m_t + x3*t;
+ qreal c = x3*m_t + x4*t;
+ a = a*m_t + b*t;
+ b = b*m_t + c*t;
+ x = a*m_t + b*t;
+ }
+ {
+ qreal a = y1*m_t + y2*t;
+ qreal b = y2*m_t + y3*t;
+ qreal c = y3*m_t + y4*t;
+ a = a*m_t + b*t;
+ b = b*m_t + c*t;
+ y = a*m_t + b*t;
+ }
return QPointF(x, y);
-#endif
}
inline QPointF QBezier::normalVector(qreal t) const
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 429ed0b25b..05f191dac6 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1538,14 +1538,6 @@ bool QGradient::operator==(const QGradient &gradient) const
}
/*!
- \internal
-*/
-bool QGradient::operator==(const QGradient &gradient)
-{
- return const_cast<const QGradient *>(this)->operator==(gradient);
-}
-
-/*!
\class QLinearGradient
\ingroup painting
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 00c0ebfa3a..edb092c035 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -239,8 +239,6 @@ public:
inline bool operator!=(const QGradient &other) const
{ return !operator==(other); }
- bool operator==(const QGradient &gradient); // ### Qt 5: remove
-
private:
friend class QLinearGradient;
friend class QRadialGradient;
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index d8b79840f6..c0edce1009 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -275,7 +275,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
if (!engine) {
if (!request.family.isEmpty()) {
QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QFont::StyleHint(request.styleHint),QUnicodeTables::Script(script));
- for (int i = 0; i < fallbacks.size(); i++) {
+ for (int i = 0; !engine && i < fallbacks.size(); i++) {
QFontDef def = request;
def.family = fallbacks.at(i);
QFontCache::Key key(def,script);
@@ -289,7 +289,6 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size);
if (engine) {
initFontDef(desc, def, &engine->fontDef);
- break;
}
}
}
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index c53e841cf4..b32e6916f0 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -291,7 +291,7 @@ private:
struct GlyphCacheEntry {
void *context;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache;
- bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; }
+ bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; }
};
mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 9e1646f046..9fce85f25b 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -224,7 +224,6 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
}
/*!
- \overload
Returns true if \a other is equal to this object; otherwise
returns false.
@@ -240,21 +239,6 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const
}
/*!
- Returns true if \a other is equal to this object; otherwise
- returns false.
-
- Two font metrics are considered equal if they were constructed
- from the same QFont and the paint devices they were constructed
- for are considered compatible.
-
- \sa operator!=()
-*/
-bool QFontMetrics::operator ==(const QFontMetrics &other)
-{
- return d == other.d;
-}
-
-/*!
\fn bool QFontMetrics::operator!=(const QFontMetrics &other)
Returns true if \a other is not equal to this object; otherwise returns false.
@@ -1118,7 +1102,6 @@ QFontMetricsF &QFontMetricsF::operator=(const QFontMetricsF &fm)
}
/*!
- \overload
Returns true if the font metrics are equal to the \a other font
metrics; otherwise returns false.
@@ -1132,19 +1115,6 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const
}
/*!
- Returns true if the font metrics are equal to the \a other font
- metrics; otherwise returns false.
-
- Two font metrics are considered equal if they were constructed from the
- same QFont and the paint devices they were constructed for are
- considered to be compatible.
-*/
-bool QFontMetricsF::operator ==(const QFontMetricsF &other)
-{
- return d == other.d;
-}
-
-/*!
\fn bool QFontMetricsF::operator!=(const QFontMetricsF &other)
Returns true if the font metrics are not equal to the \a other font
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 50e4dbb46a..f21e820556 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -117,9 +117,7 @@ public:
int strikeOutPos() const;
int lineWidth() const;
- bool operator==(const QFontMetrics &other); // 5.0 - remove me
bool operator==(const QFontMetrics &other) const;
- inline bool operator !=(const QFontMetrics &other) { return !operator==(other); } // 5.0 - remove me
inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); }
private:
@@ -183,9 +181,7 @@ public:
qreal strikeOutPos() const;
qreal lineWidth() const;
- bool operator==(const QFontMetricsF &other); // 5.0 - remove me
bool operator==(const QFontMetricsF &other) const;
- inline bool operator !=(const QFontMetricsF &other) { return !operator==(other); } // 5.0 - remove me
inline bool operator !=(const QFontMetricsF &other) const { return !operator==(other); }
private:
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index cc825525c4..be9c058693 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -45,6 +45,7 @@
#include "qglyphrun.h"
#include "qglyphrun_p.h"
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -343,12 +344,44 @@ void QGlyphRun::setStrikeOut(bool strikeOut)
}
/*!
- Returns the smallest rectangle that contains all glyphs in this QGlyphRun.
+ Sets the bounding rect of the glyphs in this QGlyphRun to be \a boundingRect. This rectangle
+ will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the
+ glyphs in the glyph run will be returned instead.
+
+ \note Unless you are implementing text shaping, you should not have to use this function.
+ It is used specifically when the QGlyphRun should represent an area which is smaller than the
+ area of the glyphs it contains. This could happen e.g. if the glyph run is retrieved by calling
+ QTextLayout::glyphRuns() and the specified range only includes part of a ligature (where two or
+ more characters are combined to a single glyph.) When this is the case, the bounding rect should
+ only include the appropriate part of the ligature glyph, based on a calculation of the average
+ width of the characters in the ligature.
+
+ In order to support such a case (an example is selections which should be drawn with a different
+ color than the main text color), it is necessary to clip the painting mechanism to the rectangle
+ returned from boundingRect() to avoid drawing the entire ligature glyph.
+
+ \sa boundingRect()
+
+ \since 5.0
+*/
+void QGlyphRun::setBoundingRect(const QRectF &boundingRect)
+{
+ detach();
+ d->boundingRect = boundingRect;
+}
+
+/*!
+ Returns the smallest rectangle that contains all glyphs in this QGlyphRun. If a bounding rect
+ has been set using setBoundingRect(), then this will be returned. Otherwise the bounding rect
+ will be calculated based on the font metrics of the glyphs in the glyph run.
\since 5.0
*/
QRectF QGlyphRun::boundingRect() const
{
+ if (!d->boundingRect.isEmpty())
+ return d->boundingRect;
+
qreal minX, minY, maxX, maxY;
for (int i=0; i<qMin(d->glyphPositions.size(), d->glyphIndexes.size()); ++i) {
@@ -371,6 +404,16 @@ QRectF QGlyphRun::boundingRect() const
return QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
}
+/*!
+ Returns true if the QGlyphRun does not contain any glyphs.
+
+ \since 5.0
+*/
+bool QGlyphRun::isEmpty() const
+{
+ return d->glyphIndexes.isEmpty();
+}
+
QT_END_NAMESPACE
#endif // QT_NO_RAWFONT
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index b4f02f0d87..da88bc72f9 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -91,8 +91,11 @@ public:
void setStrikeOut(bool strikeOut);
bool strikeOut() const;
+ void setBoundingRect(const QRectF &boundingRect);
QRectF boundingRect() const;
+ bool isEmpty() const;
+
private:
friend class QGlyphRunPrivate;
friend class QTextLine;
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index a7745e68ce..b632678971 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -83,6 +83,7 @@ public:
, glyphIndexes(other.glyphIndexes)
, glyphPositions(other.glyphPositions)
, rawFont(other.rawFont)
+ , boundingRect(other.boundingRect)
, overline(other.overline)
, underline(other.underline)
, strikeOut(other.strikeOut)
@@ -96,6 +97,7 @@ public:
QVector<quint32> glyphIndexes;
QVector<QPointF> glyphPositions;
QRawFont rawFont;
+ QRectF boundingRect;
uint overline : 1;
uint underline : 1;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index d280a67a1b..9ca6a24ce7 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -406,6 +406,8 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText
doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable);
q->setCursorWidth(-1);
+
+ QObject::connect(q, SIGNAL(updateCursorRequest(QRectF)), q, SIGNAL(updateRequest(QRectF)));
}
void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document)
@@ -544,7 +546,7 @@ void QTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode)
void QTextControlPrivate::repaintCursor()
{
Q_Q(QTextControl);
- emit q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
+ emit q->updateCursorRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
}
void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection)
@@ -562,9 +564,16 @@ void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelect
differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor);
emit q->updateRequest(q->selectionRect(differenceSelection));
} else {
- if (!oldSelection.isNull())
- emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
- emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
+ if (!oldSelection.hasSelection() && !cursor.hasSelection()) {
+ if (!oldSelection.isNull())
+ emit q->updateCursorRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
+ emit q->updateCursorRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
+
+ } else {
+ if (!oldSelection.isNull())
+ emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
+ emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
+ }
}
}
@@ -2750,6 +2759,12 @@ void QTextControl::setPalette(const QPalette &pal)
d->palette = pal;
}
+bool QTextControl::cursorOn() const
+{
+ Q_D(const QTextControl);
+ return d->cursorOn;
+}
+
QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext() const
{
Q_D(const QTextControl);
@@ -2887,6 +2902,7 @@ void QTextEditMimeData::setup() const
fragment = QTextDocumentFragment();
}
+
QT_END_NAMESPACE
#include "moc_qtextcontrol_p.cpp"
diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h
index 95c5f4d56a..bb91415fd2 100644
--- a/src/gui/text/qtextcontrol_p.h
+++ b/src/gui/text/qtextcontrol_p.h
@@ -215,6 +215,7 @@ Q_SIGNALS:
void cursorPositionChanged();
// control signals
+ void updateCursorRequest(const QRectF &rect = QRectF());
void updateRequest(const QRectF &rect = QRectF());
void documentSizeChanged(const QSizeF &);
void blockCountChanged(int newBlockCount);
@@ -247,6 +248,8 @@ public:
bool setFocusToNextOrPreviousAnchor(bool next);
bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor);
+ bool cursorOn() const;
+
protected:
virtual void timerEvent(QTimerEvent *e);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 0d3aa0b585..58cccfcbf7 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1532,33 +1532,38 @@ void QTextEngine::itemize() const
const ushort *e = uc + length;
int lastScript = QUnicodeTables::Common;
while (uc < e) {
- int script = QUnicodeTables::script(*uc);
- if (script == QUnicodeTables::Inherited)
- script = lastScript;
- analysis->flags = QScriptAnalysis::None;
- if (*uc == QChar::ObjectReplacementCharacter) {
- if (analysis->bidiLevel % 2)
- --analysis->bidiLevel;
+ switch (*uc) {
+ case QChar::ObjectReplacementCharacter:
analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Object;
- } else if (*uc == QChar::LineSeparator) {
+ break;
+ case QChar::LineSeparator:
if (analysis->bidiLevel % 2)
--analysis->bidiLevel;
analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator
- } else if (*uc == 9) {
+ break;
+ case 9: // Tab
analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Tab;
analysis->bidiLevel = control.baseLevel();
- } else if ((*uc == 32 || *uc == QChar::Nbsp)
- && (option.flags() & QTextOption::ShowTabsAndSpaces)) {
- analysis->script = QUnicodeTables::Common;
- analysis->flags = QScriptAnalysis::Space;
- analysis->bidiLevel = control.baseLevel();
- } else {
- analysis->script = script;
+ break;
+ case 32: // Space
+ case QChar::Nbsp:
+ if (option.flags() & QTextOption::ShowTabsAndSpaces) {
+ analysis->script = QUnicodeTables::Common;
+ analysis->flags = QScriptAnalysis::Space;
+ analysis->bidiLevel = control.baseLevel();
+ break;
+ }
+ // fall through
+ default:
+ int script = QUnicodeTables::script(*uc);
+ analysis->script = script == QUnicodeTables::Inherited ? lastScript : script;
+ analysis->flags = QScriptAnalysis::None;
+ break;
}
lastScript = analysis->script;
++uc;
@@ -2432,7 +2437,7 @@ void QTextEngine::indexAdditionalFormats()
between the text that gets truncated and the ellipsis. This is important to get
correctly shaped results for arabic text.
*/
-static bool nextCharJoins(const QString &string, int pos)
+static inline bool nextCharJoins(const QString &string, int pos)
{
while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing)
++pos;
@@ -2441,13 +2446,14 @@ static bool nextCharJoins(const QString &string, int pos)
return string.at(pos).joining() != QChar::OtherJoining;
}
-static bool prevCharJoins(const QString &string, int pos)
+static inline bool prevCharJoins(const QString &string, int pos)
{
while (pos > 0 && string.at(pos - 1).category() == QChar::Mark_NonSpacing)
--pos;
if (pos == 0)
return false;
- return (string.at(pos - 1).joining() == QChar::Dual || string.at(pos - 1).joining() == QChar::Center);
+ QChar::Joining joining = string.at(pos - 1).joining();
+ return (joining == QChar::Dual || joining == QChar::Center);
}
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags) const
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index d6eca77b00..25d7de827e 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -42,6 +42,7 @@
#include "qtextlayout.h"
#include "qtextengine_p.h"
+#include <qthread.h>
#include <qfont.h>
#include <qpainter.h>
#include <qvarlengtharray.h>
@@ -2106,8 +2107,10 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
}
+#if !defined(QT_NO_RAWFONT)
static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &glyphLayout,
- const QPointF &pos, const QTextItem::RenderFlags &flags)
+ const QPointF &pos, const QTextItem::RenderFlags &flags,
+ const QFixed &selectionX, const QFixed &selectionWidth)
{
QGlyphRun glyphRun;
@@ -2115,6 +2118,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
QRawFont font;
QRawFontPrivate *fontD = QRawFontPrivate::get(font);
fontD->fontEngine = fontEngine;
+ fontD->thread = QThread::currentThread();
fontD->fontEngine->ref.ref();
#if defined(Q_WS_WIN)
@@ -2149,13 +2153,27 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
positionsArray);
Q_ASSERT(glyphsArray.size() == positionsArray.size());
+ qreal fontHeight = font.ascent() + font.descent();
+ qreal minY;
+ qreal maxY;
QVector<quint32> glyphs;
QVector<QPointF> positions;
for (int i=0; i<glyphsArray.size(); ++i) {
glyphs.append(glyphsArray.at(i) & 0xffffff);
- positions.append(positionsArray.at(i).toPointF() + pos);
+
+ QPointF position = positionsArray.at(i).toPointF() + pos;
+ positions.append(position);
+
+ if (i == 0) {
+ maxY = minY = position.y();
+ } else {
+ minY = qMin(minY, position.y());
+ maxY = qMax(maxY, position.y());
+ }
}
+ qreal height = maxY + fontHeight - minY;
+
glyphRun.setGlyphIndexes(glyphs);
glyphRun.setPositions(positions);
@@ -2164,6 +2182,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
glyphRun.setStrikeOut(flags.testFlag(QTextItem::StrikeOut));
glyphRun.setRawFont(font);
+ glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height));
+
return glyphRun;
}
@@ -2180,7 +2200,6 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
\sa QTextLayout::glyphRuns()
*/
-#if !defined(QT_NO_RAWFONT)
QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
{
const QScriptLine &line = eng->lines[i];
@@ -2194,7 +2213,14 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
if (length < 0)
length = textLength();
- QTextLineItemIterator iterator(eng, i);
+ if (length == 0)
+ return QList<QGlyphRun>();
+
+ QTextLayout::FormatRange selection;
+ selection.start = from;
+ selection.length = length;
+
+ QTextLineItemIterator iterator(eng, i, QPointF(), &selection);
qreal y = line.y.toReal() + line.base().toReal();
QList<QGlyphRun> glyphRuns;
while (!iterator.atEnd()) {
@@ -2204,7 +2230,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QPointF pos(iterator.x.toReal(), y);
if (from >= 0 && length >= 0 &&
- (from >= si.position + eng->length(&si) || from + length <= si.position)) {
+ (from >= si.position + eng->length(&si)
+ || from + length <= si.position
+ || from + length <= iterator.itemStart
+ || from >= iterator.itemEnd)) {
continue;
}
@@ -2233,19 +2262,22 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
? si.num_glyphs - 1
: logClusters[relativeTo];
+ int itemGlyphsStart = logClusters[iterator.itemStart - si.position];
+ int itemGlyphsEnd = logClusters[iterator.itemEnd - 1 - si.position];
+
QGlyphLayout glyphLayout = eng->shapedGlyphs(&si);
// Calculate new x position of glyph layout for a subset. This becomes somewhat complex
// when we're breaking a RTL script item, since the expected position passed into
// getGlyphPositions() is the left-most edge of the left-most glyph in an RTL run.
if (relativeFrom != (iterator.itemStart - si.position) && !rtl) {
- for (int i=0; i<glyphsStart; ++i) {
+ for (int i=itemGlyphsStart; i<glyphsStart; ++i) {
QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(),
glyphLayout.advances_y[i].toReal());
}
} else if (relativeTo != (iterator.itemEnd - si.position - 1) && rtl) {
- for (int i=glyphLayout.numGlyphs - 1; i>glyphsEnd; --i) {
+ for (int i=itemGlyphsEnd; i>glyphsEnd; --i) {
QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(),
glyphLayout.advances_y[i].toReal());
@@ -2254,6 +2286,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
glyphLayout = glyphLayout.mid(glyphsStart, glyphsEnd - glyphsStart + 1);
+ QFixed x;
+ QFixed width;
+ iterator.getSelectionBounds(&x, &width);
+
if (glyphLayout.numGlyphs > 0) {
QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) {
@@ -2268,7 +2304,7 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
- subLayout, pos, flags));
+ subLayout, pos, flags, x, width));
for (int i = 0; i < subLayout.numGlyphs; i++) {
pos += QPointF(subLayout.advances_x[i].toReal(),
subLayout.advances_y[i].toReal());
@@ -2279,10 +2315,15 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
}
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
- glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
- subLayout, pos, flags));
+ QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
+ subLayout, pos, flags, x, width);
+ if (!glyphRun.isEmpty())
+ glyphRuns.append(glyphRun);
} else {
- glyphRuns.append(glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags));
+ QGlyphRun glyphRun = glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags, x,
+ width);
+ if (!glyphRun.isEmpty())
+ glyphRuns.append(glyphRun);
}
}
}
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index cea5eac465..d641266367 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1667,21 +1667,24 @@ QTextBlock::iterator &QTextBlock::iterator::operator--()
\sa QGlyphRun, QTextBlock::layout(), QTextLayout::position(), QPainter::drawGlyphRun()
*/
#if !defined(QT_NO_RAWFONT)
-QList<QGlyphRun> QTextFragment::glyphRuns() const
+QList<QGlyphRun> QTextFragment::glyphRuns(int pos, int len) const
{
if (!p || !n)
return QList<QGlyphRun>();
- int pos = position();
- int len = length();
- if (len == 0)
- return QList<QGlyphRun>();
-
- int blockNode = p->blockMap().findNode(pos);
+ int blockNode = p->blockMap().findNode(position());
const QTextBlockData *blockData = p->blockMap().fragment(blockNode);
QTextLayout *layout = blockData->layout;
+ int blockPosition = p->blockMap().position(blockNode);
+ if (pos < 0)
+ pos = position() - blockPosition;
+ if (len < 0)
+ len = length();
+ if (len == 0)
+ return QList<QGlyphRun>();
+
QList<QGlyphRun> ret;
for (int i=0; i<layout->lineCount(); ++i) {
QTextLine textLine = layout->lineAt(i);
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index 9c5cc13539..c2b46e4d12 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -317,7 +317,7 @@ public:
QString text() const;
#if !defined(QT_NO_RAWFONT)
- QList<QGlyphRun> glyphRuns() const;
+ QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const;
#endif
private:
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 4f7f4ed80d..0423e2224d 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -395,7 +395,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
case Basic:
if(realm.isEmpty())
this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
- if (user.isEmpty())
+ if (user.isEmpty() && password.isEmpty())
phase = Done;
break;
case Ntlm:
@@ -406,7 +406,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (options.value("stale").toLower() == "true")
phase = Start;
- if (user.isEmpty())
+ if (user.isEmpty() && password.isEmpty())
phase = Done;
break;
}
diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp
index 586c8944ca..17f8014e52 100644
--- a/src/network/ssl/qssl.cpp
+++ b/src/network/ssl/qssl.cpp
@@ -82,9 +82,9 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QSsl::AlternateNameEntryType
+ \enum QSsl::AlternativeNameEntryType
- Describes the key types for alternate name entries in QSslCertificate.
+ Describes the key types for alternative name entries in QSslCertificate.
\value EmailEntry An email entry; the entry contains an email address that
the certificate is valid for.
@@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE
\value DnsEntry A DNS host name entry; the entry contains a host name
entry that the certificate is valid for. The entry may contain wildcards.
- \sa QSslCertificate::alternateSubjectNames()
+ \sa QSslCertificate::subjectAlternativeNames()
*/
diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h
index 2ecd1c363c..7b76b64b4c 100644
--- a/src/network/ssl/qssl.h
+++ b/src/network/ssl/qssl.h
@@ -67,11 +67,15 @@ namespace QSsl {
Dsa
};
- enum AlternateNameEntryType {
+ enum AlternativeNameEntryType {
EmailEntry,
DnsEntry
};
+#if QT_DEPRECATED_SINCE(5,0)
+ typedef AlternativeNameEntryType AlternateNameEntryType;
+#endif
+
enum SslProtocol {
SslV3,
SslV2,
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 94273b0754..af265db6e4 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -426,7 +426,7 @@ QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
/*!
Returns the list of alternative subject names for this
- certificate. The alternate subject names typically contain host
+ certificate. The alternative names typically contain host
names, optionally with wildcards, that are valid for this
certificate.
@@ -437,9 +437,9 @@ QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
\sa subjectInfo()
*/
-QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubjectNames() const
+QMultiMap<QSsl::AlternativeNameEntryType, QString> QSslCertificate::subjectAlternativeNames() const
{
- QMultiMap<QSsl::AlternateNameEntryType, QString> result;
+ QMultiMap<QSsl::AlternativeNameEntryType, QString> result;
if (!d->x509)
return result;
@@ -922,7 +922,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate)
<< ',' << certificate.digest().toBase64()
<< ',' << certificate.issuerInfo(QSslCertificate::Organization)
<< ',' << certificate.subjectInfo(QSslCertificate::Organization)
- << ',' << certificate.alternateSubjectNames()
+ << ',' << certificate.subjectAlternativeNames()
#ifndef QT_NO_TEXTSTREAM
<< ',' << certificate.effectiveDate()
<< ',' << certificate.expiryDate()
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index a057d7a17d..0498d162c4 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -48,6 +48,7 @@
#include <QtCore/qcryptographichash.h>
#include <QtCore/qregexp.h>
#include <QtCore/qsharedpointer.h>
+#include <QtCore/qmap.h>
#include <QtNetwork/qssl.h>
typedef struct x509_st X509; // ### check if this works
@@ -65,7 +66,6 @@ class QIODevice;
class QSslError;
class QSslKey;
class QStringList;
-template <typename T, typename U> class QMultiMap;
class QSslCertificatePrivate;
class Q_NETWORK_EXPORT QSslCertificate
@@ -106,7 +106,11 @@ public:
QStringList subjectInfo(const QByteArray &attribute) const;
QList<QByteArray> subjectInfoAttributes() const;
QList<QByteArray> issuerInfoAttributes() const;
- QMultiMap<QSsl::AlternateNameEntryType, QString> alternateSubjectNames() const;
+#if QT_DEPRECATED_SINCE(5,0)
+ QT_DEPRECATED inline QMultiMap<QSsl::AlternateNameEntryType, QString>
+ alternateSubjectNames() const { return subjectAlternativeNames(); }
+#endif
+ QMultiMap<QSsl::AlternativeNameEntryType, QString> subjectAlternativeNames() const;
QDateTime effectiveDate() const;
QDateTime expiryDate() const;
QSslKey publicKey() const;
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 11b2ff8bcd..300a5c84d5 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1435,7 +1435,7 @@ bool QSslSocketBackendPrivate::isMatchingHostname(const QSslCertificate &cert, c
}
}
- foreach (const QString &altName, cert.alternateSubjectNames().values(QSsl::DnsEntry)) {
+ foreach (const QString &altName, cert.subjectAlternativeNames().values(QSsl::DnsEntry)) {
if (isMatchingHostname(altName.toLower(), peerName.toLower())) {
return true;
}
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index e5f032747b..921df369f4 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -401,7 +401,7 @@ public:
bool useOpacityAttribute;
bool usePmvMatrixAttribute;
- bool operator==(const QGLEngineShaderProg& other) {
+ bool operator==(const QGLEngineShaderProg& other) const {
// We don't care about the program
return ( mainVertexShader == other.mainVertexShader &&
positionVertexShader == other.positionVertexShader &&
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index 8843d3edcb..563d3b9472 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -1776,16 +1776,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
switch (t) {
case Name:
+#ifndef Q_WS_X11 // on Linux we use relations for this, name is text (fall through to Value)
if (child == OpenList)
str = QComboBox::tr("Open");
else
str = QAccessibleWidgetEx::text(t, 0);
break;
-#ifndef QT_NO_SHORTCUT
- case Accelerator:
- if (child == OpenList)
- str = (QString)QKeySequence(Qt::Key_Down);
- // missing break?
#endif
case Value:
if (comboBox()->isEditable())
@@ -1793,6 +1789,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
else
str = comboBox()->currentText();
break;
+#ifndef QT_NO_SHORTCUT
+ case Accelerator:
+ if (child == OpenList)
+ str = (QString)QKeySequence(Qt::Key_Down);
+ break;
+#endif
default:
break;
}
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
new file mode 100644
index 0000000000..4618f873d3
--- /dev/null
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -0,0 +1,1029 @@
+/****************************************************************************
+**
+** 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 plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "itemviews.h"
+
+#include <qheaderview.h>
+#include <qtableview.h>
+#include <qlistview.h>
+#include <qtreeview.h>
+#include <private/qtreewidget_p.h>
+#include <qaccessible2.h>
+#include <QDebug>
+
+#ifndef QT_NO_ACCESSIBILITY
+
+QT_BEGIN_NAMESPACE
+
+QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
+
+#ifndef QT_NO_ITEMVIEWS
+/*
+Implementation of the IAccessible2 table2 interface. Much simpler than
+the other table interfaces since there is only the main table and cells:
+
+TABLE/LIST/TREE
+ |- HEADER CELL
+ |- CELL
+ |- CELL
+ ...
+*/
+
+int QAccessibleTable2::logicalIndex(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return -1;
+ int vHeader = verticalHeader() ? 1 : 0;
+ int hHeader = horizontalHeader() ? 1 : 0;
+ // row * number columns + column + 1 for one based counting
+ return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader) + 1;
+}
+
+QAccessibleInterface *QAccessibleTable2::childFromLogical(int logicalIndex) const
+{
+ logicalIndex--; // one based counting ftw
+ int vHeader = verticalHeader() ? 1 : 0;
+ int hHeader = horizontalHeader() ? 1 : 0;
+
+ int columns = view->model()->columnCount() + vHeader;
+
+ int row = logicalIndex / columns;
+ int column = logicalIndex % columns;
+
+ if (vHeader) {
+ if (column == 0) {
+ if (row == 0) {
+ return new QAccessibleTable2CornerButton(view);
+ }
+ return new QAccessibleTable2HeaderCell(view, row-1, Qt::Vertical);
+ }
+ --column;
+ }
+ if (hHeader) {
+ if (row == 0) {
+ return new QAccessibleTable2HeaderCell(view, column, Qt::Horizontal);
+ }
+ --row;
+ }
+ return new QAccessibleTable2Cell(view, view->model()->index(row, column), cellRole());
+}
+
+QAccessibleTable2::QAccessibleTable2(QWidget *w)
+ : QAccessibleObjectEx(w)
+{
+ view = qobject_cast<QAbstractItemView *>(w);
+ Q_ASSERT(view);
+
+ if (qobject_cast<const QTableView*>(view)) {
+ m_role = QAccessible::Table;
+ } else if (qobject_cast<const QTreeView*>(view)) {
+ m_role = QAccessible::Tree;
+ } else if (qobject_cast<const QListView*>(view)) {
+ m_role = QAccessible::List;
+ } else {
+ // is this our best guess?
+ m_role = QAccessible::Table;
+ }
+}
+
+QAccessibleTable2::~QAccessibleTable2()
+{
+}
+
+QHeaderView *QAccessibleTable2::horizontalHeader() const
+{
+ QHeaderView *header = 0;
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ header = tv->horizontalHeader();
+#endif
+#ifndef QT_NO_TREEVIEW
+ } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
+ header = tv->header();
+#endif
+ }
+ return header;
+}
+
+QHeaderView *QAccessibleTable2::verticalHeader() const
+{
+ QHeaderView *header = 0;
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ header = tv->verticalHeader();
+#endif
+ }
+ return header;
+}
+
+void QAccessibleTable2::modelReset()
+{}
+
+void QAccessibleTable2::rowsInserted(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = first;
+ lastChange.lastRow = last;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeInsert;
+}
+
+void QAccessibleTable2::rowsRemoved(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = first;
+ lastChange.lastRow = last;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeDelete;
+}
+
+void QAccessibleTable2::columnsInserted(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = first;
+ lastChange.lastColumn = last;
+ lastChange.type = QAccessible2::TableModelChangeInsert;
+}
+
+void QAccessibleTable2::columnsRemoved(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = first;
+ lastChange.lastColumn = last;
+ lastChange.type = QAccessible2::TableModelChangeDelete;
+}
+
+void QAccessibleTable2::rowsMoved( const QModelIndex &, int, int, const QModelIndex &, int)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeUpdate;
+}
+
+void QAccessibleTable2::columnsMoved( const QModelIndex &, int, int, const QModelIndex &, int)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeUpdate;
+}
+
+QAccessibleTable2Cell *QAccessibleTable2::cell(const QModelIndex &index) const
+{
+ if (index.isValid())
+ return new QAccessibleTable2Cell(view, index, cellRole());
+ return 0;
+}
+
+QAccessibleTable2CellInterface *QAccessibleTable2::cellAt(int row, int column) const
+{
+ Q_ASSERT(role(0) != QAccessible::Tree);
+ QModelIndex index = view->model()->index(row, column);
+ //Q_ASSERT(index.isValid());
+ if (!index.isValid()) {
+ qWarning() << "QAccessibleTable2::cellAt: invalid index: " << index << " for " << view;
+ return 0;
+ }
+ return cell(index);
+}
+
+QAccessibleInterface *QAccessibleTable2::caption() const
+{
+ return 0;
+}
+
+QString QAccessibleTable2::columnDescription(int column) const
+{
+ return view->model()->headerData(column, Qt::Horizontal).toString();
+}
+
+int QAccessibleTable2::columnCount() const
+{
+ return view->model()->columnCount();
+}
+
+int QAccessibleTable2::rowCount() const
+{
+ return view->model()->rowCount();
+}
+
+int QAccessibleTable2::selectedCellCount() const
+{
+ return view->selectionModel()->selectedIndexes().count();
+}
+
+int QAccessibleTable2::selectedColumnCount() const
+{
+ return view->selectionModel()->selectedColumns().count();
+}
+
+int QAccessibleTable2::selectedRowCount() const
+{
+ return view->selectionModel()->selectedRows().count();
+}
+
+QString QAccessibleTable2::rowDescription(int row) const
+{
+ return view->model()->headerData(row, Qt::Vertical).toString();
+}
+
+QList<QAccessibleTable2CellInterface*> QAccessibleTable2::selectedCells() const
+{
+ QList<QAccessibleTable2CellInterface*> cells;
+ Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedIndexes()) {
+ cells.append(cell(index));
+ }
+ return cells;
+}
+
+QList<int> QAccessibleTable2::selectedColumns() const
+{
+ QList<int> columns;
+ Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedColumns()) {
+ columns.append(index.column());
+ }
+ return columns;
+}
+
+QList<int> QAccessibleTable2::selectedRows() const
+{
+ QList<int> rows;
+ Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedRows()) {
+ rows.append(index.row());
+ }
+ return rows;
+}
+
+QAccessibleInterface *QAccessibleTable2::summary() const
+{
+ return 0;
+}
+
+bool QAccessibleTable2::isColumnSelected(int column) const
+{
+ return view->selectionModel()->isColumnSelected(column, QModelIndex());
+}
+
+bool QAccessibleTable2::isRowSelected(int row) const
+{
+ return view->selectionModel()->isRowSelected(row, QModelIndex());
+}
+
+bool QAccessibleTable2::selectRow(int row)
+{
+ QModelIndex index = view->model()->index(row, 0);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Select);
+ return true;
+}
+
+bool QAccessibleTable2::selectColumn(int column)
+{
+ QModelIndex index = view->model()->index(0, column);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Select);
+ return true;
+}
+
+bool QAccessibleTable2::unselectRow(int row)
+{
+ QModelIndex index = view->model()->index(row, 0);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Deselect);
+ return true;
+}
+
+bool QAccessibleTable2::unselectColumn(int column)
+{
+ QModelIndex index = view->model()->index(0, column);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
+ return true;
+}
+
+QAccessible2::TableModelChange QAccessibleTable2::modelChange() const
+{
+ QAccessible2::TableModelChange change;
+ // FIXME
+ return change;
+}
+
+QAccessible::Role QAccessibleTable2::role(int child) const
+{
+ Q_ASSERT(child >= 0);
+ if (child > 0)
+ return QAccessible::Cell;
+ return m_role;
+}
+
+QAccessible::State QAccessibleTable2::state(int child) const
+{
+ Q_ASSERT(child == 0);
+ return QAccessible::Normal | HasInvokeExtension;
+}
+
+int QAccessibleTable2::childAt(int x, int y) const
+{
+ QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0));
+ QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset);
+ // FIXME: if indexPosition < 0 in one coordinate, return header
+
+ QModelIndex index = view->indexAt(indexPosition);
+ if (index.isValid()) {
+ return logicalIndex(index);
+ }
+ return -1;
+}
+
+int QAccessibleTable2::childCount() const
+{
+ int vHeader = verticalHeader() ? 1 : 0;
+ int hHeader = horizontalHeader() ? 1 : 0;
+ return (view->model()->rowCount()+hHeader) * (view->model()->columnCount()+vHeader);
+}
+
+int QAccessibleTable2::indexOfChild(const QAccessibleInterface *iface) const
+{
+ Q_ASSERT(iface->role(0) != QAccessible::TreeItem); // should be handled by tree class
+ if (iface->role(0) == QAccessible::Cell || iface->role(0) == QAccessible::ListItem) {
+ const QAccessibleTable2Cell* cell = static_cast<const QAccessibleTable2Cell*>(iface);
+ return logicalIndex(cell->m_index);
+ } else if (iface->role(0) == QAccessible::ColumnHeader){
+ const QAccessibleTable2HeaderCell* cell = static_cast<const QAccessibleTable2HeaderCell*>(iface);
+ return cell->index + (verticalHeader() ? 1 : 0) + 1;
+ } else if (iface->role(0) == QAccessible::RowHeader){
+ const QAccessibleTable2HeaderCell* cell = static_cast<const QAccessibleTable2HeaderCell*>(iface);
+ return (cell->index+1) * (view->model()->rowCount()+1) + 1;
+ } else if (iface->role(0) == QAccessible::Pane) {
+ return 1; // corner button
+ } else {
+ qWarning() << "WARNING QAccessibleTable2::indexOfChild Fix my children..."
+ << iface->role(0) << iface->text(QAccessible::Name, 0);
+ }
+ // FIXME: we are in denial of our children. this should stop.
+ return -1;
+}
+
+QString QAccessibleTable2::text(Text t, int child) const
+{
+ Q_ASSERT(child == 0);
+ if (t == QAccessible::Description)
+ return view->accessibleDescription();
+ return view->accessibleName();
+}
+
+QRect QAccessibleTable2::rect(int child) const
+{
+ Q_ASSERT(!child);
+ if (!view->isVisible())
+ return QRect();
+ QPoint pos = view->mapToGlobal(QPoint(0, 0));
+ return QRect(pos.x(), pos.y(), view->width(), view->height());
+}
+
+int QAccessibleTable2::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ *iface = 0;
+ switch (relation) {
+ case Ancestor: {
+ if (index == 1 && view->parent()) {
+ *iface = QAccessible::queryAccessibleInterface(view->parent());
+ if (*iface)
+ return 0;
+ }
+ break;
+ }
+ case QAccessible::Child: {
+ Q_ASSERT(index > 0);
+ *iface = childFromLogical(index);
+ if (*iface) {
+ return 0;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return -1;
+}
+
+QAccessible::Relation QAccessibleTable2::relationTo(int, const QAccessibleInterface *, int) const
+{
+ return QAccessible::Unrelated;
+}
+
+#ifndef QT_NO_ACTION
+int QAccessibleTable2::userActionCount(int) const
+{
+ return 0;
+}
+QString QAccessibleTable2::actionText(int, Text, int) const
+{
+ return QString();
+}
+bool QAccessibleTable2::doAction(int, int, const QVariantList &)
+{
+ return false;
+}
+#endif
+
+
+// TREE VIEW
+
+QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
+{
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ QModelIndex modelIndex = treeView->d_func()->viewItems.at(row).index;
+
+ if (modelIndex.isValid() && column > 0) {
+ modelIndex = view->model()->index(modelIndex.row(), column, modelIndex.parent());
+ }
+ return modelIndex;
+}
+
+int QAccessibleTree::childAt(int x, int y) const
+{
+ QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0));
+ QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset);
+
+ QModelIndex index = view->indexAt(indexPosition);
+ if (!index.isValid())
+ return -1;
+
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0);
+ int column = index.column();
+
+ int i = row * view->model()->columnCount() + column + 1;
+ Q_ASSERT(i > view->model()->columnCount());
+ return i;
+}
+
+int QAccessibleTree::childCount() const
+{
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ if (!view->model())
+ return 0;
+
+ int hHeader = horizontalHeader() ? 1 : 0;
+ return (treeView->d_func()->viewItems.count() + hHeader)* view->model()->columnCount();
+}
+
+int QAccessibleTree::rowCount() const
+{
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ return treeView->d_func()->viewItems.count();
+}
+
+int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
+{
+ if (iface->role(0) == QAccessible::TreeItem) {
+ const QAccessibleTable2Cell* cell = static_cast<const QAccessibleTable2Cell*>(iface);
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ int row = treeView->d_func()->viewIndex(cell->m_index) + (horizontalHeader() ? 1 : 0);
+ int column = cell->m_index.column();
+
+ int index = row * view->model()->columnCount() + column + 1;
+ //qDebug() << "QAccessibleTree::indexOfChild r " << row << " c " << column << "index " << index;
+ Q_ASSERT(index > treeView->model()->columnCount());
+ return index;
+ } else if (iface->role(0) == QAccessible::ColumnHeader){
+ const QAccessibleTable2HeaderCell* cell = static_cast<const QAccessibleTable2HeaderCell*>(iface);
+ //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1;
+ return cell->index + 1;
+ } else {
+ qWarning() << "WARNING QAccessibleTable2::indexOfChild invalid child"
+ << iface->role(0) << iface->text(QAccessible::Name, 0);
+ }
+ // FIXME: add scrollbars and don't just ignore them
+ return -1;
+}
+
+int QAccessibleTree::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ switch (relation) {
+ case QAccessible::Child: {
+ Q_ASSERT(index > 0);
+ --index;
+ int hHeader = horizontalHeader() ? 1 : 0;
+
+ if (hHeader) {
+ if (index < view->model()->columnCount()) {
+ *iface = new QAccessibleTable2HeaderCell(view, index, Qt::Horizontal);
+ return 0;
+ } else {
+ index -= view->model()->columnCount();
+ }
+ }
+
+ int row = index / view->model()->columnCount();
+ int column = index % view->model()->columnCount();
+ QModelIndex modelIndex = indexFromLogical(row, column);
+ if (modelIndex.isValid()) {
+ *iface = cell(modelIndex);
+ return 0;
+ }
+ return -1;
+ }
+ default:
+ break;
+ }
+ return QAccessibleTable2::navigate(relation, index, iface);
+}
+
+QAccessible::Relation QAccessibleTree::relationTo(int, const QAccessibleInterface *, int) const
+{
+ return QAccessible::Unrelated;
+}
+
+QAccessibleTable2CellInterface *QAccessibleTree::cellAt(int row, int column) const
+{
+ QModelIndex index = indexFromLogical(row, column);
+ if (!index.isValid()) {
+ qWarning() << "Requested invalid tree cell: " << row << column;
+ return 0;
+ }
+ return new QAccessibleTable2Cell(view, index, cellRole());
+}
+
+QString QAccessibleTree::rowDescription(int) const
+{
+ return QString(); // no headers for rows in trees
+}
+
+bool QAccessibleTree::isRowSelected(int row) const
+{
+ QModelIndex index = indexFromLogical(row);
+ return view->selectionModel()->isRowSelected(index.row(), index.parent());
+}
+
+bool QAccessibleTree::selectRow(int row)
+{
+ QModelIndex index = indexFromLogical(row);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Select);
+ return true;
+}
+
+// TABLE CELL
+
+QAccessibleTable2Cell::QAccessibleTable2Cell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_)
+ : /* QAccessibleSimpleEditableTextInterface(this), */ view(view_), m_index(index_), m_role(role_)
+{
+ Q_ASSERT(index_.isValid());
+}
+
+int QAccessibleTable2Cell::columnExtent() const { return 1; }
+int QAccessibleTable2Cell::rowExtent() const { return 1; }
+
+QList<QAccessibleInterface*> QAccessibleTable2Cell::rowHeaderCells() const
+{
+ QList<QAccessibleInterface*> headerCell;
+ if (verticalHeader()) {
+ headerCell.append(new QAccessibleTable2HeaderCell(view, m_index.row(), Qt::Vertical));
+ }
+ return headerCell;
+}
+
+QList<QAccessibleInterface*> QAccessibleTable2Cell::columnHeaderCells() const
+{
+ QList<QAccessibleInterface*> headerCell;
+ if (horizontalHeader()) {
+ headerCell.append(new QAccessibleTable2HeaderCell(view, m_index.column(), Qt::Horizontal));
+ }
+ return headerCell;
+}
+
+QHeaderView *QAccessibleTable2Cell::horizontalHeader() const
+{
+ QHeaderView *header = 0;
+
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ header = tv->horizontalHeader();
+#endif
+#ifndef QT_NO_TREEVIEW
+ } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
+ header = tv->header();
+#endif
+ }
+
+ return header;
+}
+
+QHeaderView *QAccessibleTable2Cell::verticalHeader() const
+{
+ QHeaderView *header = 0;
+#ifndef QT_NO_TABLEVIEW
+ if (const QTableView *tv = qobject_cast<const QTableView*>(view))
+ header = tv->verticalHeader();
+#endif
+ return header;
+}
+
+int QAccessibleTable2Cell::columnIndex() const
+{
+ return m_index.column();
+}
+
+int QAccessibleTable2Cell::rowIndex() const
+{
+ if (role(0) == QAccessible::TreeItem) {
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ int row = treeView->d_func()->viewIndex(m_index);
+ return row;
+ }
+ return m_index.row();
+}
+
+bool QAccessibleTable2Cell::isSelected() const
+{
+ return view->selectionModel()->isSelected(m_index);
+}
+
+void QAccessibleTable2Cell::rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const
+{
+ *row = m_index.row();
+ *column = m_index.column();
+ *rowExtents = 1;
+ *columnExtents = 1;
+ *selected = isSelected();
+}
+
+QAccessibleTable2Interface* QAccessibleTable2Cell::table() const
+{
+ return QAccessible::queryAccessibleInterface(view)->table2Interface();
+}
+
+QAccessible::Role QAccessibleTable2Cell::role(int child) const
+{
+ Q_ASSERT(child == 0);
+ return m_role;
+}
+
+QAccessible::State QAccessibleTable2Cell::state(int child) const
+{
+ Q_ASSERT(child == 0);
+ State st = Normal;
+
+ QRect globalRect = view->rect();
+ globalRect.translate(view->mapToGlobal(QPoint(0,0)));
+ if (!globalRect.intersects(rect(0)))
+ st |= Invisible;
+
+ if (view->selectionModel()->isSelected(m_index))
+ st |= Selected;
+ if (view->selectionModel()->currentIndex() == m_index)
+ st |= Focused;
+ if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked)
+ st |= Checked;
+
+ Qt::ItemFlags flags = m_index.flags();
+ if (flags & Qt::ItemIsSelectable) {
+ st |= Selectable;
+ st |= Focusable;
+ if (view->selectionMode() == QAbstractItemView::MultiSelection)
+ st |= MultiSelectable;
+ if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
+ st |= ExtSelectable;
+ }
+ if (m_role == QAccessible::TreeItem) {
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ if (treeView->isExpanded(m_index))
+ st |= Expanded;
+ }
+ return st;
+}
+
+bool QAccessibleTable2Cell::isExpandable() const
+{
+ return view->model()->hasChildren(m_index);
+}
+
+QRect QAccessibleTable2Cell::rect(int child) const
+{
+ Q_ASSERT(child == 0);
+
+ QRect r;
+ r = view->visualRect(m_index);
+
+ if (!r.isNull())
+ r.translate(view->viewport()->mapTo(view, QPoint(0,0)));
+ r.translate(view->mapToGlobal(QPoint(0, 0)));
+ return r;
+}
+
+QString QAccessibleTable2Cell::text(Text t, int child) const
+{
+ Q_ASSERT(child == 0);
+ QAbstractItemModel *model = view->model();
+ QString value;
+ switch (t) {
+ case QAccessible::Value:
+ case QAccessible::Name:
+ value = model->data(m_index, Qt::AccessibleTextRole).toString();
+ if (value.isEmpty())
+ value = model->data(m_index, Qt::DisplayRole).toString();
+ break;
+ case QAccessible::Description:
+ value = model->data(m_index, Qt::AccessibleDescriptionRole).toString();
+ break;
+ default:
+ break;
+ }
+ return value;
+}
+
+void QAccessibleTable2Cell::setText(Text /*t*/, int child, const QString &text)
+{
+ Q_ASSERT(child == 0);
+ if (!m_index.flags() & Qt::ItemIsEditable)
+ return;
+ view->model()->setData(m_index, text);
+}
+
+bool QAccessibleTable2Cell::isValid() const
+{
+ if (!m_index.isValid()) {
+ qDebug() << "Interface is not valid";
+ }
+
+ return m_index.isValid();
+}
+
+int QAccessibleTable2Cell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ if (relation == Ancestor && index == 1) {
+ if (m_role == QAccessible::TreeItem) {
+ *iface = new QAccessibleTree(view);
+ } else {
+ *iface = new QAccessibleTable2(view);
+ }
+ return 0;
+ }
+
+ *iface = 0;
+ if (!view)
+ return -1;
+
+ switch (relation) {
+
+ case Child: {
+ return -1;
+ }
+ case Sibling:
+ if (index > 0) {
+ QAccessibleInterface *parent = queryAccessibleInterface(view);
+ int ret = parent->navigate(QAccessible::Child, index, iface);
+ delete parent;
+ if (*iface)
+ return ret;
+ }
+ return -1;
+
+// From table1 implementation:
+// case Up:
+// case Down:
+// case Left:
+// case Right: {
+// // This is in the "not so nice" category. In order to find out which item
+// // is geometrically around, we have to set the current index, navigate
+// // and restore the index as well as the old selection
+// view->setUpdatesEnabled(false);
+// const QModelIndex oldIdx = view->currentIndex();
+// QList<QModelIndex> kids = children();
+// const QModelIndex currentIndex = index ? kids.at(index - 1) : QModelIndex(row);
+// const QItemSelection oldSelection = view->selectionModel()->selection();
+// view->setCurrentIndex(currentIndex);
+// const QModelIndex idx = view->moveCursor(toCursorAction(relation), Qt::NoModifier);
+// view->setCurrentIndex(oldIdx);
+// view->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
+// view->setUpdatesEnabled(true);
+// if (!idx.isValid())
+// return -1;
+
+// if (idx.parent() != row.parent() || idx.row() != row.row())
+// *iface = cell(idx);
+// return index ? kids.indexOf(idx) + 1 : 0; }
+ default:
+ break;
+ }
+
+ return -1;
+}
+
+QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const
+{
+ Q_ASSERT(child == 0);
+ Q_ASSERT(otherChild == 0);
+ // we only check for parent-child relationships in trees
+ if (m_role == QAccessible::TreeItem && other->role(0) == QAccessible::TreeItem) {
+ QModelIndex otherIndex = static_cast<const QAccessibleTable2Cell*>(other)->m_index;
+ // is the other our parent?
+ if (otherIndex.parent() == m_index)
+ return QAccessible::Ancestor;
+ // are we the other's child?
+ if (m_index.parent() == otherIndex)
+ return QAccessible::Child;
+ }
+ return QAccessible::Unrelated;
+}
+
+#ifndef QT_NO_ACTION
+int QAccessibleTable2Cell::userActionCount(int) const
+{
+ return 0;
+}
+
+QString QAccessibleTable2Cell::actionText(int, Text, int) const
+{
+ return QString();
+}
+
+bool QAccessibleTable2Cell::doAction(int, int, const QVariantList &)
+{
+ return false;
+}
+
+QAccessibleTable2HeaderCell::QAccessibleTable2HeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_)
+ : view(view_), index(index_), orientation(orientation_)
+{
+ Q_ASSERT(index_ >= 0);
+}
+
+QAccessible::Role QAccessibleTable2HeaderCell::role(int child) const
+{
+ Q_ASSERT(child == 0);
+ if (orientation == Qt::Horizontal)
+ return QAccessible::ColumnHeader;
+ return QAccessible::RowHeader;
+}
+
+QAccessible::State QAccessibleTable2HeaderCell::state(int child) const
+{
+ Q_ASSERT(child == 0);
+ return QAccessible::Normal;
+}
+
+QRect QAccessibleTable2HeaderCell::rect(int child) const
+{
+ Q_ASSERT(child == 0);
+
+ QHeaderView *header = 0;
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ if (orientation == Qt::Horizontal) {
+ header = tv->horizontalHeader();
+ } else {
+ header = tv->verticalHeader();
+ }
+#endif
+#ifndef QT_NO_TREEVIEW
+ } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
+ header = tv->header();
+#endif
+ }
+ QPoint zero = header->mapToGlobal(QPoint(0, 0));
+ int sectionSize = header->sectionSize(index);
+ int sectionPos = header->sectionPosition(index);
+ return orientation == Qt::Horizontal
+ ? QRect(zero.x() + sectionPos, zero.y(), sectionSize, header->height())
+ : QRect(zero.x(), zero.y() + sectionPos, header->width(), sectionSize);
+}
+
+QString QAccessibleTable2HeaderCell::text(Text t, int child) const
+{
+ Q_ASSERT(child == 0);
+ QAbstractItemModel *model = view->model();
+ QString value;
+ switch (t) {
+ case QAccessible::Value:
+ case QAccessible::Name:
+ value = model->headerData(index, orientation, Qt::AccessibleTextRole).toString();
+ if (value.isEmpty())
+ value = model->headerData(index, orientation, Qt::DisplayRole).toString();
+ break;
+ case QAccessible::Description:
+ value = model->headerData(index, orientation, Qt::AccessibleDescriptionRole).toString();
+ break;
+ default:
+ break;
+ }
+ return value;
+}
+
+void QAccessibleTable2HeaderCell::setText(Text, int, const QString &)
+{
+ return;
+}
+
+bool QAccessibleTable2HeaderCell::isValid() const
+{
+ return true;
+}
+
+int QAccessibleTable2HeaderCell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ if (relation == QAccessible::Ancestor && index == 1) {
+ if (false) {
+#ifndef QT_NO_TREEVIEW
+ } else if (qobject_cast<const QTreeView*>(view)) {
+ *iface = new QAccessibleTree(view);
+ return 0;
+#endif
+ } else {
+ *iface = new QAccessibleTable2(view);
+ return 0;
+ }
+ }
+ *iface = 0;
+ return -1;
+}
+
+QAccessible::Relation QAccessibleTable2HeaderCell::relationTo(int, const QAccessibleInterface *, int) const
+{
+ return QAccessible::Unrelated;
+}
+
+#ifndef QT_NO_ACTION
+int QAccessibleTable2HeaderCell::userActionCount(int) const
+{
+ return 0;
+}
+
+QString QAccessibleTable2HeaderCell::actionText(int, Text, int) const
+{
+ return QString();
+}
+
+bool QAccessibleTable2HeaderCell::doAction(int, int, const QVariantList &)
+{
+ return false;
+}
+#endif
+
+
+
+#endif
+
+#endif // QT_NO_ITEMVIEWS
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/accessible/widgets/itemviews.h b/src/plugins/accessible/widgets/itemviews.h
new file mode 100644
index 0000000000..2c981ef0e8
--- /dev/null
+++ b/src/plugins/accessible/widgets/itemviews.h
@@ -0,0 +1,319 @@
+/****************************************************************************
+**
+** 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 plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ACCESSIBLE_ITEMVIEWS_H
+#define ACCESSIBLE_ITEMVIEWS_H
+
+#include <QtWidgets/qabstractitemview.h>
+#include <QtWidgets/qheaderview.h>
+#include <QtWidgets/qaccessible.h>
+#include <QtWidgets/qaccessible2.h>
+#include <QtWidgets/qaccessiblewidget.h>
+
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_ACCESSIBILITY
+
+#ifndef QT_NO_ITEMVIEWS
+
+class QAccessibleTable2Cell;
+class QAccessibleTable2HeaderCell;
+
+class QAccessibleTable2: public QAccessibleTable2Interface, public QAccessibleObjectEx
+{
+ Q_ACCESSIBLE_OBJECT
+public:
+ explicit QAccessibleTable2(QWidget *w);
+
+ virtual ~QAccessibleTable2();
+
+ QObject *object() const { return view; }
+ Role role(int child) const;
+ State state(int child) const;
+ QString text(Text t, int child) const;
+ QRect rect(int child) const;
+
+ int childAt(int x, int y) const;
+ int childCount() const;
+ int indexOfChild(const QAccessibleInterface *) const;
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int child) const;
+ QString actionText(int action, Text t, int child) const;
+ bool doAction(int action, int child, const QVariantList &params);
+#endif
+ QVariant invokeMethodEx(Method, int, const QVariantList &) { return QVariant(); }
+
+ // table2 interface
+ virtual QAccessibleTable2CellInterface *cellAt(int row, int column) const;
+ virtual QAccessibleInterface *caption() const;
+ virtual QAccessibleInterface *summary() const;
+ virtual QString columnDescription(int column) const;
+ virtual QString rowDescription(int row) const;
+ virtual int columnCount() const;
+ virtual int rowCount() const;
+ virtual QAccessible2::TableModelChange modelChange() const;
+
+ // selection
+ virtual int selectedCellCount() const;
+ virtual int selectedColumnCount() const;
+ virtual int selectedRowCount() const;
+ virtual QList<QAccessibleTable2CellInterface*> selectedCells() const;
+ virtual QList<int> selectedColumns() const;
+ virtual QList<int> selectedRows() const;
+ virtual bool isColumnSelected(int column) const;
+ virtual bool isRowSelected(int row) const;
+ virtual bool selectRow(int row);
+ virtual bool selectColumn(int column);
+ virtual bool unselectRow(int row);
+ virtual bool unselectColumn(int column);
+
+protected:
+ virtual void modelReset();
+ virtual void rowsInserted(const QModelIndex &parent, int first, int last);
+ virtual void rowsRemoved(const QModelIndex &parent, int first, int last);
+ virtual void columnsInserted(const QModelIndex &parent, int first, int last);
+ virtual void columnsRemoved(const QModelIndex &parent, int first, int last);
+ virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
+ virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column);
+
+protected:
+ QAbstractItemView* view;
+ QAccessible2::TableModelChange lastChange;
+ inline QAccessibleTable2Cell *cell(const QModelIndex &index) const;
+ inline QAccessible::Role cellRole() const {
+ switch (m_role) {
+ case QAccessible::List:
+ return QAccessible::ListItem;
+ case QAccessible::Table:
+ return QAccessible::Cell;
+ case QAccessible::Tree:
+ return QAccessible::TreeItem;
+ default:
+ Q_ASSERT(0);
+ }
+ return QAccessible::NoRole;
+ }
+
+ QHeaderView *horizontalHeader() const;
+ QHeaderView *verticalHeader() const;
+private:
+ // the child index for a model index
+ inline int logicalIndex(const QModelIndex &index) const;
+ // the model index from the child index
+ QAccessibleInterface *childFromLogical(int logicalIndex) const;
+ QAccessible::Role m_role;
+};
+
+class QAccessibleTree :public QAccessibleTable2
+{
+public:
+ explicit QAccessibleTree(QWidget *w)
+ : QAccessibleTable2(w)
+ {}
+
+ virtual ~QAccessibleTree() {}
+
+ int childAt(int x, int y) const;
+ int childCount() const;
+ int indexOfChild(const QAccessibleInterface *) const;
+
+ int rowCount() const;
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+ // table2 interface
+ QAccessibleTable2CellInterface *cellAt(int row, int column) const;
+ QString rowDescription(int row) const;
+ bool isRowSelected(int row) const;
+ bool selectRow(int row);
+
+private:
+ QModelIndex indexFromLogical(int row, int column = 0) const;
+};
+
+class QAccessibleTable2Cell: public QAccessibleTable2CellInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
+{
+public:
+ QAccessibleTable2Cell(QAbstractItemView *view, const QModelIndex &m_index, QAccessible::Role role);
+
+ QObject *object() const { return 0; }
+ Role role(int child) const;
+ State state(int child) const;
+ QRect rect(int child) const;
+ bool isValid() const;
+
+ int childAt(int, int) const { return 0; }
+ int childCount() const { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const { return -1; }
+
+ QString text(Text t, int child) const;
+ void setText(Text t, int child, const QString &text);
+
+ int navigate(RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+ bool isExpandable() const;
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int child) const;
+ QString actionText(int action, Text t, int child) const;
+ bool doAction(int action, int child, const QVariantList &params);
+#endif
+
+ // cell interface
+ virtual int columnExtent() const;
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const;
+ virtual int columnIndex() const;
+ virtual int rowExtent() const;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const;
+ virtual int rowIndex() const;
+ virtual bool isSelected() const;
+ virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const;
+ virtual QAccessibleTable2Interface* table() const;
+
+private:
+ QHeaderView *verticalHeader() const;
+ QHeaderView *horizontalHeader() const;
+ QAbstractItemView *view;
+ QModelIndex m_index;
+ QAccessible::Role m_role;
+
+friend class QAccessibleTable2;
+friend class QAccessibleTree;
+};
+
+
+class QAccessibleTable2HeaderCell: public QAccessibleInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
+{
+public:
+ // For header cells, pass the header view in addition
+ QAccessibleTable2HeaderCell(QAbstractItemView *view, int index, Qt::Orientation orientation);
+
+ QObject *object() const { return 0; }
+ Role role(int child) const;
+ State state(int child) const;
+ QRect rect(int child) const;
+ bool isValid() const;
+
+ int childAt(int, int) const { return 0; }
+ int childCount() const { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const { return -1; }
+
+ QString text(Text t, int child) const;
+ void setText(Text t, int child, const QString &text);
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int child) const;
+ QString actionText(int action, Text t, int child) const;
+ bool doAction(int action, int child, const QVariantList &params);
+#endif
+
+private:
+ QAbstractItemView *view;
+ int index;
+ Qt::Orientation orientation;
+
+friend class QAccessibleTable2;
+friend class QAccessibleTree;
+};
+
+// This is the corner button on the top left of a table.
+// It can be used to select all cells or it is not active at all.
+// For now it is ignored.
+class QAccessibleTable2CornerButton: public QAccessibleInterface
+{
+public:
+ QAccessibleTable2CornerButton(QAbstractItemView *view_)
+ :view(view_)
+ {}
+
+ QObject *object() const { return 0; }
+ Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::Pane; }
+ State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; }
+ QRect rect(int child) const { Q_ASSERT(child == 0); return QRect(); }
+ bool isValid() const { return true; }
+
+ int childAt(int, int) const { return 0; }
+ int childCount() const { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const { return -1; }
+
+ QString text(Text, int) const { return QString(); }
+ void setText(Text, int, const QString &) {}
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+ {
+ if (relation == QAccessible::Ancestor && index == 1) {
+ *iface = QAccessible::queryAccessibleInterface(view);
+ return 0;
+ }
+ return -1;
+ }
+ Relation relationTo(int, const QAccessibleInterface *, int) const
+ {
+ return QAccessible::Unrelated;
+ }
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int) const { return 0; }
+ QString actionText(int, Text, int) const { return QString(); }
+ bool doAction(int, int, const QVariantList &) { return false; }
+#endif
+private:
+ QAbstractItemView *view;
+};
+
+
+#endif
+
+#endif // QT_NO_ACCESSIBILITY
+
+QT_END_NAMESPACE
+
+#endif // ACCESSIBLE_ITEMVIEWS_H
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index aa5459c066..cd17a6e80b 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -44,11 +44,13 @@
#include "simplewidgets.h"
#include "rangecontrols.h"
#include "complexwidgets.h"
+#include "itemviews.h"
#include <qaccessibleplugin.h>
#include <qplugin.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
+#include <qtreeview.h>
#include <qvariant.h>
#include <qaccessible.h>
@@ -56,6 +58,7 @@
QT_BEGIN_NAMESPACE
+
class AccessibleFactory : public QAccessiblePlugin
{
public:
@@ -251,6 +254,22 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
iface = new QAccessibleMenu(widget);
#endif
#ifndef QT_NO_ITEMVIEWS
+#ifdef Q_WS_X11
+ } else if (classname == QLatin1String("QAbstractItemView")) {
+ if (qobject_cast<const QTreeView*>(widget)) {
+ iface = new QAccessibleTree(widget);
+ } else {
+ iface = new QAccessibleTable2(widget);
+ }
+ } else if (classname == QLatin1String("QWidget")
+ && widget->objectName() == QLatin1String("qt_scrollarea_viewport")
+ && qobject_cast<QAbstractItemView*>(widget->parentWidget())) {
+ if (qobject_cast<const QTreeView*>(widget->parentWidget())) {
+ iface = new QAccessibleTree(widget->parentWidget());
+ } else {
+ iface = new QAccessibleTable2(widget->parentWidget());
+ }
+#else
} else if (classname == QLatin1String("QHeaderView")) {
iface = new QAccessibleHeader(widget);
} else if (classname == QLatin1String("QAbstractItemView")) {
@@ -259,7 +278,8 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
&& widget->objectName() == QLatin1String("qt_scrollarea_viewport")
&& qobject_cast<QAbstractItemView*>(widget->parentWidget())) {
iface = new QAccessibleItemView(widget);
-#endif
+#endif // Q_WS_X11
+#endif // QT_NO_ITEMVIEWS
#ifndef QT_NO_TABBAR
} else if (classname == QLatin1String("QTabBar")) {
iface = new QAccessibleTabBar(widget);
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index b14ee88bc8..a8f38b61a3 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -73,6 +73,9 @@ QT_BEGIN_NAMESPACE
using namespace QAccessible2;
+QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
+QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
+
QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
{
if (widget == 0)
@@ -1139,8 +1142,8 @@ int QAccessibleTitleBar::childCount() const
QString QAccessibleTitleBar::text(Text t, int child) const
{
if (!child) {
- if (t == Value) {
- return dockWidget()->windowTitle();
+ if (t == Name || t == Value) {
+ return qt_accStripAmp(dockWidget()->windowTitle());
}
}
return QString();
@@ -1171,17 +1174,19 @@ QAccessible::State QAccessibleTitleBar::state(int child) const
return state;
}
-QRect QAccessibleTitleBar::rect (int child ) const
+QRect QAccessibleTitleBar::rect(int child) const
{
bool mapToGlobal = true;
QRect rect;
if (child == 0) {
if (dockWidget()->isFloating()) {
rect = dockWidget()->frameGeometry();
- QPoint globalPos = dockWidget()->mapToGlobal( dockWidget()->widget()->rect().topLeft() );
- globalPos.ry()--;
- rect.setBottom(globalPos.y());
- mapToGlobal = false;
+ if (dockWidget()->widget()) {
+ QPoint globalPos = dockWidget()->mapToGlobal(dockWidget()->widget()->rect().topLeft());
+ globalPos.ry()--;
+ rect.setBottom(globalPos.y());
+ mapToGlobal = false;
+ }
} else {
QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(dockWidget()->layout());
rect = layout->titleArea();
@@ -1316,11 +1321,112 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset)
QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset)
{
- // TODO - wait for a definition of attributes
- Q_UNUSED(offset);
- Q_UNUSED(startOffset);
- Q_UNUSED(endOffset);
- return QString();
+ /* The list of attributes can be found at:
+ http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes
+ */
+
+ if (offset >= characterCount()) {
+ *startOffset = -1;
+ *endOffset = -1;
+ return QString();
+ }
+
+ QMap<QString, QString> attrs;
+
+ QTextCursor cursor = textEdit()->textCursor();
+
+ //cursor.charFormat returns the format of the previous character
+ cursor.setPosition(offset + 1);
+ QTextCharFormat charFormat = cursor.charFormat();
+
+ cursor.setPosition(offset);
+ QTextBlockFormat blockFormat = cursor.blockFormat();
+
+ QTextCharFormat charFormatComp;
+ QTextBlockFormat blockFormatComp;
+
+ *startOffset = offset;
+ cursor.setPosition(*startOffset);
+ while (*startOffset > 0) {
+ charFormatComp = cursor.charFormat();
+ cursor.setPosition(*startOffset - 1);
+ blockFormatComp = cursor.blockFormat();
+ if ((charFormat == charFormatComp) && (blockFormat == blockFormatComp))
+ (*startOffset)--;
+ else
+ break;
+ }
+
+ int limit = characterCount() + 1;
+ *endOffset = offset + 1;
+ cursor.setPosition(*endOffset);
+ while (*endOffset < limit) {
+ blockFormatComp = cursor.blockFormat();
+ cursor.setPosition(*endOffset + 1);
+ charFormatComp = cursor.charFormat();
+ if ((charFormat == charFormatComp) && (cursor.blockFormat() == blockFormatComp))
+ (*endOffset)++;
+ else
+ break;
+ }
+
+ QString family = charFormat.fontFamily();
+ if (!family.isEmpty()) {
+ family = family.replace('\\',"\\\\");
+ family = family.replace(':',"\\:");
+ family = family.replace(',',"\\,");
+ family = family.replace('=',"\\=");
+ family = family.replace(';',"\\;");
+ family = family.replace('\"',"\\\"");
+ attrs["font-family"] = '"'+family+'"';
+ }
+
+ int fontSize = int(charFormat.fontPointSize());
+ if (fontSize)
+ attrs["font-size"] = QString::number(fontSize).append("pt");
+
+ //Different weight values are not handled
+ attrs["font-weight"] = (charFormat.fontWeight() > QFont::Normal) ? "bold" : "normal";
+
+ QFont::Style style = charFormat.font().style();
+ attrs["font-style"] = (style == QFont::StyleItalic) ? "italic" : ((style == QFont::StyleOblique) ? "oblique": "normal");
+
+ attrs["text-underline-style"] = charFormat.font().underline() ? "solid" : "none";
+
+ QTextCharFormat::VerticalAlignment alignment = charFormat.verticalAlignment();
+ attrs["text-position"] = (alignment == QTextCharFormat::AlignSubScript) ? "sub" : ((alignment == QTextCharFormat::AlignSuperScript) ? "super" : "baseline" );
+
+ QBrush background = charFormat.background();
+ if (background.style() == Qt::SolidPattern) {
+ attrs["background-color"] = QString("rgb(%1,%2,%3)").arg(background.color().red()).arg(background.color().green()).arg(background.color().blue());
+ }
+
+ QBrush foreground = charFormat.foreground();
+ if (foreground.style() == Qt::SolidPattern) {
+ attrs["color"] = QString("rgb(%1,%2,%3)").arg(foreground.color().red()).arg(foreground.color().green()).arg(foreground.color().blue());
+ }
+
+ switch (blockFormat.alignment() & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter | Qt::AlignJustify)) {
+ case Qt::AlignLeft:
+ attrs["text-align"] = "left";
+ break;
+ case Qt::AlignRight:
+ attrs["text-align"] = "right";
+ break;
+ case Qt::AlignHCenter:
+ attrs["text-align"] = "center";
+ break;
+ case Qt::AlignJustify:
+ attrs["text-align"] = "left";
+ break;
+ }
+
+ QString result;
+ foreach (const QString &attributeName, attrs.keys()) {
+ result.append(attributeName).append(':').append(attrs[attributeName]).append(';');
+ }
+
+ return result;
}
int QAccessibleTextEdit::cursorPosition()
@@ -1435,9 +1541,9 @@ QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType,
if (offset >= characterCount())
return QString();
+ cursor.setPosition(offset);
switch (boundaryType) {
case CharBoundary:
- cursor.setPosition(offset);
*startOffset = cursor.position();
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
*endOffset = cursor.position();
diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp
index fb53b10567..8868d53dc7 100644
--- a/src/plugins/accessible/widgets/rangecontrols.cpp
+++ b/src/plugins/accessible/widgets/rangecontrols.cpp
@@ -83,8 +83,6 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const
/*! \reimp */
int QAccessibleAbstractSpinBox::childCount() const
{
- if (!abstractSpinBox()->isVisible())
- return 0;
return ValueDown;
}
@@ -344,8 +342,6 @@ QDoubleSpinBox *QAccessibleDoubleSpinBox::doubleSpinBox() const
/*! \reimp */
int QAccessibleDoubleSpinBox::childCount() const
{
- if (!doubleSpinBox()->isVisible())
- return 0;
return ValueDown;
}
@@ -410,8 +406,6 @@ QVariant QAccessibleDoubleSpinBox::invokeMethodEx(QAccessible::Method, int, cons
/*! \reimp */
QString QAccessibleDoubleSpinBox::text(Text textType, int child) const
{
- if (!doubleSpinBox()->isVisible())
- return QString();
switch (textType) {
case Name:
if (child == ValueUp)
@@ -540,16 +534,12 @@ QRect QAccessibleScrollBar::rect(int child) const
/*! \reimp */
int QAccessibleScrollBar::childCount() const
{
- if (!scrollBar()->isVisible())
- return 0;
return LineDown;
}
/*! \reimp */
QString QAccessibleScrollBar::text(Text t, int child) const
{
- if (!scrollBar()->isVisible())
- return QString();
switch (t) {
case Value:
if (!child || child == Position)
@@ -698,16 +688,12 @@ QRect QAccessibleSlider::rect(int child) const
/*! \reimp */
int QAccessibleSlider::childCount() const
{
- if (!slider()->isVisible())
- return 0;
return PageRight;
}
/*! \reimp */
QString QAccessibleSlider::text(Text t, int child) const
{
- if (!slider()->isVisible())
- return QString();
switch (t) {
case Value:
if (!child || child == 2)
@@ -932,15 +918,11 @@ QRect QAccessibleDial::rect(int child) const
int QAccessibleDial::childCount() const
{
- if (!dial()->isVisible())
- return 0;
return SliderHandle;
}
QString QAccessibleDial::text(Text textType, int child) const
{
- if (!dial()->isVisible())
- return QString();
if (textType == Value && child >= Self && child <= SliderHandle)
return QString::number(dial()->value());
if (textType == Name) {
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index 70a182f2df..36e786ff6b 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -68,6 +68,13 @@ extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
+QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text);
+
/*!
\class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@@ -176,7 +183,7 @@ QString QAccessibleButton::text(Text t, int child) const
break;
}
if (str.isEmpty())
- str = QAccessibleWidgetEx::text(t, child);;
+ str = QAccessibleWidgetEx::text(t, child);
return qt_accStripAmp(str);
}
@@ -396,7 +403,7 @@ QString QAccessibleToolButton::text(Text t, int child) const
QString str;
switch (t) {
case Name:
- str = toolButton()->text();
+ str = toolButton()->accessibleName();
if (str.isEmpty())
str = toolButton()->text();
break;
@@ -703,7 +710,14 @@ void QAccessibleLineEdit::setText(Text t, int control, const QString &text)
QAccessibleWidgetEx::setText(t, control, text);
return;
}
- lineEdit()->setText(text);
+
+ QString newText = text;
+ if (lineEdit()->validator()) {
+ int pos = 0;
+ if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable)
+ return;
+ }
+ lineEdit()->setText(newText);
}
/*! \reimp */
@@ -801,28 +815,41 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset)
{
if (startOffset > endOffset)
return QString();
+
+ if (lineEdit()->echoMode() != QLineEdit::Normal)
+ return QString();
+
return lineEdit()->text().mid(startOffset, endOffset - startOffset);
}
-QString QAccessibleLineEdit::textBeforeOffset (int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
-QString QAccessibleLineEdit::textAfterOffset(int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
-QString QAccessibleLineEdit::textAtOffset(int /*offset*/, BoundaryType /*boundaryType*/,
- int * /*startOffset*/, int * /*endOffset*/)
+QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
+ int *startOffset, int *endOffset)
{
- // TODO
- return QString();
+ if (lineEdit()->echoMode() != QLineEdit::Normal) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
}
void QAccessibleLineEdit::removeSelection(int selectionIndex)
diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro
index 6dd7e5022b..3bf7dede56 100644
--- a/src/plugins/accessible/widgets/widgets.pro
+++ b/src/plugins/accessible/widgets/widgets.pro
@@ -8,14 +8,18 @@ DESTDIR = $$QT.gui.plugins/accessible
QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
SOURCES += main.cpp \
- simplewidgets.cpp \
- rangecontrols.cpp \
- complexwidgets.cpp \
- qaccessiblewidgets.cpp \
- qaccessiblemenu.cpp
+ simplewidgets.cpp \
+ rangecontrols.cpp \
+ complexwidgets.cpp \
+ qaccessiblewidgets.cpp \
+ qaccessiblemenu.cpp \
+ itemviews.cpp
HEADERS += qaccessiblewidgets.h \
- simplewidgets.h \
- rangecontrols.h \
- complexwidgets.h \
- qaccessiblemenu.h
+ simplewidgets.h \
+ rangecontrols.h \
+ complexwidgets.h \
+ qaccessiblemenu.h \
+ itemviews.h
+
+
diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp
index da5da4285a..f90d1a9802 100644
--- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp
+++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp
@@ -42,6 +42,7 @@
#include "qwaylandclipboard.h"
#include "qwaylanddisplay.h"
#include "qwaylandinputdevice.h"
+#include "qwaylandmime.h"
#include <QtGui/QPlatformNativeInterface>
#include <QtGui/QGuiApplication>
#include <QtCore/QMimeData>
@@ -49,10 +50,11 @@
#include <QtCore/QFile>
#include <QtCore/QtDebug>
#include <QtGui/private/qdnd_p.h>
+#include <QtCore/private/qcore_unix_p.h> // for QT_READ
static QWaylandClipboard *clipboard = 0;
-class QWaylandMimeData : public QInternalMimeData
+class QWaylandClipboardMimeData : public QInternalMimeData
{
public:
void clearAll();
@@ -64,28 +66,28 @@ private:
QStringList mFormatList;
};
-void QWaylandMimeData::clearAll()
+void QWaylandClipboardMimeData::clearAll()
{
clear();
mFormatList.clear();
}
-void QWaylandMimeData::setFormats(const QStringList &formatList)
+void QWaylandClipboardMimeData::setFormats(const QStringList &formatList)
{
mFormatList = formatList;
}
-bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const
+bool QWaylandClipboardMimeData::hasFormat_sys(const QString &mimeType) const
{
return formats().contains(mimeType);
}
-QStringList QWaylandMimeData::formats_sys() const
+QStringList QWaylandClipboardMimeData::formats_sys() const
{
return mFormatList;
}
-QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
+QVariant QWaylandClipboardMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
{
return clipboard->retrieveData(mimeType, type);
}
@@ -147,7 +149,7 @@ void QWaylandSelection::send(void *data,
Q_UNUSED(selection);
QWaylandSelection *self = static_cast<QWaylandSelection *>(data);
QString mimeType = QString::fromLatin1(mime_type);
- QByteArray content = self->mMimeData->data(mimeType);
+ QByteArray content = QWaylandMimeHelper::getByteArray(self->mMimeData, mimeType);
if (!content.isEmpty()) {
QFile f;
if (f.open(fd, QIODevice::WriteOnly))
@@ -218,7 +220,7 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type
char buf[256];
int n;
close(pipefd[1]);
- while ((n = read(pipefd[0], &buf, sizeof buf)) > 0)
+ while ((n = QT_READ(pipefd[0], &buf, sizeof buf)) > 0)
content.append(buf, n);
close(pipefd[0]);
return content;
@@ -230,7 +232,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
if (!mSelections.isEmpty())
return mSelections.last()->mMimeData;
if (!mMimeDataIn)
- mMimeDataIn = new QWaylandMimeData;
+ mMimeDataIn = new QWaylandClipboardMimeData;
mMimeDataIn->clearAll();
if (!mOfferedMimeTypes.isEmpty() && mOffer)
mMimeDataIn->setFormats(mOfferedMimeTypes);
diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.h b/src/plugins/platforms/wayland/qwaylandclipboard.h
index 87294342d7..6b113ae5b0 100644
--- a/src/plugins/platforms/wayland/qwaylandclipboard.h
+++ b/src/plugins/platforms/wayland/qwaylandclipboard.h
@@ -48,7 +48,7 @@
class QWaylandDisplay;
class QWaylandSelection;
-class QWaylandMimeData;
+class QWaylandClipboardMimeData;
struct wl_selection_offer;
class QWaylandClipboardSignalEmitter : public QObject
@@ -90,7 +90,7 @@ private:
static void forceRoundtrip(struct wl_display *display);
QWaylandDisplay *mDisplay;
- QWaylandMimeData *mMimeDataIn;
+ QWaylandClipboardMimeData *mMimeDataIn;
QList<QWaylandSelection *> mSelections;
QStringList mOfferedMimeTypes;
struct wl_selection_offer *mOffer;
diff --git a/src/plugins/platforms/wayland/qwaylandmime.cpp b/src/plugins/platforms/wayland/qwaylandmime.cpp
new file mode 100644
index 0000000000..c218d7ddb8
--- /dev/null
+++ b/src/plugins/platforms/wayland/qwaylandmime.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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 plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandmime.h"
+#include <QImage>
+#include <QColor>
+#include <QUrl>
+#include <QBuffer>
+#include <QImageWriter>
+
+QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &mimeType)
+{
+ QByteArray content;
+ if (mimeType == QLatin1String("text/plain")) {
+ content = mimeData->text().toUtf8();
+ } else if (mimeData->hasImage()
+ && (mimeType == QLatin1String("application/x-qt-image")
+ || mimeType.startsWith("image/"))) {
+ QImage image = qvariant_cast<QImage>(mimeData->imageData());
+ if (!image.isNull()) {
+ QBuffer buf;
+ buf.open(QIODevice::ReadWrite);
+ QByteArray fmt = "BMP";
+ if (mimeType.startsWith("image/")) {
+ QByteArray imgFmt = mimeType.mid(6).toUpper().toAscii();
+ if (QImageWriter::supportedImageFormats().contains(imgFmt))
+ fmt = imgFmt;
+ }
+ QImageWriter wr(&buf, fmt);
+ wr.write(image);
+ content = buf.buffer();
+ }
+ } else if (mimeType == QLatin1String("application/x-color")) {
+ content = qvariant_cast<QColor>(mimeData->colorData()).name().toAscii();
+ } else if (mimeType == QLatin1String("text/uri-list")) {
+ QList<QUrl> urls = mimeData->urls();
+ for (int i = 0; i < urls.count(); ++i) {
+ content.append(urls.at(i).toEncoded());
+ content.append('\n');
+ }
+ } else {
+ content = mimeData->data(mimeType);
+ }
+ return content;
+}
diff --git a/src/plugins/platforms/wayland/qwaylandmime.h b/src/plugins/platforms/wayland/qwaylandmime.h
new file mode 100644
index 0000000000..5f6ed954a1
--- /dev/null
+++ b/src/plugins/platforms/wayland/qwaylandmime.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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 plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDMIME_H
+#define QWAYLANDMIME_H
+
+#include <QString>
+#include <QByteArray>
+#include <QMimeData>
+
+class QWaylandMimeHelper
+{
+public:
+ static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType);
+};
+
+#endif
diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro
index a46f508417..fd6ffc06de 100644
--- a/src/plugins/platforms/wayland/wayland.pro
+++ b/src/plugins/platforms/wayland/wayland.pro
@@ -25,7 +25,8 @@ SOURCES = main.cpp \
qwaylandscreen.cpp \
qwaylandshmwindow.cpp \
qwaylandclipboard.cpp \
- qwaylanddnd.cpp
+ qwaylanddnd.cpp \
+ qwaylandmime.cpp
HEADERS = qwaylandintegration.h \
qwaylandnativeinterface.h \
@@ -37,7 +38,8 @@ HEADERS = qwaylandintegration.h \
qwaylandbuffer.h \
qwaylandshmwindow.h \
qwaylandclipboard.h \
- qwaylanddnd.h
+ qwaylanddnd.h \
+ qwaylandmime.h
INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
LIBS += $$QMAKE_LIBS_WAYLAND
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index f136b8167f..7b7b23ce0c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -53,7 +53,17 @@
#include "qdri2context.h"
#endif
+#define class class_name // Yeah, in 2011 ...
#include <xcb/xcb_icccm.h>
+#undef class
+
+// xcb-icccm 3.8 support
+#ifdef XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS
+#define xcb_wm_hints_t xcb_icccm_wm_hints_t
+#define xcb_wm_hints_set_iconic xcb_icccm_wm_hints_set_iconic
+#define xcb_wm_hints_set_normal xcb_icccm_wm_hints_set_normal
+#define xcb_set_wm_hints xcb_icccm_set_wm_hints
+#endif
#include <private/qguiapplication_p.h>
#include <private/qwindow_p.h>
diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp
index a8ffdffa8a..fd731e4974 100644
--- a/src/sql/kernel/qsqlerror.cpp
+++ b/src/sql/kernel/qsqlerror.cpp
@@ -124,6 +124,26 @@ QSqlError& QSqlError::operator=(const QSqlError& other)
}
/*!
+ Compare the \a other error's values to this error and returns true, if it equal.
+*/
+
+bool QSqlError::operator==(const QSqlError& other)
+{
+ return (errorType == other.errorType);
+}
+
+
+/*!
+ Compare the \a other error's values to this error and returns true if it is not equal.
+*/
+
+bool QSqlError::operator!=(const QSqlError& other)
+{
+ return (errorType != other.errorType);
+}
+
+
+/*!
Destroys the object and frees any allocated resources.
*/
diff --git a/src/sql/kernel/qsqlerror.h b/src/sql/kernel/qsqlerror.h
index fea3ca8526..c1df370a86 100644
--- a/src/sql/kernel/qsqlerror.h
+++ b/src/sql/kernel/qsqlerror.h
@@ -66,6 +66,8 @@ public:
int number = -1);
QSqlError(const QSqlError& other);
QSqlError& operator=(const QSqlError& other);
+ bool operator==(const QSqlError& other);
+ bool operator!=(const QSqlError& other);
~QSqlError();
QString driverText() const;
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 023df89d98..27a897c263 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1076,9 +1076,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" -minimumvalue n : Sets the minimum acceptable measurement value\n"
" -iterations n : Sets the number of accumulation iterations.\n"
" -median n : Sets the number of median iterations.\n"
- " -vb : Print out verbose benchmarking information.\n"
- "\n"
- " -help : This help\n";
+ " -vb : Print out verbose benchmarking information.\n";
for (int i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0
@@ -1086,6 +1084,17 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
printf(" Usage: %s [options] [testfunction[:testdata]]...\n"
" By default, all testfunctions will be run.\n\n"
"%s", argv[0], testOptions);
+
+ if (qml) {
+ printf ("\nqmltest related options:\n"
+ " -import : Specify an import directory.\n"
+ " -input : Specify the root directory for test cases.\n"
+ " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
+ );
+ }
+
+ printf("\n"
+ " -help : This help\n");
exit(0);
} else if (strcmp(argv[i], "-functions") == 0) {
if (qml) {
@@ -1228,6 +1237,16 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
}
} else if (argv[i][0] == '-') {
printf("Unknown option: '%s'\n\n%s", argv[i], testOptions);
+ if (qml) {
+ printf ("\nqmltest related options:\n"
+ " -import : Specify an import directory.\n"
+ " -input : Specify the root directory for test cases.\n"
+ " -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
+ );
+ }
+
+ printf("\n"
+ " -help : This help\n");
exit(1);
} else if (qml) {
// We can't check the availability of test functions until
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 6805bb7b6a..de20abeeee 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -76,12 +76,9 @@ namespace QTest
#if defined(Q_WS_X11)
qt_x11_wait_for_window_manager(window);
QCoreApplication::processEvents();
-#elif defined(Q_WS_QWS)
- Q_UNUSED(window);
- qWait(100);
#else
Q_UNUSED(window);
- qWait(50);
+ qWait(200);
#endif
return true;
}
diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp
index cd1cd1d6a6..5374fe9202 100644
--- a/src/tools/uic/ui4.cpp
+++ b/src/tools/uic/ui4.cpp
@@ -40,9 +40,6 @@
****************************************************************************/
#include "ui4.h"
-#ifdef QUILOADER_QDOM_READ
-#include <QtXml/QDomElement>
-#endif
QT_BEGIN_NAMESPACE
#ifdef QFORMINTERNAL_NAMESPACE
@@ -139,126 +136,126 @@ void DomUI::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("version")) {
+ if (name == QStringLiteral("version")) {
setAttributeVersion(attribute.value().toString());
continue;
}
- if (name == QLatin1String("language")) {
+ if (name == QStringLiteral("language")) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- if (name == QLatin1String("displayname")) {
+ if (name == QStringLiteral("displayname")) {
setAttributeDisplayname(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stdsetdef")) {
+ if (name == QStringLiteral("stdsetdef")) {
setAttributeStdsetdef(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("stdSetDef")) {
+ if (name == QStringLiteral("stdSetDef")) {
setAttributeStdSetDef(attribute.value().toString().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("author")) {
+ if (tag == QStringLiteral("author")) {
setElementAuthor(reader.readElementText());
continue;
}
- if (tag == QLatin1String("comment")) {
+ if (tag == QStringLiteral("comment")) {
setElementComment(reader.readElementText());
continue;
}
- if (tag == QLatin1String("exportmacro")) {
+ if (tag == QStringLiteral("exportmacro")) {
setElementExportMacro(reader.readElementText());
continue;
}
- if (tag == QLatin1String("class")) {
+ if (tag == QStringLiteral("class")) {
setElementClass(reader.readElementText());
continue;
}
- if (tag == QLatin1String("widget")) {
+ if (tag == QStringLiteral("widget")) {
DomWidget *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
- if (tag == QLatin1String("layoutdefault")) {
+ if (tag == QStringLiteral("layoutdefault")) {
DomLayoutDefault *v = new DomLayoutDefault();
v->read(reader);
setElementLayoutDefault(v);
continue;
}
- if (tag == QLatin1String("layoutfunction")) {
+ if (tag == QStringLiteral("layoutfunction")) {
DomLayoutFunction *v = new DomLayoutFunction();
v->read(reader);
setElementLayoutFunction(v);
continue;
}
- if (tag == QLatin1String("pixmapfunction")) {
+ if (tag == QStringLiteral("pixmapfunction")) {
setElementPixmapFunction(reader.readElementText());
continue;
}
- if (tag == QLatin1String("customwidgets")) {
+ if (tag == QStringLiteral("customwidgets")) {
DomCustomWidgets *v = new DomCustomWidgets();
v->read(reader);
setElementCustomWidgets(v);
continue;
}
- if (tag == QLatin1String("tabstops")) {
+ if (tag == QStringLiteral("tabstops")) {
DomTabStops *v = new DomTabStops();
v->read(reader);
setElementTabStops(v);
continue;
}
- if (tag == QLatin1String("images")) {
+ if (tag == QStringLiteral("images")) {
DomImages *v = new DomImages();
v->read(reader);
setElementImages(v);
continue;
}
- if (tag == QLatin1String("includes")) {
+ if (tag == QStringLiteral("includes")) {
DomIncludes *v = new DomIncludes();
v->read(reader);
setElementIncludes(v);
continue;
}
- if (tag == QLatin1String("resources")) {
+ if (tag == QStringLiteral("resources")) {
DomResources *v = new DomResources();
v->read(reader);
setElementResources(v);
continue;
}
- if (tag == QLatin1String("connections")) {
+ if (tag == QStringLiteral("connections")) {
DomConnections *v = new DomConnections();
v->read(reader);
setElementConnections(v);
continue;
}
- if (tag == QLatin1String("designerdata")) {
+ if (tag == QStringLiteral("designerdata")) {
DomDesignerData *v = new DomDesignerData();
v->read(reader);
setElementDesignerdata(v);
continue;
}
- if (tag == QLatin1String("slots")) {
+ if (tag == QStringLiteral("slots")) {
DomSlots *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
- if (tag == QLatin1String("buttongroups")) {
+ if (tag == QStringLiteral("buttongroups")) {
DomButtonGroups *v = new DomButtonGroups();
v->read(reader);
setElementButtonGroups(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -274,211 +271,91 @@ void DomUI::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomUI::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("version")))
- setAttributeVersion(node.attribute(QLatin1String("version")));
- if (node.hasAttribute(QLatin1String("language")))
- setAttributeLanguage(node.attribute(QLatin1String("language")));
- if (node.hasAttribute(QLatin1String("displayname")))
- setAttributeDisplayname(node.attribute(QLatin1String("displayname")));
- if (node.hasAttribute(QLatin1String("stdsetdef")))
- setAttributeStdsetdef(node.attribute(QLatin1String("stdsetdef")).toInt());
- if (node.hasAttribute(QLatin1String("stdSetDef")))
- setAttributeStdSetDef(node.attribute(QLatin1String("stdSetDef")).toInt());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("author")) {
- setElementAuthor(e.text());
- continue;
- }
- if (tag == QLatin1String("comment")) {
- setElementComment(e.text());
- continue;
- }
- if (tag == QLatin1String("exportmacro")) {
- setElementExportMacro(e.text());
- continue;
- }
- if (tag == QLatin1String("class")) {
- setElementClass(e.text());
- continue;
- }
- if (tag == QLatin1String("widget")) {
- DomWidget *v = new DomWidget();
- v->read(e);
- setElementWidget(v);
- continue;
- }
- if (tag == QLatin1String("layoutdefault")) {
- DomLayoutDefault *v = new DomLayoutDefault();
- v->read(e);
- setElementLayoutDefault(v);
- continue;
- }
- if (tag == QLatin1String("layoutfunction")) {
- DomLayoutFunction *v = new DomLayoutFunction();
- v->read(e);
- setElementLayoutFunction(v);
- continue;
- }
- if (tag == QLatin1String("pixmapfunction")) {
- setElementPixmapFunction(e.text());
- continue;
- }
- if (tag == QLatin1String("customwidgets")) {
- DomCustomWidgets *v = new DomCustomWidgets();
- v->read(e);
- setElementCustomWidgets(v);
- continue;
- }
- if (tag == QLatin1String("tabstops")) {
- DomTabStops *v = new DomTabStops();
- v->read(e);
- setElementTabStops(v);
- continue;
- }
- if (tag == QLatin1String("images")) {
- DomImages *v = new DomImages();
- v->read(e);
- setElementImages(v);
- continue;
- }
- if (tag == QLatin1String("includes")) {
- DomIncludes *v = new DomIncludes();
- v->read(e);
- setElementIncludes(v);
- continue;
- }
- if (tag == QLatin1String("resources")) {
- DomResources *v = new DomResources();
- v->read(e);
- setElementResources(v);
- continue;
- }
- if (tag == QLatin1String("connections")) {
- DomConnections *v = new DomConnections();
- v->read(e);
- setElementConnections(v);
- continue;
- }
- if (tag == QLatin1String("designerdata")) {
- DomDesignerData *v = new DomDesignerData();
- v->read(e);
- setElementDesignerdata(v);
- continue;
- }
- if (tag == QLatin1String("slots")) {
- DomSlots *v = new DomSlots();
- v->read(e);
- setElementSlots(v);
- continue;
- }
- if (tag == QLatin1String("buttongroups")) {
- DomButtonGroups *v = new DomButtonGroups();
- v->read(e);
- setElementButtonGroups(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("ui") : tagName.toLower());
if (hasAttributeVersion())
- writer.writeAttribute(QLatin1String("version"), attributeVersion());
+ writer.writeAttribute(QStringLiteral("version"), attributeVersion());
if (hasAttributeLanguage())
- writer.writeAttribute(QLatin1String("language"), attributeLanguage());
+ writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
if (hasAttributeDisplayname())
- writer.writeAttribute(QLatin1String("displayname"), attributeDisplayname());
+ writer.writeAttribute(QStringLiteral("displayname"), attributeDisplayname());
if (hasAttributeStdsetdef())
- writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdsetdef()));
+ writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef()));
if (hasAttributeStdSetDef())
- writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdSetDef()));
+ writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdSetDef()));
if (m_children & Author) {
- writer.writeTextElement(QLatin1String("author"), m_author);
+ writer.writeTextElement(QStringLiteral("author"), m_author);
}
if (m_children & Comment) {
- writer.writeTextElement(QLatin1String("comment"), m_comment);
+ writer.writeTextElement(QStringLiteral("comment"), m_comment);
}
if (m_children & ExportMacro) {
- writer.writeTextElement(QLatin1String("exportmacro"), m_exportMacro);
+ writer.writeTextElement(QStringLiteral("exportmacro"), m_exportMacro);
}
if (m_children & Class) {
- writer.writeTextElement(QLatin1String("class"), m_class);
+ writer.writeTextElement(QStringLiteral("class"), m_class);
}
if (m_children & Widget) {
- m_widget->write(writer, QLatin1String("widget"));
+ m_widget->write(writer, QStringLiteral("widget"));
}
if (m_children & LayoutDefault) {
- m_layoutDefault->write(writer, QLatin1String("layoutdefault"));
+ m_layoutDefault->write(writer, QStringLiteral("layoutdefault"));
}
if (m_children & LayoutFunction) {
- m_layoutFunction->write(writer, QLatin1String("layoutfunction"));
+ m_layoutFunction->write(writer, QStringLiteral("layoutfunction"));
}
if (m_children & PixmapFunction) {
- writer.writeTextElement(QLatin1String("pixmapfunction"), m_pixmapFunction);
+ writer.writeTextElement(QStringLiteral("pixmapfunction"), m_pixmapFunction);
}
if (m_children & CustomWidgets) {
- m_customWidgets->write(writer, QLatin1String("customwidgets"));
+ m_customWidgets->write(writer, QStringLiteral("customwidgets"));
}
if (m_children & TabStops) {
- m_tabStops->write(writer, QLatin1String("tabstops"));
+ m_tabStops->write(writer, QStringLiteral("tabstops"));
}
if (m_children & Images) {
- m_images->write(writer, QLatin1String("images"));
+ m_images->write(writer, QStringLiteral("images"));
}
if (m_children & Includes) {
- m_includes->write(writer, QLatin1String("includes"));
+ m_includes->write(writer, QStringLiteral("includes"));
}
if (m_children & Resources) {
- m_resources->write(writer, QLatin1String("resources"));
+ m_resources->write(writer, QStringLiteral("resources"));
}
if (m_children & Connections) {
- m_connections->write(writer, QLatin1String("connections"));
+ m_connections->write(writer, QStringLiteral("connections"));
}
if (m_children & Designerdata) {
- m_designerdata->write(writer, QLatin1String("designerdata"));
+ m_designerdata->write(writer, QStringLiteral("designerdata"));
}
if (m_children & Slots) {
- m_slots->write(writer, QLatin1String("slots"));
+ m_slots->write(writer, QStringLiteral("slots"));
}
if (m_children & ButtonGroups) {
- m_buttonGroups->write(writer, QLatin1String("buttongroups"));
+ m_buttonGroups->write(writer, QStringLiteral("buttongroups"));
}
if (!m_text.isEmpty())
@@ -836,13 +713,13 @@ void DomIncludes::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("include")) {
+ if (tag == QStringLiteral("include")) {
DomInclude *v = new DomInclude();
v->read(reader);
m_include.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -858,36 +735,13 @@ void DomIncludes::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomIncludes::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("include")) {
- DomInclude *v = new DomInclude();
- v->read(e);
- m_include.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("includes") : tagName.toLower());
for (int i = 0; i < m_include.size(); ++i) {
DomInclude* v = m_include[i];
- v->write(writer, QLatin1String("include"));
+ v->write(writer, QStringLiteral("include"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -905,7 +759,7 @@ void DomInclude::clear(bool clear_all)
{
if (clear_all) {
- m_text = QLatin1String("");
+ m_text.clear();
m_has_attr_location = false;
m_has_attr_impldecl = false;
}
@@ -918,7 +772,7 @@ DomInclude::DomInclude()
m_children = 0;
m_has_attr_location = false;
m_has_attr_impldecl = false;
- m_text = QLatin1String("");
+ m_text.clear();
}
DomInclude::~DomInclude()
@@ -930,22 +784,22 @@ void DomInclude::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == QStringLiteral("location")) {
setAttributeLocation(attribute.value().toString());
continue;
}
- if (name == QLatin1String("impldecl")) {
+ if (name == QStringLiteral("impldecl")) {
setAttributeImpldecl(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -961,37 +815,15 @@ void DomInclude::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomInclude::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("location")))
- setAttributeLocation(node.attribute(QLatin1String("location")));
- if (node.hasAttribute(QLatin1String("impldecl")))
- setAttributeImpldecl(node.attribute(QLatin1String("impldecl")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text = QLatin1String("");
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("include") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QLatin1String("location"), attributeLocation());
+ writer.writeAttribute(QStringLiteral("location"), attributeLocation());
if (hasAttributeImpldecl())
- writer.writeAttribute(QLatin1String("impldecl"), attributeImpldecl());
+ writer.writeAttribute(QStringLiteral("impldecl"), attributeImpldecl());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1029,24 +861,24 @@ void DomResources::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("include")) {
+ if (tag == QStringLiteral("include")) {
DomResource *v = new DomResource();
v->read(reader);
m_include.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1062,42 +894,16 @@ void DomResources::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomResources::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("include")) {
- DomResource *v = new DomResource();
- v->read(e);
- m_include.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resources") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
for (int i = 0; i < m_include.size(); ++i) {
DomResource* v = m_include[i];
- v->write(writer, QLatin1String("include"));
+ v->write(writer, QStringLiteral("include"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1137,18 +943,18 @@ void DomResource::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == QStringLiteral("location")) {
setAttributeLocation(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1164,32 +970,12 @@ void DomResource::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomResource::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("location")))
- setAttributeLocation(node.attribute(QLatin1String("location")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resource") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QLatin1String("location"), attributeLocation());
+ writer.writeAttribute(QStringLiteral("location"), attributeLocation());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1239,42 +1025,42 @@ void DomActionGroup::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("action")) {
+ if (tag == QStringLiteral("action")) {
DomAction *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
- if (tag == QLatin1String("actiongroup")) {
+ if (tag == QStringLiteral("actiongroup")) {
DomActionGroup *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (tag == QLatin1String("attribute")) {
+ if (tag == QStringLiteral("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1290,72 +1076,28 @@ void DomActionGroup::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomActionGroup::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("action")) {
- DomAction *v = new DomAction();
- v->read(e);
- m_action.append(v);
- continue;
- }
- if (tag == QLatin1String("actiongroup")) {
- DomActionGroup *v = new DomActionGroup();
- v->read(e);
- m_actionGroup.append(v);
- continue;
- }
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- if (tag == QLatin1String("attribute")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_attribute.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actiongroup") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
for (int i = 0; i < m_action.size(); ++i) {
DomAction* v = m_action[i];
- v->write(writer, QLatin1String("action"));
+ v->write(writer, QStringLiteral("action"));
}
for (int i = 0; i < m_actionGroup.size(); ++i) {
DomActionGroup* v = m_actionGroup[i];
- v->write(writer, QLatin1String("actiongroup"));
+ v->write(writer, QStringLiteral("actiongroup"));
}
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
- v->write(writer, QLatin1String("attribute"));
+ v->write(writer, QStringLiteral("attribute"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1423,34 +1165,34 @@ void DomAction::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("menu")) {
+ if (name == QStringLiteral("menu")) {
setAttributeMenu(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (tag == QLatin1String("attribute")) {
+ if (tag == QStringLiteral("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1466,57 +1208,23 @@ void DomAction::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomAction::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
- if (node.hasAttribute(QLatin1String("menu")))
- setAttributeMenu(node.attribute(QLatin1String("menu")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- if (tag == QLatin1String("attribute")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_attribute.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("action") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (hasAttributeMenu())
- writer.writeAttribute(QLatin1String("menu"), attributeMenu());
+ writer.writeAttribute(QStringLiteral("menu"), attributeMenu());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
- v->write(writer, QLatin1String("attribute"));
+ v->write(writer, QStringLiteral("attribute"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1562,18 +1270,18 @@ void DomActionRef::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1589,32 +1297,12 @@ void DomActionRef::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomActionRef::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actionref") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1656,30 +1344,30 @@ void DomButtonGroup::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (tag == QLatin1String("attribute")) {
+ if (tag == QStringLiteral("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1695,52 +1383,20 @@ void DomButtonGroup::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomButtonGroup::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- if (tag == QLatin1String("attribute")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_attribute.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroup") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
- v->write(writer, QLatin1String("attribute"));
+ v->write(writer, QStringLiteral("attribute"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1790,13 +1446,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("buttongroup")) {
+ if (tag == QStringLiteral("buttongroup")) {
DomButtonGroup *v = new DomButtonGroup();
v->read(reader);
m_buttonGroup.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1812,36 +1468,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomButtonGroups::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("buttongroup")) {
- DomButtonGroup *v = new DomButtonGroup();
- v->read(e);
- m_buttonGroup.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroups") : tagName.toLower());
for (int i = 0; i < m_buttonGroup.size(); ++i) {
DomButtonGroup* v = m_buttonGroup[i];
- v->write(writer, QLatin1String("buttongroup"));
+ v->write(writer, QStringLiteral("buttongroup"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1885,13 +1518,13 @@ void DomImages::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("image")) {
+ if (tag == QStringLiteral("image")) {
DomImage *v = new DomImage();
v->read(reader);
m_image.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1907,36 +1540,13 @@ void DomImages::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomImages::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("image")) {
- DomImage *v = new DomImage();
- v->read(e);
- m_image.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("images") : tagName.toLower());
for (int i = 0; i < m_image.size(); ++i) {
DomImage* v = m_image[i];
- v->write(writer, QLatin1String("image"));
+ v->write(writer, QStringLiteral("image"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1980,24 +1590,24 @@ void DomImage::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("data")) {
+ if (tag == QStringLiteral("data")) {
DomImageData *v = new DomImageData();
v->read(reader);
setElementData(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2013,41 +1623,15 @@ void DomImage::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomImage::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("data")) {
- DomImageData *v = new DomImageData();
- v->read(e);
- setElementData(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("image") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (m_children & Data) {
- m_data->write(writer, QLatin1String("data"));
+ m_data->write(writer, QStringLiteral("data"));
}
if (!m_text.isEmpty())
@@ -2082,7 +1666,7 @@ void DomImageData::clear(bool clear_all)
{
if (clear_all) {
- m_text = QLatin1String("");
+ m_text.clear();
m_has_attr_format = false;
m_has_attr_length = false;
m_attr_length = 0;
@@ -2097,7 +1681,7 @@ DomImageData::DomImageData()
m_has_attr_format = false;
m_has_attr_length = false;
m_attr_length = 0;
- m_text = QLatin1String("");
+ m_text.clear();
}
DomImageData::~DomImageData()
@@ -2109,22 +1693,22 @@ void DomImageData::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("format")) {
+ if (name == QStringLiteral("format")) {
setAttributeFormat(attribute.value().toString());
continue;
}
- if (name == QLatin1String("length")) {
+ if (name == QStringLiteral("length")) {
setAttributeLength(attribute.value().toString().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2140,37 +1724,15 @@ void DomImageData::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomImageData::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("format")))
- setAttributeFormat(node.attribute(QLatin1String("format")));
- if (node.hasAttribute(QLatin1String("length")))
- setAttributeLength(node.attribute(QLatin1String("length")).toInt());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text = QLatin1String("");
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("imagedata") : tagName.toLower());
if (hasAttributeFormat())
- writer.writeAttribute(QLatin1String("format"), attributeFormat());
+ writer.writeAttribute(QStringLiteral("format"), attributeFormat());
if (hasAttributeLength())
- writer.writeAttribute(QLatin1String("length"), QString::number(attributeLength()));
+ writer.writeAttribute(QStringLiteral("length"), QString::number(attributeLength()));
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -2208,13 +1770,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("customwidget")) {
+ if (tag == QStringLiteral("customwidget")) {
DomCustomWidget *v = new DomCustomWidget();
v->read(reader);
m_customWidget.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2230,36 +1792,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomCustomWidgets::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("customwidget")) {
- DomCustomWidget *v = new DomCustomWidget();
- v->read(e);
- m_customWidget.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidgets") : tagName.toLower());
for (int i = 0; i < m_customWidget.size(); ++i) {
DomCustomWidget* v = m_customWidget[i];
- v->write(writer, QLatin1String("customwidget"));
+ v->write(writer, QStringLiteral("customwidget"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -2277,7 +1816,7 @@ void DomHeader::clear(bool clear_all)
{
if (clear_all) {
- m_text = QLatin1String("");
+ m_text.clear();
m_has_attr_location = false;
}
@@ -2288,7 +1827,7 @@ DomHeader::DomHeader()
{
m_children = 0;
m_has_attr_location = false;
- m_text = QLatin1String("");
+ m_text.clear();
}
DomHeader::~DomHeader()
@@ -2300,18 +1839,18 @@ void DomHeader::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == QStringLiteral("location")) {
setAttributeLocation(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2327,32 +1866,12 @@ void DomHeader::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomHeader::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("location")))
- setAttributeLocation(node.attribute(QLatin1String("location")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text = QLatin1String("");
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("header") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QLatin1String("location"), attributeLocation());
+ writer.writeAttribute(QStringLiteral("location"), attributeLocation());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -2416,69 +1935,69 @@ void DomCustomWidget::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("class")) {
+ if (tag == QStringLiteral("class")) {
setElementClass(reader.readElementText());
continue;
}
- if (tag == QLatin1String("extends")) {
+ if (tag == QStringLiteral("extends")) {
setElementExtends(reader.readElementText());
continue;
}
- if (tag == QLatin1String("header")) {
+ if (tag == QStringLiteral("header")) {
DomHeader *v = new DomHeader();
v->read(reader);
setElementHeader(v);
continue;
}
- if (tag == QLatin1String("sizehint")) {
+ if (tag == QStringLiteral("sizehint")) {
DomSize *v = new DomSize();
v->read(reader);
setElementSizeHint(v);
continue;
}
- if (tag == QLatin1String("addpagemethod")) {
+ if (tag == QStringLiteral("addpagemethod")) {
setElementAddPageMethod(reader.readElementText());
continue;
}
- if (tag == QLatin1String("container")) {
+ if (tag == QStringLiteral("container")) {
setElementContainer(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("sizepolicy")) {
+ if (tag == QStringLiteral("sizepolicy")) {
DomSizePolicyData *v = new DomSizePolicyData();
v->read(reader);
setElementSizePolicy(v);
continue;
}
- if (tag == QLatin1String("pixmap")) {
+ if (tag == QStringLiteral("pixmap")) {
setElementPixmap(reader.readElementText());
continue;
}
- if (tag == QLatin1String("script")) {
+ if (tag == QStringLiteral("script")) {
DomScript *v = new DomScript();
v->read(reader);
setElementScript(v);
continue;
}
- if (tag == QLatin1String("properties")) {
+ if (tag == QStringLiteral("properties")) {
DomProperties *v = new DomProperties();
v->read(reader);
setElementProperties(v);
continue;
}
- if (tag == QLatin1String("slots")) {
+ if (tag == QStringLiteral("slots")) {
DomSlots *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
- if (tag == QLatin1String("propertyspecifications")) {
+ if (tag == QStringLiteral("propertyspecifications")) {
DomPropertySpecifications *v = new DomPropertySpecifications();
v->read(reader);
setElementPropertyspecifications(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2494,135 +2013,56 @@ void DomCustomWidget::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomCustomWidget::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("class")) {
- setElementClass(e.text());
- continue;
- }
- if (tag == QLatin1String("extends")) {
- setElementExtends(e.text());
- continue;
- }
- if (tag == QLatin1String("header")) {
- DomHeader *v = new DomHeader();
- v->read(e);
- setElementHeader(v);
- continue;
- }
- if (tag == QLatin1String("sizehint")) {
- DomSize *v = new DomSize();
- v->read(e);
- setElementSizeHint(v);
- continue;
- }
- if (tag == QLatin1String("addpagemethod")) {
- setElementAddPageMethod(e.text());
- continue;
- }
- if (tag == QLatin1String("container")) {
- setElementContainer(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("sizepolicy")) {
- DomSizePolicyData *v = new DomSizePolicyData();
- v->read(e);
- setElementSizePolicy(v);
- continue;
- }
- if (tag == QLatin1String("pixmap")) {
- setElementPixmap(e.text());
- continue;
- }
- if (tag == QLatin1String("script")) {
- DomScript *v = new DomScript();
- v->read(e);
- setElementScript(v);
- continue;
- }
- if (tag == QLatin1String("properties")) {
- DomProperties *v = new DomProperties();
- v->read(e);
- setElementProperties(v);
- continue;
- }
- if (tag == QLatin1String("slots")) {
- DomSlots *v = new DomSlots();
- v->read(e);
- setElementSlots(v);
- continue;
- }
- if (tag == QLatin1String("propertyspecifications")) {
- DomPropertySpecifications *v = new DomPropertySpecifications();
- v->read(e);
- setElementPropertyspecifications(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidget") : tagName.toLower());
if (m_children & Class) {
- writer.writeTextElement(QLatin1String("class"), m_class);
+ writer.writeTextElement(QStringLiteral("class"), m_class);
}
if (m_children & Extends) {
- writer.writeTextElement(QLatin1String("extends"), m_extends);
+ writer.writeTextElement(QStringLiteral("extends"), m_extends);
}
if (m_children & Header) {
- m_header->write(writer, QLatin1String("header"));
+ m_header->write(writer, QStringLiteral("header"));
}
if (m_children & SizeHint) {
- m_sizeHint->write(writer, QLatin1String("sizehint"));
+ m_sizeHint->write(writer, QStringLiteral("sizehint"));
}
if (m_children & AddPageMethod) {
- writer.writeTextElement(QLatin1String("addpagemethod"), m_addPageMethod);
+ writer.writeTextElement(QStringLiteral("addpagemethod"), m_addPageMethod);
}
if (m_children & Container) {
- writer.writeTextElement(QLatin1String("container"), QString::number(m_container));
+ writer.writeTextElement(QStringLiteral("container"), QString::number(m_container));
}
if (m_children & SizePolicy) {
- m_sizePolicy->write(writer, QLatin1String("sizepolicy"));
+ m_sizePolicy->write(writer, QStringLiteral("sizepolicy"));
}
if (m_children & Pixmap) {
- writer.writeTextElement(QLatin1String("pixmap"), m_pixmap);
+ writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap);
}
if (m_children & Script) {
- m_script->write(writer, QLatin1String("script"));
+ m_script->write(writer, QStringLiteral("script"));
}
if (m_children & Properties) {
- m_properties->write(writer, QLatin1String("properties"));
+ m_properties->write(writer, QStringLiteral("properties"));
}
if (m_children & Slots) {
- m_slots->write(writer, QLatin1String("slots"));
+ m_slots->write(writer, QStringLiteral("slots"));
}
if (m_children & Propertyspecifications) {
- m_propertyspecifications->write(writer, QLatin1String("propertyspecifications"));
+ m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications"));
}
if (!m_text.isEmpty())
@@ -2870,13 +2310,13 @@ void DomProperties::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomPropertyData *v = new DomPropertyData();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2892,36 +2332,13 @@ void DomProperties::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomProperties::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomPropertyData *v = new DomPropertyData();
- v->read(e);
- m_property.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("properties") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomPropertyData* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -2961,18 +2378,18 @@ void DomPropertyData::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("type")) {
+ if (name == QStringLiteral("type")) {
setAttributeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2988,32 +2405,12 @@ void DomPropertyData::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomPropertyData::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("type")))
- setAttributeType(node.attribute(QLatin1String("type")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertydata") : tagName.toLower());
if (hasAttributeType())
- writer.writeAttribute(QLatin1String("type"), attributeType());
+ writer.writeAttribute(QStringLiteral("type"), attributeType());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -3051,15 +2448,15 @@ void DomSizePolicyData::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("hordata")) {
+ if (tag == QStringLiteral("hordata")) {
setElementHorData(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("verdata")) {
+ if (tag == QStringLiteral("verdata")) {
setElementVerData(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3075,41 +2472,16 @@ void DomSizePolicyData::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomSizePolicyData::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("hordata")) {
- setElementHorData(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("verdata")) {
- setElementVerData(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicydata") : tagName.toLower());
if (m_children & HorData) {
- writer.writeTextElement(QLatin1String("hordata"), QString::number(m_horData));
+ writer.writeTextElement(QStringLiteral("hordata"), QString::number(m_horData));
}
if (m_children & VerData) {
- writer.writeTextElement(QLatin1String("verdata"), QString::number(m_verData));
+ writer.writeTextElement(QStringLiteral("verdata"), QString::number(m_verData));
}
if (!m_text.isEmpty())
@@ -3172,22 +2544,22 @@ void DomLayoutDefault::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("spacing")) {
+ if (name == QStringLiteral("spacing")) {
setAttributeSpacing(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("margin")) {
+ if (name == QStringLiteral("margin")) {
setAttributeMargin(attribute.value().toString().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3203,37 +2575,15 @@ void DomLayoutDefault::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomLayoutDefault::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("spacing")))
- setAttributeSpacing(node.attribute(QLatin1String("spacing")).toInt());
- if (node.hasAttribute(QLatin1String("margin")))
- setAttributeMargin(node.attribute(QLatin1String("margin")).toInt());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutdefault") : tagName.toLower());
if (hasAttributeSpacing())
- writer.writeAttribute(QLatin1String("spacing"), QString::number(attributeSpacing()));
+ writer.writeAttribute(QStringLiteral("spacing"), QString::number(attributeSpacing()));
if (hasAttributeMargin())
- writer.writeAttribute(QLatin1String("margin"), QString::number(attributeMargin()));
+ writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin()));
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -3269,22 +2619,22 @@ void DomLayoutFunction::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("spacing")) {
+ if (name == QStringLiteral("spacing")) {
setAttributeSpacing(attribute.value().toString());
continue;
}
- if (name == QLatin1String("margin")) {
+ if (name == QStringLiteral("margin")) {
setAttributeMargin(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3300,37 +2650,15 @@ void DomLayoutFunction::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomLayoutFunction::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("spacing")))
- setAttributeSpacing(node.attribute(QLatin1String("spacing")));
- if (node.hasAttribute(QLatin1String("margin")))
- setAttributeMargin(node.attribute(QLatin1String("margin")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutfunction") : tagName.toLower());
if (hasAttributeSpacing())
- writer.writeAttribute(QLatin1String("spacing"), attributeSpacing());
+ writer.writeAttribute(QStringLiteral("spacing"), attributeSpacing());
if (hasAttributeMargin())
- writer.writeAttribute(QLatin1String("margin"), attributeMargin());
+ writer.writeAttribute(QStringLiteral("margin"), attributeMargin());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -3366,11 +2694,11 @@ void DomTabStops::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("tabstop")) {
+ if (tag == QStringLiteral("tabstop")) {
m_tabStop.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3386,34 +2714,13 @@ void DomTabStops::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomTabStops::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("tabstop")) {
- m_tabStop.append(e.text());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("tabstops") : tagName.toLower());
for (int i = 0; i < m_tabStop.size(); ++i) {
QString v = m_tabStop[i];
- writer.writeTextElement(QLatin1String("tabstop"), v);
+ writer.writeTextElement(QStringLiteral("tabstop"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -3477,60 +2784,60 @@ void DomLayout::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("class")) {
+ if (name == QStringLiteral("class")) {
setAttributeClass(attribute.value().toString());
continue;
}
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stretch")) {
+ if (name == QStringLiteral("stretch")) {
setAttributeStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("rowstretch")) {
+ if (name == QStringLiteral("rowstretch")) {
setAttributeRowStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("columnstretch")) {
+ if (name == QStringLiteral("columnstretch")) {
setAttributeColumnStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("rowminimumheight")) {
+ if (name == QStringLiteral("rowminimumheight")) {
setAttributeRowMinimumHeight(attribute.value().toString());
continue;
}
- if (name == QLatin1String("columnminimumwidth")) {
+ if (name == QStringLiteral("columnminimumwidth")) {
setAttributeColumnMinimumWidth(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (tag == QLatin1String("attribute")) {
+ if (tag == QStringLiteral("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- if (tag == QLatin1String("item")) {
+ if (tag == QStringLiteral("item")) {
DomLayoutItem *v = new DomLayoutItem();
v->read(reader);
m_item.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3546,92 +2853,42 @@ void DomLayout::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomLayout::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("class")))
- setAttributeClass(node.attribute(QLatin1String("class")));
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
- if (node.hasAttribute(QLatin1String("stretch")))
- setAttributeStretch(node.attribute(QLatin1String("stretch")));
- if (node.hasAttribute(QLatin1String("rowstretch")))
- setAttributeRowStretch(node.attribute(QLatin1String("rowstretch")));
- if (node.hasAttribute(QLatin1String("columnstretch")))
- setAttributeColumnStretch(node.attribute(QLatin1String("columnstretch")));
- if (node.hasAttribute(QLatin1String("rowminimumheight")))
- setAttributeRowMinimumHeight(node.attribute(QLatin1String("rowminimumheight")));
- if (node.hasAttribute(QLatin1String("columnminimumwidth")))
- setAttributeColumnMinimumWidth(node.attribute(QLatin1String("columnminimumwidth")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- if (tag == QLatin1String("attribute")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_attribute.append(v);
- continue;
- }
- if (tag == QLatin1String("item")) {
- DomLayoutItem *v = new DomLayoutItem();
- v->read(e);
- m_item.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layout") : tagName.toLower());
if (hasAttributeClass())
- writer.writeAttribute(QLatin1String("class"), attributeClass());
+ writer.writeAttribute(QStringLiteral("class"), attributeClass());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (hasAttributeStretch())
- writer.writeAttribute(QLatin1String("stretch"), attributeStretch());
+ writer.writeAttribute(QStringLiteral("stretch"), attributeStretch());
if (hasAttributeRowStretch())
- writer.writeAttribute(QLatin1String("rowstretch"), attributeRowStretch());
+ writer.writeAttribute(QStringLiteral("rowstretch"), attributeRowStretch());
if (hasAttributeColumnStretch())
- writer.writeAttribute(QLatin1String("columnstretch"), attributeColumnStretch());
+ writer.writeAttribute(QStringLiteral("columnstretch"), attributeColumnStretch());
if (hasAttributeRowMinimumHeight())
- writer.writeAttribute(QLatin1String("rowminimumheight"), attributeRowMinimumHeight());
+ writer.writeAttribute(QStringLiteral("rowminimumheight"), attributeRowMinimumHeight());
if (hasAttributeColumnMinimumWidth())
- writer.writeAttribute(QLatin1String("columnminimumwidth"), attributeColumnMinimumWidth());
+ writer.writeAttribute(QStringLiteral("columnminimumwidth"), attributeColumnMinimumWidth());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
- v->write(writer, QLatin1String("attribute"));
+ v->write(writer, QStringLiteral("attribute"));
}
for (int i = 0; i < m_item.size(); ++i) {
DomLayoutItem* v = m_item[i];
- v->write(writer, QLatin1String("item"));
+ v->write(writer, QStringLiteral("item"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -3713,52 +2970,52 @@ void DomLayoutItem::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("row")) {
+ if (name == QStringLiteral("row")) {
setAttributeRow(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("column")) {
+ if (name == QStringLiteral("column")) {
setAttributeColumn(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("rowspan")) {
+ if (name == QStringLiteral("rowspan")) {
setAttributeRowSpan(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("colspan")) {
+ if (name == QStringLiteral("colspan")) {
setAttributeColSpan(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("alignment")) {
+ if (name == QStringLiteral("alignment")) {
setAttributeAlignment(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("widget")) {
+ if (tag == QStringLiteral("widget")) {
DomWidget *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
- if (tag == QLatin1String("layout")) {
+ if (tag == QStringLiteral("layout")) {
DomLayout *v = new DomLayout();
v->read(reader);
setElementLayout(v);
continue;
}
- if (tag == QLatin1String("spacer")) {
+ if (tag == QStringLiteral("spacer")) {
DomSpacer *v = new DomSpacer();
v->read(reader);
setElementSpacer(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3774,90 +3031,44 @@ void DomLayoutItem::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomLayoutItem::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("row")))
- setAttributeRow(node.attribute(QLatin1String("row")).toInt());
- if (node.hasAttribute(QLatin1String("column")))
- setAttributeColumn(node.attribute(QLatin1String("column")).toInt());
- if (node.hasAttribute(QLatin1String("rowspan")))
- setAttributeRowSpan(node.attribute(QLatin1String("rowspan")).toInt());
- if (node.hasAttribute(QLatin1String("colspan")))
- setAttributeColSpan(node.attribute(QLatin1String("colspan")).toInt());
- if (node.hasAttribute(QLatin1String("alignment")))
- setAttributeAlignment(node.attribute(QLatin1String("alignment")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("widget")) {
- DomWidget *v = new DomWidget();
- v->read(e);
- setElementWidget(v);
- continue;
- }
- if (tag == QLatin1String("layout")) {
- DomLayout *v = new DomLayout();
- v->read(e);
- setElementLayout(v);
- continue;
- }
- if (tag == QLatin1String("spacer")) {
- DomSpacer *v = new DomSpacer();
- v->read(e);
- setElementSpacer(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutitem") : tagName.toLower());
if (hasAttributeRow())
- writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow()));
+ writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow()));
if (hasAttributeColumn())
- writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn()));
+ writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn()));
if (hasAttributeRowSpan())
- writer.writeAttribute(QLatin1String("rowspan"), QString::number(attributeRowSpan()));
+ writer.writeAttribute(QStringLiteral("rowspan"), QString::number(attributeRowSpan()));
if (hasAttributeColSpan())
- writer.writeAttribute(QLatin1String("colspan"), QString::number(attributeColSpan()));
+ writer.writeAttribute(QStringLiteral("colspan"), QString::number(attributeColSpan()));
if (hasAttributeAlignment())
- writer.writeAttribute(QLatin1String("alignment"), attributeAlignment());
+ writer.writeAttribute(QStringLiteral("alignment"), attributeAlignment());
switch (kind()) {
case Widget: {
DomWidget* v = elementWidget();
if (v != 0) {
- v->write(writer, QLatin1String("widget"));
+ v->write(writer, QStringLiteral("widget"));
}
break;
}
case Layout: {
DomLayout* v = elementLayout();
if (v != 0) {
- v->write(writer, QLatin1String("layout"));
+ v->write(writer, QStringLiteral("layout"));
}
break;
}
case Spacer: {
DomSpacer* v = elementSpacer();
if (v != 0) {
- v->write(writer, QLatin1String("spacer"));
+ v->write(writer, QStringLiteral("spacer"));
}
break;
}
@@ -3942,13 +3153,13 @@ void DomRow::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3964,36 +3175,13 @@ void DomRow::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomRow::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("row") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4037,13 +3225,13 @@ void DomColumn::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4059,36 +3247,13 @@ void DomColumn::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomColumn::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("column") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4142,34 +3307,34 @@ void DomItem::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("row")) {
+ if (name == QStringLiteral("row")) {
setAttributeRow(attribute.value().toString().toInt());
continue;
}
- if (name == QLatin1String("column")) {
+ if (name == QStringLiteral("column")) {
setAttributeColumn(attribute.value().toString().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (tag == QLatin1String("item")) {
+ if (tag == QStringLiteral("item")) {
DomItem *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4185,57 +3350,23 @@ void DomItem::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomItem::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("row")))
- setAttributeRow(node.attribute(QLatin1String("row")).toInt());
- if (node.hasAttribute(QLatin1String("column")))
- setAttributeColumn(node.attribute(QLatin1String("column")).toInt());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- if (tag == QLatin1String("item")) {
- DomItem *v = new DomItem();
- v->read(e);
- m_item.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("item") : tagName.toLower());
if (hasAttributeRow())
- writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow()));
+ writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow()));
if (hasAttributeColumn())
- writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn()));
+ writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn()));
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
for (int i = 0; i < m_item.size(); ++i) {
DomItem* v = m_item[i];
- v->write(writer, QLatin1String("item"));
+ v->write(writer, QStringLiteral("item"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4339,106 +3470,106 @@ void DomWidget::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("class")) {
+ if (name == QStringLiteral("class")) {
setAttributeClass(attribute.value().toString());
continue;
}
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("native")) {
+ if (name == QStringLiteral("native")) {
setAttributeNative((attribute.value().toString() == QLatin1String("true") ? true : false));
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("class")) {
+ if (tag == QStringLiteral("class")) {
m_class.append(reader.readElementText());
continue;
}
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (tag == QLatin1String("script")) {
+ if (tag == QStringLiteral("script")) {
DomScript *v = new DomScript();
v->read(reader);
m_script.append(v);
continue;
}
- if (tag == QLatin1String("widgetdata")) {
+ if (tag == QStringLiteral("widgetdata")) {
DomWidgetData *v = new DomWidgetData();
v->read(reader);
m_widgetData.append(v);
continue;
}
- if (tag == QLatin1String("attribute")) {
+ if (tag == QStringLiteral("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- if (tag == QLatin1String("row")) {
+ if (tag == QStringLiteral("row")) {
DomRow *v = new DomRow();
v->read(reader);
m_row.append(v);
continue;
}
- if (tag == QLatin1String("column")) {
+ if (tag == QStringLiteral("column")) {
DomColumn *v = new DomColumn();
v->read(reader);
m_column.append(v);
continue;
}
- if (tag == QLatin1String("item")) {
+ if (tag == QStringLiteral("item")) {
DomItem *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
- if (tag == QLatin1String("layout")) {
+ if (tag == QStringLiteral("layout")) {
DomLayout *v = new DomLayout();
v->read(reader);
m_layout.append(v);
continue;
}
- if (tag == QLatin1String("widget")) {
+ if (tag == QStringLiteral("widget")) {
DomWidget *v = new DomWidget();
v->read(reader);
m_widget.append(v);
continue;
}
- if (tag == QLatin1String("action")) {
+ if (tag == QStringLiteral("action")) {
DomAction *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
- if (tag == QLatin1String("actiongroup")) {
+ if (tag == QStringLiteral("actiongroup")) {
DomActionGroup *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
- if (tag == QLatin1String("addaction")) {
+ if (tag == QStringLiteral("addaction")) {
DomActionRef *v = new DomActionRef();
v->read(reader);
m_addAction.append(v);
continue;
}
- if (tag == QLatin1String("zorder")) {
+ if (tag == QStringLiteral("zorder")) {
m_zOrder.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4454,178 +3585,74 @@ void DomWidget::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomWidget::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("class")))
- setAttributeClass(node.attribute(QLatin1String("class")));
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
- if (node.hasAttribute(QLatin1String("native")))
- setAttributeNative((node.attribute(QLatin1String("native")) == QLatin1String("true") ? true : false));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("class")) {
- m_class.append(e.text());
- continue;
- }
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- if (tag == QLatin1String("script")) {
- DomScript *v = new DomScript();
- v->read(e);
- m_script.append(v);
- continue;
- }
- if (tag == QLatin1String("widgetdata")) {
- DomWidgetData *v = new DomWidgetData();
- v->read(e);
- m_widgetData.append(v);
- continue;
- }
- if (tag == QLatin1String("attribute")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_attribute.append(v);
- continue;
- }
- if (tag == QLatin1String("row")) {
- DomRow *v = new DomRow();
- v->read(e);
- m_row.append(v);
- continue;
- }
- if (tag == QLatin1String("column")) {
- DomColumn *v = new DomColumn();
- v->read(e);
- m_column.append(v);
- continue;
- }
- if (tag == QLatin1String("item")) {
- DomItem *v = new DomItem();
- v->read(e);
- m_item.append(v);
- continue;
- }
- if (tag == QLatin1String("layout")) {
- DomLayout *v = new DomLayout();
- v->read(e);
- m_layout.append(v);
- continue;
- }
- if (tag == QLatin1String("widget")) {
- DomWidget *v = new DomWidget();
- v->read(e);
- m_widget.append(v);
- continue;
- }
- if (tag == QLatin1String("action")) {
- DomAction *v = new DomAction();
- v->read(e);
- m_action.append(v);
- continue;
- }
- if (tag == QLatin1String("actiongroup")) {
- DomActionGroup *v = new DomActionGroup();
- v->read(e);
- m_actionGroup.append(v);
- continue;
- }
- if (tag == QLatin1String("addaction")) {
- DomActionRef *v = new DomActionRef();
- v->read(e);
- m_addAction.append(v);
- continue;
- }
- if (tag == QLatin1String("zorder")) {
- m_zOrder.append(e.text());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widget") : tagName.toLower());
if (hasAttributeClass())
- writer.writeAttribute(QLatin1String("class"), attributeClass());
+ writer.writeAttribute(QStringLiteral("class"), attributeClass());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (hasAttributeNative())
- writer.writeAttribute(QLatin1String("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(QStringLiteral("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false")));
for (int i = 0; i < m_class.size(); ++i) {
QString v = m_class[i];
- writer.writeTextElement(QLatin1String("class"), v);
+ writer.writeTextElement(QStringLiteral("class"), v);
}
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
for (int i = 0; i < m_script.size(); ++i) {
DomScript* v = m_script[i];
- v->write(writer, QLatin1String("script"));
+ v->write(writer, QStringLiteral("script"));
}
for (int i = 0; i < m_widgetData.size(); ++i) {
DomWidgetData* v = m_widgetData[i];
- v->write(writer, QLatin1String("widgetdata"));
+ v->write(writer, QStringLiteral("widgetdata"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
- v->write(writer, QLatin1String("attribute"));
+ v->write(writer, QStringLiteral("attribute"));
}
for (int i = 0; i < m_row.size(); ++i) {
DomRow* v = m_row[i];
- v->write(writer, QLatin1String("row"));
+ v->write(writer, QStringLiteral("row"));
}
for (int i = 0; i < m_column.size(); ++i) {
DomColumn* v = m_column[i];
- v->write(writer, QLatin1String("column"));
+ v->write(writer, QStringLiteral("column"));
}
for (int i = 0; i < m_item.size(); ++i) {
DomItem* v = m_item[i];
- v->write(writer, QLatin1String("item"));
+ v->write(writer, QStringLiteral("item"));
}
for (int i = 0; i < m_layout.size(); ++i) {
DomLayout* v = m_layout[i];
- v->write(writer, QLatin1String("layout"));
+ v->write(writer, QStringLiteral("layout"));
}
for (int i = 0; i < m_widget.size(); ++i) {
DomWidget* v = m_widget[i];
- v->write(writer, QLatin1String("widget"));
+ v->write(writer, QStringLiteral("widget"));
}
for (int i = 0; i < m_action.size(); ++i) {
DomAction* v = m_action[i];
- v->write(writer, QLatin1String("action"));
+ v->write(writer, QStringLiteral("action"));
}
for (int i = 0; i < m_actionGroup.size(); ++i) {
DomActionGroup* v = m_actionGroup[i];
- v->write(writer, QLatin1String("actiongroup"));
+ v->write(writer, QStringLiteral("actiongroup"));
}
for (int i = 0; i < m_addAction.size(); ++i) {
DomActionRef* v = m_addAction[i];
- v->write(writer, QLatin1String("addaction"));
+ v->write(writer, QStringLiteral("addaction"));
}
for (int i = 0; i < m_zOrder.size(); ++i) {
QString v = m_zOrder[i];
- writer.writeTextElement(QLatin1String("zorder"), v);
+ writer.writeTextElement(QStringLiteral("zorder"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4747,24 +3774,24 @@ void DomSpacer::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4780,42 +3807,16 @@ void DomSpacer::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomSpacer::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("spacer") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4863,30 +3864,30 @@ void DomColor::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("alpha")) {
+ if (name == QStringLiteral("alpha")) {
setAttributeAlpha(attribute.value().toString().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("red")) {
+ if (tag == QStringLiteral("red")) {
setElementRed(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("green")) {
+ if (tag == QStringLiteral("green")) {
setElementGreen(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("blue")) {
+ if (tag == QStringLiteral("blue")) {
setElementBlue(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4902,55 +3903,23 @@ void DomColor::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomColor::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("alpha")))
- setAttributeAlpha(node.attribute(QLatin1String("alpha")).toInt());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("red")) {
- setElementRed(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("green")) {
- setElementGreen(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("blue")) {
- setElementBlue(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("color") : tagName.toLower());
if (hasAttributeAlpha())
- writer.writeAttribute(QLatin1String("alpha"), QString::number(attributeAlpha()));
+ writer.writeAttribute(QStringLiteral("alpha"), QString::number(attributeAlpha()));
if (m_children & Red) {
- writer.writeTextElement(QLatin1String("red"), QString::number(m_red));
+ writer.writeTextElement(QStringLiteral("red"), QString::number(m_red));
}
if (m_children & Green) {
- writer.writeTextElement(QLatin1String("green"), QString::number(m_green));
+ writer.writeTextElement(QStringLiteral("green"), QString::number(m_green));
}
if (m_children & Blue) {
- writer.writeTextElement(QLatin1String("blue"), QString::number(m_blue));
+ writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue));
}
if (!m_text.isEmpty())
@@ -5024,24 +3993,24 @@ void DomGradientStop::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("position")) {
+ if (name == QStringLiteral("position")) {
setAttributePosition(attribute.value().toString().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("color")) {
+ if (tag == QStringLiteral("color")) {
DomColor *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5057,41 +4026,15 @@ void DomGradientStop::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomGradientStop::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("position")))
- setAttributePosition(node.attribute(QLatin1String("position")).toDouble());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("color")) {
- DomColor *v = new DomColor();
- v->read(e);
- setElementColor(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradientstop") : tagName.toLower());
if (hasAttributePosition())
- writer.writeAttribute(QLatin1String("position"), QString::number(attributePosition(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("position"), QString::number(attributePosition(), 'f', 15));
if (m_children & Color) {
- m_color->write(writer, QLatin1String("color"));
+ m_color->write(writer, QStringLiteral("color"));
}
if (!m_text.isEmpty())
@@ -5196,72 +4139,72 @@ void DomGradient::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("startx")) {
+ if (name == QStringLiteral("startx")) {
setAttributeStartX(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("starty")) {
+ if (name == QStringLiteral("starty")) {
setAttributeStartY(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("endx")) {
+ if (name == QStringLiteral("endx")) {
setAttributeEndX(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("endy")) {
+ if (name == QStringLiteral("endy")) {
setAttributeEndY(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("centralx")) {
+ if (name == QStringLiteral("centralx")) {
setAttributeCentralX(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("centraly")) {
+ if (name == QStringLiteral("centraly")) {
setAttributeCentralY(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("focalx")) {
+ if (name == QStringLiteral("focalx")) {
setAttributeFocalX(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("focaly")) {
+ if (name == QStringLiteral("focaly")) {
setAttributeFocalY(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("radius")) {
+ if (name == QStringLiteral("radius")) {
setAttributeRadius(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("angle")) {
+ if (name == QStringLiteral("angle")) {
setAttributeAngle(attribute.value().toString().toDouble());
continue;
}
- if (name == QLatin1String("type")) {
+ if (name == QStringLiteral("type")) {
setAttributeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("spread")) {
+ if (name == QStringLiteral("spread")) {
setAttributeSpread(attribute.value().toString());
continue;
}
- if (name == QLatin1String("coordinatemode")) {
+ if (name == QStringLiteral("coordinatemode")) {
setAttributeCoordinateMode(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("gradientstop")) {
+ if (tag == QStringLiteral("gradientstop")) {
DomGradientStop *v = new DomGradientStop();
v->read(reader);
m_gradientStop.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5277,102 +4220,52 @@ void DomGradient::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomGradient::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("startx")))
- setAttributeStartX(node.attribute(QLatin1String("startx")).toDouble());
- if (node.hasAttribute(QLatin1String("starty")))
- setAttributeStartY(node.attribute(QLatin1String("starty")).toDouble());
- if (node.hasAttribute(QLatin1String("endx")))
- setAttributeEndX(node.attribute(QLatin1String("endx")).toDouble());
- if (node.hasAttribute(QLatin1String("endy")))
- setAttributeEndY(node.attribute(QLatin1String("endy")).toDouble());
- if (node.hasAttribute(QLatin1String("centralx")))
- setAttributeCentralX(node.attribute(QLatin1String("centralx")).toDouble());
- if (node.hasAttribute(QLatin1String("centraly")))
- setAttributeCentralY(node.attribute(QLatin1String("centraly")).toDouble());
- if (node.hasAttribute(QLatin1String("focalx")))
- setAttributeFocalX(node.attribute(QLatin1String("focalx")).toDouble());
- if (node.hasAttribute(QLatin1String("focaly")))
- setAttributeFocalY(node.attribute(QLatin1String("focaly")).toDouble());
- if (node.hasAttribute(QLatin1String("radius")))
- setAttributeRadius(node.attribute(QLatin1String("radius")).toDouble());
- if (node.hasAttribute(QLatin1String("angle")))
- setAttributeAngle(node.attribute(QLatin1String("angle")).toDouble());
- if (node.hasAttribute(QLatin1String("type")))
- setAttributeType(node.attribute(QLatin1String("type")));
- if (node.hasAttribute(QLatin1String("spread")))
- setAttributeSpread(node.attribute(QLatin1String("spread")));
- if (node.hasAttribute(QLatin1String("coordinatemode")))
- setAttributeCoordinateMode(node.attribute(QLatin1String("coordinatemode")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("gradientstop")) {
- DomGradientStop *v = new DomGradientStop();
- v->read(e);
- m_gradientStop.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradient") : tagName.toLower());
if (hasAttributeStartX())
- writer.writeAttribute(QLatin1String("startx"), QString::number(attributeStartX(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("startx"), QString::number(attributeStartX(), 'f', 15));
if (hasAttributeStartY())
- writer.writeAttribute(QLatin1String("starty"), QString::number(attributeStartY(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("starty"), QString::number(attributeStartY(), 'f', 15));
if (hasAttributeEndX())
- writer.writeAttribute(QLatin1String("endx"), QString::number(attributeEndX(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("endx"), QString::number(attributeEndX(), 'f', 15));
if (hasAttributeEndY())
- writer.writeAttribute(QLatin1String("endy"), QString::number(attributeEndY(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("endy"), QString::number(attributeEndY(), 'f', 15));
if (hasAttributeCentralX())
- writer.writeAttribute(QLatin1String("centralx"), QString::number(attributeCentralX(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("centralx"), QString::number(attributeCentralX(), 'f', 15));
if (hasAttributeCentralY())
- writer.writeAttribute(QLatin1String("centraly"), QString::number(attributeCentralY(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("centraly"), QString::number(attributeCentralY(), 'f', 15));
if (hasAttributeFocalX())
- writer.writeAttribute(QLatin1String("focalx"), QString::number(attributeFocalX(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("focalx"), QString::number(attributeFocalX(), 'f', 15));
if (hasAttributeFocalY())
- writer.writeAttribute(QLatin1String("focaly"), QString::number(attributeFocalY(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("focaly"), QString::number(attributeFocalY(), 'f', 15));
if (hasAttributeRadius())
- writer.writeAttribute(QLatin1String("radius"), QString::number(attributeRadius(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("radius"), QString::number(attributeRadius(), 'f', 15));
if (hasAttributeAngle())
- writer.writeAttribute(QLatin1String("angle"), QString::number(attributeAngle(), 'f', 15));
+ writer.writeAttribute(QStringLiteral("angle"), QString::number(attributeAngle(), 'f', 15));
if (hasAttributeType())
- writer.writeAttribute(QLatin1String("type"), attributeType());
+ writer.writeAttribute(QStringLiteral("type"), attributeType());
if (hasAttributeSpread())
- writer.writeAttribute(QLatin1String("spread"), attributeSpread());
+ writer.writeAttribute(QStringLiteral("spread"), attributeSpread());
if (hasAttributeCoordinateMode())
- writer.writeAttribute(QLatin1String("coordinatemode"), attributeCoordinateMode());
+ writer.writeAttribute(QStringLiteral("coordinatemode"), attributeCoordinateMode());
for (int i = 0; i < m_gradientStop.size(); ++i) {
DomGradientStop* v = m_gradientStop[i];
- v->write(writer, QLatin1String("gradientstop"));
+ v->write(writer, QStringLiteral("gradientstop"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -5426,36 +4319,36 @@ void DomBrush::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("brushstyle")) {
+ if (name == QStringLiteral("brushstyle")) {
setAttributeBrushStyle(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("color")) {
+ if (tag == QStringLiteral("color")) {
DomColor *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- if (tag == QLatin1String("texture")) {
+ if (tag == QStringLiteral("texture")) {
DomProperty *v = new DomProperty();
v->read(reader);
setElementTexture(v);
continue;
}
- if (tag == QLatin1String("gradient")) {
+ if (tag == QStringLiteral("gradient")) {
DomGradient *v = new DomGradient();
v->read(reader);
setElementGradient(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5471,70 +4364,32 @@ void DomBrush::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomBrush::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("brushstyle")))
- setAttributeBrushStyle(node.attribute(QLatin1String("brushstyle")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("color")) {
- DomColor *v = new DomColor();
- v->read(e);
- setElementColor(v);
- continue;
- }
- if (tag == QLatin1String("texture")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- setElementTexture(v);
- continue;
- }
- if (tag == QLatin1String("gradient")) {
- DomGradient *v = new DomGradient();
- v->read(e);
- setElementGradient(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("brush") : tagName.toLower());
if (hasAttributeBrushStyle())
- writer.writeAttribute(QLatin1String("brushstyle"), attributeBrushStyle());
+ writer.writeAttribute(QStringLiteral("brushstyle"), attributeBrushStyle());
switch (kind()) {
case Color: {
DomColor* v = elementColor();
if (v != 0) {
- v->write(writer, QLatin1String("color"));
+ v->write(writer, QStringLiteral("color"));
}
break;
}
case Texture: {
DomProperty* v = elementTexture();
if (v != 0) {
- v->write(writer, QLatin1String("texture"));
+ v->write(writer, QStringLiteral("texture"));
}
break;
}
case Gradient: {
DomGradient* v = elementGradient();
if (v != 0) {
- v->write(writer, QLatin1String("gradient"));
+ v->write(writer, QStringLiteral("gradient"));
}
break;
}
@@ -5619,24 +4474,24 @@ void DomColorRole::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("role")) {
+ if (name == QStringLiteral("role")) {
setAttributeRole(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("brush")) {
+ if (tag == QStringLiteral("brush")) {
DomBrush *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5652,41 +4507,15 @@ void DomColorRole::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomColorRole::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("role")))
- setAttributeRole(node.attribute(QLatin1String("role")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("brush")) {
- DomBrush *v = new DomBrush();
- v->read(e);
- setElementBrush(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorrole") : tagName.toLower());
if (hasAttributeRole())
- writer.writeAttribute(QLatin1String("role"), attributeRole());
+ writer.writeAttribute(QStringLiteral("role"), attributeRole());
if (m_children & Brush) {
- m_brush->write(writer, QLatin1String("brush"));
+ m_brush->write(writer, QStringLiteral("brush"));
}
if (!m_text.isEmpty())
@@ -5751,19 +4580,19 @@ void DomColorGroup::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("colorrole")) {
+ if (tag == QStringLiteral("colorrole")) {
DomColorRole *v = new DomColorRole();
v->read(reader);
m_colorRole.append(v);
continue;
}
- if (tag == QLatin1String("color")) {
+ if (tag == QStringLiteral("color")) {
DomColor *v = new DomColor();
v->read(reader);
m_color.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5779,46 +4608,17 @@ void DomColorGroup::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomColorGroup::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("colorrole")) {
- DomColorRole *v = new DomColorRole();
- v->read(e);
- m_colorRole.append(v);
- continue;
- }
- if (tag == QLatin1String("color")) {
- DomColor *v = new DomColor();
- v->read(e);
- m_color.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorgroup") : tagName.toLower());
for (int i = 0; i < m_colorRole.size(); ++i) {
DomColorRole* v = m_colorRole[i];
- v->write(writer, QLatin1String("colorrole"));
+ v->write(writer, QStringLiteral("colorrole"));
}
for (int i = 0; i < m_color.size(); ++i) {
DomColor* v = m_color[i];
- v->write(writer, QLatin1String("color"));
+ v->write(writer, QStringLiteral("color"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -5876,25 +4676,25 @@ void DomPalette::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("active")) {
+ if (tag == QStringLiteral("active")) {
DomColorGroup *v = new DomColorGroup();
v->read(reader);
setElementActive(v);
continue;
}
- if (tag == QLatin1String("inactive")) {
+ if (tag == QStringLiteral("inactive")) {
DomColorGroup *v = new DomColorGroup();
v->read(reader);
setElementInactive(v);
continue;
}
- if (tag == QLatin1String("disabled")) {
+ if (tag == QStringLiteral("disabled")) {
DomColorGroup *v = new DomColorGroup();
v->read(reader);
setElementDisabled(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5910,55 +4710,20 @@ void DomPalette::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomPalette::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("active")) {
- DomColorGroup *v = new DomColorGroup();
- v->read(e);
- setElementActive(v);
- continue;
- }
- if (tag == QLatin1String("inactive")) {
- DomColorGroup *v = new DomColorGroup();
- v->read(e);
- setElementInactive(v);
- continue;
- }
- if (tag == QLatin1String("disabled")) {
- DomColorGroup *v = new DomColorGroup();
- v->read(e);
- setElementDisabled(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("palette") : tagName.toLower());
if (m_children & Active) {
- m_active->write(writer, QLatin1String("active"));
+ m_active->write(writer, QStringLiteral("active"));
}
if (m_children & Inactive) {
- m_inactive->write(writer, QLatin1String("inactive"));
+ m_inactive->write(writer, QStringLiteral("inactive"));
}
if (m_children & Disabled) {
- m_disabled->write(writer, QLatin1String("disabled"));
+ m_disabled->write(writer, QStringLiteral("disabled"));
}
if (!m_text.isEmpty())
@@ -6075,47 +4840,47 @@ void DomFont::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("family")) {
+ if (tag == QStringLiteral("family")) {
setElementFamily(reader.readElementText());
continue;
}
- if (tag == QLatin1String("pointsize")) {
+ if (tag == QStringLiteral("pointsize")) {
setElementPointSize(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("weight")) {
+ if (tag == QStringLiteral("weight")) {
setElementWeight(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("italic")) {
+ if (tag == QStringLiteral("italic")) {
setElementItalic((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
- if (tag == QLatin1String("bold")) {
+ if (tag == QStringLiteral("bold")) {
setElementBold((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
- if (tag == QLatin1String("underline")) {
+ if (tag == QStringLiteral("underline")) {
setElementUnderline((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
- if (tag == QLatin1String("strikeout")) {
+ if (tag == QStringLiteral("strikeout")) {
setElementStrikeOut((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
- if (tag == QLatin1String("antialiasing")) {
+ if (tag == QStringLiteral("antialiasing")) {
setElementAntialiasing((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
- if (tag == QLatin1String("stylestrategy")) {
+ if (tag == QStringLiteral("stylestrategy")) {
setElementStyleStrategy(reader.readElementText());
continue;
}
- if (tag == QLatin1String("kerning")) {
+ if (tag == QStringLiteral("kerning")) {
setElementKerning((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6131,105 +4896,48 @@ void DomFont::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomFont::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("family")) {
- setElementFamily(e.text());
- continue;
- }
- if (tag == QLatin1String("pointsize")) {
- setElementPointSize(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("weight")) {
- setElementWeight(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("italic")) {
- setElementItalic((e.text() == QLatin1String("true") ? true : false));
- continue;
- }
- if (tag == QLatin1String("bold")) {
- setElementBold((e.text() == QLatin1String("true") ? true : false));
- continue;
- }
- if (tag == QLatin1String("underline")) {
- setElementUnderline((e.text() == QLatin1String("true") ? true : false));
- continue;
- }
- if (tag == QLatin1String("strikeout")) {
- setElementStrikeOut((e.text() == QLatin1String("true") ? true : false));
- continue;
- }
- if (tag == QLatin1String("antialiasing")) {
- setElementAntialiasing((e.text() == QLatin1String("true") ? true : false));
- continue;
- }
- if (tag == QLatin1String("stylestrategy")) {
- setElementStyleStrategy(e.text());
- continue;
- }
- if (tag == QLatin1String("kerning")) {
- setElementKerning((e.text() == QLatin1String("true") ? true : false));
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("font") : tagName.toLower());
if (m_children & Family) {
- writer.writeTextElement(QLatin1String("family"), m_family);
+ writer.writeTextElement(QStringLiteral("family"), m_family);
}
if (m_children & PointSize) {
- writer.writeTextElement(QLatin1String("pointsize"), QString::number(m_pointSize));
+ writer.writeTextElement(QStringLiteral("pointsize"), QString::number(m_pointSize));
}
if (m_children & Weight) {
- writer.writeTextElement(QLatin1String("weight"), QString::number(m_weight));
+ writer.writeTextElement(QStringLiteral("weight"), QString::number(m_weight));
}
if (m_children & Italic) {
- writer.writeTextElement(QLatin1String("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(QStringLiteral("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & Bold) {
- writer.writeTextElement(QLatin1String("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(QStringLiteral("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & Underline) {
- writer.writeTextElement(QLatin1String("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(QStringLiteral("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & StrikeOut) {
- writer.writeTextElement(QLatin1String("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(QStringLiteral("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & Antialiasing) {
- writer.writeTextElement(QLatin1String("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(QStringLiteral("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & StyleStrategy) {
- writer.writeTextElement(QLatin1String("stylestrategy"), m_styleStrategy);
+ writer.writeTextElement(QStringLiteral("stylestrategy"), m_styleStrategy);
}
if (m_children & Kerning) {
- writer.writeTextElement(QLatin1String("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false")));
}
if (!m_text.isEmpty())
@@ -6386,7 +5094,7 @@ void DomPoint::read(QXmlStreamReader &reader)
setElementY(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6402,31 +5110,6 @@ void DomPoint::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomPoint::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QString(QLatin1Char('x'))) {
- setElementX(e.text().toInt());
- continue;
- }
- if (tag == QString(QLatin1Char('y'))) {
- setElementY(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("point") : tagName.toLower());
@@ -6509,15 +5192,15 @@ void DomRect::read(QXmlStreamReader &reader)
setElementY(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("width")) {
+ if (tag == QStringLiteral("width")) {
setElementWidth(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("height")) {
+ if (tag == QStringLiteral("height")) {
setElementHeight(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6533,39 +5216,6 @@ void DomRect::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomRect::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QString(QLatin1Char('x'))) {
- setElementX(e.text().toInt());
- continue;
- }
- if (tag == QString(QLatin1Char('y'))) {
- setElementY(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("width")) {
- setElementWidth(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("height")) {
- setElementHeight(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rect") : tagName.toLower());
@@ -6579,11 +5229,11 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
}
if (m_children & Width) {
- writer.writeTextElement(QLatin1String("width"), QString::number(m_width));
+ writer.writeTextElement(QStringLiteral("width"), QString::number(m_width));
}
if (m_children & Height) {
- writer.writeTextElement(QLatin1String("height"), QString::number(m_height));
+ writer.writeTextElement(QStringLiteral("height"), QString::number(m_height));
}
if (!m_text.isEmpty())
@@ -6664,22 +5314,22 @@ void DomLocale::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("language")) {
+ if (name == QStringLiteral("language")) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- if (name == QLatin1String("country")) {
+ if (name == QStringLiteral("country")) {
setAttributeCountry(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6695,37 +5345,15 @@ void DomLocale::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomLocale::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("language")))
- setAttributeLanguage(node.attribute(QLatin1String("language")));
- if (node.hasAttribute(QLatin1String("country")))
- setAttributeCountry(node.attribute(QLatin1String("country")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("locale") : tagName.toLower());
if (hasAttributeLanguage())
- writer.writeAttribute(QLatin1String("language"), attributeLanguage());
+ writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
if (hasAttributeCountry())
- writer.writeAttribute(QLatin1String("country"), attributeCountry());
+ writer.writeAttribute(QStringLiteral("country"), attributeCountry());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -6769,38 +5397,38 @@ void DomSizePolicy::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("hsizetype")) {
+ if (name == QStringLiteral("hsizetype")) {
setAttributeHSizeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("vsizetype")) {
+ if (name == QStringLiteral("vsizetype")) {
setAttributeVSizeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("hsizetype")) {
+ if (tag == QStringLiteral("hsizetype")) {
setElementHSizeType(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("vsizetype")) {
+ if (tag == QStringLiteral("vsizetype")) {
setElementVSizeType(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("horstretch")) {
+ if (tag == QStringLiteral("horstretch")) {
setElementHorStretch(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("verstretch")) {
+ if (tag == QStringLiteral("verstretch")) {
setElementVerStretch(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6816,68 +5444,30 @@ void DomSizePolicy::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomSizePolicy::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("hsizetype")))
- setAttributeHSizeType(node.attribute(QLatin1String("hsizetype")));
- if (node.hasAttribute(QLatin1String("vsizetype")))
- setAttributeVSizeType(node.attribute(QLatin1String("vsizetype")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("hsizetype")) {
- setElementHSizeType(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("vsizetype")) {
- setElementVSizeType(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("horstretch")) {
- setElementHorStretch(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("verstretch")) {
- setElementVerStretch(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicy") : tagName.toLower());
if (hasAttributeHSizeType())
- writer.writeAttribute(QLatin1String("hsizetype"), attributeHSizeType());
+ writer.writeAttribute(QStringLiteral("hsizetype"), attributeHSizeType());
if (hasAttributeVSizeType())
- writer.writeAttribute(QLatin1String("vsizetype"), attributeVSizeType());
+ writer.writeAttribute(QStringLiteral("vsizetype"), attributeVSizeType());
if (m_children & HSizeType) {
- writer.writeTextElement(QLatin1String("hsizetype"), QString::number(m_hSizeType));
+ writer.writeTextElement(QStringLiteral("hsizetype"), QString::number(m_hSizeType));
}
if (m_children & VSizeType) {
- writer.writeTextElement(QLatin1String("vsizetype"), QString::number(m_vSizeType));
+ writer.writeTextElement(QStringLiteral("vsizetype"), QString::number(m_vSizeType));
}
if (m_children & HorStretch) {
- writer.writeTextElement(QLatin1String("horstretch"), QString::number(m_horStretch));
+ writer.writeTextElement(QStringLiteral("horstretch"), QString::number(m_horStretch));
}
if (m_children & VerStretch) {
- writer.writeTextElement(QLatin1String("verstretch"), QString::number(m_verStretch));
+ writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch));
}
if (!m_text.isEmpty())
@@ -6960,15 +5550,15 @@ void DomSize::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("width")) {
+ if (tag == QStringLiteral("width")) {
setElementWidth(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("height")) {
+ if (tag == QStringLiteral("height")) {
setElementHeight(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6984,41 +5574,16 @@ void DomSize::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomSize::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("width")) {
- setElementWidth(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("height")) {
- setElementHeight(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("size") : tagName.toLower());
if (m_children & Width) {
- writer.writeTextElement(QLatin1String("width"), QString::number(m_width));
+ writer.writeTextElement(QStringLiteral("width"), QString::number(m_width));
}
if (m_children & Height) {
- writer.writeTextElement(QLatin1String("height"), QString::number(m_height));
+ writer.writeTextElement(QStringLiteral("height"), QString::number(m_height));
}
if (!m_text.isEmpty())
@@ -7081,19 +5646,19 @@ void DomDate::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("year")) {
+ if (tag == QStringLiteral("year")) {
setElementYear(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("month")) {
+ if (tag == QStringLiteral("month")) {
setElementMonth(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("day")) {
+ if (tag == QStringLiteral("day")) {
setElementDay(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -7109,49 +5674,20 @@ void DomDate::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomDate::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("year")) {
- setElementYear(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("month")) {
- setElementMonth(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("day")) {
- setElementDay(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("date") : tagName.toLower());
if (m_children & Year) {
- writer.writeTextElement(QLatin1String("year"), QString::number(m_year));
+ writer.writeTextElement(QStringLiteral("year"), QString::number(m_year));
}
if (m_children & Month) {
- writer.writeTextElement(QLatin1String("month"), QString::number(m_month));
+ writer.writeTextElement(QStringLiteral("month"), QString::number(m_month));
}
if (m_children & Day) {
- writer.writeTextElement(QLatin1String("day"), QString::number(m_day));
+ writer.writeTextElement(QStringLiteral("day"), QString::number(m_day));
}
if (!m_text.isEmpty())
@@ -7225,19 +5761,19 @@ void DomTime::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("hour")) {
+ if (tag == QStringLiteral("hour")) {
setElementHour(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("minute")) {
+ if (tag == QStringLiteral("minute")) {
setElementMinute(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("second")) {
+ if (tag == QStringLiteral("second")) {
setElementSecond(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -7253,49 +5789,20 @@ void DomTime::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomTime::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("hour")) {
- setElementHour(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("minute")) {
- setElementMinute(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("second")) {
- setElementSecond(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("time") : tagName.toLower());
if (m_children & Hour) {
- writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour));
+ writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour));
}
if (m_children & Minute) {
- writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute));
+ writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute));
}
if (m_children & Second) {
- writer.writeTextElement(QLatin1String("second"), QString::number(m_second));
+ writer.writeTextElement(QStringLiteral("second"), QString::number(m_second));
}
if (!m_text.isEmpty())
@@ -7375,31 +5882,31 @@ void DomDateTime::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("hour")) {
+ if (tag == QStringLiteral("hour")) {
setElementHour(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("minute")) {
+ if (tag == QStringLiteral("minute")) {
setElementMinute(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("second")) {
+ if (tag == QStringLiteral("second")) {
setElementSecond(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("year")) {
+ if (tag == QStringLiteral("year")) {
setElementYear(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("month")) {
+ if (tag == QStringLiteral("month")) {
setElementMonth(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("day")) {
+ if (tag == QStringLiteral("day")) {
setElementDay(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -7415,73 +5922,32 @@ void DomDateTime::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomDateTime::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("hour")) {
- setElementHour(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("minute")) {
- setElementMinute(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("second")) {
- setElementSecond(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("year")) {
- setElementYear(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("month")) {
- setElementMonth(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("day")) {
- setElementDay(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("datetime") : tagName.toLower());
if (m_children & Hour) {
- writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour));
+ writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour));
}
if (m_children & Minute) {
- writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute));
+ writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute));
}
if (m_children & Second) {
- writer.writeTextElement(QLatin1String("second"), QString::number(m_second));
+ writer.writeTextElement(QStringLiteral("second"), QString::number(m_second));
}
if (m_children & Year) {
- writer.writeTextElement(QLatin1String("year"), QString::number(m_year));
+ writer.writeTextElement(QStringLiteral("year"), QString::number(m_year));
}
if (m_children & Month) {
- writer.writeTextElement(QLatin1String("month"), QString::number(m_month));
+ writer.writeTextElement(QStringLiteral("month"), QString::number(m_month));
}
if (m_children & Day) {
- writer.writeTextElement(QLatin1String("day"), QString::number(m_day));
+ writer.writeTextElement(QStringLiteral("day"), QString::number(m_day));
}
if (!m_text.isEmpty())
@@ -7584,11 +6050,11 @@ void DomStringList::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("string")) {
+ if (tag == QStringLiteral("string")) {
m_string.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -7604,34 +6070,13 @@ void DomStringList::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomStringList::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("string")) {
- m_string.append(e.text());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringlist") : tagName.toLower());
for (int i = 0; i < m_string.size(); ++i) {
QString v = m_string[i];
- writer.writeTextElement(QLatin1String("string"), v);
+ writer.writeTextElement(QStringLiteral("string"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -7649,7 +6094,7 @@ void DomResourcePixmap::clear(bool clear_all)
{
if (clear_all) {
- m_text = QLatin1String("");
+ m_text.clear();
m_has_attr_resource = false;
m_has_attr_alias = false;
}
@@ -7662,7 +6107,7 @@ DomResourcePixmap::DomResourcePixmap()
m_children = 0;
m_has_attr_resource = false;
m_has_attr_alias = false;
- m_text = QLatin1String("");
+ m_text.clear();
}
DomResourcePixmap::~DomResourcePixmap()
@@ -7674,22 +6119,22 @@ void DomResourcePixmap::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("resource")) {
+ if (name == QStringLiteral("resource")) {
setAttributeResource(attribute.value().toString());
continue;
}
- if (name == QLatin1String("alias")) {
+ if (name == QStringLiteral("alias")) {
setAttributeAlias(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -7705,37 +6150,15 @@ void DomResourcePixmap::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomResourcePixmap::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("resource")))
- setAttributeResource(node.attribute(QLatin1String("resource")));
- if (node.hasAttribute(QLatin1String("alias")))
- setAttributeAlias(node.attribute(QLatin1String("alias")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text = QLatin1String("");
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourcepixmap") : tagName.toLower());
if (hasAttributeResource())
- writer.writeAttribute(QLatin1String("resource"), attributeResource());
+ writer.writeAttribute(QStringLiteral("resource"), attributeResource());
if (hasAttributeAlias())
- writer.writeAttribute(QLatin1String("alias"), attributeAlias());
+ writer.writeAttribute(QStringLiteral("alias"), attributeAlias());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -7755,7 +6178,7 @@ void DomResourceIcon::clear(bool clear_all)
delete m_selectedOn;
if (clear_all) {
- m_text = QLatin1String("");
+ m_text.clear();
m_has_attr_theme = false;
m_has_attr_resource = false;
}
@@ -7776,7 +6199,7 @@ DomResourceIcon::DomResourceIcon()
m_children = 0;
m_has_attr_theme = false;
m_has_attr_resource = false;
- m_text = QLatin1String("");
+ m_text.clear();
m_normalOff = 0;
m_normalOn = 0;
m_disabledOff = 0;
@@ -7804,70 +6227,70 @@ void DomResourceIcon::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("theme")) {
+ if (name == QStringLiteral("theme")) {
setAttributeTheme(attribute.value().toString());
continue;
}
- if (name == QLatin1String("resource")) {
+ if (name == QStringLiteral("resource")) {
setAttributeResource(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("normaloff")) {
+ if (tag == QStringLiteral("normaloff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOff(v);
continue;
}
- if (tag == QLatin1String("normalon")) {
+ if (tag == QStringLiteral("normalon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOn(v);
continue;
}
- if (tag == QLatin1String("disabledoff")) {
+ if (tag == QStringLiteral("disabledoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOff(v);
continue;
}
- if (tag == QLatin1String("disabledon")) {
+ if (tag == QStringLiteral("disabledon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOn(v);
continue;
}
- if (tag == QLatin1String("activeoff")) {
+ if (tag == QStringLiteral("activeoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOff(v);
continue;
}
- if (tag == QLatin1String("activeon")) {
+ if (tag == QStringLiteral("activeon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOn(v);
continue;
}
- if (tag == QLatin1String("selectedoff")) {
+ if (tag == QStringLiteral("selectedoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOff(v);
continue;
}
- if (tag == QLatin1String("selectedon")) {
+ if (tag == QStringLiteral("selectedon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOn(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -7883,116 +6306,46 @@ void DomResourceIcon::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomResourceIcon::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("theme")))
- setAttributeTheme(node.attribute(QLatin1String("theme")));
- if (node.hasAttribute(QLatin1String("resource")))
- setAttributeResource(node.attribute(QLatin1String("resource")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("normaloff")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementNormalOff(v);
- continue;
- }
- if (tag == QLatin1String("normalon")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementNormalOn(v);
- continue;
- }
- if (tag == QLatin1String("disabledoff")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementDisabledOff(v);
- continue;
- }
- if (tag == QLatin1String("disabledon")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementDisabledOn(v);
- continue;
- }
- if (tag == QLatin1String("activeoff")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementActiveOff(v);
- continue;
- }
- if (tag == QLatin1String("activeon")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementActiveOn(v);
- continue;
- }
- if (tag == QLatin1String("selectedoff")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementSelectedOff(v);
- continue;
- }
- if (tag == QLatin1String("selectedon")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementSelectedOn(v);
- continue;
- }
- }
- m_text = QLatin1String("");
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourceicon") : tagName.toLower());
if (hasAttributeTheme())
- writer.writeAttribute(QLatin1String("theme"), attributeTheme());
+ writer.writeAttribute(QStringLiteral("theme"), attributeTheme());
if (hasAttributeResource())
- writer.writeAttribute(QLatin1String("resource"), attributeResource());
+ writer.writeAttribute(QStringLiteral("resource"), attributeResource());
if (m_children & NormalOff) {
- m_normalOff->write(writer, QLatin1String("normaloff"));
+ m_normalOff->write(writer, QStringLiteral("normaloff"));
}
if (m_children & NormalOn) {
- m_normalOn->write(writer, QLatin1String("normalon"));
+ m_normalOn->write(writer, QStringLiteral("normalon"));
}
if (m_children & DisabledOff) {
- m_disabledOff->write(writer, QLatin1String("disabledoff"));
+ m_disabledOff->write(writer, QStringLiteral("disabledoff"));
}
if (m_children & DisabledOn) {
- m_disabledOn->write(writer, QLatin1String("disabledon"));
+ m_disabledOn->write(writer, QStringLiteral("disabledon"));
}
if (m_children & ActiveOff) {
- m_activeOff->write(writer, QLatin1String("activeoff"));
+ m_activeOff->write(writer, QStringLiteral("activeoff"));
}
if (m_children & ActiveOn) {
- m_activeOn->write(writer, QLatin1String("activeon"));
+ m_activeOn->write(writer, QStringLiteral("activeon"));
}
if (m_children & SelectedOff) {
- m_selectedOff->write(writer, QLatin1String("selectedoff"));
+ m_selectedOff->write(writer, QStringLiteral("selectedoff"));
}
if (m_children & SelectedOn) {
- m_selectedOn->write(writer, QLatin1String("selectedon"));
+ m_selectedOn->write(writer, QStringLiteral("selectedon"));
}
if (!m_text.isEmpty())
@@ -8181,7 +6534,7 @@ void DomString::clear(bool clear_all)
{
if (clear_all) {
- m_text = QLatin1String("");
+ m_text.clear();
m_has_attr_notr = false;
m_has_attr_comment = false;
m_has_attr_extraComment = false;
@@ -8196,7 +6549,7 @@ DomString::DomString()
m_has_attr_notr = false;
m_has_attr_comment = false;
m_has_attr_extraComment = false;
- m_text = QLatin1String("");
+ m_text.clear();
}
DomString::~DomString()
@@ -8208,26 +6561,26 @@ void DomString::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("notr")) {
+ if (name == QStringLiteral("notr")) {
setAttributeNotr(attribute.value().toString());
continue;
}
- if (name == QLatin1String("comment")) {
+ if (name == QStringLiteral("comment")) {
setAttributeComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("extracomment")) {
+ if (name == QStringLiteral("extracomment")) {
setAttributeExtraComment(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -8243,42 +6596,18 @@ void DomString::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomString::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("notr")))
- setAttributeNotr(node.attribute(QLatin1String("notr")));
- if (node.hasAttribute(QLatin1String("comment")))
- setAttributeComment(node.attribute(QLatin1String("comment")));
- if (node.hasAttribute(QLatin1String("extracomment")))
- setAttributeExtraComment(node.attribute(QLatin1String("extracomment")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text = QLatin1String("");
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("string") : tagName.toLower());
if (hasAttributeNotr())
- writer.writeAttribute(QLatin1String("notr"), attributeNotr());
+ writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
if (hasAttributeComment())
- writer.writeAttribute(QLatin1String("comment"), attributeComment());
+ writer.writeAttribute(QStringLiteral("comment"), attributeComment());
if (hasAttributeExtraComment())
- writer.writeAttribute(QLatin1String("extracomment"), attributeExtraComment());
+ writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -8324,7 +6653,7 @@ void DomPointF::read(QXmlStreamReader &reader)
setElementY(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -8340,31 +6669,6 @@ void DomPointF::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomPointF::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QString(QLatin1Char('x'))) {
- setElementX(e.text().toDouble());
- continue;
- }
- if (tag == QString(QLatin1Char('y'))) {
- setElementY(e.text().toDouble());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("pointf") : tagName.toLower());
@@ -8447,15 +6751,15 @@ void DomRectF::read(QXmlStreamReader &reader)
setElementY(reader.readElementText().toDouble());
continue;
}
- if (tag == QLatin1String("width")) {
+ if (tag == QStringLiteral("width")) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
- if (tag == QLatin1String("height")) {
+ if (tag == QStringLiteral("height")) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -8471,39 +6775,6 @@ void DomRectF::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomRectF::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QString(QLatin1Char('x'))) {
- setElementX(e.text().toDouble());
- continue;
- }
- if (tag == QString(QLatin1Char('y'))) {
- setElementY(e.text().toDouble());
- continue;
- }
- if (tag == QLatin1String("width")) {
- setElementWidth(e.text().toDouble());
- continue;
- }
- if (tag == QLatin1String("height")) {
- setElementHeight(e.text().toDouble());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rectf") : tagName.toLower());
@@ -8517,11 +6788,11 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
}
if (m_children & Width) {
- writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15));
+ writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15));
}
if (m_children & Height) {
- writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15));
+ writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15));
}
if (!m_text.isEmpty())
@@ -8604,15 +6875,15 @@ void DomSizeF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("width")) {
+ if (tag == QStringLiteral("width")) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
- if (tag == QLatin1String("height")) {
+ if (tag == QStringLiteral("height")) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -8628,41 +6899,16 @@ void DomSizeF::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomSizeF::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("width")) {
- setElementWidth(e.text().toDouble());
- continue;
- }
- if (tag == QLatin1String("height")) {
- setElementHeight(e.text().toDouble());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizef") : tagName.toLower());
if (m_children & Width) {
- writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15));
+ writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15));
}
if (m_children & Height) {
- writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15));
+ writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15));
}
if (!m_text.isEmpty())
@@ -8721,11 +6967,11 @@ void DomChar::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("unicode")) {
+ if (tag == QStringLiteral("unicode")) {
setElementUnicode(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -8741,33 +6987,12 @@ void DomChar::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomChar::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("unicode")) {
- setElementUnicode(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("char") : tagName.toLower());
if (m_children & Unicode) {
- writer.writeTextElement(QLatin1String("unicode"), QString::number(m_unicode));
+ writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode));
}
if (!m_text.isEmpty())
@@ -8817,13 +7042,13 @@ void DomUrl::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("string")) {
+ if (tag == QStringLiteral("string")) {
DomString *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -8839,35 +7064,12 @@ void DomUrl::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomUrl::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("string")) {
- DomString *v = new DomString();
- v->read(e);
- setElementString(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("url") : tagName.toLower());
if (m_children & String) {
- m_string->write(writer, QLatin1String("string"));
+ m_string->write(writer, QStringLiteral("string"));
}
if (!m_text.isEmpty())
@@ -9028,196 +7230,196 @@ void DomProperty::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stdset")) {
+ if (name == QStringLiteral("stdset")) {
setAttributeStdset(attribute.value().toString().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("bool")) {
+ if (tag == QStringLiteral("bool")) {
setElementBool(reader.readElementText());
continue;
}
- if (tag == QLatin1String("color")) {
+ if (tag == QStringLiteral("color")) {
DomColor *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- if (tag == QLatin1String("cstring")) {
+ if (tag == QStringLiteral("cstring")) {
setElementCstring(reader.readElementText());
continue;
}
- if (tag == QLatin1String("cursor")) {
+ if (tag == QStringLiteral("cursor")) {
setElementCursor(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("cursorshape")) {
+ if (tag == QStringLiteral("cursorshape")) {
setElementCursorShape(reader.readElementText());
continue;
}
- if (tag == QLatin1String("enum")) {
+ if (tag == QStringLiteral("enum")) {
setElementEnum(reader.readElementText());
continue;
}
- if (tag == QLatin1String("font")) {
+ if (tag == QStringLiteral("font")) {
DomFont *v = new DomFont();
v->read(reader);
setElementFont(v);
continue;
}
- if (tag == QLatin1String("iconset")) {
+ if (tag == QStringLiteral("iconset")) {
DomResourceIcon *v = new DomResourceIcon();
v->read(reader);
setElementIconSet(v);
continue;
}
- if (tag == QLatin1String("pixmap")) {
+ if (tag == QStringLiteral("pixmap")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementPixmap(v);
continue;
}
- if (tag == QLatin1String("palette")) {
+ if (tag == QStringLiteral("palette")) {
DomPalette *v = new DomPalette();
v->read(reader);
setElementPalette(v);
continue;
}
- if (tag == QLatin1String("point")) {
+ if (tag == QStringLiteral("point")) {
DomPoint *v = new DomPoint();
v->read(reader);
setElementPoint(v);
continue;
}
- if (tag == QLatin1String("rect")) {
+ if (tag == QStringLiteral("rect")) {
DomRect *v = new DomRect();
v->read(reader);
setElementRect(v);
continue;
}
- if (tag == QLatin1String("set")) {
+ if (tag == QStringLiteral("set")) {
setElementSet(reader.readElementText());
continue;
}
- if (tag == QLatin1String("locale")) {
+ if (tag == QStringLiteral("locale")) {
DomLocale *v = new DomLocale();
v->read(reader);
setElementLocale(v);
continue;
}
- if (tag == QLatin1String("sizepolicy")) {
+ if (tag == QStringLiteral("sizepolicy")) {
DomSizePolicy *v = new DomSizePolicy();
v->read(reader);
setElementSizePolicy(v);
continue;
}
- if (tag == QLatin1String("size")) {
+ if (tag == QStringLiteral("size")) {
DomSize *v = new DomSize();
v->read(reader);
setElementSize(v);
continue;
}
- if (tag == QLatin1String("string")) {
+ if (tag == QStringLiteral("string")) {
DomString *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
- if (tag == QLatin1String("stringlist")) {
+ if (tag == QStringLiteral("stringlist")) {
DomStringList *v = new DomStringList();
v->read(reader);
setElementStringList(v);
continue;
}
- if (tag == QLatin1String("number")) {
+ if (tag == QStringLiteral("number")) {
setElementNumber(reader.readElementText().toInt());
continue;
}
- if (tag == QLatin1String("float")) {
+ if (tag == QStringLiteral("float")) {
setElementFloat(reader.readElementText().toFloat());
continue;
}
- if (tag == QLatin1String("double")) {
+ if (tag == QStringLiteral("double")) {
setElementDouble(reader.readElementText().toDouble());
continue;
}
- if (tag == QLatin1String("date")) {
+ if (tag == QStringLiteral("date")) {
DomDate *v = new DomDate();
v->read(reader);
setElementDate(v);
continue;
}
- if (tag == QLatin1String("time")) {
+ if (tag == QStringLiteral("time")) {
DomTime *v = new DomTime();
v->read(reader);
setElementTime(v);
continue;
}
- if (tag == QLatin1String("datetime")) {
+ if (tag == QStringLiteral("datetime")) {
DomDateTime *v = new DomDateTime();
v->read(reader);
setElementDateTime(v);
continue;
}
- if (tag == QLatin1String("pointf")) {
+ if (tag == QStringLiteral("pointf")) {
DomPointF *v = new DomPointF();
v->read(reader);
setElementPointF(v);
continue;
}
- if (tag == QLatin1String("rectf")) {
+ if (tag == QStringLiteral("rectf")) {
DomRectF *v = new DomRectF();
v->read(reader);
setElementRectF(v);
continue;
}
- if (tag == QLatin1String("sizef")) {
+ if (tag == QStringLiteral("sizef")) {
DomSizeF *v = new DomSizeF();
v->read(reader);
setElementSizeF(v);
continue;
}
- if (tag == QLatin1String("longlong")) {
+ if (tag == QStringLiteral("longlong")) {
setElementLongLong(reader.readElementText().toLongLong());
continue;
}
- if (tag == QLatin1String("char")) {
+ if (tag == QStringLiteral("char")) {
DomChar *v = new DomChar();
v->read(reader);
setElementChar(v);
continue;
}
- if (tag == QLatin1String("url")) {
+ if (tag == QStringLiteral("url")) {
DomUrl *v = new DomUrl();
v->read(reader);
setElementUrl(v);
continue;
}
- if (tag == QLatin1String("uint")) {
+ if (tag == QStringLiteral("uint")) {
setElementUInt(reader.readElementText().toUInt());
continue;
}
- if (tag == QLatin1String("ulonglong")) {
+ if (tag == QStringLiteral("ulonglong")) {
setElementULongLong(reader.readElementText().toULongLong());
continue;
}
- if (tag == QLatin1String("brush")) {
+ if (tag == QStringLiteral("brush")) {
DomBrush *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -9233,405 +7435,209 @@ void DomProperty::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomProperty::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
- if (node.hasAttribute(QLatin1String("stdset")))
- setAttributeStdset(node.attribute(QLatin1String("stdset")).toInt());
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("bool")) {
- setElementBool(e.text());
- continue;
- }
- if (tag == QLatin1String("color")) {
- DomColor *v = new DomColor();
- v->read(e);
- setElementColor(v);
- continue;
- }
- if (tag == QLatin1String("cstring")) {
- setElementCstring(e.text());
- continue;
- }
- if (tag == QLatin1String("cursor")) {
- setElementCursor(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("cursorshape")) {
- setElementCursorShape(e.text());
- continue;
- }
- if (tag == QLatin1String("enum")) {
- setElementEnum(e.text());
- continue;
- }
- if (tag == QLatin1String("font")) {
- DomFont *v = new DomFont();
- v->read(e);
- setElementFont(v);
- continue;
- }
- if (tag == QLatin1String("iconset")) {
- DomResourceIcon *v = new DomResourceIcon();
- v->read(e);
- setElementIconSet(v);
- continue;
- }
- if (tag == QLatin1String("pixmap")) {
- DomResourcePixmap *v = new DomResourcePixmap();
- v->read(e);
- setElementPixmap(v);
- continue;
- }
- if (tag == QLatin1String("palette")) {
- DomPalette *v = new DomPalette();
- v->read(e);
- setElementPalette(v);
- continue;
- }
- if (tag == QLatin1String("point")) {
- DomPoint *v = new DomPoint();
- v->read(e);
- setElementPoint(v);
- continue;
- }
- if (tag == QLatin1String("rect")) {
- DomRect *v = new DomRect();
- v->read(e);
- setElementRect(v);
- continue;
- }
- if (tag == QLatin1String("set")) {
- setElementSet(e.text());
- continue;
- }
- if (tag == QLatin1String("locale")) {
- DomLocale *v = new DomLocale();
- v->read(e);
- setElementLocale(v);
- continue;
- }
- if (tag == QLatin1String("sizepolicy")) {
- DomSizePolicy *v = new DomSizePolicy();
- v->read(e);
- setElementSizePolicy(v);
- continue;
- }
- if (tag == QLatin1String("size")) {
- DomSize *v = new DomSize();
- v->read(e);
- setElementSize(v);
- continue;
- }
- if (tag == QLatin1String("string")) {
- DomString *v = new DomString();
- v->read(e);
- setElementString(v);
- continue;
- }
- if (tag == QLatin1String("stringlist")) {
- DomStringList *v = new DomStringList();
- v->read(e);
- setElementStringList(v);
- continue;
- }
- if (tag == QLatin1String("number")) {
- setElementNumber(e.text().toInt());
- continue;
- }
- if (tag == QLatin1String("float")) {
- setElementFloat(e.text().toFloat());
- continue;
- }
- if (tag == QLatin1String("double")) {
- setElementDouble(e.text().toDouble());
- continue;
- }
- if (tag == QLatin1String("date")) {
- DomDate *v = new DomDate();
- v->read(e);
- setElementDate(v);
- continue;
- }
- if (tag == QLatin1String("time")) {
- DomTime *v = new DomTime();
- v->read(e);
- setElementTime(v);
- continue;
- }
- if (tag == QLatin1String("datetime")) {
- DomDateTime *v = new DomDateTime();
- v->read(e);
- setElementDateTime(v);
- continue;
- }
- if (tag == QLatin1String("pointf")) {
- DomPointF *v = new DomPointF();
- v->read(e);
- setElementPointF(v);
- continue;
- }
- if (tag == QLatin1String("rectf")) {
- DomRectF *v = new DomRectF();
- v->read(e);
- setElementRectF(v);
- continue;
- }
- if (tag == QLatin1String("sizef")) {
- DomSizeF *v = new DomSizeF();
- v->read(e);
- setElementSizeF(v);
- continue;
- }
- if (tag == QLatin1String("longlong")) {
- setElementLongLong(e.text().toLongLong());
- continue;
- }
- if (tag == QLatin1String("char")) {
- DomChar *v = new DomChar();
- v->read(e);
- setElementChar(v);
- continue;
- }
- if (tag == QLatin1String("url")) {
- DomUrl *v = new DomUrl();
- v->read(e);
- setElementUrl(v);
- continue;
- }
- if (tag == QLatin1String("uint")) {
- setElementUInt(e.text().toUInt());
- continue;
- }
- if (tag == QLatin1String("ulonglong")) {
- setElementULongLong(e.text().toULongLong());
- continue;
- }
- if (tag == QLatin1String("brush")) {
- DomBrush *v = new DomBrush();
- v->read(e);
- setElementBrush(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("property") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (hasAttributeStdset())
- writer.writeAttribute(QLatin1String("stdset"), QString::number(attributeStdset()));
+ writer.writeAttribute(QStringLiteral("stdset"), QString::number(attributeStdset()));
switch (kind()) {
case Bool: {
- writer.writeTextElement(QLatin1String("bool"), elementBool());
+ writer.writeTextElement(QStringLiteral("bool"), elementBool());
break;
}
case Color: {
DomColor* v = elementColor();
if (v != 0) {
- v->write(writer, QLatin1String("color"));
+ v->write(writer, QStringLiteral("color"));
}
break;
}
case Cstring: {
- writer.writeTextElement(QLatin1String("cstring"), elementCstring());
+ writer.writeTextElement(QStringLiteral("cstring"), elementCstring());
break;
}
case Cursor: {
- writer.writeTextElement(QLatin1String("cursor"), QString::number(elementCursor()));
+ writer.writeTextElement(QStringLiteral("cursor"), QString::number(elementCursor()));
break;
}
case CursorShape: {
- writer.writeTextElement(QLatin1String("cursorShape"), elementCursorShape());
+ writer.writeTextElement(QStringLiteral("cursorShape"), elementCursorShape());
break;
}
case Enum: {
- writer.writeTextElement(QLatin1String("enum"), elementEnum());
+ writer.writeTextElement(QStringLiteral("enum"), elementEnum());
break;
}
case Font: {
DomFont* v = elementFont();
if (v != 0) {
- v->write(writer, QLatin1String("font"));
+ v->write(writer, QStringLiteral("font"));
}
break;
}
case IconSet: {
DomResourceIcon* v = elementIconSet();
if (v != 0) {
- v->write(writer, QLatin1String("iconset"));
+ v->write(writer, QStringLiteral("iconset"));
}
break;
}
case Pixmap: {
DomResourcePixmap* v = elementPixmap();
if (v != 0) {
- v->write(writer, QLatin1String("pixmap"));
+ v->write(writer, QStringLiteral("pixmap"));
}
break;
}
case Palette: {
DomPalette* v = elementPalette();
if (v != 0) {
- v->write(writer, QLatin1String("palette"));
+ v->write(writer, QStringLiteral("palette"));
}
break;
}
case Point: {
DomPoint* v = elementPoint();
if (v != 0) {
- v->write(writer, QLatin1String("point"));
+ v->write(writer, QStringLiteral("point"));
}
break;
}
case Rect: {
DomRect* v = elementRect();
if (v != 0) {
- v->write(writer, QLatin1String("rect"));
+ v->write(writer, QStringLiteral("rect"));
}
break;
}
case Set: {
- writer.writeTextElement(QLatin1String("set"), elementSet());
+ writer.writeTextElement(QStringLiteral("set"), elementSet());
break;
}
case Locale: {
DomLocale* v = elementLocale();
if (v != 0) {
- v->write(writer, QLatin1String("locale"));
+ v->write(writer, QStringLiteral("locale"));
}
break;
}
case SizePolicy: {
DomSizePolicy* v = elementSizePolicy();
if (v != 0) {
- v->write(writer, QLatin1String("sizepolicy"));
+ v->write(writer, QStringLiteral("sizepolicy"));
}
break;
}
case Size: {
DomSize* v = elementSize();
if (v != 0) {
- v->write(writer, QLatin1String("size"));
+ v->write(writer, QStringLiteral("size"));
}
break;
}
case String: {
DomString* v = elementString();
if (v != 0) {
- v->write(writer, QLatin1String("string"));
+ v->write(writer, QStringLiteral("string"));
}
break;
}
case StringList: {
DomStringList* v = elementStringList();
if (v != 0) {
- v->write(writer, QLatin1String("stringlist"));
+ v->write(writer, QStringLiteral("stringlist"));
}
break;
}
case Number: {
- writer.writeTextElement(QLatin1String("number"), QString::number(elementNumber()));
+ writer.writeTextElement(QStringLiteral("number"), QString::number(elementNumber()));
break;
}
case Float: {
- writer.writeTextElement(QLatin1String("float"), QString::number(elementFloat(), 'f', 8));
+ writer.writeTextElement(QStringLiteral("float"), QString::number(elementFloat(), 'f', 8));
break;
}
case Double: {
- writer.writeTextElement(QLatin1String("double"), QString::number(elementDouble(), 'f', 15));
+ writer.writeTextElement(QStringLiteral("double"), QString::number(elementDouble(), 'f', 15));
break;
}
case Date: {
DomDate* v = elementDate();
if (v != 0) {
- v->write(writer, QLatin1String("date"));
+ v->write(writer, QStringLiteral("date"));
}
break;
}
case Time: {
DomTime* v = elementTime();
if (v != 0) {
- v->write(writer, QLatin1String("time"));
+ v->write(writer, QStringLiteral("time"));
}
break;
}
case DateTime: {
DomDateTime* v = elementDateTime();
if (v != 0) {
- v->write(writer, QLatin1String("datetime"));
+ v->write(writer, QStringLiteral("datetime"));
}
break;
}
case PointF: {
DomPointF* v = elementPointF();
if (v != 0) {
- v->write(writer, QLatin1String("pointf"));
+ v->write(writer, QStringLiteral("pointf"));
}
break;
}
case RectF: {
DomRectF* v = elementRectF();
if (v != 0) {
- v->write(writer, QLatin1String("rectf"));
+ v->write(writer, QStringLiteral("rectf"));
}
break;
}
case SizeF: {
DomSizeF* v = elementSizeF();
if (v != 0) {
- v->write(writer, QLatin1String("sizef"));
+ v->write(writer, QStringLiteral("sizef"));
}
break;
}
case LongLong: {
- writer.writeTextElement(QLatin1String("longLong"), QString::number(elementLongLong()));
+ writer.writeTextElement(QStringLiteral("longLong"), QString::number(elementLongLong()));
break;
}
case Char: {
DomChar* v = elementChar();
if (v != 0) {
- v->write(writer, QLatin1String("char"));
+ v->write(writer, QStringLiteral("char"));
}
break;
}
case Url: {
DomUrl* v = elementUrl();
if (v != 0) {
- v->write(writer, QLatin1String("url"));
+ v->write(writer, QStringLiteral("url"));
}
break;
}
case UInt: {
- writer.writeTextElement(QLatin1String("UInt"), QString::number(elementUInt()));
+ writer.writeTextElement(QStringLiteral("UInt"), QString::number(elementUInt()));
break;
}
case ULongLong: {
- writer.writeTextElement(QLatin1String("uLongLong"), QString::number(elementULongLong()));
+ writer.writeTextElement(QStringLiteral("uLongLong"), QString::number(elementULongLong()));
break;
}
case Brush: {
DomBrush* v = elementBrush();
if (v != 0) {
- v->write(writer, QLatin1String("brush"));
+ v->write(writer, QStringLiteral("brush"));
}
break;
}
@@ -10052,13 +8058,13 @@ void DomConnections::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("connection")) {
+ if (tag == QStringLiteral("connection")) {
DomConnection *v = new DomConnection();
v->read(reader);
m_connection.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10074,36 +8080,13 @@ void DomConnections::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomConnections::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("connection")) {
- DomConnection *v = new DomConnection();
- v->read(e);
- m_connection.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connections") : tagName.toLower());
for (int i = 0; i < m_connection.size(); ++i) {
DomConnection* v = m_connection[i];
- v->write(writer, QLatin1String("connection"));
+ v->write(writer, QStringLiteral("connection"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -10147,29 +8130,29 @@ void DomConnection::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("sender")) {
+ if (tag == QStringLiteral("sender")) {
setElementSender(reader.readElementText());
continue;
}
- if (tag == QLatin1String("signal")) {
+ if (tag == QStringLiteral("signal")) {
setElementSignal(reader.readElementText());
continue;
}
- if (tag == QLatin1String("receiver")) {
+ if (tag == QStringLiteral("receiver")) {
setElementReceiver(reader.readElementText());
continue;
}
- if (tag == QLatin1String("slot")) {
+ if (tag == QStringLiteral("slot")) {
setElementSlot(reader.readElementText());
continue;
}
- if (tag == QLatin1String("hints")) {
+ if (tag == QStringLiteral("hints")) {
DomConnectionHints *v = new DomConnectionHints();
v->read(reader);
setElementHints(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10185,67 +8168,28 @@ void DomConnection::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomConnection::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("sender")) {
- setElementSender(e.text());
- continue;
- }
- if (tag == QLatin1String("signal")) {
- setElementSignal(e.text());
- continue;
- }
- if (tag == QLatin1String("receiver")) {
- setElementReceiver(e.text());
- continue;
- }
- if (tag == QLatin1String("slot")) {
- setElementSlot(e.text());
- continue;
- }
- if (tag == QLatin1String("hints")) {
- DomConnectionHints *v = new DomConnectionHints();
- v->read(e);
- setElementHints(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connection") : tagName.toLower());
if (m_children & Sender) {
- writer.writeTextElement(QLatin1String("sender"), m_sender);
+ writer.writeTextElement(QStringLiteral("sender"), m_sender);
}
if (m_children & Signal) {
- writer.writeTextElement(QLatin1String("signal"), m_signal);
+ writer.writeTextElement(QStringLiteral("signal"), m_signal);
}
if (m_children & Receiver) {
- writer.writeTextElement(QLatin1String("receiver"), m_receiver);
+ writer.writeTextElement(QStringLiteral("receiver"), m_receiver);
}
if (m_children & Slot) {
- writer.writeTextElement(QLatin1String("slot"), m_slot);
+ writer.writeTextElement(QStringLiteral("slot"), m_slot);
}
if (m_children & Hints) {
- m_hints->write(writer, QLatin1String("hints"));
+ m_hints->write(writer, QStringLiteral("hints"));
}
if (!m_text.isEmpty())
@@ -10350,13 +8294,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("hint")) {
+ if (tag == QStringLiteral("hint")) {
DomConnectionHint *v = new DomConnectionHint();
v->read(reader);
m_hint.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10372,36 +8316,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomConnectionHints::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("hint")) {
- DomConnectionHint *v = new DomConnectionHint();
- v->read(e);
- m_hint.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhints") : tagName.toLower());
for (int i = 0; i < m_hint.size(); ++i) {
DomConnectionHint* v = m_hint[i];
- v->write(writer, QLatin1String("hint"));
+ v->write(writer, QStringLiteral("hint"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -10445,11 +8366,11 @@ void DomConnectionHint::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("type")) {
+ if (name == QStringLiteral("type")) {
setAttributeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
@@ -10464,7 +8385,7 @@ void DomConnectionHint::read(QXmlStreamReader &reader)
setElementY(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10480,40 +8401,12 @@ void DomConnectionHint::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomConnectionHint::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("type")))
- setAttributeType(node.attribute(QLatin1String("type")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QString(QLatin1Char('x'))) {
- setElementX(e.text().toInt());
- continue;
- }
- if (tag == QString(QLatin1Char('y'))) {
- setElementY(e.text().toInt());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhint") : tagName.toLower());
if (hasAttributeType())
- writer.writeAttribute(QLatin1String("type"), attributeType());
+ writer.writeAttribute(QStringLiteral("type"), attributeType());
if (m_children & X) {
writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
@@ -10579,22 +8472,22 @@ void DomScript::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("source")) {
+ if (name == QStringLiteral("source")) {
setAttributeSource(attribute.value().toString());
continue;
}
- if (name == QLatin1String("language")) {
+ if (name == QStringLiteral("language")) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10610,37 +8503,15 @@ void DomScript::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomScript::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("source")))
- setAttributeSource(node.attribute(QLatin1String("source")));
- if (node.hasAttribute(QLatin1String("language")))
- setAttributeLanguage(node.attribute(QLatin1String("language")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("script") : tagName.toLower());
if (hasAttributeSource())
- writer.writeAttribute(QLatin1String("source"), attributeSource());
+ writer.writeAttribute(QStringLiteral("source"), attributeSource());
if (hasAttributeLanguage())
- writer.writeAttribute(QLatin1String("language"), attributeLanguage());
+ writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -10678,13 +8549,13 @@ void DomWidgetData::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10700,36 +8571,13 @@ void DomWidgetData::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomWidgetData::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widgetdata") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -10773,13 +8621,13 @@ void DomDesignerData::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("property")) {
+ if (tag == QStringLiteral("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10795,36 +8643,13 @@ void DomDesignerData::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomDesignerData::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("property")) {
- DomProperty *v = new DomProperty();
- v->read(e);
- m_property.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("designerdata") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
- v->write(writer, QLatin1String("property"));
+ v->write(writer, QStringLiteral("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -10868,15 +8693,15 @@ void DomSlots::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("signal")) {
+ if (tag == QStringLiteral("signal")) {
m_signal.append(reader.readElementText());
continue;
}
- if (tag == QLatin1String("slot")) {
+ if (tag == QStringLiteral("slot")) {
m_slot.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10892,42 +8717,17 @@ void DomSlots::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomSlots::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("signal")) {
- m_signal.append(e.text());
- continue;
- }
- if (tag == QLatin1String("slot")) {
- m_slot.append(e.text());
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("slots") : tagName.toLower());
for (int i = 0; i < m_signal.size(); ++i) {
QString v = m_signal[i];
- writer.writeTextElement(QLatin1String("signal"), v);
+ writer.writeTextElement(QStringLiteral("signal"), v);
}
for (int i = 0; i < m_slot.size(); ++i) {
QString v = m_slot[i];
- writer.writeTextElement(QLatin1String("slot"), v);
+ writer.writeTextElement(QStringLiteral("slot"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -10977,13 +8777,13 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- if (tag == QLatin1String("stringpropertyspecification")) {
+ if (tag == QStringLiteral("stringpropertyspecification")) {
DomStringPropertySpecification *v = new DomStringPropertySpecification();
v->read(reader);
m_stringpropertyspecification.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -10999,36 +8799,13 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomPropertySpecifications::read(const QDomElement &node)
-{
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- if (tag == QLatin1String("stringpropertyspecification")) {
- DomStringPropertySpecification *v = new DomStringPropertySpecification();
- v->read(e);
- m_stringpropertyspecification.append(v);
- continue;
- }
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower());
for (int i = 0; i < m_stringpropertyspecification.size(); ++i) {
DomStringPropertySpecification* v = m_stringpropertyspecification[i];
- v->write(writer, QLatin1String("stringpropertyspecification"));
+ v->write(writer, QStringLiteral("stringpropertyspecification"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -11072,26 +8849,26 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == QStringLiteral("name")) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("type")) {
+ if (name == QStringLiteral("type")) {
setAttributeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("notr")) {
+ if (name == QStringLiteral("notr")) {
setAttributeNotr(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
+ reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError(QStringLiteral("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -11107,42 +8884,18 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader)
}
}
-#ifdef QUILOADER_QDOM_READ
-void DomStringPropertySpecification::read(const QDomElement &node)
-{
- if (node.hasAttribute(QLatin1String("name")))
- setAttributeName(node.attribute(QLatin1String("name")));
- if (node.hasAttribute(QLatin1String("type")))
- setAttributeType(node.attribute(QLatin1String("type")));
- if (node.hasAttribute(QLatin1String("notr")))
- setAttributeNotr(node.attribute(QLatin1String("notr")));
-
- for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
- if (!n.isElement())
- continue;
- QDomElement e = n.toElement();
- QString tag = e.tagName().toLower();
- }
- m_text.clear();
- for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
- if (child.isText())
- m_text.append(child.nodeValue());
- }
-}
-#endif
-
void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QLatin1String("name"), attributeName());
+ writer.writeAttribute(QStringLiteral("name"), attributeName());
if (hasAttributeType())
- writer.writeAttribute(QLatin1String("type"), attributeType());
+ writer.writeAttribute(QStringLiteral("type"), attributeType());
if (hasAttributeNotr())
- writer.writeAttribute(QLatin1String("notr"), attributeNotr());
+ writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h
index 8d7f108065..6a56c9eadc 100644
--- a/src/tools/uic/ui4.h
+++ b/src/tools/uic/ui4.h
@@ -62,17 +62,8 @@
#include <QtCore/QXmlStreamWriter>
#include <QtCore/qglobal.h>
-#if defined(QT_UIC3)
- #define QUILOADER_QDOM_READ
-#endif
-
QT_BEGIN_NAMESPACE
-#ifdef QUILOADER_QDOM_READ
- class QDomElement;
-#endif
-
-
#define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT
#define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT
@@ -174,9 +165,6 @@ public:
~DomUI();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -374,9 +362,6 @@ public:
~DomIncludes();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -408,9 +393,6 @@ public:
~DomInclude();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -451,9 +433,6 @@ public:
~DomResources();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -493,9 +472,6 @@ public:
~DomResource();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -528,9 +504,6 @@ public:
~DomActionGroup();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -585,9 +558,6 @@ public:
~DomAction();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -640,9 +610,6 @@ public:
~DomActionRef();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -675,9 +642,6 @@ public:
~DomButtonGroup();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -722,9 +686,6 @@ public:
~DomButtonGroups();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -756,9 +717,6 @@ public:
~DomImages();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -790,9 +748,6 @@ public:
~DomImage();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -835,9 +790,6 @@ public:
~DomImageData();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -878,9 +830,6 @@ public:
~DomCustomWidgets();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -912,9 +861,6 @@ public:
~DomHeader();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -947,9 +893,6 @@ public:
~DomCustomWidget();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1067,9 +1010,6 @@ public:
~DomProperties();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1101,9 +1041,6 @@ public:
~DomPropertyData();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1136,9 +1073,6 @@ public:
~DomSizePolicyData();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1179,9 +1113,6 @@ public:
~DomLayoutDefault();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1222,9 +1153,6 @@ public:
~DomLayoutFunction();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1265,9 +1193,6 @@ public:
~DomTabStops();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1299,9 +1224,6 @@ public:
~DomLayout();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1399,9 +1321,6 @@ public:
~DomLayoutItem();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1484,9 +1403,6 @@ public:
~DomRow();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1518,9 +1434,6 @@ public:
~DomColumn();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1552,9 +1465,6 @@ public:
~DomItem();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1607,9 +1517,6 @@ public:
~DomWidget();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1730,9 +1637,6 @@ public:
~DomSpacer();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1772,9 +1676,6 @@ public:
~DomColor();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1830,9 +1731,6 @@ public:
~DomGradientStop();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -1875,9 +1773,6 @@ public:
~DomGradient();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2013,9 +1908,6 @@ public:
~DomBrush();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2066,9 +1958,6 @@ public:
~DomColorRole();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2111,9 +2000,6 @@ public:
~DomColorGroup();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2150,9 +2036,6 @@ public:
~DomPalette();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2203,9 +2086,6 @@ public:
~DomFont();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2302,9 +2182,6 @@ public:
~DomPoint();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2345,9 +2222,6 @@ public:
~DomRect();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2402,9 +2276,6 @@ public:
~DomLocale();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2445,9 +2316,6 @@ public:
~DomSizePolicy();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2518,9 +2386,6 @@ public:
~DomSize();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2561,9 +2426,6 @@ public:
~DomDate();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2611,9 +2473,6 @@ public:
~DomTime();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2661,9 +2520,6 @@ public:
~DomDateTime();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2732,9 +2588,6 @@ public:
~DomStringList();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2766,9 +2619,6 @@ public:
~DomResourcePixmap();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2809,9 +2659,6 @@ public:
~DomResourceIcon();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2918,9 +2765,6 @@ public:
~DomString();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -2969,9 +2813,6 @@ public:
~DomPointF();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3012,9 +2853,6 @@ public:
~DomRectF();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3069,9 +2907,6 @@ public:
~DomSizeF();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3112,9 +2947,6 @@ public:
~DomChar();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3148,9 +2980,6 @@ public:
~DomUrl();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3185,9 +3014,6 @@ public:
~DomProperty();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3384,9 +3210,6 @@ public:
~DomConnections();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3418,9 +3241,6 @@ public:
~DomConnection();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3483,9 +3303,6 @@ public:
~DomConnectionHints();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3517,9 +3334,6 @@ public:
~DomConnectionHint();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3568,9 +3382,6 @@ public:
~DomScript();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3611,9 +3422,6 @@ public:
~DomWidgetData();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3645,9 +3453,6 @@ public:
~DomDesignerData();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3679,9 +3484,6 @@ public:
~DomSlots();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3718,9 +3520,6 @@ public:
~DomPropertySpecifications();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
@@ -3752,9 +3551,6 @@ public:
~DomStringPropertySpecification();
void read(QXmlStreamReader &reader);
-#ifdef QUILOADER_QDOM_READ
- void read(const QDomElement &node);
-#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; }
diff --git a/src/uitools/uitools.pro b/src/uitools/uitools.pro
index 3f9f166dbd..be8c9c88a1 100644
--- a/src/uitools/uitools.pro
+++ b/src/uitools/uitools.pro
@@ -1,7 +1,7 @@
QPRO_PWD = $$PWD
TEMPLATE = lib
TARGET = $$qtLibraryTarget(QtUiTools)
-QT = core xml
+QT = core
CONFIG += qt staticlib module
MODULE = uitools
@@ -56,5 +56,4 @@ unix|win32-g++* {
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
- QMAKE_PKGCONFIG_REQUIRES += QtXml
}
diff --git a/src/widgets/accessible/qaccessible.cpp b/src/widgets/accessible/qaccessible.cpp
index 337bb9992d..10e5785cd5 100644
--- a/src/widgets/accessible/qaccessible.cpp
+++ b/src/widgets/accessible/qaccessible.cpp
@@ -1048,6 +1048,11 @@ const QAccessibleInterface *other, int otherChild) const
*/
/*!
+ \fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface()
+ \internal
+*/
+
+/*!
\fn QAccessibleActionInterface *QAccessibleInterface::actionInterface()
\internal
*/
diff --git a/src/widgets/accessible/qaccessible.h b/src/widgets/accessible/qaccessible.h
index 517dac492b..312e2a3088 100644
--- a/src/widgets/accessible/qaccessible.h
+++ b/src/widgets/accessible/qaccessible.h
@@ -151,6 +151,7 @@ public:
ReadOnly = 0x00000040,
HotTracked = 0x00000080,
DefaultButton = 0x00000100,
+ // #### Qt5 Expandable
Expanded = 0x00000200,
Collapsed = 0x00000400,
Busy = 0x00000800,
@@ -175,6 +176,8 @@ public:
HasPopup = 0x40000000,
Modal = 0x80000000,
+ // #### Qt5 ManagesDescendants
+ // #### Qt5 remove HasInvokeExtension
HasInvokeExtension = 0x10000000 // internal
};
Q_DECLARE_FLAGS(State, StateFlag)
@@ -345,7 +348,8 @@ namespace QAccessible2
ValueInterface,
TableInterface,
ActionInterface,
- ImageInterface
+ ImageInterface,
+ Table2Interface
};
}
@@ -356,6 +360,7 @@ class QAccessibleValueInterface;
class QAccessibleTableInterface;
class QAccessibleActionInterface;
class QAccessibleImageInterface;
+class QAccessibleTable2Interface;
class Q_WIDGETS_EXPORT QAccessibleInterface : public QAccessible
{
@@ -419,6 +424,9 @@ public:
inline QAccessibleImageInterface *imageInterface()
{ return reinterpret_cast<QAccessibleImageInterface *>(cast_helper(QAccessible2::ImageInterface)); }
+ inline QAccessibleTable2Interface *table2Interface()
+ { return reinterpret_cast<QAccessibleTable2Interface *>(cast_helper(QAccessible2::Table2Interface)); }
+
private:
QAccessible2Interface *cast_helper(QAccessible2::InterfaceType);
};
diff --git a/src/widgets/accessible/qaccessible2.cpp b/src/widgets/accessible/qaccessible2.cpp
index 35b24f6e24..078ff13e2c 100644
--- a/src/widgets/accessible/qaccessible2.cpp
+++ b/src/widgets/accessible/qaccessible2.cpp
@@ -42,6 +42,7 @@
#include "qaccessible2.h"
#include "qapplication.h"
#include "qclipboard.h"
+#include "qtextboundaryfinder.h"
#ifndef QT_NO_ACCESSIBILITY
@@ -132,6 +133,117 @@ QT_BEGIN_NAMESPACE
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
+
+/*!
+ \internal
+*/
+QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text)
+{
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = text.length();
+ return text;
+ }
+
+ QTextBoundaryFinder boundary(type, text);
+ boundary.setPosition(offset);
+
+ if (!boundary.isAtBoundary()) {
+ boundary.toPreviousBoundary();
+ }
+ boundary.toPreviousBoundary();
+ *startOffset = boundary.position();
+ boundary.toNextBoundary();
+ *endOffset = boundary.position();
+
+ return text.mid(*startOffset, *endOffset - *startOffset);
+}
+
+/*!
+ \internal
+*/
+QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text)
+{
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = text.length();
+ return text;
+ }
+
+ QTextBoundaryFinder boundary(type, text);
+ boundary.setPosition(offset);
+
+ boundary.toNextBoundary();
+ *startOffset = boundary.position();
+ boundary.toNextBoundary();
+ *endOffset = boundary.position();
+
+ return text.mid(*startOffset, *endOffset - *startOffset);
+}
+
+/*!
+ \internal
+*/
+QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset, const QString& text)
+{
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = text.length();
+ return text;
+ }
+
+ QTextBoundaryFinder boundary(type, text);
+ boundary.setPosition(offset);
+
+ if (!boundary.isAtBoundary()) {
+ boundary.toPreviousBoundary();
+ }
+ *startOffset = boundary.position();
+ boundary.toNextBoundary();
+ *endOffset = boundary.position();
+
+ return text.mid(*startOffset, *endOffset - *startOffset);
+}
+
QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface(
QAccessibleInterface *accessibleInterface)
: iface(accessibleInterface)
diff --git a/src/widgets/accessible/qaccessible2.h b/src/widgets/accessible/qaccessible2.h
index 1f18ac5501..69c19499c2 100644
--- a/src/widgets/accessible/qaccessible2.h
+++ b/src/widgets/accessible/qaccessible2.h
@@ -52,6 +52,8 @@ QT_MODULE(Gui)
#ifndef QT_NO_ACCESSIBILITY
+class QModelIndex;
+
namespace QAccessible2
{
enum CoordinateType
@@ -68,6 +70,24 @@ namespace QAccessible2
LineBoundary,
NoBoundary
};
+
+ enum TableModelChangeType {
+ TableModelChangeInsert,
+ TableModelChangeDelete,
+ TableModelChangeUpdate
+ };
+
+ struct TableModelChange {
+ int firstColumn;
+ int firstRow;
+ int lastColumn;
+ int lastRow;
+ TableModelChangeType type;
+
+ TableModelChange()
+ : firstColumn(0), firstRow(0), lastColumn(0), lastRow(0), type(TableModelChangeUpdate)
+ {}
+ };
}
class Q_WIDGETS_EXPORT QAccessible2Interface
@@ -83,6 +103,7 @@ inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
+inline QAccessible2Interface *qAccessibleTable2CastHelper() { return 0; }
#define Q_ACCESSIBLE_OBJECT \
public: \
@@ -101,6 +122,8 @@ inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
return qAccessibleActionCastHelper(); \
case QAccessible2::ImageInterface: \
return qAccessibleImageCastHelper(); \
+ case QAccessible2::Table2Interface: \
+ return qAccessibleTable2CastHelper(); \
} \
return 0; \
} \
@@ -214,6 +237,95 @@ public:
int *columnSpan, bool *isSelected) = 0;
};
+class Q_WIDGETS_EXPORT QAccessibleTable2CellInterface: public QAccessibleInterface
+{
+public:
+ // Returns the number of columns occupied by this cell accessible.
+ virtual int columnExtent() const = 0;
+
+ // Returns the column headers as an array of cell accessibles.
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const = 0;
+
+ // Translates this cell accessible into the corresponding column index.
+ virtual int columnIndex() const = 0;
+ // Returns the number of rows occupied by this cell accessible.
+ virtual int rowExtent() const = 0;
+ // Returns the row headers as an array of cell accessibles.
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const = 0;
+ // Translates this cell accessible into the corresponding row index.
+ virtual int rowIndex() const = 0;
+ // Returns a boolean value indicating whether this cell is selected.
+ virtual bool isSelected() const = 0;
+
+ // Gets the row and column indexes and extents of this cell accessible and whether or not it is selected.
+ virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0;
+ // Returns a reference to the accessbile of the containing table.
+ virtual QAccessibleTable2Interface* table() const = 0;
+
+ // #### Qt5 this should not be here but part of the state
+ virtual bool isExpandable() const = 0;
+};
+
+class Q_WIDGETS_EXPORT QAccessibleTable2Interface: public QAccessible2Interface
+{
+public:
+ inline QAccessible2Interface *qAccessibleTable2CastHelper() { return this; }
+
+ // Returns the cell at the specified row and column in the table.
+ virtual QAccessibleTable2CellInterface *cellAt (int row, int column) const = 0;
+ // Returns the caption for the table.
+ virtual QAccessibleInterface *caption() const = 0;
+ // Returns the description text of the specified column in the table.
+ virtual QString columnDescription(int column) const = 0;
+ // Returns the total number of columns in table.
+ virtual int columnCount() const = 0;
+ // Returns the total number of rows in table.
+ virtual int rowCount() const = 0;
+ // Returns the total number of selected cells.
+ virtual int selectedCellCount() const = 0;
+ // Returns the total number of selected columns.
+ virtual int selectedColumnCount() const = 0;
+ // Returns the total number of selected rows.
+ virtual int selectedRowCount() const = 0;
+ // Returns the description text of the specified row in the table.
+ virtual QString rowDescription(int row) const = 0;
+ // Returns a list of accessibles currently selected.
+ virtual QList<QAccessibleTable2CellInterface*> selectedCells() const = 0;
+ // Returns a list of column indexes currently selected (0 based).
+ virtual QList<int> selectedColumns() const = 0;
+ // Returns a list of row indexes currently selected (0 based).
+ virtual QList<int> selectedRows() const = 0;
+ // Returns the summary description of the table.
+ virtual QAccessibleInterface *summary() const = 0;
+ // Returns a boolean value indicating whether the specified column is completely selected.
+ virtual bool isColumnSelected(int column) const = 0;
+ // Returns a boolean value indicating whether the specified row is completely selected.
+ virtual bool isRowSelected(int row) const = 0;
+ // Selects a row and unselects all previously selected rows.
+ virtual bool selectRow(int row) = 0;
+ // Selects a column and unselects all previously selected columns.
+ virtual bool selectColumn(int column) = 0;
+ // Unselects one row, leaving other selected rows selected (if any).
+ virtual bool unselectRow(int row) = 0;
+ // Unselects one column, leaving other selected columns selected (if any).
+ virtual bool unselectColumn(int column) = 0;
+ // Returns the type and extents describing how a table changed.
+ virtual QAccessible2::TableModelChange modelChange() const = 0;
+
+protected:
+ // These functions are called when the model changes.
+ virtual void modelReset() = 0;
+ virtual void rowsInserted(const QModelIndex &parent, int first, int last) = 0;
+ virtual void rowsRemoved(const QModelIndex &parent, int first, int last) = 0;
+ virtual void columnsInserted(const QModelIndex &parent, int first, int last) = 0;
+ virtual void columnsRemoved(const QModelIndex &parent, int first, int last) = 0;
+ virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) = 0;
+ virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column) = 0;
+
+friend class QAbstractItemView;
+friend class QAbstractItemViewPrivate;
+};
+
class Q_WIDGETS_EXPORT QAccessibleActionInterface : public QAccessible2Interface
{
public:
diff --git a/src/widgets/accessible/qaccessible_mac.mm b/src/widgets/accessible/qaccessible_mac.mm
index 432b536577..a250730493 100644
--- a/src/widgets/accessible/qaccessible_mac.mm
+++ b/src/widgets/accessible/qaccessible_mac.mm
@@ -2427,7 +2427,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
}
// There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored
- // and isItIntersting which will mark the HIObject accociated with the element as ignored if the
+ // and isItInteresting which will mark the HIObject accociated with the element as ignored if the
// QAccessible::Invisible state bit is set.
QAInterface interface = accessibleHierarchyManager()->lookup(element);
if (interface.isValid()) {
diff --git a/src/widgets/accessible/qaccessible_unix.cpp b/src/widgets/accessible/qaccessible_unix.cpp
index a6b7ec3345..19fbe78301 100644
--- a/src/widgets/accessible/qaccessible_unix.cpp
+++ b/src/widgets/accessible/qaccessible_unix.cpp
@@ -103,6 +103,17 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (!iface)
return;
+ // updates for List/Table/Tree should send child
+ if (who) {
+ QAccessibleInterface *child;
+ iface->navigate(QAccessible::Child, who, &child);
+ if (child) {
+ delete iface;
+ iface = child;
+ who = 0;
+ }
+ }
+
for (int i = 0; i < bridges()->count(); ++i)
bridges()->at(i)->notifyAccessibilityUpdate(reason, iface, who);
delete iface;
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 9605e38c5a..05948dcc9c 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -704,13 +704,16 @@ int QAccessibleWidget::navigate(RelationFlag relation, int entry,
int sibCount = pIface->childCount();
QAccessibleInterface *candidate = 0;
for (int i = 0; i < sibCount && entry; ++i) {
- pIface->navigate(Child, i+1, &candidate);
- Q_ASSERT(candidate);
- if (candidate->relationTo(0, this, 0) & Label)
+ const int childId = pIface->navigate(Child, i+1, &candidate);
+ Q_ASSERT(childId >= 0);
+ if (childId > 0)
+ candidate = pIface;
+ if (candidate->relationTo(childId, this, 0) & Label)
--entry;
if (!entry)
break;
- delete candidate;
+ if (candidate != pIface)
+ delete candidate;
candidate = 0;
}
if (!candidate) {
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 7070d49579..c0f6339deb 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1171,24 +1171,26 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
// Update focus scope item ptr in new scope.
QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
if (newFocusScopeItem && newParent) {
- if (subFocusItem) {
- // Find the subFocusItem's topmost focus scope.
- QGraphicsItem *ancestorScope = 0;
- QGraphicsItem *p = subFocusItem->d_ptr->parent;
- while (p) {
- if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
- ancestorScope = p;
- if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel)
- break;
- p = p->d_ptr->parent;
- }
- if (ancestorScope)
- newFocusScopeItem = ancestorScope;
- }
-
QGraphicsItem *p = newParent;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
+ if (subFocusItem && subFocusItem != q_ptr) {
+ // Find the subFocusItem's topmost focus scope within the new parent's focusscope
+ QGraphicsItem *ancestorScope = 0;
+ QGraphicsItem *p2 = subFocusItem->d_ptr->parent;
+ while (p2 && p2 != p) {
+ if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
+ ancestorScope = p2;
+ if (p2->d_ptr->flags & QGraphicsItem::ItemIsPanel)
+ break;
+ if (p2 == q_ptr)
+ break;
+ p2 = p2->d_ptr->parent;
+ }
+ if (ancestorScope)
+ newFocusScopeItem = ancestorScope;
+ }
+
p->d_ptr->focusScopeItem = newFocusScopeItem;
newFocusScopeItem->d_ptr->focusScopeItemChange(true);
// Ensure the new item is no longer the subFocusItem. The
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index 94150cb9fd..f11bfbf38c 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -98,9 +98,9 @@ public:
inline QStyle *style() const { return m_style; }
inline QWidget *widget() const { return m_widget; }
- inline bool operator==(const QLayoutStyleInfo &other)
+ inline bool operator==(const QLayoutStyleInfo &other) const
{ return m_style == other.m_style && m_widget == other.m_widget; }
- inline bool operator!=(const QLayoutStyleInfo &other)
+ inline bool operator!=(const QLayoutStyleInfo &other) const
{ return !(*this == other); }
inline void setDefaultSpacing(Qt::Orientation o, qreal spacing){
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 6aed17c049..d3875c8961 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -60,6 +60,7 @@
#include <private/qabstractitemmodel_p.h>
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
+#include <qaccessible2.h>
#endif
#include <private/qsoftkeymanager_p.h>
#ifndef QT_NO_GESTURE
@@ -682,6 +683,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
+ disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
@@ -712,6 +715,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(_q_headerDataChanged()));
connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(rowsInserted(QModelIndex,int,int)));
+ connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
connect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
@@ -1095,6 +1100,14 @@ void QAbstractItemView::reset()
setRootIndex(QModelIndex());
if (d->selectionModel)
d->selectionModel->reset();
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset();
+ QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
/*!
@@ -2849,7 +2862,7 @@ void QAbstractItemView::editorDestroyed(QObject *editor)
*/
void QAbstractItemView::setHorizontalStepsPerItem(int steps)
{
- Q_UNUSED(steps);
+ Q_UNUSED(steps)
// do nothing
}
@@ -2878,7 +2891,7 @@ int QAbstractItemView::horizontalStepsPerItem() const
*/
void QAbstractItemView::setVerticalStepsPerItem(int steps)
{
- Q_UNUSED(steps);
+ Q_UNUSED(steps)
// do nothing
}
@@ -3311,12 +3324,24 @@ void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int star
rows are those under the given \a parent from \a start to \a end
inclusive.
*/
-void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &, int, int)
+void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end)
{
+ Q_UNUSED(index)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
Q_Q(QAbstractItemView);
if (q->isVisible())
q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState);
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end);
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
/*!
@@ -3379,27 +3404,72 @@ void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &par
rows are those under the given \a parent from \a start to \a end
inclusive.
*/
-void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &, int, int)
+void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end)
{
+ Q_UNUSED(index)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
Q_Q(QAbstractItemView);
if (q->isVisible())
q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState);
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end);
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
+
/*!
\internal
This slot is called when rows have been inserted.
*/
-void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int)
+void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end)
{
+ Q_UNUSED(index)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
Q_Q(QAbstractItemView);
- if (q->isVisible())
- q->updateEditorGeometries();
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end);
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
+/*!
+ \internal
+ This slot is called when columns have been inserted.
+*/
+void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end)
+{
+ Q_UNUSED(index)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
+ Q_Q(QAbstractItemView);
+ if (q->isVisible())
+ q->updateEditorGeometries();
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end);
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
+}
/*!
\internal
@@ -3417,7 +3487,16 @@ void QAbstractItemViewPrivate::_q_modelDestroyed()
*/
void QAbstractItemViewPrivate::_q_layoutChanged()
{
+ Q_Q(QAbstractItemView);
doDelayedItemsLayout();
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset();
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
/*!
@@ -3742,7 +3821,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QM
QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand(
const QModelIndex &index, const QEvent *event) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
if (event) {
switch (event->type()) {
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 2ba7c8de1c..8a2e1cb04e 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -355,6 +355,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_columnsInserted(const QModelIndex&, int, int))
+ Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index b76e579880..cd15694ffe 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -108,6 +108,7 @@ public:
void init();
virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
+ virtual void _q_rowsInserted(const QModelIndex &parent, int start, int end);
virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 983b0d38e3..d879e65c14 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -3169,7 +3169,11 @@ void QListView::currentChanged(const QModelIndex &current, const QModelIndex &pr
if (QAccessible::isActive()) {
if (current.isValid()) {
int entry = visualIndex(current) + 1;
+#ifdef Q_WS_X11
+ QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
+#else
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
+#endif
}
}
#endif
@@ -3188,12 +3192,20 @@ void QListView::selectionChanged(const QItemSelection &selected,
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
int entry = visualIndex(sel) + 1;
+#ifdef Q_WS_X11
+ QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
+#else
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
+#endif
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
int entry = visualIndex(desel) + 1;
+#ifdef Q_WS_X11
+ QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
+#else
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
+#endif
}
}
#endif
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 617409ff3f..6f532eb7c7 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3164,10 +3164,16 @@ void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &p
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
if (current.isValid()) {
+#ifdef Q_WS_X11
+ Q_D(QTableView);
+ int entry = d->accessibleTable2Index(current);
+ QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
+#else
int entry = visualIndex(current) + 1;
if (horizontalHeader())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
+#endif
}
}
#endif
@@ -3180,22 +3186,33 @@ void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &p
void QTableView::selectionChanged(const QItemSelection &selected,
const QItemSelection &deselected)
{
+ Q_D(QTableView);
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
// ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
+#ifdef Q_WS_X11
+ int entry = d->accessibleTable2Index(sel);
+ QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
+#else
int entry = visualIndex(sel);
if (horizontalHeader())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
+#endif
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
+#ifdef Q_WS_X11
+ int entry = d->accessibleTable2Index(sel);
+ QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
+#else
int entry = visualIndex(sel);
if (horizontalHeader())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
+#endif
}
}
#endif
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index f973acf3ce..dce0ed06ac 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -167,6 +167,11 @@ public:
return horizontalHeader->logicalIndex(visualCol);
}
+ inline int accessibleTable2Index(const QModelIndex &index) const {
+ return (index.row() + (horizontalHeader ? 1 : 0)) * (index.model()->columnCount() + (verticalHeader ? 1 : 0))
+ + index.column() + (verticalHeader ? 1 : 0) + 1;
+ }
+
int sectionSpanEndLogical(const QHeaderView *header, int logical, int span) const;
int sectionSpanSize(const QHeaderView *header, int logical, int span) const;
bool spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const;
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 6a992dbab6..9228ac82a2 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -54,6 +54,7 @@
#include <qdebug.h>
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
+#include <qaccessible2.h>
#endif
#include <private/qtreeview_p.h>
@@ -2883,20 +2884,36 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &viewItem)
{
+ Q_Q(QTreeView);
viewItems.insert(pos, count, viewItem);
QTreeViewItem *items = viewItems.data();
for (int i = pos + count; i < viewItems.count(); i++)
if (items[i].parentItem >= pos)
items[i].parentItem += count;
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
void QTreeViewPrivate::removeViewItems(int pos, int count)
{
+ Q_Q(QTreeView);
viewItems.remove(pos, count);
QTreeViewItem *items = viewItems.data();
for (int i = pos; i < viewItems.count(); i++)
if (items[i].parentItem >= pos)
items[i].parentItem -= count;
+#ifndef QT_NO_ACCESSIBILITY
+#ifdef Q_WS_X11
+ if (QAccessible::isActive()) {
+ QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ }
+#endif
+#endif
}
#if 0
@@ -3687,14 +3704,6 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order)
*/
void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
-#ifndef QT_NO_ACCESSIBILITY
- if (QAccessible::isActive()) {
- int entry = visualIndex(current) + 1;
- if (header())
- ++entry;
- QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
- }
-#endif
QAbstractItemView::currentChanged(current, previous);
if (allColumnsShowFocus()) {
@@ -3711,6 +3720,19 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
viewport()->update(currentRect);
}
}
+#ifndef QT_NO_ACCESSIBILITY
+ if (QAccessible::isActive() && current.isValid()) {
+#ifdef Q_WS_X11
+ int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1;
+ QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
+#else
+ int entry = visualIndex(current) + 1;
+ if (header())
+ ++entry;
+ QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
+#endif
+ }
+#endif
}
/*!
@@ -3719,26 +3741,38 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
void QTreeView::selectionChanged(const QItemSelection &selected,
const QItemSelection &deselected)
{
+ QAbstractItemView::selectionChanged(selected, deselected);
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
// ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
+#ifdef Q_WS_X11
+ int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1;
+ Q_ASSERT(entry > 0);
+ QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
+#else
int entry = visualIndex(sel) + 1;
if (header())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
+#endif
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
+#ifdef Q_WS_X11
+ int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1;
+ Q_ASSERT(entry > 0);
+ QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
+#else
int entry = visualIndex(desel) + 1;
if (header())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
+#endif
}
}
#endif
- QAbstractItemView::selectionChanged(selected, deselected);
}
int QTreeView::visualIndex(const QModelIndex &index) const
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index a78bad341f..47cac2faed 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -219,6 +219,9 @@ protected:
private:
friend class QAccessibleItemView;
+ friend class QAccessibleTable2;
+ friend class QAccessibleTree;
+ friend class QAccessibleTable2Cell;
int visualIndex(const QModelIndex &index) const;
Q_DECLARE_PRIVATE(QTreeView)
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index b6d84586ee..a9dc452398 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -78,7 +78,7 @@ struct QTreeViewItem
Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE);
-class QTreeViewPrivate : public QAbstractItemViewPrivate
+class Q_GUI_EXPORT QTreeViewPrivate : public QAbstractItemViewPrivate
{
Q_DECLARE_PUBLIC(QTreeView)
public:
@@ -223,6 +223,10 @@ public:
inline void invalidateHeightCache(int item) const
{ viewItems[item].height = 0; }
+ inline int accessibleTable2Index(const QModelIndex &index) const {
+ return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column() + 1;
+ }
+
// used for spanning rows
QVector<QPersistentModelIndex> spanningIndexes;
diff --git a/src/widgets/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h
index 19724a3ccc..e7a08de378 100644
--- a/src/widgets/itemviews/qwidgetitemdata_p.h
+++ b/src/widgets/itemviews/qwidgetitemdata_p.h
@@ -62,7 +62,7 @@ public:
inline QWidgetItemData(int r, QVariant v) : role(r), value(v) {}
int role;
QVariant value;
- inline bool operator==(const QWidgetItemData &other) { return role == other.role && value == other.value; }
+ inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; }
};
#ifndef QT_NO_DATASTREAM
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 0e7a12c021..9587ac44e0 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6376,6 +6376,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId()))
//setFocusWidget will already post a focus event for us (that the AT client receives) on Windows
# endif
+# ifdef Q_OS_UNIX
+ // menus update the focus manually and this would create bogus events
+ if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
+# endif
QAccessible::updateAccessibility(f, 0, QAccessible::Focus);
#endif
#ifndef QT_NO_GRAPHICSVIEW
diff --git a/src/widgets/platforms/mac/qeventdispatcher_mac_p.h b/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
index 485b14c38f..f4cf16e8a0 100644
--- a/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
+++ b/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
@@ -141,7 +141,7 @@ struct MacTimerInfo {
QObject *obj;
bool pending;
CFRunLoopTimerRef runLoopTimer;
- bool operator==(const MacTimerInfo &other)
+ bool operator==(const MacTimerInfo &other) const
{
return (id == other.id);
}
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index bf6730e9e3..650227214a 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -80,6 +80,9 @@
#if defined(Q_WS_S60)
#include "private/qt_s60_p.h"
#endif
+#ifndef QT_NO_ACCESSIBILITY
+#include "qaccessible.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -1018,6 +1021,9 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
}
q->update();
}
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
+#endif
}
void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end)
@@ -1271,6 +1277,9 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
Q_Q(QComboBox);
emit q->currentIndexChanged(index.row());
emit q->currentIndexChanged(itemText(index));
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
+#endif
}
QString QComboBoxPrivate::itemText(const QModelIndex &index) const
@@ -2635,6 +2644,9 @@ void QComboBox::clear()
{
Q_D(QComboBox);
d->model->removeRows(0, d->model->rowCount(d->root), d->root);
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
}
/*!
@@ -2651,6 +2663,9 @@ void QComboBox::clearEditText()
Q_D(QComboBox);
if (d->lineEdit)
d->lineEdit->clear();
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
}
/*!
@@ -2661,6 +2676,9 @@ void QComboBox::setEditText(const QString &text)
Q_D(QComboBox);
if (d->lineEdit)
d->lineEdit->setText(text);
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
}
/*!
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 7db7b42ef2..fa75aeaebc 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -88,6 +88,13 @@ QT_BEGIN_NAMESPACE
by clear().
\endtable
+ \warning When passing a QString to the constructor or calling setText(),
+ make sure to sanitize your input, as QLabel tries to guess whether it
+ displays the text as plain text or as rich text. You may want to call
+ setTextFormat() explicitly, e.g. in case you expect the text to be in
+ plain format but cannot control the text source (for instance when
+ displaying data loaded from the Web).
+
When the content is changed using any of these functions, any
previous content is cleared.
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index fee401d6ae..28c0973e04 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -60,6 +60,28 @@
QT_BEGIN_NAMESPACE
/*!
+ \internal
+
+ Updates the internal text layout. Returns the ascent of the
+ created QTextLine.
+*/
+int QWidgetLineControl::redoTextLayout() const
+{
+ m_textLayout.clearLayout();
+
+ m_textLayout.beginLayout();
+ QTextLine l = m_textLayout.createLine();
+ m_textLayout.endLayout();
+
+#if defined(Q_WS_MAC)
+ if (m_threadChecks)
+ m_textLayoutThread = QThread::currentThread();
+#endif
+
+ return qRound(l.ascent());
+}
+
+/*!
\internal
Updates the display text based of the current edit text
@@ -92,15 +114,12 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate)
m_textLayout.setText(str);
- QTextOption option;
+ QTextOption option = m_textLayout.textOption();
option.setTextDirection(m_layoutDirection);
option.setFlags(QTextOption::IncludeTrailingSpaces);
m_textLayout.setTextOption(option);
- m_textLayout.beginLayout();
- QTextLine l = m_textLayout.createLine();
- m_textLayout.endLayout();
- m_ascent = qRound(l.ascent());
+ m_ascent = redoTextLayout();
if (str != orig || forceUpdate)
emit displayTextChanged(str);
@@ -196,7 +215,7 @@ void QWidgetLineControl::del()
if (hasSelectedText()) {
removeSelectedText();
} else {
- int n = m_textLayout.nextCursorPosition(m_cursor) - m_cursor;
+ int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor;
while (n--)
internalDelete();
}
@@ -324,7 +343,7 @@ void QWidgetLineControl::updatePasswordEchoEditing(bool editing)
*/
int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const
{
- return m_textLayout.lineAt(0).xToCursor(x, betweenOrOn);
+ return textLayout()->lineAt(0).xToCursor(x, betweenOrOn);
}
/*!
@@ -335,7 +354,7 @@ int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) con
*/
QRect QWidgetLineControl::cursorRect() const
{
- QTextLine l = m_textLayout.lineAt(0);
+ QTextLine l = textLayout()->lineAt(0);
int c = m_cursor;
if (m_preeditCursor != -1)
c += m_preeditCursor;
@@ -538,14 +557,14 @@ void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRe
}
if (flags & DrawText)
- m_textLayout.draw(painter, offset, selections, clip);
+ textLayout()->draw(painter, offset, selections, clip);
if (flags & DrawCursor){
int cursor = m_cursor;
if (m_preeditCursor != -1)
cursor += m_preeditCursor;
if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus))
- m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth);
+ textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth);
}
}
@@ -561,10 +580,10 @@ void QWidgetLineControl::selectWordAtPos(int cursor)
int next = cursor + 1;
if(next > end())
--next;
- int c = m_textLayout.previousCursorPosition(next, QTextLayout::SkipWords);
+ int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords);
moveCursor(c, false);
// ## text layout should support end of words.
- int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords);
+ int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords);
while (end > cursor && m_text[end-1].isSpace())
--end;
moveCursor(end, true);
@@ -1392,9 +1411,9 @@ bool QWidgetLineControl::processEvent(QEvent* ev)
case QEvent::GraphicsSceneMouseRelease:
case QEvent::GraphicsSceneMousePress:{
QGraphicsSceneMouseEvent *gvEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
- QMouseEvent* mouse = new QMouseEvent(ev->type(),
+ QMouseEvent mouse(ev->type(),
gvEv->pos().toPoint(), gvEv->button(), gvEv->buttons(), gvEv->modifiers());
- processMouseEvent(mouse); break;
+ processMouseEvent(&mouse); break;
}
#endif
case QEvent::MouseButtonPress:
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index edc8d16e7f..2237c27887 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -64,6 +64,10 @@
#include "QtGui/qclipboard.h"
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"
+#include "QtWidgets/qaccessible.h"
+#include "QtCore/qthread.h"
+
+#include "qplatformdefs.h"
QT_BEGIN_HEADER
@@ -84,6 +88,13 @@ public:
m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1),
m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0),
m_selstart(0), m_selend(0), m_passwordEchoEditing(false)
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ , m_passwordEchoTimer(0)
+#endif
+#if defined(Q_WS_MAC)
+ , m_threadChecks(false)
+ , m_textLayoutThread(0)
+ #endif
{
init(txt);
}
@@ -319,11 +330,27 @@ public:
bool processEvent(QEvent *ev);
- QTextLayout *textLayout()
+ QTextLayout *textLayout() const
{
+#if defined(Q_WS_MAC)
+ if (m_threadChecks && QThread::currentThread() != m_textLayoutThread)
+ redoTextLayout();
+#endif
return &m_textLayout;
}
+#if defined(Q_WS_MAC)
+ void setThreadChecks(bool threadChecks)
+ {
+ m_threadChecks = threadChecks;
+ }
+
+ bool threadChecks() const
+ {
+ return m_threadChecks;
+ }
+#endif
+
private:
void init(const QString &txt);
void removeSelectedText();
@@ -420,12 +447,18 @@ private:
QString stripString(const QString &str) const;
int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const;
- // complex text layout
- QTextLayout m_textLayout;
+ // complex text layout (must be mutable so it can be reshaped at will)
+ mutable QTextLayout m_textLayout;
bool m_passwordEchoEditing;
QChar m_passwordCharacter;
+ int redoTextLayout() const;
+#if defined(Q_WS_MAC)
+ bool m_threadChecks;
+ mutable QThread *m_textLayoutThread;
+#endif
+
Q_SIGNALS:
void cursorPositionChanged(int, int);
void selectionChanged();
diff --git a/src/xml/stream/stream.pri b/src/xml/stream/stream.pri
deleted file mode 100644
index a5ba3a22fa..0000000000
--- a/src/xml/stream/stream.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-# compatibility header:
-HEADERS += stream/qxmlstream.h
-
-!static {
- # The platforms that require the symbol to be present in QtXml:
- win32:!wince-*:SOURCES += ../corelib/xml/qxmlstream.cpp
- mac:SOURCES += ../corelib/xml/qxmlstream.cpp
- aix-*:SOURCES += ../corelib/xml/qxmlstream.cpp
-}
diff --git a/src/xml/xml.pro b/src/xml/xml.pro
index f1d2baca50..a764fa6094 100644
--- a/src/xml/xml.pro
+++ b/src/xml/xml.pro
@@ -25,6 +25,5 @@ win32-borland {
include(dom/dom.pri)
include(sax/sax.pri)
-include(stream/stream.pri)
symbian:TARGET.UID3=0x2001B2E0
diff --git a/tests/auto/macgui/macgui.pro b/tests/auto/macgui/macgui.pro
index 7e40d81808..8a57a8c54b 100644
--- a/tests/auto/macgui/macgui.pro
+++ b/tests/auto/macgui/macgui.pro
@@ -11,3 +11,4 @@ QT = core-private gui-private
requires(mac)
+CONFIG+=insignificant_test # QTBUG-20984, fails unstably
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index c919df136f..db9110f525 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -1244,8 +1244,12 @@ void tst_QAbstractItemView::task200665_itemEntered()
QCursor::setPos( view.viewport()->mapToGlobal(rect.center()) );
QSignalSpy spy(&view, SIGNAL(entered(QModelIndex)));
view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum());
- QCOMPARE(spy.count(), 1);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20753 QCursor::setPos() is broken for QPA", Continue);
+#endif
+
+ QCOMPARE(spy.count(), 1);
}
void tst_QAbstractItemView::task257481_emptyEditor()
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index 1ab630d020..d8aa382548 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -187,7 +187,8 @@ static int verifyHierarchy(QAccessibleInterface *iface)
if (middleChild) {
entry = if2->navigate(QAccessible::Sibling, middle, &if3);
EXPECT(entry == 0 && if3->object() == middleChild->object());
- delete if3;
+ if (entry == 0)
+ delete if3;
EXPECT(iface->indexOfChild(middleChild) == middle);
}
@@ -229,6 +230,7 @@ private slots:
void navigateHierarchy();
void navigateSlider();
void navigateCovered();
+ void textAttributes();
void hideShowTest();
void userActionCount();
@@ -258,6 +260,9 @@ private slots:
void scrollAreaTest();
void tableWidgetTest();
void tableViewTest();
+ void table2ListTest();
+ void table2TreeTest();
+ void table2TableTest();
void calendarWidgetTest();
void dockWidgetTest();
void comboBoxTest();
@@ -288,6 +293,10 @@ QString eventName(const int ev)
case 0x0012: return "ScrollingStart";
case 0x0013: return "ScrollingEnd";
case 0x0018: return "MenuCommand";
+
+ case 0x0116: return "TableModelChanged";
+ case 0x011B: return "TextCaretMoved";
+
case 0x8000: return "ObjectCreated";
case 0x8001: return "ObjectDestroyed";
case 0x8002: return "ObjectShow";
@@ -854,6 +863,60 @@ void tst_QAccessibility::accessibleName()
QTestAccessibility::clearEvents();
}
+void tst_QAccessibility::textAttributes()
+{
+ QTextEdit textEdit;
+ int startOffset;
+ int endOffset;
+ QString attributes;
+ QString text("<html><head></head><body>"
+ "Hello, <b>this</b> is an <i><b>example</b> text</i>."
+ "<span style=\"font-family: monospace\">Multiple fonts are used.</span>"
+ "Multiple <span style=\"font-size: 8pt\">text sizes</span> are used."
+ "Let's give some color to <span style=\"color:#f0f1f2; background-color:#14f01e\">Qt</span>."
+ "</body></html>");
+
+ textEdit.setText(text);
+ QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&textEdit);
+
+ QAccessibleTextInterface *textInterface=interface->textInterface();
+
+ QVERIFY(textInterface);
+ QCOMPARE(textInterface->characterCount(), 112);
+
+ attributes = textInterface->attributes(10, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 7);
+ QCOMPARE(endOffset, 11);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;")));
+
+ attributes = textInterface->attributes(18, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 18);
+ QCOMPARE(endOffset, 25);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;")));
+ QVERIFY(attributes.contains(QLatin1String(";font-style:italic;")));
+
+ attributes = textInterface->attributes(34, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 31);
+ QCOMPARE(endOffset, 55);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-family:\"monospace\";")));
+
+ attributes = textInterface->attributes(65, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 64);
+ QCOMPARE(endOffset, 74);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-size:8pt;")));
+
+ attributes = textInterface->attributes(110, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 109);
+ QCOMPARE(endOffset, 111);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";background-color:rgb(20,240,30);")));
+ QVERIFY(attributes.contains(QLatin1String(";color:rgb(240,241,242);")));
+}
+
void tst_QAccessibility::hideShowTest()
{
QWidget * const window = new QWidget();
@@ -957,18 +1020,21 @@ void tst_QAccessibility::applicationTest()
void tst_QAccessibility::mainWindowTest()
{
- QMainWindow mw;
- mw.resize(300, 200);
- mw.show(); // triggers layout
+ QMainWindow *mw = new QMainWindow;
+ mw->resize(300, 200);
+ mw->show(); // triggers layout
QLatin1String name = QLatin1String("I am the main window");
- mw.setWindowTitle(name);
- QTest::qWaitForWindowShown(&mw);
+ mw->setWindowTitle(name);
+ QTest::qWaitForWindowShown(mw);
+ QVERIFY_EVENT(mw, 0, QAccessible::ObjectShow);
- QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw);
+ QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(mw);
QCOMPARE(interface->text(QAccessible::Name, 0), name);
QCOMPARE(interface->role(0), QAccessible::Window);
delete interface;
+ delete mw;
+ QTestAccessibility::clearEvents();
}
class CounterButton : public QPushButton {
@@ -1679,6 +1745,8 @@ void tst_QAccessibility::textEditTest()
{
{
QTextEdit edit;
+ int startOffset;
+ int endOffset;
QString text = "hello world\nhow are you today?\n";
edit.setText(text);
edit.show();
@@ -1688,6 +1756,12 @@ void tst_QAccessibility::textEditTest()
QCOMPARE(iface->childCount(), 6);
QCOMPARE(iface->text(QAccessible::Value, 4), QString("hello world"));
QCOMPARE(iface->text(QAccessible::Value, 5), QString("how are you today?"));
+ QCOMPARE(iface->textInterface()->textAtOffset(8, QAccessible2::WordBoundary, &startOffset, &endOffset), QString("world"));
+ QCOMPARE(startOffset, 6);
+ QCOMPARE(endOffset, 11);
+ QCOMPARE(iface->textInterface()->textAtOffset(14, QAccessible2::LineBoundary, &startOffset, &endOffset), QString("how are you today?"));
+ QCOMPARE(startOffset, 12);
+ QCOMPARE(endOffset, 30);
QCOMPARE(iface->text(QAccessible::Value, 6), QString());
QCOMPARE(iface->textInterface()->characterCount(), 31);
QFontMetrics fm(edit.font());
@@ -1720,6 +1794,9 @@ void tst_QAccessibility::textBrowserTest()
void tst_QAccessibility::listViewTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QListView listView;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView);
@@ -1785,6 +1862,7 @@ void tst_QAccessibility::listViewTest()
}
QTestAccessibility::clearEvents();
+#endif
}
@@ -2020,9 +2098,71 @@ void tst_QAccessibility::lineEditTest()
QTestAccessibility::clearEvents();
le2->setFocus(Qt::TabFocusReason);
QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le2, 0, QAccessible::Focus)));
+
+ le->setText(QLatin1String("500"));
+ le->setValidator(new QIntValidator());
+ iface->setText(QAccessible::Value, 0, QLatin1String("This text is not a number"));
+ QCOMPARE(le->text(), QLatin1String("500"));
+
delete iface;
delete le;
delete le2;
+ QTestAccessibility::clearEvents();
+
+ // IA2
+ QString cite = "I always pass on good advice. It is the only thing to do with it. It is never of any use to oneself. --Oscar Wilde";
+ QLineEdit *le3 = new QLineEdit(cite, toplevel);
+ iface = QAccessible::queryAccessibleInterface(le3);
+ QAccessibleTextInterface* textIface = iface->textInterface();
+ le3->deselect();
+ le3->setCursorPosition(3);
+ QCOMPARE(textIface->cursorPosition(), 3);
+ QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le3, 0, QAccessible::TextCaretMoved)));
+ QCOMPARE(textIface->selectionCount(), 0);
+ QTestAccessibility::clearEvents();
+
+ int start, end;
+ QCOMPARE(textIface->text(0, 8), QString::fromLatin1("I always"));
+ QCOMPARE(textIface->textAtOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("I"));
+ QCOMPARE(start, 0);
+ QCOMPARE(end, 1);
+ QCOMPARE(textIface->textBeforeOffset(0, QAccessible2::CharBoundary,&start,&end), QString());
+ QCOMPARE(textIface->textAfterOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1(" "));
+ QCOMPARE(start, 1);
+ QCOMPARE(end, 2);
+
+ QCOMPARE(textIface->textAtOffset(5, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("a"));
+ QCOMPARE(start, 5);
+ QCOMPARE(end, 6);
+ QCOMPARE(textIface->textBeforeOffset(5, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("w"));
+ QCOMPARE(textIface->textAfterOffset(5, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("y"));
+
+ QCOMPARE(textIface->textAtOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("always"));
+ QCOMPARE(start, 2);
+ QCOMPARE(end, 8);
+
+ QCOMPARE(textIface->textAtOffset(2, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("always"));
+ QCOMPARE(textIface->textAtOffset(7, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("always"));
+ QCOMPARE(textIface->textAtOffset(8, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" "));
+ QCOMPARE(textIface->textAtOffset(25, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("advice"));
+ QCOMPARE(textIface->textAtOffset(92, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("oneself"));
+
+ QCOMPARE(textIface->textBeforeOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" "));
+ QCOMPARE(textIface->textAfterOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" "));
+ QCOMPARE(textIface->textAtOffset(5, QAccessible2::SentenceBoundary,&start,&end), QString::fromLatin1("I always pass on good advice. "));
+ QCOMPARE(start, 0);
+ QCOMPARE(end, 30);
+
+ QCOMPARE(textIface->textBeforeOffset(40, QAccessible2::SentenceBoundary,&start,&end), QString::fromLatin1("I always pass on good advice. "));
+ QCOMPARE(textIface->textAfterOffset(5, QAccessible2::SentenceBoundary,&start,&end), QString::fromLatin1("It is the only thing to do with it. "));
+
+ QCOMPARE(textIface->textAtOffset(5, QAccessible2::ParagraphBoundary,&start,&end), cite);
+ QCOMPARE(start, 0);
+ QCOMPARE(end, cite.length());
+ QCOMPARE(textIface->textAtOffset(5, QAccessible2::LineBoundary,&start,&end), cite);
+ QCOMPARE(textIface->textAtOffset(5, QAccessible2::NoBoundary,&start,&end), cite);
+
+ delete iface;
delete toplevel;
QTestAccessibility::clearEvents();
}
@@ -2435,6 +2575,9 @@ void tst_QAccessibility::scrollAreaTest()
void tst_QAccessibility::tableWidgetTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QWidget *topLevel = new QWidget;
QTableWidget *w = new QTableWidget(8,4,topLevel);
@@ -2474,6 +2617,7 @@ void tst_QAccessibility::tableWidgetTest()
delete topLevel;
}
QTestAccessibility::clearEvents();
+#endif
}
class QtTestTableModel: public QAbstractTableModel
@@ -2556,6 +2700,9 @@ public:
void tst_QAccessibility::tableViewTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QtTestTableModel *model = new QtTestTableModel(3, 4);
QTableView *w = new QTableView();
@@ -2635,6 +2782,331 @@ void tst_QAccessibility::tableViewTest()
delete model;
}
QTestAccessibility::clearEvents();
+#endif
+}
+
+void tst_QAccessibility::table2ListTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QListWidget *listView = new QListWidget;
+ listView->addItem("Oslo");
+ listView->addItem("Berlin");
+ listView->addItem("Brisbane");
+ listView->resize(400,400);
+ listView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(listView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(listView);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::List);
+ QCOMPARE(iface->childCount(), 3);
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 1);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("Oslo"));
+ QCOMPARE(child1->role(0), QAccessible::ListItem);
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 2, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 2);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("Berlin"));
+ delete child2;
+
+ QAccessibleInterface *child3 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child3), 0);
+ QVERIFY(child3);
+ QCOMPARE(iface->indexOfChild(child3), 3);
+ QCOMPARE(child3->text(QAccessible::Name, 0), QString("Brisbane"));
+ delete child3;
+ QTestAccessibility::clearEvents();
+
+ // Check for events
+ QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center());
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Selection)));
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Focus)));
+ QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center());
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Selection)));
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Focus)));
+
+ listView->addItem("Munich");
+ QCOMPARE(iface->childCount(), 4);
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 1);
+ QCOMPARE(table2->rowCount(), 4);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Oslo"));
+ QAccessibleTable2CellInterface *cell4;
+ QVERIFY(cell4 = table2->cellAt(3,0));
+ QCOMPARE(cell4->text(QAccessible::Name, 0), QString("Munich"));
+ QCOMPARE(cell4->role(0), QAccessible::ListItem);
+ QCOMPARE(cell4->rowIndex(), 3);
+ QCOMPARE(cell4->columnIndex(), 0);
+ QVERIFY(!cell4->isExpandable());
+
+ delete cell4;
+ delete cell1;
+ delete iface;
+ delete listView;
+ QTestAccessibility::clearEvents();
+#endif
+}
+
+void tst_QAccessibility::table2TreeTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QTreeWidget *treeView = new QTreeWidget;
+ treeView->setColumnCount(2);
+ QTreeWidgetItem *header = new QTreeWidgetItem;
+ header->setText(0, "Artist");
+ header->setText(1, "Work");
+ treeView->setHeaderItem(header);
+
+ QTreeWidgetItem *root1 = new QTreeWidgetItem;
+ root1->setText(0, "Spain");
+ treeView->addTopLevelItem(root1);
+
+ QTreeWidgetItem *item1 = new QTreeWidgetItem;
+ item1->setText(0, "Picasso");
+ item1->setText(1, "Guernica");
+ root1->addChild(item1);
+
+ QTreeWidgetItem *item2 = new QTreeWidgetItem;
+ item2->setText(0, "Tapies");
+ item2->setText(1, "Ambrosia");
+ root1->addChild(item2);
+
+ QTreeWidgetItem *root2 = new QTreeWidgetItem;
+ root2->setText(0, "Austria");
+ treeView->addTopLevelItem(root2);
+
+ QTreeWidgetItem *item3 = new QTreeWidgetItem;
+ item3->setText(0, "Klimt");
+ item3->setText(1, "The Kiss");
+ root2->addChild(item3);
+
+ treeView->resize(400,400);
+ treeView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(treeView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView);
+ QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::Tree);
+ // header and 2 rows (the others are not expanded, thus not visible)
+ QCOMPARE(iface->childCount(), 6);
+
+ QAccessibleInterface *header1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &header1), 0);
+ QVERIFY(header1);
+ QCOMPARE(iface->indexOfChild(header1), 1);
+ QCOMPARE(header1->text(QAccessible::Name, 0), QString("Artist"));
+ QCOMPARE(header1->role(0), QAccessible::ColumnHeader);
+ delete header1;
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 3);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("Spain"));
+ QCOMPARE(child1->role(0), QAccessible::TreeItem);
+ QVERIFY(!(child1->state(0) & QAccessible::Expanded));
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 5, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 5);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("Austria"));
+ delete child2;
+
+ QTestAccessibility::clearEvents();
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 2);
+ QCOMPARE(table2->rowCount(), 2);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Spain"));
+ QAccessibleTable2CellInterface *cell2;
+ QVERIFY(cell2 = table2->cellAt(1,0));
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Austria"));
+ QCOMPARE(cell2->role(0), QAccessible::TreeItem);
+ QCOMPARE(cell2->rowIndex(), 1);
+ QCOMPARE(cell2->columnIndex(), 0);
+ QVERIFY(cell2->isExpandable());
+ QCOMPARE(iface->indexOfChild(cell2), 5);
+ QVERIFY(!(cell2->state(0) & QAccessible::Expanded));
+ QCOMPARE(table2->columnDescription(1), QString("Work"));
+ delete cell2;
+ delete cell1;
+
+ treeView->expandAll();
+
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(treeView);
+ QTest::qWait(100);
+#endif
+
+ QCOMPARE(table2->columnCount(), 2);
+ QCOMPARE(table2->rowCount(), 5);
+ cell1 = table2->cellAt(1,0);
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Picasso"));
+ QCOMPARE(iface->indexOfChild(cell1), 5); // 1 based + 2 header + 2 for root item
+
+ cell2 = table2->cellAt(4,0);
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Klimt"));
+ QCOMPARE(cell2->role(0), QAccessible::TreeItem);
+ QCOMPARE(cell2->rowIndex(), 4);
+ QCOMPARE(cell2->columnIndex(), 0);
+ QVERIFY(!cell2->isExpandable());
+ QCOMPARE(iface->indexOfChild(cell2), 11);
+
+ QCOMPARE(table2->columnDescription(0), QString("Artist"));
+ QCOMPARE(table2->columnDescription(1), QString("Work"));
+
+ delete iface;
+ QTestAccessibility::clearEvents();
+#endif
+}
+
+
+void tst_QAccessibility::table2TableTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QTableWidget *tableView = new QTableWidget(3, 3);
+ tableView->setColumnCount(3);
+ QStringList hHeader;
+ hHeader << "h1" << "h2" << "h3";
+ tableView->setHorizontalHeaderLabels(hHeader);
+
+ QStringList vHeader;
+ vHeader << "v1" << "v2" << "v3";
+ tableView->setVerticalHeaderLabels(vHeader);
+
+ for (int i = 0; i<9; ++i) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ item->setText(QString::number(i/3) + QString(".") + QString::number(i%3));
+ tableView->setItem(i/3, i%3, item);
+ }
+
+ tableView->resize(600,600);
+ tableView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(tableView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
+ QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::Table);
+ // header and 2 rows (the others are not expanded, thus not visible)
+ QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button
+
+ QAccessibleInterface *cornerButton = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &cornerButton), 0);
+ QVERIFY(cornerButton);
+ QCOMPARE(iface->indexOfChild(cornerButton), 1);
+ QCOMPARE(cornerButton->role(0), QAccessible::Pane);
+ delete cornerButton;
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 3);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("h2"));
+ QCOMPARE(child1->role(0), QAccessible::ColumnHeader);
+ QVERIFY(!(child1->state(0) & QAccessible::Expanded));
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 11, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 11);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("1.1"));
+ QAccessibleTable2CellInterface *cell2Iface = static_cast<QAccessibleTable2CellInterface*>(child2);
+ QCOMPARE(cell2Iface->rowIndex(), 1);
+ QCOMPARE(cell2Iface->columnIndex(), 1);
+ delete child2;
+
+ QAccessibleInterface *child3 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 12, &child3), 0);
+ QCOMPARE(iface->indexOfChild(child3), 12);
+ QCOMPARE(child3->text(QAccessible::Name, 0), QString("1.2"));
+ delete child3;
+
+ QTestAccessibility::clearEvents();
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 3);
+ QCOMPARE(table2->rowCount(), 3);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("0.0"));
+ QCOMPARE(iface->indexOfChild(cell1), 6);
+
+ QAccessibleTable2CellInterface *cell2;
+ QVERIFY(cell2 = table2->cellAt(0,1));
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("0.1"));
+ QCOMPARE(cell2->role(0), QAccessible::Cell);
+ QCOMPARE(cell2->rowIndex(), 0);
+ QCOMPARE(cell2->columnIndex(), 1);
+ QCOMPARE(iface->indexOfChild(cell2), 7);
+ delete cell2;
+
+ QAccessibleTable2CellInterface *cell3;
+ QVERIFY(cell3 = table2->cellAt(1,2));
+ QCOMPARE(cell3->text(QAccessible::Name, 0), QString("1.2"));
+ QCOMPARE(cell3->role(0), QAccessible::Cell);
+ QCOMPARE(cell3->rowIndex(), 1);
+ QCOMPARE(cell3->columnIndex(), 2);
+ QCOMPARE(iface->indexOfChild(cell3), 12);
+ delete cell3;
+
+ QCOMPARE(table2->columnDescription(0), QString("h1"));
+ QCOMPARE(table2->columnDescription(1), QString("h2"));
+ QCOMPARE(table2->columnDescription(2), QString("h3"));
+ QCOMPARE(table2->rowDescription(0), QString("v1"));
+ QCOMPARE(table2->rowDescription(1), QString("v2"));
+ QCOMPARE(table2->rowDescription(2), QString("v3"));
+
+ delete iface;
+
+ delete tableView;
+
+ QTestAccessibility::clearEvents();
+#endif
}
void tst_QAccessibility::calendarWidgetTest()
@@ -2851,6 +3323,9 @@ void tst_QAccessibility::comboBoxTest()
void tst_QAccessibility::treeWidgetTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
QWidget *w = new QWidget;
QTreeWidget *tree = new QTreeWidget(w);
QHBoxLayout *l = new QHBoxLayout(w);
@@ -2908,6 +3383,7 @@ void tst_QAccessibility::treeWidgetTest()
delete w;
QTestAccessibility::clearEvents();
+#endif
}
void tst_QAccessibility::labelTest()
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 86c3445d5b..137438b3ef 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -2487,6 +2487,10 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
int selection;
GET_SELECTION(selection);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20753 QCursor::setPos doesn't work for qpa", Abort);
+#endif
+
//since we moved the mouse is in the middle it should even be around 5;
QVERIFY(selection > 3);
diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp
index 23cb9e73f2..1e82431a48 100644
--- a/tests/auto/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/qcssparser/tst_qcssparser.cpp
@@ -1590,6 +1590,14 @@ void tst_QCssParser::extractFontFamily()
QFont fnt;
extractor.extractFont(&fnt, &adjustment);
QFontInfo info(fnt);
+
+#ifdef Q_WS_QPA
+ // Note, we have to QSKIP rather than QEXPECT_FAIL because font lookup is broken
+ // such that it may work or not work depending on the order in which fonts were
+ // loaded from disk
+ QSKIP("QTBUG-20986 may fail on qpa", SkipSingle);
+#endif
+
QTEST(info.family(), "expectedFamily");
}
diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
index e06e3a8b26..6490bfe973 100644
--- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
@@ -113,6 +113,10 @@ private slots:
void serviceRegistrationRaceCondition();
+ void registerVirtualObject();
+ void callVirtualObject();
+ void callVirtualObjectLocal();
+
public:
QString serviceName() const { return "com.trolltech.Qt.Autotests.QDBusConnection"; }
bool callMethod(const QDBusConnection &conn, const QString &path);
@@ -823,7 +827,6 @@ bool tst_QDBusConnection::callMethod(const QDBusConnection &conn, const QString
{
QDBusMessage msg = QDBusMessage::createMethodCall(conn.baseService(), path, "", "method");
QDBusMessage reply = conn.call(msg, QDBus::Block/*WithGui*/);
-
if (reply.type() != QDBusMessage::ReplyMessage)
return false;
if (MyObject::path == path) {
@@ -1098,6 +1101,203 @@ void tst_QDBusConnection::serviceRegistrationRaceCondition()
QCOMPARE(recv.count, 1);
}
+class VirtualObject: public QDBusVirtualObject
+{
+ Q_OBJECT
+public:
+ VirtualObject() :success(true) {}
+
+ QString introspect(const QString &path) const
+ {
+ return QString();
+ }
+
+ bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) {
+ ++callCount;
+ lastMessage = message;
+
+ if (success) {
+ QDBusMessage reply = message.createReply(replyArguments);
+ connection.send(reply);
+ }
+ emit messageReceived(message);
+ return success;
+ }
+signals:
+ void messageReceived(const QDBusMessage &message) const;
+
+public:
+ mutable QDBusMessage lastMessage;
+ QVariantList replyArguments;
+ mutable int callCount;
+ bool success;
+};
+
+
+void tst_QDBusConnection::registerVirtualObject()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QString path = "/tree/node";
+ QString childPath = "/tree/node/child";
+ QString childChildPath = "/tree/node/child/another";
+
+ {
+ // Register VirtualObject that handles child paths. Unregister by going out of scope.
+ VirtualObject obj;
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(&obj));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(&obj));
+ QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(&obj));
+ }
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(0));
+
+ {
+ // Register VirtualObject that handles child paths. Unregister by calling unregister.
+ VirtualObject obj;
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(&obj));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(&obj));
+ QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(&obj));
+ con.unregisterObject(path);
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(0));
+ }
+
+ {
+ // Single node has no sub path handling.
+ VirtualObject obj;
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SingleNode));
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(&obj));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(0));
+ }
+
+ {
+ // Register VirtualObject that handles child paths. Try to register an object on a child path of that.
+ VirtualObject obj;
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(&obj));
+
+ QObject objectAtSubPath;
+ QVERIFY(!con.registerObject(path, &objectAtSubPath));
+ QVERIFY(!con.registerObject(childPath, &objectAtSubPath));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(&obj));
+ }
+
+ {
+ // Register object, make sure no SubPath handling object can be registered on a parent path.
+ QObject objectAtSubPath;
+ QVERIFY(con.registerObject(childPath, &objectAtSubPath));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(&objectAtSubPath));
+
+ VirtualObject obj;
+ QVERIFY(!con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
+ }
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
+ QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(0));
+ QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(0));
+}
+
+void tst_QDBusConnection::callVirtualObject()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QDBusConnection con2 = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "con2");
+
+ QString path = "/tree/node";
+ QString childPath = "/tree/node/child";
+
+ // register one object at root:
+ VirtualObject obj;
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ obj.callCount = 0;
+ obj.replyArguments << 42 << 47u;
+
+ QObject::connect(&obj, SIGNAL(messageReceived(QDBusMessage)), &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello");
+ QDBusPendingCall reply = con2.asyncCall(message);
+
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(obj.callCount, 1);
+ QCOMPARE(obj.lastMessage.service(), con2.baseService());
+ QCOMPARE(obj.lastMessage.interface(), QString());
+ QCOMPARE(obj.lastMessage.path(), path);
+ reply.waitForFinished();
+ QVERIFY(reply.isValid());
+ QCOMPARE(reply.reply().arguments(), obj.replyArguments);
+
+ // call sub path
+ QDBusMessage childMessage = QDBusMessage::createMethodCall(con.baseService(), childPath, QString(), "helloChild");
+ obj.replyArguments.clear();
+ obj.replyArguments << 99;
+ QDBusPendingCall childReply = con2.asyncCall(childMessage);
+
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(obj.callCount, 2);
+ QCOMPARE(obj.lastMessage.service(), con2.baseService());
+ QCOMPARE(obj.lastMessage.interface(), QString());
+ QCOMPARE(obj.lastMessage.path(), childPath);
+
+ childReply.waitForFinished();
+ QVERIFY(childReply.isValid());
+ QCOMPARE(childReply.reply().arguments(), obj.replyArguments);
+
+ // let the call fail by having the virtual object return false
+ obj.success = false;
+ QDBusMessage errorMessage = QDBusMessage::createMethodCall(con.baseService(), childPath, QString(), "someFunc");
+ QDBusPendingCall errorReply = con2.asyncCall(errorMessage);
+
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QTest::qWait(100);
+ QVERIFY(errorReply.isError());
+ qDebug() << errorReply.reply().arguments();
+ QCOMPARE(errorReply.reply().errorName(), QString("org.freedesktop.DBus.Error.UnknownObject"));
+
+ QDBusConnection::disconnectFromBus("con2");
+}
+
+void tst_QDBusConnection::callVirtualObjectLocal()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QString path = "/tree/node";
+ QString childPath = "/tree/node/child";
+
+ // register one object at root:
+ VirtualObject obj;
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ obj.callCount = 0;
+ obj.replyArguments << 42 << 47u;
+
+ QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello");
+ QDBusMessage reply = con.call(message, QDBus::Block, 5000);
+ QCOMPARE(obj.callCount, 1);
+ QCOMPARE(obj.lastMessage.service(), con.baseService());
+ QCOMPARE(obj.lastMessage.interface(), QString());
+ QCOMPARE(obj.lastMessage.path(), path);
+ QCOMPARE(obj.replyArguments, reply.arguments());
+
+ obj.replyArguments << QString("alien abduction");
+ QDBusMessage subPathMessage = QDBusMessage::createMethodCall(con.baseService(), childPath, QString(), "hello");
+ QDBusMessage subPathReply = con.call(subPathMessage , QDBus::Block, 5000);
+ QCOMPARE(obj.callCount, 2);
+ QCOMPARE(obj.lastMessage.service(), con.baseService());
+ QCOMPARE(obj.lastMessage.interface(), QString());
+ QCOMPARE(obj.lastMessage.path(), childPath);
+ QCOMPARE(obj.replyArguments, subPathReply.arguments());
+}
+
QString MyObject::path;
QTEST_MAIN(tst_QDBusConnection)
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
index 96ab3113f3..9156818158 100644
--- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
@@ -200,6 +200,7 @@ private slots:
void invalidAfterServiceOwnerChanged();
void introspect();
void introspectUnknownTypes();
+ void introspectVirtualObject();
void callMethod();
void invokeMethod();
void invokeMethodWithReturn();
@@ -361,7 +362,6 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged()
void tst_QDBusInterface::introspect()
{
- QDBusConnection con = QDBusConnection::sessionBus();
QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"),
TEST_INTERFACE_NAME);
@@ -394,6 +394,75 @@ void tst_QDBusInterface::introspectUnknownTypes()
QVERIFY(mo->indexOfProperty("prop1") != -1);
int pidx = mo->indexOfProperty("prop1");
QCOMPARE(mo->property(pidx).typeName(), "QDBusRawType<0x7e>*");
+
+
+
+ QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), "/unknownTypes", "org.freedesktop.DBus.Introspectable", "Introspect");
+ QDBusMessage reply = con.call(message, QDBus::Block, 5000);
+ qDebug() << "REPL: " << reply.arguments();
+
+}
+
+
+class VirtualObject: public QDBusVirtualObject
+{
+ Q_OBJECT
+public:
+ VirtualObject() :success(true) {}
+
+ QString introspect(const QString &path) const {
+ if (path == "/some/path/superNode")
+ return "zitroneneis";
+ if (path == "/some/path/superNode/foo")
+ return " <interface name=\"com.trolltech.QtDBus.VirtualObject\">\n"
+ " <method name=\"klingeling\" />\n"
+ " </interface>\n" ;
+ return QString();
+ }
+
+ bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) {
+ ++callCount;
+ lastMessage = message;
+
+ if (success) {
+ QDBusMessage reply = message.createReply(replyArguments);
+ connection.send(reply);
+ }
+ emit messageReceived(message);
+ return success;
+ }
+signals:
+ void messageReceived(const QDBusMessage &message) const;
+
+public:
+ mutable QDBusMessage lastMessage;
+ QVariantList replyArguments;
+ mutable int callCount;
+ bool success;
+};
+
+void tst_QDBusInterface::introspectVirtualObject()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+ VirtualObject obj;
+
+ obj.success = false;
+
+ QString path = "/some/path/superNode";
+ QVERIFY(con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+
+ QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, "org.freedesktop.DBus.Introspectable", "Introspect");
+ QDBusMessage reply = con.call(message, QDBus::Block, 5000);
+ QVERIFY(reply.arguments().at(0).toString().contains(
+ QRegExp("<node>.*zitroneneis.*<interface name=") ));
+
+ QDBusMessage message2 = QDBusMessage::createMethodCall(con.baseService(), path + "/foo", "org.freedesktop.DBus.Introspectable", "Introspect");
+ QDBusMessage reply2 = con.call(message2, QDBus::Block, 5000);
+ QVERIFY(reply2.arguments().at(0).toString().contains(
+ QRegExp("<node>.*<interface name=\"com.trolltech.QtDBus.VirtualObject\">"
+ ".*<method name=\"klingeling\" />\n"
+ ".*</interface>.*<interface name=") ));
}
void tst_QDBusInterface::callMethod()
diff --git a/tests/auto/qeventloop/qeventloop.pro b/tests/auto/qeventloop/qeventloop.pro
index 153cdbafe7..e3c170a33b 100644
--- a/tests/auto/qeventloop/qeventloop.pro
+++ b/tests/auto/qeventloop/qeventloop.pro
@@ -6,5 +6,3 @@ QT += network
win32:!wince*:LIBS += -luser32
symbian:TARGET.CAPABILITY += NetworkServices
-
-CONFIG+=insignificant_test
diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp
index 828366ba49..a702908549 100644
--- a/tests/auto/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/qeventloop/tst_qeventloop.cpp
@@ -203,6 +203,7 @@ private slots:
void symbianNestedActiveSchedulerLoop();
void processEvents();
void exec();
+ void throwInExec();
void reexec();
void exit();
void execAfterExit();
@@ -445,14 +446,35 @@ void tst_QEventLoop::exec()
QCOMPARE(returnCode, 0);
QCOMPARE(executor.returnCode, -1);
}
+}
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM) && !defined(Q_OS_SYMBIAN) && !defined(NO_EVENTLOOP_EXCEPTIONS)
+void tst_QEventLoop::throwInExec()
+{
+#if defined(QT_NO_EXCEPTIONS) || defined(NO_EVENTLOOP_EXCEPTIONS)
+ QSKIP("Exceptions are disabled", SkipAll);
+#elif defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN)
// Windows Mobile cannot handle cross library exceptions
// qobject.cpp will try to rethrow the exception after handling
// which causes gwes.exe to crash
// Symbian doesn't propagate exceptions from eventloop, but converts them to
// CActiveScheduler errors instead -> this test will hang.
+ QSKIP("This platform doesn't support propagating exceptions through the event loop", SkipAll);
+#elif defined(Q_OS_LINUX)
+ // C++ exceptions can't be passed through glib callbacks. Skip the test if
+ // we're using the glib event loop.
+ QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className();
+ if (dispatcher.contains("Glib")) {
+ QSKIP(
+ qPrintable(QString(
+ "Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n"
+ "Try running with QT_NO_GLIB=1 in environment."
+ ).arg(QString::fromLatin1(dispatcher))),
+ SkipAll
+ );
+ }
+#endif
+
{
// QEventLoop::exec() is exception safe
QEventLoop eventLoop;
@@ -474,7 +496,6 @@ void tst_QEventLoop::exec()
}
QCOMPARE(caughtExceptions, 2);
}
-#endif
}
void tst_QEventLoop::reexec()
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 3bb682c7e9..d9fd736e09 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -80,7 +80,9 @@
# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
#elif defined(Q_OS_UNIX)
#ifdef QT_BUILD_INTERNAL
+QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0);
+QT_END_NAMESPACE
#endif
#endif
diff --git a/tests/auto/qfocusevent/qfocusevent.pro b/tests/auto/qfocusevent/qfocusevent.pro
index 85140ad9e1..e709a547ec 100644
--- a/tests/auto/qfocusevent/qfocusevent.pro
+++ b/tests/auto/qfocusevent/qfocusevent.pro
@@ -2,4 +2,4 @@ load(qttest_p4)
QT += widgets
SOURCES += tst_qfocusevent.cpp
-mac*:CONFIG+=insignificant_test
+CONFIG+=insignificant_test
diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp
index 711ffc0b53..a564e71e19 100644
--- a/tests/auto/qfont/tst_qfont.cpp
+++ b/tests/auto/qfont/tst_qfont.cpp
@@ -604,8 +604,8 @@ void tst_QFont::serializeSpacing()
void tst_QFont::lastResortFont()
{
-#ifdef Q_WS_QWS
- QSKIP("QFont::lastResortFont() may abort with qFatal() on QWS", SkipAll);
+#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
+ QSKIP("QFont::lastResortFont() may abort with qFatal() on QWS/QPA", SkipAll);
// ...if absolutely no font is found. Just as ducumented for QFont::lastResortFont().
// This happens on our CI machines which run QWS autotests.
#endif
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
index 735c7e4350..1df61d0a06 100644
--- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
@@ -160,6 +160,13 @@ void tst_QFontDatabase::fixedPitch()
if (!fdb.families().contains(font))
QSKIP( "Font not installed", SkipSingle);
+#ifdef Q_WS_QPA
+ if (fixedPitch) {
+ // fixedPitch() never returns true on qpa
+ QEXPECT_FAIL("", "QTBUG-20754 fails on qpa", Abort);
+ }
+#endif
+
QCOMPARE(fdb.isFixedPitch(font), fixedPitch);
QFont qfont(font);
@@ -229,6 +236,10 @@ void tst_QFontDatabase::addAppFont()
QFontDatabase db;
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("memory font", "QTBUG-20754 fails on qpa", Abort);
+#endif
+
const QStringList oldFamilies = db.families();
QVERIFY(!oldFamilies.isEmpty());
@@ -262,6 +273,10 @@ void tst_QFontDatabase::addAppFont()
const QStringList addedFamilies = QFontDatabase::applicationFontFamilies(id);
QVERIFY(!addedFamilies.isEmpty());
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("font file", "QTBUG-20754 fails on qpa", Abort);
+#endif
+
const QStringList newFamilies = db.families();
QVERIFY(!newFamilies.isEmpty());
QVERIFY(newFamilies.count() >= oldFamilies.count());
diff --git a/tests/auto/qfontdialog/qfontdialog.pro b/tests/auto/qfontdialog/qfontdialog.pro
index 60320476e2..e4ad2f1a41 100644
--- a/tests/auto/qfontdialog/qfontdialog.pro
+++ b/tests/auto/qfontdialog/qfontdialog.pro
@@ -9,3 +9,5 @@ mac:!qpa {
OBJECTIVE_SOURCES += tst_qfontdialog_mac_helpers.mm
LIBS += -framework Cocoa
}
+
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 1df194d020..982cfc11d9 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -277,12 +277,20 @@ void tst_QFontMetrics::inFontUcs4()
{
QFontMetrics fm(font);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20759 fails for qpa", Continue);
+#endif
+
QVERIFY(fm.inFontUcs4(0x1D7FF));
}
{
QFontMetricsF fm(font);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20759 fails for qpa", Continue);
+#endif
+
QVERIFY(fm.inFontUcs4(0x1D7FF));
}
@@ -303,6 +311,11 @@ void tst_QFontMetrics::lineWidth()
const QFontMetrics bigFontMetrics(bigFont);
QVERIFY(smallFontMetrics.lineWidth() >= 1);
+
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20759 fails for qpa", Continue);
+#endif
+
QVERIFY(smallFontMetrics.lineWidth() < bigFontMetrics.lineWidth());
}
diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro
index 69f89572ba..8f63d6e26e 100644
--- a/tests/auto/qftp/qftp.pro
+++ b/tests/auto/qftp/qftp.pro
@@ -18,3 +18,5 @@ wince*: {
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
+
+CONFIG+=insignificant_test # uses live qt-test-server, inherently unstable
diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp
index 859f47f000..472379ab7a 100644
--- a/tests/auto/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/qglthreads/tst_qglthreads.cpp
@@ -46,7 +46,6 @@
#include "tst_qglthreads.h"
#ifdef Q_OS_SYMBIAN
-#include <unistd.h> // for usleep
#define RUNNING_TIME 2000 // save GPU mem by running shorter time.
#else
#define RUNNING_TIME 5000
@@ -467,11 +466,7 @@ void tst_QGLThreads::renderInThread()
qApp->processEvents();
value = -value;
-#ifdef Q_WS_WIN
- Sleep(100);
-#else
- usleep(100 * 1000);
-#endif
+ QThread::msleep(100);
}
QVERIFY(!thread.failure);
@@ -574,11 +569,7 @@ public slots:
p.drawText(rect.center(), "This is a piece of text");
p.end();
rotAngle += 2;
-#ifdef Q_WS_WIN
- Sleep(20);
-#else
- usleep(20 * 1000);
-#endif
+ QThread::msleep(20);
}
fail = beginFailed;
@@ -670,11 +661,7 @@ void tst_QGLThreads::painterOnGLWidgetInThread()
while (painterThreads.areRunning()) {
qApp->processEvents();
-#ifdef Q_WS_WIN
- Sleep(100);
-#else
- usleep(100 * 1000);
-#endif
+ QThread::msleep(100);
}
QVERIFY(!painterThreads.failed());
}
@@ -693,11 +680,7 @@ void tst_QGLThreads::painterOnPixmapInThread()
while (painterThreads.areRunning()) {
qApp->processEvents();
-#ifdef Q_WS_WIN
- Sleep(100);
-#else
- usleep(100 * 1000);
-#endif
+ QThread::msleep(100);
}
QVERIFY(!painterThreads.failed());
}
@@ -726,11 +709,7 @@ void tst_QGLThreads::painterOnPboInThread()
while (painterThreads.areRunning()) {
qApp->processEvents();
-#ifdef Q_WS_WIN
- Sleep(100);
-#else
- usleep(100 * 1000);
-#endif
+ QThread::msleep(100);
}
QVERIFY(!painterThreads.failed());
}
@@ -760,11 +739,7 @@ void tst_QGLThreads::painterOnFboInThread()
while (painterThreads.areRunning()) {
qApp->processEvents();
-#ifdef Q_WS_WIN
- Sleep(100);
-#else
- usleep(100 * 1000);
-#endif
+ QThread::msleep(100);
}
QVERIFY(!painterThreads.failed());
}
diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp
index a18a2ac8dd..e84915428f 100644
--- a/tests/auto/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp
@@ -55,6 +55,7 @@ class tst_QGlyphRun: public QObject
#if !defined(QT_NO_RAWFONT)
private slots:
void initTestCase();
+ void init();
void cleanupTestCase();
void constructionAndDestruction();
@@ -78,6 +79,7 @@ private slots:
private:
int m_testFontId;
QFont m_testFont;
+ bool m_testFont_ok;
#endif // QT_NO_RAWFONT
};
@@ -88,12 +90,27 @@ Q_DECLARE_METATYPE(QGlyphRun);
void tst_QGlyphRun::initTestCase()
{
+ m_testFont_ok = false;
+
m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf");
QVERIFY(m_testFontId >= 0);
m_testFont = QFont("QtsSpecialTestFont");
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20760 fails on qpa", Abort);
+#endif
+
QCOMPARE(QFontInfo(m_testFont).family(), QString::fromLatin1("QtsSpecialTestFont"));
+
+ m_testFont_ok = true;
+}
+
+void tst_QGlyphRun::init()
+{
+ if (!m_testFont_ok) {
+ QSKIP("Test font is not working correctly", SkipAll);
+ }
}
void tst_QGlyphRun::cleanupTestCase()
@@ -237,6 +254,7 @@ void tst_QGlyphRun::textLayoutGlyphIndexes()
layout.endLayout();
QList<QGlyphRun> listOfGlyphs = layout.glyphRuns();
+
QCOMPARE(listOfGlyphs.size(), 1);
QGlyphRun glyphs = listOfGlyphs.at(0);
diff --git a/tests/auto/qgraphicseffect/qgraphicseffect.pro b/tests/auto/qgraphicseffect/qgraphicseffect.pro
index 171ab3ffda..d0d1f11d0c 100644
--- a/tests/auto/qgraphicseffect/qgraphicseffect.pro
+++ b/tests/auto/qgraphicseffect/qgraphicseffect.pro
@@ -5,3 +5,5 @@ QT += core-private gui-private
SOURCES += tst_qgraphicseffect.cpp
CONFIG += parallel_test
+
+qpa:CONFIG+=insignificant_test # QTBUG-20761
diff --git a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro
index f0e9a4b0f8..7db7c1ae6f 100644
--- a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro
+++ b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro
@@ -3,4 +3,4 @@ load(qttest_p4)
QT += widgets
SOURCES += tst_qgraphicsgridlayout.cpp
CONFIG += parallel_test
-
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qgraphicsitem/qgraphicsitem.pro b/tests/auto/qgraphicsitem/qgraphicsitem.pro
index bfcf87721f..51a4426680 100644
--- a/tests/auto/qgraphicsitem/qgraphicsitem.pro
+++ b/tests/auto/qgraphicsitem/qgraphicsitem.pro
@@ -6,4 +6,4 @@ DEFINES += QT_NO_CAST_TO_ASCII
win32:!wince*: LIBS += -lUser32
-
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 9e90a9f03c..79dd2bdd7d 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -474,6 +474,7 @@ private slots:
void QTBUG_12112_focusItem();
void QTBUG_13473_sceneposchange();
void QTBUG_16374_crashInDestructor();
+ void QTBUG_20699_focusScopeCrash();
private:
QList<QGraphicsItem *> paintedItems;
@@ -11256,5 +11257,36 @@ void tst_QGraphicsItem::QTBUG_16374_crashInDestructor()
QTest::qWaitForWindowShown(&view);
}
+void tst_QGraphicsItem::QTBUG_20699_focusScopeCrash()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsPixmapItem fs;
+ fs.setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable);
+ scene.addItem(&fs);
+ QGraphicsPixmapItem* fs2 = new QGraphicsPixmapItem(&fs);
+ fs2->setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable);
+ QGraphicsPixmapItem* fi2 = new QGraphicsPixmapItem(&fs);
+ fi2->setFlags(QGraphicsItem::ItemIsFocusable);
+ QGraphicsPixmapItem* fi = new QGraphicsPixmapItem(fs2);
+ fi->setFlags(QGraphicsItem::ItemIsFocusable);
+ fs.setFocus();
+ fi->setFocus();
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ fi->setParentItem(fi2);
+ fi->setFocus();
+ fs.setFocus();
+ fi->setParentItem(fs2);
+ fi->setFocus();
+ fs2->setFocus();
+ fs.setFocus();
+ fi->setParentItem(fi2);
+ fi->setFocus();
+ fs.setFocus();
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro b/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro
index abe6c23b14..a649ae1a3c 100644
--- a/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro
+++ b/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro
@@ -5,4 +5,4 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsproxywidget.cpp
-
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro
index 5b9afe1b1f..9f961a11b8 100644
--- a/tests/auto/qgraphicsscene/qgraphicsscene.pro
+++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro
@@ -20,3 +20,4 @@ wince*:{
}
symbian:TARGET.EPOCHEAPSIZE="0x100000 0x1000000" # Min 1Mb, max 16Mb
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro
index 4f9d001717..de7f01f36f 100644
--- a/tests/auto/qgraphicstransform/qgraphicstransform.pro
+++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro
@@ -2,3 +2,5 @@ load(qttest_p4)
QT += widgets
SOURCES += tst_qgraphicstransform.cpp
CONFIG += parallel_test
+
+linux-*:contains(QT_CONFIG,release):DEFINES+=MAY_HIT_QTBUG_20661
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index 7b928909ff..1a116b7f30 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -359,7 +359,7 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis()
exp.rotate(angle, axis);
QTransform expected = exp.toTransform(1024.0f);
-#ifdef Q_OS_LINUX
+#if defined(MAY_HIT_QTBUG_20661)
// These failures possibly relate to the float vs qreal issue mentioned
// in the comment above fuzzyCompare().
if (sizeof(qreal) == sizeof(double)) {
diff --git a/tests/auto/qgraphicsview/qgraphicsview.pro b/tests/auto/qgraphicsview/qgraphicsview.pro
index 55569e07bd..053093f9bd 100644
--- a/tests/auto/qgraphicsview/qgraphicsview.pro
+++ b/tests/auto/qgraphicsview/qgraphicsview.pro
@@ -7,3 +7,4 @@ SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
DEFINES += QT_NO_CAST_TO_ASCII
symbian:TARGET.EPOCHEAPSIZE = 1000000 10000000
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qgraphicswidget/qgraphicswidget.pro b/tests/auto/qgraphicswidget/qgraphicswidget.pro
index 1dc01f14cf..330076eafc 100644
--- a/tests/auto/qgraphicswidget/qgraphicswidget.pro
+++ b/tests/auto/qgraphicswidget/qgraphicswidget.pro
@@ -7,3 +7,4 @@ SOURCES += tst_qgraphicswidget.cpp
mac*:CONFIG+=insignificant_test
+qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-20778 unstable on qpa, xcb
diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp
index 693236aa9d..d52729a273 100644
--- a/tests/auto/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp
@@ -721,10 +721,8 @@ void tst_QGridLayout::spacingsAndMargins()
QSize topsize = toplevel.size();
QSize minimumsize = vbox.totalMinimumSize();
-#if defined(Q_WS_QWS)
if (topsize.width() < minimumsize.width() || topsize.height() < minimumsize.height())
QSKIP("The screen is too small to run this test case", SkipSingle);
-#endif
// We are relying on the order here...
for (int pi = 0; pi < sizehinters.count(); ++pi) {
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index 35c8d8d95c..1c7df1bdae 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -611,7 +611,7 @@ void tst_QHostInfo::resultsReady(const QHostInfo &hi)
lookupDone = true;
lookupResults = hi;
lookupsDoneCounter++;
- QMetaObject::invokeMethod(&QTestEventLoop::instance(), "exitLoop", Qt::QueuedConnection);
+ QTestEventLoop::instance().exitLoop();
}
void tst_QHostInfo::abortHostLookup()
diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
index 98511ac86e..1ce5d8a092 100644
--- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
+++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -9,3 +9,5 @@ symbian: TARGET.CAPABILITY = NetworkServices
symbian: {
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
}
+
+CONFIG+=insignificant_test # QTBUG-20981, crashes sometimes
diff --git a/tests/auto/qlistview/qlistview.pro b/tests/auto/qlistview/qlistview.pro
index 6d004fcfc4..cba2ef1170 100644
--- a/tests/auto/qlistview/qlistview.pro
+++ b/tests/auto/qlistview/qlistview.pro
@@ -3,4 +3,4 @@ QT += widgets
SOURCES += tst_qlistview.cpp
win32:!wince*: LIBS += -luser32
-
+qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index b3c41e1c2b..73a74c6d75 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -827,6 +827,9 @@ void tst_QMenu::task258920_mouseBorder()
#ifdef Q_OS_WINCE_WM
QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll);
#endif
+#ifdef Q_WS_QPA
+ QSKIP("QTBUG-20753 QCursor::setPos() / QTest::mouseMove() doesn't work on qpa", SkipAll);
+#endif
Menu258920 menu;
// On Symbian, styleHint(QStyle::SH_Menu_MouseTracking) in QS60Style is false.
// For other styles which inherit from QWindowsStyle, the value is true.
@@ -880,12 +883,27 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow()
b.show();
const QRect screen = QApplication::desktop()->screenGeometry(scrNumber);
- b.move(10, screen.bottom()-b.height()-5);
+ QRect desiredGeometry = b.geometry();
+ desiredGeometry.moveTopLeft(QPoint(10, screen.bottom()-b.height()-5));
+
+ b.setGeometry(desiredGeometry);
QTest::qWaitForWindowShown(&b);
+
+ if (b.geometry() != desiredGeometry) {
+ // We are trying to put the button very close to the edge of the screen,
+ // explicitly to test behavior when the popup menu goes off the screen.
+ // However a modern window manager is quite likely to reject this requested geometry
+ // (kwin in kde4 does, for example, since the button would probably appear behind
+ // or partially behind the taskbar).
+ // Your best bet is to run this test _without_ a WM.
+ QSKIP("Your window manager won't allow a window against the bottom of the screen", SkipAll);
+ }
+
QTimer::singleShot(300,lastMenu, SLOT(hide()));
QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
QVERIFY(!lastMenu->geometry().intersects(b.geometry()));
+ // note: we're assuming that, if we previously got the desired geometry, we'll get it here too
b.move(10, screen.bottom()-lastMenu->height()-5);
QTimer::singleShot(300,lastMenu, SLOT(hide()));
QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 51bb43716e..e1b7f1ff9b 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -344,6 +344,9 @@ void tst_QMenuBar::accel()
// create a popup menu with menu items set the accelerators later...
initSimpleMenubar();
+
+ // shortcuts won't work unless the window is active
+ QTRY_VERIFY( QApplication::activeWindow() );
// QTest::keyClick( 0, Qt::Key_A, AltKey );
QTest::keyClick( 0, Qt::Key_A, Qt::ControlModifier );
QTest::qWait(300);
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 99942d54be..3cd4376d80 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -689,6 +689,101 @@ void tst_QObject::findChildren()
tl = o.findChildren<QTimer *>("t1");
QCOMPARE(tl.size(), 1);
QCOMPARE(tl.at(0), &t1);
+
+ // Find direct child/children
+
+ op = o.findChild<QObject*>("o1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, &o1);
+ op = o.findChild<QObject*>("o2", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, &o2);
+ op = o.findChild<QObject*>("o11", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QObject*>("o12", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QObject*>("o111", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QObject*>("t1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(&t1));
+ op = o.findChild<QObject*>("t121", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QTimer*>("t1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(&t1));
+ op = o.findChild<QTimer*>("t121", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QTimer*>("o12", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QObject*>("o", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QObject*>("harry", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+ op = o.findChild<QObject*>("o1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, &o1);
+
+ l = o.findChildren<QObject*>("o1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 1);
+ QCOMPARE(l.at(0), &o1);
+ l = o.findChildren<QObject*>("o2", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 1);
+ QCOMPARE(l.at(0), &o2);
+ l = o.findChildren<QObject*>("o11", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+ l = o.findChildren<QObject*>("o12", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+ l = o.findChildren<QObject*>("o111", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+ l = o.findChildren<QObject*>("t1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 1);
+ QCOMPARE(l.at(0), static_cast<QObject *>(&t1));
+ l = o.findChildren<QObject*>("t121", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+ tl = o.findChildren<QTimer*>("t1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(tl.size(), 1);
+ QCOMPARE(tl.at(0), &t1);
+ tl = o.findChildren<QTimer*>("t121", Qt::FindDirectChildrenOnly);
+ QCOMPARE(tl.size(), 0);
+ l = o.findChildren<QObject*>("o", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+ l = o.findChildren<QObject*>("harry", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+ tl = o.findChildren<QTimer*>("o12", Qt::FindDirectChildrenOnly);
+ QCOMPARE(tl.size(), 0);
+ l = o.findChildren<QObject*>("o1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 1);
+ QCOMPARE(l.at(0), &o1);
+
+ l = o.findChildren<QObject*>(QRegExp("o.*"), Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 2);
+ QVERIFY(l.contains(&o1));
+ QVERIFY(l.contains(&o2));
+ l = o.findChildren<QObject*>(QRegExp("t.*"), Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 1);
+ QVERIFY(l.contains(&t1));
+ tl = o.findChildren<QTimer*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
+ QCOMPARE(tl.size(), 2);
+ QVERIFY(tl.contains(&t1));
+ tl = o.findChildren<QTimer*>(QRegExp("o.*"), Qt::FindDirectChildrenOnly);
+ QCOMPARE(tl.size(), 0);
+ l = o.findChildren<QObject*>(QRegExp("harry"), Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+
+ // empty and null string check
+ op = o.findChild<QObject*>(QString(), Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, &o1);
+ op = o.findChild<QObject*>("", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, &unnamed);
+ op = o.findChild<QObject*>("unnamed", Qt::FindDirectChildrenOnly);
+ QCOMPARE(op, static_cast<QObject *>(0));
+
+ l = o.findChildren<QObject*>(QString(), Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 5);
+ l = o.findChildren<QObject*>("", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 2);
+ l = o.findChildren<QObject*>("unnamed", Qt::FindDirectChildrenOnly);
+ QCOMPARE(l.size(), 0);
+
+ tl = o.findChildren<QTimer *>("t1", Qt::FindDirectChildrenOnly);
+ QCOMPARE(tl.size(), 1);
+ QCOMPARE(tl.at(0), &t1);
}
diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro
index 3660da3e39..00307d3e58 100644
--- a/tests/auto/qpainter/qpainter.pro
+++ b/tests/auto/qpainter/qpainter.pro
@@ -17,3 +17,4 @@ wince* {
mac*:CONFIG+=insignificant_test
+contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb
diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp
index 3941a11460..33315adc06 100644
--- a/tests/auto/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp
@@ -114,6 +114,8 @@ private slots:
void connectPathMoveTo();
void translate();
+
+ void lineWithinBounds();
};
// Testing get/set functions
@@ -1306,6 +1308,25 @@ void tst_QPainterPath::translate()
QCOMPARE(complexPath.translated(-offset), untranslatedComplexPath);
}
+
+void tst_QPainterPath::lineWithinBounds()
+{
+ const int iteration_count = 3;
+ volatile const qreal yVal = 0.5;
+ QPointF a(0.0, yVal);
+ QPointF b(1000.0, yVal);
+ QPointF c(2000.0, yVal);
+ QPointF d(3000.0, yVal);
+ QPainterPath path;
+ path.moveTo(QPointF(0, yVal));
+ path.cubicTo(QPointF(1000.0, yVal), QPointF(2000.0, yVal), QPointF(3000.0, yVal));
+ for(int i=0; i<=iteration_count; i++) {
+ qreal actual = path.pointAtPercent(qreal(i) / iteration_count).y();
+ QVERIFY(actual == yVal); // don't use QCOMPARE, don't want fuzzy comparison
+ }
+}
+
+
QTEST_APPLESS_MAIN(tst_QPainterPath)
#include "tst_qpainterpath.moc"
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 1365f080cc..38858e5503 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -800,6 +800,9 @@ void tst_QPixmap::grabWidget()
void tst_QPixmap::grabWindow()
{
+#ifdef Q_WS_QPA
+ QSKIP("QTBUG-20863 grabWindow is broken on most qpa backends", SkipAll);
+#endif
#ifdef Q_OS_WINCE
// We get out of memory, if the desktop itself is too big.
if (QApplication::desktop()->width() <= 480)
@@ -1257,6 +1260,9 @@ void tst_QPixmap::toSymbianCFbsBitmap()
void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
{
+#ifdef Q_WS_QPA
+ QSKIP("QTBUG-20864 can't determine if threaded pixmaps are available for qpa", SkipAll);
+#endif
#if !defined(Q_WS_WIN) && !defined(Q_WS_MAC)
class Thread : public QThread
{
diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp
index 99ca6fbd58..a6b6895981 100644
--- a/tests/auto/qprinter/tst_qprinter.cpp
+++ b/tests/auto/qprinter/tst_qprinter.cpp
@@ -423,8 +423,8 @@ void tst_QPrinter::testMargins()
void tst_QPrinter::testNonExistentPrinter()
{
-#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_MAC)
- QSKIP("QPrinter::testNonExistentPrinter() is not relevant for X11/Embedded/Mac", SkipAll);
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_MAC)
+ QSKIP("QPrinter::testNonExistentPrinter() is not relevant for this platform", SkipAll);
#else
QPrinter printer;
QPainter painter;
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp
index eb78057b5e..1c18f2f1e8 100644
--- a/tests/auto/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/qrawfont/tst_qrawfont.cpp
@@ -49,6 +49,8 @@ class tst_QRawFont: public QObject
Q_OBJECT
#if !defined(QT_NO_RAWFONT)
private slots:
+ void init();
+
void invalidRawFont();
void explicitRawFontNotLoadedInDatabase_data();
@@ -107,6 +109,20 @@ Q_DECLARE_METATYPE(QFont::Style)
Q_DECLARE_METATYPE(QFont::Weight)
Q_DECLARE_METATYPE(QFontDatabase::WritingSystem)
+void tst_QRawFont::init()
+{
+#ifdef Q_WS_QPA
+ // Loading fonts from a QByteArray seems unimplemented for all qpa plugins at time of writing;
+ // almost all testfunctions fail on qpa due to this, except these few:
+ const QByteArray func = QTest::currentTestFunction();
+ if (func != "invalidRawFont"
+ && func != "explicitRawFontNotAvailableInSystem"
+ && func != "fromFont"
+ && func != "textLayout")
+ QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort);
+#endif
+}
+
void tst_QRawFont::invalidRawFont()
{
QRawFont font;
@@ -292,6 +308,9 @@ void tst_QRawFont::textLayout()
QString familyName = QString::fromLatin1("QtBidiTestFont");
QFont font(familyName);
font.setPixelSize(18.0);
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort);
+#endif
QCOMPARE(QFontInfo(font).family(), familyName);
QTextLayout layout(QLatin1String("Foobar"));
@@ -608,6 +627,11 @@ void tst_QRawFont::fromFont()
QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
QVERIFY(rawFont.isValid());
+
+#ifdef Q_WS_QPA
+ QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort);
+#endif
+
QCOMPARE(rawFont.familyName(), familyName);
QCOMPARE(rawFont.pixelSize(), 26.0);
diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
index c416ec7ccb..77836b4671 100644
--- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -294,6 +294,7 @@ void tst_QSocketNotifier::posixSockets()
QTestEventLoop::instance().enterLoop(3);
QCOMPARE(readSpy.count(), 1);
+ QEXPECT_FAIL("", "QTBUG-20982 fails", Abort);
QCOMPARE(writeSpy.count(), 0);
QCOMPARE(errorSpy.count(), 0);
@@ -321,11 +322,13 @@ void tst_QSocketNotifier::bogusFds()
QSocketNotifier max(std::numeric_limits<int>::max(), QSocketNotifier::Read);
QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Invalid socket specified");
#ifndef Q_OS_WIN
- QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error");
+ // FIXME QTBUG-20982: this fails, and ignoreMessage can't be skipped or QEXPECT_FAILed
+ // QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error");
#endif
QSocketNotifier min(std::numeric_limits<int>::min(), QSocketNotifier::Write);
#ifndef Q_OS_WIN
- QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error");
+ // FIXME QTBUG-20982: this fails, and ignoreMessage can't be skipped or QEXPECT_FAILed
+ // QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error");
#endif
//bogus magic number is the first pseudo socket descriptor from symbian socket engine.
QSocketNotifier bogus(0x40000000, QSocketNotifier::Exception);
diff --git a/tests/auto/qsqlerror/tst_qsqlerror.cpp b/tests/auto/qsqlerror/tst_qsqlerror.cpp
index ad3ef05cda..d02b373c73 100644
--- a/tests/auto/qsqlerror/tst_qsqlerror.cpp
+++ b/tests/auto/qsqlerror/tst_qsqlerror.cpp
@@ -61,6 +61,7 @@ public:
private slots:
void getSetCheck();
void construction();
+ void operators();
};
tst_QSqlError::tst_QSqlError()
@@ -125,5 +126,20 @@ void tst_QSqlError::construction()
QVERIFY(!obj4.isValid());
}
+void tst_QSqlError::operators()
+{
+ QSqlError error1;
+ QSqlError error2;
+ QSqlError error3;
+
+ error1.setType(QSqlError::NoError);
+ error2.setType(QSqlError::NoError);
+ error3.setType(QSqlError::UnknownError);
+
+ QVERIFY(error1 == error2);
+ QVERIFY(error1 != error3);
+}
+
+
QTEST_MAIN(tst_QSqlError)
#include "tst_qsqlerror.moc"
diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem b/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem
index bc43c63f21..08176289d7 100644
--- a/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem
+++ b/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem
@@ -5,22 +5,22 @@ Certificate:
Signature Algorithm: sha1WithRSAEncryption
Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority
Validity
- Not Before: Jun 21 21:32:19 2011 GMT
- Not After : Jun 18 21:32:19 2021 GMT
+ Not Before: Jul 31 21:01:17 2011 GMT
+ Not After : Jul 28 21:01:17 2021 GMT
Subject: CN=www.example.com, CN=www2.example.com, ST=Lancashire, C=UK, O=Some organisation
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (1024 bit)
Modulus:
- 00:b8:b3:72:13:cd:17:2c:01:78:16:62:5d:72:71:
- 33:14:41:be:0c:17:ac:85:db:f8:1e:e8:55:98:3e:
- 7b:46:a5:08:a7:db:0e:dc:78:d8:b7:1e:e0:78:30:
- 6e:b9:e2:43:2e:f2:7d:98:fb:b4:a8:5e:63:42:e8:
- 5c:26:79:20:5e:f6:0e:1d:12:ac:c5:0e:a4:b6:68:
- 79:5f:3d:52:ce:44:f9:20:c9:8e:b3:fb:20:42:d5:
- 97:9f:a4:41:8f:b8:b1:8d:c3:14:61:70:b8:d1:f7:
- ff:48:99:c1:a0:dd:71:cb:8b:91:e6:60:29:1e:af:
- a9:00:91:d2:c3:af:7f:cd:f9
+ 00:e8:61:96:bd:d0:d2:c6:54:92:15:fe:42:2b:86:
+ 20:dc:74:51:82:c8:b4:5e:5e:c5:3b:01:6e:1e:84:
+ 8d:4a:8c:6f:d8:63:21:a7:74:16:02:62:c3:84:1f:
+ ac:83:00:ad:6d:f8:79:d0:48:19:4a:a4:45:bf:24:
+ 88:db:89:f7:96:80:70:b1:f9:94:46:8d:52:cd:47:
+ 11:86:74:3b:04:c6:d2:08:3b:4d:70:b0:d4:a2:5a:
+ ae:54:43:4e:8c:26:05:77:b4:52:8b:bf:43:26:cd:
+ 6e:b6:04:ca:36:e1:cf:c3:70:52:7b:73:40:1d:1f:
+ 2a:44:b9:fc:d3:be:77:5a:df
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -29,39 +29,39 @@ Certificate:
OCSP - URI:http://ocsp.example.com:8888/
Signature Algorithm: sha1WithRSAEncryption
- 4c:c8:bc:0e:84:4b:bb:9e:c1:7b:81:4d:65:60:e5:d1:86:6a:
- 00:f2:fb:ff:6d:a1:23:a1:88:c7:85:4a:b2:3d:24:cf:92:c8:
- ab:60:10:b8:17:fa:d2:4f:60:cd:94:40:2a:b7:6e:4a:e9:f9:
- 2b:e6:54:70:7f:f3:71:f8:fc:45:df:cf:43:f4:26:d6:73:69:
- b3:ff:d9:da:dc:12:05:e2:52:62:2f:d4:b0:0a:e3:a1:e8:f2:
- c1:80:b7:44:8e:3a:46:ca:1b:6d:82:c0:16:c2:f6:4f:56:89:
- 24:86:42:8e:f9:5e:63:91:7d:88:ff:c4:bd:0d:f5:00:ad:ba:
- 6c:fd:5d:02:32:4f:94:3f:4e:10:4a:a6:15:c2:77:e6:be:a0:
- ea:15:e3:49:40:e8:f0:7d:e0:fe:33:f2:6b:36:a6:a6:70:52:
- 21:d2:ff:ee:ce:2d:46:50:dd:c2:19:4d:9a:1a:f1:a8:e8:45:
- 41:2d:6e:29:d3:c8:59:69:dd:1b:5c:21:21:31:b6:be:98:64:
- 31:a2:3e:a6:36:9c:27:8f:86:bb:0e:aa:67:f1:0b:e1:ea:d6:
- d6:50:72:6c:24:cd:85:8e:32:26:45:44:2e:7c:83:69:54:9b:
- 8b:1b:94:71:ba:8e:49:77:dd:d1:d4:30:a6:56:80:95:5e:6b:
- b8:11:bf:b0
+ a7:ce:f4:72:aa:54:01:d5:a0:ef:fb:54:a5:79:d0:51:87:27:
+ 93:37:d7:a8:92:a0:51:a4:56:a6:93:ea:3b:f4:e2:07:68:29:
+ 2b:59:e6:eb:71:d8:78:0a:b2:e2:df:13:9f:68:f9:6b:d8:42:
+ c6:ff:3b:e1:2e:01:91:9b:eb:90:7f:da:54:7e:5a:47:ba:40:
+ 18:fb:a5:f7:8a:3a:b0:05:37:03:a8:b8:23:61:d4:58:37:97:
+ 87:54:57:62:aa:7f:e6:73:8f:74:f4:3b:57:29:af:bb:f7:bc:
+ 33:72:d4:f3:02:22:44:3e:70:1f:48:59:7d:6e:a0:af:c4:91:
+ 58:4c:99:6b:33:28:36:09:59:c7:71:a7:94:ba:0e:af:87:d2:
+ 47:75:86:c1:ac:2d:ab:89:83:03:a9:97:cb:50:39:c1:66:a3:
+ a2:92:f6:c8:42:05:5b:d3:e4:13:17:84:10:57:8f:3e:ae:d0:
+ 5e:f7:15:54:dd:04:61:2f:d6:d4:25:00:d6:6f:02:bb:b9:9f:
+ ff:ab:d2:a0:32:87:a0:d2:ff:91:29:bf:5d:74:61:d8:86:e5:
+ 89:29:5e:c0:85:b1:05:e1:79:68:50:fa:21:98:cc:26:09:d1:
+ 86:18:4d:2e:84:21:33:d1:ff:b5:bf:78:2d:0b:9e:8c:51:82:
+ 09:9c:03:ec
-----BEGIN CERTIFICATE-----
MIIDXjCCAkagAwIBAgIBCjANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz
dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx
CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G
A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0
-aW9uIEF1dGhvcml0eTAeFw0xMTA2MjEyMTMyMTlaFw0yMTA2MTgyMTMyMTlaMHMx
+aW9uIEF1dGhvcml0eTAeFw0xMTA3MzEyMTAxMTdaFw0yMTA3MjgyMTAxMTdaMHMx
GDAWBgNVBAMTD3d3dy5leGFtcGxlLmNvbTEZMBcGA1UEAxMQd3d3Mi5leGFtcGxl
LmNvbTETMBEGA1UECBMKTGFuY2FzaGlyZTELMAkGA1UEBhMCVUsxGjAYBgNVBAoT
-EVNvbWUgb3JnYW5pc2F0aW9uMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4
-s3ITzRcsAXgWYl1ycTMUQb4MF6yF2/ge6FWYPntGpQin2w7ceNi3HuB4MG654kMu
-8n2Y+7SoXmNC6FwmeSBe9g4dEqzFDqS2aHlfPVLORPkgyY6z+yBC1ZefpEGPuLGN
-wxRhcLjR9/9ImcGg3XHLi5HmYCker6kAkdLDr3/N+QIDAQABo0gwRjAJBgNVHRME
+EVNvbWUgb3JnYW5pc2F0aW9uMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDo
+YZa90NLGVJIV/kIrhiDcdFGCyLReXsU7AW4ehI1KjG/YYyGndBYCYsOEH6yDAK1t
++HnQSBlKpEW/JIjbifeWgHCx+ZRGjVLNRxGGdDsExtIIO01wsNSiWq5UQ06MJgV3
+tFKLv0MmzW62BMo24c/DcFJ7c0AdHypEufzTvnda3wIDAQABo0gwRjAJBgNVHRME
AjAAMDkGCCsGAQUFBwEBBC0wKzApBggrBgEFBQcwAYYdaHR0cDovL29jc3AuZXhh
-bXBsZS5jb206ODg4OC8wDQYJKoZIhvcNAQEFBQADggEBAEzIvA6ES7uewXuBTWVg
-5dGGagDy+/9toSOhiMeFSrI9JM+SyKtgELgX+tJPYM2UQCq3bkrp+SvmVHB/83H4
-/EXfz0P0JtZzabP/2drcEgXiUmIv1LAK46Ho8sGAt0SOOkbKG22CwBbC9k9WiSSG
-Qo75XmORfYj/xL0N9QCtumz9XQIyT5Q/ThBKphXCd+a+oOoV40lA6PB94P4z8ms2
-pqZwUiHS/+7OLUZQ3cIZTZoa8ajoRUEtbinTyFlp3RtcISExtr6YZDGiPqY2nCeP
-hrsOqmfxC+Hq1tZQcmwkzYWOMiZFRC58g2lUm4sblHG6jkl33dHUMKZWgJVea7gR
-v7A=
+bXBsZS5jb206ODg4OC8wDQYJKoZIhvcNAQEFBQADggEBAKfO9HKqVAHVoO/7VKV5
+0FGHJ5M316iSoFGkVqaT6jv04gdoKStZ5utx2HgKsuLfE59o+WvYQsb/O+EuAZGb
+65B/2lR+Wke6QBj7pfeKOrAFNwOouCNh1Fg3l4dUV2Kqf+Zzj3T0O1cpr7v3vDNy
+1PMCIkQ+cB9IWX1uoK/EkVhMmWszKDYJWcdxp5S6Dq+H0kd1hsGsLauJgwOpl8tQ
+OcFmo6KS9shCBVvT5BMXhBBXjz6u0F73FVTdBGEv1tQlANZvAru5n/+r0qAyh6DS
+/5Epv110YdiG5YkpXsCFsQXheWhQ+iGYzCYJ0YYYTS6EITPR/7W/eC0LnoxRggmc
+A+w=
-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem b/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem
index 952b711aa2..ed8823a520 100644
--- a/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem
+++ b/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem
@@ -5,22 +5,22 @@ Certificate:
Signature Algorithm: sha1WithRSAEncryption
Issuer: CN=Westpoint Certificate Test CA, ST=Lancashire, C=UK/emailAddress=ca@example.com, O=Westpoint Certificate Test Root Certification Authority
Validity
- Not Before: Jun 26 19:36:40 2011 GMT
- Not After : Jun 23 19:36:40 2021 GMT
+ Not Before: Jul 31 21:01:17 2011 GMT
+ Not After : Jul 28 21:01:17 2021 GMT
Subject: CN=example.com/emailAddress=test@example.com/favouriteDrink=tequila
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (1024 bit)
Modulus:
- 00:a5:88:9c:fd:1b:8d:26:90:7d:ed:b2:66:14:09:
- 88:9f:c5:96:87:97:84:33:db:fd:a9:32:20:d0:4d:
- 03:ce:34:a6:b3:e2:db:33:27:e5:5b:09:3b:6f:49:
- 36:c8:99:63:88:4c:33:f2:55:bc:04:02:07:50:59:
- 6a:34:52:4c:83:74:cb:d5:54:b5:a9:41:91:07:0e:
- cf:50:3b:87:09:a5:5f:d8:71:f3:ee:d8:10:6d:5c:
- 5d:69:ab:dc:98:d7:1a:38:63:c6:15:4e:d7:31:19:
- 96:4c:db:be:d3:32:9d:ad:8b:1d:85:1b:aa:cf:d1:
- b1:a4:ce:bf:5a:0f:30:a0:63
+ 00:b8:2a:88:dd:a3:5b:4a:44:69:03:d5:6e:18:e9:
+ 9e:55:0d:35:d0:e6:9a:c2:cc:f8:b5:c5:b6:15:00:
+ a1:24:33:af:e8:fb:93:b9:cc:b9:22:28:ef:69:57:
+ b0:a2:d0:e3:9e:e5:73:3e:90:55:5b:91:26:0b:c4:
+ 1a:a6:b6:9d:a2:68:5b:e8:5b:45:3f:21:ff:84:64:
+ a7:84:bb:61:b7:72:e7:ea:cb:49:66:40:23:be:bf:
+ f0:8d:60:f2:fb:71:b2:fc:fe:6b:e7:07:94:35:65:
+ 66:d8:06:90:82:4d:b1:ba:6c:78:f4:42:17:cb:3c:
+ 0e:10:70:21:a9:31:3b:88:41
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
@@ -29,38 +29,38 @@ Certificate:
OCSP - URI:http://ocsp.example.com:8888/
Signature Algorithm: sha1WithRSAEncryption
- 21:55:2f:82:17:e6:8c:2c:39:af:2a:ce:b7:83:7f:cf:76:ce:
- 25:39:b5:08:3c:9b:33:a2:9b:f7:3f:df:7d:67:7b:11:c7:e3:
- ac:6f:59:c0:4f:25:3b:6d:3c:ec:3e:c2:0d:4c:a4:43:dd:4f:
- c4:4c:5a:67:9d:a9:7a:91:c3:48:ed:40:5e:4d:6f:18:46:38:
- 9c:e2:9a:7f:c9:d8:26:0c:35:fa:60:87:67:45:56:42:81:ba:
- 4b:b6:03:6f:6c:7d:d1:f9:78:a1:08:9e:4a:f1:00:07:4b:ca:
- ec:a4:1d:26:ad:63:46:63:5f:b2:64:2e:d3:cd:80:35:87:4f:
- c4:16:1a:91:97:50:95:16:31:c5:97:49:70:19:68:a9:a8:6c:
- 0f:c3:5b:8f:6a:1f:3f:e7:3b:ba:48:76:2c:b0:8d:b3:de:ce:
- 7b:c7:bf:0f:80:34:7c:73:d5:d6:45:63:83:02:c5:4d:73:9b:
- 66:8a:3a:66:dc:0c:9f:75:1a:a7:15:d1:1d:7f:12:af:f4:5d:
- 9c:80:99:55:9b:26:69:ec:76:11:fe:4e:65:f7:57:7d:32:bb:
- 9a:25:51:76:f5:68:99:2a:d2:a5:53:17:87:b6:ad:08:f1:24:
- db:6f:45:07:d2:f1:60:50:ac:a0:d0:b7:0b:45:aa:e2:27:38:
- 1f:4c:41:a3
+ 4b:a3:3d:37:e4:fa:61:3b:8c:94:c7:b1:49:55:a6:63:c4:b8:
+ 13:33:8c:0b:ad:c9:f6:38:d1:a6:d3:5e:7f:10:23:be:d5:4c:
+ 63:de:15:9b:eb:f1:08:0c:32:95:ff:87:bc:c7:41:c3:17:af:
+ 73:c9:ac:18:2c:3d:6d:87:9b:41:71:92:e4:57:f0:da:b7:f4:
+ f3:92:dd:db:a0:b3:82:1a:8d:88:d4:ff:b2:8e:ac:65:6f:b0:
+ 59:0a:4e:cf:12:cd:fe:ce:35:85:da:13:1c:5e:d0:30:38:8a:
+ ec:46:eb:d7:a7:87:93:1b:08:a0:28:b0:2d:fc:7d:36:51:2f:
+ df:6b:67:57:15:b3:a7:cf:dd:55:ee:81:fc:66:fc:a7:22:5f:
+ e7:86:91:0b:3f:35:56:5f:fa:41:9c:71:06:03:d0:62:d2:3b:
+ e2:08:ab:af:42:2b:1f:68:9f:17:0a:20:3b:de:a1:fa:0a:44:
+ a8:67:67:c2:96:7a:ec:fa:92:4d:8f:c8:ba:be:d7:0c:c7:c8:
+ 6d:9f:b1:6c:c8:1d:e9:b9:5c:30:f3:a2:52:43:e5:43:2a:54:
+ 24:15:b3:d5:95:af:f8:01:ab:f3:c3:3f:1d:8e:35:58:11:6c:
+ 12:82:6f:ad:c3:78:c1:cd:43:ff:93:90:25:9f:97:17:36:8e:
+ 74:28:e8:a9
-----BEGIN CERTIFICATE-----
MIIDOzCCAiOgAwIBAgIBCzANBgkqhkiG9w0BAQUFADCBqzEmMCQGA1UEAxMdV2Vz
dHBvaW50IENlcnRpZmljYXRlIFRlc3QgQ0ExEzARBgNVBAgTCkxhbmNhc2hpcmUx
CzAJBgNVBAYTAlVLMR0wGwYJKoZIhvcNAQkBFg5jYUBleGFtcGxlLmNvbTFAMD4G
A1UEChM3V2VzdHBvaW50IENlcnRpZmljYXRlIFRlc3QgUm9vdCBDZXJ0aWZpY2F0
-aW9uIEF1dGhvcml0eTAeFw0xMTA2MjYxOTM2NDBaFw0yMTA2MjMxOTM2NDBaMFAx
+aW9uIEF1dGhvcml0eTAeFw0xMTA3MzEyMTAxMTdaFw0yMTA3MjgyMTAxMTdaMFAx
FDASBgNVBAMTC2V4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkBFhB0ZXN0QGV4YW1w
bGUuY29tMRcwFQYKCZImiZPyLGQBBRMHdGVxdWlsYTCBnzANBgkqhkiG9w0BAQEF
-AAOBjQAwgYkCgYEApYic/RuNJpB97bJmFAmIn8WWh5eEM9v9qTIg0E0DzjSms+Lb
-MyflWwk7b0k2yJljiEwz8lW8BAIHUFlqNFJMg3TL1VS1qUGRBw7PUDuHCaVf2HHz
-7tgQbVxdaavcmNcaOGPGFU7XMRmWTNu+0zKdrYsdhRuqz9GxpM6/Wg8woGMCAwEA
+AAOBjQAwgYkCgYEAuCqI3aNbSkRpA9VuGOmeVQ010Oaawsz4tcW2FQChJDOv6PuT
+ucy5IijvaVewotDjnuVzPpBVW5EmC8Qapradomhb6FtFPyH/hGSnhLtht3Ln6stJ
+ZkAjvr/wjWDy+3Gy/P5r5weUNWVm2AaQgk2xumx49EIXyzwOEHAhqTE7iEECAwEA
AaNIMEYwCQYDVR0TBAIwADA5BggrBgEFBQcBAQQtMCswKQYIKwYBBQUHMAGGHWh0
-dHA6Ly9vY3NwLmV4YW1wbGUuY29tOjg4ODgvMA0GCSqGSIb3DQEBBQUAA4IBAQAh
-VS+CF+aMLDmvKs63g3/Pds4lObUIPJszopv3P999Z3sRx+Osb1nATyU7bTzsPsIN
-TKRD3U/ETFpnnal6kcNI7UBeTW8YRjic4pp/ydgmDDX6YIdnRVZCgbpLtgNvbH3R
-+XihCJ5K8QAHS8rspB0mrWNGY1+yZC7TzYA1h0/EFhqRl1CVFjHFl0lwGWipqGwP
-w1uPah8/5zu6SHYssI2z3s57x78PgDR8c9XWRWODAsVNc5tmijpm3AyfdRqnFdEd
-fxKv9F2cgJlVmyZp7HYR/k5l91d9MruaJVF29WiZKtKlUxeHtq0I8STbb0UH0vFg
-UKyg0LcLRariJzgfTEGj
+dHA6Ly9vY3NwLmV4YW1wbGUuY29tOjg4ODgvMA0GCSqGSIb3DQEBBQUAA4IBAQBL
+oz035PphO4yUx7FJVaZjxLgTM4wLrcn2ONGm015/ECO+1Uxj3hWb6/EIDDKV/4e8
+x0HDF69zyawYLD1th5tBcZLkV/Dat/Tzkt3boLOCGo2I1P+yjqxlb7BZCk7PEs3+
+zjWF2hMcXtAwOIrsRuvXp4eTGwigKLAt/H02US/fa2dXFbOnz91V7oH8ZvynIl/n
+hpELPzVWX/pBnHEGA9Bi0jviCKuvQisfaJ8XCiA73qH6CkSoZ2fClnrs+pJNj8i6
+vtcMx8htn7FsyB3puVww86JSQ+VDKlQkFbPVla/4Aavzwz8djjVYEWwSgm+tw3jB
+zUP/k5Aln5cXNo50KOip
-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index e0bc029c71..bcd21eefe2 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -95,9 +95,9 @@ private slots:
void copyAndAssign();
void digest_data();
void digest();
- void alternateSubjectNames_data();
+ void subjectAlternativeNames_data();
void utf8SubjectNames();
- void alternateSubjectNames();
+ void subjectAlternativeNames();
void publicKey_data();
void publicKey();
void toPemOrDer_data();
@@ -203,7 +203,7 @@ void tst_QSslCertificate::emptyConstructor()
QCOMPARE(certificate.digest(), QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md5));
QCOMPARE(certificate.issuerInfo(QSslCertificate::Organization), QStringList());
QCOMPARE(certificate.subjectInfo(QSslCertificate::Organization), QStringList());
- QCOMPARE(certificate.alternateSubjectNames(),(QMultiMap<QSsl::AlternateNameEntryType, QString>()));
+ QCOMPARE(certificate.subjectAlternativeNames(),(QMultiMap<QSsl::AlternativeNameEntryType, QString>()));
#ifndef QT_NO_TEXTSTREAM
QCOMPARE(certificate.effectiveDate(), QDateTime());
QCOMPARE(certificate.expiryDate(), QDateTime());
@@ -272,7 +272,7 @@ void tst_QSslCertificate::compareCertificates(
QCOMPARE(cert1.issuerInfo(subjectInfo), cert2.issuerInfo(subjectInfo));
QCOMPARE(cert1.subjectInfo(subjectInfo), cert2.subjectInfo(subjectInfo));
}
- QCOMPARE(cert1.alternateSubjectNames(), cert2.alternateSubjectNames());
+ QCOMPARE(cert1.subjectAlternativeNames(), cert2.subjectAlternativeNames());
QCOMPARE(cert1.effectiveDate(), cert2.effectiveDate());
QCOMPARE(cert1.expiryDate(), cert2.expiryDate());
QCOMPARE(cert1.version(), cert2.version());
@@ -352,7 +352,7 @@ void tst_QSslCertificate::digest()
certificate.digest(QCryptographicHash::Sha1));
}
-void tst_QSslCertificate::alternateSubjectNames_data()
+void tst_QSslCertificate::subjectAlternativeNames_data()
{
QTest::addColumn<QString>("certFilePath");
QTest::addColumn<QSsl::EncodingFormat>("format");
@@ -368,7 +368,7 @@ void tst_QSslCertificate::alternateSubjectNames_data()
}
}
-void tst_QSslCertificate::alternateSubjectNames()
+void tst_QSslCertificate::subjectAlternativeNames()
{
if (!QSslSocket::supportsSsl())
return;
@@ -383,11 +383,11 @@ void tst_QSslCertificate::alternateSubjectNames()
QByteArray fileContents = readFile(subjAltNameFilePath);
- const QMultiMap<QSsl::AlternateNameEntryType, QString> altSubjectNames =
- certificate.alternateSubjectNames();
+ const QMultiMap<QSsl::AlternativeNameEntryType, QString> altSubjectNames =
+ certificate.subjectAlternativeNames();
// verify that each entry in subjAltNames is present in fileContents
- QMapIterator<QSsl::AlternateNameEntryType, QString> it(altSubjectNames);
+ QMapIterator<QSsl::AlternativeNameEntryType, QString> it(altSubjectNames);
while (it.hasNext()) {
it.next();
QString type;
@@ -404,7 +404,7 @@ void tst_QSslCertificate::alternateSubjectNames()
// verify that each entry in fileContents is present in subjAltNames
QRegExp rx(QLatin1String("(email|DNS):([^,\\r\\n]+)"));
for (int pos = 0; (pos = rx.indexIn(fileContents, pos)) != -1; pos += rx.matchedLength()) {
- QSsl::AlternateNameEntryType key;
+ QSsl::AlternativeNameEntryType key;
if (rx.cap(1) == QLatin1String("email"))
key = QSsl::EmailEntry;
else if (rx.cap(1) == QLatin1String("DNS"))
@@ -811,7 +811,7 @@ void tst_QSslCertificate::nulInSan()
const QSslCertificate &cert = certList.at(0);
QVERIFY(!cert.isNull());
- QMultiMap<QSsl::AlternateNameEntryType, QString> san = cert.alternateSubjectNames();
+ QMultiMap<QSsl::AlternativeNameEntryType, QString> san = cert.subjectAlternativeNames();
QVERIFY(!san.isEmpty());
QString dnssan = san.value(QSsl::DnsEntry);
@@ -929,7 +929,6 @@ void tst_QSslCertificate::verify()
toVerify = QSslCertificate::fromPath(SRCDIR "verify-certs/test-ocsp-good-cert.pem");
errors = QSslCertificate::verify(toVerify);
- QEXPECT_FAIL("", "QTBUG-20582 fails since ~5am, 27th July 2011", Continue);
VERIFY_VERBOSE(errors.count() == 0);
errors.clear();
@@ -965,12 +964,10 @@ void tst_QSslCertificate::verify()
toVerify << QSslCertificate::fromPath(SRCDIR "verify-certs/test-intermediate-is-ca-cert.pem").first();
toVerify << QSslCertificate::fromPath(SRCDIR "verify-certs/test-intermediate-ca-cert.pem").first();
errors = QSslCertificate::verify(toVerify);
- QEXPECT_FAIL("", "QTBUG-20582 fails since ~5am, 27th July 2011", Continue);
VERIFY_VERBOSE(errors.count() == 0);
// Recheck the above with hostname validation
errors = QSslCertificate::verify(toVerify, QLatin1String("example.com"));
- QEXPECT_FAIL("", "QTBUG-20582 fails since ~5am, 27th July 2011", Continue);
VERIFY_VERBOSE(errors.count() == 0);
// Recheck the above with a bad hostname
diff --git a/tests/auto/qsslcertificate/verify-certs/cacert.pem b/tests/auto/qsslcertificate/verify-certs/cacert.pem
index 0e06285766..8c75c54bcb 100644
--- a/tests/auto/qsslcertificate/verify-certs/cacert.pem
+++ b/tests/auto/qsslcertificate/verify-certs/cacert.pem
@@ -1,23 +1,23 @@
-----BEGIN CERTIFICATE-----
-MIID6zCCAtOgAwIBAgIJALIOhqebAhS9MA0GCSqGSIb3DQEBBQUAMIGrMSYwJAYD
+MIID6zCCAtOgAwIBAgIJAP4bjANFSx0BMA0GCSqGSIb3DQEBBQUAMIGrMSYwJAYD
VQQDEx1XZXN0cG9pbnQgQ2VydGlmaWNhdGUgVGVzdCBDQTETMBEGA1UECBMKTGFu
Y2FzaGlyZTELMAkGA1UEBhMCVUsxHTAbBgkqhkiG9w0BCQEWDmNhQGV4YW1wbGUu
Y29tMUAwPgYDVQQKEzdXZXN0cG9pbnQgQ2VydGlmaWNhdGUgVGVzdCBSb290IENl
-cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTExMDYyNjE5MzYzOVoXDTExMDcyNjE5
-MzYzOVowgasxJjAkBgNVBAMTHVdlc3Rwb2ludCBDZXJ0aWZpY2F0ZSBUZXN0IENB
+cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTExMDczMTIxMDExNloXDTIxMDcyODIx
+MDExNlowgasxJjAkBgNVBAMTHVdlc3Rwb2ludCBDZXJ0aWZpY2F0ZSBUZXN0IENB
MRMwEQYDVQQIEwpMYW5jYXNoaXJlMQswCQYDVQQGEwJVSzEdMBsGCSqGSIb3DQEJ
ARYOY2FAZXhhbXBsZS5jb20xQDA+BgNVBAoTN1dlc3Rwb2ludCBDZXJ0aWZpY2F0
ZSBUZXN0IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQCoP3znXuxcIAWkyu51aPWwXYX0kSPnBO1gcJj6
-xQa4ycOHv9Cs9XTVTGvpj4aoc6lP+6/jUe14cVCR7018zHRe7u5g4ozO1aZqISqS
-Y4hdWkTSFPmFoiyXkACl0ZGwcfv6QdFhNnK4COBrff4D6lndfQUZu8CnRYxlKGuR
-1vGiUcJ88t0dDmMEFEdYNtlDnYlxXHbTS4VdRb2u3EGFzV24ENJwgqYuFrBAG/+N
-TRXahWMsdfP0whCYJOsaNBwXaoeoxGlYz35gMU8A8AFmYOJLohsWqHcHmMV3X6hn
-aKGnL3nOa8zlNKNr948Dwenucaggf5KquDCHVf2Ms+ROxlfTAgMBAAGjEDAOMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAGmY4+AeMyx+FkpPxeNY3DAH
-Jys0WfndLZFABARYfKdJE1dqQi3uXaRkKMkV7npb46cw92jmwFT+v9rHd88UmgMs
-KGJNWjARD6Ai1dzenMNYBJz9GFkDJ0Pr4Gqj2tR9JuzEOdxss+nZ4r6vhC+/yeAB
-4jGT4QMuYU+14Rfsv5Aw0HjbcH955zTy1pJ6ck9OWWyzET8ALxz+RTFOok/4r4++
-yhE5Hh8+2aE52AcZqKa4hKXdVBCb9oewl93h3rmYcA/Yz36w+GRkSnOPZUgDDL5D
-HKnICDidtf9ZZBZ4iJxaBg4iCraeuei20V+0g+9/1aoIWJ5TrelVYVCx8O0x+E0=
+DQEBAQUAA4IBDwAwggEKAoIBAQC5xMKXviXuxFO67WzFIImO5RY3Y+dqt7maTB+p
+JiHkn98rJoBB4J1cDnEUIs5ErO+kqOjW7JwF50fePNJ5K+I6SbRVn9gxAI59ZA6O
+9UvOPZOw4/6GM24UY4B4mUcp8oXg9fhwgtjVhfXiMD2GvKQq3RazIiCoSW4aJWEq
+L58Q+sIo+jL72qwk648xIwIhuC3XzcOOE/+rCOtZmu812/NN08UfsL2qup0aaaGv
+aL36n6OIx5AYFcCD5uOxXAmUy14mhwQyDHAl6K42ghSm5b43VMMSQ+N9AQpentWl
+RH6Vt1eY52YTxjNxpRlj88GBnYxdr8WgjKOV7v8OPGXP6zWlAgMBAAGjEDAOMAwG
+A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADptDEfvsh8aq/tTc7ciGkHG
+jh7WFELVTcdWBTyveZ24298Hl9UOfsAfLqjMGMs3delAaZocchba9Og2xSZyRstH
+GUtlJXd4PnSJSx/TksPf2DCANo5sxBWBITs1Iprm3Nlm3/xPZM2QLIamRYi2J6Ed
+JTfWvMpoaW1umJX49jKqk1gfdcS6e