summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfig.tests/unix/compile.test5
-rwxr-xr-xconfigure60
-rw-r--r--doc/src/index.qdoc20
-rw-r--r--doc/src/installation.qdoc3
-rw-r--r--doc/src/introtodbus.qdoc19
-rw-r--r--doc/src/qmake-manual.qdoc4
-rw-r--r--doc/src/snippets/code/doc_src_introtodbus.qdoc5
-rw-r--r--qmake/generators/makefile.cpp1
-rw-r--r--src/corelib/codecs/qutfcodec.cpp15
-rw-r--r--src/corelib/io/qdir.cpp73
-rw-r--r--src/corelib/io/qfile.cpp6
-rw-r--r--src/corelib/io/qsettings_p.h2
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/kernel/qvariant.cpp16
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp3
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp6
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp7
-rw-r--r--src/corelib/tools/qstringbuilder.cpp10
-rw-r--r--src/gui/accessible/qaccessible_win.cpp4
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp14
-rw-r--r--src/gui/dialogs/qcolordialog.cpp2
-rw-r--r--src/gui/dialogs/qerrormessage.cpp2
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp6
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/gui/dialogs/qmessagebox.cpp24
-rw-r--r--src/gui/dialogs/qpagesetupdialog_win.cpp2
-rw-r--r--src/gui/dialogs/qprintdialog_win.cpp2
-rw-r--r--src/gui/dialogs/qprogressdialog.cpp2
-rw-r--r--src/gui/dialogs/qwizard.cpp2
-rw-r--r--src/gui/dialogs/qwizard_win.cpp4
-rw-r--r--src/gui/graphicsview/graphicsview.pri77
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp250
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h42
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp24
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp122
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h9
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp125
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h6
-rw-r--r--src/gui/image/qicon.cpp2
-rw-r--r--src/gui/inputmethod/qinputcontext.cpp4
-rw-r--r--src/gui/inputmethod/qwininputcontext_win.cpp4
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp14
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h2
-rw-r--r--src/gui/itemviews/qcolumnview.cpp40
-rw-r--r--src/gui/itemviews/qheaderview.cpp7
-rw-r--r--src/gui/itemviews/qlistview.cpp10
-rw-r--r--src/gui/itemviews/qlistwidget.cpp92
-rw-r--r--src/gui/itemviews/qlistwidget_p.h2
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp36
-rw-r--r--src/gui/itemviews/qtablewidget.cpp118
-rw-r--r--src/gui/itemviews/qtablewidget_p.h2
-rw-r--r--src/gui/itemviews/qtreeview.cpp47
-rw-r--r--src/gui/itemviews/qtreewidget.cpp97
-rw-r--r--src/gui/itemviews/qtreewidget_p.h7
-rw-r--r--src/gui/kernel/qapplication.cpp36
-rw-r--r--src/gui/kernel/qapplication_win.cpp84
-rw-r--r--src/gui/kernel/qcursor.cpp2
-rw-r--r--src/gui/kernel/qdnd.cpp2
-rw-r--r--src/gui/kernel/qdnd_win.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp6
-rw-r--r--src/gui/kernel/qwidget.cpp36
-rw-r--r--src/gui/kernel/qwidget_p.h14
-rw-r--r--src/gui/kernel/qwidget_win.cpp6
-rw-r--r--src/gui/painting/qbackingstore.cpp4
-rw-r--r--src/gui/painting/qdrawutil.cpp22
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp12
-rw-r--r--src/gui/painting/qpaintengine_mac.cpp4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp7
-rw-r--r--src/gui/painting/qpaintengineex.cpp12
-rw-r--r--src/gui/painting/qpainter.cpp29
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qvectorpath_p.h2
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp4
-rw-r--r--src/gui/styles/qcommonstyle.cpp6
-rw-r--r--src/gui/styles/qstylefactory.cpp2
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp26
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp4
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp6
-rw-r--r--src/gui/text/qfontdatabase.cpp36
-rw-r--r--src/gui/text/qtextcontrol.cpp4
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp10
-rw-r--r--src/gui/text/qtextodfwriter.cpp51
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp2
-rw-r--r--src/gui/widgets/qabstractbutton.cpp22
-rw-r--r--src/gui/widgets/qdockwidget.cpp75
-rw-r--r--src/gui/widgets/qeffects.cpp8
-rw-r--r--src/gui/widgets/qmdiarea.cpp34
-rw-r--r--src/gui/widgets/qmdisubwindow.cpp36
-rw-r--r--src/gui/widgets/qmdisubwindow_p.h4
-rw-r--r--src/gui/widgets/qmenu.cpp12
-rw-r--r--src/gui/widgets/qmenubar.cpp4
-rw-r--r--src/gui/widgets/qpushbutton.cpp6
-rw-r--r--src/gui/widgets/qspinbox.cpp13
-rw-r--r--src/gui/widgets/qsplitter.cpp2
-rw-r--r--src/gui/widgets/qtabwidget.cpp2
-rw-r--r--src/gui/widgets/qtextbrowser.cpp8
-rw-r--r--src/gui/widgets/qtoolbar.cpp12
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp7
-rw-r--r--src/gui/widgets/qtoolbutton.cpp6
-rw-r--r--src/gui/widgets/qwidgetresizehandler.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp45
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h11
-rw-r--r--src/network/access/qhttpnetworkreply.cpp2
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/tools/moc/moc.cpp8
-rw-r--r--src/tools/moc/moc.h3
-rw-r--r--tests/auto/auto.pro10
-rw-r--r--tests/auto/qgraphicsobject/qgraphicsobject.pro2
-rw-r--r--tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp255
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp63
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp2
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp99
-rw-r--r--tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp49
-rw-r--r--tests/auto/qtextcodec/test/test.pro6
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp66
-rw-r--r--tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp2
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp21
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp14
-rw-r--r--tests/auto/uiloader/baseline/css_task255849_downarrow.ui144
-rw-r--r--tests/auto/uiloader/baseline/images/arrow-down.pngbin0 -> 1006 bytes
-rw-r--r--tests/auto/uiloader/baseline/images/arrow-up.pngbin0 -> 927 bytes
-rw-r--r--tools/qdoc3/test/classic.css76
125 files changed, 1946 insertions, 1091 deletions
diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test
index ff51c91..a854bd1 100755
--- a/config.tests/unix/compile.test
+++ b/config.tests/unix/compile.test
@@ -28,6 +28,11 @@ while [ "$#" -gt 0 ]; do
MAC_ARCH_LFLAGS="$MAC_ARCH_LFLAGS -arch $2"
shift
;;
+ -sdk)
+ LFLAGS="$LFLAGS -Wl,-syslibroot,$2"
+ CXXFLAGS="$CXXFLAGS -isysroot $2"
+ shift
+ ;;
-F*|-m*|-x*)
LFLAGS="$LFLAGS $PARAM"
CXXFLAGS="$CXXFLAGS $PARAM"
diff --git a/configure b/configure
index eb339fc..2cc495c 100755
--- a/configure
+++ b/configure
@@ -669,7 +669,7 @@ CFG_INOTIFY=auto
CFG_RPATH=yes
CFG_FRAMEWORK=auto
CFG_MAC_ARCHS=
-MAC_ARCHS_COMMANDLINE=
+MAC_CONFIG_TEST_COMMANDLINE= # used to make the configure tests run with the correct arch's and SDK settings
CFG_MAC_DWARF2=auto
CFG_MAC_XARCH=auto
CFG_MAC_CARBON=yes
@@ -2730,14 +2730,20 @@ if [ "$PLATFORM_MAC" = "yes" ]; then
# These are synonymous values
# CFG_MAC_ARCHS requires x86 while GCC requires i386
CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
- MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch i386"
+ MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
else
CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
- MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $i"
+ MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
fi
done
fi
+# pass on $CFG_SDK to the configure tests.
+if [ '!' -z "$CFG_SDK" ]; then
+ MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK"
+ echo "tests command line: $MAC_CONFIG_TEST_COMMANDLINE"
+fi
+
# find the default framework value
if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then
if [ "$CFG_FRAMEWORK" = "auto" ]; then
@@ -4278,7 +4284,7 @@ if [ "$CFG_ZLIB" = "no" ]; then
ZLIB_FORCED=yes
fi
if [ "$CFG_ZLIB" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_ZLIB=system
else
CFG_ZLIB=yes
@@ -4295,7 +4301,7 @@ if [ "$CFG_JPEG" = "auto" ]; then
fi
# detect jpeg
if [ "$CFG_LIBJPEG" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_LIBJPEG=system
else
CFG_LIBJPEG=qt
@@ -4322,7 +4328,7 @@ fi
# detect tiff
if [ "$CFG_LIBTIFF" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_LIBTIFF=system
else
CFG_LIBTIFF=qt
@@ -4339,7 +4345,7 @@ if [ "$CFG_MNG" = "auto" ]; then
fi
# detect mng
if [ "$CFG_LIBMNG" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_LIBMNG=system
else
CFG_LIBMNG=qt
@@ -4348,7 +4354,7 @@ fi
# detect png
if [ "$CFG_LIBPNG" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_LIBPNG=system
else
CFG_LIBPNG=qt
@@ -4387,13 +4393,13 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
QT_CFLAGS_MYSQL=""
fi
else
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
QMakeVar add CONFIG use_libmysqlclient_r
if [ "$CFG_SQL_mysql" = "auto" ]; then
CFG_SQL_mysql=plugin
fi
QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
- elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_mysql" = "auto" ]; then
CFG_SQL_mysql=plugin
fi
@@ -4422,7 +4428,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
fi
[ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
[ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_psql" = "auto" ]; then
CFG_SQL_psql=plugin
fi
@@ -4443,12 +4449,12 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
odbc)
if [ "$CFG_SQL_odbc" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_odbc" = "auto" ]; then
CFG_SQL_odbc=plugin
fi
else
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iodbc "iODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iodbc "iODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
QT_LFLAGS_ODBC="-liodbc"
if [ "$CFG_SQL_odbc" = "auto" ]; then
CFG_SQL_odbc=plugin
@@ -4469,7 +4475,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
oci)
if [ "$CFG_SQL_oci" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_oci" = "auto" ]; then
CFG_SQL_oci=plugin
fi
@@ -4488,7 +4494,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
tds)
if [ "$CFG_SQL_tds" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_tds" = "auto" ]; then
CFG_SQL_tds=plugin
fi
@@ -4507,7 +4513,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
db2)
if [ "$CFG_SQL_db2" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_db2" = "auto" ]; then
CFG_SQL_db2=plugin
fi
@@ -4526,7 +4532,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
ibase)
if [ "$CFG_SQL_ibase" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_ibase" = "auto" ]; then
CFG_SQL_ibase=plugin
fi
@@ -4545,7 +4551,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
sqlite2)
if [ "$CFG_SQL_sqlite2" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_sqlite2" = "auto" ]; then
CFG_SQL_sqlite2=plugin
fi
@@ -4570,7 +4576,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
fi
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_SQL_sqlite" = "auto" ]; then
CFG_SQL_sqlite=plugin
fi
@@ -4607,7 +4613,7 @@ done
# auto-detect NIS support
if [ "$CFG_NIS" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_NIS=yes
else
if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
@@ -4624,7 +4630,7 @@ fi
# auto-detect CUPS support
if [ "$CFG_CUPS" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_CUPS=yes
else
if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
@@ -4643,9 +4649,9 @@ fi
if [ "$CFG_ICONV" != "no" ]; then
if [ "$PLATFORM_QWS" = "yes" ]; then
CFG_ICONV=no
- elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_ICONV=yes
- elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_ICONV=gnu
else
if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
@@ -4666,7 +4672,7 @@ if [ "$CFG_DBUS" != "no" ]; then
QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
fi
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS $MAC_CONFIG_TEST_COMMANDLINE; then
[ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
@@ -5243,7 +5249,7 @@ fi # QWS
[ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
[ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no
if [ "$CFG_LIBFREETYPE" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_LIBFREETYPE=system
else
CFG_LIBFREETYPE=yes
@@ -5360,7 +5366,7 @@ fi
# find if the platform supports IPv6
if [ "$CFG_IPV6" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_IPV6=yes
else
if [ "$CFG_IPV6" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
@@ -5491,7 +5497,7 @@ fi
# detect OpenSSL
if [ "$CFG_OPENSSL" != "no" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
if [ "$CFG_OPENSSL" = "auto" ]; then
CFG_OPENSSL=yes
fi
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index 2d64dfe..ed4ab37 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -86,15 +86,15 @@
\endif
\raw HTML
- <table cellpadding="2" cellspacing="1" border="0" width="100%" bgcolor="#e5e5e5">
+ <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
<tr>
- <th bgcolor="#66b036" width="33%">
+ <th class="titleheader" width="33%">
Getting Started
</th>
- <th bgcolor="#66b036" width="33%">
+ <th class="titleheader" width="33%">
General
</th>
- <th bgcolor="#66b036" width="33%">
+ <th class="titleheader" width="33%">
Developer Resources
</th>
</tr>
@@ -128,13 +128,13 @@
</td>
</tr>
<tr>
- <th bgcolor="#66b036">
+ <th class="titleheader">
API Reference
</th>
- <th bgcolor="#66b036">
+ <th class="titleheader">
Core Features
</th>
- <th bgcolor="#66b036">
+ <th class="titleheader">
Key Technologies
</th>
</tr>
@@ -195,13 +195,13 @@
</td>
</tr>
<tr>
- <th bgcolor="#66b036">
+ <th class="titleheader">
Add-ons &amp; Services
</th>
- <th bgcolor="#66b036">
+ <th class="titleheader">
Tools
</th>
- <th bgcolor="#66b036">
+ <th class="titleheader">
Licenses &amp; Credits
</th>
</tr>
diff --git a/doc/src/installation.qdoc b/doc/src/installation.qdoc
index bc310c9..49ab45a 100644
--- a/doc/src/installation.qdoc
+++ b/doc/src/installation.qdoc
@@ -508,6 +508,9 @@ in the \l{Qt for Windows CE Requirements} document.
This page describes the specific requirements of libraries and components on which
Qt depends. For information about installing Qt, see the \l{Installation} page.
+ For information about the platforms that Qt supports, see the \l{Supported Platforms}
+ page.
+
\section1 OpenSSL (version 0.9.7 or later)
Support for \l{SSL}{Secure Sockets Layer (SSL)} communication is provided by the
diff --git a/doc/src/introtodbus.qdoc b/doc/src/introtodbus.qdoc
index 71c65d5..1edc6eb 100644
--- a/doc/src/introtodbus.qdoc
+++ b/doc/src/introtodbus.qdoc
@@ -198,7 +198,24 @@
\row \o Interface \o Plugin identifier \o Dot-separated
\endtable
- \section2 Further Reading
+ \section1 Debugging
+
+ When developing applications that use D-Bus, it is sometimes useful to be able
+ to see information about the messages that are sent and received across the
+ bus by each application.
+
+ This feature can be enabled on a per-application basis by setting the
+ \c QDBUS_DEBUG environment variable before running each application.
+ For example, we can enable debugging only for the car in the
+ \l{Remote Controlled Car Example} by running the controller and the
+ car in the following way:
+
+ \snippet doc/src/snippets/code/doc_src_introtodbus.qdoc QDBUS_DEBUG
+
+ Information about the messages will be written to the console the application
+ was launched from.
+
+ \section1 Further Reading
The following documents contain information about Qt's D-Bus integration
features, and provide details about the mechanisms used to send and receive
diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc
index 172bc60..9714a44 100644
--- a/doc/src/qmake-manual.qdoc
+++ b/doc/src/qmake-manual.qdoc
@@ -3303,10 +3303,6 @@
\o output_function
\o Specifies a custom qmake function that is used to specify the filename to be created.
\row
- \o variables
- \o Indicates that the variables specified here are replaced with $(QMAKE_COMP_VARNAME) when refered to
- in the pro file as $(VARNAME).
- \row
\o variable_out
\o The variable that the files created from the output should be added to.
\endtable
diff --git a/doc/src/snippets/code/doc_src_introtodbus.qdoc b/doc/src/snippets/code/doc_src_introtodbus.qdoc
index bedfe7f..97b14e9 100644
--- a/doc/src/snippets/code/doc_src_introtodbus.qdoc
+++ b/doc/src/snippets/code/doc_src_introtodbus.qdoc
@@ -1,3 +1,8 @@
//! [0]
org.freedesktop.DBus
//! [0]
+
+//! [QDBUS_DEBUG]
+examples/dbus/remotecontrolledcar/controller/controller &
+QDBUS_DEBUG=1 examples/dbus/remotecontrolledcar/car/car &
+//! [QDBUS_DEBUG]
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 2d4658e..a385748 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1910,6 +1910,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
deps += replaceExtraCompilerVariables(pre_deps.at(i), (*input), out);
}
QString cmd = replaceExtraCompilerVariables(tmp_cmd, (*input), out);
+ // NOTE: The var -> QMAKE_COMP_var replace feature is unsupported, do not use!
for(QStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3)
cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index d9defe1..27c0572 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -184,7 +184,10 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
uc = (uc << 6) | (ch & 0x3f);
need--;
if (!need) {
- if (uc > 0xffff && uc < 0x110000) {
+ // utf-8 bom composes into 0xfeff code point
+ if (!headerdone && uc == 0xfeff) {
+ // dont do anything, just skip the BOM
+ } else if (uc > 0xffff && uc < 0x110000) {
// surrogate pair
uc -= 0x10000;
unsigned short high = uc/0x400 + 0xd800;
@@ -206,6 +209,7 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
} else {
*qch++ = uc;
}
+ headerdone = true;
}
} else {
// error
@@ -213,15 +217,18 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
*qch++ = replacement;
++invalid;
need = 0;
+ headerdone = true;
}
} else {
if (ch < 128) {
*qch++ = QLatin1Char(ch);
+ headerdone = true;
} else if ((ch & 0xe0) == 0xc0) {
uc = ch & 0x1f;
need = 1;
error = i;
min_uc = 0x80;
+ headerdone = true;
} else if ((ch & 0xf0) == 0xe0) {
uc = ch & 0x0f;
need = 2;
@@ -232,10 +239,12 @@ void QUtf8Codec::convertToUnicode(QString *target, const char *chars, int len, C
need = 3;
error = i;
min_uc = 0x10000;
+ headerdone = true;
} else {
// error
*qch++ = replacement;
++invalid;
+ headerdone = true;
}
}
}
@@ -387,7 +396,7 @@ QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState
result.truncate(qch - result.unicode());
if (state) {
- if (endian != Detect)
+ if (headerdone)
state->flags |= IgnoreHeader;
state->state_data[Endian] = endian;
if (half) {
@@ -569,7 +578,7 @@ QString QUtf32Codec::convertToUnicode(const char *chars, int len, ConverterState
result.truncate(qch - result.unicode());
if (state) {
- if (endian != Detect)
+ if (headerdone)
state->flags |= IgnoreHeader;
state->state_data[Endian] = endian;
state->remainingChars = num;
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 7d330e6..8aadf34 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -45,6 +45,7 @@
#ifndef QT_NO_DEBUG_STREAM
#include "qdebug.h"
#endif
+#include "qdiriterator.h"
#include "qfsfileengine.h"
#include "qdatetime.h"
#include "qstring.h"
@@ -92,7 +93,7 @@ protected:
QString initFileEngine(const QString &file);
void updateFileLists() const;
- void sortFileList(QDir::SortFlags, QStringList &, QStringList *, QFileInfoList *) const;
+ void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *) const;
private:
#ifdef QT3_SUPPORT
@@ -262,45 +263,57 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt
? f1->filename_cache.localeAwareCompare(f2->filename_cache)
: f1->filename_cache.compare(f2->filename_cache);
}
-
+ if (r == 0) // Enforce an order - the order the items appear in the array
+ r = (&n1) - (&n2);
if (qt_cmp_si_sort_flags & QDir::Reversed)
return r > 0;
return r < 0;
}
-inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l,
+inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l,
QStringList *names, QFileInfoList *infos) const
{
if(names)
names->clear();
if(infos)
infos->clear();
- if(!l.isEmpty()) {
- QDirSortItem *si= new QDirSortItem[l.count()];
- int i;
- for (i = 0; i < l.size(); ++i) {
- QString path = data->path;
- if (!path.isEmpty() && !path.endsWith(QLatin1Char('/')))
- path += QLatin1Char('/');
- si[i].item = QFileInfo(path + l.at(i));
- }
- if ((sort & QDir::SortByMask) != QDir::Unsorted)
- qStableSort(si, si+i, QDirSortItemComparator(sort));
- // put them back in the list(s)
- for (int j = 0; j<i; j++) {
+ int n = l.size();
+ if(n > 0) {
+ if (n == 1 || (sort & QDir::SortByMask) == QDir::Unsorted) {
if(infos)
- infos->append(si[j].item);
- if(names)
- names->append(si[j].item.fileName());
+ *infos = l;
+ if(names) {
+ for (int i = 0; i < n; ++i)
+ names->append(l.at(i).fileName());
+ }
+ } else {
+ QDirSortItem *si = new QDirSortItem[n];
+ for (int i = 0; i < n; ++i)
+ si[i].item = l.at(i);
+ qSort(si, si+n, QDirSortItemComparator(sort));
+ // put them back in the list(s)
+ if(infos) {
+ for (int i = 0; i < n; ++i)
+ infos->append(si[i].item);
+ }
+ if(names) {
+ for (int i = 0; i < n; ++i)
+ names->append(si[i].item.fileName());
+ }
+ delete [] si;
}
- delete [] si;
}
}
inline void QDirPrivate::updateFileLists() const
{
if(data->listsDirty) {
- QStringList l = data->fileEngine->entryList(data->filters, data->nameFilters);
+ QFileInfoList l;
+ QDirIterator it(data->path, data->nameFilters, data->filters);
+ while (it.hasNext()) {
+ it.next();
+ l.append(it.fileInfo());
+ }
sortFileList(data->sort, l, &data->files, &data->fileInfos);
data->listsDirty = 0;
}
@@ -1304,7 +1317,6 @@ QStringList QDir::entryList(Filters filters, SortFlags sort) const
\sa entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), exists()
*/
-
QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const
{
Q_D(const QDir);
@@ -1346,10 +1358,12 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters,
d->updateFileLists();
return d->data->files;
}
- QStringList l = d->data->fileEngine->entryList(filters, nameFilters);
- if ((sort & QDir::SortByMask) == QDir::Unsorted)
- return l;
-
+ QFileInfoList l;
+ QDirIterator it(d->data->path, nameFilters, filters);
+ while (it.hasNext()) {
+ it.next();
+ l.append(it.fileInfo());
+ }
QStringList ret;
d->sortFileList(sort, l, &ret, 0);
return ret;
@@ -1389,8 +1403,13 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter
d->updateFileLists();
return d->data->fileInfos;
}
+ QFileInfoList l;
+ QDirIterator it(d->data->path, nameFilters, filters);
+ while (it.hasNext()) {
+ it.next();
+ l.append(it.fileInfo());
+ }
QFileInfoList ret;
- QStringList l = d->data->fileEngine->entryList(filters, nameFilters);
d->sortFileList(sort, l, 0, &ret);
return ret;
}
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 4deaddb..bfb1aae 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -154,17 +154,15 @@ QFilePrivate::setError(QFile::FileError err)
void
QFilePrivate::setError(QFile::FileError err, const QString &errStr)
{
- Q_Q(QFile);
error = err;
- q->setErrorString(errStr);
+ errorString = errStr;
}
void
QFilePrivate::setError(QFile::FileError err, int errNum)
{
- Q_Q(QFile);
error = err;
- q->setErrorString(qt_error_string(errNum));
+ errorString = qt_error_string(errNum);
}
//************* QFile
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index 93d07e0..565aeb6 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -146,7 +146,7 @@ inline QString QSettingsGroup::toString() const
return result;
}
-class QConfFile
+class Q_AUTOTEST_EXPORT QConfFile
{
public:
ParsedSettingsMap mergedKeyMap() const;
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 7c925f1..75c682a 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -561,7 +561,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
if (!codec || autoDetectUnicode) {
autoDetectUnicode = false;
- codec = QTextCodec::codecForUtfText(QByteArray::fromRawData(buf, bytesRead), 0);
+ codec = QTextCodec::codecForUtfText(QByteArray::fromRawData(buf, bytesRead), codec);
if (!codec) {
codec = QTextCodec::codecForLocale();
writeConverterState.flags |= QTextCodec::IgnoreHeader;
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index e6f1c48..a3434a4 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -591,6 +591,15 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
ok = &dummy;
switch (uint(t)) {
+ case QVariant::Url:
+ switch (d->type) {
+ case QVariant::String:
+ *static_cast<QUrl *>(result) = QUrl(*v_cast<QString>(d));
+ break;
+ default:
+ return false;
+ }
+ break;
case QVariant::String: {
QString *str = static_cast<QString *>(result);
switch (d->type) {
@@ -640,6 +649,8 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
if (v_cast<QStringList>(d)->count() == 1)
*str = v_cast<QStringList>(d)->at(0);
break;
+ case QVariant::Url:
+ *str = v_cast<QUrl>(d)->toString();
default:
return false;
}
@@ -2484,7 +2495,8 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QString*/ 1 << QVariant::StringList | 1 << QVariant::ByteArray | 1 << QVariant::Int
| 1 << QVariant::UInt | 1 << QVariant::Bool | 1 << QVariant::Double
| 1 << QVariant::Date | 1 << QVariant::Time | 1 << QVariant::DateTime
- | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Char,
+ | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Char
+ | 1 << QVariant::Url,
/*QStringList*/ 1 << QVariant::List | 1 << QVariant::String,
@@ -2499,7 +2511,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QDateTime*/ 1 << QVariant::String | 1 << QVariant::Date,
-/*QUrl*/ 0,
+/*QUrl*/ 1 << QVariant::String,
/*QLocale*/ 0,
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index b9a50a2..973057b 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -89,8 +89,7 @@ QAbstractStatePrivate *QAbstractStatePrivate::get(QAbstractState *q)
QStateMachine *QAbstractStatePrivate::machine() const
{
- Q_Q(const QAbstractState);
- QObject *par = q->parent();
+ QObject *par = parent;
while (par != 0) {
if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
return mach;
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index f582b8c..c1b553c 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -113,8 +113,7 @@ QAbstractTransitionPrivate *QAbstractTransitionPrivate::get(QAbstractTransition
QStateMachine *QAbstractTransitionPrivate::machine() const
{
- Q_Q(const QAbstractTransition);
- QObject *par = q->parent();
+ QObject *par = parent;
while (par != 0) {
if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
return mach;
@@ -137,8 +136,7 @@ void QAbstractTransitionPrivate::callOnTransition(QEvent *e)
QState *QAbstractTransitionPrivate::sourceState() const
{
- Q_Q(const QAbstractTransition);
- return qobject_cast<QState*>(q->parent());
+ return qobject_cast<QState*>(parent);
}
/*!
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index 996ac18..fc75cc0 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -429,11 +429,4 @@ MyRecord record(int row) const
\sa normalizeIndexes(), append(), prepend()
*/
-/*! \fn void QContiguousCache::dump() const
-
- \internal
-
- Sends information about the cache's internal structure to qDebug()
-*/
-
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 740deb4..366a07b 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -64,17 +64,17 @@
\sa QStringBuilder, QLatin1String, QString, QStringRef
*/
-/*! \fn QLatin1Literal::QLatin1Literal(const char(&string)[N])
-
- Constructs a new literal from the given \a string.
-*/
-
/*! \fn int QLatin1Literal::size() const
Returns the number of characters in the literal \e{excluding} the trailing
NULL char.
*/
+/*! \fn QLatin1Literal::QLatin1Literal(const char(&string)[N])
+
+ Constructs a new literal from the given \a string.
+*/
+
/*! \fn char *QLatin1Literal::data() const
Returns a pointer to the first character of the string literal.
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index f287874..6195451 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -270,9 +270,9 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (!w) {
if (reason != QAccessible::ContextHelpStart &&
reason != QAccessible::ContextHelpEnd)
- w = qApp->focusWidget();
+ w = QApplication::focusWidget();
if (!w) {
- w = qApp->activeWindow();
+ w = QApplication::activeWindow();
if (!w)
return;
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index 7df097b..0c710f0 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -212,7 +212,7 @@ QAccessibleApplication::QAccessibleApplication()
static QWidgetList topLevelWidgets()
{
QWidgetList list;
- const QWidgetList tlw(qApp->topLevelWidgets());
+ const QWidgetList tlw(QApplication::topLevelWidgets());
for (int i = 0; i < tlw.count(); ++i) {
QWidget *w = tlw.at(i);
if (!(w->windowType() == Qt::Popup) && !(w->windowType() == Qt::Desktop))
@@ -308,7 +308,7 @@ int QAccessibleApplication::navigate(RelationFlag relation, int entry,
}
break;
case FocusChild:
- targetObject = qApp->activeWindow();
+ targetObject = QApplication::activeWindow();
break;
default:
break;
@@ -322,11 +322,11 @@ QString QAccessibleApplication::text(Text t, int) const
{
switch (t) {
case Name:
- if (qApp->activeWindow())
- return qApp->activeWindow()->windowTitle();
+ if (QApplication::activeWindow())
+ return QApplication::activeWindow()->windowTitle();
break;
case Description:
- return qApp->applicationFilePath();
+ return QApplication::applicationFilePath();
default:
break;
}
@@ -342,7 +342,7 @@ QAccessible::Role QAccessibleApplication::role(int) const
/*! \reimp */
QAccessible::State QAccessibleApplication::state(int) const
{
- return qApp->activeWindow() ? Focused : Normal;
+ return QApplication::activeWindow() ? Focused : Normal;
}
/*! \reimp */
@@ -356,7 +356,7 @@ bool QAccessibleApplication::doAction(int action, int child, const QVariantList
{
if (action == 0 || action == 1) {
QWidget *w = 0;
- w = qApp->activeWindow();
+ w = QApplication::activeWindow();
if (!w)
w = topLevelWidgets().at(0);
if (!w)
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index dc7e3cc..8299381 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1375,7 +1375,7 @@ void QColorDialogPrivate::init(const QColor &initial)
#else
// small displays (e.g. PDAs) cannot fit the full color dialog,
// so just use the color picker.
- smallDisplay = (qApp->desktop()->width() < 480 || qApp->desktop()->height() < 350);
+ smallDisplay = (QApplication::desktop()->width() < 480 || QApplication::desktop()->height() < 350);
const int lumSpace = topLay->spacing() / 2;
#endif
diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp
index ca39d31..d24d348 100644
--- a/src/gui/dialogs/qerrormessage.cpp
+++ b/src/gui/dialogs/qerrormessage.cpp
@@ -300,7 +300,7 @@ QErrorMessage * QErrorMessage::qtHandler()
if (!qtMessageHandler) {
qtMessageHandler = new QErrorMessage(0);
qAddPostRoutine(deleteStaticcQErrorMessage); // clean up
- qtMessageHandler->setWindowTitle(qApp->applicationName());
+ qtMessageHandler->setWindowTitle(QApplication::applicationName());
qInstallMsgHandler(jump);
}
return qtMessageHandler;
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 75a1820..4e818be 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -206,7 +206,7 @@ static OPENFILENAMEA *qt_win_make_OFNA(QWidget *parent,
if (parent)
parent = parent->window();
else
- parent = qApp->activeWindow();
+ parent = QApplication::activeWindow();
aTitle = title.toLocal8Bit();
aInitDir = QDir::toNativeSeparators(initialDirectory).toLocal8Bit();
@@ -279,7 +279,7 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
if (parent)
parent = parent->window();
else
- parent = qApp->activeWindow();
+ parent = QApplication::activeWindow();
tInitDir = QDir::toNativeSeparators(initialDirectory);
tFilters = filters;
@@ -692,7 +692,7 @@ QString qt_win_get_existing_directory(const QFileDialogArgs &args)
if (parent)
parent = parent->window();
else
- parent = qApp->activeWindow();
+ parent = QApplication::activeWindow();
if (parent)
parent->createWinId();
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index 2c47116..603789e 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -1407,7 +1407,7 @@ void QFileSystemModel::setIconProvider(QFileIconProvider *provider)
{
Q_D(QFileSystemModel);
d->fileInfoGatherer.setIconProvider(provider);
- qApp->processEvents();
+ QApplication::processEvents();
d->root.updateIcon(provider, QString());
}
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index 648cda8..1fefb67 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -258,10 +258,8 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
int QMessageBoxPrivate::layoutMinimumWidth()
{
- Q_Q(QMessageBox);
-
- q->layout()->activate();
- return q->layout()->totalMinimumSize().width();
+ layout->activate();
+ return layout->totalMinimumSize().width();
}
void QMessageBoxPrivate::updateSize()
@@ -334,15 +332,15 @@ void QMessageBoxPrivate::updateSize()
label->setSizePolicy(policy);
}
- QFontMetrics fm(qApp->font("QWorkspaceTitleBar"));
+ QFontMetrics fm(QApplication::font("QWorkspaceTitleBar"));
int windowTitleWidth = qMin(fm.width(q->windowTitle()) + 50, hardLimit);
if (windowTitleWidth > width)
width = windowTitleWidth;
- q->layout()->activate();
- int height = (q->layout()->hasHeightForWidth())
- ? q->layout()->totalHeightForWidth(width)
- : q->layout()->totalMinimumSize().height();
+ layout->activate();
+ int height = (layout->hasHeightForWidth())
+ ? layout->totalHeightForWidth(width)
+ : layout->totalMinimumSize().height();
q->setFixedSize(width, height);
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}
@@ -363,7 +361,7 @@ void QMessageBoxPrivate::hideSpecial()
QPushButton *pb = list.at(i);
QString text = pb->text();
text.remove(QChar::fromLatin1('&'));
- if (text == qApp->translate("QMessageBox", "OK" ))
+ if (text == QApplication::translate("QMessageBox", "OK" ))
pb->setFixedSize(0,0);
}
}
@@ -1210,8 +1208,8 @@ bool QMessageBox::event(QEvent *e)
case QEvent::HelpRequest: {
QString bName =
(e->type() == QEvent::OkRequest)
- ? qApp->translate("QMessageBox", "OK")
- : qApp->translate("QMessageBox", "Help");
+ ? QApplication::translate("QMessageBox", "OK")
+ : QApplication::translate("QMessageBox", "Help");
QList<QPushButton*> list = qFindChildren<QPushButton*>(this);
for (int i=0; i<list.size(); ++i) {
QPushButton *pb = list.at(i);
@@ -1324,7 +1322,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
}
textToCopy += buttonTexts + separator;
- qApp->clipboard()->setText(textToCopy);
+ QApplication::clipboard()->setText(textToCopy);
return;
}
#endif //QT_NO_SHORTCUT QT_NO_CLIPBOARD Q_OS_WIN
diff --git a/src/gui/dialogs/qpagesetupdialog_win.cpp b/src/gui/dialogs/qpagesetupdialog_win.cpp
index 4bb571c..2c74ed2 100644
--- a/src/gui/dialogs/qpagesetupdialog_win.cpp
+++ b/src/gui/dialogs/qpagesetupdialog_win.cpp
@@ -98,7 +98,7 @@ int QPageSetupDialog::exec()
psd.hDevNames = tempDevNames;
QWidget *parent = parentWidget();
- parent = parent ? parent->window() : qApp->activeWindow();
+ parent = parent ? parent->window() : QApplication::activeWindow();
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
psd.hwndOwner = parent ? parent->winId() : 0;
diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp
index 936d1ed..2561227 100644
--- a/src/gui/dialogs/qprintdialog_win.cpp
+++ b/src/gui/dialogs/qprintdialog_win.cpp
@@ -225,7 +225,7 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
if (parent)
parent = parent->window();
else
- parent = qApp->activeWindow();
+ parent = QApplication::activeWindow();
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp
index 66a1285..b68a0a72 100644
--- a/src/gui/dialogs/qprogressdialog.cpp
+++ b/src/gui/dialogs/qprogressdialog.cpp
@@ -643,7 +643,7 @@ void QProgressDialog::setValue(int progress)
if (d->shown_once) {
if (isModal())
- qApp->processEvents();
+ QApplication::processEvents();
} else {
if (progress == 0) {
d->starttime.start();
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index b2ed983..7fc8a63 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -377,7 +377,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
/*
There is no widthForHeight() function, so we simulate it with a loop.
*/
- int candidateSubTitleWidth = qMin(512, 2 * qApp->desktop()->width() / 3);
+ int candidateSubTitleWidth = qMin(512, 2 * QApplication::desktop()->width() / 3);
int delta = candidateSubTitleWidth >> 1;
while (delta > 0) {
if (subTitleLabel->heightForWidth(candidateSubTitleWidth - delta)
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 8aad4af..e0aaa19 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -279,7 +279,7 @@ QVistaHelper::VistaState QVistaHelper::vistaState()
QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
- HANDLE hTheme = pOpenThemeData(qApp->desktop()->winId(), L"WINDOW");
+ HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW");
pGetThemeColor(
hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE,
wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT,
@@ -611,7 +611,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
{
bool value = false;
if (vistaState() == VistaAero) {
- HANDLE hTheme = pOpenThemeData(qApp->desktop()->winId(), L"WINDOW");
+ HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW");
if (!hTheme) return false;
// Set up a memory DC and bitmap that we'll draw into
HDC dcMem;
diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri
index 02d9bb1..4cee6d6 100644
--- a/src/gui/graphicsview/graphicsview.pri
+++ b/src/gui/graphicsview/graphicsview.pri
@@ -1,46 +1,37 @@
# Qt graphicsview module
-
-HEADERS += \
- graphicsview/qgraphicsitem.h \
- graphicsview/qgraphicsitem_p.h \
- graphicsview/qgraphicsitemanimation.h \
- graphicsview/qgraphicsscene.h \
- graphicsview/qgraphicsscene_p.h \
- graphicsview/qgraphicsscene_bsp_p.h \
- graphicsview/qgraphicssceneevent.h \
- graphicsview/qgraphicsview_p.h \
- graphicsview/qgraphicsview.h
-
-SOURCES += \
- graphicsview/qgraphicsitem.cpp \
- graphicsview/qgraphicsitemanimation.cpp \
- graphicsview/qgraphicsscene.cpp \
- graphicsview/qgraphicsscene_bsp.cpp \
- graphicsview/qgraphicssceneevent.cpp \
- graphicsview/qgraphicsview.cpp
+HEADERS += graphicsview/qgraphicsitem.h \
+ graphicsview/qgraphicsitem_p.h \
+ graphicsview/qgraphicsitemanimation.h \
+ graphicsview/qgraphicsscene.h \
+ graphicsview/qgraphicsscene_p.h \
+ graphicsview/qgraphicsscene_bsp_p.h \
+ graphicsview/qgraphicssceneevent.h \
+ graphicsview/qgraphicsview_p.h \
+ graphicsview/qgraphicsview.h
+SOURCES += graphicsview/qgraphicsitem.cpp \
+ graphicsview/qgraphicsitemanimation.cpp \
+ graphicsview/qgraphicsscene.cpp \
+ graphicsview/qgraphicsscene_bsp.cpp \
+ graphicsview/qgraphicssceneevent.cpp \
+ graphicsview/qgraphicsview.cpp
# Widgets on the canvas
-
-HEADERS += \
- graphicsview/qgraphicslayout.h \
- graphicsview/qgraphicslayout_p.h \
- graphicsview/qgraphicslayoutitem.h \
- graphicsview/qgraphicslayoutitem_p.h \
- graphicsview/qgraphicslinearlayout.h \
- graphicsview/qgraphicswidget.h \
- graphicsview/qgraphicswidget_p.h \
- graphicsview/qgridlayoutengine_p.h \
- graphicsview/qgraphicsproxywidget.h \
- graphicsview/qgraphicsgridlayout.h
-
-SOURCES += \
- graphicsview/qgraphicslayout.cpp \
- graphicsview/qgraphicslayout_p.cpp \
- graphicsview/qgraphicslayoutitem.cpp \
- graphicsview/qgraphicslinearlayout.cpp \
- graphicsview/qgraphicswidget.cpp \
- graphicsview/qgraphicswidget_p.cpp \
- graphicsview/qgridlayoutengine.cpp \
- graphicsview/qgraphicsproxywidget.cpp \
- graphicsview/qgraphicsgridlayout.cpp
-
+HEADERS += graphicsview/qgraphicslayout.h \
+ graphicsview/qgraphicslayout_p.h \
+ graphicsview/qgraphicslayoutitem.h \
+ graphicsview/qgraphicslayoutitem_p.h \
+ graphicsview/qgraphicslinearlayout.h \
+ graphicsview/qgraphicswidget.h \
+ graphicsview/qgraphicswidget_p.h \
+ graphicsview/qgridlayoutengine_p.h \
+ graphicsview/qgraphicsproxywidget.h \
+ graphicsview/qgraphicsgridlayout.h
+SOURCES += graphicsview/qgraphicslayout.cpp \
+ graphicsview/qgraphicslayout_p.cpp \
+ graphicsview/qgraphicslayoutitem.cpp \
+ graphicsview/qgraphicslinearlayout.cpp \
+ graphicsview/qgraphicswidget.cpp \
+ graphicsview/qgraphicswidget_p.cpp \
+ graphicsview/qgridlayoutengine.cpp \
+ graphicsview/qgraphicsproxywidget.cpp \
+ graphicsview/qgraphicsgridlayout.cpp
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 1e21b54..36281f8 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -100,7 +100,7 @@ QLayoutStyleInfo QGraphicsGridLayoutPrivate::styleInfo() const
if (!wid)
wid = new QWidget;
QGraphicsItem *item = parentItem();
- QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : qApp->style();
+ QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style();
return QLayoutStyleInfo(style, wid);
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index f50d210..43cbca1 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -959,6 +959,9 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
// Deliver post-change notification
q->itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant);
+
+ if (isObject)
+ emit static_cast<QGraphicsObject *>(q)->parentChanged();
}
/*!
@@ -1213,6 +1216,20 @@ QGraphicsItem *QGraphicsItem::topLevelItem() const
/*!
\since 4.4
+ Returns a pointer to the item's parent, cast to a QGraphicsObject. returns 0 if the parent item
+ is not a QGraphicsObject.
+
+ \sa parentItem(), childItems()
+*/
+QGraphicsObject *QGraphicsItem::parentObject() const
+{
+ QGraphicsItem *p = d_ptr->parent;
+ return (p && p->d_ptr->isObject) ? static_cast<QGraphicsObject *>(p) : 0;
+}
+
+/*!
+ \since 4.4
+
Returns a pointer to the item's parent widget. The item's parent widget is
the closest parent item that is a widget.
@@ -1260,6 +1277,28 @@ QGraphicsWidget *QGraphicsItem::window() const
}
/*!
+ \since 4.6
+
+ Return the graphics item cast to a QGraphicsObject, if the class is actually a
+ graphics object, 0 otherwise.
+*/
+QGraphicsObject *QGraphicsItem::toGraphicsObject()
+{
+ return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : 0;
+}
+
+/*!
+ \since 4.6
+
+ Return the graphics item cast to a QGraphicsObject, if the class is actually a
+ graphics object, 0 otherwise.
+*/
+const QGraphicsObject *QGraphicsItem::toGraphicsObject() const
+{
+ return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : 0;
+}
+
+/*!
Sets this item's parent item to \a parent. If this item already has a
parent, it is first removed from the previous parent. If \a parent is 0,
this item will become a top-level item.
@@ -1767,6 +1806,9 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
// Deliver post-change notification.
q_ptr->itemChange(QGraphicsItem::ItemVisibleHasChanged, newVisibleVariant);
+
+ if (isObject)
+ emit static_cast<QGraphicsObject *>(q_ptr)->visibleChanged();
}
/*!
@@ -1887,6 +1929,9 @@ void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bo
// Deliver post-change notification.
q_ptr->itemChange(QGraphicsItem::ItemEnabledHasChanged, newEnabledVariant);
+
+ if (isObject)
+ emit static_cast<QGraphicsObject *>(q_ptr)->enabledChanged();
}
/*!
@@ -2082,6 +2127,9 @@ void QGraphicsItem::setOpacity(qreal opacity)
/*maybeDirtyClipPath=*/false,
/*force=*/false,
/*ignoreOpacity=*/true);
+
+ if (d_ptr->isObject)
+ emit static_cast<QGraphicsObject *>(this)->opacityChanged();
}
/*!
@@ -2490,6 +2538,17 @@ QPointF QGraphicsItem::pos() const
\sa y()
*/
+/*
+ Set's the x coordinate of the item's position. Equivalent to
+ calling setPos(x, y()).
+
+ \sa x(), setPos()
+*/
+void QGraphicsItem::setX(qreal x)
+{
+ d_ptr->setPosHelper(QPointF(x, d_ptr->pos.y()));
+}
+
/*!
\fn QGraphicsItem::y() const
@@ -2498,6 +2557,17 @@ QPointF QGraphicsItem::pos() const
\sa x()
*/
+/*
+ Set's the y coordinate of the item's position. Equivalent to
+ calling setPos(x(), y).
+
+ \sa x(), setPos()
+*/
+void QGraphicsItem::setY(qreal y)
+{
+ d_ptr->setPosHelper(QPointF(d_ptr->pos.x(), y));
+}
+
/*!
Returns the item's position in scene coordinates. This is
equivalent to calling \c mapToScene(0, 0).
@@ -2521,9 +2591,16 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos)
updateCachedClipPathFromSetPosHelper(pos);
if (scene)
q->prepareGeometryChange();
+ QPointF oldPos = this->pos;
this->pos = pos;
dirtySceneTransform = 1;
inSetPosHelper = 0;
+ if (isObject) {
+ if (pos.x() != oldPos.x())
+ emit static_cast<QGraphicsObject *>(q_ptr)->xChanged();
+ if (pos.y() != oldPos.y())
+ emit static_cast<QGraphicsObject *>(q_ptr)->yChanged();
+ }
}
/*!
@@ -2987,7 +3064,7 @@ QPointF QGraphicsItem::transformOrigin() const
/*!
\since 4.6
- Sets the origin for transformation in item coordinate
+ Sets the \a origin for transformation in item coordinate
\sa transformOrigin(), {Transformations}
*/
@@ -3002,11 +3079,14 @@ void QGraphicsItem::setTransformOrigin(const QPointF &origin)
}
/*!
- \fn inline void setTransformOrigin(qreal x, qreal y)
+ \fn void QGraphicsItem::setTransformOrigin(qreal x, qreal y)
\since 4.6
\overload
+ Sets the origin for the transformation to the point
+ composed of \a x and \a y.
+
\sa setTransformOrigin(), {Transformations}
*/
@@ -3503,6 +3583,9 @@ void QGraphicsItem::setZValue(qreal z)
}
itemChange(ItemZValueHasChanged, newZVariant);
+
+ if (d_ptr->isObject)
+ emit static_cast<QGraphicsObject *>(this)->zChanged();
}
/*!
@@ -4281,7 +4364,9 @@ void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &n
// Find closest clip ancestor and transform.
Q_Q(QGraphicsItem);
// COMBINE
- QTransform thisToParentTransform = transformToParent();
+ QTransform thisToParentTransform = transformData
+ ? transformData->computedFullTransform() * QTransform::fromTranslate(newPos.x(), newPos.y())
+ : QTransform::fromTranslate(newPos.x(), newPos.y());
QGraphicsItem *clipParent = parent;
while (clipParent && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) {
thisToParentTransform *= clipParent->d_ptr->transformToParent();
@@ -6322,6 +6407,160 @@ static void qt_graphicsItem_highlightSelected(
}
/*!
+ \class QGraphicsObject
+ \brief The QGraphicsObject class provides a base class for all graphics items that
+ require signals, slots and properties.
+ \since 4.6
+ \ingroup graphicsview-api
+
+ The class extends a QGraphicsItem with QObject's signal/slot and property mechanisms.
+ It maps many of QGraphicsItem's basic setters and getters to properties and adds notification
+ signals for many of them.
+*/
+
+/*!
+ Constructs a QGraphicsObject with \a parent.
+*/
+QGraphicsObject::QGraphicsObject(QGraphicsItem *parent)
+ : QGraphicsItem(parent)
+{
+ QGraphicsItem::d_ptr->isObject = true;
+}
+
+/*!
+ \internal
+*/
+QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene)
+ : QGraphicsItem(dd, parent, scene)
+{
+ QGraphicsItem::d_ptr->isObject = true;
+}
+
+/*!
+ \property QGraphicsObject::parent
+ \brief the parent of the item
+
+ \sa QGraphicsItem::setParentItem, QGraphicsItem::parentObject
+*/
+
+
+/*!
+ \property QGraphicsObject::opacity
+ \brief the opacity of the item
+
+ \sa QGraphicsItem::setOpacity, QGraphicsItem::opacity
+*/
+
+/*!
+ \fn QGraphicsObject::opacityChanged()
+
+ This signal gets emitted whenever the opacity of the item changes
+
+ \sa opacity
+*/
+
+/*!
+ \property QGraphicsObject::pos
+ \brief the position of the item
+
+ Describes the items position.
+
+ \sa QGraphicsItem::setPos, QGraphicsItem::pos, positionChanged
+*/
+
+/*!
+ \property QGraphicsObject::x
+ \brief the x position of the item
+
+ Describes the items x position.
+
+ \sa QGraphicsItem::setX, setPos, xChanged
+*/
+
+/*!
+ \fn QGraphicsObject::xChanged()
+
+ This signal gets emitted whenever the x position of the item changes
+
+ \sa pos
+*/
+
+/*!
+ \property QGraphicsObject::y
+ \brief the y position of the item
+
+ Describes the items y position.
+
+ \sa QGraphicsItem::setY, setPos, yChanged
+*/
+
+/*!
+ \fn QGraphicsObject::yChanged()
+
+ This signal gets emitted whenever the y position of the item changes
+
+ \sa pos
+*/
+
+/*!
+ \property QGraphicsObject::z
+ \brief the z value of the item
+
+ Describes the items z value.
+
+ \sa QGraphicsItem::setZValue, zValue, zChanged
+*/
+
+/*!
+ \fn QGraphicsObject::zChanged()
+
+ This signal gets emitted whenever the z value of the item changes
+
+ \sa pos
+*/
+
+
+/*!
+ \property QGraphicsObject::enabled
+ \brief whether the item is enabled or not
+
+ This property is declared in QGraphicsItem.
+
+ By default, this property is true.
+
+ \sa QGraphicsItem::isEnabled(), QGraphicsItem::setEnabled(), enabledChanged()
+*/
+
+/*!
+ \fn QGraphicsObject::enabledChanged()
+
+ This signal gets emitted whenever the item get's enabled or disabled.
+
+ \sa enabled
+*/
+
+/*!
+ \property QGraphicsObject::visible
+ \brief whether the item is visible or not
+
+ This property is declared in QGraphicsItem.
+
+ By default, this property is true.
+
+ \sa QGraphicsItem::isVisible(), QGraphicsItem::setVisible(), visibleChanged()
+*/
+
+/*!
+ \fn QGraphicsObject::visibleChanged()
+
+ This signal gets emitted whenever the visibility of the item changes
+
+ \sa visible
+*/
+
+
+
+/*!
\class QAbstractGraphicsShapeItem
\brief The QAbstractGraphicsShapeItem class provides a common base for
all path items.
@@ -8145,6 +8384,7 @@ public:
QGraphicsTextItem *qq;
};
+
/*!
Constructs a QGraphicsTextItem, using \a text as the default plain
text. \a parent is passed to QGraphicsItem's constructor.
@@ -8157,7 +8397,7 @@ QGraphicsTextItem::QGraphicsTextItem(const QString &text, QGraphicsItem *parent
, QGraphicsScene *scene
#endif
)
- : QGraphicsItem(parent, scene), dd(new QGraphicsTextItemPrivate)
+ : QGraphicsObject(*new QGraphicsItemPrivate, parent, scene), dd(new QGraphicsTextItemPrivate)
{
dd->qq = this;
if (!text.isEmpty())
@@ -8179,7 +8419,7 @@ QGraphicsTextItem::QGraphicsTextItem(QGraphicsItem *parent
, QGraphicsScene *scene
#endif
)
- : QGraphicsItem(parent, scene), dd(new QGraphicsTextItemPrivate)
+ : QGraphicsObject(*new QGraphicsItemPrivate, parent, scene), dd(new QGraphicsTextItemPrivate)
{
dd->qq = this;
setAcceptDrops(true);
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 79f7362..22742b0 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -63,6 +63,7 @@ class QBrush;
class QCursor;
class QFocusEvent;
class QGraphicsItemGroup;
+class QGraphicsObject;
class QGraphicsSceneContextMenuEvent;
class QGraphicsSceneDragDropEvent;
class QGraphicsSceneEvent;
@@ -150,6 +151,7 @@ public:
QGraphicsItem *parentItem() const;
QGraphicsItem *topLevelItem() const;
+ QGraphicsObject *parentObject() const;
QGraphicsWidget *parentWidget() const;
QGraphicsWidget *topLevelWidget() const;
QGraphicsWidget *window() const;
@@ -159,6 +161,9 @@ public:
bool isWidget() const;
bool isWindow() const;
+ QGraphicsObject *toGraphicsObject();
+ const QGraphicsObject *toGraphicsObject() const;
+
QGraphicsItemGroup *group() const;
void setGroup(QGraphicsItemGroup *group);
@@ -223,7 +228,9 @@ public:
// Positioning in scene coordinates
QPointF pos() const;
inline qreal x() const { return pos().x(); }
+ void setX(qreal x);
inline qreal y() const { return pos().y(); }
+ void setY(qreal y);
QPointF scenePos() const;
void setPos(const QPointF &pos);
inline void setPos(qreal x, qreal y);
@@ -485,6 +492,39 @@ inline QRectF QGraphicsItem::mapRectFromParent(qreal ax, qreal ay, qreal w, qrea
inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal h) const
{ return mapRectFromScene(QRectF(ax, ay, w, h)); }
+
+class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false)
+ Q_PROPERTY(QString id READ objectName WRITE setObjectName)
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(QPointF pos READ pos WRITE setPos)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
+ Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged)
+public:
+ QGraphicsObject(QGraphicsItem *parent = 0);
+
+Q_SIGNALS:
+ void parentChanged();
+ void opacityChanged();
+ void visibleChanged();
+ void enabledChanged();
+ void xChanged();
+ void yChanged();
+ void zChanged();
+
+protected:
+ QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene);
+private:
+ friend class QGraphicsItem;
+ friend class QGraphicsItemPrivate;
+};
+
+
class QAbstractGraphicsShapeItemPrivate;
class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem
{
@@ -836,7 +876,7 @@ inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay)
class QGraphicsTextItemPrivate;
class QTextDocument;
class QTextCursor;
-class Q_GUI_EXPORT QGraphicsTextItem : public QObject, public QGraphicsItem
+class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject
{
Q_OBJECT
QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index c502655..0e6658c 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -149,6 +149,7 @@ public:
dirtySceneTransform(1),
geometryChanged(0),
inDestructor(0),
+ isObject(0),
globalStackingOrder(-1),
q_ptr(0)
{
@@ -365,7 +366,7 @@ public:
QGraphicsScene *scene;
QGraphicsItem *parent;
QList<QGraphicsItem *> children;
- class TransformData;
+ struct TransformData;
TransformData *transformData;
QTransform sceneTransform;
int index;
@@ -405,7 +406,8 @@ public:
quint32 dirtySceneTransform : 1;
quint32 geometryChanged : 1;
quint32 inDestructor : 1;
- quint32 unused : 15; // feel free to use
+ quint32 isObject : 1;
+ quint32 unused : 14; // feel free to use
// Optional stacking order
int globalStackingOrder;
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 6a2d456..2f32950 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -178,7 +178,7 @@ QLayoutStyleInfo QGraphicsLinearLayoutPrivate::styleInfo() const
if (!wid)
wid = new QWidget;
QGraphicsItem *item = parentItem();
- QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : qApp->style();
+ QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style();
return QLayoutStyleInfo(style, wid);
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index e6c3503..55d8a1d 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2161,7 +2161,7 @@ void QGraphicsScenePrivate::setFont_helper(const QFont &font)
*/
void QGraphicsScenePrivate::resolveFont()
{
- QFont naturalFont = qApp->font();
+ QFont naturalFont = QApplication::font();
naturalFont.resolve(0);
QFont resolvedFont = font.resolve(naturalFont);
updateFont(resolvedFont);
@@ -2217,7 +2217,7 @@ void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette)
*/
void QGraphicsScenePrivate::resolvePalette()
{
- QPalette naturalPalette = qApp->palette();
+ QPalette naturalPalette = QApplication::palette();
naturalPalette.resolve(0);
QPalette resolvedPalette = palette.resolve(naturalPalette);
updatePalette(resolvedPalette);
@@ -3975,10 +3975,10 @@ bool QGraphicsScene::eventFilter(QObject *watched, QEvent *event)
switch (event->type()) {
case QEvent::ApplicationPaletteChange:
- qApp->postEvent(this, new QEvent(QEvent::ApplicationPaletteChange));
+ QApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange));
break;
case QEvent::ApplicationFontChange:
- qApp->postEvent(this, new QEvent(QEvent::ApplicationFontChange));
+ QApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange));
break;
default:
break;
@@ -4918,7 +4918,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
bool allowPartialCacheExposure = !viewRect.contains(deviceRect);
#else
// Only if deviceRect is 20% taller or wider than the desktop.
- QRect desktopRect = qApp->desktop()->availableGeometry(widget);
+ QRect desktopRect = QApplication::desktop()->availableGeometry(widget);
bool allowPartialCacheExposure = (desktopRect.width() * 1.2 < deviceRect.width()
|| desktopRect.height() * 1.2 < deviceRect.height());
#endif
@@ -5269,7 +5269,9 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
for (int i = 0; i < views.size(); ++i) {
QGraphicsViewPrivate *viewPrivate = views.at(i)->d_func();
- viewPrivate->updateRect(item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport));
+ QRect rect = item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport);
+ rect.translate(viewPrivate->dirtyScrollOffset);
+ viewPrivate->updateRect(rect);
}
return;
}
@@ -5350,7 +5352,9 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
if (item->d_ptr->paintedViewBoundingRectsNeedRepaint) {
wasDirtyParentViewBoundingRects = true;
- viewPrivate->updateRect(item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport));
+ QRect rect = item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport);
+ rect.translate(viewPrivate->dirtyScrollOffset);
+ viewPrivate->updateRect(rect);
}
if (!item->d_ptr->dirty)
@@ -5606,7 +5610,7 @@ QStyle *QGraphicsScene::style() const
{
Q_D(const QGraphicsScene);
// ### This function, and the use of styles in general, is non-reentrant.
- return d->style ? d->style : qApp->style();
+ return d->style ? d->style : QApplication::style();
}
/*!
@@ -5683,7 +5687,7 @@ QFont QGraphicsScene::font() const
void QGraphicsScene::setFont(const QFont &font)
{
Q_D(QGraphicsScene);
- QFont naturalFont = qApp->font();
+ QFont naturalFont = QApplication::font();
naturalFont.resolve(0);
QFont resolvedFont = font.resolve(naturalFont);
d->setFont_helper(resolvedFont);
@@ -5720,7 +5724,7 @@ QPalette QGraphicsScene::palette() const
void QGraphicsScene::setPalette(const QPalette &palette)
{
Q_D(QGraphicsScene);
- QPalette naturalPalette = qApp->palette();
+ QPalette naturalPalette = QApplication::palette();
naturalPalette.resolve(0);
QPalette resolvedPalette = palette.resolve(naturalPalette);
d->setPalette_helper(resolvedPalette);
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 4891e81..a72aa5a 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -387,7 +387,7 @@ void QGraphicsViewPrivate::recalculateContentSize()
int left = q_round_bound(viewRect.left());
int right = q_round_bound(viewRect.right() - width);
if (left >= right) {
- q->horizontalScrollBar()->setRange(0, 0);
+ hbar->setRange(0, 0);
switch (alignment & Qt::AlignHorizontal_Mask) {
case Qt::AlignLeft:
@@ -402,9 +402,9 @@ void QGraphicsViewPrivate::recalculateContentSize()
break;
}
} else {
- q->horizontalScrollBar()->setRange(left, right);
- q->horizontalScrollBar()->setPageStep(width);
- q->horizontalScrollBar()->setSingleStep(width / 20);
+ hbar->setRange(left, right);
+ hbar->setPageStep(width);
+ hbar->setSingleStep(width / 20);
leftIndent = 0;
}
@@ -413,7 +413,7 @@ void QGraphicsViewPrivate::recalculateContentSize()
int top = q_round_bound(viewRect.top());
int bottom = q_round_bound(viewRect.bottom() - height);
if (top >= bottom) {
- q->verticalScrollBar()->setRange(0, 0);
+ vbar->setRange(0, 0);
switch (alignment & Qt::AlignVertical_Mask) {
case Qt::AlignTop:
@@ -428,9 +428,9 @@ void QGraphicsViewPrivate::recalculateContentSize()
break;
}
} else {
- q->verticalScrollBar()->setRange(top, bottom);
- q->verticalScrollBar()->setPageStep(height);
- q->verticalScrollBar()->setSingleStep(height / 20);
+ vbar->setRange(top, bottom);
+ vbar->setPageStep(height);
+ vbar->setSingleStep(height / 20);
topIndent = 0;
}
@@ -442,7 +442,7 @@ void QGraphicsViewPrivate::recalculateContentSize()
// scroll instead.
if (oldLeftIndent != leftIndent || oldTopIndent != topIndent) {
dirtyScroll = true;
- q->viewport()->update();
+ updateAll();
} else if (q->isRightToLeft() && !leftIndent) {
// In reverse mode, the horizontal scroll always changes after the content
// size has changed, as the scroll is calculated by summing the min and
@@ -468,7 +468,7 @@ void QGraphicsViewPrivate::centerView(QGraphicsView::ViewportAnchor anchor)
if (q->underMouse()) {
// Last scene pos: lastMouseMoveScenePoint
// Current mouse pos:
- QPointF transformationDiff = q->mapToScene(q->viewport()->rect().center())
+ QPointF transformationDiff = q->mapToScene(viewport->rect().center())
- q->mapToScene(q->mapFromGlobal(QCursor::pos()));
q->centerOn(lastMouseMoveScenePoint + transformationDiff);;
} else {
@@ -490,7 +490,7 @@ void QGraphicsViewPrivate::centerView(QGraphicsView::ViewportAnchor anchor)
void QGraphicsViewPrivate::updateLastCenterPoint()
{
Q_Q(QGraphicsView);
- lastCenterPoint = q->mapToScene(q->viewport()->rect().center());
+ lastCenterPoint = q->mapToScene(viewport->rect().center());
}
/*!
@@ -528,15 +528,15 @@ void QGraphicsViewPrivate::updateScroll()
scrollX = qint64(-leftIndent);
if (q->isRightToLeft()) {
if (!leftIndent) {
- scrollX += q->horizontalScrollBar()->minimum();
- scrollX += q->horizontalScrollBar()->maximum();
- scrollX -= q->horizontalScrollBar()->value();
+ scrollX += hbar->minimum();
+ scrollX += hbar->maximum();
+ scrollX -= hbar->value();
}
} else {
- scrollX += q->horizontalScrollBar()->value();
+ scrollX += hbar->value();
}
- scrollY = qint64(q->verticalScrollBar()->value() - topIndent);
+ scrollY = qint64(vbar->value() - topIndent);
dirtyScroll = false;
}
@@ -576,7 +576,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
return;
QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
- mouseEvent.setWidget(q->viewport());
+ mouseEvent.setWidget(viewport);
mouseEvent.setButtonDownScenePos(mousePressButton, mousePressScenePoint);
mouseEvent.setButtonDownScreenPos(mousePressButton, mousePressScreenPoint);
mouseEvent.setScenePos(q->mapToScene(event->pos()));
@@ -623,7 +623,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
if (hasStoredOriginalCursor) {
// Restore the original viewport cursor.
hasStoredOriginalCursor = false;
- q->viewport()->setCursor(originalCursor);
+ viewport->setCursor(originalCursor);
}
#endif
}
@@ -655,8 +655,6 @@ QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRec
#ifndef QT_NO_CURSOR
void QGraphicsViewPrivate::_q_setViewportCursor(const QCursor &cursor)
{
- Q_Q(QGraphicsView);
- QWidget *viewport = q->viewport();
if (!hasStoredOriginalCursor) {
hasStoredOriginalCursor = true;
originalCursor = viewport->cursor();
@@ -682,9 +680,9 @@ void QGraphicsViewPrivate::_q_unsetViewportCursor()
// Restore the original viewport cursor.
hasStoredOriginalCursor = false;
if (dragMode == QGraphicsView::ScrollHandDrag)
- q->viewport()->setCursor(Qt::OpenHandCursor);
+ viewport->setCursor(Qt::OpenHandCursor);
else
- q->viewport()->setCursor(originalCursor);
+ viewport->setCursor(originalCursor);
}
#endif
@@ -723,7 +721,7 @@ void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEven
dest->setProposedAction(source->proposedAction());
dest->setDropAction(source->dropAction());
dest->setMimeData(source->mimeData());
- dest->setWidget(q->viewport());
+ dest->setWidget(viewport);
dest->setSource(source->source());
#else
Q_UNUSED(dest)
@@ -814,7 +812,7 @@ void QGraphicsViewPrivate::processPendingUpdates()
if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) {
if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing)
- viewport->update(dirtyBoundingRect);
+ viewport->update(dirtyBoundingRect.adjusted(-1, -1, 1, 1));
else
viewport->update(dirtyBoundingRect.adjusted(-2, -2, 2, 2));
} else {
@@ -825,45 +823,36 @@ void QGraphicsViewPrivate::processPendingUpdates()
dirtyRegion = QRegion();
}
-void QGraphicsViewPrivate::updateAll()
-{
- Q_Q(QGraphicsView);
- q->viewport()->update();
- fullUpdatePending = true;
- dirtyBoundingRect = QRect();
- dirtyRegion = QRegion();
-}
-
void QGraphicsViewPrivate::updateRegion(const QRegion &r)
{
if (r.isEmpty() || fullUpdatePending)
return;
- Q_Q(QGraphicsView);
-
// Rect intersects viewport - update everything?
switch (viewportUpdateMode) {
case QGraphicsView::FullViewportUpdate:
fullUpdatePending = true;
- q->viewport()->update();
+ viewport->update();
break;
case QGraphicsView::BoundingRectViewportUpdate:
dirtyBoundingRect |= r.boundingRect();
- if (dirtyBoundingRect.contains(q->viewport()->rect())) {
+ if (dirtyBoundingRect.contains(viewport->rect())) {
fullUpdatePending = true;
- q->viewport()->update();
+ viewport->update();
}
break;
case QGraphicsView::SmartViewportUpdate: // ### DEPRECATE
case QGraphicsView::MinimalViewportUpdate:
- if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) {
- dirtyRegion += r;
- } else {
- const QVector<QRect> &rects = r.rects();
- for (int i = 0; i < rects.size(); ++i)
+ {
+ const QVector<QRect> &rects = r.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing)
+ dirtyRegion += rects.at(i).adjusted(-1, -1, 1, 1);
+ else
dirtyRegion += rects.at(i).adjusted(-2, -2, 2, 2);
}
break;
+ }
case QGraphicsView::NoViewportUpdate:
// Unreachable
break;
@@ -875,25 +864,23 @@ void QGraphicsViewPrivate::updateRect(const QRect &r)
if (r.isEmpty() || fullUpdatePending)
return;
- Q_Q(QGraphicsView);
-
// Rect intersects viewport - update everything?
switch (viewportUpdateMode) {
case QGraphicsView::FullViewportUpdate:
fullUpdatePending = true;
- q->viewport()->update();
+ viewport->update();
break;
case QGraphicsView::BoundingRectViewportUpdate:
dirtyBoundingRect |= r;
- if (dirtyBoundingRect.contains(q->viewport()->rect())) {
+ if (dirtyBoundingRect.contains(viewport->rect())) {
fullUpdatePending = true;
- q->viewport()->update();
+ viewport->update();
}
break;
case QGraphicsView::SmartViewportUpdate: // ### DEPRECATE
case QGraphicsView::MinimalViewportUpdate:
if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing)
- dirtyRegion += r;
+ dirtyRegion += r.adjusted(-1, -1, 1, 1);
else
dirtyRegion += r.adjusted(-2, -2, 2, 2);
break;
@@ -1091,7 +1078,7 @@ void QGraphicsView::setRenderHints(QPainter::RenderHints hints)
if (hints == d->renderHints)
return;
d->renderHints = hints;
- viewport()->update();
+ d->updateAll();
}
/*!
@@ -1109,7 +1096,7 @@ void QGraphicsView::setRenderHint(QPainter::RenderHint hint, bool enabled)
else
d->renderHints &= ~hint;
if (oldHints != d->renderHints)
- viewport()->update();
+ d->updateAll();
}
/*!
@@ -1396,7 +1383,7 @@ void QGraphicsView::resetCachedContent()
if (d->cacheMode & CacheBackground) {
// Background caching is enabled.
d->mustResizeBackgroundPixmap = true;
- viewport()->update();
+ d->updateAll();
} else if (d->mustResizeBackgroundPixmap) {
// Background caching is disabled.
// Cleanup, free some resources.
@@ -1485,7 +1472,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
return;
// Always update the viewport when the scene changes.
- viewport()->update();
+ d->updateAll();
// Remove the previously assigned scene.
if (d->scene) {
@@ -2441,7 +2428,7 @@ void QGraphicsView::setBackgroundBrush(const QBrush &brush)
{
Q_D(QGraphicsView);
d->backgroundBrush = brush;
- viewport()->update();
+ d->updateAll();
if (d->cacheMode & CacheBackground) {
// Invalidate the background pixmap
@@ -2471,7 +2458,7 @@ void QGraphicsView::setForegroundBrush(const QBrush &brush)
{
Q_D(QGraphicsView);
d->foregroundBrush = brush;
- viewport()->update();
+ d->updateAll();
}
/*!
@@ -2693,6 +2680,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
case QEvent::Paint:
// Reset full update
d->fullUpdatePending = false;
+ d->dirtyScrollOffset = QPoint();
if (d->scene) {
// Check if this view reimplements the updateScene slot; if it
// does, we can't do direct update delivery and have to fall back
@@ -3069,7 +3057,7 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event)
if (d->viewportUpdateMode != FullViewportUpdate)
viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));
else
- viewport()->update();
+ d->updateAll();
}
// Stop rubber banding if the user has let go of all buttons (even
@@ -3091,7 +3079,7 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event)
if (d->viewportUpdateMode != FullViewportUpdate)
viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));
else
- viewport()->update();
+ d->updateAll();
}
// Set the new selection area
QPainterPath selectionArea;
@@ -3134,7 +3122,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
if (d->viewportUpdateMode != FullViewportUpdate)
viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));
else
- viewport()->update();
+ d->updateAll();
}
d->rubberBanding = false;
d->rubberBandRect = QRect();
@@ -3245,7 +3233,6 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Set up the painter
QPainter painter(viewport());
- QTransform original = painter.worldTransform();
#ifndef QT_NO_RUBBERBAND
if (d->rubberBanding && !d->rubberBandRect.isEmpty())
painter.save();
@@ -3256,7 +3243,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Set up viewport transform
const QTransform viewTransform = viewportTransform();
- painter.setTransform(viewTransform, true);
+ painter.setWorldTransform(viewTransform);
// Draw background
if ((d->cacheMode & CacheBackground)
@@ -3288,10 +3275,9 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
}
// Blit the background from the background pixmap
- QTransform oldMatrix = painter.worldTransform();
- painter.setWorldTransform(original);
+ painter.setWorldTransform(QTransform());
painter.drawPixmap(QPoint(), d->backgroundPixmap);
- painter.setWorldTransform(oldMatrix);
+ painter.setWorldTransform(viewTransform);
} else {
if (!(d->optimizationFlags & DontSavePainterState))
painter.save();
@@ -3392,7 +3378,6 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) {
if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) {
- d->dirtyRegion.translate(dx, dy);
if (d->accelerateScrolling) {
#ifndef QT_NO_RUBBERBAND
// Update new and old rubberband regions
@@ -3402,12 +3387,15 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
viewport()->update(rubberBandRegion);
}
#endif
+ d->dirtyScrollOffset.rx() += dx;
+ d->dirtyScrollOffset.ry() += dy;
+ d->dirtyRegion.translate(dx, dy);
viewport()->scroll(dx, dy);
} else {
- viewport()->update();
+ d->updateAll();
}
} else {
- viewport()->update();
+ d->updateAll();
}
}
@@ -3620,7 +3608,7 @@ void QGraphicsView::setTransform(const QTransform &matrix, bool combine )
d->transforming = false;
// Any matrix operation requires a full update.
- viewport()->update();
+ d->updateAll();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index 814e476..a6f0d04 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -94,6 +94,7 @@ public:
QPoint mousePressScreenPoint;
QPointF lastMouseMoveScenePoint;
QPoint lastMouseMoveScreenPoint;
+ QPoint dirtyScrollOffset;
Qt::MouseButton mousePressButton;
QTransform matrix;
bool identityMatrix;
@@ -163,7 +164,13 @@ public:
QRegion dirtyRegion;
QRect dirtyBoundingRect;
void processPendingUpdates();
- void updateAll();
+ inline void updateAll()
+ {
+ viewport->update();
+ fullUpdatePending = true;
+ dirtyBoundingRect = QRect();
+ dirtyRegion = QRegion();
+ }
void updateRect(const QRect &rect);
void updateRegion(const QRegion &region);
bool updateSceneSlotReimplementedChecked;
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 4d0da2f..12baa56 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -170,134 +170,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \property QGraphicsWidget::xScale
- \brief the x scale factor
-
- This property is declared in QGraphicsItem.
- \sa QGraphicsItem::xScale(), QGraphicsItem::setXScale()
- */
-
-/*!
- \property QGraphicsWidget::yScale
- \brief the y scale factor
-
- This property is declared in QGraphicsItem.
- \sa QGraphicsItem::yScale(), QGraphicsItem::setYScale()
-*/
-
-/*!
- \property QGraphicsWidget::zRotation
- \brief the z rotation angle
-
- This property is declared in QGraphicsItem.
- \sa QGraphicsItem::zRotation(), QGraphicsItem::setZRotation()
-*/
-
-/*!
- \property QGraphicsWidget::xRotation
- \brief the x rotation angle
-
- This property is declared in QGraphicsItem.
- \sa QGraphicsItem::xRotation(), QGraphicsItem::setXRotation()
-*/
-
-/*!
- \property QGraphicsWidget::yRotation
- \brief the y rotation angle.
-
- This property is declared in QGraphicsItem.
- \sa QGraphicsItem::yRotation(), QGraphicsItem::setYRotation()
-*/
-
-/*!
- \property QGraphicsWidget::enabled
- \brief whether the item is enabled or not
-
- This property is declared in QGraphicsItem.
-
- By default, this property is true.
-
- \sa QGraphicsItem::isEnabled(), QGraphicsItem::setEnabled()
-*/
-
-/*!
- \property QGraphicsWidget::visible
- \brief whether the item is visible or not
-
- This property is declared in QGraphicsItem.
-
- By default, this property is true.
-
- \sa QGraphicsItem::isVisible(), QGraphicsItem::setVisible(), show(),
- hide()
-*/
-
-/*!
- \property QGraphicsWidget::opacity
- \brief the opacity of the widget
-*/
-
-/*!
- \property QGraphicsWidget::pos
- \brief the position of the widget
-*/
-
-/*!
- \property QGraphicsWidget::xRotation
- \since 4.6
- \brief the rotation angle in degrees around the X axis
-*/
-
-/*!
- \property QGraphicsWidget::yRotation
- \since 4.6
- \brief the rotation angle in degrees around the Y axis
-*/
-
-/*!
- \property QGraphicsWidget::zRotation
- \since 4.6
- \brief the rotation angle in degrees around the Z axis
-*/
-
-/*!
- \property QGraphicsWidget::xScale
- \since 4.6
- \brief the scale factor on the X axis.
-*/
-
-/*!
- \property QGraphicsWidget::yScale
- \since 4.6
- \brief the scale factor on the Y axis.
-*/
-
-/*!
- \property QGraphicsWidget::horizontalShear
- \since 4.6
- \brief the horizontal shear.
-*/
-
-/*!
- \property QGraphicsWidget::verticalShear
- \since 4.6
- \brief the vertical shear.
-*/
-
-/*!
- \property QGraphicsWidget::transformOrigin
- \since 4.6
- \brief the transformation origin for the transformation properties.
-*/
-
-/*!
Constructs a QGraphicsWidget instance. The optional \a parent argument is
passed to QGraphicsItem's constructor. The optional \a wFlags argument
specifies the widget's window flags (e.g., whether the widget should be a
window, a tool, a popup, etc).
*/
QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QGraphicsItem(*new QGraphicsWidgetPrivate, 0, 0), QGraphicsLayoutItem(0, false)
+ : QGraphicsObject(*new QGraphicsWidgetPrivate, 0, 0), QGraphicsLayoutItem(0, false)
{
Q_D(QGraphicsWidget);
d->init(parent, wFlags);
@@ -309,7 +188,7 @@ QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
Constructs a new QGraphicsWidget, using \a dd as parent.
*/
QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene, Qt::WindowFlags wFlags)
- : QGraphicsItem(dd, 0, scene), QGraphicsLayoutItem(0, false)
+ : QGraphicsObject(dd, 0, scene), QGraphicsLayoutItem(0, false)
{
Q_D(QGraphicsWidget);
d->init(parent, wFlags);
diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h
index 1a835df..5795daf 100644
--- a/src/gui/graphicsview/qgraphicswidget.h
+++ b/src/gui/graphicsview/qgraphicswidget.h
@@ -66,7 +66,7 @@ class QStyleOption;
class QGraphicsWidgetPrivate;
-class Q_GUI_EXPORT QGraphicsWidget : public QObject, public QGraphicsItem, public QGraphicsLayoutItem
+class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLayoutItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem QGraphicsLayoutItem)
@@ -75,12 +75,8 @@ class Q_GUI_EXPORT QGraphicsWidget : public QObject, public QGraphicsItem, publi
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
Q_PROPERTY(QSizeF size READ size WRITE resize)
Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
- Q_PROPERTY(QPointF pos READ pos WRITE setPos)
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
Q_PROPERTY(QPointF transformOrigin READ transformOrigin WRITE setTransformOrigin)
Q_PROPERTY(qreal xRotation READ xRotation WRITE setXRotation)
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index f24aeff..7e262b1 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -304,7 +304,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
QString key = QLatin1String("$qt_icon_")
+ QString::number(pm.cacheKey())
+ QString::number(pe->mode)
- + QString::number(qApp->palette().cacheKey())
+ + QString::number(QApplication::palette().cacheKey())
+ QLatin1Char('_')
+ QString::number(actualSize.width())
+ QLatin1Char('_')
diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp
index f78b86a..8db326b 100644
--- a/src/gui/inputmethod/qinputcontext.cpp
+++ b/src/gui/inputmethod/qinputcontext.cpp
@@ -262,7 +262,7 @@ void QInputContext::sendEvent(const QInputMethodEvent &event)
return;
QInputMethodEvent e(event);
- qApp->sendEvent(focus, &e);
+ QApplication::sendEvent(focus, &e);
}
@@ -408,7 +408,7 @@ QList<QAction *> QInputContext::actions()
QTextFormat QInputContext::standardFormat(StandardFormat s) const
{
QWidget *focus = focusWidget();
- const QPalette &pal = focus ? focus->palette() : qApp->palette();
+ const QPalette &pal = focus ? focus->palette() : QApplication::palette();
QTextCharFormat fmt;
QColor bg;
diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp
index dd966d5..b94c604 100644
--- a/src/gui/inputmethod/qwininputcontext_win.cpp
+++ b/src/gui/inputmethod/qwininputcontext_win.cpp
@@ -539,7 +539,7 @@ bool QWinInputContext::endComposition()
}
if (!fw)
- fw = qApp->focusWidget();
+ fw = QApplication::focusWidget();
if (fw) {
QInputMethodEvent e;
@@ -637,7 +637,7 @@ bool QWinInputContext::composition(LPARAM lParam)
// bogus event
return true;
- QWidget *fw = qApp->focusWidget();
+ QWidget *fw = QApplication::focusWidget();
if (fw) {
Q_ASSERT(fw->testAttribute(Qt::WA_WState_Created));
HIMC imc = getContext(fw->effectiveWinId());
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index d353c2d..9effc70 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -108,16 +108,16 @@ void QAbstractItemViewPrivate::init()
Q_Q(QAbstractItemView);
q->setItemDelegate(new QStyledItemDelegate(q));
- q->verticalScrollBar()->setRange(0, 0);
- q->horizontalScrollBar()->setRange(0, 0);
+ vbar->setRange(0, 0);
+ hbar->setRange(0, 0);
- QObject::connect(q->verticalScrollBar(), SIGNAL(actionTriggered(int)),
+ QObject::connect(vbar, SIGNAL(actionTriggered(int)),
q, SLOT(verticalScrollbarAction(int)));
- QObject::connect(q->horizontalScrollBar(), SIGNAL(actionTriggered(int)),
+ QObject::connect(hbar, SIGNAL(actionTriggered(int)),
q, SLOT(horizontalScrollbarAction(int)));
- QObject::connect(q->verticalScrollBar(), SIGNAL(valueChanged(int)),
+ QObject::connect(vbar, SIGNAL(valueChanged(int)),
q, SLOT(verticalScrollbarValueChanged(int)));
- QObject::connect(q->horizontalScrollBar(), SIGNAL(valueChanged(int)),
+ QObject::connect(hbar, SIGNAL(valueChanged(int)),
q, SLOT(horizontalScrollbarValueChanged(int)));
viewport->setBackgroundRole(QPalette::Base);
@@ -3784,7 +3784,7 @@ void QAbstractItemViewPrivate::clearOrRemove()
void QAbstractItemViewPrivate::checkPersistentEditorFocus()
{
Q_Q(QAbstractItemView);
- if (QWidget *widget = qApp->focusWidget()) {
+ if (QWidget *widget = QApplication::focusWidget()) {
if (persistent.contains(widget)) {
//a persistent editor has gained the focus
QModelIndex index = indexForEditor(widget);
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 139d0b7..8594ad7 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -99,7 +99,7 @@ public:
QVariant data(const QModelIndex &, int) const { return QVariant(); }
};
-class QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
+class Q_AUTOTEST_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QAbstractItemView)
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index 4fb08bb..16ae8e9 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -108,9 +108,9 @@ void QColumnViewPrivate::initialize()
{
Q_Q(QColumnView);
q->setTextElideMode(Qt::ElideMiddle);
- q->connect(&currentAnimation, SIGNAL(frameChanged(int)),
- q->horizontalScrollBar(), SLOT(setValue(int)));
- q->connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
+ QObject::connect(&currentAnimation, SIGNAL(frameChanged(int)),
+ hbar, SLOT(setValue(int)));
+ QObject::connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
delete itemDelegate;
q->setItemDelegate(new QColumnViewDelegate(q));
}
@@ -421,23 +421,23 @@ void QColumnViewPrivate::updateScrollbars()
horizontalLength = (columns.first()->x() + columns.first()->width()) - columns.last()->x();
}
- QSize viewportSize = q->viewport()->size();
- if (horizontalLength < viewportSize.width() && q->horizontalScrollBar()->value() == 0) {
- q->horizontalScrollBar()->setRange(0, 0);
+ QSize viewportSize = viewport->size();
+ if (horizontalLength < viewportSize.width() && hbar->value() == 0) {
+ hbar->setRange(0, 0);
} else {
int visibleLength = qMin(horizontalLength + q->horizontalOffset(), viewportSize.width());
int hiddenLength = horizontalLength - visibleLength;
- if (hiddenLength != q->horizontalScrollBar()->maximum())
- q->horizontalScrollBar()->setRange(0, hiddenLength);
+ if (hiddenLength != hbar->maximum())
+ hbar->setRange(0, hiddenLength);
}
if (!columns.isEmpty()) {
int pageStepSize = columns.at(0)->width();
- if (pageStepSize != q->horizontalScrollBar()->pageStep())
- q->horizontalScrollBar()->setPageStep(pageStepSize);
+ if (pageStepSize != hbar->pageStep())
+ hbar->setPageStep(pageStepSize);
}
- bool visible = (q->horizontalScrollBar()->maximum() > 0);
- if (visible != q->horizontalScrollBar()->isVisible())
- q->horizontalScrollBar()->setVisible(visible);
+ bool visible = (hbar->maximum() > 0);
+ if (visible != hbar->isVisible())
+ hbar->setVisible(visible);
}
/*!
@@ -696,7 +696,7 @@ QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bo
q, SIGNAL(pressed(const QModelIndex &)));
view->setFocusPolicy(Qt::NoFocus);
- view->setParent(q->viewport());
+ view->setParent(viewport);
Q_ASSERT(view);
// Setup corner grip
@@ -707,13 +707,13 @@ QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bo
}
if (columnSizes.count() > columns.count()) {
- view->setGeometry(0, 0, columnSizes.at(columns.count()), q->viewport()->height());
+ view->setGeometry(0, 0, columnSizes.at(columns.count()), viewport->height());
} else {
int initialWidth = view->sizeHint().width();
if (q->isRightToLeft())
- view->setGeometry(q->viewport()->width() - initialWidth, 0, initialWidth, q->viewport()->height());
+ view->setGeometry(viewport->width() - initialWidth, 0, initialWidth, viewport->height());
else
- view->setGeometry(0, 0, initialWidth, q->viewport()->height());
+ view->setGeometry(0, 0, initialWidth, viewport->height());
columnSizes.resize(qMax(columnSizes.count(), columns.count() + 1));
columnSizes[columns.count()] = initialWidth;
}
@@ -1056,11 +1056,11 @@ void QColumnViewPrivate::doLayout()
if (!model || columns.isEmpty())
return;
- int viewportHeight = q->viewport()->height();
+ int viewportHeight = viewport->height();
int x = columns.at(0)->x();
if (q->isRightToLeft()) {
- x = q->viewport()->width() + q->horizontalOffset();
+ x = viewport->width() + q->horizontalOffset();
for (int i = 0; i < columns.size(); ++i) {
QAbstractItemView *view = columns.at(i);
x -= view->width();
@@ -1116,7 +1116,7 @@ void QColumnViewDelegate::paint(QPainter *painter,
// Draw >
if (index.model()->hasChildren(index)) {
const QWidget *view = opt.widget;
- QStyle *style = view ? view->style() : qApp->style();
+ QStyle *style = view ? view->style() : QApplication::style();
style->drawPrimitive(QStyle::PE_IndicatorColumnViewArrow, &opt, painter, view);
}
}
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 7ad825a..d0321d8 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -3474,11 +3474,10 @@ void QHeaderViewPrivate::setGlobalHeaderResizeMode(QHeaderView::ResizeMode mode)
int QHeaderViewPrivate::viewSectionSizeHint(int logical) const
{
- Q_Q(const QHeaderView);
- if (QAbstractItemView *parent = qobject_cast<QAbstractItemView*>(q->parent())) {
+ if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(parent)) {
return (orientation == Qt::Horizontal
- ? parent->sizeHintForColumn(logical)
- : parent->sizeHintForRow(logical));
+ ? view->sizeHintForColumn(logical)
+ : view->sizeHintForRow(logical));
}
return 0;
}
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 03ba641..fe7916c 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -610,7 +610,7 @@ int QListViewPrivate::horizontalScrollToValue(const QModelIndex &index, const QR
const bool rightOf = q->isRightToLeft()
? rect.right() > area.right()
: (rect.right() > area.right()) && (rect.left() > area.left());
- int horizontalValue = q->horizontalScrollBar()->value();
+ int horizontalValue = hbar->value();
// ScrollPerItem
if (q->horizontalScrollMode() == QAbstractItemView::ScrollPerItem && viewMode == QListView::ListMode) {
@@ -652,10 +652,10 @@ int QListViewPrivate::verticalScrollToValue(const QModelIndex &index, const QRec
const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());
const bool below = (hint == QListView::EnsureVisible && rect.bottom() > area.bottom());
- int verticalValue = q->verticalScrollBar()->value();
+ int verticalValue = vbar->value();
// ScrollPerItem
- if (q->verticalScrollMode() == QAbstractItemView::ScrollPerItem && viewMode == QListView::ListMode) {
+ if (verticalScrollMode == QAbstractItemView::ScrollPerItem && viewMode == QListView::ListMode) {
const QListViewItem item = indexToListViewItem(index);
const QRect rect = q->visualRect(index);
verticalValue = staticListView->verticalPerItemValue(itemIndex(item),
@@ -1972,10 +1972,10 @@ void QListViewPrivate::prepareItemsLayout()
// Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy
// is Qt::ScrollBarAsNeeded
int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded
- ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->verticalScrollBar()) + frameAroundContents
+ ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, vbar) + frameAroundContents
: 0;
int horizontalMargin = hbarpolicy==Qt::ScrollBarAsNeeded
- ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q->horizontalScrollBar()) + frameAroundContents
+ ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, hbar) + frameAroundContents
: 0;
layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin);
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 504908f..51861b3 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -1020,51 +1020,51 @@ void QListWidgetPrivate::setup()
QObject::connect(q, SIGNAL(activated(QModelIndex)),
q, SLOT(_q_emitItemActivated(QModelIndex)));
QObject::connect(q, SIGNAL(entered(QModelIndex)), q, SLOT(_q_emitItemEntered(QModelIndex)));
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitItemChanged(QModelIndex)));
QObject::connect(q->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitCurrentItemChanged(QModelIndex,QModelIndex)));
QObject::connect(q->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
q, SIGNAL(itemSelectionChanged()));
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
- QObject::connect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
+ QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
}
void QListWidgetPrivate::_q_emitItemPressed(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemPressed(model()->at(index.row()));
+ emit q->itemPressed(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemClicked(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemClicked(model()->at(index.row()));
+ emit q->itemClicked(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemDoubleClicked(model()->at(index.row()));
+ emit q->itemDoubleClicked(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemActivated(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemActivated(model()->at(index.row()));
+ emit q->itemActivated(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemEntered(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemEntered(model()->at(index.row()));
+ emit q->itemEntered(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemChanged(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemChanged(model()->at(index.row()));
+ emit q->itemChanged(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
@@ -1072,8 +1072,8 @@ void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
{
Q_Q(QListWidget);
QPersistentModelIndex persistentCurrent = current;
- QListWidgetItem *currentItem = model()->at(persistentCurrent.row());
- emit q->currentItemChanged(currentItem, model()->at(previous.row()));
+ QListWidgetItem *currentItem = listModel()->at(persistentCurrent.row());
+ emit q->currentItemChanged(currentItem, listModel()->at(previous.row()));
//persistentCurrent is invalid if something changed the model in response
//to the currentItemChanged signal emission and the item was removed
@@ -1088,14 +1088,14 @@ void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
void QListWidgetPrivate::_q_sort()
{
if (sortingEnabled)
- model()->sort(0, sortOrder);
+ model->sort(0, sortOrder);
}
void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight)
{
if (sortingEnabled && topLeft.isValid() && bottomRight.isValid())
- model()->ensureSorted(topLeft.column(), sortOrder,
+ listModel()->ensureSorted(topLeft.column(), sortOrder,
topLeft.row(), bottomRight.row());
}
@@ -1308,9 +1308,9 @@ QListWidget::~QListWidget()
QListWidgetItem *QListWidget::item(int row) const
{
Q_D(const QListWidget);
- if (row < 0 || row >= d->model()->rowCount())
+ if (row < 0 || row >= d->model->rowCount())
return 0;
- return d->model()->at(row);
+ return d->listModel()->at(row);
}
/*!
@@ -1322,7 +1322,7 @@ QListWidgetItem *QListWidget::item(int row) const
int QListWidget::row(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
- return d->model()->index(const_cast<QListWidgetItem*>(item)).row();
+ return d->listModel()->index(const_cast<QListWidgetItem*>(item)).row();
}
@@ -1336,7 +1336,7 @@ void QListWidget::insertItem(int row, QListWidgetItem *item)
{
Q_D(QListWidget);
if (item && !item->view)
- d->model()->insert(row, item);
+ d->listModel()->insert(row, item);
}
/*!
@@ -1349,7 +1349,7 @@ void QListWidget::insertItem(int row, QListWidgetItem *item)
void QListWidget::insertItem(int row, const QString &label)
{
Q_D(QListWidget);
- d->model()->insert(row, new QListWidgetItem(label));
+ d->listModel()->insert(row, new QListWidgetItem(label));
}
/*!
@@ -1362,7 +1362,7 @@ void QListWidget::insertItem(int row, const QString &label)
void QListWidget::insertItems(int row, const QStringList &labels)
{
Q_D(QListWidget);
- d->model()->insert(row, labels);
+ d->listModel()->insert(row, labels);
}
/*!
@@ -1378,9 +1378,9 @@ void QListWidget::insertItems(int row, const QStringList &labels)
QListWidgetItem *QListWidget::takeItem(int row)
{
Q_D(QListWidget);
- if (row < 0 || row >= d->model()->rowCount())
+ if (row < 0 || row >= d->model->rowCount())
return 0;
- return d->model()->take(row);
+ return d->listModel()->take(row);
}
/*!
@@ -1391,7 +1391,7 @@ QListWidgetItem *QListWidget::takeItem(int row)
int QListWidget::count() const
{
Q_D(const QListWidget);
- return d->model()->rowCount();
+ return d->model->rowCount();
}
/*!
@@ -1400,7 +1400,7 @@ int QListWidget::count() const
QListWidgetItem *QListWidget::currentItem() const
{
Q_D(const QListWidget);
- return d->model()->at(currentIndex().row());
+ return d->listModel()->at(currentIndex().row());
}
@@ -1438,7 +1438,7 @@ int QListWidget::currentRow() const
void QListWidget::setCurrentRow(int row)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(row);
+ QModelIndex index = d->listModel()->index(row);
if (d->selectionMode == SingleSelection)
selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
else if (d->selectionMode == NoSelection)
@@ -1455,7 +1455,7 @@ void QListWidget::setCurrentRow(int row)
void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags command)
{
Q_D(QListWidget);
- d->selectionModel->setCurrentIndex(d->model()->index(row), command);
+ d->selectionModel->setCurrentIndex(d->listModel()->index(row), command);
}
/*!
@@ -1464,7 +1464,7 @@ void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags com
QListWidgetItem *QListWidget::itemAt(const QPoint &p) const
{
Q_D(const QListWidget);
- return d->model()->at(indexAt(p).row());
+ return d->listModel()->at(indexAt(p).row());
}
@@ -1482,7 +1482,7 @@ QListWidgetItem *QListWidget::itemAt(const QPoint &p) const
QRect QListWidget::visualItemRect(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
return visualRect(index);
}
@@ -1493,7 +1493,7 @@ void QListWidget::sortItems(Qt::SortOrder order)
{
Q_D(QListWidget);
d->sortOrder = order;
- d->model()->sort(0, order);
+ d->listModel()->sort(0, order);
}
/*!
@@ -1532,7 +1532,7 @@ Qt::SortOrder QListWidget::sortOrder() const
void QListWidget::editItem(QListWidgetItem *item)
{
Q_D(QListWidget);
- edit(d->model()->index(item));
+ edit(d->listModel()->index(item));
}
/*!
@@ -1543,7 +1543,7 @@ void QListWidget::editItem(QListWidgetItem *item)
void QListWidget::openPersistentEditor(QListWidgetItem *item)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
QAbstractItemView::openPersistentEditor(index);
}
@@ -1555,7 +1555,7 @@ void QListWidget::openPersistentEditor(QListWidgetItem *item)
void QListWidget::closePersistentEditor(QListWidgetItem *item)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
QAbstractItemView::closePersistentEditor(index);
}
@@ -1567,7 +1567,7 @@ void QListWidget::closePersistentEditor(QListWidgetItem *item)
QWidget *QListWidget::itemWidget(QListWidgetItem *item) const
{
Q_D(const QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
return QAbstractItemView::indexWidget(index);
}
@@ -1585,7 +1585,7 @@ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const
void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
QAbstractItemView::setIndexWidget(index, widget);
}
@@ -1599,7 +1599,7 @@ void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
bool QListWidget::isItemSelected(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
return selectionModel()->isSelected(index);
}
@@ -1614,7 +1614,7 @@ bool QListWidget::isItemSelected(const QListWidgetItem *item) const
void QListWidget::setItemSelected(const QListWidgetItem *item, bool select)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
if (d->selectionMode == SingleSelection) {
selectionModel()->select(index, select
@@ -1638,7 +1638,7 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const
QModelIndexList indexes = selectionModel()->selectedIndexes();
QList<QListWidgetItem*> items;
for (int i = 0; i < indexes.count(); ++i)
- items.append(d->model()->at(indexes.at(i).row()));
+ items.append(d->listModel()->at(indexes.at(i).row()));
return items;
}
@@ -1649,11 +1649,11 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const
QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFlags flags) const
{
Q_D(const QListWidget);
- QModelIndexList indexes = d->model()->match(model()->index(0, 0, QModelIndex()),
+ QModelIndexList indexes = d->listModel()->match(model()->index(0, 0, QModelIndex()),
Qt::DisplayRole, text, -1, flags);
QList<QListWidgetItem*> items;
for (int i = 0; i < indexes.size(); ++i)
- items.append(d->model()->at(indexes.at(i).row()));
+ items.append(d->listModel()->at(indexes.at(i).row()));
return items;
}
@@ -1690,7 +1690,7 @@ void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide)
void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
QListView::scrollTo(index, hint);
}
@@ -1703,7 +1703,7 @@ void QListWidget::clear()
{
Q_D(QListWidget);
selectionModel()->clear();
- d->model()->clear();
+ d->listModel()->clear();
}
/*!
@@ -1714,7 +1714,7 @@ void QListWidget::clear()
*/
QStringList QListWidget::mimeTypes() const
{
- return d_func()->model()->QAbstractListModel::mimeTypes();
+ return d_func()->listModel()->QAbstractListModel::mimeTypes();
}
/*!
@@ -1727,7 +1727,7 @@ QStringList QListWidget::mimeTypes() const
*/
QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const
{
- return d_func()->model()->internalMimeData();
+ return d_func()->listModel()->internalMimeData();
}
#ifndef QT_NO_DRAGANDDROP
@@ -1750,7 +1750,7 @@ bool QListWidget::dropMimeData(int index, const QMimeData *data, Qt::DropAction
row = -1;
column = -1;
}
- return d_func()->model()->QAbstractListModel::dropMimeData(data, action , row, column, idx);
+ return d_func()->listModel()->QAbstractListModel::dropMimeData(data, action , row, column, idx);
}
/*! \reimp */
@@ -1809,7 +1809,7 @@ void QListWidget::dropEvent(QDropEvent *event) {
Qt::DropActions QListWidget::supportedDropActions() const
{
Q_D(const QListWidget);
- return d->model()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;
+ return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;
}
#endif // QT_NO_DRAGANDDROP
@@ -1833,7 +1833,7 @@ QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const
QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const
{
Q_D(const QListWidget);
- return d->model()->index(item);
+ return d->listModel()->index(item);
}
/*!
@@ -1844,7 +1844,7 @@ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const
{
Q_D(const QListWidget);
if (d->isIndexValid(index))
- return d->model()->at(index.row());
+ return d->listModel()->at(index.row());
return 0;
}
diff --git a/src/gui/itemviews/qlistwidget_p.h b/src/gui/itemviews/qlistwidget_p.h
index 8556047..6887d9d 100644
--- a/src/gui/itemviews/qlistwidget_p.h
+++ b/src/gui/itemviews/qlistwidget_p.h
@@ -143,7 +143,7 @@ class QListWidgetPrivate : public QListViewPrivate
Q_DECLARE_PUBLIC(QListWidget)
public:
QListWidgetPrivate() : QListViewPrivate(), sortOrder(Qt::AscendingOrder), sortingEnabled(false) {}
- inline QListModel *model() const { return qobject_cast<QListModel*>(q_func()->model()); }
+ inline QListModel *listModel() const { return qobject_cast<QListModel*>(model); }
void setup();
void _q_emitItemPressed(const QModelIndex &index);
void _q_emitItemClicked(const QModelIndex &index);
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 9d0f796..30daed2 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1742,18 +1742,21 @@ QList<QStandardItem*> QStandardItem::takeRow(int row)
Q_D(QStandardItem);
if ((row < 0) || (row >= rowCount()))
return QList<QStandardItem*>();
+ if (d->model)
+ d->model->d_func()->rowsAboutToBeRemoved(this, row, row);
QList<QStandardItem*> items;
int index = d->childIndex(row, 0);
- for (int column = 0; column < d->columnCount(); ++column) {
- QStandardItem *ch = d->children.at(index);
- if (ch) {
+ int col_count = d->columnCount();
+ for (int column = 0; column < col_count; ++column) {
+ QStandardItem *ch = d->children.at(index + column);
+ if (ch)
ch->d_func()->setParentAndModel(0, 0);
- d->children.replace(index, 0);
- }
items.append(ch);
- ++index;
}
- removeRow(row);
+ d->children.remove(index, col_count);
+ d->rows--;
+ if (d->model)
+ d->model->d_func()->rowsRemoved(this, row, 1);
return items;
}
@@ -1769,18 +1772,21 @@ QList<QStandardItem*> QStandardItem::takeColumn(int column)
Q_D(QStandardItem);
if ((column < 0) || (column >= columnCount()))
return QList<QStandardItem*>();
+ if (d->model)
+ d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
QList<QStandardItem*> items;
- int index = d->childIndex(0, column);
- for (int row = 0; row < d->rowCount(); ++row) {
+
+ for (int row = d->rowCount() - 1; row >= 0; --row) {
+ int index = d->childIndex(row, column);
QStandardItem *ch = d->children.at(index);
- if (ch) {
+ if (ch)
ch->d_func()->setParentAndModel(0, 0);
- d->children.replace(index, 0);
- }
- items.append(ch);
- index += d->columnCount();
+ d->children.remove(index);
+ items.prepend(ch);
}
- removeColumn(column);
+ d->columns--;
+ if (d->model)
+ d->model->d_func()->columnsRemoved(this, column, 1);
return items;
}
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index 072e435..6645376 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1570,7 +1570,7 @@ void QTableWidgetPrivate::setup()
QObject::connect(q, SIGNAL(activated(QModelIndex)), q, SLOT(_q_emitItemActivated(QModelIndex)));
QObject::connect(q, SIGNAL(entered(QModelIndex)), q, SLOT(_q_emitItemEntered(QModelIndex)));
// model signals
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitItemChanged(QModelIndex)));
// selection signals
QObject::connect(q->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
@@ -1578,15 +1578,15 @@ void QTableWidgetPrivate::setup()
QObject::connect(q->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
q, SIGNAL(itemSelectionChanged()));
// sorting
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
- QObject::connect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
+ QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
}
void QTableWidgetPrivate::_q_emitItemPressed(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemPressed(item);
emit q->cellPressed(index.row(), index.column());
}
@@ -1594,7 +1594,7 @@ void QTableWidgetPrivate::_q_emitItemPressed(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemClicked(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemClicked(item);
emit q->cellClicked(index.row(), index.column());
}
@@ -1602,7 +1602,7 @@ void QTableWidgetPrivate::_q_emitItemClicked(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemDoubleClicked(item);
emit q->cellDoubleClicked(index.row(), index.column());
}
@@ -1610,7 +1610,7 @@ void QTableWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemActivated(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemActivated(item);
emit q->cellActivated(index.row(), index.column());
}
@@ -1618,7 +1618,7 @@ void QTableWidgetPrivate::_q_emitItemActivated(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemEntered(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemEntered(item);
emit q->cellEntered(index.row(), index.column());
}
@@ -1626,7 +1626,7 @@ void QTableWidgetPrivate::_q_emitItemEntered(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemChanged(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemChanged(item);
emit q->cellChanged(index.row(), index.column());
}
@@ -1635,8 +1635,8 @@ void QTableWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
const QModelIndex &previous)
{
Q_Q(QTableWidget);
- QTableWidgetItem *currentItem = model()->item(current);
- QTableWidgetItem *previousItem = model()->item(previous);
+ QTableWidgetItem *currentItem = tableModel()->item(current);
+ QTableWidgetItem *previousItem = tableModel()->item(previous);
if (currentItem || previousItem)
emit q->currentItemChanged(currentItem, previousItem);
emit q->currentCellChanged(current.row(), current.column(), previous.row(), previous.column());
@@ -1647,7 +1647,7 @@ void QTableWidgetPrivate::_q_sort()
if (sortingEnabled) {
int column = horizontalHeader->sortIndicatorSection();
Qt::SortOrder order = horizontalHeader->sortIndicatorOrder();
- model()->sort(column, order);
+ model->sort(column, order);
}
}
@@ -1658,7 +1658,7 @@ void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
int column = horizontalHeader->sortIndicatorSection();
if (column >= topLeft.column() && column <= bottomRight.column()) {
Qt::SortOrder order = horizontalHeader->sortIndicatorOrder();
- model()->ensureSorted(column, order, topLeft.row(), bottomRight.row());
+ tableModel()->ensureSorted(column, order, topLeft.row(), bottomRight.row());
}
}
}
@@ -1862,7 +1862,7 @@ QTableWidget::~QTableWidget()
void QTableWidget::setRowCount(int rows)
{
Q_D(QTableWidget);
- d->model()->setRowCount(rows);
+ d->tableModel()->setRowCount(rows);
}
/*!
@@ -1872,7 +1872,7 @@ void QTableWidget::setRowCount(int rows)
int QTableWidget::rowCount() const
{
Q_D(const QTableWidget);
- return d->model()->rowCount();
+ return d->model->rowCount();
}
/*!
@@ -1885,7 +1885,7 @@ int QTableWidget::rowCount() const
void QTableWidget::setColumnCount(int columns)
{
Q_D(QTableWidget);
- d->model()->setColumnCount(columns);
+ d->tableModel()->setColumnCount(columns);
}
/*!
@@ -1895,7 +1895,7 @@ void QTableWidget::setColumnCount(int columns)
int QTableWidget::columnCount() const
{
Q_D(const QTableWidget);
- return d->model()->columnCount();
+ return d->model->columnCount();
}
/*!
@@ -1904,7 +1904,7 @@ int QTableWidget::columnCount() const
int QTableWidget::row(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- return d->model()->index(item).row();
+ return d->tableModel()->index(item).row();
}
/*!
@@ -1913,7 +1913,7 @@ int QTableWidget::row(const QTableWidgetItem *item) const
int QTableWidget::column(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- return d->model()->index(item).column();
+ return d->tableModel()->index(item).column();
}
@@ -1926,7 +1926,7 @@ int QTableWidget::column(const QTableWidgetItem *item) const
QTableWidgetItem *QTableWidget::item(int row, int column) const
{
Q_D(const QTableWidget);
- return d->model()->item(row, column);
+ return d->tableModel()->item(row, column);
}
/*!
@@ -1955,7 +1955,7 @@ void QTableWidget::setItem(int row, int column, QTableWidgetItem *item)
qWarning("QTableWidget: cannot insert an item that is already owned by another QTableWidget");
} else {
item->view = this;
- d->model()->setItem(row, column, item);
+ d->tableModel()->setItem(row, column, item);
}
} else {
delete takeItem(row, column);
@@ -1968,7 +1968,7 @@ void QTableWidget::setItem(int row, int column, QTableWidgetItem *item)
QTableWidgetItem *QTableWidget::takeItem(int row, int column)
{
Q_D(QTableWidget);
- QTableWidgetItem *item = d->model()->takeItem(row, column);
+ QTableWidgetItem *item = d->tableModel()->takeItem(row, column);
if (item)
item->view = 0;
return item;
@@ -1980,7 +1980,7 @@ QTableWidgetItem *QTableWidget::takeItem(int row, int column)
QTableWidgetItem *QTableWidget::verticalHeaderItem(int row) const
{
Q_D(const QTableWidget);
- return d->model()->verticalHeaderItem(row);
+ return d->tableModel()->verticalHeaderItem(row);
}
/*!
@@ -1991,7 +1991,7 @@ void QTableWidget::setVerticalHeaderItem(int row, QTableWidgetItem *item)
Q_D(QTableWidget);
if (item) {
item->view = this;
- d->model()->setVerticalHeaderItem(row, item);
+ d->tableModel()->setVerticalHeaderItem(row, item);
} else {
delete takeVerticalHeaderItem(row);
}
@@ -2004,7 +2004,7 @@ void QTableWidget::setVerticalHeaderItem(int row, QTableWidgetItem *item)
QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row)
{
Q_D(QTableWidget);
- QTableWidgetItem *itm = d->model()->takeVerticalHeaderItem(row);
+ QTableWidgetItem *itm = d->tableModel()->takeVerticalHeaderItem(row);
if (itm)
itm->view = 0;
return itm;
@@ -2017,7 +2017,7 @@ QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row)
QTableWidgetItem *QTableWidget::horizontalHeaderItem(int column) const
{
Q_D(const QTableWidget);
- return d->model()->horizontalHeaderItem(column);
+ return d->tableModel()->horizontalHeaderItem(column);
}
/*!
@@ -2028,7 +2028,7 @@ void QTableWidget::setHorizontalHeaderItem(int column, QTableWidgetItem *item)
Q_D(QTableWidget);
if (item) {
item->view = this;
- d->model()->setHorizontalHeaderItem(column, item);
+ d->tableModel()->setHorizontalHeaderItem(column, item);
} else {
delete takeHorizontalHeaderItem(column);
}
@@ -2041,7 +2041,7 @@ void QTableWidget::setHorizontalHeaderItem(int column, QTableWidgetItem *item)
QTableWidgetItem *QTableWidget::takeHorizontalHeaderItem(int column)
{
Q_D(QTableWidget);
- QTableWidgetItem *itm = d->model()->takeHorizontalHeaderItem(column);
+ QTableWidgetItem *itm = d->tableModel()->takeHorizontalHeaderItem(column);
if (itm)
itm->view = 0;
return itm;
@@ -2053,7 +2053,7 @@ QTableWidgetItem *QTableWidget::takeHorizontalHeaderItem(int column)
void QTableWidget::setVerticalHeaderLabels(const QStringList &labels)
{
Q_D(QTableWidget);
- QTableModel *model = d->model();
+ QTableModel *model = d->tableModel();
QTableWidgetItem *item = 0;
for (int i = 0; i < model->rowCount() && i < labels.count(); ++i) {
item = model->verticalHeaderItem(i);
@@ -2071,7 +2071,7 @@ void QTableWidget::setVerticalHeaderLabels(const QStringList &labels)
void QTableWidget::setHorizontalHeaderLabels(const QStringList &labels)
{
Q_D(QTableWidget);
- QTableModel *model = d->model();
+ QTableModel *model = d->tableModel();
QTableWidgetItem *item = 0;
for (int i = 0; i < model->columnCount() && i < labels.count(); ++i) {
item = model->horizontalHeaderItem(i);
@@ -2111,7 +2111,7 @@ int QTableWidget::currentColumn() const
QTableWidgetItem *QTableWidget::currentItem() const
{
Q_D(const QTableWidget);
- return d->model()->item(currentIndex());
+ return d->tableModel()->item(currentIndex());
}
/*!
@@ -2125,7 +2125,7 @@ QTableWidgetItem *QTableWidget::currentItem() const
void QTableWidget::setCurrentItem(QTableWidgetItem *item)
{
Q_D(QTableWidget);
- setCurrentIndex(d->model()->index(item));
+ setCurrentIndex(d->tableModel()->index(item));
}
/*!
@@ -2138,7 +2138,7 @@ void QTableWidget::setCurrentItem(QTableWidgetItem *item)
void QTableWidget::setCurrentItem(QTableWidgetItem *item, QItemSelectionModel::SelectionFlags command)
{
Q_D(QTableWidget);
- d->selectionModel->setCurrentIndex(d->model()->index(item), command);
+ d->selectionModel->setCurrentIndex(d->tableModel()->index(item), command);
}
/*!
@@ -2177,7 +2177,7 @@ void QTableWidget::setCurrentCell(int row, int column, QItemSelectionModel::Sele
void QTableWidget::sortItems(int column, Qt::SortOrder order)
{
Q_D(QTableWidget);
- d->model()->sort(column, order);
+ d->model->sort(column, order);
horizontalHeader()->setSortIndicator(column, order);
}
@@ -2206,7 +2206,7 @@ void QTableWidget::editItem(QTableWidgetItem *item)
Q_D(QTableWidget);
if (!item)
return;
- edit(d->model()->index(item));
+ edit(d->tableModel()->index(item));
}
/*!
@@ -2219,7 +2219,7 @@ void QTableWidget::openPersistentEditor(QTableWidgetItem *item)
Q_D(QTableWidget);
if (!item)
return;
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
QAbstractItemView::openPersistentEditor(index);
}
@@ -2233,7 +2233,7 @@ void QTableWidget::closePersistentEditor(QTableWidgetItem *item)
Q_D(QTableWidget);
if (!item)
return;
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
QAbstractItemView::closePersistentEditor(index);
}
@@ -2283,7 +2283,7 @@ void QTableWidget::setCellWidget(int row, int column, QWidget *widget)
bool QTableWidget::isItemSelected(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
return selectionModel()->isSelected(index);
}
@@ -2297,7 +2297,7 @@ bool QTableWidget::isItemSelected(const QTableWidgetItem *item) const
void QTableWidget::setItemSelected(const QTableWidgetItem *item, bool select)
{
Q_D(QTableWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
selectionModel()->select(index, select ? QItemSelectionModel::Select : QItemSelectionModel::Deselect);
}
@@ -2354,7 +2354,7 @@ QList<QTableWidgetItem*> QTableWidget::selectedItems()
QModelIndex index = indexes.at(i);
if (isIndexHidden(index))
continue;
- QTableWidgetItem *item = d->model()->item(index);
+ QTableWidgetItem *item = d->tableModel()->item(index);
if (item)
items.append(item);
}
@@ -2370,11 +2370,11 @@ QList<QTableWidgetItem*> QTableWidget::findItems(const QString &text, Qt::MatchF
Q_D(const QTableWidget);
QModelIndexList indexes;
for (int column = 0; column < columnCount(); ++column)
- indexes += d->model()->match(model()->index(0, column, QModelIndex()),
+ indexes += d->model->match(model()->index(0, column, QModelIndex()),
Qt::DisplayRole, text, -1, flags);
QList<QTableWidgetItem*> items;
for (int i = 0; i < indexes.size(); ++i)
- items.append(d->model()->item(indexes.at(i)));
+ items.append(d->tableModel()->item(indexes.at(i)));
return items;
}
@@ -2408,7 +2408,7 @@ int QTableWidget::visualColumn(int logicalColumn) const
QTableWidgetItem *QTableWidget::itemAt(const QPoint &p) const
{
Q_D(const QTableWidget);
- return d->model()->item(indexAt(p));
+ return d->tableModel()->item(indexAt(p));
}
/*!
@@ -2419,7 +2419,7 @@ QRect QTableWidget::visualItemRect(const QTableWidgetItem *item) const
Q_D(const QTableWidget);
if (!item)
return QRect();
- QModelIndex index = d->model()->index(const_cast<QTableWidgetItem*>(item));
+ QModelIndex index = d->tableModel()->index(const_cast<QTableWidgetItem*>(item));
Q_ASSERT(index.isValid());
return visualRect(index);
}
@@ -2435,7 +2435,7 @@ void QTableWidget::scrollToItem(const QTableWidgetItem *item, QAbstractItemView:
Q_D(QTableWidget);
if (!item)
return;
- QModelIndex index = d->model()->index(const_cast<QTableWidgetItem*>(item));
+ QModelIndex index = d->tableModel()->index(const_cast<QTableWidgetItem*>(item));
Q_ASSERT(index.isValid());
QTableView::scrollTo(index, hint);
}
@@ -2448,7 +2448,7 @@ void QTableWidget::scrollToItem(const QTableWidgetItem *item, QAbstractItemView:
const QTableWidgetItem *QTableWidget::itemPrototype() const
{
Q_D(const QTableWidget);
- return d->model()->itemPrototype();
+ return d->tableModel()->itemPrototype();
}
/*!
@@ -2467,7 +2467,7 @@ const QTableWidgetItem *QTableWidget::itemPrototype() const
void QTableWidget::setItemPrototype(const QTableWidgetItem *item)
{
Q_D(QTableWidget);
- d->model()->setItemPrototype(item);
+ d->tableModel()->setItemPrototype(item);
}
/*!
@@ -2476,7 +2476,7 @@ void QTableWidget::setItemPrototype(const QTableWidgetItem *item)
void QTableWidget::insertRow(int row)
{
Q_D(QTableWidget);
- d->model()->insertRows(row);
+ d->tableModel()->insertRows(row);
}
/*!
@@ -2485,7 +2485,7 @@ void QTableWidget::insertRow(int row)
void QTableWidget::insertColumn(int column)
{
Q_D(QTableWidget);
- d->model()->insertColumns(column);
+ d->tableModel()->insertColumns(column);
}
/*!
@@ -2494,7 +2494,7 @@ void QTableWidget::insertColumn(int column)
void QTableWidget::removeRow(int row)
{
Q_D(QTableWidget);
- d->model()->removeRows(row);
+ d->tableModel()->removeRows(row);
}
/*!
@@ -2503,7 +2503,7 @@ void QTableWidget::removeRow(int row)
void QTableWidget::removeColumn(int column)
{
Q_D(QTableWidget);
- d->model()->removeColumns(column);
+ d->tableModel()->removeColumns(column);
}
/*!
@@ -2516,7 +2516,7 @@ void QTableWidget::clear()
{
Q_D(QTableWidget);
selectionModel()->clear();
- d->model()->clear();
+ d->tableModel()->clear();
}
/*!
@@ -2530,7 +2530,7 @@ void QTableWidget::clearContents()
{
Q_D(QTableWidget);
selectionModel()->clear();
- d->model()->clearContents();
+ d->tableModel()->clearContents();
}
/*!
@@ -2541,7 +2541,7 @@ void QTableWidget::clearContents()
*/
QStringList QTableWidget::mimeTypes() const
{
- return d_func()->model()->QAbstractTableModel::mimeTypes();
+ return d_func()->tableModel()->QAbstractTableModel::mimeTypes();
}
/*!
@@ -2554,7 +2554,7 @@ QStringList QTableWidget::mimeTypes() const
*/
QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*>) const
{
- return d_func()->model()->internalMimeData();
+ return d_func()->tableModel()->internalMimeData();
}
/*!
@@ -2576,7 +2576,7 @@ bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::
column = -1;
}
#endif
- return d_func()->model()->QAbstractTableModel::dropMimeData(data, action , row, column, idx);
+ return d_func()->tableModel()->QAbstractTableModel::dropMimeData(data, action , row, column, idx);
}
/*!
@@ -2586,7 +2586,7 @@ bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::
*/
Qt::DropActions QTableWidget::supportedDropActions() const
{
- return d_func()->model()->QAbstractTableModel::supportedDropActions() | Qt::MoveAction;
+ return d_func()->tableModel()->QAbstractTableModel::supportedDropActions() | Qt::MoveAction;
}
/*!
@@ -2610,7 +2610,7 @@ QList<QTableWidgetItem*> QTableWidget::items(const QMimeData *data) const
QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- return d->model()->index(item);
+ return d->tableModel()->index(item);
}
/*!
@@ -2620,7 +2620,7 @@ QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
QTableWidgetItem *QTableWidget::itemFromIndex(const QModelIndex &index) const
{
Q_D(const QTableWidget);
- return d->model()->item(index);
+ return d->tableModel()->item(index);
}
/*!
diff --git a/src/gui/itemviews/qtablewidget_p.h b/src/gui/itemviews/qtablewidget_p.h
index d8bfcc5..2acaf9b 100644
--- a/src/gui/itemviews/qtablewidget_p.h
+++ b/src/gui/itemviews/qtablewidget_p.h
@@ -189,7 +189,7 @@ class QTableWidgetPrivate : public QTableViewPrivate
Q_DECLARE_PUBLIC(QTableWidget)
public:
QTableWidgetPrivate() : QTableViewPrivate() {}
- inline QTableModel *model() const { return qobject_cast<QTableModel*>(q_func()->model()); }
+ inline QTableModel *tableModel() const { return qobject_cast<QTableModel*>(model); }
void setup();
// view signals
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 9910118..ecbd683 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -1319,7 +1319,7 @@ bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos)
expand(i, true);
if (!isAnimating()) {
q->updateGeometries();
- q->viewport()->update();
+ viewport->update();
}
return true;
}
@@ -3201,19 +3201,18 @@ int QTreeViewPrivate::itemHeight(int item) const
*/
int QTreeViewPrivate::coordinateForItem(int item) const
{
- Q_Q(const QTreeView);
if (verticalScrollMode == QAbstractItemView::ScrollPerPixel) {
if (uniformRowHeights)
- return (item * defaultItemHeight) - q->verticalScrollBar()->value();
+ return (item * defaultItemHeight) - vbar->value();
// ### optimize (spans or caching)
int y = 0;
for (int i = 0; i < viewItems.count(); ++i) {
if (i == item)
- return y - q->verticalScrollBar()->value();
+ return y - vbar->value();
y += itemHeight(i);
}
} else { // ScrollPerItem
- int topViewItemIndex = q->verticalScrollBar()->value();
+ int topViewItemIndex = vbar->value();
if (uniformRowHeights)
return defaultItemHeight * (item - topViewItemIndex);
if (item >= topViewItemIndex) {
@@ -3253,7 +3252,6 @@ int QTreeViewPrivate::coordinateForItem(int item) const
*/
int QTreeViewPrivate::itemAtCoordinate(int coordinate) const
{
- Q_Q(const QTreeView);
const int itemCount = viewItems.count();
if (itemCount == 0)
return -1;
@@ -3261,19 +3259,19 @@ int QTreeViewPrivate::itemAtCoordinate(int coordinate) const
return -1;
if (verticalScrollMode == QAbstractItemView::ScrollPerPixel) {
if (uniformRowHeights) {
- const int viewItemIndex = (coordinate + q->verticalScrollBar()->value()) / defaultItemHeight;
+ const int viewItemIndex = (coordinate + vbar->value()) / defaultItemHeight;
return ((viewItemIndex >= itemCount || viewItemIndex < 0) ? -1 : viewItemIndex);
}
// ### optimize
int viewItemCoordinate = 0;
- const int contentsCoordinate = coordinate + q->verticalScrollBar()->value();
+ const int contentsCoordinate = coordinate + vbar->value();
for (int viewItemIndex = 0; viewItemIndex < viewItems.count(); ++viewItemIndex) {
viewItemCoordinate += itemHeight(viewItemIndex);
if (viewItemCoordinate >= contentsCoordinate)
return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
}
} else { // ScrollPerItem
- int topViewItemIndex = q->verticalScrollBar()->value();
+ int topViewItemIndex = vbar->value();
if (uniformRowHeights) {
if (coordinate < 0)
coordinate -= defaultItemHeight - 1;
@@ -3365,8 +3363,7 @@ QModelIndex QTreeViewPrivate::modelIndex(int i, int column) const
int QTreeViewPrivate::firstVisibleItem(int *offset) const
{
- Q_Q(const QTreeView);
- const int value = q->verticalScrollBar()->value();
+ const int value = vbar->value();
if (verticalScrollMode == QAbstractItemView::ScrollPerItem) {
if (offset)
*offset = 0;
@@ -3443,9 +3440,9 @@ void QTreeViewPrivate::updateScrollBars()
if (verticalScrollMode == QAbstractItemView::ScrollPerItem) {
if (!viewItems.isEmpty())
itemsInViewport = qMax(1, itemsInViewport);
- q->verticalScrollBar()->setRange(0, viewItems.count() - itemsInViewport);
- q->verticalScrollBar()->setPageStep(itemsInViewport);
- q->verticalScrollBar()->setSingleStep(1);
+ vbar->setRange(0, viewItems.count() - itemsInViewport);
+ vbar->setPageStep(itemsInViewport);
+ vbar->setSingleStep(1);
} else { // scroll per pixel
int contentsHeight = 0;
if (uniformRowHeights) {
@@ -3454,9 +3451,9 @@ void QTreeViewPrivate::updateScrollBars()
for (int i = 0; i < viewItems.count(); ++i)
contentsHeight += itemHeight(i);
}
- q->verticalScrollBar()->setRange(0, contentsHeight - viewportSize.height());
- q->verticalScrollBar()->setPageStep(viewportSize.height());
- q->verticalScrollBar()->setSingleStep(qMax(viewportSize.height() / (itemsInViewport + 1), 2));
+ vbar->setRange(0, contentsHeight - viewportSize.height());
+ vbar->setPageStep(viewportSize.height());
+ vbar->setSingleStep(qMax(viewportSize.height() / (itemsInViewport + 1), 2));
}
const int columnCount = header->count();
@@ -3472,23 +3469,23 @@ void QTreeViewPrivate::updateScrollBars()
if (columnCount > 0)
columnsInViewport = qMax(1, columnsInViewport);
if (horizontalScrollMode == QAbstractItemView::ScrollPerItem) {
- q->horizontalScrollBar()->setRange(0, columnCount - columnsInViewport);
- q->horizontalScrollBar()->setPageStep(columnsInViewport);
- q->horizontalScrollBar()->setSingleStep(1);
+ hbar->setRange(0, columnCount - columnsInViewport);
+ hbar->setPageStep(columnsInViewport);
+ hbar->setSingleStep(1);
} else { // scroll per pixel
const int horizontalLength = header->length();
const QSize maxSize = q->maximumViewportSize();
- if (maxSize.width() >= horizontalLength && q->verticalScrollBar()->maximum() <= 0)
+ if (maxSize.width() >= horizontalLength && vbar->maximum() <= 0)
viewportSize = maxSize;
- q->horizontalScrollBar()->setPageStep(viewportSize.width());
- q->horizontalScrollBar()->setRange(0, qMax(horizontalLength - viewportSize.width(), 0));
- q->horizontalScrollBar()->setSingleStep(qMax(viewportSize.width() / (columnsInViewport + 1), 2));
+ hbar->setPageStep(viewportSize.width());
+ hbar->setRange(0, qMax(horizontalLength - viewportSize.width(), 0));
+ hbar->setSingleStep(qMax(viewportSize.width() / (columnsInViewport + 1), 2));
}
}
int QTreeViewPrivate::itemDecorationAt(const QPoint &pos) const
{
- const_cast<QTreeView *>(q_func())->executeDelayedItemsLayout();
+ executePostedLayout();
int x = pos.x();
int column = header->logicalIndexAt(x);
if (column != 0)
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 5604f8d..2a6ac30 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2280,11 +2280,10 @@ void QTreeWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
void QTreeWidgetPrivate::_q_sort()
{
- Q_Q(QTreeWidget);
if (sortingEnabled) {
- int column = q->header()->sortIndicatorSection();
- Qt::SortOrder order = q->header()->sortIndicatorOrder();
- model()->sort(column, order);
+ int column = header->sortIndicatorSection();
+ Qt::SortOrder order = header->sortIndicatorOrder();
+ treeModel()->sort(column, order);
}
}
@@ -2293,7 +2292,7 @@ void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, con
Q_Q(QTreeWidget);
QModelIndexList indices = selected.indexes();
int i;
- QTreeModel *m = model();
+ QTreeModel *m = treeModel();
for (i = 0; i < indices.count(); ++i) {
QTreeWidgetItem *item = m->item(indices.at(i));
item->d->selected = true;
@@ -2311,13 +2310,12 @@ void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, con
void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight)
{
- Q_Q(QTreeWidget);
if (sortingEnabled && topLeft.isValid() && bottomRight.isValid()
- && !model()->sortPendingTimer.isActive()) {
- int column = q->header()->sortIndicatorSection();
+ && !treeModel()->sortPendingTimer.isActive()) {
+ int column = header->sortIndicatorSection();
if (column >= topLeft.column() && column <= bottomRight.column()) {
- Qt::SortOrder order = q->header()->sortIndicatorOrder();
- model()->ensureSorted(column, order, topLeft.row(),
+ Qt::SortOrder order = header->sortIndicatorOrder();
+ treeModel()->ensureSorted(column, order, topLeft.row(),
bottomRight.row(), topLeft.parent());
}
}
@@ -2545,7 +2543,7 @@ QTreeWidget::~QTreeWidget()
int QTreeWidget::columnCount() const
{
Q_D(const QTreeWidget);
- return d->model()->columnCount();
+ return d->model->columnCount();
}
/*
@@ -2557,7 +2555,7 @@ void QTreeWidget::setColumnCount(int columns)
Q_D(QTreeWidget);
if (columns < 0)
return;
- d->model()->setColumnCount(columns);
+ d->treeModel()->setColumnCount(columns);
}
/*!
@@ -2574,7 +2572,7 @@ void QTreeWidget::setColumnCount(int columns)
QTreeWidgetItem *QTreeWidget::invisibleRootItem() const
{
Q_D(const QTreeWidget);
- return d->model()->rootItem;
+ return d->treeModel()->rootItem;
}
/*!
@@ -2587,7 +2585,7 @@ QTreeWidgetItem *QTreeWidget::invisibleRootItem() const
QTreeWidgetItem *QTreeWidget::topLevelItem(int index) const
{
Q_D(const QTreeWidget);
- return d->model()->rootItem->child(index);
+ return d->treeModel()->rootItem->child(index);
}
/*!
@@ -2602,7 +2600,7 @@ QTreeWidgetItem *QTreeWidget::topLevelItem(int index) const
int QTreeWidget::topLevelItemCount() const
{
Q_D(const QTreeWidget);
- return d->model()->rootItem->childCount();
+ return d->treeModel()->rootItem->childCount();
}
/*!
@@ -2616,7 +2614,7 @@ int QTreeWidget::topLevelItemCount() const
void QTreeWidget::insertTopLevelItem(int index, QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- d->model()->rootItem->insertChild(index, item);
+ d->treeModel()->rootItem->insertChild(index, item);
}
/*!
@@ -2641,7 +2639,7 @@ void QTreeWidget::addTopLevelItem(QTreeWidgetItem *item)
QTreeWidgetItem *QTreeWidget::takeTopLevelItem(int index)
{
Q_D(QTreeWidget);
- return d->model()->rootItem->takeChild(index);
+ return d->treeModel()->rootItem->takeChild(index);
}
/*!
@@ -2650,8 +2648,8 @@ QTreeWidgetItem *QTreeWidget::takeTopLevelItem(int index)
int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- d->model()->executePendingSort();
- return d->model()->rootItem->children.indexOf(item);
+ d->treeModel()->executePendingSort();
+ return d->treeModel()->rootItem->children.indexOf(item);
}
/*!
@@ -2663,8 +2661,8 @@ int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item)
int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- d->model()->executePendingSort();
- return d->model()->rootItem->children.indexOf(item);
+ d->treeModel()->executePendingSort();
+ return d->treeModel()->rootItem->children.indexOf(item);
}
/*!
@@ -2679,7 +2677,7 @@ int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item) const
void QTreeWidget::insertTopLevelItems(int index, const QList<QTreeWidgetItem*> &items)
{
Q_D(QTreeWidget);
- d->model()->rootItem->insertChildren(index, items);
+ d->treeModel()->rootItem->insertChildren(index, items);
}
/*!
@@ -2701,7 +2699,7 @@ void QTreeWidget::addTopLevelItems(const QList<QTreeWidgetItem*> &items)
QTreeWidgetItem *QTreeWidget::headerItem() const
{
Q_D(const QTreeWidget);
- return d->model()->headerItem;
+ return d->treeModel()->headerItem;
}
/*!
@@ -2722,16 +2720,16 @@ void QTreeWidget::setHeaderItem(QTreeWidgetItem *item)
int oldCount = columnCount();
if (oldCount < item->columnCount())
- d->model()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
+ d->treeModel()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
else
- d->model()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
- delete d->model()->headerItem;
- d->model()->headerItem = item;
+ d->treeModel()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
+ delete d->treeModel()->headerItem;
+ d->treeModel()->headerItem = item;
if (oldCount < item->columnCount())
- d->model()->endInsertColumns();
+ d->treeModel()->endInsertColumns();
else
- d->model()->endRemoveColumns();
- d->model()->headerDataChanged(Qt::Horizontal, 0, oldCount);
+ d->treeModel()->endRemoveColumns();
+ d->treeModel()->headerDataChanged(Qt::Horizontal, 0, oldCount);
}
@@ -2748,8 +2746,7 @@ void QTreeWidget::setHeaderLabels(const QStringList &labels)
Q_D(QTreeWidget);
if (columnCount() < labels.count())
setColumnCount(labels.count());
- QTreeModel *model = d->model();
- QTreeWidgetItem *item = model->headerItem;
+ QTreeWidgetItem *item = d->treeModel()->headerItem;
for (int i = 0; i < labels.count(); ++i)
item->setText(i, labels.at(i));
}
@@ -2877,7 +2874,7 @@ void QTreeWidget::sortItems(int column, Qt::SortOrder order)
{
Q_D(QTreeWidget);
header()->setSortIndicator(column, order);
- d->model()->sort(column, order);
+ d->model->sort(column, order);
}
/*!
@@ -3044,7 +3041,7 @@ QList<QTreeWidgetItem*> QTreeWidget::selectedItems() const
QList<QTreeWidgetItem*> QTreeWidget::findItems(const QString &text, Qt::MatchFlags flags, int column) const
{
Q_D(const QTreeWidget);
- QModelIndexList indexes = d->model()->match(model()->index(0, column, QModelIndex()),
+ QModelIndexList indexes = d->model->match(model()->index(0, column, QModelIndex()),
Qt::DisplayRole, text, -1, flags);
QList<QTreeWidgetItem*> items;
for (int i = 0; i < indexes.size(); ++i)
@@ -3062,11 +3059,11 @@ QList<QTreeWidgetItem*> QTreeWidget::findItems(const QString &text, Qt::MatchFla
bool QTreeWidget::isItemHidden(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return header()->isHidden();
if (d->hiddenIndexes.isEmpty())
return false;
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
return d->isRowHidden(d->index(item));
}
@@ -3082,7 +3079,7 @@ bool QTreeWidget::isItemHidden(const QTreeWidgetItem *item) const
void QTreeWidget::setItemHidden(const QTreeWidgetItem *item, bool hide)
{
Q_D(QTreeWidget);
- if (item == d->model()->headerItem) {
+ if (item == d->treeModel()->headerItem) {
header()->setHidden(hide);
} else {
const QModelIndex index = d->index(item);
@@ -3102,7 +3099,7 @@ void QTreeWidget::setItemHidden(const QTreeWidgetItem *item, bool hide)
bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
return isExpanded(d->index(item));
}
@@ -3119,7 +3116,7 @@ bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const
void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand)
{
Q_D(QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
setExpanded(d->index(item), expand);
}
@@ -3134,7 +3131,7 @@ void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand)
bool QTreeWidget::isFirstItemColumnSpanned(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return false; // We can't set the header items to spanning
const QModelIndex index = d->index(item);
return isFirstColumnSpanned(index.row(), index.parent());
@@ -3151,7 +3148,7 @@ bool QTreeWidget::isFirstItemColumnSpanned(const QTreeWidgetItem *item) const
void QTreeWidget::setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool span)
{
Q_D(QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return; // We can't set header items to spanning
const QModelIndex index = d->index(item);
setFirstColumnSpanned(index.row(), index.parent(), span);
@@ -3165,7 +3162,7 @@ void QTreeWidget::setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool sp
QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return 0;
const QModelIndex index = d->index(item);
const QModelIndex above = indexAbove(index);
@@ -3180,7 +3177,7 @@ QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const
QTreeWidgetItem *QTreeWidget::itemBelow(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return 0;
const QModelIndex index = d->index(item);
const QModelIndex below = indexBelow(index);
@@ -3220,7 +3217,7 @@ void QTreeWidget::scrollToItem(const QTreeWidgetItem *item, QAbstractItemView::S
void QTreeWidget::expandItem(const QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
expand(d->index(item));
}
@@ -3233,7 +3230,7 @@ void QTreeWidget::expandItem(const QTreeWidgetItem *item)
void QTreeWidget::collapseItem(const QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
collapse(d->index(item));
}
@@ -3250,7 +3247,7 @@ void QTreeWidget::clear()
{
Q_D(QTreeWidget);
selectionModel()->clear();
- d->model()->clear();
+ d->treeModel()->clear();
}
/*!
@@ -3275,7 +3272,7 @@ QStringList QTreeWidget::mimeTypes() const
QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
{
Q_D(const QTreeWidget);
- if (d->model()->cachedIndexes.isEmpty()) {
+ if (d->treeModel()->cachedIndexes.isEmpty()) {
QList<QModelIndex> indexes;
for (int i = 0; i < items.count(); ++i) {
QTreeWidgetItem *item = items.at(i);
@@ -3283,9 +3280,9 @@ QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
indexes << indexFromItem(item, c);
}
}
- return model()->QAbstractItemModel::mimeData(indexes);
+ return d->model->QAbstractItemModel::mimeData(indexes);
}
- return d->model()->internalMimeData();
+ return d->treeModel()->internalMimeData();
}
/*!
@@ -3429,7 +3426,7 @@ bool QTreeWidget::event(QEvent *e)
{
Q_D(QTreeWidget);
if (e->type() == QEvent::Polish)
- d->model()->executePendingSort();
+ d->treeModel()->executePendingSort();
return QTreeView::event(e);
}
diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/gui/itemviews/qtreewidget_p.h
index a089cf5..fb0ee11 100644
--- a/src/gui/itemviews/qtreewidget_p.h
+++ b/src/gui/itemviews/qtreewidget_p.h
@@ -219,12 +219,11 @@ class QTreeWidgetPrivate : public QTreeViewPrivate
Q_DECLARE_PUBLIC(QTreeWidget)
public:
QTreeWidgetPrivate() : QTreeViewPrivate(), explicitSortColumn(-1) {}
- inline QTreeModel *model() const
- { return qobject_cast<QTreeModel*>(q_func()->model()); }
+ inline QTreeModel *treeModel() const { return qobject_cast<QTreeModel*>(model); }
inline QModelIndex index(const QTreeWidgetItem *item, int column = 0) const
- { return model()->index(item, column); }
+ { return treeModel()->index(item, column); }
inline QTreeWidgetItem *item(const QModelIndex &index) const
- { return model()->item(index); }
+ { return treeModel()->item(index); }
void _q_emitItemPressed(const QModelIndex &index);
void _q_emitItemClicked(const QModelIndex &index);
void _q_emitItemDoubleClicked(const QModelIndex &index);
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 4923d23..cbb1f45 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -491,8 +491,6 @@ QWidgetList * qt_modal_stack=0; // stack of modal widgets
*/
void QApplicationPrivate::process_cmdline()
{
- Q_Q(QApplication);
- Q_UNUSED(q);// only static members being used.
// process platform-indep command line
if (!qt_is_gui_used || !argc)
return;
@@ -537,7 +535,7 @@ void QApplicationPrivate::process_cmdline()
#endif
} else if (qstrcmp(arg, "-reverse") == 0) {
force_reverse = true;
- q->setLayoutDirection(Qt::RightToLeft);
+ QApplication::setLayoutDirection(Qt::RightToLeft);
} else if (qstrcmp(arg, "-widgetcount") == 0) {
widgetCount = true;
} else if (arg == "-graphicssystem" && i < argc-1) {
@@ -2577,14 +2575,14 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
QEvent leaveEvent(QEvent::Leave);
for (int i = 0; i < leaveList.size(); ++i) {
w = leaveList.at(i);
- if (!qApp->activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
+ if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
#if defined(Q_WS_WIN) || defined(Q_WS_X11)
if (leaveAfterRelease == w)
leaveAfterRelease = 0;
#endif
QApplication::sendEvent(w, &leaveEvent);
if (w->testAttribute(Qt::WA_Hover) &&
- (!qApp->activePopupWidget() || qApp->activePopupWidget() == w->window())) {
+ (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
Q_ASSERT(instance());
QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos));
qApp->d_func()->notify_helper(w, &he);
@@ -2595,10 +2593,10 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
QEvent enterEvent(QEvent::Enter);
for (int i = 0; i < enterList.size(); ++i) {
w = enterList.at(i);
- if (!qApp->activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
+ if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
QApplication::sendEvent(w, &enterEvent);
if (w->testAttribute(Qt::WA_Hover) &&
- (!qApp->activePopupWidget() || qApp->activePopupWidget() == w->window())) {
+ (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
QHoverEvent he(QEvent::HoverEnter, w->mapFromGlobal(posEnter), QPoint(-1, -1));
qApp->d_func()->notify_helper(w, &he);
}
@@ -2672,7 +2670,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
widget = widget->window();
if (!modalState())
return false;
- if (qApp->activePopupWidget() == widget)
+ if (QApplication::activePopupWidget() == widget)
return false;
for (int i = 0; i < qt_modal_stack->size(); ++i) {
@@ -2761,7 +2759,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
void QApplicationPrivate::enterModal(QWidget *widget)
{
QSet<QWidget*> blocked;
- QList<QWidget*> windows = qApp->topLevelWidgets();
+ QList<QWidget*> windows = QApplication::topLevelWidgets();
for (int i = 0; i < windows.count(); ++i) {
QWidget *window = windows.at(i);
if (window->windowType() != Qt::Tool && isBlockedByModal(window))
@@ -2770,7 +2768,7 @@ void QApplicationPrivate::enterModal(QWidget *widget)
enterModal_sys(widget);
- windows = qApp->topLevelWidgets();
+ windows = QApplication::topLevelWidgets();
QEvent e(QEvent::WindowBlocked);
for (int i = 0; i < windows.count(); ++i) {
QWidget *window = windows.at(i);
@@ -2784,7 +2782,7 @@ void QApplicationPrivate::enterModal(QWidget *widget)
void QApplicationPrivate::leaveModal(QWidget *widget)
{
QSet<QWidget*> blocked;
- QList<QWidget*> windows = qApp->topLevelWidgets();
+ QList<QWidget*> windows = QApplication::topLevelWidgets();
for (int i = 0; i < windows.count(); ++i) {
QWidget *window = windows.at(i);
if (window->windowType() != Qt::Tool && isBlockedByModal(window))
@@ -2793,7 +2791,7 @@ void QApplicationPrivate::leaveModal(QWidget *widget)
leaveModal_sys(widget);
- windows = qApp->topLevelWidgets();
+ windows = QApplication::topLevelWidgets();
QEvent e(QEvent::WindowUnblocked);
for (int i = 0; i < windows.count(); ++i) {
QWidget *window = windows.at(i);
@@ -2816,7 +2814,7 @@ bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop)
*rettop = top;
// the active popup widget always gets the input event
- if (qApp->activePopupWidget())
+ if (QApplication::activePopupWidget())
return true;
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
@@ -2882,7 +2880,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
QPointer<QWidget> receiverGuard = receiver;
QPointer<QWidget> nativeGuard = nativeWidget;
QPointer<QWidget> alienGuard = alienWidget;
- QPointer<QWidget> activePopupWidget = qApp->activePopupWidget();
+ QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();
const bool graphicsWidget = nativeWidget->testAttribute(Qt::WA_DontShowOnScreen);
@@ -3779,7 +3777,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QPoint diff = relpos - w->mapFromGlobal(d->hoverGlobalPos);
while (w) {
if (w->testAttribute(Qt::WA_Hover) &&
- (!qApp->activePopupWidget() || qApp->activePopupWidget() == w->window())) {
+ (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
QHoverEvent he(QEvent::HoverMove, relpos, relpos - diff);
d->notify_helper(w, &he);
}
@@ -4038,7 +4036,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
#if !defined(Q_WS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
// toggle HasMouse widget state on enter and leave
if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) &&
- (!qApp->activePopupWidget() || qApp->activePopupWidget() == widget->window()))
+ (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window()))
widget->setAttribute(Qt::WA_UnderMouse, true);
else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave)
widget->setAttribute(Qt::WA_UnderMouse, false);
@@ -4568,9 +4566,9 @@ void QSessionManager::requestPhase2()
\oldcode
app.setWinStyleHighlightColor(color);
\newcode
- QPalette palette(qApp->palette());
+ QPalette palette(QApplication::palette());
palette.setColor(QPalette::Highlight, color);
- qApp->setPalette(palette);
+ QApplication::setPalette(palette);
\endcode
*/
@@ -4589,7 +4587,7 @@ void QSessionManager::requestPhase2()
/*!
\fn const QColor &QApplication::winStyleHighlightColor()
- Use qApp->palette().color(QPalette::Active, QPalette::Highlight) instead.
+ Use QApplication::palette().color(QPalette::Active, QPalette::Highlight) instead.
*/
/*!
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index b21eb36..f449141 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1526,13 +1526,13 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
int index = QApplication::staticMetaObject.indexOfSignal("aboutToQuit()");
qApp->qt_metacall(QMetaObject::InvokeMetaMethod, index,0);
// since the process will be killed immediately quit() has no real effect
- qApp->quit();
+ QApplication::quit();
}
RETURN(0);
}
case WM_DISPLAYCHANGE:
- if (qApp->type() == QApplication::Tty)
+ if (QApplication::type() == QApplication::Tty)
break;
if (qt_desktopWidget) {
qt_desktopWidget->move(GetSystemMetrics(76), GetSystemMetrics(77));
@@ -1558,7 +1558,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
#endif
// ignore spurious XP message when user logs in again after locking
- if (qApp->type() == QApplication::Tty)
+ if (QApplication::type() == QApplication::Tty)
break;
if (QApplication::desktopSettingsAware() && wParam != SPI_SETWORKAREA) {
widget = (QETWidget*)QWidget::find(hwnd);
@@ -1581,7 +1581,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
if (wParam == SPI_SETFONTSMOOTHINGTYPE) {
qt_win_read_cleartype_settings();
- foreach (QWidget *w, qApp->topLevelWidgets()) {
+ foreach (QWidget *w, QApplication::topLevelWidgets()) {
if (!w->isVisible())
continue;
((QETWidget *) w)->forceUpdate();
@@ -1590,7 +1590,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
case WM_SYSCOLORCHANGE:
- if (qApp->type() == QApplication::Tty)
+ if (QApplication::type() == QApplication::Tty)
break;
if (QApplication::desktopSettingsAware()) {
widget = (QETWidget*)QWidget::find(hwnd);
@@ -1642,7 +1642,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
RETURN(res);
if (qt_is_translatable_mouse_event(message)) {
- if (qApp->activePopupWidget() != 0) { // in popup mode
+ if (QApplication::activePopupWidget() != 0) { // in popup mode
POINT curPos = msg.pt;
QWidget* w = QApplication::widgetAt(curPos.x, curPos.y);
if (w)
@@ -1652,9 +1652,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
if (!qt_tabletChokeMouse) {
result = widget->translateMouseEvent(msg); // mouse event
#if defined(Q_WS_WINCE) && !defined(QT_NO_CONTEXTMENU)
- if (message == WM_LBUTTONDOWN && widget != qApp->activePopupWidget()) {
+ if (message == WM_LBUTTONDOWN && widget != QApplication::activePopupWidget()) {
QWidget* alienWidget = widget;
- if ((alienWidget != qApp->activePopupWidget()) && (alienWidget->contextMenuPolicy() != Qt::PreventContextMenu)) {
+ if ((alienWidget != QApplication::activePopupWidget()) && (alienWidget->contextMenuPolicy() != Qt::PreventContextMenu)) {
QPoint pos(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
QPoint globalPos(msg.pt.x, msg.pt.y);
// In case we are using Alien, then the widget to
@@ -1673,8 +1673,8 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;
resolveAygLibs();
if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) {
- if (qApp->activePopupWidget())
- qApp->activePopupWidget()->close();
+ if (QApplication::activePopupWidget())
+ QApplication::activePopupWidget()->close();
QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos);
result = qt_sendSpontaneousEvent(alienWidget, &e);
}
@@ -1752,7 +1752,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
widget = (QETWidget*)QApplication::activePopupWidget()->focusWidget()
? (QETWidget*)QApplication::activePopupWidget()->focusWidget()
: (QETWidget*)QApplication::activePopupWidget();
- else if (qApp->focusWidget())
+ else if (QApplication::focusWidget())
widget = (QETWidget*)QApplication::focusWidget();
else if (!widget || widget->internalWinId() == GetFocus()) // We faked the message to go to exactly that widget.
widget = (QETWidget*)widget->window();
@@ -1875,8 +1875,8 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
QWidget *g = QWidget::keyboardGrabber();
if (g)
widget = (QETWidget*)g;
- else if (qApp->focusWidget())
- widget = (QETWidget*)qApp->focusWidget();
+ else if (QApplication::focusWidget())
+ widget = (QETWidget*)QApplication::focusWidget();
else
widget = (QETWidget*)widget->window();
if (widget->isEnabled()) {
@@ -1991,7 +1991,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
case WM_SETTINGCHANGE:
- if ( qApp->type() == QApplication::Tty )
+ if ( QApplication::type() == QApplication::Tty )
break;
if (!msg.wParam) {
@@ -2004,7 +2004,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
}
else if (msg.wParam == SPI_SETICONTITLELOGFONT) {
- if (qApp->desktopSettingsAware()) {
+ if (QApplication::desktopSettingsAware()) {
widget = (QETWidget*)QWidget::find(hwnd);
if (widget && !widget->parentWidget()) {
qt_set_windows_font_resources();
@@ -2047,7 +2047,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
case WM_ACTIVATE:
- if ( qApp->type() == QApplication::Tty )
+ if ( QApplication::type() == QApplication::Tty )
break;
if (ptrWTOverlap && ptrWTEnable) {
@@ -2276,12 +2276,12 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
QWidget *fw = QWidget::keyboardGrabber();
if (!fw) {
- if (qApp->activePopupWidget())
- fw = (qApp->activePopupWidget()->focusWidget()
- ? qApp->activePopupWidget()->focusWidget()
- : qApp->activePopupWidget());
- else if (qApp->focusWidget())
- fw = qApp->focusWidget();
+ if (QApplication::activePopupWidget())
+ fw = (QApplication::activePopupWidget()->focusWidget()
+ ? QApplication::activePopupWidget()->focusWidget()
+ : QApplication::activePopupWidget());
+ else if (QApplication::focusWidget())
+ fw = QApplication::focusWidget();
else if (widget)
fw = widget->window();
}
@@ -2298,7 +2298,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case WM_IME_STARTCOMPOSITION:
case WM_IME_ENDCOMPOSITION:
case WM_IME_COMPOSITION: {
- QWidget *fw = qApp->focusWidget();
+ QWidget *fw = QApplication::focusWidget();
QWinInputContext *im = fw ? qobject_cast<QWinInputContext *>(fw->inputContext()) : 0;
if (fw && im) {
if(message == WM_IME_STARTCOMPOSITION)
@@ -2331,7 +2331,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case WM_GETOBJECT:
{
// Ignoring all requests while starting up
- if (qApp->startingUp() || qApp->closingDown() || (DWORD)lParam != OBJID_CLIENT) {
+ if (QApplication::startingUp() || QApplication::closingDown() || (DWORD)lParam != OBJID_CLIENT) {
result = false;
break;
}
@@ -2431,7 +2431,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case WM_KILLFOCUS:
if (!QWidget::find((HWND)wParam)) { // we don't get focus, so unset it now
if (!widget->hasFocus()) // work around Windows bug after minimizing/restoring
- widget = (QETWidget*)qApp->focusWidget();
+ widget = (QETWidget*)QApplication::focusWidget();
HWND focus = ::GetFocus();
//if there is a current widget and the new widget belongs to the same toplevel window
//or if the current widget was embedded into non-qt window (i.e. we won't get WM_ACTIVATEAPP)
@@ -2450,16 +2450,16 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
break;
case WM_THEMECHANGED:
- if ((widget->windowType() == Qt::Desktop) || !qApp || qApp->closingDown()
- || qApp->type() == QApplication::Tty)
+ if ((widget->windowType() == Qt::Desktop) || !qApp || QApplication::closingDown()
+ || QApplication::type() == QApplication::Tty)
break;
if (widget->testAttribute(Qt::WA_WState_Polished))
- qApp->style()->unpolish(widget);
+ QApplication::style()->unpolish(widget);
if (widget->testAttribute(Qt::WA_WState_Polished))
- qApp->style()->polish(widget);
- widget->repolishStyle(*qApp->style());
+ QApplication::style()->polish(widget);
+ widget->repolishStyle(*QApplication::style());
if (widget->isVisible())
widget->update();
break;
@@ -2748,9 +2748,9 @@ void QApplicationPrivate::openPopup(QWidget *popup)
if (popup->focusWidget()) {
popup->focusWidget()->setFocus(Qt::PopupFocusReason);
} else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup
- if (QWidget *fw = q_func()->focusWidget()) {
+ if (QWidget *fw = QApplication::focusWidget()) {
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
+ QApplication::sendEvent(fw, &e);
}
}
}
@@ -2777,13 +2777,13 @@ void QApplicationPrivate::closePopup(QWidget *popup)
if (!qt_nograb()) // grabbing not disabled
releaseAutoCapture();
QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget()
- : q_func()->focusWidget();
+ : QApplication::focusWidget();
if (fw) {
- if (fw != q_func()->focusWidget()) {
+ if (fw != QApplication::focusWidget()) {
fw->setFocus(Qt::PopupFocusReason);
} else {
QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
+ QApplication::sendEvent(fw, &e);
}
}
} else {
@@ -3047,7 +3047,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
HWND id = effectiveWinId();
QWidget *mouseGrabber = QWidget::mouseGrabber();
- QWidget *activePopupWidget = qApp->activePopupWidget();
+ QWidget *activePopupWidget = QApplication::activePopupWidget();
if (mouseGrabber) {
if (!activePopupWidget || (activePopupWidget == this && !rect().contains(widgetPos)))
id = mouseGrabber->effectiveWinId();
@@ -3140,7 +3140,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
return false;
replayPopupMouseEvent = false;
- QWidget* activePopupWidget = qApp->activePopupWidget();
+ QWidget* activePopupWidget = QApplication::activePopupWidget();
QWidget *target = activePopupWidget;
const QPoint globalPos(gpos.x, gpos.y);
@@ -3198,7 +3198,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
}
if (type == QEvent::MouseButtonPress
- && qApp->activePopupWidget() != activePopupWidget
+ && QApplication::activePopupWidget() != activePopupWidget
&& replayPopupMouseEvent) {
// the popup dissappeared. Replay the event
QWidget* w = QApplication::widgetAt(gpos.x, gpos.y);
@@ -3215,7 +3215,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
winPostMessage(hwndTarget, msg.message, msg.wParam, lParam);
}
} else if (type == QEvent::MouseButtonRelease && button == Qt::RightButton
- && qApp->activePopupWidget() == activePopupWidget) {
+ && QApplication::activePopupWidget() == activePopupWidget) {
// popup still alive and received right-button-release
#if !defined(QT_NO_CONTEXTMENU)
QContextMenuEvent e2(QContextMenuEvent::Mouse, pos, globalPos,
@@ -3325,7 +3325,7 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
// send the event to the widget or its ancestors
{
- QWidget* popup = qApp->activePopupWidget();
+ QWidget* popup = QApplication::activePopupWidget();
if (popup && w->window() != popup)
popup->close();
#ifndef QT_NO_WHEELEVENT
@@ -3341,8 +3341,8 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
}
// send the event to the widget that has the focus or its ancestors, if different
- if (w != qApp->focusWidget() && (w = qApp->focusWidget())) {
- QWidget* popup = qApp->activePopupWidget();
+ if (w != QApplication::focusWidget() && (w = QApplication::focusWidget())) {
+ QWidget* popup = QApplication::activePopupWidget();
if (popup && w->window() != popup)
popup->close();
#ifndef QT_NO_WHEELEVENT
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 598f4ba..4ffa8fd 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -403,7 +403,7 @@ void QCursorData::initialize()
QCursor::QCursor()
{
if (!QCursorData::initialized) {
- if (qApp->startingUp()) {
+ if (QApplication::startingUp()) {
d = 0;
return;
}
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index a5092a0..e83a2ae 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -368,7 +368,7 @@ QDragManager::~QDragManager()
QDragManager *QDragManager::self()
{
- if (!instance && qApp && !qApp->closingDown())
+ if (!instance && !QApplication::closingDown())
instance = new QDragManager;
return instance;
}
diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp
index 8bf5c84..b8c65e8 100644
--- a/src/gui/kernel/qdnd_win.cpp
+++ b/src/gui/kernel/qdnd_win.cpp
@@ -549,7 +549,7 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
return ResultFromScode(DRAGDROP_S_DROP);
}
#endif
- qApp->processEvents();
+ QApplication::processEvents();
return NOERROR;
}
}
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 3c2fcdd..735fe0f 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -628,13 +628,13 @@ QKeySequence::SequenceMatch QShortcutMap::matches(const QKeySequence &seq1,
bool QShortcutMap::correctContext(const QShortcutEntry &item) const {
Q_ASSERT_X(item.owner, "QShortcutMap", "Shortcut has no owner. Illegal map state!");
- QWidget *active_window = qApp->activeWindow();
+ QWidget *active_window = QApplication::activeWindow();
// popups do not become the active window,
// so we fake it here to get the correct context
// for the shortcut system.
- if (qApp->activePopupWidget())
- active_window = qApp->activePopupWidget();
+ if (QApplication::activePopupWidget())
+ active_window = QApplication::activePopupWidget();
if (!active_window)
return false;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 71c2f2b..d5fdd93 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1052,7 +1052,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
{
Q_Q(QWidget);
- if (qApp->type() == QApplication::Tty)
+ if (QApplication::type() == QApplication::Tty)
qFatal("QWidget: Cannot create a QWidget when no GUI is being used");
Q_ASSERT(uncreatedWidgets);
@@ -1067,7 +1067,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
q->data = &data;
#ifndef QT_NO_THREAD
- if (!q->parent()) {
+ if (!parent) {
Q_ASSERT_X(q->thread() == qApp->thread(), "QWidget",
"Widgets must be created in the GUI thread.");
}
@@ -1345,7 +1345,7 @@ QWidget::~QWidget()
#ifdef QT3_SUPPORT
if (QApplicationPrivate::main_widget == this) { // reset main widget
QApplicationPrivate::main_widget = 0;
- qApp->quit();
+ QApplication::quit();
}
#endif
@@ -2034,8 +2034,8 @@ void QWidgetPrivate::deactivateWidgetCleanup()
{
Q_Q(QWidget);
// If this was the active application window, reset it
- if (qApp->activeWindow() == q)
- qApp->setActiveWindow(0);
+ if (QApplication::activeWindow() == q)
+ QApplication::setActiveWindow(0);
// If the is the active mouse press widget, reset it
if (q == qt_button_down)
qt_button_down = 0;
@@ -2236,7 +2236,7 @@ QStyle *QWidget::style() const
if (d->extra && d->extra->style)
return d->extra->style;
- return qApp->style();
+ return QApplication::style();
}
/*!
@@ -4993,7 +4993,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
QPoint scrollAreaOffset;
#ifndef QT_NO_SCROLLAREA
- QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(q->parent());
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
if (scrollArea && scrollArea->viewport() == q) {
QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr;
QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
@@ -5372,7 +5372,7 @@ QIcon QWidget::windowIcon() const
return *d->extra->topextra->icon;
w = w->parentWidget();
}
- return qApp->windowIcon();
+ return QApplication::windowIcon();
}
void QWidgetPrivate::setWindowIcon_helper()
@@ -5894,7 +5894,7 @@ QWidget *QWidget::previousInFocusChain() const
bool QWidget::isActiveWindow() const
{
QWidget *tlw = window();
- if(tlw == qApp->activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup)))
+ if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup)))
return true;
#ifndef QT_NO_GRAPHICSVIEW
@@ -5915,7 +5915,7 @@ bool QWidget::isActiveWindow() const
!tlw->isModal() &&
(!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow()))
return true;
- QWidget *w = qApp->activeWindow();
+ QWidget *w = QApplication::activeWindow();
while(w && tlw->windowType() == Qt::Tool &&
!w->isModal() && w->parentWidget()) {
w = w->parentWidget()->window();
@@ -7085,7 +7085,7 @@ bool QWidgetPrivate::close_helper(CloseMode mode)
#ifdef QT3_SUPPORT
if (isMain)
- qApp->quit();
+ QApplication::quit();
#endif
// Attempt to close the application only if this widget has the
// WA_QuitOnClose flag set set and has a non-visible parent
@@ -7268,10 +7268,10 @@ QSize QWidgetPrivate::adjustedSize() const
if (q->isWindow()) {
Qt::Orientations exp;
- if (QLayout *l = q->layout()) {
- if (l->hasHeightForWidth())
- s.setHeight(l->totalHeightForWidth(s.width()));
- exp = l->expandingDirections();
+ if (layout) {
+ if (layout->hasHeightForWidth())
+ s.setHeight(layout->totalHeightForWidth(s.width()));
+ exp = layout->expandingDirections();
} else
{
if (q->sizePolicy().hasHeightForWidth())
@@ -7784,7 +7784,7 @@ bool QWidget::event(QEvent *event)
QList<QObject*> childList = d->children;
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
- if (o != qApp->activeModalWidget()) {
+ if (o != QApplication::activeModalWidget()) {
if (qobject_cast<QWidget *>(o) && static_cast<QWidget *>(o)->isWindow()) {
// do not forward the event to child windows,
// QApplication does this for us
@@ -8007,9 +8007,9 @@ void QWidget::mousePressEvent(QMouseEvent *event)
if ((windowType() == Qt::Popup)) {
event->accept();
QWidget* w;
- while ((w = qApp->activePopupWidget()) && w != this){
+ while ((w = QApplication::activePopupWidget()) && w != this){
w->close();
- if (qApp->activePopupWidget() == w) // widget does not want to dissappear
+ if (QApplication::activePopupWidget() == w) // widget does not want to dissappear
w->hide(); // hide at least
}
if (!rect().contains(event->pos())){
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ff194f7..2bc4da6 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -131,10 +131,6 @@ struct QTLWExtra {
uint embedded : 1;
// *************************** Platform specific values (bit fields first) **********
-#ifndef QT_NO_XSYNC
- int newCounterValueHi : 32;
- uint newCounterValueLo : 32;
-#endif
#if defined(Q_WS_X11) // <----------------------------------------------------------- X11
uint spont_unmapped: 1; // window was spontaneously unmapped
uint dnd : 1; // DND properties installed
@@ -143,6 +139,12 @@ struct QTLWExtra {
WId parentWinId; // parent window Id (valid after reparenting)
WId userTimeWindow; // window id that contains user-time timestamp when WM supports a _NET_WM_USER_TIME_WINDOW atom
QPoint fullScreenOffset;
+#ifndef QT_NO_XSYNC
+ WId syncUpdateCounter;
+ ulong syncRequestTimestamp;
+ qint32 newCounterValueHi;
+ quint32 newCounterValueLo;
+#endif
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN
HICON winIconBig; // internal big Windows icon
HICON winIconSmall; // internal small Windows icon
@@ -160,10 +162,6 @@ struct QTLWExtra {
QWSManager *qwsManager;
#endif
#endif
-#ifndef QT_NO_XSYNC
- WId syncUpdateCounter;
- ulong syncRequestTimestamp;
-#endif
};
struct QWExtra {
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index ea79329..6ad2548 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1036,7 +1036,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
if (isVisible())
style |= WS_VISIBLE;
SetWindowLongA(internalWinId(), GWL_STYLE, style);
- QRect r = qApp->desktop()->screenGeometry(this);
+ QRect r = QApplication::desktop()->screenGeometry(this);
UINT swpf = SWP_FRAMECHANGED;
if (newstate & Qt::WindowActive)
swpf |= SWP_NOACTIVATE;
@@ -1977,8 +1977,8 @@ public:
// in
QOnScreenRasterPaintEngine()
: QRasterPaintEngine(new QImage(qt_primary_surface_bits,
- qApp->desktop()->width(),
- qApp->desktop()->height(),
+ QApplication::desktop()->width(),
+ QApplication::desktop()->height(),
qt_primary_surface_stride,
qt_primary_surface_format))
{
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 0a3a8dd..25dab4c 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -758,7 +758,7 @@ void QWidgetBackingStore::paintWindowDecoration()
engine->setSystemClip(decorationRegion.translated(tlwOffset));
QPainter painter(windowSurface->paintDevice());
- painter.setFont(qApp->font());
+ painter.setFont(QApplication::font());
painter.translate(tlwOffset);
const int numDirty = managerPrivate->dirtyRegions.size();
@@ -1347,7 +1347,7 @@ void QWidgetBackingStore::flush(QWidget *widget, QWindowSurface *surface)
static inline bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra)
{
Q_ASSERT(widget);
- if (qApp && qApp->closingDown())
+ if (QApplication::closingDown())
return true;
if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore)
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index f4acd5f..c2509ad 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1050,19 +1050,19 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
*/
/*!
- \fn QMargins::QMargins(int margin)
-
- Constructs an instance of QMargins setting all four
- margins to \a margin.
- */
+ \fn QMargins::QMargins(int margin)
+
+ Constructs an instance of QMargins setting all four
+ margins to \a margin.
+*/
/*!
- \fn QMargins::QMargins(int topMargin, int leftMargin, int bottomMargin, int rightMargin)
-
- Constructs an instance of QMargins setting the four
- margins to \a topMargin, \a leftMargin, \a bottomMargin,
- and \a rightMargin.
- */
+ \fn QMargins::QMargins(int topMargin, int leftMargin, int bottomMargin, int rightMargin)
+
+ Constructs an instance of QMargins setting the four
+ margins to \a topMargin, \a leftMargin, \a bottomMargin,
+ and \a rightMargin.
+*/
/*!
\class QTileRules
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 175f1ab..5ce1136 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -99,9 +99,9 @@ void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
} else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
QBrush copy = brush;
QTransform mat = copy.transform();
- QRealRect r = path.controlPointRect();
- mat.translate(r.x1, r.y1);
- mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ QRectF r = path.controlPointRect();
+ mat.translate(r.x(), r.y());
+ mat.scale(r.width(), r.height());
copy.setTransform(mat);
real_engine->fill(path, copy);
return;
@@ -139,9 +139,9 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
return;
} else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
QTransform mat = brush.transform();
- QRealRect r = path.controlPointRect();
- mat.translate(r.x1, r.y1);
- mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ QRectF r = path.controlPointRect();
+ mat.translate(r.x(), r.y());
+ mat.scale(r.width(), r.height());
brush.setTransform(mat);
copy.setBrush(brush);
real_engine->stroke(path, copy);
diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp
index 5889388..3d0a1b7 100644
--- a/src/gui/painting/qpaintengine_mac.cpp
+++ b/src/gui/painting/qpaintengine_mac.cpp
@@ -131,8 +131,8 @@ QMacCGContext::QMacCGContext(QPainter *p)
QPainterState *state = static_cast<QPainterState *>(pe->state);
Q_ASSERT(state);
- if (!state->redirection_offset.isNull())
- CGContextTranslateCTM(context, -state->redirection_offset.x(), -state->redirection_offset.y());
+ if (!state->redirectionMatrix.isIdentity())
+ CGContextTranslateCTM(context, state->redirectionMatrix.dx(), state->redirectionMatrix.dy());
}
}
CGContextRetain(context);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 7ed2dfd..4711455 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1852,8 +1852,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
}
// ### Optimize for non transformed ellipses and rectangles...
- QRealRect r = path.controlPointRect();
- QRectF cpRect(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1);
+ QRectF cpRect = path.controlPointRect();
const QRect deviceRect = s->matrix.mapRect(cpRect).toRect();
ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData);
@@ -4333,7 +4332,9 @@ void QClipData::initialize()
if (m_spans)
return;
- m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight);
+ if (!m_clipLines)
+ m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight);
+
m_spans = (QSpan *)malloc(clipSpanHeight*sizeof(QSpan));
allocated = clipSpanHeight;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index d2671c8..67a3fa9 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -56,15 +56,15 @@ QT_BEGIN_NAMESPACE
*
*/
-const QRealRect &QVectorPath::controlPointRect() const
+QRectF QVectorPath::controlPointRect() const
{
if (m_hints & ControlPointRect)
- return m_cp_rect;
+ return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
if (m_count == 0) {
m_cp_rect.x1 = m_cp_rect.x2 = m_cp_rect.y1 = m_cp_rect.y2 = 0;
m_hints |= ControlPointRect;
- return m_cp_rect;
+ return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
Q_ASSERT(m_points && m_count > 0);
@@ -88,7 +88,7 @@ const QRealRect &QVectorPath::controlPointRect() const
}
m_hints |= ControlPointRect;
- return m_cp_rect;
+ return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
const QVectorPath &qtVectorPathForPath(const QPainterPath &path)
@@ -100,9 +100,7 @@ const QVectorPath &qtVectorPathForPath(const QPainterPath &path)
#ifndef QT_NO_DEBUG_STREAM
QDebug Q_GUI_EXPORT &operator<<(QDebug &s, const QVectorPath &path)
{
- QRealRect vectorPathBounds = path.controlPointRect();
- QRectF rf(vectorPathBounds.x1, vectorPathBounds.y1,
- vectorPathBounds.x2 - vectorPathBounds.x1, vectorPathBounds.y2 - vectorPathBounds.y1);
+ QRectF rf = path.controlPointRect();
s << "QVectorPath(size:" << path.elementCount()
<< " hints:" << hex << path.hints()
<< rf << ')';
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 0ece498..528c575 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -414,7 +414,7 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio
bool old_txinv = txinv;
QTransform old_invMatrix = invMatrix;
txinv = true;
- invMatrix = state->redirectionMatrix;
+ invMatrix = state->redirectionMatrix.inverted();
QPainterPath clipPath = q->clipPath();
QRectF r = clipPath.boundingRect().intersected(absPathRect);
absPathRect = r.toAlignedRect();
@@ -653,18 +653,7 @@ void QPainterPrivate::updateInvMatrix()
{
Q_ASSERT(txinv == false);
txinv = true; // creating inverted matrix
- QTransform m;
-
- if (state->VxF)
- m = viewTransform();
-
- if (state->WxF) {
- if (state->VxF)
- m = state->worldMatrix * m;
- else
- m = state->worldMatrix;
- }
- invMatrix = m.inverted(); // invert matrix
+ invMatrix = state->matrix.inverted();
}
void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
@@ -2569,7 +2558,7 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op)
QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
d->state->clipEnabled = true;
d->extended->clip(vp, op);
- d->state->clipInfo << QPainterClipInfo(rect, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix);
d->state->clipOperation = op;
return;
}
@@ -2612,7 +2601,7 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
if (d->extended) {
d->state->clipEnabled = true;
d->extended->clip(rect, op);
- d->state->clipInfo << QPainterClipInfo(rect, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix);
d->state->clipOperation = op;
return;
}
@@ -2624,7 +2613,7 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op)
d->state->clipOperation = op;
if (op == Qt::NoClip || op == Qt::ReplaceClip)
d->state->clipInfo.clear();
- d->state->clipInfo << QPainterClipInfo(rect, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix);
d->state->clipEnabled = true;
d->state->dirtyFlags |= QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipEnabled;
d->updateState(d->state);
@@ -2665,7 +2654,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
if (d->extended) {
d->state->clipEnabled = true;
d->extended->clip(r, op);
- d->state->clipInfo << QPainterClipInfo(r, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(r, op, d->state->matrix);
d->state->clipOperation = op;
return;
}
@@ -2677,7 +2666,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
d->state->clipOperation = op;
if (op == Qt::NoClip || op == Qt::ReplaceClip)
d->state->clipInfo.clear();
- d->state->clipInfo << QPainterClipInfo(r, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(r, op, d->state->matrix);
d->state->clipEnabled = true;
d->state->dirtyFlags |= QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipEnabled;
d->updateState(d->state);
@@ -3062,7 +3051,7 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
if (d->extended) {
d->state->clipEnabled = true;
d->extended->clip(path, op);
- d->state->clipInfo << QPainterClipInfo(path, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(path, op, d->state->matrix);
d->state->clipOperation = op;
return;
}
@@ -3076,7 +3065,7 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
d->state->clipOperation = op;
if (op == Qt::NoClip || op == Qt::ReplaceClip)
d->state->clipInfo.clear();
- d->state->clipInfo << QPainterClipInfo(path, op, combinedTransform());
+ d->state->clipInfo << QPainterClipInfo(path, op, d->state->matrix);
d->state->clipEnabled = true;
d->state->dirtyFlags |= QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipEnabled;
d->updateState(d->state);
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 986770d..2f3a0cb 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -2049,7 +2049,7 @@ QPainterPath QPainterPath::translated(qreal dx, qreal dy) const
}
/*!
- \fn void QPainterPath::translated(const QPointF &offset) const
+ \fn QPainterPath QPainterPath::translated(const QPointF &offset) const;
\overload
\since 4.6
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 2602a3d..b073f8c 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -112,7 +112,7 @@ public:
{
}
- const QRealRect &controlPointRect() const;
+ QRectF controlPointRect() const;
inline Hint shape() const { return (Hint) (m_hints & ShapeHintMask); }
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 805cd05..aff0af3 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -4419,7 +4419,7 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon,
{
#ifdef Q_WS_X11
Q_D(const QCleanlooksStyle);
- if (!qApp->desktopSettingsAware())
+ if (!QApplication::desktopSettingsAware())
return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
QIcon icon;
QPixmap pixmap;
@@ -4588,7 +4588,7 @@ QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QS
#ifdef Q_WS_X11
Q_D(const QCleanlooksStyle);
QPixmap pixmap;
- if (!qApp->desktopSettingsAware())
+ if (!QApplication::desktopSettingsAware())
return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
d->lookupIconTheme();
#ifndef QT_NO_IMAGEFORMAT_XPM
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 1285598..74eacf6 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -3130,7 +3130,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if (dw->isFloating())
icon = dw->windowIcon();
if (!icon.isNull()
- && icon.cacheKey() != qApp->windowIcon().cacheKey()) {
+ && icon.cacheKey() != QApplication::windowIcon().cacheKey()) {
QSize sz = icon.actualSize(QSize(r.height(), r.height()));
if (verticalTitleBar)
sz.transpose();
@@ -5309,7 +5309,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
#ifdef Q_WS_X11
Q_D(const QCommonStyle);
QPixmap pixmap;
- if (qApp->desktopSettingsAware()) {
+ if (QApplication::desktopSettingsAware()) {
d->lookupIconTheme();
switch (sp) {
case SP_DirHomeIcon:
@@ -5730,7 +5730,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
QIcon icon;
#ifdef Q_WS_X11
Q_D(const QCommonStyle);
- if (qApp->desktopSettingsAware()) {
+ if (QApplication::desktopSettingsAware()) {
d->lookupIconTheme();
QPixmap pixmap;
switch (standardIcon) {
diff --git a/src/gui/styles/qstylefactory.cpp b/src/gui/styles/qstylefactory.cpp
index 70717db..376aa0f 100644
--- a/src/gui/styles/qstylefactory.cpp
+++ b/src/gui/styles/qstylefactory.cpp
@@ -170,7 +170,7 @@ QStyle *QStyleFactory::create(const QString& key)
else
#endif
#ifndef QT_NO_STYLE_MAC
- if (style.left(9) == QLatin1String("macintosh")) {
+ if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
# ifdef Q_WS_MAC
if (style == QLatin1String("macintosh"))
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 9a8f97e..1bbe70e 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -867,7 +867,7 @@ static QStyle::StandardPixmap subControlIcon(int pe)
QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QWidget *widget)
: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)
{
- QPalette palette = qApp->palette(); // ###: ideally widget's palette
+ QPalette palette = QApplication::palette(); // ###: ideally widget's palette
ValueExtractor v(declarations, palette);
features = v.extractStyleFeatures();
@@ -2584,7 +2584,7 @@ static void updateWidgets(const QList<const QWidget *>& widgets)
continue;
widget->style()->polish(widget);
QEvent event(QEvent::StyleChange);
- qApp->sendEvent(widget, &event);
+ QApplication::sendEvent(widget, &event);
widget->update();
widget->updateGeometry();
}
@@ -2630,9 +2630,9 @@ QStyle *QStyleSheetStyle::baseStyle() const
{
if (base)
return base;
- if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(qApp->style()))
+ if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(QApplication::style()))
return me->base;
- return qApp->style();
+ return QApplication::style();
}
void QStyleSheetStyle::widgetDestroyed(QObject *o)
@@ -2850,7 +2850,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
rule.drawBackgroundImage(p, cmbOpt.rect);
rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button);
bool customDropDown = (opt->subControls & QStyle::SC_ComboBoxArrow)
- && hasStyleRule(w, PseudoElement_ComboBoxDropDown);
+ && (hasStyleRule(w, PseudoElement_ComboBoxDropDown) || hasStyleRule(w, PseudoElement_ComboBoxArrow));
if (customDropDown)
cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow;
if (rule.baseStyleCanDraw()) {
@@ -2896,11 +2896,11 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) {
rule.drawBackgroundImage(p, spinOpt.rect);
customUp = (opt->subControls & QStyle::SC_SpinBoxUp)
- && hasStyleRule(w, PseudoElement_SpinBoxUpButton);
+ && (hasStyleRule(w, PseudoElement_SpinBoxUpButton) || hasStyleRule(w, PseudoElement_UpArrow));
if (customUp)
spinOpt.subControls &= ~QStyle::SC_SpinBoxUp;
customDown = (opt->subControls & QStyle::SC_SpinBoxDown)
- && hasStyleRule(w, PseudoElement_SpinBoxDownButton);
+ && (hasStyleRule(w, PseudoElement_SpinBoxDownButton) || hasStyleRule(w, PseudoElement_DownArrow));
if (customDown)
spinOpt.subControls &= ~QStyle::SC_SpinBoxDown;
if (rule.baseStyleCanDraw()) {
@@ -3573,7 +3573,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
mi.rect = positionRect(w, subRule, subRule2, PseudoElement_MenuRightArrow, opt->rect, mi.direction);
drawPrimitive(arrow, &mi, p, w);
}
- } else if (hasStyleRule(w, PseudoElement_MenuCheckMark)) {
+ } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) {
QWindowsStyle::drawControl(ce, &mi, p, w);
} else {
if (rule.hasDrawable() && !subRule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
@@ -4339,6 +4339,16 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
pseudoElement = PseudoElement_ScrollAreaCorner;
break;
+ case PE_IndicatorSpinDown:
+ case PE_IndicatorSpinMinus:
+ pseudoElement = PseudoElement_SpinBoxDownArrow;
+ break;
+
+ case PE_IndicatorSpinUp:
+ case PE_IndicatorSpinPlus:
+ pseudoElement = PseudoElement_SpinBoxUpArrow;
+ break;
+
default:
break;
}
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index 013ca1e..9ea9a03 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -1436,7 +1436,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (isFloating) {
titleRect.adjust(0, -fw, 0, 0);
- if (widget != 0 && widget->windowIcon().cacheKey() != qApp->windowIcon().cacheKey())
+ if (widget != 0 && widget->windowIcon().cacheKey() != QApplication::windowIcon().cacheKey())
titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
} else {
titleRect.adjust(mw, 0, 0, 0);
@@ -2435,7 +2435,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) {
tree->viewport()->setAttribute(Qt::WA_Hover, false);
} else if (qobject_cast<QCommandLinkButton*>(widget)) {
- QFont font = qApp->font("QCommandLinkButton");
+ QFont font = QApplication::font("QCommandLinkButton");
QFont widgetFont = widget->font();
widgetFont.setFamily(font.family()); //Only family set by polish
widget->setFont(widgetFont);
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 3dac9f5..b5dfdbd 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -261,7 +261,7 @@ void QWindowsXPStylePrivate::cleanup(bool force)
use_xp = false;
cleanupHandleMap();
if (limboWidget) {
- if (qApp->closingDown())
+ if (QApplication::closingDown())
delete limboWidget;
else
limboWidget->deleteLater();
@@ -2275,7 +2275,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
if (isFloating) {
titleRect.adjust(0, -fw, 0, 0);
- if (widget != 0 && widget->windowIcon().cacheKey() != qApp->windowIcon().cacheKey())
+ if (widget != 0 && widget->windowIcon().cacheKey() != QApplication::windowIcon().cacheKey())
titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
} else {
titleRect.adjust(mw, 0, 0, 0);
@@ -2322,7 +2322,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
// Figure out maximal button space on title bar
QIcon ico = widget->windowIcon();
- bool hasIcon = (ico.cacheKey() != qApp->windowIcon().cacheKey());
+ bool hasIcon = (ico.cacheKey() != QApplication::windowIcon().cacheKey());
if (hasIcon) {
QPixmap pxIco = ico.pixmap(titleHeight);
if (!verticalTitleBar && QApplication::layoutDirection() == Qt::RightToLeft)
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 9c3c4a4..e9f067a 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -87,34 +87,34 @@ static int getFontWeight(const QString &weightString)
// Test in decreasing order of commonness
if (s == QLatin1String("medium") ||
s == QLatin1String("normal")
- || s.compare(qApp->translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
return QFont::Normal;
if (s == QLatin1String("bold")
- || s.compare(qApp->translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
return QFont::Bold;
if (s == QLatin1String("demibold") || s == QLatin1String("demi bold")
- || s.compare(qApp->translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
return QFont::DemiBold;
if (s == QLatin1String("black")
- || s.compare(qApp->translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
return QFont::Black;
if (s == QLatin1String("light"))
return QFont::Light;
if (s.contains(QLatin1String("bold"))
- || s.contains(qApp->translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
+ || s.contains(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
if (s.contains(QLatin1String("demi"))
- || s.compare(qApp->translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
return (int) QFont::DemiBold;
return (int) QFont::Bold;
}
if (s.contains(QLatin1String("light"))
- || s.compare(qApp->translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
return (int) QFont::Light;
if (s.contains(QLatin1String("black"))
- || s.compare(qApp->translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
+ || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
return (int) QFont::Black;
return (int) QFont::Normal;
@@ -251,10 +251,10 @@ QtFontStyle::Key::Key(const QString &styleString)
weight = getFontWeight(styleString);
if (styleString.contains(QLatin1String("Italic"))
- || styleString.contains(qApp->translate("QFontDatabase", "Italic")))
+ || styleString.contains(QApplication::translate("QFontDatabase", "Italic")))
style = QFont::StyleItalic;
else if (styleString.contains(QLatin1String("Oblique"))
- || styleString.contains(qApp->translate("QFontDatabase", "Oblique")))
+ || styleString.contains(QApplication::translate("QFontDatabase", "Oblique")))
style = QFont::StyleOblique;
}
@@ -1249,21 +1249,21 @@ static QString styleStringHelper(int weight, QFont::Style style)
{
QString result;
if (weight >= QFont::Black)
- result = qApp->translate("QFontDatabase", "Black");
+ result = QApplication::translate("QFontDatabase", "Black");
else if (weight >= QFont::Bold)
- result = qApp->translate("QFontDatabase", "Bold");
+ result = QApplication::translate("QFontDatabase", "Bold");
else if (weight >= QFont::DemiBold)
- result = qApp->translate("QFontDatabase", "Demi Bold");
+ result = QApplication::translate("QFontDatabase", "Demi Bold");
else if (weight < QFont::Normal)
- result = qApp->translate("QFontDatabase", "Light");
+ result = QApplication::translate("QFontDatabase", "Light");
if (style == QFont::StyleItalic)
- result += QLatin1Char(' ') + qApp->translate("QFontDatabase", "Italic");
+ result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Italic");
else if (style == QFont::StyleOblique)
- result += QLatin1Char(' ') + qApp->translate("QFontDatabase", "Oblique");
+ result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Oblique");
if (result.isEmpty())
- result = qApp->translate("QFontDatabase", "Normal");
+ result = QApplication::translate("QFontDatabase", "Normal");
return result.simplified();
}
@@ -2067,7 +2067,7 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem)
Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter");
break;
}
- return qApp ? qApp->translate("QFontDatabase", name) : QString::fromLatin1(name);
+ return QApplication::translate("QFontDatabase", name);
}
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 0958b52..8573fc9 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -394,7 +394,7 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText
Q_Q(QTextControl);
setContent(format, text, document);
- QWidget *parentWidget = qobject_cast<QWidget*>(q->parent());
+ QWidget *parentWidget = qobject_cast<QWidget*>(parent);
if (parentWidget) {
QTextOption opt = doc->defaultTextOption();
opt.setTextDirection(parentWidget->layoutDirection());
@@ -1712,7 +1712,7 @@ void QTextControlPrivate::mouseDoubleClickEvent(QEvent *e, Qt::MouseButton butto
selectedWordOnDoubleClick = cursor;
trippleClickPoint = pos;
- trippleClickTimer.start(qApp->doubleClickInterval(), q);
+ trippleClickTimer.start(QApplication::doubleClickInterval(), q);
if (doEmit) {
selectionChanged();
#ifndef QT_NO_CLIPBOARD
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index fa032e6..cf40ad8 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -3205,18 +3205,16 @@ bool QTextDocumentLayout::contentHasAlignment() const
qreal QTextDocumentLayoutPrivate::scaleToDevice(qreal value) const
{
- QPaintDevice *dev = q_func()->paintDevice();
- if (!dev)
+ if (!paintDevice)
return value;
- return value * dev->logicalDpiY() / qreal(qt_defaultDpi());
+ return value * paintDevice->logicalDpiY() / qreal(qt_defaultDpi());
}
QFixed QTextDocumentLayoutPrivate::scaleToDevice(QFixed value) const
{
- QPaintDevice *dev = q_func()->paintDevice();
- if (!dev)
+ if (!paintDevice)
return value;
- return value * QFixed(dev->logicalDpiY()) / QFixed(qt_defaultDpi());
+ return value * QFixed(paintDevice->logicalDpiY()) / QFixed(qt_defaultDpi());
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 75e89d2..bc8ac5b 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -295,28 +295,13 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
writer.writeAttribute(textNS, QString::fromLatin1("style-name"), QString::fromLatin1("c%1")
.arg(frag.fragment().charFormatIndex()));
bool escapeNextSpace = true;
- int precedingSpaces = 0, precedingTabs = 0;
+ int precedingSpaces = 0;
int exportedIndex = 0;
for (int i=0; i <= fragmentText.count(); ++i) {
- bool isTab = false, isSpace = false;
- if (i < fragmentText.count()) {
+ bool isSpace = false;
QChar character = fragmentText[i];
- isTab = character.unicode() == '\t';
isSpace = character.unicode() == ' ';
- if (character.unicode() == 0x2028) { // soft-return
- writer.writeCharacters(fragmentText.mid(exportedIndex, i));
- writer.writeEmptyElement(textNS, QString::fromLatin1("line-break"));
- exportedIndex = i+1;
- continue;
- }
- if (isSpace) {
- ++precedingSpaces;
- escapeNextSpace = true;
- }
- else if (isTab) {
- precedingTabs++;
- }
- }
+
// find more than one space. -> <text:s text:c="2" />
if (!isSpace && escapeNextSpace && precedingSpaces > 1) {
const bool startParag = exportedIndex == 0 && i == precedingSpaces;
@@ -329,17 +314,27 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
precedingSpaces = 0;
exportedIndex = i;
}
- // find tabs. -> <text:tab text:tab-ref="3" /> or <text:tab/>
- if (!isTab && precedingTabs) {
- writer.writeCharacters(fragmentText.mid(exportedIndex, i - precedingTabs - exportedIndex));
- writer.writeEmptyElement(textNS, QString::fromLatin1("tab"));
- if (precedingTabs > 1)
- writer.writeAttribute(textNS, QString::fromLatin1("tab-ref"), QString::number(precedingTabs));
- precedingTabs = 0;
- exportedIndex = i;
+
+ if (i < fragmentText.count()) {
+ if (character.unicode() == 0x2028) { // soft-return
+ //if (exportedIndex < i)
+ writer.writeCharacters(fragmentText.mid(exportedIndex, i - exportedIndex));
+ writer.writeEmptyElement(textNS, QString::fromLatin1("line-break"));
+ exportedIndex = i+1;
+ continue;
+ } else if (character.unicode() == '\t') { // Tab
+ //if (exportedIndex < i)
+ writer.writeCharacters(fragmentText.mid(exportedIndex, i - exportedIndex));
+ writer.writeEmptyElement(textNS, QString::fromLatin1("tab"));
+ exportedIndex = i+1;
+ precedingSpaces = 0;
+ } else if (isSpace) {
+ ++precedingSpaces;
+ escapeNextSpace = true;
+ } else if (!isSpace) {
+ precedingSpaces = 0;
+ }
}
- if (!isSpace && !isTab)
- precedingSpaces = 0;
}
writer.writeCharacters(fragmentText.mid(exportedIndex));
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index c46c929..f79f135 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -518,7 +518,7 @@ void QSystemTrayIconPrivate::install_sys()
QRect QSystemTrayIconSys::findTrayGeometry()
{
//Use lower right corner as fallback
- QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight();
+ QPoint brCorner = QApplication::desktop()->screenGeometry().bottomRight();
QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10);
#if defined(Q_OS_WINCE)
HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL);
diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp
index 1900016..6337b5c 100644
--- a/src/gui/widgets/qabstractbutton.cpp
+++ b/src/gui/widgets/qabstractbutton.cpp
@@ -319,20 +319,16 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
return group->d_func()->buttonList;
#endif
- Q_Q(const QAbstractButton);
- QList<QAbstractButton*>candidates;
- if (q->parentWidget()) {
- candidates = qFindChildren<QAbstractButton *>(q->parentWidget());
- if (autoExclusive) {
- for (int i = candidates.count() - 1; i >= 0; --i) {
- QAbstractButton *candidate = candidates.at(i);
- if (!candidate->autoExclusive()
+ QList<QAbstractButton*>candidates = qFindChildren<QAbstractButton *>(parent);
+ if (autoExclusive) {
+ for (int i = candidates.count() - 1; i >= 0; --i) {
+ QAbstractButton *candidate = candidates.at(i);
+ if (!candidate->autoExclusive()
#ifndef QT_NO_BUTTONGROUP
- || candidate->group()
+ || candidate->group()
#endif
- )
- candidates.removeAt(i);
- }
+ )
+ candidates.removeAt(i);
}
}
return candidates;
@@ -383,7 +379,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
#else
bool exclusive = autoExclusive;
#endif
- QWidget *f = qApp->focusWidget();
+ QWidget *f = QApplication::focusWidget();
QAbstractButton *fb = qobject_cast<QAbstractButton *>(f);
if (!fb || !buttonList.contains(fb))
return;
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 6a0c879..30f9a87 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -69,6 +69,9 @@ extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); /
extern QHash<QByteArray, QFont> *qt_app_fonts_hash(); // qapplication.cpp
+static inline bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature)
+{ return (priv->features & feature) == feature; }
+
static inline bool hasFeature(const QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature)
{ return (dockwidget->features() & feature) == feature; }
@@ -647,25 +650,25 @@ void QDockWidgetPrivate::_q_toggleView(bool b)
void QDockWidgetPrivate::updateButtons()
{
Q_Q(QDockWidget);
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
QStyleOptionDockWidget opt;
q->initStyleOption(&opt);
- bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
- bool nativeDeco = layout->nativeWindowDeco();
+ bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
+ bool nativeDeco = dwLayout->nativeWindowDeco();
bool hideButtons = nativeDeco || customTitleBar;
- bool canClose = hasFeature(q, QDockWidget::DockWidgetClosable);
- bool canFloat = hasFeature(q, QDockWidget::DockWidgetFloatable);
+ bool canClose = hasFeature(this, QDockWidget::DockWidgetClosable);
+ bool canFloat = hasFeature(this, QDockWidget::DockWidgetFloatable);
QAbstractButton *button
- = qobject_cast<QAbstractButton*>(layout->widgetForRole(QDockWidgetLayout::FloatButton));
+ = qobject_cast<QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::FloatButton));
button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, &opt, q));
button->setVisible(canFloat && !hideButtons);
button
- = qobject_cast <QAbstractButton*>(layout->widgetForRole(QDockWidgetLayout::CloseButton));
+ = qobject_cast <QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::CloseButton));
button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, q));
button->setVisible(canClose && !hideButtons);
@@ -688,7 +691,7 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca)
if (state != 0)
return;
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
Q_ASSERT(layout != 0);
@@ -741,15 +744,15 @@ void QDockWidgetPrivate::endDrag(bool abort)
q->releaseMouse();
if (state->dragging) {
- QMainWindowLayout *layout =
+ QMainWindowLayout *mwLayout =
qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
- Q_ASSERT(layout != 0);
+ Q_ASSERT(mwLayout != 0);
- if (abort || !layout->plug(state->widgetItem)) {
- if (hasFeature(q, QDockWidget::DockWidgetFloatable)) {
+ if (abort || !mwLayout->plug(state->widgetItem)) {
+ if (hasFeature(this, QDockWidget::DockWidgetFloatable)) {
if (state->ownWidgetItem)
delete state->widgetItem;
- layout->restore();
+ mwLayout->restore();
#ifdef Q_WS_X11
// get rid of the X11BypassWindowManager window flag and activate the resizer
Qt::WindowFlags flags = q->windowFlags();
@@ -759,14 +762,14 @@ void QDockWidgetPrivate::endDrag(bool abort)
q->show();
#else
QDockWidgetLayout *myLayout
- = qobject_cast<QDockWidgetLayout*>(q->layout());
+ = qobject_cast<QDockWidgetLayout*>(layout);
resizer->setActive(QWidgetResizeHandler::Resize,
myLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0);
#endif
undockedGeometry = q->geometry();
q->activateWindow();
} else {
- layout->revert(state->widgetItem);
+ mwLayout->revert(state->widgetItem);
}
}
}
@@ -778,7 +781,7 @@ bool QDockWidgetPrivate::isAnimating() const
{
Q_Q(const QDockWidget);
- QMainWindow *mainWin = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *mainWin = qobject_cast<QMainWindow*>(parent);
if (mainWin == 0)
return false;
@@ -795,18 +798,18 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
#if !defined(QT_NO_MAINWINDOW)
Q_Q(QDockWidget);
- QDockWidgetLayout *layout
- = qobject_cast<QDockWidgetLayout*>(q->layout());
+ QDockWidgetLayout *dwLayout
+ = qobject_cast<QDockWidgetLayout*>(layout);
- if (!layout->nativeWindowDeco()) {
- QRect titleArea = layout->titleArea();
+ if (!dwLayout->nativeWindowDeco()) {
+ QRect titleArea = dwLayout->titleArea();
if (event->button() != Qt::LeftButton ||
!titleArea.contains(event->pos()) ||
// check if the tool window is movable... do nothing if it
// is not (but allow moving if the window is floating)
- (!hasFeature(q, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
- qobject_cast<QMainWindow*>(q->parentWidget()) == 0 ||
+ (!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
+ qobject_cast<QMainWindow*>(parent) == 0 ||
isAnimating() || state != 0) {
return false;
}
@@ -814,7 +817,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
initDrag(event->pos(), false);
if (state)
- state->ctrlDrag = hasFeature(q, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier;
+ state->ctrlDrag = hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier;
return true;
}
@@ -825,15 +828,13 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
bool QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event)
{
- Q_Q(QDockWidget);
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
-
- if (!layout->nativeWindowDeco()) {
- QRect titleArea = layout->titleArea();
+ if (!dwLayout->nativeWindowDeco()) {
+ QRect titleArea = dwLayout->titleArea();
if (event->button() == Qt::LeftButton && titleArea.contains(event->pos()) &&
- hasFeature(q, QDockWidget::DockWidgetFloatable)) {
+ hasFeature(this, QDockWidget::DockWidgetFloatable)) {
_q_toggleTopLevel();
return true;
}
@@ -851,7 +852,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
return ret;
QDockWidgetLayout *dwlayout
- = qobject_cast<QDockWidgetLayout*>(q->layout());
+ = qobject_cast<QDockWidgetLayout*>(layout);
QMainWindowLayout *mwlayout
= qobject_cast<QMainWindowLayout*>(q->parentWidget()->layout());
if (!dwlayout->nativeWindowDeco()) {
@@ -924,7 +925,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
break;
if (state != 0)
break;
- if (qobject_cast<QMainWindow*>(q->parentWidget()) == 0)
+ if (qobject_cast<QMainWindow*>(parent) == 0)
break;
if (isAnimating())
break;
@@ -997,9 +998,9 @@ void QDockWidgetPrivate::unplug(const QRect &rect)
Q_Q(QDockWidget);
QRect r = rect;
r.moveTopLeft(q->mapToGlobal(QPoint(0, 0)));
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
- if (layout->nativeWindowDeco(true))
- r.adjust(0, layout->titleHeight(), 0, 0);
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
+ if (dwLayout->nativeWindowDeco(true))
+ r.adjust(0, dwLayout->titleHeight(), 0, 0);
setWindowState(true, true, r);
}
@@ -1020,12 +1021,12 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
Qt::WindowFlags flags = floating ? Qt::Tool : Qt::Widget;
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
- const bool nativeDeco = layout->nativeWindowDeco(floating);
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
+ const bool nativeDeco = dwLayout->nativeWindowDeco(floating);
if (nativeDeco) {
flags |= Qt::CustomizeWindowHint | Qt::WindowTitleHint;
- if (hasFeature(q, QDockWidget::DockWidgetClosable))
+ if (hasFeature(this, QDockWidget::DockWidgetClosable))
flags |= Qt::WindowCloseButtonHint;
} else {
flags |= Qt::FramelessWindowHint;
diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp
index 140953d..19cdf89 100644
--- a/src/gui/widgets/qeffects.cpp
+++ b/src/gui/widgets/qeffects.cpp
@@ -588,8 +588,8 @@ void qScrollEffect(QWidget* w, QEffects::DirFlags orient, int time)
if (!w)
return;
- qApp->sendPostedEvents(w, QEvent::Move);
- qApp->sendPostedEvents(w, QEvent::Resize);
+ QApplication::sendPostedEvents(w, QEvent::Move);
+ QApplication::sendPostedEvents(w, QEvent::Resize);
Qt::WindowFlags flags = Qt::ToolTip;
// those can be popups - they would steal the focus, but are disabled
@@ -610,8 +610,8 @@ void qFadeEffect(QWidget* w, int time)
if (!w)
return;
- qApp->sendPostedEvents(w, QEvent::Move);
- qApp->sendPostedEvents(w, QEvent::Resize);
+ QApplication::sendPostedEvents(w, QEvent::Move);
+ QApplication::sendPostedEvents(w, QEvent::Resize);
Qt::WindowFlags flags = Qt::ToolTip;
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
index 6acd977..efaa2d3 100644
--- a/src/gui/widgets/qmdiarea.cpp
+++ b/src/gui/widgets/qmdiarea.cpp
@@ -800,12 +800,12 @@ void QMdiAreaPrivate::appendChild(QMdiSubWindow *child)
Q_Q(QMdiArea);
Q_ASSERT(child && childWindows.indexOf(child) == -1);
- if (child->parent() != q->viewport())
- child->setParent(q->viewport(), child->windowFlags());
+ if (child->parent() != viewport)
+ child->setParent(viewport, child->windowFlags());
childWindows.append(QPointer<QMdiSubWindow>(child));
if (!child->testAttribute(Qt::WA_Resized) && q->isVisible()) {
- QSize newSize(child->sizeHint().boundedTo(q->viewport()->size()));
+ QSize newSize(child->sizeHint().boundedTo(viewport->size()));
child->resize(newSize.expandedTo(qSmartMinSize(child)));
}
@@ -931,7 +931,7 @@ void QMdiAreaPrivate::rearrange(Rearranger *rearranger)
widgets.move(indexToActive, 0);
}
- QRect domain = q->viewport()->rect();
+ QRect domain = viewport->rect();
if (rearranger->type() == Rearranger::RegularTiler && !widgets.isEmpty())
domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count());
@@ -1212,7 +1212,7 @@ void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const
QMdiSubWindow *stackUnderChild = 0;
if (!windowStaysOnTop(mdiChild)) {
- foreach (QObject *object, q_func()->viewport()->children()) {
+ foreach (QObject *object, viewport->children()) {
QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object);
if (!child || !childWindows.contains(child))
continue;
@@ -1236,7 +1236,7 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in
{
Q_Q(QMdiArea);
if (!minSubWindowSize.isValid() || subWindowCount <= 0)
- return q->viewport()->rect();
+ return viewport->rect();
// Calculate minimum size.
const int columns = qMax(qCeil(qSqrt(qreal(subWindowCount))), 1);
@@ -1255,10 +1255,10 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in
// We don't want sub-subwindows to be placed at the edge, thus add 2 pixels.
int minAreaWidth = minWidth + left + right + 2;
int minAreaHeight = minHeight + top + bottom + 2;
- if (q->horizontalScrollBar()->isVisible())
- minAreaHeight += q->horizontalScrollBar()->height();
- if (q->verticalScrollBar()->isVisible())
- minAreaWidth += q->verticalScrollBar()->width();
+ if (hbar->isVisible())
+ minAreaHeight += hbar->height();
+ if (vbar->isVisible())
+ minAreaWidth += vbar->width();
if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) {
const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q);
minAreaWidth += 2 * frame;
@@ -1268,23 +1268,23 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in
topLevel->resize(topLevel->size() + diff);
}
- QRect domain = q->viewport()->rect();
+ QRect domain = viewport->rect();
// Adjust domain width and provide horizontal scroll bar.
if (domain.width() < minWidth) {
domain.setWidth(minWidth);
- if (q->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
+ if (hbarpolicy == Qt::ScrollBarAlwaysOff)
q->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- else if (q->horizontalScrollBar()->value() != 0)
- q->horizontalScrollBar()->setValue(0);
+ else
+ hbar->setValue(0);
}
// Adjust domain height and provide vertical scroll bar.
if (domain.height() < minHeight) {
domain.setHeight(minHeight);
- if (q->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
+ if (vbarpolicy == Qt::ScrollBarAlwaysOff)
q->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- else if (q->verticalScrollBar()->value() != 0)
- q->verticalScrollBar()->setValue(0);
+ else
+ vbar->setValue(0);
}
return domain;
}
diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp
index 56df8ea..e5cc6b6 100644
--- a/src/gui/widgets/qmdisubwindow.cpp
+++ b/src/gui/widgets/qmdisubwindow.cpp
@@ -1006,7 +1006,7 @@ void QMdiSubWindowPrivate::removeBaseWidget()
Q_Q(QMdiSubWindow);
baseWidget->removeEventFilter(q);
- if (QLayout *layout = q->layout())
+ if (layout)
layout->removeWidget(baseWidget);
if (baseWidget->windowTitle() == q->windowTitle()) {
ignoreWindowTitleChange = true;
@@ -1102,7 +1102,7 @@ void QMdiSubWindowPrivate::updateCursor()
void QMdiSubWindowPrivate::updateDirtyRegions()
{
// No update necessary
- if (!q_func()->parent())
+ if (!parent)
return;
foreach (Operation operation, operationMap.keys())
@@ -1115,7 +1115,7 @@ void QMdiSubWindowPrivate::updateDirtyRegions()
void QMdiSubWindowPrivate::updateGeometryConstraints()
{
Q_Q(QMdiSubWindow);
- if (!q->parent())
+ if (!parent)
return;
internalMinimumSize = (!q->isMinimized() && !q->minimumSize().isNull())
@@ -1145,7 +1145,7 @@ void QMdiSubWindowPrivate::updateMask()
if (!q->mask().isEmpty())
q->clearMask();
- if (!q->parent())
+ if (!parent)
return;
if ((q->isMaximized() && !drawTitleBarWhenMaximized())
@@ -1168,7 +1168,7 @@ void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos)
{
Q_Q(QMdiSubWindow);
Q_ASSERT(currentOperation != None);
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
uint cflags = operationMap.find(currentOperation).value().changeFlags;
int posX = pos.x();
@@ -1235,7 +1235,7 @@ void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos)
void QMdiSubWindowPrivate::setMinimizeMode()
{
Q_Q(QMdiSubWindow);
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
ensureWindowState(Qt::WindowMinimized);
isShadeRequestFromMinimizeMode = true;
@@ -1263,7 +1263,7 @@ void QMdiSubWindowPrivate::setMinimizeMode()
void QMdiSubWindowPrivate::setNormalMode()
{
Q_Q(QMdiSubWindow);
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
isShadeMode = false;
isMaximizeMode = false;
@@ -1334,7 +1334,7 @@ void QMdiSubWindowPrivate::setNormalMode()
void QMdiSubWindowPrivate::setMaximizeMode()
{
Q_Q(QMdiSubWindow);
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
ensureWindowState(Qt::WindowMaximized);
isShadeMode = false;
@@ -1423,7 +1423,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
{
Q_Q(QMdiSubWindow);
- if (!q->parent() || !activationEnabled)
+ if (!parent || !activationEnabled)
return;
if (activate && !isActive && q->isEnabled()) {
@@ -1711,7 +1711,7 @@ void QMdiSubWindowPrivate::ensureWindowState(Qt::WindowState state)
int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const
{
Q_Q(const QMdiSubWindow);
- if (!q->parent() || q->windowFlags() & Qt::FramelessWindowHint
+ if (!parent || q->windowFlags() & Qt::FramelessWindowHint
|| (q->isMaximized() && !drawTitleBarWhenMaximized())) {
return 0;
}
@@ -1734,7 +1734,7 @@ void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const
{
Q_Q(const QMdiSubWindow);
Qt::WindowFlags flags = q->windowFlags();
- if (!q->parent() || flags & Qt::FramelessWindowHint) {
+ if (!parent || flags & Qt::FramelessWindowHint) {
*margin = 0;
*minWidth = 0;
return;
@@ -1893,7 +1893,7 @@ void QMdiSubWindowPrivate::enterRubberBandMode()
if (q->isMaximized())
return;
Q_ASSERT(oldGeometry.isValid());
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
if (!rubberBand) {
rubberBand = new QRubberBand(QRubberBand::Rectangle, q->parentWidget());
// For accessibility to identify this special widget.
@@ -2079,7 +2079,7 @@ void QMdiSubWindowPrivate::restoreFocus()
void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags)
{
Q_Q(QMdiSubWindow);
- if (!q->parent()) {
+ if (!parent) {
q->setWindowFlags(windowFlags);
return;
}
@@ -2164,7 +2164,7 @@ void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QStri
QSize QMdiSubWindowPrivate::iconSize() const
{
Q_Q(const QMdiSubWindow);
- if (!q->parent() || q->windowFlags() & Qt::FramelessWindowHint)
+ if (!parent || q->windowFlags() & Qt::FramelessWindowHint)
return QSize(-1, -1);
return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());
}
@@ -2180,17 +2180,17 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
if (!newSizeGrip || sizeGrip || q->windowFlags() & Qt::FramelessWindowHint)
return;
- if (q->layout() && q->layout()->indexOf(newSizeGrip) != -1)
+ if (layout && layout->indexOf(newSizeGrip) != -1)
return;
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
- bool putSizeGripInLayout = q->layout() ? true : false;
+ bool putSizeGripInLayout = layout ? true : false;
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
putSizeGripInLayout = false;
#endif
if (putSizeGripInLayout) {
- q->layout()->addWidget(newSizeGrip);
- q->layout()->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight);
+ layout->addWidget(newSizeGrip);
+ layout->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight);
} else {
newSizeGrip->setParent(q);
newSizeGrip->move(q->isLeftToRight() ? q->width() - newSizeGrip->width() : 0,
diff --git a/src/gui/widgets/qmdisubwindow_p.h b/src/gui/widgets/qmdisubwindow_p.h
index 2e672d6..d706546 100644
--- a/src/gui/widgets/qmdisubwindow_p.h
+++ b/src/gui/widgets/qmdisubwindow_p.h
@@ -287,7 +287,7 @@ public:
inline int titleBarHeight() const
{
Q_Q(const QMdiSubWindow);
- if (!q->parent() || q->windowFlags() & Qt::FramelessWindowHint
+ if (!parent || q->windowFlags() & Qt::FramelessWindowHint
|| (q->isMaximized() && !drawTitleBarWhenMaximized())) {
return 0;
}
@@ -308,7 +308,7 @@ public:
inline void setNewGeometry(QRect *geometry)
{
Q_Q(QMdiSubWindow);
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
#ifndef QT_NO_RUBBERBAND
if (isInRubberBandMode)
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 711f1f4..7baea94 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1048,7 +1048,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
hideUpToMenuBar();
} else {
- for(QWidget *widget = qApp->activePopupWidget(); widget; ) {
+ for(QWidget *widget = QApplication::activePopupWidget(); widget; ) {
if (QMenu *qmenu = qobject_cast<QMenu*>(widget)) {
if(qmenu == q)
hideUpToMenuBar();
@@ -1843,7 +1843,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
if (adjustToDesktop) {
//handle popup falling "off screen"
- if (qApp->layoutDirection() == Qt::RightToLeft) {
+ if (QApplication::layoutDirection() == Qt::RightToLeft) {
if(snapToMouse) //position flowing left from the mouse
pos.setX(mouse.x()-size.width());
@@ -1881,9 +1881,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
}
setGeometry(QRect(pos, size));
#ifndef QT_NO_EFFECTS
- int hGuess = qApp->layoutDirection() == Qt::RightToLeft ? QEffects::LeftScroll : QEffects::RightScroll;
+ int hGuess = QApplication::layoutDirection() == Qt::RightToLeft ? QEffects::LeftScroll : QEffects::RightScroll;
int vGuess = QEffects::DownScroll;
- if (qApp->layoutDirection() == Qt::RightToLeft) {
+ if (QApplication::layoutDirection() == Qt::RightToLeft) {
if ((snapToMouse && (pos.x() + size.width()/2 > mouse.x())) ||
(qobject_cast<QMenu*>(d->causedPopup.widget) && pos.x() + size.width()/2 > d->causedPopup.widget->x()))
hGuess = QEffects::RightScroll;
@@ -2575,7 +2575,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
{
d->hideMenu(this);
#ifndef QT_NO_MENUBAR
- if (QMenuBar *mb = qobject_cast<QMenuBar*>(qApp->focusWidget())) {
+ if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
mb->d_func()->setKeyboardMode(false);
}
#endif
@@ -2719,7 +2719,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
#ifdef Q_OS_WIN32
if (key_consumed && (e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift || e->key() == Qt::Key_Meta))
- qApp->beep();
+ QApplication::beep();
#endif // Q_OS_WIN32
}
if (key_consumed)
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index fc7e901..51e38e6 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -284,7 +284,7 @@ void QMenuBarPrivate::setKeyboardMode(bool b)
}
keyboardState = b;
if(b) {
- QWidget *fw = qApp->focusWidget();
+ QWidget *fw = QApplication::focusWidget();
if (fw != q)
keyboardFocusWidget = fw;
if(!currentAction && !actionList.isEmpty())
@@ -294,7 +294,7 @@ void QMenuBarPrivate::setKeyboardMode(bool b)
if(!popupState)
setCurrentAction(0);
if(keyboardFocusWidget) {
- if (qApp->focusWidget() == q)
+ if (QApplication::focusWidget() == q)
keyboardFocusWidget->setFocus(Qt::MenuBarFocusReason);
keyboardFocusWidget = 0;
}
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index ca58f87..b526f02 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -576,7 +576,7 @@ void QPushButtonPrivate::_q_popupPressed()
menu->setNoReplayFor(q);
bool horizontal = true;
#if !defined(QT_NO_TOOLBAR)
- QToolBar *tb = qobject_cast<QToolBar*>(q->parentWidget());
+ QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
#endif
@@ -589,7 +589,7 @@ void QPushButtonPrivate::_q_popupPressed()
int x = globalPos.x();
int y = globalPos.y();
if (horizontal) {
- if (globalPos.y() + rect.height() + menuSize.height() <= qApp->desktop()->height()) {
+ if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->height()) {
y += rect.height();
} else {
y -= menuSize.height();
@@ -597,7 +597,7 @@ void QPushButtonPrivate::_q_popupPressed()
if (q->layoutDirection() == Qt::RightToLeft)
x += rect.width() - menuSize.width();
} else {
- if (globalPos.x() + rect.width() + menu->sizeHint().width() <= qApp->desktop()->width())
+ if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->width())
x += rect.width();
else
x -= menuSize.width();
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index f12946c..a9b9a84 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -983,7 +983,7 @@ QVariant QSpinBoxPrivate::valueFromText(const QString &text) const
bool QSpinBoxPrivate::isIntermediateValue(const QString &str) const
{
- const int num = q_func()->locale().toInt(str, 0, 10);
+ const int num = locale.toInt(str, 0, 10);
const int min = minimum.toInt();
const int max = maximum.toInt();
@@ -1053,13 +1053,13 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} else {
bool ok = false;
bool removedThousand = false;
- num = q_func()->locale().toInt(copy, &ok, 10);
+ num = locale.toInt(copy, &ok, 10);
if (!ok && copy.contains(thousand) && (max >= 1000 || min <= -1000)) {
const int s = copy.size();
copy.remove(thousand);
pos = qMax(0, pos - (s - copy.size()));
removedThousand = true;
- num = q_func()->locale().toInt(copy, &ok, 10);
+ num = locale.toInt(copy, &ok, 10);
}
QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num;
if (!ok) {
@@ -1346,9 +1346,8 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
{
bool ok = false;
- QLocale loc(q_func()->locale());
- num = loc.toDouble(copy, &ok);
- QSBDEBUG() << __FILE__ << __LINE__ << loc << copy << num << ok;
+ num = locale.toDouble(copy, &ok);
+ QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok;
bool notAcceptable = false;
if (!ok) {
@@ -1373,7 +1372,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
pos = qMax(0, pos - (s - copy.size()));
- num = loc.toDouble(copy, &ok);
+ num = locale.toDouble(copy, &ok);
QSBDEBUG() << thousand << num << copy << ok;
if (!ok) {
diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp
index 400d78a..24a8b6c 100644
--- a/src/gui/widgets/qsplitter.cpp
+++ b/src/gui/widgets/qsplitter.cpp
@@ -397,7 +397,7 @@ void QSplitterPrivate::recalc(bool update)
}
if (empty) {
- if (qobject_cast<QSplitter *>(q->parentWidget())) {
+ if (qobject_cast<QSplitter *>(parent)) {
// nested splitters; be nice
maxl = maxt = 0;
} else {
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index 43b2f54..c97154c 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -1057,7 +1057,7 @@ void QTabWidget::keyPressEvent(QKeyEvent *e)
break;
}
}
- if (!qApp->focusWidget())
+ if (!QApplication::focusWidget())
d->tabs->setFocus();
} else {
e->ignore();
diff --git a/src/gui/widgets/qtextbrowser.cpp b/src/gui/widgets/qtextbrowser.cpp
index a1f4d34..d849184 100644
--- a/src/gui/widgets/qtextbrowser.cpp
+++ b/src/gui/widgets/qtextbrowser.cpp
@@ -263,7 +263,7 @@ void QTextBrowserPrivate::setSource(const QUrl &url)
Q_Q(QTextBrowser);
#ifndef QT_NO_CURSOR
if (q->isVisible())
- qApp->setOverrideCursor(Qt::WaitCursor);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
#endif
textOrSourceChanged = true;
@@ -295,9 +295,9 @@ void QTextBrowserPrivate::setSource(const QUrl &url)
if (q->isVisible()) {
QString firstTag = txt.left(txt.indexOf(QLatin1Char('>')) + 1);
- if (firstTag.left(3) == QLatin1String("<qt") && firstTag.contains(QLatin1String("type")) && firstTag.contains(QLatin1String("detail"))) {
+ if (firstTag.startsWith(QLatin1String("<qt")) && firstTag.contains(QLatin1String("type")) && firstTag.contains(QLatin1String("detail"))) {
#ifndef QT_NO_CURSOR
- qApp->restoreOverrideCursor();
+ QApplication::restoreOverrideCursor();
#endif
#ifndef QT_NO_WHATSTHIS
QWhatsThis::showText(QCursor::pos(), txt, q);
@@ -342,7 +342,7 @@ void QTextBrowserPrivate::setSource(const QUrl &url)
#ifndef QT_NO_CURSOR
if (q->isVisible())
- qApp->restoreOverrideCursor();
+ QApplication::restoreOverrideCursor();
#endif
emit q->sourceChanged(url);
}
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index d765794..7787a66 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -198,7 +198,7 @@ void QToolBarPrivate::initDrag(const QPoint &pos)
if (state != 0)
return;
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
Q_ASSERT(layout != 0);
@@ -224,7 +224,7 @@ void QToolBarPrivate::startDrag(bool moving)
if ((moving && state->moving) || state->dragging)
return;
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
Q_ASSERT(layout != 0);
@@ -283,7 +283,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
// drag between toolbar contents to move the window. Make this work by
// implementing the standard mouse-dragging code and then call
// window->move() in mouseMoveEvent below.
- if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->parentWidget())) {
+ if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parent)) {
if (mainWindow->toolBarArea(q) == Qt::TopToolBarArea
&& mainWindow->unifiedTitleAndToolBarOnMac()
&& q->childAt(event->pos()) == 0) {
@@ -337,7 +337,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
return false;
}
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
if (win == 0)
return true;
@@ -1181,7 +1181,7 @@ bool QToolBar::event(QEvent *event)
if (!d->layout->expanded)
break;
- QWidget *w = qApp->activePopupWidget();
+ QWidget *w = QApplication::activePopupWidget();
if (waitForPopup(this, w)) {
d->waitForPopupTimer->start();
break;
@@ -1201,7 +1201,7 @@ void QToolBarPrivate::_q_waitForPopup()
{
Q_Q(QToolBar);
- QWidget *w = qApp->activePopupWidget();
+ QWidget *w = QApplication::activePopupWidget();
if (!waitForPopup(q, w)) {
waitForPopupTimer->stop();
if (!q->underMouse())
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index 240d059..b1b743e 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -440,9 +440,10 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos)
//we check if the previous is near its size hint
//in which case we try to stick to it
- if (qAbs(pick(o, previous.sizeHint()) - (previous.size + extra)) < QApplication::startDragDistance()) {
- //we stick to the default space
- extra = 0;
+ const int diff = pick(o, previous.sizeHint()) - (previous.size + extra);
+ if (qAbs(diff) < QApplication::startDragDistance()) {
+ //we stick to the default place and size
+ extra += diff;
}
//update for the current item
diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/gui/widgets/qtoolbutton.cpp
index 20b84ef..0eb6364 100644
--- a/src/gui/widgets/qtoolbutton.cpp
+++ b/src/gui/widgets/qtoolbutton.cpp
@@ -278,7 +278,7 @@ void QToolButtonPrivate::init()
#endif
defaultAction = 0;
#ifndef QT_NO_TOOLBAR
- if (qobject_cast<QToolBar*>(q->parentWidget()))
+ if (qobject_cast<QToolBar*>(parent))
autoRaise = true;
else
#endif
@@ -890,12 +890,12 @@ void QToolButtonPrivate::popupTimerDone()
q->setAutoRepeat(false);
bool horizontal = true;
#if !defined(QT_NO_TOOLBAR)
- QToolBar *tb = qobject_cast<QToolBar*>(q->parentWidget());
+ QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
#endif
QPoint p;
- QRect screen = qApp->desktop()->availableGeometry(q);
+ QRect screen = QApplication::desktop()->availableGeometry(q);
QSize sh = ((QToolButton*)(QMenu*)actualMenu)->receivers(SIGNAL(aboutToShow()))? QSize() : actualMenu->sizeHint();
QRect rect = q->rect();
if (horizontal) {
diff --git a/src/gui/widgets/qwidgetresizehandler.cpp b/src/gui/widgets/qwidgetresizehandler.cpp
index 9171244..0e5b28a 100644
--- a/src/gui/widgets/qwidgetresizehandler.cpp
+++ b/src/gui/widgets/qwidgetresizehandler.cpp
@@ -258,7 +258,7 @@ void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)
#ifdef Q_WS_X11
// Workaround for window managers which refuse to move a tool window partially offscreen.
- QRect desktop = qApp->desktop()->availableGeometry(widget);
+ QRect desktop = QApplication::desktop()->availableGeometry(widget);
pp.rx() = qMax(pp.x(), desktop.left());
pp.ry() = qMax(pp.y(), desktop.top());
p.rx() = qMin(p.x(), desktop.right());
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 43fbb16..abaa7fb 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -468,7 +468,7 @@ bool QHttpNetworkConnectionPrivate::sendRequest(QAbstractSocket *socket)
return true;
}
-bool QHttpNetworkConnectionPrivate::emitSignals(QHttpNetworkReply *reply)
+bool QHttpNetworkConnectionPrivate::shouldEmitSignals(QHttpNetworkReply *reply)
{
// for 401 & 407 don't emit the data signals. Content along with these
// responses are send only if the authentication fails.
@@ -484,7 +484,7 @@ bool QHttpNetworkConnectionPrivate::expectContent(QHttpNetworkReply *reply)
|| reply->d_func()->statusCode == 204 || reply->d_func()->statusCode == 304)
return false;
if (reply->d_func()->request.operation() == QHttpNetworkRequest::Head)
- return !emitSignals(reply);
+ return !shouldEmitSignals(reply);
if (reply->d_func()->contentLength() == 0)
return false;
return true;
@@ -528,7 +528,7 @@ bool QHttpNetworkConnectionPrivate::expand(QAbstractSocket *socket, QHttpNetwork
if (inflated.size()) {
reply->d_func()->totalProgress += inflated.size();
appendData(*reply, inflated, false);
- if (emitSignals(reply)) {
+ if (shouldEmitSignals(reply)) {
emit reply->readyRead();
// make sure that the reply is valid
if (channels[i].reply != reply)
@@ -613,7 +613,7 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN
reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
break; // ignore
}
- if (emitSignals(reply))
+ if (shouldEmitSignals(reply))
emit reply->headerChanged();
if (!expectContent(reply)) {
reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState;
@@ -631,7 +631,7 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN
appendData(*reply, fragment.data(), reply->d_func()->autoDecompress);
if (!reply->d_func()->autoDecompress) {
reply->d_func()->totalProgress += fragment.size();
- if (emitSignals(reply)) {
+ if (shouldEmitSignals(reply)) {
emit reply->readyRead();
// make sure that the reply is valid
if (channels[i].reply != reply)
@@ -673,7 +673,7 @@ void QHttpNetworkConnectionPrivate::allDone(QAbstractSocket *socket, QHttpNetwor
expand(socket, reply, true); // ### if expand returns false, its an error
#endif
// while handling 401 & 407, we might reset the status code, so save this.
- bool emitFinished = emitSignals(reply);
+ bool emitFinished = shouldEmitSignals(reply);
handleStatus(socket, reply);
// ### at this point there should be no more data on the socket
// close if server requested
@@ -828,7 +828,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
if (priv->phase != QAuthenticatorPrivate::Done) {
// send any pending requests
copyCredentials(i, auth, isProxy);
- QMetaObject::invokeMethod(q, "_q_restartPendingRequest", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(q, "_q_restartAuthPendingRequests", Qt::QueuedConnection);
}
}
// changing values in QAuthenticator will reset the 'phase'
@@ -907,7 +907,7 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
return reply;
}
-void QHttpNetworkConnectionPrivate::unqueueRequest(QAbstractSocket *socket)
+void QHttpNetworkConnectionPrivate::unqueueAndSendRequest(QAbstractSocket *socket)
{
Q_ASSERT(socket);
@@ -918,13 +918,12 @@ void QHttpNetworkConnectionPrivate::unqueueRequest(QAbstractSocket *socket)
HttpMessagePair &messagePair = highPriorityQueue[j];
if (!messagePair.second->d_func()->requestIsPrepared)
prepareRequest(messagePair);
- if (!messagePair.second->d_func()->requestIsBuffering) {
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- sendRequest(socket);
- highPriorityQueue.removeAt(j);
- return;
- }
+
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ sendRequest(socket);
+ highPriorityQueue.removeAt(j);
+ return;
}
}
@@ -933,13 +932,11 @@ void QHttpNetworkConnectionPrivate::unqueueRequest(QAbstractSocket *socket)
HttpMessagePair &messagePair = lowPriorityQueue[j];
if (!messagePair.second->d_func()->requestIsPrepared)
prepareRequest(messagePair);
- if (!messagePair.second->d_func()->requestIsBuffering) {
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- sendRequest(socket);
- lowPriorityQueue.removeAt(j);
- return;
- }
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ sendRequest(socket);
+ lowPriorityQueue.removeAt(j);
+ return;
}
}
}
@@ -1112,10 +1109,10 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
if (!socket) {
return; // this will be called after finishing current request.
}
- unqueueRequest(socket);
+ unqueueAndSendRequest(socket);
}
-void QHttpNetworkConnectionPrivate::_q_restartPendingRequest()
+void QHttpNetworkConnectionPrivate::_q_restartAuthPendingRequests()
{
// send the request using the idle socket
for (int i = 0 ; i < channelCount; ++i) {
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 9b127dd..4603a55 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -140,7 +140,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_readyRead())
Q_PRIVATE_SLOT(d_func(), void _q_disconnected())
Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
- Q_PRIVATE_SLOT(d_func(), void _q_restartPendingRequest())
+ Q_PRIVATE_SLOT(d_func(), void _q_restartAuthPendingRequests())
Q_PRIVATE_SLOT(d_func(), void _q_connected())
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
#ifndef QT_NO_NETWORKPROXY
@@ -189,7 +189,7 @@ public:
bool isSocketReading(QAbstractSocket *socket) const;
QHttpNetworkReply *queueRequest(const QHttpNetworkRequest &request);
- void unqueueRequest(QAbstractSocket *socket);
+ void unqueueAndSendRequest(QAbstractSocket *socket);
void prepareRequest(HttpMessagePair &request);
bool sendRequest(QAbstractSocket *socket);
void receiveReply(QAbstractSocket *socket, QHttpNetworkReply *reply);
@@ -202,7 +202,7 @@ public:
void _q_readyRead(); // pending data to read
void _q_disconnected(); // disconnected from host
void _q_startNextRequest(); // send the next request from the queue
- void _q_restartPendingRequest(); // send the currently blocked request
+ void _q_restartAuthPendingRequests(); // send the currently blocked request
void _q_connected(); // start sending request
void _q_error(QAbstractSocket::SocketError); // error from socket
#ifndef QT_NO_NETWORKPROXY
@@ -261,7 +261,7 @@ public:
bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend);
void allDone(QAbstractSocket *socket, QHttpNetworkReply *reply);
void handleStatus(QAbstractSocket *socket, QHttpNetworkReply *reply);
- inline bool emitSignals(QHttpNetworkReply *reply);
+ inline bool shouldEmitSignals(QHttpNetworkReply *reply);
inline bool expectContent(QHttpNetworkReply *reply);
#ifndef QT_NO_OPENSSL
@@ -283,9 +283,6 @@ public:
QT_END_NAMESPACE
-//Q_DECLARE_METATYPE(QHttpNetworkRequest)
-//Q_DECLARE_METATYPE(QHttpNetworkReply)
-
#endif // QT_NO_HTTP
#endif
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 310994c..88b1a44 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -187,7 +187,7 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100),
majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0),
currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false),
- autoDecompress(false), requestIsBuffering(false), requestIsPrepared(false)
+ autoDecompress(false), requestIsPrepared(false)
{
}
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index cc5cce8..eff1da3 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -206,7 +206,6 @@ public:
QByteArray responseData; // uncompressed body
QByteArray compressedData; // compressed body (temporary)
- bool requestIsBuffering;
bool requestIsPrepared;
};
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 38b0a59..6c01ae3 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -770,7 +770,8 @@ void Moc::generate(FILE *out)
if (classList.size() && classList.first().classname == "Qt")
fprintf(out, "#include <QtCore/qobject.h>\n");
- fprintf(out, "#include <QtCore/qmetatype.h>\n");
+ if (mustIncludeQMetaTypeH)
+ fprintf(out, "#include <QtCore/qmetatype.h>\n");
fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n"
"#error \"The header file '%s' doesn't include <QObject>.\"\n", (const char *)fn);
@@ -903,6 +904,9 @@ void Moc::parseProperty(ClassDef *def)
type = "qlonglong";
else if (type == "ULongLong")
type = "qulonglong";
+ else if (type == "qreal")
+ mustIncludeQMetaTypeH = true;
+
propDef.type = type;
next();
@@ -964,7 +968,7 @@ void Moc::parseProperty(ClassDef *def)
msg += " has no READ accessor function. The property will be invalid.";
warning(msg.constData());
}
- if(!propDef.notify.isEmpty())
+ if(!propDef.notify.isEmpty())
def->notifyableProperties++;
def->propertyList += propDef;
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index c02864a..8e59e2d 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -178,13 +178,14 @@ class Moc : public Parser
{
public:
Moc()
- : noInclude(false), generatedCode(false)
+ : noInclude(false), generatedCode(false), mustIncludeQMetaTypeH(false)
{}
QByteArray filename;
bool noInclude;
bool generatedCode;
+ bool mustIncludeQMetaTypeH;
QByteArray includePath;
QList<QByteArray> includeFiles;
QList<ClassDef> classList;
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index c1bf2f4..f3f6f7d 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -143,9 +143,17 @@ SUBDIRS += _networkselftest \
qglobal \
qgraphicsitem \
qgraphicsitemanimation \
+ qgraphicslayout \
+ qgraphicslayoutitem \
+ qgraphicslinearlayout \
+ qgraphicsobject \
+ qgraphicspixmapitem \
+ qgraphicspolygonitem \
+ qgraphicsproxywidget \
qgraphicsscene \
qgraphicsview \
- qgridlayout \
+ qgraphicswidget \
+ qgridlayout \
qgroupbox \
qguivariant \
qhash \
diff --git a/tests/auto/qgraphicsobject/qgraphicsobject.pro b/tests/auto/qgraphicsobject/qgraphicsobject.pro
new file mode 100644
index 0000000..965b319
--- /dev/null
+++ b/tests/auto/qgraphicsobject/qgraphicsobject.pro
@@ -0,0 +1,2 @@
+load(qttest_p4)
+SOURCES += tst_qgraphicsobject.cpp
diff --git a/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp
new file mode 100644
index 0000000..eb12c48
--- /dev/null
+++ b/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <qgraphicsitem.h>
+#include <qgraphicsscene.h>
+#include <qgraphicssceneevent.h>
+#include <qgraphicsview.h>
+#include <qstyleoption.h>
+#include "../../shared/util.h"
+
+class tst_QGraphicsObject : public QObject {
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void pos();
+ void x();
+ void y();
+ void z();
+ void opacity();
+ void enabled();
+ void visible();
+};
+
+
+// This will be called before the first test function is executed.
+// It is only called once.
+void tst_QGraphicsObject::initTestCase()
+{
+}
+
+// This will be called after the last test function is executed.
+// It is only called once.
+void tst_QGraphicsObject::cleanupTestCase()
+{
+}
+
+// This will be called before each test function is executed.
+void tst_QGraphicsObject::init()
+{
+}
+
+// This will be called after every test function.
+void tst_QGraphicsObject::cleanup()
+{
+}
+
+
+class MyGraphicsObject : public QGraphicsObject
+{
+public:
+ MyGraphicsObject() : QGraphicsObject() {}
+ virtual QRectF boundingRect() const { return QRectF(); }
+ virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
+};
+
+void tst_QGraphicsObject::pos()
+{
+ MyGraphicsObject object;
+ QSignalSpy xSpy(&object, SIGNAL(xChanged()));
+ QSignalSpy ySpy(&object, SIGNAL(yChanged()));
+ QVERIFY(object.pos() == QPointF(0, 0));
+ object.setPos(10, 10);
+ QCOMPARE(xSpy.count(), 1);
+ QCOMPARE(ySpy.count(), 1);
+
+ QVERIFY(object.pos() == QPointF(10,10));
+
+ object.setPos(10, 10);
+ QCOMPARE(xSpy.count(), 1);
+ QCOMPARE(ySpy.count(), 1);
+
+ object.setProperty("pos", QPointF(0, 0));
+ QCOMPARE(xSpy.count(), 2);
+ QCOMPARE(ySpy.count(), 2);
+ QVERIFY(object.property("pos") == QPointF(0,0));
+
+ object.setProperty("pos", QPointF(10, 0));
+ QCOMPARE(xSpy.count(), 3);
+ QCOMPARE(ySpy.count(), 2);
+ QVERIFY(object.property("pos") == QPointF(10,0));
+
+ object.setProperty("pos", QPointF(10, 10));
+ QCOMPARE(xSpy.count(), 3);
+ QCOMPARE(ySpy.count(), 3);
+ QVERIFY(object.property("pos") == QPointF(10, 10));
+}
+
+void tst_QGraphicsObject::x()
+{
+ MyGraphicsObject object;
+ QSignalSpy xSpy(&object, SIGNAL(xChanged()));
+ QSignalSpy ySpy(&object, SIGNAL(yChanged()));
+ QVERIFY(object.pos() == QPointF(0, 0));
+ object.setX(10);
+ QCOMPARE(xSpy.count(), 1);
+ QCOMPARE(ySpy.count(), 0);
+
+ QVERIFY(object.pos() == QPointF(10, 0));
+ QVERIFY(object.x() == 10);
+
+ object.setX(10);
+ QCOMPARE(xSpy.count(), 1);
+ QCOMPARE(ySpy.count(), 0);
+
+ object.setProperty("x", 0);
+ QCOMPARE(xSpy.count(), 2);
+ QCOMPARE(ySpy.count(), 0);
+ QVERIFY(object.property("x") == 0);
+}
+
+void tst_QGraphicsObject::y()
+{
+ MyGraphicsObject object;
+ QSignalSpy xSpy(&object, SIGNAL(xChanged()));
+ QSignalSpy ySpy(&object, SIGNAL(yChanged()));
+ QVERIFY(object.pos() == QPointF(0, 0));
+ object.setY(10);
+ QCOMPARE(xSpy.count(), 0);
+ QCOMPARE(ySpy.count(), 1);
+
+ QVERIFY(object.pos() == QPointF(0, 10));
+ QVERIFY(object.y() == 10);
+
+ object.setY(10);
+ QCOMPARE(xSpy.count(), 0);
+ QCOMPARE(ySpy.count(), 1);
+
+ object.setProperty("y", 0);
+ QCOMPARE(xSpy.count(), 0);
+ QCOMPARE(ySpy.count(), 2);
+ QVERIFY(object.property("y") == 0);
+}
+
+void tst_QGraphicsObject::z()
+{
+ MyGraphicsObject object;
+ QSignalSpy zSpy(&object, SIGNAL(zChanged()));
+ QVERIFY(object.zValue() == 0);
+ object.setZValue(10);
+ QCOMPARE(zSpy.count(), 1);
+
+ QVERIFY(object.zValue() == 10);
+
+ object.setZValue(10);
+ QCOMPARE(zSpy.count(), 1);
+
+ object.setProperty("z", 0);
+ QCOMPARE(zSpy.count(), 2);
+ QVERIFY(object.property("z") == 0);
+}
+
+void tst_QGraphicsObject::opacity()
+{
+ MyGraphicsObject object;
+ QSignalSpy spy(&object, SIGNAL(opacityChanged()));
+ QVERIFY(object.opacity() == 1.);
+ object.setOpacity(0);
+ QCOMPARE(spy.count(), 1);
+
+ QVERIFY(object.opacity() == 0.);
+
+ object.setOpacity(0);
+ QCOMPARE(spy.count(), 1);
+
+ object.setProperty("opacity", .5);
+ QCOMPARE(spy.count(), 2);
+ QVERIFY(object.property("opacity") == .5);
+}
+
+void tst_QGraphicsObject::enabled()
+{
+ MyGraphicsObject object;
+ QSignalSpy spy(&object, SIGNAL(enabledChanged()));
+ QVERIFY(object.isEnabled() == true);
+ object.setEnabled(false);
+ QCOMPARE(spy.count(), 1);
+
+ QVERIFY(object.isEnabled() == false);
+
+ object.setEnabled(false);
+ QCOMPARE(spy.count(), 1);
+
+ object.setProperty("enabled", true);
+ QCOMPARE(spy.count(), 2);
+ QVERIFY(object.property("enabled") == true);
+}
+
+void tst_QGraphicsObject::visible()
+{
+ MyGraphicsObject object;
+ QSignalSpy spy(&object, SIGNAL(visibleChanged()));
+ QVERIFY(object.isVisible() == true);
+ object.setVisible(false);
+ QCOMPARE(spy.count(), 1);
+
+ QVERIFY(object.isVisible() == false);
+
+ object.setVisible(false);
+ QCOMPARE(spy.count(), 1);
+
+ object.setProperty("visible", true);
+ QCOMPARE(spy.count(), 2);
+ QVERIFY(object.property("visible") == true);
+}
+
+
+QTEST_MAIN(tst_QGraphicsObject)
+#include "tst_qgraphicsobject.moc"
+
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 5167682..06b4a78 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -188,6 +188,8 @@ private slots:
void embeddedViews();
void scrollAfterResize_data();
void scrollAfterResize();
+ void moveItemWhileScrolling_data();
+ void moveItemWhileScrolling();
void centerOnDirtyItem();
void mouseTracking();
void mouseTracking2();
@@ -3045,6 +3047,67 @@ void tst_QGraphicsView::scrollAfterResize()
QCOMPARE(view.viewportTransform(), x3);
}
+void tst_QGraphicsView::moveItemWhileScrolling_data()
+{
+ QTest::addColumn<bool>("adjustForAntialiasing");
+
+ QTest::newRow("no adjust") << false;
+ QTest::newRow("adjust") << true;
+}
+
+void tst_QGraphicsView::moveItemWhileScrolling()
+{
+ QFETCH(bool, adjustForAntialiasing);
+
+ class MoveItemScrollView : public QGraphicsView
+ {
+ public:
+ MoveItemScrollView()
+ {
+ setScene(new QGraphicsScene(0, 0, 1000, 1000));
+ rect = scene()->addRect(0, 0, 10, 10);
+ rect->setPos(50, 50);
+ }
+ QRegion lastPaintedRegion;
+ QGraphicsItem *rect;
+ protected:
+ void paintEvent(QPaintEvent *event)
+ {
+ lastPaintedRegion = event->region();
+ QGraphicsView::paintEvent(event);
+ }
+ };
+
+ MoveItemScrollView view;
+ view.setFrameStyle(0);
+ view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view.setResizeAnchor(QGraphicsView::NoAnchor);
+ view.setTransformationAnchor(QGraphicsView::NoAnchor);
+ if (!adjustForAntialiasing)
+ view.setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing);
+ view.show();
+ view.resize(200, 200);
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(100);
+
+ view.lastPaintedRegion = QRegion();
+ view.horizontalScrollBar()->setValue(view.horizontalScrollBar()->value() + 10);
+ view.rect->moveBy(0, 10);
+ QTest::qWait(100);
+
+ QRegion expectedRegion;
+ expectedRegion += QRect(0, 0, 200, 200);
+ expectedRegion -= QRect(0, 0, 190, 200);
+ int a = adjustForAntialiasing ? 2 : 1;
+ expectedRegion += QRect(40, 50, 10, 10).adjusted(-a, -a, a, a);
+ expectedRegion += QRect(40, 60, 10, 10).adjusted(-a, -a, a, a);
+
+ QCOMPARE(view.lastPaintedRegion, expectedRegion);
+}
+
void tst_QGraphicsView::centerOnDirtyItem()
{
QGraphicsView view;
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 8a6b63b..058c3c6 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -376,7 +376,7 @@ void tst_QPixmap::scroll()
QFETCH(QRegion, exposed);
QFETCH(bool, newPix);
- QPixmap pixmap(input);
+ QPixmap pixmap = QPixmap::fromImage(input);
QRegion exp;
qint64 oldKey = pixmap.cacheKey();
pixmap.scroll(dx, dy, rect, &exp);
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index d7c231f..274b177 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -134,6 +134,7 @@ private slots:
void task250023_fetchMore();
void task251296_hiddenChildren();
void task252507_mapFromToSource();
+ void task255652_removeRowsRecursive();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -390,7 +391,7 @@ void tst_QSortFilterProxyModel::sort()
QModelIndex index = m_proxy->index(row, 0, QModelIndex());
QCOMPARE(m_proxy->data(index, Qt::DisplayRole).toString(), initial.at(row));
}
-
+
}
void tst_QSortFilterProxyModel::sortHierarchy_data()
@@ -411,7 +412,7 @@ void tst_QSortFilterProxyModel::sortHierarchy_data()
<< static_cast<int>(Qt::AscendingOrder)
<< (QStringList() << "a" << "<" << "b" << "<" << "c" << ">" << ">")
<< (QStringList() << "a" << "<" << "b" << "<" << "c" << ">" << ">");
-
+
#if 1
QTest::newRow("hierarchical ascending")
<< static_cast<int>(Qt::AscendingOrder)
@@ -571,7 +572,7 @@ void tst_QSortFilterProxyModel::insertRows()
QModelIndex index = m_proxy->index(row, 0, QModelIndex());
QCOMPARE(m_proxy->data(index, Qt::DisplayRole).toString(), initial.at(row));
}
-
+
// insert the row
m_proxy->insertRows(position, insert.count(), QModelIndex());
QCOMPARE(m_model->rowCount(QModelIndex()), expected.count());
@@ -615,7 +616,7 @@ void tst_QSortFilterProxyModel::prependRow()
QStandardItem sub2("sub2");
sub2.appendRow(new QStandardItem("sub3"));
item.insertRow(0, &sub2);
-
+
QModelIndex index_sub2 = proxy.mapFromSource(model.indexFromItem(&sub2));
QCOMPARE(sub2.rowCount(), proxy.rowCount(index_sub2));
@@ -626,7 +627,7 @@ void tst_QSortFilterProxyModel::prependRow()
/*
void tst_QSortFilterProxyModel::insertColumns_data()
{
-
+
}
void tst_QSortFilterProxyModel::insertColumns()
@@ -923,7 +924,7 @@ void tst_QSortFilterProxyModel::removeRows()
// prepare model
foreach (QString s, initial)
model.appendRow(new QStandardItem(s));
-
+
// remove the rows
QCOMPARE(proxy.removeRows(position, count, QModelIndex()), success);
QCOMPARE(model.rowCount(QModelIndex()), expectedSource.count());
@@ -1164,10 +1165,10 @@ void tst_QSortFilterProxyModel::removeColumns()
proxy.setSourceModel(&model);
if (!filter.isEmpty())
proxy.setFilterRegExp(QRegExp(filter));
-
+
// prepare model
model.setHorizontalHeaderLabels(initial);
-
+
// remove the columns
QCOMPARE(proxy.removeColumns(position, count, QModelIndex()), success);
QCOMPARE(model.columnCount(QModelIndex()), expectedSource.count());
@@ -1266,7 +1267,7 @@ void tst_QSortFilterProxyModel::filter_data()
<< "golf"
<< "quebec"
<< "foxtrot"
- << "india"
+ << "india"
<< "romeo"
<< "november"
<< "oskar"
@@ -1274,9 +1275,9 @@ void tst_QSortFilterProxyModel::filter_data()
<< "kilo"
<< "whiskey"
<< "mike"
- << "papa"
+ << "papa"
<< "sierra"
- << "xray"
+ << "xray"
<< "viktor")
<< (QStringList()
<< "delta"
@@ -1334,7 +1335,7 @@ void tst_QSortFilterProxyModel::filterHierarchy_data()
<< "foo" << "boo" << "baz" << "moo" << "laa" << "haa")
<< (QStringList()
<< "foo" << "boo" << "moo");
-
+
QTest::newRow("simple hierarchy") << "b.*z"
<< (QStringList() << "baz" << "<" << "boz" << "<" << "moo" << ">" << ">")
<< (QStringList() << "baz" << "<" << "boz" << ">");
@@ -1671,7 +1672,7 @@ void tst_QSortFilterProxyModel::removeSourceRows()
QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int)));
QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)));
QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)));
-
+
model.removeRows(start, count, QModelIndex());
QCOMPARE(aboutToRemoveSpy.count(), expectedRemovedProxyIntervals.count());
@@ -1827,7 +1828,7 @@ void tst_QSortFilterProxyModel::changeFilter()
QFETCH(IntPairList, finalRemoveIntervals);
QFETCH(IntPairList, insertIntervals);
QFETCH(QStringList, finalProxyItems);
-
+
QStandardItemModel model;
QSortFilterProxyModel proxy;
@@ -1880,7 +1881,7 @@ void tst_QSortFilterProxyModel::changeFilter()
#ifdef Q_OS_IRIX
QEXPECT_FAIL("filter (2)", "Not reliable on IRIX", Abort);
-#endif
+#endif
QCOMPARE(finalInsertSpy.count(), insertIntervals.count());
for (int i = 0; i < finalInsertSpy.count(); ++i) {
QList<QVariant> args = finalInsertSpy.at(i);
@@ -2068,7 +2069,7 @@ void tst_QSortFilterProxyModel::sortFilterRole()
model.setData(index, sourceItems.at(i).first, Qt::DisplayRole);
model.setData(index, sourceItems.at(i).second, Qt::UserRole);
}
-
+
proxy.setFilterRegExp("2");
QCOMPARE(proxy.rowCount(), 0); // Qt::DisplayRole is default role
@@ -2358,7 +2359,7 @@ void tst_QSortFilterProxyModel::sourceInsertRows()
model.insertColumns(0, 1, parent);
model.insertRows(0, 1, parent);
}
-
+
model.insertRows(0, 1, QModelIndex());
model.insertRows(0, 1, QModelIndex());
@@ -2462,7 +2463,7 @@ void tst_QSortFilterProxyModel::task236755_hiddenColumns()
QVERIFY(view.isColumnHidden(0));
}
-void tst_QSortFilterProxyModel::task247867_insertRowsSort()
+void tst_QSortFilterProxyModel::task247867_insertRowsSort()
{
QStandardItemModel model(2,2);
QSortFilterProxyModel proxyModel;
@@ -2567,7 +2568,7 @@ void tst_QSortFilterProxyModel::task248868_dynamicSorting()
QStringList initial2 = initial;
initial2.replaceInStrings("bateau", "girafe");
model1.setStringList(initial2); //this will cause a reset
-
+
QStringList expected2 = initial2;
expected2.sort();
@@ -2648,7 +2649,7 @@ class QtTestModel: public QAbstractItemModel
{
if (!idx.isValid())
return QVariant();
-
+
if (role == Qt::DisplayRole) {
if (idx.row() < 0 || idx.column() < 0 || idx.column() >= cols || idx.row() >= rows) {
wrongIndex = true;
@@ -2756,5 +2757,63 @@ void tst_QSortFilterProxyModel::task252507_mapFromToSource()
QCOMPARE(proxy.mapFromSource(proxy.index(6, 2)), QModelIndex());
}
+static QStandardItem *addEntry(QStandardItem* pParent, const QString &description)
+{
+ QStandardItem* pItem = new QStandardItem(description);
+ pParent->appendRow(pItem);
+ return pItem;
+}
+
+
+void tst_QSortFilterProxyModel::task255652_removeRowsRecursive()
+{
+ QStandardItemModel pModel;
+ QStandardItem *pItem1 = new QStandardItem("root");
+ pModel.appendRow(pItem1);
+ QList<QStandardItem *> items;
+
+ QStandardItem *pItem11 = addEntry(pItem1,"Sub-heading");
+ items << pItem11;
+ QStandardItem *pItem111 = addEntry(pItem11,"A");
+ items << pItem111;
+ items << addEntry(pItem111,"A1");
+ items << addEntry(pItem111,"A2");
+ QStandardItem *pItem112 = addEntry(pItem11,"B");
+ items << pItem112;
+ items << addEntry(pItem112,"B1");
+ items << addEntry(pItem112,"B2");
+ QStandardItem *pItem1123 = addEntry(pItem112,"B3");
+ items << pItem1123;
+ items << addEntry(pItem1123,"B3-");
+
+ QSortFilterProxyModel proxy;
+ proxy.setSourceModel(&pModel);
+
+ QList<QPersistentModelIndex> sourceIndexes;
+ QList<QPersistentModelIndex> proxyIndexes;
+ foreach (QStandardItem *item, items) {
+ QModelIndex idx = item->index();
+ sourceIndexes << idx;
+ proxyIndexes << proxy.mapFromSource(idx);
+ }
+
+ foreach (const QPersistentModelIndex &pidx, sourceIndexes)
+ QVERIFY(pidx.isValid());
+ foreach (const QPersistentModelIndex &pidx, proxyIndexes)
+ QVERIFY(pidx.isValid());
+
+ QList<QStandardItem*> itemRow = pItem1->takeRow(0);
+
+ QCOMPARE(itemRow.count(), 1);
+ QCOMPARE(itemRow.first(), pItem11);
+
+ foreach (const QPersistentModelIndex &pidx, sourceIndexes)
+ QVERIFY(!pidx.isValid());
+ foreach (const QPersistentModelIndex &pidx, proxyIndexes)
+ QVERIFY(!pidx.isValid());
+
+ delete pItem11;
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
index 84bda92..8067554 100644
--- a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -135,6 +135,7 @@ private slots:
void rootItemFlags();
void treeDragAndDrop();
+ void removeRowsAndColumns();
private:
QAbstractItemModel *m_model;
@@ -1403,7 +1404,7 @@ bool tst_QStandardItemModel::compareItems(QStandardItem *item1, QStandardItem *i
return true;
if (!item1 || !item2)
return false;
- if (item1->text() != item2->text()){
+ if (item1->text() != item2->text()){
qDebug() << item1->text() << item2->text();
return false;
}
@@ -1606,6 +1607,52 @@ void tst_QStandardItemModel::treeDragAndDrop()
}
}
+void tst_QStandardItemModel::removeRowsAndColumns()
+{
+#define VERIFY_MODEL \
+ for (int c = 0; c < col_list.count(); c++) \
+ for (int r = 0; r < row_list.count(); r++) \
+ QCOMPARE(model.item(r,c)->text() , row_list[r] + "x" + col_list[c]);
+
+ QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector();
+ QVector<QString> col_list = row_list;
+ QStandardItemModel model;
+ for (int c = 0; c < col_list.count(); c++)
+ for (int r = 0; r < row_list.count(); r++)
+ model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c]));
+ VERIFY_MODEL
+
+ row_list.remove(3);
+ model.removeRow(3);
+ VERIFY_MODEL
+
+ col_list.remove(5);
+ model.removeColumn(5);
+ VERIFY_MODEL
+
+ row_list.remove(2, 5);
+ model.removeRows(2, 5);
+ VERIFY_MODEL
+
+ col_list.remove(1, 6);
+ model.removeColumns(1, 6);
+ VERIFY_MODEL
+
+ QList<QStandardItem *> row_taken = model.takeRow(6);
+ QCOMPARE(row_taken.count(), col_list.count());
+ for (int c = 0; c < col_list.count(); c++)
+ QCOMPARE(row_taken[c]->text() , row_list[6] + "x" + col_list[c]);
+ row_list.remove(6);
+ VERIFY_MODEL
+
+ QList<QStandardItem *> col_taken = model.takeColumn(10);
+ QCOMPARE(col_taken.count(), row_list.count());
+ for (int r = 0; r < row_list.count(); r++)
+ QCOMPARE(col_taken[r]->text() , row_list[r] + "x" + col_list[10]);
+ col_list.remove(10);
+ VERIFY_MODEL
+}
+
QTEST_MAIN(tst_QStandardItemModel)
#include "tst_qstandarditemmodel.moc"
diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro
index e52bb7a..9c07e76 100644
--- a/tests/auto/qtextcodec/test/test.pro
+++ b/tests/auto/qtextcodec/test/test.pro
@@ -6,7 +6,7 @@ wince*: {
addFiles.path = .
DEPLOYMENT += addFiles
DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
+ DEFINES += SRCDIR=\\\"\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
-
-
-
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 97c409b..1802c3e 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -74,6 +74,9 @@ private slots:
void utf8Codec_data();
void utf8Codec();
+ void utf8bom_data();
+ void utf8bom();
+
void utfHeaders_data();
void utfHeaders();
@@ -92,8 +95,8 @@ void tst_QTextCodec::toUnicode_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<QString>("codecName");
- QTest::newRow( "korean-eucKR" ) << "korean.txt" << "eucKR";
- QTest::newRow( "UTF-8" ) << "utf8.txt" << "UTF-8";
+ QTest::newRow( "korean-eucKR" ) << SRCDIR "korean.txt" << "eucKR";
+ QTest::newRow( "UTF-8" ) << SRCDIR "utf8.txt" << "UTF-8";
}
void tst_QTextCodec::toUnicode()
@@ -234,7 +237,7 @@ void tst_QTextCodec::fromUnicode()
void tst_QTextCodec::toUnicode_codecForHtml()
{
- QFile file(QString("QT4-crashtest.txt"));
+ QFile file(QString(SRCDIR "QT4-crashtest.txt"));
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
@@ -1513,6 +1516,63 @@ void tst_QTextCodec::utf8Codec()
QCOMPARE(str, res);
}
+void tst_QTextCodec::utf8bom_data()
+{
+ QTest::addColumn<QByteArray>("data");
+ QTest::addColumn<QString>("result");
+
+ QTest::newRow("nobom")
+ << QByteArray("\302\240", 2)
+ << QString("\240");
+
+ {
+ static const ushort data[] = { 0x201d };
+ QTest::newRow("nobom 2")
+ << QByteArray("\342\200\235", 3)
+ << QString::fromUtf16(data, sizeof(data)/sizeof(short));
+ }
+
+ {
+ static const ushort data[] = { 0xf000 };
+ QTest::newRow("bom1")
+ << QByteArray("\357\200\200", 3)
+ << QString::fromUtf16(data, sizeof(data)/sizeof(short));
+ }
+
+ {
+ static const ushort data[] = { 0xfec0 };
+ QTest::newRow("bom2")
+ << QByteArray("\357\273\200", 3)
+ << QString::fromUtf16(data, sizeof(data)/sizeof(short));
+ }
+
+ {
+ QTest::newRow("normal-bom")
+ << QByteArray("\357\273\277a", 4)
+ << QString("a");
+ }
+
+ {
+ static const ushort data[] = { 0x61, 0xfeff, 0x62 };
+ QTest::newRow("middle-bom")
+ << QByteArray("a\357\273\277b", 5)
+ << QString::fromUtf16(data, sizeof(data)/sizeof(short));
+ }
+}
+
+void tst_QTextCodec::utf8bom()
+{
+ QFETCH(QByteArray, data);
+ QFETCH(QString, result);
+
+ QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
+ Q_ASSERT(codec);
+
+ QCOMPARE(codec->toUnicode(data.constData(), data.length(), 0), result);
+
+ QTextCodec::ConverterState state;
+ QCOMPARE(codec->toUnicode(data.constData(), data.length(), &state), result);
+}
void tst_QTextCodec::utfHeaders_data()
{
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
index f92e30f..f8c7cdf 100644
--- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
+++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
@@ -133,7 +133,7 @@ void tst_QTextOdfWriter::testWriteParagraph_data()
QTest::newRow("tab") << "word\ttab x" <<
"<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">word<text:tab/>tab x</text:span></text:p>";
QTest::newRow("tab2") << "word\t\ttab\tx" <<
- "<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">word<text:tab text:tab-ref=\"2\"/>tab<text:tab/>x</text:span></text:p>";
+ "<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">word<text:tab/><text:tab/>tab<text:tab/>x</text:span></text:p>";
QTest::newRow("misc") << "foobar word\ttab x" <<
"<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">foobar <text:s text:c=\"2\"/>word<text:tab/>tab x</text:span></text:p>";
QTest::newRow("misc2") << "\t \tFoo" <<
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index 358b4b6..9573957 100644
--- a/tests/auto/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/qtextstream/tst_qtextstream.cpp
@@ -552,8 +552,15 @@ void tst_QTextStream::generateLineData(bool for_QString)
QTest::newRow("threelines/crlf/crlf/crlf") << QByteArray("ole\r\ndole\r\ndoffen\r\n") << (QStringList() << "ole" << "dole" << "doffen");
QTest::newRow("threelines/crlf/crlf/nothing") << QByteArray("ole\r\ndole\r\ndoffen") << (QStringList() << "ole" << "dole" << "doffen");
- // utf-16
if (!for_QString) {
+ // utf-8
+ QTest::newRow("utf8/twolines")
+ << QByteArray("\xef\xbb\xbf"
+ "\x66\x67\x65\x0a"
+ "\x66\x67\x65\x0a", 11)
+ << (QStringList() << "fge" << "fge");
+
+ // utf-16
// one line
QTest::newRow("utf16-BE/nothing")
<< QByteArray("\xfe\xff"
@@ -593,6 +600,18 @@ void tst_QTextStream::generateLineData(bool for_QString)
"\xe5\x00\x67\x00\x65\x00\x0a\x00"
"\xe5\x00\x67\x00\x65\x00\x0a\x00", 26)
<< (QStringList() << "\345ge" << "\345ge" << "\345ge");
+
+ // utf-32
+ QTest::newRow("utf32-BE/twolines")
+ << QByteArray("\x00\x00\xfe\xff"
+ "\x00\x00\x00\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a"
+ "\x00\x00\x00\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a", 36)
+ << (QStringList() << "\345ge" << "\345ge");
+ QTest::newRow("utf32-LE/twolines")
+ << QByteArray("\xff\xfe\x00\x00"
+ "\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a\x00\x00\x00"
+ "\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a\x00\x00\x00", 36)
+ << (QStringList() << "\345ge" << "\345ge");
}
// partials
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 0ede920..2d26914 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -2449,14 +2449,22 @@ void tst_QVariant::saveLoadCustomTypes()
void tst_QVariant::url()
{
- QUrl url("http://www.trolltech.com");
+ QString str("http://www.trolltech.com");
+ QUrl url(str);
- QVariant v(url);
+ QVariant v(url); //built with a QUrl
QVariant v2 = v;
- QVERIFY(v2.toUrl() == url);
+ QVariant v3(str); //built with a QString
+ QCOMPARE(v2.toUrl(), url);
+ QVERIFY(qVariantCanConvert<QUrl>(v3));
+ QCOMPARE(v2.toUrl(), v3.toUrl());
+
+ QVERIFY(qVariantCanConvert<QString>(v2));
+ QCOMPARE(v2.toString(), str);
+ QCOMPARE(v3.toString(), str);
}
void tst_QVariant::globalColor()
diff --git a/tests/auto/uiloader/baseline/css_task255849_downarrow.ui b/tests/auto/uiloader/baseline/css_task255849_downarrow.ui
new file mode 100644
index 0000000..d3e99b1
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_task255849_downarrow.ui
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>275</width>
+ <height>175</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">/* Some widget were not displaying the arrow if only the arrow was set */
+*::down-arrow { image: url(&quot;images/arrow-down.png&quot;) }
+*::up-arrow { image: url(&quot;images/arrow-up.png&quot;) }
+
+
+</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QComboBox" name="comboBox"/>
+ </item>
+ <item row="0" column="2" rowspan="5">
+ <widget class="QTreeWidget" name="treeWidget">
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerShowSortIndicator" stdset="0">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="headerShowSortIndicator" stdset="0">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </column>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QSpinBox" name="spinBox"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QToolButton" name="toolButton">
+ <property name="text">
+ <string>foo</string>
+ </property>
+ <property name="arrowType">
+ <enum>Qt::DownArrow</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox"/>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QPushButton" name="pushButton">
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/uiloader/baseline/images/arrow-down.png b/tests/auto/uiloader/baseline/images/arrow-down.png
new file mode 100644
index 0000000..7c9274f
--- /dev/null
+++ b/tests/auto/uiloader/baseline/images/arrow-down.png
Binary files differ
diff --git a/tests/auto/uiloader/baseline/images/arrow-up.png b/tests/auto/uiloader/baseline/images/arrow-up.png
new file mode 100644
index 0000000..758a0d1
--- /dev/null
+++ b/tests/auto/uiloader/baseline/images/arrow-up.png
Binary files differ
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index d8c3d33..79bcb80 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -17,7 +17,7 @@ h3.fn,span.fn
background-color: #eee;
border-width: 1px;
border-style: solid;
- border-color: #ddd #ddd #ddd #ddd ;
+ border-color: #ddd;
font-weight: bold;
padding: 6px 0px 6px 10px;
margin: 42px 0px 0px 0px;
@@ -25,7 +25,7 @@ h3.fn,span.fn
hr {
border: 0;
- color: #9E9E9E;
+ color: #a0a0a0;
background-color: #ccc;
height: 1px;
width: 100%;
@@ -33,29 +33,44 @@ hr {
margin: 34px 0px 34px 0px;
}
-table {
+table.valuelist {
border-width: 1px 1px 1px 1px;
border-style: solid;
border-color: #dddddd;
border-collapse: collapse;
background-color: #f0f0f0;
- margin-left: 1.5%;
- width: 97%
}
-table th {
+table.indextable {
+ border-width: 1px 1px 1px 1px;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+ border-color:#555;
+}
+
+
+table.valuelist th {
border-width: 1px 1px 1px 2px;
padding: 4px;
border-style: solid;
+ border-color: #666;
+ color:white;
+ background-color:#666;
+}
+
+th.titleheader {
+ border-width: 1px 0px 1px 0px;
+ padding: 4px;
+ border-style: solid;
border-color: #444;
color:white;
- background-color:#444;
+ background-color:#555555;
}
p {
- margin-left: 1.5%;
+
+ margin-left: 4px;
margin-top: 8px;
- width: 97%
margin-bottom: 8px;
}
@@ -101,42 +116,31 @@ body
color: black
}
+table.generic, table.annotated
+{
+ border-width: 1px;
+ border-color:#bbb;
+ border-style:solid;
+ border-collapse:collapse;
+}
+
table td.memItemLeft {
- width: 200px;
+ width: 160px;
padding: 2px 0px 0px 8px;
margin: 4px;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-color: #E0E0E0;
- border-right-color: #E0E0E0;
- border-bottom-color: #E0E0E0;
- border-left-color: #E0E0E0;
- border-top-style: none;
- border-right-style: none;
- border-bottom-style: none;
- border-left-style: none;
- background-color: #FAFAFA;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
font-size: 100%;
white-space: nowrap
}
+
table td.memItemRight {
padding: 2px 8px 0px 8px;
margin: 4px;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-color: #E0E0E0;
- border-right-color: #E0E0E0;
- border-bottom-color: #E0E0E0;
- border-left-color: #E0E0E0;
- border-top-style: none;
- border-right-style: none;
- border-bottom-style: none;
- border-left-style: none;
- background-color: #FAFAFA;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
font-size: 100%;
}