summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-30 13:28:49 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-30 13:28:49 (GMT)
commita08b3f5336e5c819b33d922d3a809b5203d728f3 (patch)
tree952f42304d50f28ed6651bace587ab7935b29cd0
parent813fc3574a006cb2687715ccf7bdb984a485b173 (diff)
parent188ac02e2fb6cc6437b776f8c5b69a508728fbdb (diff)
downloadQt-a08b3f5336e5c819b33d922d3a809b5203d728f3.zip
Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.tar.gz
Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: demos/demos.pro src/gui/graphicsview/qgraphicsitem_p.h
-rw-r--r--demos/demos.pro4
-rw-r--r--demos/qtdemo/xml/examples.xml2
-rw-r--r--demos/sub-attaq/animationmanager.cpp (renamed from examples/animation/sub-attaq/animationmanager.cpp)0
-rw-r--r--demos/sub-attaq/animationmanager.h (renamed from examples/animation/sub-attaq/animationmanager.h)0
-rw-r--r--demos/sub-attaq/boat.cpp (renamed from examples/animation/sub-attaq/boat.cpp)0
-rw-r--r--demos/sub-attaq/boat.h (renamed from examples/animation/sub-attaq/boat.h)0
-rw-r--r--demos/sub-attaq/boat_p.h (renamed from examples/animation/sub-attaq/boat_p.h)0
-rw-r--r--demos/sub-attaq/bomb.cpp (renamed from examples/animation/sub-attaq/bomb.cpp)0
-rw-r--r--demos/sub-attaq/bomb.h (renamed from examples/animation/sub-attaq/bomb.h)0
-rw-r--r--demos/sub-attaq/custompropertyanimation.cpp (renamed from examples/animation/sub-attaq/custompropertyanimation.cpp)0
-rw-r--r--demos/sub-attaq/custompropertyanimation.h (renamed from examples/animation/sub-attaq/custompropertyanimation.h)0
-rw-r--r--demos/sub-attaq/data.xml39
-rw-r--r--demos/sub-attaq/graphicsscene.cpp (renamed from examples/animation/sub-attaq/graphicsscene.cpp)0
-rw-r--r--demos/sub-attaq/graphicsscene.h (renamed from examples/animation/sub-attaq/graphicsscene.h)0
-rw-r--r--demos/sub-attaq/main.cpp (renamed from examples/animation/sub-attaq/main.cpp)0
-rw-r--r--demos/sub-attaq/mainwindow.cpp (renamed from examples/animation/sub-attaq/mainwindow.cpp)0
-rw-r--r--demos/sub-attaq/mainwindow.h (renamed from examples/animation/sub-attaq/mainwindow.h)0
-rw-r--r--demos/sub-attaq/pics/big/background.png (renamed from examples/animation/sub-attaq/pics/big/background.png)bin48858 -> 48858 bytes
-rw-r--r--demos/sub-attaq/pics/big/boat.png (renamed from examples/animation/sub-attaq/pics/big/boat.png)bin5198 -> 5198 bytes
-rw-r--r--demos/sub-attaq/pics/big/bomb.png (renamed from examples/animation/sub-attaq/pics/small/bomb.png)bin760 -> 760 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/boat/step1.png (renamed from examples/animation/sub-attaq/pics/big/explosion/boat/step1.png)bin5760 -> 5760 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/boat/step2.png (renamed from examples/animation/sub-attaq/pics/big/explosion/boat/step2.png)bin9976 -> 9976 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/boat/step3.png (renamed from examples/animation/sub-attaq/pics/big/explosion/boat/step3.png)bin12411 -> 12411 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/boat/step4.png (renamed from examples/animation/sub-attaq/pics/big/explosion/boat/step4.png)bin15438 -> 15438 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/submarine/step1.png (renamed from examples/animation/sub-attaq/pics/big/explosion/submarine/step1.png)bin3354 -> 3354 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/submarine/step2.png (renamed from examples/animation/sub-attaq/pics/big/explosion/submarine/step2.png)bin6205 -> 6205 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/submarine/step3.png (renamed from examples/animation/sub-attaq/pics/big/explosion/submarine/step3.png)bin6678 -> 6678 bytes
-rw-r--r--demos/sub-attaq/pics/big/explosion/submarine/step4.png (renamed from examples/animation/sub-attaq/pics/big/explosion/submarine/step4.png)bin6666 -> 6666 bytes
-rw-r--r--demos/sub-attaq/pics/big/submarine.png (renamed from examples/animation/sub-attaq/pics/big/submarine.png)bin3202 -> 3202 bytes
-rw-r--r--demos/sub-attaq/pics/big/surface.png (renamed from examples/animation/sub-attaq/pics/big/surface.png)bin575 -> 575 bytes
-rw-r--r--demos/sub-attaq/pics/big/torpedo.png (renamed from examples/animation/sub-attaq/pics/small/torpedo.png)bin951 -> 951 bytes
-rw-r--r--demos/sub-attaq/pics/scalable/background-n810.svg (renamed from examples/animation/sub-attaq/pics/scalable/background-n810.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/background.svg (renamed from examples/animation/sub-attaq/pics/scalable/background.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/boat.svg (renamed from examples/animation/sub-attaq/pics/scalable/boat.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/bomb.svg (renamed from examples/animation/sub-attaq/pics/scalable/bomb.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/sand.svg (renamed from examples/animation/sub-attaq/pics/scalable/sand.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/see.svg (renamed from examples/animation/sub-attaq/pics/scalable/see.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/sky.svg (renamed from examples/animation/sub-attaq/pics/scalable/sky.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/sub-attaq.svg (renamed from examples/animation/sub-attaq/pics/scalable/sub-attaq.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/submarine.svg (renamed from examples/animation/sub-attaq/pics/scalable/submarine.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/surface.svg (renamed from examples/animation/sub-attaq/pics/scalable/surface.svg)0
-rw-r--r--demos/sub-attaq/pics/scalable/torpedo.svg (renamed from examples/animation/sub-attaq/pics/scalable/torpedo.svg)0
-rw-r--r--demos/sub-attaq/pics/small/background.png (renamed from examples/animation/sub-attaq/pics/small/background.png)bin34634 -> 34634 bytes
-rw-r--r--demos/sub-attaq/pics/small/boat.png (renamed from examples/animation/sub-attaq/pics/small/boat.png)bin2394 -> 2394 bytes
-rw-r--r--demos/sub-attaq/pics/small/bomb.png (renamed from examples/animation/sub-attaq/pics/big/bomb.png)bin760 -> 760 bytes
-rw-r--r--demos/sub-attaq/pics/small/submarine.png (renamed from examples/animation/sub-attaq/pics/small/submarine.png)bin1338 -> 1338 bytes
-rw-r--r--demos/sub-attaq/pics/small/surface.png (renamed from examples/animation/sub-attaq/pics/small/surface.png)bin502 -> 502 bytes
-rw-r--r--demos/sub-attaq/pics/small/torpedo.png (renamed from examples/animation/sub-attaq/pics/big/torpedo.png)bin951 -> 951 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-a.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-a.png)bin5972 -> 5972 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-a2.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-a2.png)bin5969 -> 5969 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-b.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-b.png)bin6869 -> 6869 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-dash.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-dash.png)bin2255 -> 2255 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-excl.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-excl.png)bin2740 -> 2740 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-q.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-q.png)bin7016 -> 7016 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-s.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-s.png)bin5817 -> 5817 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-t.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-t.png)bin3717 -> 3717 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-t2.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-t2.png)bin3688 -> 3688 bytes
-rw-r--r--demos/sub-attaq/pics/welcome/logo-u.png (renamed from examples/animation/sub-attaq/pics/welcome/logo-u.png)bin5374 -> 5374 bytes
-rw-r--r--demos/sub-attaq/pixmapitem.cpp (renamed from examples/animation/sub-attaq/pixmapitem.cpp)0
-rw-r--r--demos/sub-attaq/pixmapitem.h (renamed from examples/animation/sub-attaq/pixmapitem.h)0
-rw-r--r--demos/sub-attaq/progressitem.cpp (renamed from examples/animation/sub-attaq/progressitem.cpp)0
-rw-r--r--demos/sub-attaq/progressitem.h (renamed from examples/animation/sub-attaq/progressitem.h)0
-rw-r--r--demos/sub-attaq/qanimationstate.cpp (renamed from examples/animation/sub-attaq/qanimationstate.cpp)0
-rw-r--r--demos/sub-attaq/qanimationstate.h (renamed from examples/animation/sub-attaq/qanimationstate.h)0
-rw-r--r--demos/sub-attaq/states.cpp (renamed from examples/animation/sub-attaq/states.cpp)0
-rw-r--r--demos/sub-attaq/states.h (renamed from examples/animation/sub-attaq/states.h)0
-rw-r--r--demos/sub-attaq/sub-attaq.pro (renamed from examples/animation/sub-attaq/sub-attaq.pro)5
-rw-r--r--demos/sub-attaq/subattaq.qrc (renamed from examples/animation/sub-attaq/subattaq.qrc)0
-rw-r--r--demos/sub-attaq/submarine.cpp (renamed from examples/animation/sub-attaq/submarine.cpp)11
-rw-r--r--demos/sub-attaq/submarine.h (renamed from examples/animation/sub-attaq/submarine.h)4
-rw-r--r--demos/sub-attaq/submarine_p.h (renamed from examples/animation/sub-attaq/submarine_p.h)4
-rw-r--r--demos/sub-attaq/torpedo.cpp (renamed from examples/animation/sub-attaq/torpedo.cpp)0
-rw-r--r--demos/sub-attaq/torpedo.h (renamed from examples/animation/sub-attaq/torpedo.h)0
-rw-r--r--doc/src/demos/sub-attaq.qdoc54
-rw-r--r--doc/src/images/sub-attaq-demo.pngbin0 -> 51552 bytes
-rw-r--r--examples/animation/animation.pro1
-rw-r--r--examples/animation/sub-attaq/data.xml15
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/io/qprocess_unix.cpp4
-rw-r--r--src/corelib/tools/qsharedpointer.cpp113
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h37
-rw-r--r--src/gui/graphicsview/graphicsview.pri4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp346
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h49
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h39
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp11
-rw-r--r--src/gui/graphicsview/qgraphicstransform.cpp479
-rw-r--r--src/gui/graphicsview/qgraphicstransform.h168
-rw-r--r--src/gui/graphicsview/qgraphicstransform_p.h73
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp34
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h8
-rw-r--r--src/gui/image/qimage.cpp15
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp152
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp322
-rw-r--r--src/gui/painting/qtransform.cpp36
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/styles/qstyleoption.cpp25
-rw-r--r--src/gui/text/qtextformat.cpp101
-rw-r--r--src/gui/widgets/qmenubar.cpp7
-rw-r--r--src/opengl/qglframebufferobject.cpp5
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp4
-rw-r--r--src/qt3support/sql/q3sqlcursor.cpp2
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp4
-rw-r--r--src/testlib/qtest.h25
-rw-r--r--src/xml/sax/qxml.cpp18
-rw-r--r--src/xml/sax/qxml.h1
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp158
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp69
-rw-r--r--tests/auto/qgraphicstransform/qgraphicstransform.pro2
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp162
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp11
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp4
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h10
-rw-r--r--tests/auto/qxml/tst_qxml.cpp26
-rw-r--r--tests/auto/selftests/cmptest/tst_cmptest.cpp46
-rw-r--r--tests/auto/selftests/expected_cmptest.txt20
-rw-r--r--tools/assistant/tools/qhelpconverter/adpreader.cpp20
-rw-r--r--tools/assistant/tools/qhelpconverter/adpreader.h6
-rw-r--r--tools/qdoc3/htmlgenerator.cpp13
-rw-r--r--tools/qdoc3/htmlgenerator.h1
-rwxr-xr-xutil/webkit/mkdist-webkit16
121 files changed, 1943 insertions, 847 deletions
diff --git a/demos/demos.pro b/demos/demos.pro
index 3856591..d734c05 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -13,7 +13,8 @@ SUBDIRS = \
demos_textedit \
demos_chip \
demos_embeddeddialogs \
- demos_undo
+ demos_undo \
+ demos_sub-attaq
symbian: SUBDIRS = \
demos_shared \
@@ -68,6 +69,7 @@ demos_mediaplayer.subdir = mediaplayer
demos_browser.subdir = browser
demos_boxes.subdir = boxes
+demos_sub-attaq.subdir = sub-attaq
#CONFIG += ordered
!ordered {
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 2560848..a81eead 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -18,6 +18,7 @@
<example filename="browser" name="Browser" />
<example filename="mediaplayer" name="Media Player" />
<example filename="boxes" name="Boxes" />
+ <example filename="sub-attaq" name="Sub-attaq" />
</demos>
<category dirname="animation" name="Animation Framework">
<example filename="animatedtiles" name="Animated Tiles" />
@@ -26,7 +27,6 @@
<example filename="moveblocks" name="Moving Blocks" />
<example filename="states" name="UI States" />
<example filename="stickman" name="Stickman" />
- <example filename="sub-attaq" name="Sub-attaq" />
</category>
<category dirname="qtconcurrent" name="Concurrent Programming">
<example filename="map" name="Map" executable="false" />
diff --git a/examples/animation/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp
index 13266f9..13266f9 100644
--- a/examples/animation/sub-attaq/animationmanager.cpp
+++ b/demos/sub-attaq/animationmanager.cpp
diff --git a/examples/animation/sub-attaq/animationmanager.h b/demos/sub-attaq/animationmanager.h
index 63ecae6..63ecae6 100644
--- a/examples/animation/sub-attaq/animationmanager.h
+++ b/demos/sub-attaq/animationmanager.h
diff --git a/examples/animation/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp
index 68e646e..68e646e 100644
--- a/examples/animation/sub-attaq/boat.cpp
+++ b/demos/sub-attaq/boat.cpp
diff --git a/examples/animation/sub-attaq/boat.h b/demos/sub-attaq/boat.h
index f6b1a90..f6b1a90 100644
--- a/examples/animation/sub-attaq/boat.h
+++ b/demos/sub-attaq/boat.h
diff --git a/examples/animation/sub-attaq/boat_p.h b/demos/sub-attaq/boat_p.h
index 4e962fc..4e962fc 100644
--- a/examples/animation/sub-attaq/boat_p.h
+++ b/demos/sub-attaq/boat_p.h
diff --git a/examples/animation/sub-attaq/bomb.cpp b/demos/sub-attaq/bomb.cpp
index e92a723..e92a723 100644
--- a/examples/animation/sub-attaq/bomb.cpp
+++ b/demos/sub-attaq/bomb.cpp
diff --git a/examples/animation/sub-attaq/bomb.h b/demos/sub-attaq/bomb.h
index ed6b0f5..ed6b0f5 100644
--- a/examples/animation/sub-attaq/bomb.h
+++ b/demos/sub-attaq/bomb.h
diff --git a/examples/animation/sub-attaq/custompropertyanimation.cpp b/demos/sub-attaq/custompropertyanimation.cpp
index 9282f42..9282f42 100644
--- a/examples/animation/sub-attaq/custompropertyanimation.cpp
+++ b/demos/sub-attaq/custompropertyanimation.cpp
diff --git a/examples/animation/sub-attaq/custompropertyanimation.h b/demos/sub-attaq/custompropertyanimation.h
index a984163..a984163 100644
--- a/examples/animation/sub-attaq/custompropertyanimation.h
+++ b/demos/sub-attaq/custompropertyanimation.h
diff --git a/demos/sub-attaq/data.xml b/demos/sub-attaq/data.xml
new file mode 100644
index 0000000..0f30515
--- /dev/null
+++ b/demos/sub-attaq/data.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<subattaq>
+ <submarines>
+ <submarine type="0" points="10" name="Q1" />
+ <submarine type="1" points="20" name="Q2" />
+ </submarines>
+ <levels>
+ <level id="0" name="Seaman recruit">
+ <subinstance type="0" nb="1"/>
+ </level>
+ <level id="1" name="Seaman apprentice">
+ <subinstance type="0" nb="2"/>
+ </level>
+ <level id="2" name="Seaman">
+ <subinstance type="0" nb="4"/>
+ </level>
+ <level id="3" name="Petty Officer Third Class">
+ <subinstance type="0" nb="6"/>
+ </level>
+ <level id="4" name="Petty Officer Second Class">
+ <subinstance type="0" nb="6"/>
+ </level>
+ <level id="5" name="Petty Officer First Class">
+ <subinstance type="0" nb="8"/>
+ </level>
+ <level id="6" name="Lieutenant">
+ <subinstance type="0" nb="10"/>
+ </level>
+ <level id="7" name="Commander">
+ <subinstance type="0" nb="15"/>
+ </level>
+ <level id="8" name="Captain">
+ <subinstance type="0" nb="12"/>
+ </level>
+ <level id="9" name="Admiral">
+ <subinstance type="0" nb="12"/>
+ </level>
+ </levels>
+</subattaq>
diff --git a/examples/animation/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp
index fcbc1b3..fcbc1b3 100644
--- a/examples/animation/sub-attaq/graphicsscene.cpp
+++ b/demos/sub-attaq/graphicsscene.cpp
diff --git a/examples/animation/sub-attaq/graphicsscene.h b/demos/sub-attaq/graphicsscene.h
index 068ee97..068ee97 100644
--- a/examples/animation/sub-attaq/graphicsscene.h
+++ b/demos/sub-attaq/graphicsscene.h
diff --git a/examples/animation/sub-attaq/main.cpp b/demos/sub-attaq/main.cpp
index 4f6f4f9..4f6f4f9 100644
--- a/examples/animation/sub-attaq/main.cpp
+++ b/demos/sub-attaq/main.cpp
diff --git a/examples/animation/sub-attaq/mainwindow.cpp b/demos/sub-attaq/mainwindow.cpp
index bcccd34..bcccd34 100644
--- a/examples/animation/sub-attaq/mainwindow.cpp
+++ b/demos/sub-attaq/mainwindow.cpp
diff --git a/examples/animation/sub-attaq/mainwindow.h b/demos/sub-attaq/mainwindow.h
index 08cfcd9..08cfcd9 100644
--- a/examples/animation/sub-attaq/mainwindow.h
+++ b/demos/sub-attaq/mainwindow.h
diff --git a/examples/animation/sub-attaq/pics/big/background.png b/demos/sub-attaq/pics/big/background.png
index 9f58157..9f58157 100644
--- a/examples/animation/sub-attaq/pics/big/background.png
+++ b/demos/sub-attaq/pics/big/background.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/boat.png b/demos/sub-attaq/pics/big/boat.png
index be82dff..be82dff 100644
--- a/examples/animation/sub-attaq/pics/big/boat.png
+++ b/demos/sub-attaq/pics/big/boat.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/small/bomb.png b/demos/sub-attaq/pics/big/bomb.png
index 3af5f2f..3af5f2f 100644
--- a/examples/animation/sub-attaq/pics/small/bomb.png
+++ b/demos/sub-attaq/pics/big/bomb.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step1.png b/demos/sub-attaq/pics/big/explosion/boat/step1.png
index c9fd8b0..c9fd8b0 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/boat/step1.png
+++ b/demos/sub-attaq/pics/big/explosion/boat/step1.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step2.png b/demos/sub-attaq/pics/big/explosion/boat/step2.png
index 7528f2d..7528f2d 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/boat/step2.png
+++ b/demos/sub-attaq/pics/big/explosion/boat/step2.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step3.png b/demos/sub-attaq/pics/big/explosion/boat/step3.png
index aae9c9c..aae9c9c 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/boat/step3.png
+++ b/demos/sub-attaq/pics/big/explosion/boat/step3.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step4.png b/demos/sub-attaq/pics/big/explosion/boat/step4.png
index d697c1b..d697c1b 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/boat/step4.png
+++ b/demos/sub-attaq/pics/big/explosion/boat/step4.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step1.png b/demos/sub-attaq/pics/big/explosion/submarine/step1.png
index 88ca514..88ca514 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/submarine/step1.png
+++ b/demos/sub-attaq/pics/big/explosion/submarine/step1.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step2.png b/demos/sub-attaq/pics/big/explosion/submarine/step2.png
index 524f589..524f589 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/submarine/step2.png
+++ b/demos/sub-attaq/pics/big/explosion/submarine/step2.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step3.png b/demos/sub-attaq/pics/big/explosion/submarine/step3.png
index 2cca1e8..2cca1e8 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/submarine/step3.png
+++ b/demos/sub-attaq/pics/big/explosion/submarine/step3.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step4.png b/demos/sub-attaq/pics/big/explosion/submarine/step4.png
index 82100a8..82100a8 100644
--- a/examples/animation/sub-attaq/pics/big/explosion/submarine/step4.png
+++ b/demos/sub-attaq/pics/big/explosion/submarine/step4.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/submarine.png b/demos/sub-attaq/pics/big/submarine.png
index df435dc..df435dc 100644
--- a/examples/animation/sub-attaq/pics/big/submarine.png
+++ b/demos/sub-attaq/pics/big/submarine.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/surface.png b/demos/sub-attaq/pics/big/surface.png
index 4eba29e..4eba29e 100644
--- a/examples/animation/sub-attaq/pics/big/surface.png
+++ b/demos/sub-attaq/pics/big/surface.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/small/torpedo.png b/demos/sub-attaq/pics/big/torpedo.png
index f9c2687..f9c2687 100644
--- a/examples/animation/sub-attaq/pics/small/torpedo.png
+++ b/demos/sub-attaq/pics/big/torpedo.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/scalable/background-n810.svg b/demos/sub-attaq/pics/scalable/background-n810.svg
index ece9f7a..ece9f7a 100644
--- a/examples/animation/sub-attaq/pics/scalable/background-n810.svg
+++ b/demos/sub-attaq/pics/scalable/background-n810.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/background.svg b/demos/sub-attaq/pics/scalable/background.svg
index 0be2680..0be2680 100644
--- a/examples/animation/sub-attaq/pics/scalable/background.svg
+++ b/demos/sub-attaq/pics/scalable/background.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/boat.svg b/demos/sub-attaq/pics/scalable/boat.svg
index 5298821b..5298821b 100644
--- a/examples/animation/sub-attaq/pics/scalable/boat.svg
+++ b/demos/sub-attaq/pics/scalable/boat.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/bomb.svg b/demos/sub-attaq/pics/scalable/bomb.svg
index 294771a..294771a 100644
--- a/examples/animation/sub-attaq/pics/scalable/bomb.svg
+++ b/demos/sub-attaq/pics/scalable/bomb.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/sand.svg b/demos/sub-attaq/pics/scalable/sand.svg
index 8af11b7..8af11b7 100644
--- a/examples/animation/sub-attaq/pics/scalable/sand.svg
+++ b/demos/sub-attaq/pics/scalable/sand.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/see.svg b/demos/sub-attaq/pics/scalable/see.svg
index 0666691..0666691 100644
--- a/examples/animation/sub-attaq/pics/scalable/see.svg
+++ b/demos/sub-attaq/pics/scalable/see.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/sky.svg b/demos/sub-attaq/pics/scalable/sky.svg
index 1546c08..1546c08 100644
--- a/examples/animation/sub-attaq/pics/scalable/sky.svg
+++ b/demos/sub-attaq/pics/scalable/sky.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/sub-attaq.svg b/demos/sub-attaq/pics/scalable/sub-attaq.svg
index b075179..b075179 100644
--- a/examples/animation/sub-attaq/pics/scalable/sub-attaq.svg
+++ b/demos/sub-attaq/pics/scalable/sub-attaq.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/submarine.svg b/demos/sub-attaq/pics/scalable/submarine.svg
index 8a0ffdd..8a0ffdd 100644
--- a/examples/animation/sub-attaq/pics/scalable/submarine.svg
+++ b/demos/sub-attaq/pics/scalable/submarine.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/surface.svg b/demos/sub-attaq/pics/scalable/surface.svg
index 40ed239..40ed239 100644
--- a/examples/animation/sub-attaq/pics/scalable/surface.svg
+++ b/demos/sub-attaq/pics/scalable/surface.svg
diff --git a/examples/animation/sub-attaq/pics/scalable/torpedo.svg b/demos/sub-attaq/pics/scalable/torpedo.svg
index 48e429d..48e429d 100644
--- a/examples/animation/sub-attaq/pics/scalable/torpedo.svg
+++ b/demos/sub-attaq/pics/scalable/torpedo.svg
diff --git a/examples/animation/sub-attaq/pics/small/background.png b/demos/sub-attaq/pics/small/background.png
index 5ad3db6..5ad3db6 100644
--- a/examples/animation/sub-attaq/pics/small/background.png
+++ b/demos/sub-attaq/pics/small/background.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/small/boat.png b/demos/sub-attaq/pics/small/boat.png
index 114ccc3..114ccc3 100644
--- a/examples/animation/sub-attaq/pics/small/boat.png
+++ b/demos/sub-attaq/pics/small/boat.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/bomb.png b/demos/sub-attaq/pics/small/bomb.png
index 3af5f2f..3af5f2f 100644
--- a/examples/animation/sub-attaq/pics/big/bomb.png
+++ b/demos/sub-attaq/pics/small/bomb.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/small/submarine.png b/demos/sub-attaq/pics/small/submarine.png
index 0c0c350..0c0c350 100644
--- a/examples/animation/sub-attaq/pics/small/submarine.png
+++ b/demos/sub-attaq/pics/small/submarine.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/small/surface.png b/demos/sub-attaq/pics/small/surface.png
index 06d0e47..06d0e47 100644
--- a/examples/animation/sub-attaq/pics/small/surface.png
+++ b/demos/sub-attaq/pics/small/surface.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/torpedo.png b/demos/sub-attaq/pics/small/torpedo.png
index f9c2687..f9c2687 100644
--- a/examples/animation/sub-attaq/pics/big/torpedo.png
+++ b/demos/sub-attaq/pics/small/torpedo.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-a.png b/demos/sub-attaq/pics/welcome/logo-a.png
index 67dd76d..67dd76d 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-a.png
+++ b/demos/sub-attaq/pics/welcome/logo-a.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-a2.png b/demos/sub-attaq/pics/welcome/logo-a2.png
index 17668b0..17668b0 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-a2.png
+++ b/demos/sub-attaq/pics/welcome/logo-a2.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-b.png b/demos/sub-attaq/pics/welcome/logo-b.png
index cf6c045..cf6c045 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-b.png
+++ b/demos/sub-attaq/pics/welcome/logo-b.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-dash.png b/demos/sub-attaq/pics/welcome/logo-dash.png
index 219233c..219233c 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-dash.png
+++ b/demos/sub-attaq/pics/welcome/logo-dash.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-excl.png b/demos/sub-attaq/pics/welcome/logo-excl.png
index 8dd0a2e..8dd0a2e 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-excl.png
+++ b/demos/sub-attaq/pics/welcome/logo-excl.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-q.png b/demos/sub-attaq/pics/welcome/logo-q.png
index 86e588d..86e588d 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-q.png
+++ b/demos/sub-attaq/pics/welcome/logo-q.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-s.png b/demos/sub-attaq/pics/welcome/logo-s.png
index 7b6a36e..7b6a36e 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-s.png
+++ b/demos/sub-attaq/pics/welcome/logo-s.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-t.png b/demos/sub-attaq/pics/welcome/logo-t.png
index b2e3526..b2e3526 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-t.png
+++ b/demos/sub-attaq/pics/welcome/logo-t.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-t2.png b/demos/sub-attaq/pics/welcome/logo-t2.png
index b11a778..b11a778 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-t2.png
+++ b/demos/sub-attaq/pics/welcome/logo-t2.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/welcome/logo-u.png b/demos/sub-attaq/pics/welcome/logo-u.png
index 24eede8..24eede8 100644
--- a/examples/animation/sub-attaq/pics/welcome/logo-u.png
+++ b/demos/sub-attaq/pics/welcome/logo-u.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pixmapitem.cpp b/demos/sub-attaq/pixmapitem.cpp
index ed0f075..ed0f075 100644
--- a/examples/animation/sub-attaq/pixmapitem.cpp
+++ b/demos/sub-attaq/pixmapitem.cpp
diff --git a/examples/animation/sub-attaq/pixmapitem.h b/demos/sub-attaq/pixmapitem.h
index e32973e..e32973e 100644
--- a/examples/animation/sub-attaq/pixmapitem.h
+++ b/demos/sub-attaq/pixmapitem.h
diff --git a/examples/animation/sub-attaq/progressitem.cpp b/demos/sub-attaq/progressitem.cpp
index 9ccaa72..9ccaa72 100644
--- a/examples/animation/sub-attaq/progressitem.cpp
+++ b/demos/sub-attaq/progressitem.cpp
diff --git a/examples/animation/sub-attaq/progressitem.h b/demos/sub-attaq/progressitem.h
index 7be57c9..7be57c9 100644
--- a/examples/animation/sub-attaq/progressitem.h
+++ b/demos/sub-attaq/progressitem.h
diff --git a/examples/animation/sub-attaq/qanimationstate.cpp b/demos/sub-attaq/qanimationstate.cpp
index 4e6df56..4e6df56 100644
--- a/examples/animation/sub-attaq/qanimationstate.cpp
+++ b/demos/sub-attaq/qanimationstate.cpp
diff --git a/examples/animation/sub-attaq/qanimationstate.h b/demos/sub-attaq/qanimationstate.h
index 6c5b565..6c5b565 100644
--- a/examples/animation/sub-attaq/qanimationstate.h
+++ b/demos/sub-attaq/qanimationstate.h
diff --git a/examples/animation/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp
index d63737f..d63737f 100644
--- a/examples/animation/sub-attaq/states.cpp
+++ b/demos/sub-attaq/states.cpp
diff --git a/examples/animation/sub-attaq/states.h b/demos/sub-attaq/states.h
index c3d81e7..c3d81e7 100644
--- a/examples/animation/sub-attaq/states.h
+++ b/demos/sub-attaq/states.h
diff --git a/examples/animation/sub-attaq/sub-attaq.pro b/demos/sub-attaq/sub-attaq.pro
index d13a099..ad1327d 100644
--- a/examples/animation/sub-attaq/sub-attaq.pro
+++ b/demos/sub-attaq/sub-attaq.pro
@@ -30,7 +30,8 @@ SOURCES += boat.cpp \
RESOURCES += subattaq.qrc
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/animation/sub-attaq
+target.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS sub-attaq.pro pics
-sources.path = $$[QT_INSTALL_EXAMPLES]/animation/sub-attaq
+sources.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq
INSTALLS += target sources
+
diff --git a/examples/animation/sub-attaq/subattaq.qrc b/demos/sub-attaq/subattaq.qrc
index 80a3af1..80a3af1 100644
--- a/examples/animation/sub-attaq/subattaq.qrc
+++ b/demos/sub-attaq/subattaq.qrc
diff --git a/examples/animation/sub-attaq/submarine.cpp b/demos/sub-attaq/submarine.cpp
index 78a9539..029e04b 100644
--- a/examples/animation/sub-attaq/submarine.cpp
+++ b/demos/sub-attaq/submarine.cpp
@@ -109,7 +109,14 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
setZValue(5);
setFlags(QGraphicsItem::ItemIsMovable);
resize(pixmapItem->boundingRect().width(),pixmapItem->boundingRect().height());
- setTransformOrigin(boundingRect().center());
+ setTransformOriginPoint(boundingRect().center());
+
+ graphicsRotation = new QGraphicsRotation3D(this);
+ graphicsRotation->setAxis(QVector3D(0, 1, 0));
+ graphicsRotation->setOrigin(QPointF(size().width()/2, size().height()/2));
+ QList<QGraphicsTransform *> r;
+ r.append(graphicsRotation);
+ setTransformations(r);
//We setup the state machine of the submarine
QStateMachine *machine = new QStateMachine(this);
@@ -166,7 +173,7 @@ void SubMarine::setCurrentDirection(SubMarine::Movement direction)
if (this->direction == direction)
return;
if (direction == SubMarine::Right && this->direction == SubMarine::None) {
- setYRotation(180);
+ graphicsRotation->setAngle(180);
}
this->direction = direction;
}
diff --git a/examples/animation/sub-attaq/submarine.h b/demos/sub-attaq/submarine.h
index 481e816..564e9c6 100644
--- a/examples/animation/sub-attaq/submarine.h
+++ b/demos/sub-attaq/submarine.h
@@ -45,6 +45,7 @@
//Qt
#include <QtCore/QVariantAnimation>
#include <QtGui/QGraphicsWidget>
+#include <QtGui/QGraphicsTransform>
class PixmapItem;
@@ -75,6 +76,8 @@ public:
virtual int type() const;
+ QGraphicsRotation3D *rotation3d() const { return graphicsRotation; }
+
signals:
void subMarineDestroyed();
void subMarineExecutionFinished();
@@ -87,6 +90,7 @@ private:
int speed;
Movement direction;
PixmapItem *pixmapItem;
+ QGraphicsRotation3D *graphicsRotation;
};
#endif //__SUBMARINE__H__
diff --git a/examples/animation/sub-attaq/submarine_p.h b/demos/sub-attaq/submarine_p.h
index e8df877..c04b25b 100644
--- a/examples/animation/sub-attaq/submarine_p.h
+++ b/demos/sub-attaq/submarine_p.h
@@ -109,7 +109,7 @@ class ReturnState : public QAnimationState
public:
ReturnState(SubMarine *submarine, QState *parent = 0) : QAnimationState(parent)
{
- returnAnimation = new QPropertyAnimation(submarine, "yRotation");
+ returnAnimation = new QPropertyAnimation(submarine->rotation3d(), "angle");
AnimationManager::self()->registerAnimation(returnAnimation);
setAnimation(returnAnimation);
this->submarine = submarine;
@@ -119,7 +119,7 @@ protected:
void onEntry(QEvent *e)
{
returnAnimation->stop();
- returnAnimation->setStartValue(submarine->yRotation());
+ returnAnimation->setStartValue(submarine->rotation3d()->angle());
returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
returnAnimation->setDuration(500);
QAnimationState::onEntry(e);
diff --git a/examples/animation/sub-attaq/torpedo.cpp b/demos/sub-attaq/torpedo.cpp
index fe79488..fe79488 100644
--- a/examples/animation/sub-attaq/torpedo.cpp
+++ b/demos/sub-attaq/torpedo.cpp
diff --git a/examples/animation/sub-attaq/torpedo.h b/demos/sub-attaq/torpedo.h
index c44037f..c44037f 100644
--- a/examples/animation/sub-attaq/torpedo.h
+++ b/demos/sub-attaq/torpedo.h
diff --git a/doc/src/demos/sub-attaq.qdoc b/doc/src/demos/sub-attaq.qdoc
new file mode 100644
index 0000000..6bbf763
--- /dev/null
+++ b/doc/src/demos/sub-attaq.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example demos/sub-attaq
+ \title Sub-Attaq
+
+ This demo shows Qt's ability to combine \l{The Animation Framework}{the animation framework}
+ and \l{The State Machine Framework}{the state machine framework} to create a game.
+
+ \image sub-attaq-demo.png
+
+ The purpose of the game is to destroy all submarines to win the current level.
+ The boat can be controlled using left and right keys. To fire a bomb you can press
+ up and down keys.
+*/
diff --git a/doc/src/images/sub-attaq-demo.png b/doc/src/images/sub-attaq-demo.png
new file mode 100644
index 0000000..5a35ec6
--- /dev/null
+++ b/doc/src/images/sub-attaq-demo.png
Binary files differ
diff --git a/examples/animation/animation.pro b/examples/animation/animation.pro
index 9a2874b..c72c532 100644
--- a/examples/animation/animation.pro
+++ b/examples/animation/animation.pro
@@ -7,7 +7,6 @@ SUBDIRS += \
moveblocks \
states \
stickman \
- sub-attaq
# install
target.path = $$[QT_INSTALL_EXAMPLES]/animation
diff --git a/examples/animation/sub-attaq/data.xml b/examples/animation/sub-attaq/data.xml
deleted file mode 100644
index 41d4754..0000000
--- a/examples/animation/sub-attaq/data.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<subattaq>
- <submarines>
- <submarine type="0" points="10" name="Q1" />
- <submarine type="1" points="20" name="Q2" />
- </submarines>
- <levels>
- <level id="0" name="Seaman recruit">
- <subinstance type="0" nb="2"/>
- </level>
- <level id="1" name="Seaman apprentice">
- <subinstance type="0" nb="4"/>
- </level>
- </levels>
-</subattaq>
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 5e5ce49..dd876f5 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -681,6 +681,9 @@ namespace QT_NAMESPACE {}
// using CC 5.9: Warning: attribute visibility is unsupported and will be skipped..
//# define Q_DECL_EXPORT __attribute__((__visibility__("default")))
# endif
+# if __SUNPRO_CC < 0x5a0
+# define Q_NO_TEMPLATE_FRIENDS
+# endif
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
# endif
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index fafce07..607b734 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1161,10 +1161,10 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
// To catch the startup of the child
int startedPipe[2];
- ::pipe(startedPipe);
+ qt_safe_pipe(startedPipe);
// To communicate the pid of the child
int pidPipe[2];
- ::pipe(pidPipe);
+ qt_safe_pipe(pidPipe);
pid_t childPid = qt_fork();
if (childPid == 0) {
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 596a125..a186771 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -808,29 +808,19 @@
# endif
# endif
-# if !defined(BACKTRACE_SUPPORTED)
-// Dummy implementation of the functions.
-// Using QHashDummyValue also means that the QHash below is actually a QSet
-typedef QT_PREPEND_NAMESPACE(QHashDummyValue) Backtrace;
-
-static inline Backtrace saveBacktrace() { return Backtrace(); }
-static inline void printBacktrace(Backtrace) { }
-
-# else
+# if defined(BACKTRACE_SUPPORTED)
# include <sys/types.h>
# include <execinfo.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/wait.h>
-typedef QT_PREPEND_NAMESPACE(QByteArray) Backtrace;
-
-static inline Backtrace saveBacktrace() __attribute__((always_inline));
-static inline Backtrace saveBacktrace()
+static inline QByteArray saveBacktrace() __attribute__((always_inline));
+static inline QByteArray saveBacktrace()
{
static const int maxFrames = 32;
- Backtrace stacktrace;
+ QByteArray stacktrace;
stacktrace.resize(sizeof(void*) * maxFrames);
int stack_size = backtrace((void**)stacktrace.data(), maxFrames);
stacktrace.resize(sizeof(void*) * stack_size);
@@ -838,7 +828,7 @@ static inline Backtrace saveBacktrace()
return stacktrace;
}
-static void printBacktrace(Backtrace stacktrace)
+static void printBacktrace(QByteArray stacktrace)
{
void *const *stack = (void *const *)stacktrace.constData();
int stack_size = stacktrace.size() / sizeof(void*);
@@ -889,11 +879,19 @@ static void printBacktrace(Backtrace stacktrace)
namespace {
QT_USE_NAMESPACE
+ struct Data {
+ const volatile void *pointer;
+# ifdef BACKTRACE_SUPPORTED
+ QByteArray backtrace;
+# endif
+ };
+
class KnownPointers
{
public:
QMutex mutex;
- QHash<void *, Backtrace> values;
+ QHash<const void *, Data> dPointers;
+ QHash<const volatile void *, const void *> dataPointers;
};
}
@@ -901,38 +899,101 @@ Q_GLOBAL_STATIC(KnownPointers, knownPointers)
QT_BEGIN_NAMESPACE
+namespace QtSharedPointer {
+ Q_CORE_EXPORT void internalSafetyCheckAdd(const volatile void *);
+ Q_CORE_EXPORT void internalSafetyCheckRemove(const volatile void *);
+}
+
+/*!
+ \internal
+*/
+void QtSharedPointer::internalSafetyCheckAdd(const volatile void *)
+{
+ // Qt 4.5 compatibility
+ // this function is broken by design, so it was replaced with internalSafetyCheckAdd2
+ //
+ // it's broken because we tracked the pointers added and
+ // removed from QSharedPointer, converted to void*.
+ // That is, this is supposed to track the "top-of-object" pointer in
+ // case of multiple inheritance.
+ //
+ // However, it doesn't work well in some compilers:
+ // if you create an object with a class of type A and the last reference
+ // is dropped of type B, then the value passed to internalSafetyCheckRemove could
+ // be different than was added. That would leave dangling addresses.
+ //
+ // So instead, we track the pointer by the d-pointer instead.
+}
+
/*!
\internal
*/
-void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr)
+void QtSharedPointer::internalSafetyCheckRemove(const volatile void *)
{
+ // Qt 4.5 compatibility
+ // see comments above
+}
+
+/*!
+ \internal
+*/
+void QtSharedPointer::internalSafetyCheckAdd2(const void *d_ptr, const volatile void *ptr)
+{
+ // see comments above for the rationale for this function
KnownPointers *const kp = knownPointers();
if (!kp)
return; // end-game: the application is being destroyed already
QMutexLocker lock(&kp->mutex);
- void *actual = const_cast<void*>(ptr);
- if (kp->values.contains(actual)) {
- printBacktrace(knownPointers()->values.value(actual));
- qFatal("QSharedPointerData: internal self-check failed: pointer %p was already tracked "
- "by another QSharedPointerData object", actual);
+ Q_ASSERT(!kp->dPointers.contains(d_ptr));
+
+ //qDebug("Adding d=%p value=%p", d_ptr, ptr);
+
+ const void *other_d_ptr = kp->dataPointers.value(ptr, 0);
+ if (other_d_ptr) {
+# ifdef BACKTRACE_SUPPORTED
+ printBacktrace(knownPointers()->dPointers.value(other_d_ptr).backtrace);
+# endif
+ qFatal("QSharedPointer: internal self-check failed: pointer %p was already tracked "
+ "by another QSharedPointer object %p", ptr, other_d_ptr);
}
- kp->values.insert(actual, saveBacktrace());
+ Data data;
+ data.pointer = ptr;
+# ifdef BACKTRACE_SUPPORTED
+ data.backtrace = saveBacktrace();
+# endif
+
+ kp->dPointers.insert(d_ptr, data);
+ kp->dataPointers.insert(ptr, d_ptr);
}
/*!
\internal
*/
-void QtSharedPointer::internalSafetyCheckRemove(const volatile void *ptr)
+void QtSharedPointer::internalSafetyCheckRemove2(const void *d_ptr)
{
KnownPointers *const kp = knownPointers();
if (!kp)
return; // end-game: the application is being destroyed already
QMutexLocker lock(&kp->mutex);
- void *actual = const_cast<void*>(ptr);
- kp->values.remove(actual);
+
+ QHash<const void *, Data>::iterator it = kp->dPointers.find(d_ptr);
+ if (it == kp->dPointers.end()) {
+ qFatal("QSharedPointer: internal self-check inconsistency: pointer %p was not tracked. "
+ "To use QT_SHAREDPOINTER_TRACK_POINTERS, you have to enable it throughout "
+ "in your code.", d_ptr);
+ }
+
+ QHash<const volatile void *, const void *>::iterator it2 = kp->dataPointers.find(it->pointer);
+ Q_ASSERT(it2 != kp->dataPointers.end());
+
+ //qDebug("Removing d=%p value=%p", d_ptr, it->pointer);
+
+ // remove entries
+ kp->dataPointers.erase(it2);
+ kp->dPointers.erase(it);
}
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index d9fc73c..657c45a 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -98,9 +98,9 @@ namespace QtSharedPointer {
template <class X, class Y> QSharedPointer<X> copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src);
// used in debug mode to verify the reuse of pointers
- Q_CORE_EXPORT void internalSafetyCheckAdd(const volatile void *);
- Q_CORE_EXPORT void internalSafetyCheckRemove(const volatile void *);
-
+ Q_CORE_EXPORT void internalSafetyCheckAdd2(const void *, const volatile void *);
+ Q_CORE_EXPORT void internalSafetyCheckRemove2(const void *);
+
template <class T, typename Klass, typename RetVal>
inline void executeDeleter(T *t, RetVal (Klass:: *memberDeleter)())
{ (t->*memberDeleter)(); }
@@ -152,17 +152,8 @@ namespace QtSharedPointer {
inline void internalConstruct(T *ptr)
{
-#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- if (ptr) internalSafetyCheckAdd(ptr);
-#endif
value = ptr;
}
- inline void internalDestroy()
- {
-#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- if (value) internalSafetyCheckRemove(value);
-#endif
- }
#if defined(Q_NO_TEMPLATE_FRIENDS)
public:
@@ -241,7 +232,6 @@ namespace QtSharedPointer {
struct ExternalRefCountWithContiguousData: public ExternalRefCountWithDestroyFn
{
typedef ExternalRefCountWithDestroyFn Parent;
- typedef ExternalRefCountWithContiguousData Self;
T data;
static void deleter(ExternalRefCountData *self)
@@ -254,7 +244,8 @@ namespace QtSharedPointer {
static inline ExternalRefCountData *create(T **ptr)
{
DestroyerFn destroy = &deleter;
- Self *d = static_cast<Self *>(::operator new(sizeof(Self)));
+ ExternalRefCountWithContiguousData *d =
+ static_cast<ExternalRefCountWithContiguousData *>(::operator new(sizeof(ExternalRefCountWithContiguousData)));
// initialize the d-pointer sub-object
// leave d->data uninitialized
@@ -279,8 +270,9 @@ namespace QtSharedPointer {
inline void ref() const { d->weakref.ref(); d->strongref.ref(); }
inline bool deref()
{
- if (!d->strongref.deref())
- this->internalDestroy();
+ if (!d->strongref.deref()) {
+ internalDestroy();
+ }
return d->weakref.deref();
}
@@ -290,6 +282,9 @@ namespace QtSharedPointer {
Q_ASSERT(!d);
if (ptr)
d = new Data;
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ if (ptr) internalSafetyCheckAdd2(d, ptr);
+#endif
}
template <typename Deleter>
@@ -299,6 +294,9 @@ namespace QtSharedPointer {
Q_ASSERT(!d);
if (ptr)
d = ExternalRefCountWithCustomDeleter<T, Deleter>::create(ptr, deleter);
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ if (ptr) internalSafetyCheckAdd2(d, ptr);
+#endif
}
inline void internalCreate()
@@ -307,6 +305,9 @@ namespace QtSharedPointer {
d = ExternalRefCountWithContiguousData<T>::create(&ptr);
Basic<T>::internalConstruct(ptr);
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ if (ptr) internalSafetyCheckAdd2(d, ptr);
+#endif
}
inline ExternalRefCount() : d(0) { }
@@ -322,7 +323,9 @@ namespace QtSharedPointer {
inline void internalDestroy()
{
- Basic<T>::internalDestroy();
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ internalSafetyCheckRemove2(d);
+#endif
if (!d->destroy())
delete this->value;
}
diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri
index 0c0747e..9d232e4 100644
--- a/src/gui/graphicsview/graphicsview.pri
+++ b/src/gui/graphicsview/graphicsview.pri
@@ -16,12 +16,13 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \
graphicsview/qgraphicssceneevent.h \
graphicsview/qgraphicssceneindex_p.h \
graphicsview/qgraphicsscenelinearindex_p.h \
+ graphicsview/qgraphicstransform.h \
+ graphicsview/qgraphicstransform_p.h \
graphicsview/qgraphicsview.h \
graphicsview/qgraphicsview_p.h \
graphicsview/qgraphicswidget.h \
graphicsview/qgraphicswidget_p.h \
graphicsview/qgridlayoutengine_p.h
-
SOURCES += graphicsview/qgraphicsgridlayout.cpp \
graphicsview/qgraphicsitem.cpp \
graphicsview/qgraphicsitemanimation.cpp \
@@ -36,6 +37,7 @@ SOURCES += graphicsview/qgraphicsgridlayout.cpp \
graphicsview/qgraphicssceneevent.cpp \
graphicsview/qgraphicssceneindex.cpp \
graphicsview/qgraphicsscenelinearindex.cpp \
+ graphicsview/qgraphicstransform.cpp \
graphicsview/qgraphicsview.cpp \
graphicsview/qgraphicswidget.cpp \
graphicsview/qgraphicswidget_p.cpp \
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 5b769ab..731a9a9 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -303,11 +303,12 @@
drop shadow effects and for decoration objects that follow the parent
item's geometry without drawing on top of it.
- \value ItemUsesExtendedStyleOption The item makes use of either
- QStyleOptionGraphicsItem::exposedRect or QStyleOptionGraphicsItem::matrix.
+ \value ItemUsesExtendedStyleOption The item makes use of either the
+ exposedRect or matrix member of the QStyleOptionGraphicsItem. Implementers
+ of QGraphicsItem subclasses should set that flag if this data is required.
By default, the exposedRect is initialized to the item's boundingRect and
the matrix is untransformed. Enable this flag for more fine-grained values.
- Use QStyleOptionGraphicsItem::levelOfDetailFromTransform for a more
+ Use QStyleOptionGraphicsItem::levelOfDetailFromTransform() for a more
fine-grained value.
\value ItemHasNoContents The item does not paint anything (i.e., calling
@@ -1197,6 +1198,13 @@ QGraphicsItem::~QGraphicsItem()
else
d_ptr->setParentItemHelper(0);
+ if (d_ptr->transformData) {
+ for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
+ QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
+ static_cast<QGraphicsTransformPrivate *>(t->d_ptr)->item = 0;
+ delete t;
+ }
+ }
delete d_ptr->transformData;
qt_dataStore()->data.remove(this);
@@ -2979,94 +2987,19 @@ QTransform QGraphicsItem::transform() const
/*!
\since 4.6
- Returns the rotation around the X axis.
-
- The default is 0
-
- \warning The value doesn't take in account any rotation set with
- the setTransform() method.
-
- \sa setXRotation(), {Transformations}
-*/
-qreal QGraphicsItem::xRotation() const
-{
- if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->xRotation;
-}
-
-/*!
- \since 4.6
-
- Sets the rotation around the X axis to \a angle degrees.
-
- \warning The value doesn't take in account any rotation set with the setTransform() method.
-
- \sa xRotation(), setTransformOrigin(), {Transformations}
-*/
-void QGraphicsItem::setXRotation(qreal angle)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xRotation = angle;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
- Returns the rotation around the Y axis.
-
- The default is 0
-
- \warning The value doesn't take in account any rotation set with the setTransform() method.
-
- \sa setYRotation(), {Transformations}
-*/
-qreal QGraphicsItem::yRotation() const
-{
- if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->yRotation;
-}
-
-/*!
- \since 4.6
-
- Sets the rotation around the Y axis to \a angle degrees.
-
- \warning The value doesn't take in account any rotation set with the setTransform() method.
-
- \sa yRotation(), setTransformOrigin() {Transformations}
-*/
-void QGraphicsItem::setYRotation(qreal angle)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->yRotation = angle;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
Returns the rotation around the Z axis.
The default is 0
\warning The value doesn't take in account any rotation set with the setTransform() method.
- \sa setZRotation(), {Transformations}
+ \sa setRotation(), {Transformations}
*/
-qreal QGraphicsItem::zRotation() const
+qreal QGraphicsItem::rotation() const
{
if (!d_ptr->transformData)
return 0;
- return d_ptr->transformData->zRotation;
+ return d_ptr->transformData->rotation;
}
/*!
@@ -3076,224 +3009,107 @@ qreal QGraphicsItem::zRotation() const
\warning The value doesn't take in account any rotation set with the setTransform() method.
- \sa zRotation(), setTransformOrigin(), {Transformations}
+ \sa rotation(), setTransformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setZRotation(qreal angle)
+void QGraphicsItem::setRotation(qreal angle)
{
prepareGeometryChange();
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->zRotation = angle;
+ d_ptr->transformData->rotation = angle;
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
- This convenience function set the rotation angles around the 3 axes
- to \a x, \a y and \a z.
-
- \sa setXRotation(), setYRotation(), setZRotation(), {Transformations}
-*/
-void QGraphicsItem::setRotation(qreal x, qreal y, qreal z)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xRotation = x;
- d_ptr->transformData->yRotation = y;
- d_ptr->transformData->zRotation = z;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
+ if (d_ptr->isObject)
+ emit static_cast<QGraphicsObject *>(this)->rotationChanged();
}
/*!
\since 4.6
- Returns the scale factor on the X axis.
+ Returns the scale factor of the item.
The default is 1
\warning The value doesn't take in account any scaling set with the setTransform() method.
- \sa setXScale(), {Transformations}
+ \sa setScale(), {Transformations}
*/
-qreal QGraphicsItem::xScale() const
+qreal QGraphicsItem::scale() const
{
if (!d_ptr->transformData)
- return 1;
- return d_ptr->transformData->xScale;
+ return 1.;
+ return d_ptr->transformData->scale;
}
/*!
\since 4.6
- Sets the scale factor on the X axis to \a factor.
+ Sets the scale factor of the item to \a factor.
\warning The value doesn't take in account any scaling set with the setTransform() method.
- \sa xScale(), setTransformOrigin(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setXScale(qreal factor)
+void QGraphicsItem::setScale(qreal factor)
{
prepareGeometryChange();
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xScale = factor;
+ d_ptr->transformData->scale = factor;
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
- Returns the scale factor on the Y axis.
-
- The default is 1
-
- \warning The value doesn't take in account any scaling set with the setTransform() method.
-
- \sa setYScale(), {Transformations}
-*/
-qreal QGraphicsItem::yScale() const
-{
- if (!d_ptr->transformData)
- return 1;
- return d_ptr->transformData->yScale;
-}
-
-/*!
- \since 4.6
-
- Sets the scale factor on the Y axis to \a factor.
- \warning The value doesn't take in account any scaling set with the setTransform() method.
-
- \sa yScale(), setTransformOrigin(), {Transformations}
-*/
-void QGraphicsItem::setYScale(qreal factor)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->yScale = factor;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
+ if (d_ptr->isObject)
+ emit static_cast<QGraphicsObject *>(this)->scaleChanged();
}
-/*!
- \since 4.6
-
- This convenience function set the scaling factors on X and Y axis to \a sx and \a sy.
-
- \warning The value doesn't take in account any scaling set with the setTransform() method.
-
- \sa setXScale(), setYScale(), {Transformations}
-*/
-void QGraphicsItem::setScale(qreal sx, qreal sy)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xScale = sx;
- d_ptr->transformData->yScale = sy;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
/*!
\since 4.6
- Returns the horizontal shear.
-
- The default is 0
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
+ returns list of graphics transformations on the item.
- \sa setHorizontalShear(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations}
*/
-qreal QGraphicsItem::horizontalShear() const
+QList<QGraphicsTransform *> QGraphicsItem::transformations() const
{
if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->horizontalShear;
+ return QList<QGraphicsTransform *>();
+ return d_ptr->transformData->graphicsTransforms;
}
/*!
\since 4.6
- Sets the horizontal shear to \a shear.
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
+ Sets a list of graphics transformations on the item to \a transformations.
- \sa horizontalShear(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setHorizontalShear(qreal shear)
+void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transformations)
{
prepareGeometryChange();
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->horizontalShear = shear;
+ d_ptr->transformData->graphicsTransforms = transformations;
+ for (int i = 0; i < transformations.size(); ++i)
+ transformations.at(i)->d_func()->setItem(this);
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
}
-/*!
- \since 4.6
-
- Returns the vertical shear.
-
- The default is 0
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
- \sa setHorizontalShear(), {Transformations}
-*/
-qreal QGraphicsItem::verticalShear() const
+void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t)
{
- if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->verticalShear;
-}
+ if (!transformData)
+ transformData = new QGraphicsItemPrivate::TransformData;
+ if (!transformData->graphicsTransforms.contains(t))
+ transformData->graphicsTransforms.append(t);
-/*!
- \since 4.6
-
- Sets the vertical shear to \a shear.
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
-
- \sa verticalShear(), {Transformations}
-*/
-void QGraphicsItem::setVerticalShear(qreal shear)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->verticalShear = shear;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
- This convenience function sets the horizontal shear to \a sh and the vertical shear to \a sv.
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
-
- \sa setHorizontalShear(), setVerticalShear()
-*/
-void QGraphicsItem::setShear(qreal sh, qreal sv)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->horizontalShear = sh;
- d_ptr->transformData->verticalShear = sv;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
+ Q_Q(QGraphicsItem);
+ t->d_func()->setItem(q);
+ transformData->onlyTransform = false;
+ dirtySceneTransform = 1;
}
/*!
@@ -3303,9 +3119,9 @@ void QGraphicsItem::setShear(qreal sh, qreal sv)
The default is QPointF(0,0).
- \sa setTransformOrigin(), {Transformations}
+ \sa setTransformOriginPoint(), {Transformations}
*/
-QPointF QGraphicsItem::transformOrigin() const
+QPointF QGraphicsItem::transformOriginPoint() const
{
if (!d_ptr->transformData)
return QPointF(0,0);
@@ -3317,9 +3133,9 @@ QPointF QGraphicsItem::transformOrigin() const
Sets the \a origin point for the transformation in item coordinates.
- \sa transformOrigin(), {Transformations}
+ \sa transformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setTransformOrigin(const QPointF &origin)
+void QGraphicsItem::setTransformOriginPoint(const QPointF &origin)
{
prepareGeometryChange();
if (!d_ptr->transformData)
@@ -3331,15 +3147,15 @@ void QGraphicsItem::setTransformOrigin(const QPointF &origin)
}
/*!
- \fn void QGraphicsItem::setTransformOrigin(qreal x, qreal y)
+ \fn void QGraphicsItem::setTransformOriginPoint(qreal x, qreal y)
\since 4.6
\overload
Sets the origin point for the transformation in item coordinates.
- This is equivalent to calling setTransformOrigin(QPointF(\a x, \a y)).
+ This is equivalent to calling setTransformOriginPoint(QPointF(\a x, \a y)).
- \sa setTransformOrigin(), {Transformations}
+ \sa setTransformOriginPoint(), {Transformations}
*/
@@ -3618,7 +3434,7 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
\warning using this function doesnt affect the value of the transformation properties
- \sa transform(), setRotation(), setScale(), setShear(), setTransformOrigin(), {The Graphics View Coordinate System}, {Transformations}
+ \sa transform(), setRotation(), setScale(), setTransformOriginPoint(), {The Graphics View Coordinate System}, {Transformations}
*/
void QGraphicsItem::setTransform(const QTransform &matrix, bool combine)
{
@@ -3732,7 +3548,7 @@ void QGraphicsItem::shear(qreal sh, qreal sv)
/*!
\obsolete
- Use setPos() or setTransformOrigin() instead.
+ Use setPos() or setTransformOriginPoint() instead.
Translates the current item transformation by (\a dx, \a dy).
@@ -6856,6 +6672,41 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
\sa pos()
*/
+/*!
+ \property QGraphicsObject::rotation
+ This property holds the rotation of the item in degrees.
+
+ This specifies how many degrees to rotate the item around its transformOrigin.
+ The default rotation is 0 degrees (i.e. not rotated at all).
+*/
+
+/*!
+ \fn QGraphicsObject::rotationChanged()
+
+ This signal gets emitted whenever the roation of the item changes.
+*/
+
+/*!
+ \property QGraphicsObject::scale
+ This property holds the scale of the item.
+
+ A scale of less than 1 means the item will be displayed smaller than
+ normal, and a scale of greater than 1 means the item will be
+ displayed larger than normal. A negative scale means the item will
+ be mirrored.
+
+ By default, items are displayed at a scale of 1 (i.e. at their
+ normal size).
+
+ Scaling is from the item's transformOrigin.
+*/
+
+/*!
+ \fn void QGraphicsObject::scaleChanged()
+
+ This signal is emitted when the scale of the item changes.
+*/
+
/*!
\property QGraphicsObject::enabled
@@ -6895,6 +6746,15 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
\sa visible
*/
+/*!
+ \property QGraphicsObject::transformOriginPoint
+ \brief the transformation origin
+
+ This property sets a specific point in the items coordiante system as the
+ origin for scale and rotation.
+
+ \sa scale, rotation, QGraphicsItem::transformOriginPoint()
+*/
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index f8e74f3..3e7224d 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -72,6 +72,7 @@ class QGraphicsSceneHoverEvent;
class QGraphicsSceneMouseEvent;
class QGraphicsSceneWheelEvent;
class QGraphicsScene;
+class QGraphicsTransform;
class QGraphicsWidget;
class QInputMethodEvent;
class QKeyEvent;
@@ -269,34 +270,19 @@ public:
void shear(qreal sh, qreal sv); // ### obsolete
void translate(qreal dx, qreal dy); // ### obsolete
- qreal xRotation() const;
- void setXRotation(qreal angle);
+ void setRotation(qreal angle);
+ qreal rotation() const;
- qreal yRotation() const;
- void setYRotation(qreal angle);
+ void setScale(qreal scale);
+ qreal scale() const;
- qreal zRotation() const;
- void setZRotation(qreal angle);
- void setRotation(qreal x, qreal y, qreal z);
+ QList<QGraphicsTransform *> transformations() const;
+ void setTransformations(const QList<QGraphicsTransform *> &transformations);
- qreal xScale() const;
- void setXScale(qreal factor);
-
- qreal yScale() const;
- void setYScale(qreal factor);
- void setScale(qreal sx, qreal sy);
-
- qreal horizontalShear() const;
- void setHorizontalShear(qreal shear);
-
- qreal verticalShear() const;
- void setVerticalShear(qreal shear);
- void setShear(qreal sh, qreal sv);
-
- QPointF transformOrigin() const;
- void setTransformOrigin(const QPointF &origin);
- inline void setTransformOrigin(qreal x, qreal y)
- { setTransformOrigin(QPointF(x,y)); }
+ QPointF transformOriginPoint() const;
+ void setTransformOriginPoint(const QPointF &origin);
+ inline void setTransformOriginPoint(qreal x, qreal y)
+ { setTransformOriginPoint(QPointF(x,y)); }
virtual void advance(int phase);
@@ -457,6 +443,7 @@ private:
friend class QGraphicsSceneIndexPrivate;
friend class QGraphicsSceneBspTreeIndex;
friend class QGraphicsSceneBspTreeIndexPrivate;
+ friend class QGraphicsTransformPrivate;
friend class ::tst_QGraphicsItem;
friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *);
friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *);
@@ -522,9 +509,19 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
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)
+ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
+ Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
+ Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
public:
QGraphicsObject(QGraphicsItem *parent = 0);
+ // ### Qt 5: Disambiguate
+#ifdef Q_NO_USING_KEYWORD
+ const QObjectList &children() const { return QObject::children(); }
+#else
+ using QObject::children;
+#endif
+
Q_SIGNALS:
void parentChanged();
void opacityChanged();
@@ -533,6 +530,8 @@ Q_SIGNALS:
void xChanged();
void yChanged();
void zChanged();
+ void rotationChanged();
+ void scaleChanged();
protected:
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 8097519..aa2cf40 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -57,6 +57,8 @@
#include "qset.h"
#include "qpixmapcache.h"
#include <private/qgraphicsview_p.h>
+#include "qgraphicstransform.h"
+#include <private/qgraphicstransform_p.h>
#include <QtCore/qpoint.h>
@@ -192,7 +194,7 @@ public:
void combineTransformToParent(QTransform *x, const QTransform *viewTransform = 0) const;
void combineTransformFromParent(QTransform *x, const QTransform *viewTransform = 0) const;
- void updateSceneTransformFromParent();
+ virtual void updateSceneTransformFromParent();
// ### Qt 5: Remove. Workaround for reimplementation added after Qt 4.4.
virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const;
@@ -200,6 +202,7 @@ public:
void setPosHelper(const QPointF &pos);
void setTransformHelper(const QTransform &transform);
+ void appendGraphicsTransform(QGraphicsTransform *t);
void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false,
@@ -467,45 +470,35 @@ public:
struct QGraphicsItemPrivate::TransformData {
QTransform transform;
- qreal xScale;
- qreal yScale;
- qreal xRotation;
- qreal yRotation;
- qreal zRotation;
- qreal horizontalShear;
- qreal verticalShear;
+ qreal scale;
+ qreal rotation;
qreal xOrigin;
qreal yOrigin;
+ QList<QGraphicsTransform *> graphicsTransforms;
bool onlyTransform;
TransformData() :
- xScale(1.0), yScale(1.0), xRotation(0.0), yRotation(0.0), zRotation(0.0),
- horizontalShear(0.0), verticalShear(0.0), xOrigin(0.0), yOrigin(0.0),
+ scale(1.0), rotation(0.0),
+ xOrigin(0.0), yOrigin(0.0),
onlyTransform(true)
{}
QTransform computedFullTransform(QTransform *postmultiplyTransform = 0) const
{
if (onlyTransform) {
- if (!postmultiplyTransform)
- return transform;
- if (postmultiplyTransform->isIdentity())
+ if (!postmultiplyTransform || postmultiplyTransform->isIdentity())
return transform;
if (transform.isIdentity())
return *postmultiplyTransform;
- QTransform x(transform);
- x *= *postmultiplyTransform;
- return x;
+ return transform * *postmultiplyTransform;
}
QTransform x(transform);
- if (xOrigin != 0 || yOrigin != 0)
- x *= QTransform::fromTranslate(xOrigin, yOrigin);
- x.rotate(xRotation, Qt::XAxis);
- x.rotate(yRotation, Qt::YAxis);
- x.rotate(zRotation, Qt::ZAxis);
- x.shear(horizontalShear, verticalShear);
- x.scale(xScale, yScale);
+ for (int i = 0; i < graphicsTransforms.size(); ++i)
+ graphicsTransforms.at(i)->applyTo(&x);
+ x.translate(xOrigin, yOrigin);
+ x.rotate(rotation, Qt::ZAxis);
+ x.scale(scale, scale);
x.translate(-xOrigin, -yOrigin);
if (postmultiplyTransform)
x *= *postmultiplyTransform;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 7e2f7c8..e6727af 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2356,6 +2356,10 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+ // Auto-activate the first inactive window if the scene is active.
+ if (d->activationRefCount > 0 && !d->activeWindow && item->isWindow())
+ setActiveWindow(static_cast<QGraphicsWidget *>(item));
+
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
if (!d->focusItem && item->focusItem())
@@ -3678,6 +3682,13 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
void QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
Q_D(QGraphicsScene);
+ if (d->mouseGrabberItems.isEmpty()) {
+ // Dispatch hover events
+ QGraphicsSceneHoverEvent hover;
+ _q_hoverFromMouseEvent(&hover, mouseEvent);
+ d->dispatchHoverEvent(&hover);
+ }
+
d->mousePressEventHandler(mouseEvent);
}
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
new file mode 100644
index 0000000..b55d78e
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the 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 "qgraphicstransform.h"
+#include "qgraphicsitem_p.h"
+#include "qgraphicstransform_p.h"
+#include <QDebug>
+
+#include <math.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+QT_BEGIN_NAMESPACE
+
+
+void QGraphicsTransformPrivate::setItem(QGraphicsItem *i)
+{
+ if (item == i)
+ return;
+
+ if (item) {
+ Q_Q(QGraphicsTransform);
+ QGraphicsItemPrivate *d_ptr = item->d_ptr;
+
+ item->prepareGeometryChange();
+ Q_ASSERT(d_ptr->transformData);
+ d_ptr->transformData->graphicsTransforms.removeAll(q);
+ d_ptr->dirtySceneTransform = 1;
+ item = 0;
+ }
+
+ item = i;
+}
+
+void QGraphicsTransformPrivate::updateItem(QGraphicsItem *item)
+{
+ item->prepareGeometryChange();
+ item->d_ptr->dirtySceneTransform = 1;
+}
+
+void QGraphicsTransform::update()
+{
+ Q_D(QGraphicsTransform);
+ if (d->item)
+ d->updateItem(d->item);
+}
+
+/*!
+ returns this object as a QTransform.
+*/
+QTransform QGraphicsTransform::transform() const
+{
+ QTransform t;
+ applyTo(&t);
+ return t;
+}
+
+/*!
+ \class QGraphicsTransform
+ \brief The QGraphicsTransform class is an abstract base class for tranformations on QGraphicsItems.
+ \since 4.6
+
+ The classes that inherit QGraphicsTransform express different types of transformations
+ that can be applied to graphics items.
+
+ A list of these transformations can be applied to any graphics item. These
+ transformations are then easily modifyable and usable from e.g. within animations.
+
+ QGraphicsTransform is an abstract base class that is implemented by QGraphicsScale,
+ QGraphicsRotation and QGraphicsRotation3D. Subclasses have to implement the applyTo method.
+
+ \sa QGraphicsItem::transform(), QGraphicsScale, QGraphicsRotation, QGraphicsRotation3D
+*/
+
+/*!
+ Constructs a new QGraphicsTransform with \a parent.
+*/
+QGraphicsTransform::QGraphicsTransform(QObject *parent) :
+ QObject(*new QGraphicsTransformPrivate, parent)
+{
+}
+
+/*!
+ Destructs the graphics transform.
+*/
+QGraphicsTransform::~QGraphicsTransform()
+{
+ Q_D(QGraphicsTransform);
+ d->setItem(0);
+}
+
+/*!
+ \internal
+*/
+QGraphicsTransform::QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent)
+ : QObject(p, parent)
+{
+}
+
+/*! \fn void QGraphicsTransform::applyTo(QTransform *transform) const
+
+ This pure virtual method has to be reimplemented in derived classes.
+
+ It applies this transformation to \a transform.
+*/
+
+
+/*!
+ \class QGraphicsScale
+ \brief The QGraphicsScale class provides a way to scale a graphics item in 2 dimensions.
+ \since 4.6
+
+ QGraphicsScale contains an \a origin around which the scaling happens, and two
+ scale factors, xScale and yScale, the x and one for the y axis.
+*/
+
+class QGraphicsScalePrivate : public QGraphicsTransformPrivate
+{
+public:
+ QGraphicsScalePrivate()
+ : xScale(1), yScale(1) {}
+ QPointF origin;
+ qreal xScale;
+ qreal yScale;
+};
+
+/*!
+ Constructs a new graphics scale object with \a parent.
+*/
+QGraphicsScale::QGraphicsScale(QObject *parent)
+ : QGraphicsTransform(*new QGraphicsScalePrivate, parent)
+{
+}
+
+/*!
+ Destroys the object
+*/
+QGraphicsScale::~QGraphicsScale()
+{
+}
+
+/*!
+ \property QGraphicsScale::origin
+ The origin of the scale. All scaling will be done relative to this point.
+
+ The \a origin is in other words the fixed point for the transformation.
+*/
+QPointF QGraphicsScale::origin() const
+{
+ Q_D(const QGraphicsScale);
+ return d->origin;
+}
+
+void QGraphicsScale::setOrigin(const QPointF &point)
+{
+ Q_D(QGraphicsScale);
+ d->origin = point;
+ update();
+ emit originChanged();
+}
+
+/*!
+ \fn QGraphicsScale::originChanged()
+
+ This signal is emitted whenever the origin of the object
+ changes.
+*/
+
+/*!
+ \property QGraphicsScale::xScale
+
+ The scale factor in x direction. The x direction is
+ in the graphics items logical coordinates.
+
+ \sa yScale
+*/
+qreal QGraphicsScale::xScale() const
+{
+ Q_D(const QGraphicsScale);
+ return d->xScale;
+}
+
+void QGraphicsScale::setXScale(qreal scale)
+{
+ Q_D(QGraphicsScale);
+ if (d->xScale == scale)
+ return;
+ d->xScale = scale;
+ update();
+ emit scaleChanged();
+}
+
+/*!
+ \property QGraphicsScale::yScale
+
+ The scale factor in y direction. The y direction is
+ in the graphics items logical coordinates.
+
+ \sa xScale
+*/
+qreal QGraphicsScale::yScale() const
+{
+ Q_D(const QGraphicsScale);
+ return d->yScale;
+}
+
+void QGraphicsScale::setYScale(qreal scale)
+{
+ Q_D(QGraphicsScale);
+ if (d->yScale == scale)
+ return;
+ d->yScale = scale;
+ update();
+ emit scaleChanged();
+}
+
+/*!
+ \fn QGraphicsScale::scaleChanged()
+
+ This signal is emitted whenever the xScale or yScale of the object
+ changes.
+*/
+
+/*!
+ \reimp
+*/
+void QGraphicsScale::applyTo(QTransform *transform) const
+{
+ Q_D(const QGraphicsScale);
+ transform->translate(d->origin.x(), d->origin.y());
+ transform->scale(d->xScale, d->yScale);
+ transform->translate(-d->origin.x(), -d->origin.y());
+}
+
+/*!
+ \class QGraphicsRotation
+ \brief The QGraphicsRotation class provides a way to rotate a graphics item in 2 dimensions.
+ \since 4.6
+
+ QGraphicsRotation contains an \a origin around which the rotation happens, and one
+ angle in degrees describing the amount of the rotation.
+*/
+
+class QGraphicsRotationPrivate : public QGraphicsTransformPrivate
+{
+public:
+ QGraphicsRotationPrivate()
+ : angle(0) {}
+ QPointF origin;
+ qreal originY;
+ qreal angle;
+};
+
+/*!
+ Constructs a new graphics rotation with \a parent.
+*/
+QGraphicsRotation::QGraphicsRotation(QObject *parent)
+ : QGraphicsTransform(*new QGraphicsRotationPrivate, parent)
+{
+}
+
+/*!
+ \internal
+*/
+QGraphicsRotation::QGraphicsRotation(QGraphicsRotationPrivate &p, QObject *parent)
+ : QGraphicsTransform(p, parent)
+{
+}
+
+/*!
+ Destructs the object
+*/
+QGraphicsRotation::~QGraphicsRotation()
+{
+}
+
+/*!
+ \property QGraphicsRotation::origin
+ The origin around which this object will rotate the graphics item.
+
+ The \a origin is in other words the fixed point for the transformation.
+*/
+QPointF QGraphicsRotation::origin() const
+{
+ Q_D(const QGraphicsRotation);
+ return d->origin;
+}
+
+void QGraphicsRotation::setOrigin(const QPointF &point)
+{
+ Q_D(QGraphicsRotation);
+ d->origin = point;
+ update();
+ emit originChanged();
+}
+
+/*!
+ \fn QGraphicsRotation::originChanged()
+
+ This signal is emitted whenever the origin of the object
+ changes.
+*/
+
+/*!
+ \property QGraphicsRotation::angle
+ The angle, in degrees, of the rotation.
+*/
+qreal QGraphicsRotation::angle() const
+{
+ Q_D(const QGraphicsRotation);
+ return d->angle;
+}
+
+void QGraphicsRotation::setAngle(qreal angle)
+{
+ Q_D(QGraphicsRotation);
+ if (d->angle == angle)
+ return;
+ d->angle = angle;
+ update();
+ emit angleChanged();
+}
+
+/*!
+ \fn void QGraphicsRotation::angleChanged()
+
+ This signal is emitted whenever the angle of the object
+ changes.
+*/
+
+/*!
+ \reimp
+*/
+void QGraphicsRotation::applyTo(QTransform *t) const
+{
+ Q_D(const QGraphicsRotation);
+ if(d->angle) {
+ t->translate(d->origin.x(), d->origin.y());
+ t->rotate(d->angle);
+ t->translate(-d->origin.x(), -d->origin.y());
+ }
+}
+
+
+/*!
+ \class QGraphicsRotation3D
+ \brief The QGraphicsRotation3D class provides a way to rotate a graphics item in 3 dimensions.
+ \since 4.6
+
+ In addition to the origin and angle of a simple QGraphicsRotation, QGraphicsRotation3D contains
+ also an axis that describes around which axis in space the rotation is supposed to happen.
+*/
+
+class QGraphicsRotation3DPrivate : public QGraphicsRotationPrivate
+{
+public:
+ QGraphicsRotation3DPrivate() {}
+
+ QVector3D axis;
+};
+
+/*!
+ Constructs a new 3D rotation with \a parent.
+*/
+QGraphicsRotation3D::QGraphicsRotation3D(QObject *parent)
+ : QGraphicsRotation(*new QGraphicsRotation3DPrivate, parent)
+{
+}
+
+/*!
+ Destroys the object
+*/
+QGraphicsRotation3D::~QGraphicsRotation3D()
+{
+}
+
+/*!
+ \property QGraphicsRotation3D::axis
+
+ A rotation axis is specified by a vector in 3D space.
+*/
+QVector3D QGraphicsRotation3D::axis()
+{
+ Q_D(QGraphicsRotation3D);
+ return d->axis;
+}
+
+void QGraphicsRotation3D::setAxis(const QVector3D &axis)
+{
+ Q_D(QGraphicsRotation3D);
+ d->axis = axis;
+ update();
+}
+
+/*!
+ \fn void QGraphicsRotation3D::axisChanged()
+
+ This signal is emitted whenever the axis of the object
+ changes.
+*/
+
+const qreal inv_dist_to_plane = 1. / 1024.;
+
+/*!
+ \reimp
+*/
+void QGraphicsRotation3D::applyTo(QTransform *t) const
+{
+ Q_D(const QGraphicsRotation3D);
+
+ if (d->angle == 0. ||
+ (d->axis.z() == 0. && d->axis.y() == 0 && d->axis.x() == 0))
+ return;
+
+ qreal rad = d->angle * 2. * M_PI / 360.;
+ qreal c = ::cos(rad);
+ qreal s = ::sin(rad);
+
+ qreal x = d->axis.x();
+ qreal y = d->axis.y();
+ qreal z = d->axis.z();
+
+ qreal len = x * x + y * y + z * z;
+ if (len != 1.) {
+ len = 1./::sqrt(len);
+ x *= len;
+ y *= len;
+ z *= len;
+ }
+
+ t->translate(d->origin.x(), d->origin.y());
+ *t = QTransform(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane,
+ y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane,
+ 0, 0, 1) * *t;
+ t->translate(-d->origin.x(), -d->origin.y());
+}
+
+#include "moc_qgraphicstransform.cpp"
+
+QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicstransform.h b/src/gui/graphicsview/qgraphicstransform.h
new file mode 100644
index 0000000..adf9438
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicstransform.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the 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$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSTRANSFORM_H
+#define QGRAPHICSTRANSFORM_H
+
+#include <QtCore/QObject>
+#include <QtGui/QTransform>
+#include <QtGui/QVector3D>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QGraphicsItem;
+class QGraphicsTransformPrivate;
+
+class Q_GUI_EXPORT QGraphicsTransform : public QObject
+{
+ Q_OBJECT
+public:
+ QGraphicsTransform(QObject *parent = 0);
+ ~QGraphicsTransform();
+
+ QTransform transform() const;
+ virtual void applyTo(QTransform *transform) const = 0;
+
+protected slots:
+ void update();
+
+protected:
+ QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent);
+private:
+ friend class QGraphicsItem;
+ friend class QGraphicsItemPrivate;
+ Q_DECLARE_PRIVATE(QGraphicsTransform)
+};
+
+class QGraphicsScalePrivate;
+
+class Q_GUI_EXPORT QGraphicsScale : public QGraphicsTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPointF origin READ origin WRITE setOrigin NOTIFY originChanged)
+ Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY scaleChanged)
+ Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY scaleChanged)
+public:
+ QGraphicsScale(QObject *parent = 0);
+ ~QGraphicsScale();
+
+ QPointF origin() const;
+ void setOrigin(const QPointF &point);
+
+ qreal xScale() const;
+ void setXScale(qreal);
+
+ qreal yScale() const;
+ void setYScale(qreal);
+
+ void applyTo(QTransform *transform) const;
+
+Q_SIGNALS:
+ void originChanged();
+ void scaleChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QGraphicsScale)
+};
+
+class QGraphicsRotationPrivate;
+
+class Q_GUI_EXPORT QGraphicsRotation : public QGraphicsTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPointF origin READ origin WRITE setOrigin NOTIFY originChanged)
+ Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
+public:
+ QGraphicsRotation(QObject *parent = 0);
+ ~QGraphicsRotation();
+
+ QPointF origin() const;
+ void setOrigin(const QPointF &point);
+
+ qreal angle() const;
+ void setAngle(qreal);
+
+ void applyTo(QTransform *transform) const;
+
+Q_SIGNALS:
+ void originChanged();
+ void angleChanged();
+
+protected:
+ QGraphicsRotation(QGraphicsRotationPrivate &p, QObject *parent);
+private:
+ Q_DECLARE_PRIVATE(QGraphicsRotation)
+};
+
+class QGraphicsRotation3DPrivate;
+
+class Q_GUI_EXPORT QGraphicsRotation3D : public QGraphicsRotation
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
+public:
+ QGraphicsRotation3D(QObject *parent = 0);
+ ~QGraphicsRotation3D();
+
+ QVector3D axis();
+ void setAxis(const QVector3D &axis);
+
+ void applyTo(QTransform *transform) const;
+
+Q_SIGNALS:
+ void axisChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QGraphicsRotation3D)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QFXTRANSFORM_H
diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h
new file mode 100644
index 0000000..2d36eda
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicstransform_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the 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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSTRANSFORM_P_H
+#define QGRAPHICSTRANSFORM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qobject_p.h"
+
+class QGraphicsItem;
+
+class QGraphicsTransformPrivate : public QObjectPrivate {
+public:
+ Q_DECLARE_PUBLIC(QGraphicsTransform)
+
+ QGraphicsTransformPrivate()
+ : QObjectPrivate(), item(0) {}
+
+ QGraphicsItem *item;
+
+ void setItem(QGraphicsItem *item);
+ static void updateItem(QGraphicsItem *item);
+};
+
+#endif // QGRAPHICSTRANSFORM_P_H
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 5e5c826..bf0acc9 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1728,39 +1728,6 @@ QGraphicsWidget *QGraphicsWidget::focusWidget() const
return 0;
}
-/*! \property QGraphicsWidget::horizontalShear
- \brief This property holds the horizontal shear value for the item.
- */
-
-/*! \property QGraphicsWidget::transformOrigin
- \brief This property holds the origin point used for transformations
- in item coordinates.
- */
-
-/*! \property QGraphicsWidget::verticalShear
- \brief This property holds the vertical shear value for the item.
- */
-
-/*! \property QGraphicsWidget::xRotation
- \brief This property holds the value for rotation around the x axis.
- */
-
-/*! \property QGraphicsWidget::xScale
- \brief This property holds the scale factor for the x axis.
- */
-
-/*! \property QGraphicsWidget::yRotation
- \brief This property holds the value for rotation around the y axis.
- */
-
-/*! \property QGraphicsWidget::yScale
- \brief This property holds the scale factor for the y axis.
- */
-
-/*! \property QGraphicsWidget::zRotation
- \brief This property holds the value for rotation around the z axis.
- */
-
#ifndef QT_NO_SHORTCUT
/*!
\since 4.5
@@ -2286,6 +2253,7 @@ bool QGraphicsWidget::close()
#ifdef Q_NO_USING_KEYWORD
/*!
\fn const QObjectList &QGraphicsWidget::children() const
+ \internal
This function returns the same value as QObject::children(). It's
provided to differentiate between the obsolete member
diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h
index 9047310..cb5490a 100644
--- a/src/gui/graphicsview/qgraphicswidget.h
+++ b/src/gui/graphicsview/qgraphicswidget.h
@@ -77,14 +77,6 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay
Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
- Q_PROPERTY(QPointF transformOrigin READ transformOrigin WRITE setTransformOrigin)
- Q_PROPERTY(qreal xRotation READ xRotation WRITE setXRotation)
- Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation)
- Q_PROPERTY(qreal zRotation READ zRotation WRITE setZRotation)
- Q_PROPERTY(qreal xScale READ xScale WRITE setXScale)
- Q_PROPERTY(qreal yScale READ yScale WRITE setYScale)
- Q_PROPERTY(qreal horizontalShear READ horizontalShear WRITE setHorizontalShear)
- Q_PROPERTY(qreal verticalShear READ verticalShear WRITE setVerticalShear)
public:
QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
~QGraphicsWidget();
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d71aef3..9a1380e 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4639,12 +4639,19 @@ bool QImage::loadFromData(const uchar *data, int len, const char *format)
binary \a data. The loader attempts to read the image using the
specified \a format. If \a format is not specified (which is the default),
the loader probes the file for a header to guess the file format.
+ binary \a data. The loader attempts to read the image, either using the
+ optional image \a format specified or by determining the image format from
+ the data.
- If the loading of the image failed, this object is a null image.
+ If \a format is not specified (which is the default), the loader probes the
+ file for a header to determine the file format. If \a format is specified,
+ it must be one of the values returned by QImageReader::supportedImageFormats().
+
+ If the loading of the image fails, the image returned will be a null image.
+
+ \sa load(), save(), {QImage#Reading and Writing Image Files}{Reading and Writing Image Files}
+ */
- \sa load(), save(), {QImage#Reading and Writing Image
- Files}{Reading and Writing Image Files}
-*/
QImage QImage::fromData(const uchar *data, int size, const char *format)
{
QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(data), size);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 759ee1a..afcb918 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -852,8 +852,8 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) cons
}
/*!
- Returns the item delegate used by this view and model for
- the given \a index.
+ Returns the item delegate used by this view and model for
+ the given \a index.
*/
QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index) const
{
@@ -862,14 +862,14 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index)
}
/*!
- \property QAbstractItemView::selectionMode
- \brief which selection mode the view operates in
+ \property QAbstractItemView::selectionMode
+ \brief which selection mode the view operates in
- This property controls whether the user can select one or many items
- and, in many-item selections, whether the selection must be a
- continuous range of items.
+ This property controls whether the user can select one or many items
+ and, in many-item selections, whether the selection must be a
+ continuous range of items.
- \sa SelectionMode SelectionBehavior
+ \sa SelectionMode SelectionBehavior
*/
void QAbstractItemView::setSelectionMode(SelectionMode mode)
{
@@ -884,13 +884,13 @@ QAbstractItemView::SelectionMode QAbstractItemView::selectionMode() const
}
/*!
- \property QAbstractItemView::selectionBehavior
- \brief which selection behavior the view uses
+ \property QAbstractItemView::selectionBehavior
+ \brief which selection behavior the view uses
- This property holds whether selections are done
- in terms of single items, rows or columns.
+ This property holds whether selections are done
+ in terms of single items, rows or columns.
- \sa SelectionMode SelectionBehavior
+ \sa SelectionMode SelectionBehavior
*/
void QAbstractItemView::setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
@@ -991,11 +991,11 @@ QModelIndex QAbstractItemView::rootIndex() const
}
/*!
- Selects all item in the view.
- This function wil use the selection selection behavior
- set on the view when selecting.
+ Selects all items in the view.
+ This function will use the selection behavior
+ set on the view when selecting.
- \sa setSelection(), selectedIndexes(), clearSelection()
+ \sa setSelection(), selectedIndexes(), clearSelection()
*/
void QAbstractItemView::selectAll()
{
@@ -1224,10 +1224,10 @@ bool QAbstractItemView::tabKeyNavigation() const
#ifndef QT_NO_DRAGANDDROP
/*!
- \property QAbstractItemView::showDropIndicator
- \brief whether the drop indicator is shown when dragging items and dropping.
+ \property QAbstractItemView::showDropIndicator
+ \brief whether the drop indicator is shown when dragging items and dropping.
- \sa dragEnabled DragDropMode dragDropOverwriteMode acceptDrops
+ \sa dragEnabled DragDropMode dragDropOverwriteMode acceptDrops
*/
void QAbstractItemView::setDropIndicatorShown(bool enable)
@@ -1243,10 +1243,10 @@ bool QAbstractItemView::showDropIndicator() const
}
/*!
- \property QAbstractItemView::dragEnabled
- \brief whether the view supports dragging of its own items
+ \property QAbstractItemView::dragEnabled
+ \brief whether the view supports dragging of its own items
- \sa showDropIndicator DragDropMode dragDropOverwriteMode acceptDrops
+ \sa showDropIndicator DragDropMode dragDropOverwriteMode acceptDrops
*/
void QAbstractItemView::setDragEnabled(bool enable)
@@ -1282,11 +1282,11 @@ bool QAbstractItemView::dragEnabled() const
*/
/*!
- \property QAbstractItemView::dragDropMode
- \brief the drag and drop event the view will act upon
+ \property QAbstractItemView::dragDropMode
+ \brief the drag and drop event the view will act upon
- \since 4.2
- \sa showDropIndicator dragDropOverwriteMode
+ \since 4.2
+ \sa showDropIndicator dragDropOverwriteMode
*/
void QAbstractItemView::setDragDropMode(DragDropMode behavior)
{
@@ -1322,14 +1322,14 @@ QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const
#endif // QT_NO_DRAGANDDROP
/*!
- \property QAbstractItemView::alternatingRowColors
- \brief whether to draw the background using alternating colors
+ \property QAbstractItemView::alternatingRowColors
+ \brief whether to draw the background using alternating colors
- If this property is true, the item background will be drawn using
- QPalette::Base and QPalette::AlternateBase; otherwise the background
- will be drawn using the QPalette::Base color.
+ If this property is true, the item background will be drawn using
+ QPalette::Base and QPalette::AlternateBase; otherwise the background
+ will be drawn using the QPalette::Base color.
- By default, this property is false.
+ By default, this property is false.
*/
void QAbstractItemView::setAlternatingRowColors(bool enable)
{
@@ -2261,8 +2261,8 @@ void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event)
\value BelowItem The item will be dropped below the index.
\value OnViewport The item will be dropped onto a region of the viewport with
-no items. The way each view handles items dropped onto the viewport depends on
-the behavior of the underlying model in use.
+ no items. The way each view handles items dropped onto the viewport depends on
+ the behavior of the underlying model in use.
*/
@@ -2279,11 +2279,11 @@ QAbstractItemView::DropIndicatorPosition QAbstractItemView::dropIndicatorPositio
#endif
/*!
- This convenience function returns a list of all selected and
- non-hidden item indexes in the view. The list contains no
- duplicates, and is not sorted.
+ This convenience function returns a list of all selected and
+ non-hidden item indexes in the view. The list contains no
+ duplicates, and is not sorted.
- \sa QItemSelectionModel::selectedIndexes()
+ \sa QItemSelectionModel::selectedIndexes()
*/
QModelIndexList QAbstractItemView::selectedIndexes() const
{
@@ -2365,8 +2365,8 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
}
/*!
- \internal
- Updates the data shown in the open editor widgets in the view.
+ \internal
+ Updates the data shown in the open editor widgets in the view.
*/
void QAbstractItemView::updateEditorData()
{
@@ -2375,8 +2375,8 @@ void QAbstractItemView::updateEditorData()
}
/*!
- \internal
- Updates the geometry of the open editor widgets in the view.
+ \internal
+ Updates the geometry of the open editor widgets in the view.
*/
void QAbstractItemView::updateEditorGeometries()
{
@@ -2425,7 +2425,7 @@ void QAbstractItemView::updateGeometries()
}
/*!
- \internal
+ \internal
*/
void QAbstractItemView::verticalScrollbarValueChanged(int value)
{
@@ -2436,7 +2436,7 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value)
}
/*!
- \internal
+ \internal
*/
void QAbstractItemView::horizontalScrollbarValueChanged(int value)
{
@@ -2538,9 +2538,9 @@ void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndE
}
/*!
- Commit the data in the \a editor to the model.
+ Commit the data in the \a editor to the model.
- \sa closeEditor()
+ \sa closeEditor()
*/
void QAbstractItemView::commitData(QWidget *editor)
{
@@ -2559,9 +2559,9 @@ void QAbstractItemView::commitData(QWidget *editor)
}
/*!
- This function is called when the given \a editor has been destroyed.
+ This function is called when the given \a editor has been destroyed.
- \sa closeEditor()
+ \sa closeEditor()
*/
void QAbstractItemView::editorDestroyed(QObject *editor)
{
@@ -2632,12 +2632,12 @@ int QAbstractItemView::verticalStepsPerItem() const
}
/*!
- Moves to and selects the item best matching the string \a search.
- If no item is found nothing happens.
+ Moves to and selects the item best matching the string \a search.
+ If no item is found nothing happens.
- In the default implementation, the search is reset if \a search is empty, or
- the time interval since the last search has exceeded
- QApplication::keyboardInputInterval().
+ In the default implementation, the search is reset if \a search is empty, or
+ the time interval since the last search has exceeded
+ QApplication::keyboardInputInterval().
*/
void QAbstractItemView::keyboardSearch(const QString &search)
{
@@ -2691,9 +2691,9 @@ void QAbstractItemView::keyboardSearch(const QString &search)
setCurrentIndex(firstMatch);
break;
}
- int row = firstMatch.row() + 1;
- if (row >= d->model->rowCount(firstMatch.parent()))
- row = 0;
+ int row = firstMatch.row() + 1;
+ if (row >= d->model->rowCount(firstMatch.parent()))
+ row = 0;
current = firstMatch.sibling(row, firstMatch.column());
}
} while (current != start && firstMatch.isValid());
@@ -2800,9 +2800,9 @@ void QAbstractItemView::openPersistentEditor(const QModelIndex &index)
}
/*!
- Closes the persistent editor for the item at the given \a index.
+ Closes the persistent editor for the item at the given \a index.
- \sa openPersistentEditor()
+ \sa openPersistentEditor()
*/
void QAbstractItemView::closePersistentEditor(const QModelIndex &index)
{
@@ -3337,14 +3337,14 @@ void QAbstractItemView::setDirtyRegion(const QRegion &region)
}
/*!
- Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the
- opposite direction. You only need to call this function if you are implementing a scrolling
- viewport in your view subclass.
+ Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the
+ opposite direction. You only need to call this function if you are implementing a scrolling
+ viewport in your view subclass.
- If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function
- before you call QWidget::scroll() on the viewport. Alternatively, just call update().
+ If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function
+ before you call QWidget::scroll() on the viewport. Alternatively, just call update().
- \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion()
+ \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion()
*/
void QAbstractItemView::scrollDirtyRegion(int dx, int dy)
{
@@ -3353,13 +3353,13 @@ void QAbstractItemView::scrollDirtyRegion(int dx, int dy)
}
/*!
- Returns the offset of the dirty regions in the view.
+ Returns the offset of the dirty regions in the view.
- If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of
- QAbstractItemView, you should translate the area given by the paint event with
- the offset returned from this function.
+ If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of
+ QAbstractItemView, you should translate the area given by the paint event with
+ the offset returned from this function.
- \sa scrollDirtyRegion(), setDirtyRegion()
+ \sa scrollDirtyRegion(), setDirtyRegion()
*/
QPoint QAbstractItemView::dirtyRegionOffset() const
{
@@ -3531,7 +3531,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC
const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
const bool controlKeyPressed = modifiers & Qt::ControlModifier;
if (((index == pressedIndex && selectionModel->isSelected(index))
- || !index.isValid()) && state != QAbstractItemView::DragSelectingState
+ || !index.isValid()) && state != QAbstractItemView::DragSelectingState
&& !shiftKeyPressed && !controlKeyPressed && !rightButtonPressed)
return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
return QItemSelectionModel::NoUpdate;
@@ -3763,7 +3763,7 @@ void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QMo
but the behavior is view dependant (table just clears the selected indexes for example).
Either remove the selected rows or clear them
- */
+*/
void QAbstractItemViewPrivate::clearOrRemove()
{
#ifndef QT_NO_DRAGANDDROP
@@ -3799,7 +3799,7 @@ void QAbstractItemViewPrivate::clearOrRemove()
When persistent aeditor gets/loses focus, we need to check
and setcorrectly the current index.
- */
+*/
void QAbstractItemViewPrivate::checkPersistentEditorFocus()
{
Q_Q(QAbstractItemView);
@@ -3886,10 +3886,10 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
}
/*
- \internal
+ \internal
- returns the pair QRect/QModelIndex that should be painted on the viewports's rect
- */
+ returns the pair QRect/QModelIndex that should be painted on the viewports's rect
+*/
QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
{
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 87825d9..9dad95f 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -303,45 +303,44 @@ QModelIndexList QItemSelectionRange::indexes() const
}
/*!
- \class QItemSelection
+ \class QItemSelection
- \brief The QItemSelection class manages information about selected items in a model.
+ \brief The QItemSelection class manages information about selected items in a model.
- \ingroup model-view
-
- A QItemSelection describes the items in a model that have been
- selected by the user. A QItemSelection is basically a list of
- selection ranges, see QItemSelectionRange. It provides functions for
- creating and manipulating selections, and selecting a range of items
- from a model.
+ \ingroup model-view
- The QItemSelection class is one of the \l{Model/View Classes}
- and is part of Qt's \l{Model/View Programming}{model/view framework}.
+ A QItemSelection describes the items in a model that have been
+ selected by the user. A QItemSelection is basically a list of
+ selection ranges, see QItemSelectionRange. It provides functions for
+ creating and manipulating selections, and selecting a range of items
+ from a model.
- An item selection can be constructed and initialized to contain a
- range of items from an existing model. The following example constructs
- a selection that contains a range of items from the given \c model,
- beginning at the \c topLeft, and ending at the \c bottomRight.
+ The QItemSelection class is one of the \l{Model/View Classes}
+ and is part of Qt's \l{Model/View Programming}{model/view framework}.
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0
+ An item selection can be constructed and initialized to contain a
+ range of items from an existing model. The following example constructs
+ a selection that contains a range of items from the given \c model,
+ beginning at the \c topLeft, and ending at the \c bottomRight.
- An empty item selection can be constructed, and later populated as
- required. So, if the model is going to be unavailable when we construct
- the item selection, we can rewrite the above code in the following way:
+ \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1
+ An empty item selection can be constructed, and later populated as
+ required. So, if the model is going to be unavailable when we construct
+ the item selection, we can rewrite the above code in the following way:
- QItemSelection saves memory, and avoids unnecessary work, by working with
- selection ranges rather than recording the model item index for each
- item in the selection. Generally, an instance of this class will contain
- a list of non-overlapping selection ranges.
+ \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1
- Use merge() to merge one item selection into another without making
- overlapping ranges. Use split() to split one selection range into
- smaller ranges based on a another selection range.
+ QItemSelection saves memory, and avoids unnecessary work, by working with
+ selection ranges rather than recording the model item index for each
+ item in the selection. Generally, an instance of this class will contain
+ a list of non-overlapping selection ranges.
- \sa {Model/View Programming}, QItemSelectionModel
+ Use merge() to merge one item selection into another without making
+ overlapping ranges. Use split() to split one selection range into
+ smaller ranges based on a another selection range.
+ \sa {Model/View Programming}, QItemSelectionModel
*/
/*!
@@ -420,14 +419,14 @@ QModelIndexList QItemSelection::indexes() const
}
/*!
- Merges the \a other selection with this QItemSelection using the
- \a command given. This method guarantees that no ranges are overlapping.
+ Merges the \a other selection with this QItemSelection using the
+ \a command given. This method guarantees that no ranges are overlapping.
- Note that only QItemSelectionModel::Select,
- QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are
- supported.
+ Note that only QItemSelectionModel::Select,
+ QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are
+ supported.
- \sa split()
+ \sa split()
*/
void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command)
{
@@ -479,10 +478,10 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel
}
/*!
- Splits the selection \a range using the selection \a other range.
- Removes all items in \a other from \a range and puts the result in \a result.
- This can be compared with the semantics of the \e subtract operation of a set.
- \sa merge()
+ Splits the selection \a range using the selection \a other range.
+ Removes all items in \a other from \a range and puts the result in \a result.
+ This can be compared with the semantics of the \e subtract operation of a set.
+ \sa merge()
*/
void QItemSelection::split(const QItemSelectionRange &range,
@@ -529,11 +528,11 @@ void QItemSelection::split(const QItemSelectionRange &range,
}
/*!
- \internal
+ \internal
- returns a QItemSelection where all ranges have been expanded to:
- Rows: left: 0 and right: columnCount()-1
- Columns: top: 0 and bottom: rowCount()-1
+ returns a QItemSelection where all ranges have been expanded to:
+ Rows: left: 0 and right: columnCount()-1
+ Columns: top: 0 and bottom: rowCount()-1
*/
QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection &selection,
@@ -568,7 +567,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection
}
/*!
- \internal
+ \internal
*/
void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &parent,
int start, int end)
@@ -599,7 +598,7 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
}
/*!
- \internal
+ \internal
*/
void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent,
int start, int end)
@@ -630,9 +629,9 @@ void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &p
}
/*!
- \internal
+ \internal
- Split selection ranges if columns are about to be inserted in the middle.
+ Split selection ranges if columns are about to be inserted in the middle.
*/
void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &parent,
int start, int end)
@@ -659,9 +658,9 @@ void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &
}
/*!
- \internal
+ \internal
- Split selection ranges if rows are about to be inserted in the middle.
+ Split selection ranges if rows are about to be inserted in the middle.
*/
void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &parent,
int start, int end)
@@ -688,11 +687,11 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &par
}
/*!
- \internal
+ \internal
- Split selection into individual (persistent) indexes. This is done in
- preparation for the layoutChanged() signal, where the indexes can be
- merged again.
+ Split selection into individual (persistent) indexes. This is done in
+ preparation for the layoutChanged() signal, where the indexes can be
+ merged again.
*/
void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
{
@@ -726,10 +725,10 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
}
/*!
- \internal
+ \internal
- Merges \a indexes into an item selection made up of ranges.
- Assumes that the indexes are sorted.
+ Merges \a indexes into an item selection made up of ranges.
+ Assumes that the indexes are sorted.
*/
static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
{
@@ -774,9 +773,9 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
}
/*!
- \internal
+ \internal
- Merge the selected indexes into selection ranges again.
+ Merge the selected indexes into selection ranges again.
*/
void QItemSelectionModelPrivate::_q_layoutChanged()
{
@@ -818,41 +817,41 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
}
/*!
- \class QItemSelectionModel
+ \class QItemSelectionModel
- \brief The QItemSelectionModel class keeps track of a view's selected items.
+ \brief The QItemSelectionModel class keeps track of a view's selected items.
- \ingroup model-view
+ \ingroup model-view
- A QItemSelectionModel keeps track of the selected items in a view, or
- in several views onto the same model. It also keeps track of the
- currently selected item in a view.
+ A QItemSelectionModel keeps track of the selected items in a view, or
+ in several views onto the same model. It also keeps track of the
+ currently selected item in a view.
- The QItemSelectionModel class is one of the \l{Model/View Classes}
- and is part of Qt's \l{Model/View Programming}{model/view framework}.
+ The QItemSelectionModel class is one of the \l{Model/View Classes}
+ and is part of Qt's \l{Model/View Programming}{model/view framework}.
- The selected items are stored using ranges. Whenever you want to
- modify the selected items use select() and provide either a
- QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.
+ The selected items are stored using ranges. Whenever you want to
+ modify the selected items use select() and provide either a
+ QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.
- The QItemSelectionModel takes a two layer approach to selection
- management, dealing with both selected items that have been committed
- and items that are part of the current selection. The current
- selected items are part of the current interactive selection (for
- example with rubber-band selection or keyboard-shift selections).
+ The QItemSelectionModel takes a two layer approach to selection
+ management, dealing with both selected items that have been committed
+ and items that are part of the current selection. The current
+ selected items are part of the current interactive selection (for
+ example with rubber-band selection or keyboard-shift selections).
- To update the currently selected items, use the bitwise OR of
- QItemSelectionModel::Current and any of the other SelectionFlags.
- If you omit the QItemSelectionModel::Current command, a new current
- selection will be created, and the previous one added to the whole
- selection. All functions operate on both layers; for example,
- selectedItems() will return items from both layers.
+ To update the currently selected items, use the bitwise OR of
+ QItemSelectionModel::Current and any of the other SelectionFlags.
+ If you omit the QItemSelectionModel::Current command, a new current
+ selection will be created, and the previous one added to the whole
+ selection. All functions operate on both layers; for example,
+ selectedItems() will return items from both layers.
- \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}
+ \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}
*/
/*!
- Constructs a selection model that operates on the specified item \a model.
+ Constructs a selection model that operates on the specified item \a model.
*/
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
: QObject(*new QItemSelectionModelPrivate, model)
@@ -875,7 +874,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
}
/*!
- Constructs a selection model that operates on the specified item \a model with \a parent.
+ Constructs a selection model that operates on the specified item \a model with \a parent.
*/
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)
: QObject(*new QItemSelectionModelPrivate, parent)
@@ -898,7 +897,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *par
}
/*!
- \internal
+ \internal
*/
QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model)
: QObject(dd, model)
@@ -921,7 +920,7 @@ QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstra
}
/*!
- Destroys the selection model.
+ Destroys the selection model.
*/
QItemSelectionModel::~QItemSelectionModel()
{
@@ -943,10 +942,10 @@ QItemSelectionModel::~QItemSelectionModel()
}
/*!
- Selects the model item \a index using the specified \a command, and emits
- selectionChanged().
+ Selects the model item \a index using the specified \a command, and emits
+ selectionChanged().
- \sa QItemSelectionModel::SelectionFlags
+ \sa QItemSelectionModel::SelectionFlags
*/
void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
@@ -955,37 +954,37 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::
}
/*!
- \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted whenever the current item changes. The \a previous
- model item index is replaced by the \a current index as the selection's
- current item.
+ This signal is emitted whenever the current item changes. The \a previous
+ model item index is replaced by the \a current index as the selection's
+ current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentIndex() setCurrentIndex() selectionChanged()
+ \sa currentIndex() setCurrentIndex() selectionChanged()
*/
/*!
- \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted if the \a current item changes and its column is
- different to the column of the \a previous current item.
+ This signal is emitted if the \a current item changes and its column is
+ different to the column of the \a previous current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentChanged() currentRowChanged() currentIndex() setCurrentIndex()
+ \sa currentChanged() currentRowChanged() currentIndex() setCurrentIndex()
*/
/*!
- \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted if the \a current item changes and its row is
- different to the row of the \a previous current item.
+ This signal is emitted if the \a current item changes and its row is
+ different to the row of the \a previous current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentChanged() currentColumnChanged() currentIndex() setCurrentIndex()
+ \sa currentChanged() currentColumnChanged() currentIndex() setCurrentIndex()
*/
/*!
@@ -1002,32 +1001,32 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::
*/
/*!
- \enum QItemSelectionModel::SelectionFlag
+ \enum QItemSelectionModel::SelectionFlag
- This enum describes the way the selection model will be updated.
+ This enum describes the way the selection model will be updated.
- \value NoUpdate No selection will be made.
- \value Clear The complete selection will be cleared.
- \value Select All specified indexes will be selected.
- \value Deselect All specified indexes will be deselected.
- \value Toggle All specified indexes will be selected or
- deselected depending on their current state.
- \value Current The current selection will be updated.
- \value Rows All indexes will be expanded to span rows.
- \value Columns All indexes will be expanded to span columns.
- \value SelectCurrent A combination of Select and Current, provided for
- convenience.
- \value ToggleCurrent A combination of Toggle and Current, provided for
- convenience.
- \value ClearAndSelect A combination of Clear and Select, provided for
- convenience.
+ \value NoUpdate No selection will be made.
+ \value Clear The complete selection will be cleared.
+ \value Select All specified indexes will be selected.
+ \value Deselect All specified indexes will be deselected.
+ \value Toggle All specified indexes will be selected or
+ deselected depending on their current state.
+ \value Current The current selection will be updated.
+ \value Rows All indexes will be expanded to span rows.
+ \value Columns All indexes will be expanded to span columns.
+ \value SelectCurrent A combination of Select and Current, provided for
+ convenience.
+ \value ToggleCurrent A combination of Toggle and Current, provided for
+ convenience.
+ \value ClearAndSelect A combination of Clear and Select, provided for
+ convenience.
*/
/*!
- Selects the item \a selection using the specified \a command, and emits
- selectionChanged().
+ Selects the item \a selection using the specified \a command, and emits
+ selectionChanged().
- \sa QItemSelectionModel::SelectionFlag
+ \sa QItemSelectionModel::SelectionFlag
*/
void QItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
{
@@ -1067,7 +1066,7 @@ void QItemSelectionModel::select(const QItemSelection &selection, QItemSelection
}
/*!
- Clears the selection model. Emits selectionChanged() and currentChanged().
+ Clears the selection model. Emits selectionChanged() and currentChanged().
*/
void QItemSelectionModel::clear()
{
@@ -1083,7 +1082,7 @@ void QItemSelectionModel::clear()
}
/*!
- Clears the selection model. Does not emit any signals.
+ Clears the selection model. Does not emit any signals.
*/
void QItemSelectionModel::reset()
{
@@ -1093,8 +1092,8 @@ void QItemSelectionModel::reset()
}
/*!
- \since 4.2
- Clears the selection in the selection model. Emits selectionChanged().
+ \since 4.2
+ Clears the selection in the selection model. Emits selectionChanged().
*/
void QItemSelectionModel::clearSelection()
{
@@ -1110,14 +1109,14 @@ void QItemSelectionModel::clearSelection()
/*!
- Sets the model item \a index to be the current item, and emits
- currentChanged(). The current item is used for keyboard navigation and
- focus indication; it is independent of any selected items, although a
- selected item can also be the current item.
+ Sets the model item \a index to be the current item, and emits
+ currentChanged(). The current item is used for keyboard navigation and
+ focus indication; it is independent of any selected items, although a
+ selected item can also be the current item.
- Depending on the specified \a command, the \a index can also become part
- of the current selection.
- \sa select()
+ Depending on the specified \a command, the \a index can also become part
+ of the current selection.
+ \sa select()
*/
void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
@@ -1141,8 +1140,8 @@ void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelecti
}
/*!
- Returns the model item index for the current item, or an invalid index
- if there is no current item.
+ Returns the model item index for the current item, or an invalid index
+ if there is no current item.
*/
QModelIndex QItemSelectionModel::currentIndex() const
{
@@ -1150,7 +1149,7 @@ QModelIndex QItemSelectionModel::currentIndex() const
}
/*!
- Returns true if the given model item \a index is selected.
+ Returns true if the given model item \a index is selected.
*/
bool QItemSelectionModel::isSelected(const QModelIndex &index) const
{
@@ -1187,12 +1186,12 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const
}
/*!
- Returns true if all items are selected in the \a row with the given
- \a parent.
+ Returns true if all items are selected in the \a row with the given
+ \a parent.
- Note that this function is usually faster than calling isSelected()
- on all items in the same row and that unselectable items are
- ignored.
+ Note that this function is usually faster than calling isSelected()
+ on all items in the same row and that unselectable items are
+ ignored.
*/
bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) const
{
@@ -1247,12 +1246,12 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons
}
/*!
- Returns true if all items are selected in the \a column with the given
- \a parent.
+ Returns true if all items are selected in the \a column with the given
+ \a parent.
- Note that this function is usually faster than calling isSelected()
- on all items in the same column and that unselectable items are
- ignored.
+ Note that this function is usually faster than calling isSelected()
+ on all items in the same column and that unselectable items are
+ ignored.
*/
bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent) const
{
@@ -1307,8 +1306,8 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent
}
/*!
- Returns true if there are any items selected in the \a row with the given
- \a parent.
+ Returns true if there are any items selected in the \a row with the given
+ \a parent.
*/
bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &parent) const
{
@@ -1336,8 +1335,8 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
}
/*!
- Returns true if there are any items selected in the \a column with the given
- \a parent.
+ Returns true if there are any items selected in the \a column with the given
+ \a parent.
*/
bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelIndex &parent) const
{
@@ -1377,15 +1376,14 @@ bool QItemSelectionModel::hasSelection() const
QItemSelection sel = d->ranges;
sel.merge(d->currentSelection, d->currentCommand);
return !sel.isEmpty();
- }
- else {
+ } else {
return !(d->ranges.isEmpty() && d->currentSelection.isEmpty());
}
}
/*!
- Returns a list of all selected model item indexes. The list contains no
- duplicates, and is not sorted.
+ Returns a list of all selected model item indexes. The list contains no
+ duplicates, and is not sorted.
*/
QModelIndexList QItemSelectionModel::selectedIndexes() const
{
@@ -1396,10 +1394,10 @@ QModelIndexList QItemSelectionModel::selectedIndexes() const
}
/*!
- \since 4.2
- Returns the indexes in the given \a column for the rows where all columns are selected.
+ \since 4.2
+ Returns the indexes in the given \a column for the rows where all columns are selected.
- \sa selectedIndexes(), selectedColumns()
+ \sa selectedIndexes(), selectedColumns()
*/
QModelIndexList QItemSelectionModel::selectedRows(int column) const
@@ -1460,7 +1458,7 @@ QModelIndexList QItemSelectionModel::selectedColumns(int row) const
}
/*!
- Returns the selection ranges stored in the selection model.
+ Returns the selection ranges stored in the selection model.
*/
const QItemSelection QItemSelectionModel::selection() const
{
@@ -1480,7 +1478,7 @@ const QItemSelection QItemSelectionModel::selection() const
}
/*!
- Returns the item model operated on by the selection model.
+ Returns the item model operated on by the selection model.
*/
const QAbstractItemModel *QItemSelectionModel::model() const
{
@@ -1488,8 +1486,8 @@ const QAbstractItemModel *QItemSelectionModel::model() const
}
/*!
- Compares the two selections \a newSelection and \a oldSelection
- and emits selectionChanged() with the deselected and selected items.
+ Compares the two selections \a newSelection and \a oldSelection
+ and emits selectionChanged() with the deselected and selected items.
*/
void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelection,
const QItemSelection &oldSelection)
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 45939c1..a322fe4 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE
allowing perspective transformations. QTransform's toAffine()
method allows casting QTransform to QMatrix. If a perspective
transformation has been specified on the matrix, then the
- conversion to an affine QMatrix will cause loss of data.
+ conversion will cause loss of data.
QTransform is the recommended transformation class in Qt.
@@ -125,11 +125,13 @@ QT_BEGIN_NAMESPACE
which returns true if the matrix is non-singular (i.e. AB = BA =
I). The inverted() function returns an inverted copy of \e this
matrix if it is invertible (otherwise it returns the identity
- matrix). In addition, QTransform provides the det() function
- returning the matrix's determinant.
+ matrix), and adjoint() returns the matrix's classical adjoint.
+ In addition, QTransform provides the determinant() function which
+ returns the matrix's determinant.
- Finally, the QTransform class supports matrix multiplication, and
- objects of the class can be streamed as well as compared.
+ Finally, the QTransform class supports matrix multiplication, addition
+ and subtraction, and objects of the class can be streamed as well
+ as compared.
\tableofcontents
@@ -191,7 +193,7 @@ QT_BEGIN_NAMESPACE
The various matrix elements can be set when constructing the
matrix, or by using the setMatrix() function later on. They can also
be manipulated using the translate(), rotate(), scale() and
- shear() convenience functions, The currently set values can be
+ shear() convenience functions. The currently set values can be
retrieved using the m11(), m12(), m13(), m21(), m22(), m23(),
m31(), m32(), m33(), dx() and dy() functions.
@@ -204,9 +206,9 @@ QT_BEGIN_NAMESPACE
to 0) mapping a point to itself. Shearing is controlled by \c m12
and \c m21. Setting these elements to values different from zero
will twist the coordinate system. Rotation is achieved by
- carefully setting both the shearing factors and the scaling
- factors. Perspective transformation is achieved by carefully setting
- both the projection factors and the scaling factors.
+ setting both the shearing factors and the scaling factors. Perspective
+ transformation is achieved by setting both the projection factors and
+ the scaling factors.
Here's the combined transformations example using basic matrix
operations:
@@ -958,8 +960,8 @@ QTransform & QTransform::operator=(const QTransform &matrix)
/*!
Resets the matrix to an identity matrix, i.e. all elements are set
- to zero, except \c m11 and \c m22 (specifying the scale) which are
- set to 1.
+ to zero, except \c m11 and \c m22 (specifying the scale) and \c m33
+ which are set to 1.
\sa QTransform(), isIdentity(), {QTransform#Basic Matrix
Operations}{Basic Matrix Operations}
@@ -1773,7 +1775,7 @@ bool QTransform::quadToQuad(const QPolygonF &one,
Sets the matrix elements to the specified values, \a m11,
\a m12, \a m13 \a m21, \a m22, \a m23 \a m31, \a m32 and
\a m33. Note that this function replaces the previous values.
- QMatrix provides the translate(), rotate(), scale() and shear()
+ QTransform provides the translate(), rotate(), scale() and shear()
convenience functions to manipulate the various matrix elements
based on the currently defined coordinate system.
@@ -1951,8 +1953,11 @@ void QTransform::map(int x, int y, int *tx, int *ty) const
}
/*!
- Returns the QTransform cast to a QMatrix.
- */
+ Returns the QTransform as an affine matrix.
+
+ \warning If a perspective transformation has been specified,
+ then the conversion will cause loss of data.
+*/
const QMatrix &QTransform::toAffine() const
{
return affine;
@@ -2030,8 +2035,9 @@ QTransform::operator QVariant() const
/*!
\fn qreal QTransform::det() const
+ \obsolete
- Returns the matrix's determinant.
+ Returns the matrix's determinant. Use determinant() instead.
*/
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index c869976..598fe6b 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -564,7 +564,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
/*!
\enum QStyle::PrimitiveElement
- This enum describes that various primitive elements. A
+ This enum describes the various primitive elements. A
primitive element is a common GUI element, such as a checkbox
indicator or button bevel.
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 7547dda..0ff7995 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -5007,11 +5007,6 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
of the painter used to draw the item. By default, if no
transformations are applied, its value is 1. If zoomed out 1:2, the level
of detail will be 0.5, and if zoomed in 2:1, its value is 2.
-
- For more advanced level-of-detail metrics, use
- QStyleOptionGraphicsItem::matrix directly.
-
- \sa QStyleOptionGraphicsItem::matrix
*/
qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform)
{
@@ -5038,20 +5033,32 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
Make use of this rectangle to speed up item drawing when only parts of the
item are exposed. If the whole item is exposed, this rectangle will be the
same as QGraphicsItem::boundingRect().
+
+ This member is only initialized for items that have the
+ QGraphicsItem::ItemUsesExtendedStyleOption flag set.
*/
/*!
\variable QStyleOptionGraphicsItem::matrix
\brief the complete transformation matrix for the item
+ \obsolete
- This matrix is the sum of the item's scene matrix and the matrix of the
- painter used for drawing the item. It is provided for convenience,
+ The QMatrix provided through this member does include information about
+ any perspective transformations applied to the view or item. To get the
+ correct transformation matrix, use QPainter::transform() on the painter
+ passed into the QGraphicsItem::paint() implementation.
+
+ This matrix is the combination of the item's scene matrix and the matrix
+ of the painter used for drawing the item. It is provided for convenience,
allowing anvanced level-of-detail metrics that can be used to speed up
item drawing.
- To find the dimentions of an item in screen coordinates (i.e., pixels),
+ To find the dimensions of an item in screen coordinates (i.e., pixels),
you can use the mapping functions of QMatrix, such as QMatrix::map().
+ This member is only initialized for items that have the
+ QGraphicsItem::ItemUsesExtendedStyleOption flag set.
+
\sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
*/
@@ -5059,7 +5066,7 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
\variable QStyleOptionGraphicsItem::levelOfDetail
\obsolete
- Use QStyleOptionGraphicsItem::levelOfDetailFromTransform
+ Use QStyleOptionGraphicsItem::levelOfDetailFromTransform()
together with QPainter::worldTransform() instead.
*/
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 4e43418..a3dd83e 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn Type QTextLength::type() const
- Returns the type of length.
+ Returns the type of this length object.
\sa QTextLength::Type
*/
@@ -129,9 +129,15 @@ QT_BEGIN_NAMESPACE
/*!
\enum QTextLength::Type
- \value VariableLength
- \value FixedLength
- \value PercentageLength
+ This enum describes the different types a length object can
+ have.
+
+ \value VariableLength The width of the object is variable
+ \value FixedLength The width of the object is fixed
+ \value PercentageLength The width of the object is in
+ percentage of the maximum width
+
+ \sa type()
*/
/*!
@@ -417,7 +423,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
more useful, and describe the formatting that is applied to
specific parts of the document.
- A format has a \c FormatType which specifies the kinds of thing it
+ A format has a \c FormatType which specifies the kinds of text item it
can format; e.g. a block of text, a list, a table, etc. A format
also has various properties (some specific to particular format
types), as described by the Property enum. Every property has a
@@ -447,24 +453,32 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
/*!
\enum QTextFormat::FormatType
- \value InvalidFormat
- \value BlockFormat
- \value CharFormat
- \value ListFormat
- \value TableFormat
- \value FrameFormat
+ This enum describes the text item a QTextFormat object is formatting.
+
+ \value InvalidFormat An invalid format as created by the default
+ constructor
+ \value BlockFormat The object formats a text block
+ \value CharFormat The object formats a single character
+ \value ListFormat The object formats a list
+ \value TableFormat The object formats a table
+ \value FrameFormat The object formats a frame
\value UserFormat
+
+ \sa QTextCharFormat, QTextBlockFormat, QTextListFormat,
+ QTextTableFormat, type()
*/
/*!
\enum QTextFormat::Property
- \value ObjectIndex
+ This enum describes the different properties a format can have.
+
+ \value ObjectIndex The index of the formatted object. See objectIndex().
Paragraph and character properties
- \value CssFloat
+ \value CssFloat How a frame is located relative to the surrounding text
\value LayoutDirection The layout direction of the text in the document
(Qt::LayoutDirection).
@@ -482,25 +496,25 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value BlockRightMargin
\value TextIndent
\value TabPositions Specifies the tab positions. The tab positions are structs of QTextOption::Tab which are stored in
- a QList (internally, in a QList<QVariant>).
+ a QList (internally, in a QList<QVariant>).
\value BlockIndent
\value BlockNonBreakableLines
- \value BlockTrailingHorizontalRulerWidth
+ \value BlockTrailingHorizontalRulerWidth The width of a horizontal ruler element.
Character properties
\value FontFamily
\value FontPointSize
+ \value FontPixelSize
\value FontSizeAdjustment Specifies the change in size given to the fontsize already set using
FontPointSize or FontPixelSize.
+ \value FontFixedPitch
\omitvalue FontSizeIncrement
\value FontWeight
\value FontItalic
\value FontUnderline \e{This property has been deprecated.} Use QTextFormat::TextUnderlineStyle instead.
\value FontOverline
\value FontStrikeOut
- \value FontFixedPitch
- \value FontPixelSize
\value FontCapitalization Specifies the capitalization type that is to be applied to the text.
\value FontLetterSpacing Changes the default spacing between individual letters in the font. The value is
specified in percentage, with 100 as the default value.
@@ -512,7 +526,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\omitvalue FirstFontProperty
\omitvalue LastFontProperty
-
+
\value TextUnderlineColor
\value TextVerticalAlignment
\value TextOutline
@@ -533,7 +547,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value FrameBorder
\value FrameBorderBrush
- \value FrameBorderStyle
+ \value FrameBorderStyle See the \l{QTextFrameFormat::BorderStyle}{BorderStyle} enum.
\value FrameBottomMargin
\value FrameHeight
\value FrameLeftMargin
@@ -565,33 +579,46 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
Selection properties
- \value FullWidthSelection When set on the characterFormat of a selection, the whole width of the text will be shown selected
+ \value FullWidthSelection When set on the characterFormat of a selection,
+ the whole width of the text will be shown selected.
Page break properties
- \value PageBreakPolicy
+ \value PageBreakPolicy Specifies how pages are broken. See the PageBreakFlag enum.
\value UserProperty
+
+ \sa property(), setProperty()
*/
/*!
\enum QTextFormat::ObjectTypes
+ This enum describes what kind of QTextObject this format is associated with.
+
\value NoObject
\value ImageObject
\value TableObject
\value TableCellObject
\value UserObject The first object that can be used for application-specific purposes.
+
+ \sa QTextObject, QTextTable, QTextObject::format()
*/
/*!
\enum QTextFormat::PageBreakFlag
\since 4.2
+ This enum describes how page breaking is performed when printing. It maps to the
+ corresponding css properties.
+
\value PageBreak_Auto The page break is determined automatically depending on the
available space on the current page
\value PageBreak_AlwaysBefore The page is always broken before the paragraph/table
\value PageBreak_AlwaysAfter A new page is always started after the paragraph/table
+
+ \sa QTextBlockFormat::pageBreakPolicy(), QTextFrameFormat::pageBreakPolicy(),
+ PageBreakPolicy
*/
/*!
@@ -971,6 +998,8 @@ QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
/*!
Returns the property specified by the given \a propertyId.
+
+ \sa Property
*/
QVariant QTextFormat::property(int propertyId) const
{
@@ -979,6 +1008,8 @@ QVariant QTextFormat::property(int propertyId) const
/*!
Sets the property specified by the \a propertyId to the given \a value.
+
+ \sa Property
*/
void QTextFormat::setProperty(int propertyId, const QVariant &value)
{
@@ -1006,8 +1037,10 @@ void QTextFormat::setProperty(int propertyId, const QVector<QTextLength> &value)
}
/*!
- Clears the value of the property given by \a propertyId
- */
+ Clears the value of the property given by \a propertyId
+
+ \sa Property
+*/
void QTextFormat::clearProperty(int propertyId)
{
if (!d)
@@ -1019,14 +1052,18 @@ void QTextFormat::clearProperty(int propertyId)
/*!
\fn void QTextFormat::setObjectType(int type)
- Sets the text format's object \a type. See \c{ObjectTypes}.
+ Sets the text format's object type to \a type.
+
+ \sa ObjectTypes, objectType()
*/
/*!
\fn int QTextFormat::objectType() const
- Returns the text format's object type. See \c{ObjectTypes}.
+ Returns the text format's object type.
+
+ \sa ObjectTypes, setObjectType()
*/
@@ -2116,17 +2153,17 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
/*!
\fn void QTextListFormat::setStyle(Style style)
- Sets the list format's \a style. See \c{Style} for the available styles.
+ Sets the list format's \a style.
- \sa style()
+ \sa style() Style
*/
/*!
\fn Style QTextListFormat::style() const
- Returns the list format's style. See \c{Style}.
+ Returns the list format's style.
- \sa setStyle()
+ \sa setStyle() Style
*/
@@ -2188,16 +2225,21 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
/*!
\enum QTextFrameFormat::Position
+ This enum describes how a frame is located relative to the surrounding text.
+
\value InFlow
\value FloatLeft
\value FloatRight
+ \sa position() CssFloat
*/
/*!
\enum QTextFrameFormat::BorderStyle
\since 4.3
+ This enum describes different border styles for the text frame.
+
\value BorderStyle_None
\value BorderStyle_Dotted
\value BorderStyle_Dashed
@@ -2210,6 +2252,7 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\value BorderStyle_Inset
\value BorderStyle_Outset
+ \sa borderStyle() FrameBorderStyle
*/
/*!
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 3f7675b..6be30cd 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -446,13 +446,12 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
continue; //we don't really position these!
} else {
const QString s = action->text();
- if(!s.isEmpty()) {
- sz = fm.size(Qt::TextShowMnemonic, s);
- }
-
QIcon is = action->icon();
+ // If an icon is set, only the icon is visible
if (!is.isNull())
sz = sz.expandedTo(QSize(icone, icone));
+ else if (!s.isEmpty())
+ sz = fm.size(Qt::TextShowMnemonic, s);
}
//let the style modify the above size..
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index f8607cc..0577f9a 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -745,8 +745,11 @@ QGLFramebufferObject::~QGLFramebufferObject()
The framebuffer can become invalid if the initialization process
fails, the user attaches an invalid buffer to the framebuffer
- object, or a non-power of 2 width/height is specified as the
+ object, or a non-power of two width/height is specified as the
texture size if the texture target is \c{GL_TEXTURE_2D}.
+ The non-power of two limitation does not apply if the OpenGL version
+ is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension
+ is present.
*/
bool QGLFramebufferObject::isValid() const
{
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 4b76ef6..030e51f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -745,6 +745,7 @@ QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType typ
return new QDirectFBPixmapData(type);
}
+#if (Q_DIRECTFB_VERSION >= 0x000923)
#ifdef QT_NO_DEBUG
struct FlagDescription;
static const FlagDescription *accelerationDescriptions = 0;
@@ -802,9 +803,6 @@ static const FlagDescription drawDescriptions[] = {
};
#endif
-
-
-#if (Q_DIRECTFB_VERSION >= 0x000923)
static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags)
{
#ifdef QT_NO_DEBUG
diff --git a/src/qt3support/sql/q3sqlcursor.cpp b/src/qt3support/sql/q3sqlcursor.cpp
index 6b0c69f..aa6aae2 100644
--- a/src/qt3support/sql/q3sqlcursor.cpp
+++ b/src/qt3support/sql/q3sqlcursor.cpp
@@ -879,7 +879,7 @@ QString Q3SqlCursor::toString(const QString& prefix, QSqlField* field, const QSt
{
QString f;
if (field && driver()) {
- f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + field->name();
+ f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + driver()->escapeIdentifier(field->name(), QSqlDriver::FieldName);
f += QLatin1Char(' ') + fieldSep + QLatin1Char(' ');
if (field->isNull()) {
f += QLatin1String("NULL");
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 474c53d..a32b3aa 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -868,11 +868,13 @@ bool QDB2Result::fetch(int i)
SQL_FETCH_ABSOLUTE,
actualIdx);
}
- if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
+ if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r != SQL_NO_DATA) {
setLastError(qMakeError(QCoreApplication::translate("QDB2Result",
"Unable to fetch record %1").arg(i), QSqlError::StatementError, d));
return false;
}
+ else if (r == SQL_NO_DATA)
+ return false;
setAt(i);
return true;
}
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 6d57d2f..7a6e268 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -53,6 +53,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qobject.h>
+#include <QtCore/qvariant.h>
#include <QtCore/qurl.h>
#include <QtCore/qpoint.h>
@@ -146,6 +147,30 @@ template<> inline char *toString(const QUrl &uri)
return qstrdup(uri.toEncoded().constData());
}
+template<> inline char *toString(const QVariant &v)
+{
+ QByteArray vstring("QVariant(");
+ if (v.isValid()) {
+ QByteArray type(v.typeName());
+ if (type.isEmpty()) {
+ type = QByteArray::number(v.userType());
+ }
+ vstring.append(type);
+ if (!v.isNull()) {
+ vstring.append(',');
+ if (v.canConvert(QVariant::String)) {
+ vstring.append(qVariantValue<QString>(v).toLatin1());
+ }
+ else {
+ vstring.append("<value not representable as string>");
+ }
+ }
+ }
+ vstring.append(')');
+
+ return qstrdup(vstring.constData());
+}
+
#ifndef QTEST_NO_SPECIALIZATIONS
template<>
#endif
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index dac2c8a..9177490 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -244,6 +244,16 @@ public:
class QXmlParseExceptionPrivate
{
public:
+ QXmlParseExceptionPrivate()
+ : column(-1), line(-1)
+ {
+ }
+ QXmlParseExceptionPrivate(const QXmlParseExceptionPrivate &other)
+ : msg(other.msg), column(other.column), line(other.line),
+ pub(other.pub), sys(other.sys)
+ {
+ }
+
QString msg;
int column;
int line;
@@ -556,6 +566,14 @@ QXmlParseException::QXmlParseException(const QString& name, int c, int l,
}
/*!
+ Creates a copy of \a other.
+*/
+QXmlParseException::QXmlParseException(const QXmlParseException& other)
+{
+ d = new QXmlParseExceptionPrivate(*other.d);
+}
+
+/*!
Destroys the QXmlParseException.
*/
QXmlParseException::~QXmlParseException()
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 5b1592c..18dc332 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -194,6 +194,7 @@ class Q_XML_EXPORT QXmlParseException
public:
explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1,
const QString &p = QString(), const QString &s = QString());
+ QXmlParseException(const QXmlParseException &other);
~QXmlParseException();
int columnNumber() const;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 9f1693d..7f6f322 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -44,6 +44,7 @@
#include <private/qtextcontrol_p.h>
#include <private/qgraphicsitem_p.h>
+#include <private/qgraphicsview_p.h>
#include <QStyleOptionGraphicsItem>
#include <QAbstractTextDocumentLayout>
#include <QBitmap>
@@ -6884,44 +6885,21 @@ void tst_QGraphicsItem::update()
void tst_QGraphicsItem::setTransformProperties_data()
{
QTest::addColumn<QPointF>("origin");
- QTest::addColumn<qreal>("rotationX");
- QTest::addColumn<qreal>("rotationY");
- QTest::addColumn<qreal>("rotationZ");
- QTest::addColumn<qreal>("scaleX");
- QTest::addColumn<qreal>("scaleY");
- QTest::addColumn<qreal>("shearX");
- QTest::addColumn<qreal>("shearY");
+ QTest::addColumn<qreal>("rotation");
+ QTest::addColumn<qreal>("scale");
- QTest::newRow("nothing") << QPointF() << qreal(0.0) << qreal(0.0) << qreal(0.0)
- << qreal(1.0) << qreal(1.0) << qreal(0.0) << qreal(0.0);
+ QTest::newRow("nothing") << QPointF() << qreal(0.0) << qreal(1.0);
- QTest::newRow("rotationZ") << QPointF() << qreal(0.0) << qreal(0.0) << qreal(42.2)
- << qreal(1.0) << qreal(1.0) << qreal(0.0) << qreal(0.0);
+ QTest::newRow("rotation") << QPointF() << qreal(42.2) << qreal(1.0);
- QTest::newRow("rotationXY") << QPointF() << qreal(12.5) << qreal(53.6) << qreal(0.0)
- << qreal(1.0) << qreal(1.0) << qreal(0.0) << qreal(0.0);
+ QTest::newRow("rotation dicentred") << QPointF(qreal(22.3), qreal(-56.2))
+ << qreal(-2578.2)
+ << qreal(1.0);
- QTest::newRow("rotationXYZ") << QPointF() << qreal(-25) << qreal(12) << qreal(556)
- << qreal(1.0) << qreal(1.0) << qreal(0.0) << qreal(0.0);
+ QTest::newRow("Scale") << QPointF() << qreal(0.0)
+ << qreal(6);
- QTest::newRow("rotationXYZ dicentred") << QPointF(-53, 25.2)
- << qreal(-2578.2) << qreal(4565.2) << qreal(56)
- << qreal(1.0) << qreal(1.0) << qreal(0.0) << qreal(0.0);
-
- QTest::newRow("Scale") << QPointF() << qreal(0.0) << qreal(0.0) << qreal(0.0)
- << qreal(6) << qreal(0.5) << qreal(0.0) << qreal(0.0);
-
- QTest::newRow("Shear") << QPointF() << qreal(0.0) << qreal(0.0) << qreal(0.0)
- << qreal(1.0) << qreal(1.0) << qreal(2.2) << qreal(0.5);
-
- QTest::newRow("Scale and Shear") << QPointF() << qreal(0.0) << qreal(0.0) << qreal(0.0)
- << qreal(5.2) << qreal(2.1) << qreal(5.2) << qreal(5.5);
-
- QTest::newRow("Everything") << QPointF() << qreal(41) << qreal(-23) << qreal(0.56)
- << qreal(8.2) << qreal(-0.2) << qreal(-12) << qreal(-0.8);
-
- QTest::newRow("Everything dicentred") << QPointF(qreal(22.3), qreal(-56.2)) << qreal(-175) << qreal(196) << qreal(-1260)
- << qreal(4) << qreal(2) << qreal(2.56) << qreal(0.8);
+ QTest::newRow("Everything dicentred") << QPointF(qreal(22.3), qreal(-56.2)) << qreal(-175) << qreal(196);
}
/**
@@ -6932,92 +6910,61 @@ void tst_QGraphicsItem::setTransformProperties_data()
void tst_QGraphicsItem::setTransformProperties()
{
QFETCH(QPointF,origin);
- QFETCH(qreal,rotationX);
- QFETCH(qreal,rotationY);
- QFETCH(qreal,rotationZ);
- QFETCH(qreal,scaleX);
- QFETCH(qreal,scaleY);
- QFETCH(qreal,shearX);
- QFETCH(qreal,shearY);
+ QFETCH(qreal,rotation);
+ QFETCH(qreal,scale);
QTransform result;
result.translate(origin.x(), origin.y());
- result.rotate(rotationX, Qt::XAxis);
- result.rotate(rotationY, Qt::YAxis);
- result.rotate(rotationZ, Qt::ZAxis);
- result.shear(shearX, shearY);
- result.scale(scaleX, scaleY);
+ result.rotate(rotation, Qt::ZAxis);
+ result.scale(scale, scale);
result.translate(-origin.x(), -origin.y());
QGraphicsScene scene;
QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 100, 100));
scene.addItem(item);
- item->setRotation(rotationX, rotationY, rotationZ);
- item->setScale(scaleX, scaleY);
- item->setShear(shearX, shearY);
- item->setTransformOrigin(origin);
+ item->setRotation(rotation);
+ item->setScale(scale);
+ item->setTransformOriginPoint(origin);
- QCOMPARE(item->xRotation(), rotationX);
- QCOMPARE(item->yRotation(), rotationY);
- QCOMPARE(item->zRotation(), rotationZ);
- QCOMPARE(item->xScale(), scaleX);
- QCOMPARE(item->yScale(), scaleY);
- QCOMPARE(item->horizontalShear(), shearX);
- QCOMPARE(item->verticalShear(), shearY);
- QCOMPARE(item->transformOrigin(), origin);
+ QCOMPARE(item->rotation(), rotation);
+ QCOMPARE(item->scale(), scale);
+ QCOMPARE(item->transformOriginPoint(), origin);
QCOMPARE(QTransform(), item->transform());
QCOMPARE(result, item->sceneTransform());
//-----------------------------------------------------------------
//Change the rotation Z
- item->setZRotation(45);
+ item->setRotation(45);
QTransform result2;
result2.translate(origin.x(), origin.y());
- result2.rotate(rotationX, Qt::XAxis);
- result2.rotate(rotationY, Qt::YAxis);
- result2.rotate(45, Qt::ZAxis);
- result2.shear(shearX, shearY);
- result2.scale(scaleX, scaleY);
+ result2.rotate(45);
+ result2.scale(scale, scale);
result2.translate(-origin.x(), -origin.y());
- QCOMPARE(item->xRotation(), rotationX);
- QCOMPARE(item->yRotation(), rotationY);
- QCOMPARE(item->zRotation(), 45.0);
- QCOMPARE(item->xScale(), scaleX);
- QCOMPARE(item->yScale(), scaleY);
- QCOMPARE(item->horizontalShear(), shearX);
- QCOMPARE(item->verticalShear(), shearY);
- QCOMPARE(item->transformOrigin(), origin);
+ QCOMPARE(item->rotation(), 45.);
+ QCOMPARE(item->scale(), scale);
+ QCOMPARE(item->transformOriginPoint(), origin);
QCOMPARE(QTransform(), item->transform());
QCOMPARE(result2, item->sceneTransform());
//-----------------------------------------------------------------
- // calling setTransform() and setPos shoukld change the sceneTransform
+ // calling setTransform() and setPos should change the sceneTransform
item->setTransform(result);
item->setPos(100, -150.5);
- QCOMPARE(item->xRotation(), rotationX);
- QCOMPARE(item->yRotation(), rotationY);
- QCOMPARE(item->zRotation(), 45.0);
- QCOMPARE(item->xScale(), scaleX);
- QCOMPARE(item->yScale(), scaleY);
- QCOMPARE(item->horizontalShear(), shearX);
- QCOMPARE(item->verticalShear(), shearY);
- QCOMPARE(item->transformOrigin(), origin);
+ QCOMPARE(item->rotation(), 45.);
+ QCOMPARE(item->scale(), scale);
+ QCOMPARE(item->transformOriginPoint(), origin);
QCOMPARE(result, item->transform());
- QTransform result3;
+ QTransform result3(result);
result3.translate(origin.x(), origin.y());
- result3 = result * result3;
- result3.rotate(rotationX, Qt::XAxis);
- result3.rotate(rotationY, Qt::YAxis);
- result3.rotate(45, Qt::ZAxis);
- result3.shear(shearX, shearY);
- result3.scale(scaleX, scaleY);
+ result3.rotate(45);
+ result3.scale(scale, scale);
result3.translate(-origin.x(), -origin.y());
result3 *= QTransform::fromTranslate(100, -150.5); //the pos;
@@ -7034,10 +6981,9 @@ void tst_QGraphicsItem::setTransformProperties()
item1->setPos(12.3, -5);
item2->setPos(12.3, -5);
- item1->setRotation(rotationX, rotationY, rotationZ);
- item1->setScale(scaleX, scaleY);
- item1->setShear(shearX, shearY);
- item1->setTransformOrigin(origin);
+ item1->setRotation(rotation);
+ item1->setScale(scale);
+ item1->setTransformOriginPoint(origin);
item2->setTransform(result);
@@ -7046,36 +6992,6 @@ void tst_QGraphicsItem::setTransformProperties()
QCOMPARE_TRANSFORM(item1->itemTransform(item2), QTransform());
QCOMPARE_TRANSFORM(item2->itemTransform(item1), QTransform());
}
-
- {//with center origin on the item
- QGraphicsRectItem *item1 = new QGraphicsRectItem(QRectF(50.2, -150, 230.5, 119));
- scene.addItem(item1);
- QGraphicsRectItem *item2 = new QGraphicsRectItem(QRectF(50.2, -150, 230.5, 119));
- scene.addItem(item2);
-
- item1->setPos(12.3, -5);
- item2->setPos(12.3, -5);
- item1->setTransformOrigin(origin);
- item2->setTransformOrigin(origin);
-
- item1->setRotation(rotationX, rotationY, rotationZ);
- item1->setScale(scaleX, scaleY);
- item1->setShear(shearX, shearY);
-
- QTransform tr;
- tr.rotate(rotationX, Qt::XAxis);
- tr.rotate(rotationY, Qt::YAxis);
- tr.rotate(rotationZ, Qt::ZAxis);
- tr.shear(shearX, shearY);
- tr.scale(scaleX, scaleY);
-
- item2->setTransform(tr);
-
- QCOMPARE_TRANSFORM(item1->sceneTransform(), item2->sceneTransform());
-
- QCOMPARE_TRANSFORM(item1->itemTransform(item2), QTransform());
- QCOMPARE_TRANSFORM(item2->itemTransform(item1), QTransform());
- }
}
class MyStyleOptionTester : public QGraphicsRectItem
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 27b1da6..d3b8883 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -263,6 +263,7 @@ private slots:
void sendEvent();
void inputMethod_data();
void inputMethod();
+ void dispatchHoverOnPress();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -3729,5 +3730,73 @@ void tst_QGraphicsScene::inputMethod()
QCOMPARE(item->queryCalls, 0);
}
+void tst_QGraphicsScene::dispatchHoverOnPress()
+{
+ QGraphicsScene scene;
+ EventTester *tester1 = new EventTester;
+ tester1->setAcceptHoverEvents(true);
+ EventTester *tester2 = new EventTester;
+ tester2->setAcceptHoverEvents(true);
+ tester2->setPos(30, 30);
+ scene.addItem(tester1);
+ scene.addItem(tester2);
+
+ tester1->eventTypes.clear();
+ tester2->eventTypes.clear();
+
+ {
+ QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress);
+ me.setButton(Qt::LeftButton);
+ me.setButtons(Qt::LeftButton);
+ QGraphicsSceneMouseEvent me2(QEvent::GraphicsSceneMouseRelease);
+ me2.setButton(Qt::LeftButton);
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ QCOMPARE(tester1->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverEnter
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ tester1->eventTypes.clear();
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ QCOMPARE(tester1->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ }
+ {
+ QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress);
+ me.setScenePos(QPointF(30, 30));
+ me.setButton(Qt::LeftButton);
+ me.setButtons(Qt::LeftButton);
+ QGraphicsSceneMouseEvent me2(QEvent::GraphicsSceneMouseRelease);
+ me2.setScenePos(QPointF(30, 30));
+ me2.setButton(Qt::LeftButton);
+ tester1->eventTypes.clear();
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ qDebug() << tester1->eventTypes;
+ QCOMPARE(tester1->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverLeave);
+ QCOMPARE(tester2->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverEnter
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ tester2->eventTypes.clear();
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ QCOMPARE(tester2->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ }
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro
new file mode 100644
index 0000000..709cff6
--- /dev/null
+++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro
@@ -0,0 +1,2 @@
+load(qttest_p4)
+SOURCES += tst_qgraphicstransform.cpp
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
new file mode 100644
index 0000000..672b1f1
--- /dev/null
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <qgraphicsitem.h>
+#include <qgraphicstransform.h>
+#include "../../shared/util.h"
+
+class tst_QGraphicsTransform : public QObject {
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void scale();
+ void rotation();
+ void rotation3d();
+};
+
+
+// This will be called before the first test function is executed.
+// It is only called once.
+void tst_QGraphicsTransform::initTestCase()
+{
+}
+
+// This will be called after the last test function is executed.
+// It is only called once.
+void tst_QGraphicsTransform::cleanupTestCase()
+{
+}
+
+// This will be called before each test function is executed.
+void tst_QGraphicsTransform::init()
+{
+}
+
+// This will be called after every test function.
+void tst_QGraphicsTransform::cleanup()
+{
+}
+
+
+void tst_QGraphicsTransform::scale()
+{
+ QGraphicsScale scale;
+ scale.setOrigin(QPointF(10, 10));
+
+ QTransform t;
+ scale.applyTo(&t);
+
+ QCOMPARE(t, QTransform());
+ QCOMPARE(scale.transform(), QTransform());
+
+ scale.setXScale(10);
+ scale.setOrigin(QPointF(0, 0));
+
+ QTransform res;
+ res.scale(10, 1);
+
+ QCOMPARE(scale.transform(), res);
+ QCOMPARE(scale.transform().map(QPointF(10, 10)), QPointF(100, 10));
+
+ scale.setOrigin(QPointF(10, 10));
+ QCOMPARE(scale.transform().map(QPointF(10, 10)), QPointF(10, 10));
+ QCOMPARE(scale.transform().map(QPointF(11, 10)), QPointF(20, 10));
+}
+
+void tst_QGraphicsTransform::rotation()
+{
+ QGraphicsRotation rotation;
+ rotation.setOrigin(QPointF(10, 10));
+
+ QTransform t;
+ rotation.applyTo(&t);
+
+ QCOMPARE(t, QTransform());
+ QCOMPARE(rotation.transform(), QTransform());
+
+ rotation.setAngle(40);
+ rotation.setOrigin(QPointF(0, 0));
+
+ QTransform res;
+ res.rotate(40);
+
+ QCOMPARE(rotation.transform(), res);
+
+ rotation.setOrigin(QPointF(10, 10));
+ rotation.setAngle(90);
+ QCOMPARE(rotation.transform().map(QPointF(10, 10)), QPointF(10, 10));
+ QCOMPARE(rotation.transform().map(QPointF(20, 10)), QPointF(10, 20));
+}
+
+void tst_QGraphicsTransform::rotation3d()
+{
+ QGraphicsRotation3D rotation;
+ rotation.setOrigin(QPointF(10, 10));
+
+ QTransform t;
+ rotation.applyTo(&t);
+
+ QCOMPARE(t, QTransform());
+ QCOMPARE(rotation.transform(), QTransform());
+
+ rotation.setAngle(180);
+
+ QCOMPARE(t, QTransform());
+ QCOMPARE(rotation.transform(), QTransform());
+
+ rotation.setOrigin(QPointF(0, 0));
+
+ QCOMPARE(t, QTransform());
+ QCOMPARE(rotation.transform(), QTransform());
+}
+
+
+QTEST_MAIN(tst_QGraphicsTransform)
+#include "tst_qgraphicstransform.moc"
+
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 78d13d3..2cfedb1 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1315,6 +1315,12 @@ void tst_QGraphicsWidget::focusNextPrevChild()
void tst_QGraphicsWidget::verifyFocusChain()
{
QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
{
// parent/child focus
SubQGraphicsWidget *w = new SubQGraphicsWidget(0, Qt::Window);
@@ -1448,6 +1454,11 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
+
// delete item in focus chain with no focus and verify chain
SubQGraphicsWidget *parent = new SubQGraphicsWidget(0, Qt::Window);
SubQGraphicsWidget *w = new SubQGraphicsWidget(0, Qt::Window);
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 4991549..65be4fe 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -235,6 +235,9 @@ extern int forwardDeclaredDestructorRunCount;
void tst_QSharedPointer::forwardDeclaration1()
{
+#if defined(Q_CC_SUN)
+ QSKIP("This type of forward declaration is not valid with this compiler", SkipAll);
+#else
externalForwardDeclaration();
struct Wrapper { QSharedPointer<ForwardDeclared> pointer; };
@@ -246,6 +249,7 @@ void tst_QSharedPointer::forwardDeclaration1()
QVERIFY(!w.pointer.isNull());
}
QCOMPARE(forwardDeclaredDestructorRunCount, 1);
+#endif
}
#include "forwarddeclared.h"
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index 9c8c313..8253541 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -335,7 +335,7 @@ public:
if(table2.compare(table.section('.', -1, -1), Qt::CaseInsensitive) == 0) {
table=db.driver()->escapeIdentifier(table2, QSqlDriver::TableName);
wasDropped = q.exec( "drop table " + table);
- dbtables.removeAll(table);
+ dbtables.removeAll(table2);
}
}
}
@@ -430,8 +430,8 @@ public:
return "IDENTITY";
/* if ( db.driverName().startsWith( "QPSQL" ) )
return "SERIAL";*/
- if ( db.driverName().startsWith( "QDB2" ) )
- return "GENERATED BY DEFAULT AS IDENTITY";
+// if ( db.driverName().startsWith( "QDB2" ) )
+// return "GENERATED BY DEFAULT AS IDENTITY";
return QString();
}
@@ -483,6 +483,10 @@ public:
{
return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL") );
}
+ static bool isDB2( QSqlDatabase db )
+ {
+ return db.driverName().startsWith("QDB2") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("db2") );
+ }
// -1 on fail, else Oracle version
static int getOraVersion( QSqlDatabase db )
diff --git a/tests/auto/qxml/tst_qxml.cpp b/tests/auto/qxml/tst_qxml.cpp
index 13de82f..1bc5ef5 100644
--- a/tests/auto/qxml/tst_qxml.cpp
+++ b/tests/auto/qxml/tst_qxml.cpp
@@ -57,6 +57,7 @@ Q_OBJECT
private slots:
void getSetCheck();
void interpretedAs0D() const;
+ void exception();
};
class MyXmlEntityResolver : public QXmlEntityResolver
@@ -213,5 +214,30 @@ void tst_QXml::interpretedAs0D() const
QCOMPARE(myHandler.attrName, QChar(0x010D) + QString::fromLatin1("reated-by"));
}
+void tst_QXml::exception()
+{
+#ifndef QT_NO_EXCEPTIONS
+ QString message = QString::fromLatin1("message");
+ int column = 3;
+ int line = 2;
+ QString publicId = QString::fromLatin1("publicId");
+ QString systemId = QString::fromLatin1("systemId");
+
+ try {
+ QXmlParseException e(message, column, line, publicId, systemId);
+ throw e;
+ }
+ catch (QXmlParseException e) {
+ QCOMPARE(e.message(), message);
+ QCOMPARE(e.columnNumber(), column);
+ QCOMPARE(e.lineNumber(), line);
+ QCOMPARE(e.publicId(), publicId);
+ QCOMPARE(e.systemId(), systemId);
+ }
+#else
+ QSKIP("Exceptions not available", SkipAll);
+#endif
+}
+
QTEST_MAIN(tst_QXml)
#include "tst_qxml.moc"
diff --git a/tests/auto/selftests/cmptest/tst_cmptest.cpp b/tests/auto/selftests/cmptest/tst_cmptest.cpp
index 59dd678..7395210 100644
--- a/tests/auto/selftests/cmptest/tst_cmptest.cpp
+++ b/tests/auto/selftests/cmptest/tst_cmptest.cpp
@@ -50,6 +50,8 @@ class tst_Cmptest: public QObject
private slots:
void compare_boolfuncs();
void compare_pointerfuncs();
+ void compare_tostring();
+ void compare_tostring_data();
};
static bool boolfunc() { return true; }
@@ -76,6 +78,50 @@ void tst_Cmptest::compare_pointerfuncs()
QCOMPARE(&i, intptr());
}
+Q_DECLARE_METATYPE(QVariant)
+
+class PhonyClass
+{};
+
+void tst_Cmptest::compare_tostring_data()
+{
+ QTest::addColumn<QVariant>("actual");
+ QTest::addColumn<QVariant>("expected");
+
+ QTest::newRow("int, string")
+ << QVariant::fromValue(123)
+ << QVariant::fromValue(QString("hi"))
+ ;
+
+ QTest::newRow("both invalid")
+ << QVariant()
+ << QVariant()
+ ;
+
+ QTest::newRow("null hash, invalid")
+ << QVariant(QVariant::Hash)
+ << QVariant()
+ ;
+
+ QTest::newRow("string, null user type")
+ << QVariant::fromValue(QString::fromLatin1("A simple string"))
+ << QVariant(QVariant::Type(qRegisterMetaType<PhonyClass>("PhonyClass")))
+ ;
+
+ QTest::newRow("both non-null user type")
+ << QVariant(qRegisterMetaType<PhonyClass>("PhonyClass"), (const void*)0)
+ << QVariant(qRegisterMetaType<PhonyClass>("PhonyClass"), (const void*)0)
+ ;
+}
+
+void tst_Cmptest::compare_tostring()
+{
+ QFETCH(QVariant, actual);
+ QFETCH(QVariant, expected);
+
+ QCOMPARE(actual, expected);
+}
+
QTEST_MAIN(tst_Cmptest)
#include "tst_cmptest.moc"
diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt
index dc89d9d..f70eba5 100644
--- a/tests/auto/selftests/expected_cmptest.txt
+++ b/tests/auto/selftests/expected_cmptest.txt
@@ -1,8 +1,24 @@
********* Start testing of tst_Cmptest *********
-Config: Using QTest library 4.1.0, Qt 4.1.0
+Config: Using QTest library 4.6.0, Qt 4.6.0
PASS : tst_Cmptest::initTestCase()
PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_pointerfuncs()
+FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same
+ Actual (actual): QVariant(int,123)
+ Expected (expected): QVariant(QString,hi)
+ Loc: [/home/rmcgover/depot/qt/master/tests/auto/selftests/cmptest/tst_cmptest.cpp(122)]
+FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same
+ Actual (actual): QVariant(QVariantHash)
+ Expected (expected): QVariant()
+ Loc: [/home/rmcgover/depot/qt/master/tests/auto/selftests/cmptest/tst_cmptest.cpp(122)]
+FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same
+ Actual (actual): QVariant(QString,A simple string)
+ Expected (expected): QVariant(PhonyClass)
+ Loc: [/home/rmcgover/depot/qt/master/tests/auto/selftests/cmptest/tst_cmptest.cpp(122)]
+FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same
+ Actual (actual): QVariant(PhonyClass,<value not representable as string>)
+ Expected (expected): QVariant(PhonyClass,<value not representable as string>)
+ Loc: [/home/rmcgover/depot/qt/master/tests/auto/selftests/cmptest/tst_cmptest.cpp(122)]
PASS : tst_Cmptest::cleanupTestCase()
-Totals: 4 passed, 0 failed, 0 skipped
+Totals: 4 passed, 4 failed, 0 skipped
********* Finished testing of tst_Cmptest *********
diff --git a/tools/assistant/tools/qhelpconverter/adpreader.cpp b/tools/assistant/tools/qhelpconverter/adpreader.cpp
index 35f8878..c427038 100644
--- a/tools/assistant/tools/qhelpconverter/adpreader.cpp
+++ b/tools/assistant/tools/qhelpconverter/adpreader.cpp
@@ -39,8 +39,16 @@
**
****************************************************************************/
+#include <QRegExp>
+
#include "adpreader.h"
+static bool versionIsAtLeast320(const QString &version)
+{
+ return QRegExp("\\d.\\d\\.\\d").exactMatch(version)
+ && (version[0] > '3' || (version[0] == '3' && version[2] >= '2'));
+}
+
QT_BEGIN_NAMESPACE
void AdpReader::readData(const QByteArray &contents)
@@ -51,11 +59,11 @@ void AdpReader::readData(const QByteArray &contents)
m_properties.clear();
m_files.clear();
addData(contents);
- while (!atEnd()) {
- readNext();
- if (isStartElement()) {
+ while (!atEnd()) {
+ readNext();
+ if (isStartElement()) {
if (name().toString().toLower() == QLatin1String("assistantconfig")
- && attributes().value(QLatin1String("version")) == QLatin1String("3.2.0")) {
+ && versionIsAtLeast320(attributes().value(QLatin1String("version")).toString())) {
readProject();
} else if (name().toString().toLower() == QLatin1String("dcf")) {
QString ref = attributes().value(QLatin1String("ref")).toString();
@@ -66,8 +74,8 @@ void AdpReader::readData(const QByteArray &contents)
} else {
raiseError();
}
- }
- }
+ }
+ }
}
QList<ContentItem> AdpReader::contents() const
diff --git a/tools/assistant/tools/qhelpconverter/adpreader.h b/tools/assistant/tools/qhelpconverter/adpreader.h
index f2e7509..740a462 100644
--- a/tools/assistant/tools/qhelpconverter/adpreader.h
+++ b/tools/assistant/tools/qhelpconverter/adpreader.h
@@ -50,15 +50,15 @@ QT_BEGIN_NAMESPACE
struct ContentItem {
ContentItem(const QString &t, const QString &r, int d)
- : title(t), reference(r), depth(d) {}
+ : title(t), reference(r), depth(d) {}
QString title;
QString reference;
- int depth;
+ int depth;
};
struct KeywordItem {
KeywordItem(const QString &k, const QString &r)
- : keyword(k), reference(r) {}
+ : keyword(k), reference(r) {}
QString keyword;
QString reference;
};
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index ab74f13..f92391e 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -2881,7 +2881,9 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
}
#endif
-void HtmlGenerator::generateLink(const Atom *atom, const Node * /* relative */, CodeMarker *marker)
+void HtmlGenerator::generateLink(const Atom* atom,
+ const Node* /* relative */,
+ CodeMarker* marker)
{
static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_");
@@ -3472,6 +3474,7 @@ QString HtmlGenerator::getLink(const Atom *atom,
{
QString link;
*node = 0;
+ inObsoleteLink = false;
if (atom->string().contains(":") &&
(atom->string().startsWith("file:")
@@ -3530,10 +3533,12 @@ QString HtmlGenerator::getLink(const Atom *atom,
porting = true;
}
QString name = marker->plainFullName(relative);
- if (!porting && !name.startsWith("Q3"))
+ if (!porting && !name.startsWith("Q3")) {
relative->doc().location().warning(tr("Link to obsolete item '%1' in %2")
.arg(atom->string())
.arg(name));
+ inObsoleteLink = true;
+ }
#if 0
qDebug() << "Link to Obsolete entity"
<< (*node)->name();
@@ -3689,10 +3694,14 @@ void HtmlGenerator::endLink()
out() << "</i>";
}
else {
+ if (inObsoleteLink) {
+ out() << "<sup>(obsolete)</sup>";
+ }
out() << "</a>";
}
}
inLink = false;
+ inObsoleteLink = false;
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index a7f4009..a7632cd 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -230,6 +230,7 @@ class HtmlGenerator : public PageGenerator
DcfSection dcfQmakeRoot;
HelpProjectWriter *helpProjectWriter;
bool inLink;
+ bool inObsoleteLink;
bool inContents;
bool inSectionHeading;
bool inTableHeader;
diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit
index a843c83..f4b36d0 100755
--- a/util/webkit/mkdist-webkit
+++ b/util/webkit/mkdist-webkit
@@ -47,6 +47,7 @@ excluded_directories="$excluded_directories JavaScriptCore/wtf/gtk"
excluded_directories="$excluded_directories JavaScriptCore/wtf/mac"
excluded_directories="$excluded_directories JavaScriptCore/wtf/win"
excluded_directories="$excluded_directories JavaScriptCore/wtf/chromium"
+excluded_directories="$excluded_directories JavaScriptCore/wtf/haiku"
excluded_directories="$excluded_directories WebCore/WebCore.vcproj"
excluded_directories="$excluded_directories WebCore/DerivedSources.make"
@@ -68,21 +69,28 @@ excluded_directories="$excluded_directories WebCore/icu"
excluded_directories="$excluded_directories WebCore/loader/mac"
excluded_directories="$excluded_directories WebCore/loader/win"
+excluded_directories="$excluded_directories WebCore/loader/icon/wince"
excluded_directories="$excluded_directories WebCore/page/gtk"
excluded_directories="$excluded_directories WebCore/page/mac"
excluded_directories="$excluded_directories WebCore/page/wx"
excluded_directories="$excluded_directories WebCore/page/chromium"
+excluded_directories="$excluded_directories WebCore/page/haiku"
excluded_directories="$excluded_directories WebCore/history/mac"
excluded_directories="$excluded_directories WebCore/editing/mac"
excluded_directories="$excluded_directories WebCore/editing/wx"
+excluded_directories="$excluded_directories WebCore/editing/haiku"
+
+excluded_directories="$excluded_directories WebCore/platform/haiku"
excluded_directories="$excluded_directories WebCore/platform/text/wx"
excluded_directories="$excluded_directories WebCore/platform/text/gtk"
excluded_directories="$excluded_directories WebCore/platform/text/chromium"
+excluded_directories="$excluded_directories WebCore/platform/text/haiku"
+excluded_directories="$excluded_directories WebCore/platform/sql/chromium"
excluded_directories="$excluded_directories WebCore/manual-tests"
@@ -101,6 +109,7 @@ excluded_directories="$excluded_directories WebCore/platform/graphics/mac"
excluded_directories="$excluded_directories WebCore/platform/graphics/win"
excluded_directories="$excluded_directories WebCore/platform/graphics/skia"
excluded_directories="$excluded_directories WebCore/platform/graphics/chromium"
+excluded_directories="$excluded_directories WebCore/platform/graphics/wince"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/bmp"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/gif"
@@ -110,6 +119,7 @@ excluded_directories="$excluded_directories WebCore/platform/image-decoders/ico"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/jpeg"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/xbm"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/skia"
+excluded_directories="$excluded_directories WebCore/platform/image-decoders/haiku"
excluded_directories="$excluded_directories WebCore/platform/image-encoders/skia"
@@ -122,12 +132,16 @@ excluded_directories="$excluded_directories WebCore/accessibility/mac"
excluded_directories="$excluded_directories WebCore/accessibility/win"
excluded_directories="$excluded_directories WebCore/accessibility/wx"
+excluded_directories="$excluded_directories WebCore/storage/wince"
+excluded_directories="$excluded_directories WebCore/svg/graphics/wince"
+
excluded_directories="$excluded_directories WebCore/platform/wx"
excluded_directories="$excluded_directories WebKit/gtk"
excluded_directories="$excluded_directories WebKit/win"
excluded_directories="$excluded_directories WebKit/mac"
excluded_directories="$excluded_directories WebKit/wx"
excluded_directories="$excluded_directories WebKit/cf"
+excluded_directories="$excluded_directories WebKit/haiku"
excluded_directories="$excluded_directories WebKit/English.lproj WebKit/WebKit.xcodeproj"
excluded_directories="$excluded_directories WebCore/English.lproj"
@@ -147,8 +161,6 @@ files_to_remove="$files_to_remove configure.ac"
files_to_remove="$files_to_remove WebKit.pro"
-files_to_remove="$files_to_remove JavaScriptCore/jsc.pro"
-
files_to_remove="$files_to_remove WebKit/qt/QtLauncher/QtLauncher.pro"
files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp"