summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-05-20 04:51:29 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-05-20 04:51:29 (GMT)
commite484ee27f929aca738a269947237d834dab89b39 (patch)
tree216f95598411eb4c72141308973695d5e0d8b372 /examples
parentded29009f766a8373193d94bcb8309270f66a266 (diff)
parentd1f1f2c91f63609ca1ffad32efdd6590f9f0ce6a (diff)
downloadQt-e484ee27f929aca738a269947237d834dab89b39.zip
Qt-e484ee27f929aca738a269947237d834dab89b39.tar.gz
Qt-e484ee27f929aca738a269947237d834dab89b39.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r--examples/animation/animation.pro3
-rw-r--r--examples/animation/moveblocks/main.cpp2
-rw-r--r--examples/animation/stickman/lifecycle.cpp4
-rw-r--r--examples/animation/sub-attaq/boat_p.h6
-rw-r--r--examples/animation/sub-attaq/states.cpp6
-rw-r--r--examples/animation/sub-attaq/states.h6
-rw-r--r--examples/declarative/dial/DialLibrary/Dial.qml42
-rw-r--r--examples/declarative/dial/DialLibrary/background.pngbin0 -> 35876 bytes
-rw-r--r--examples/declarative/dial/DialLibrary/background.svg385
-rw-r--r--examples/declarative/dial/DialLibrary/needle.pngbin0 -> 342 bytes
-rw-r--r--examples/declarative/dial/DialLibrary/needle.svg26
-rw-r--r--examples/declarative/dial/DialLibrary/needle_shadow.pngbin0 -> 632 bytes
-rw-r--r--examples/declarative/dial/DialLibrary/needle_shadow.svg30
-rw-r--r--examples/declarative/dial/DialLibrary/overlay.pngbin0 -> 3564 bytes
-rw-r--r--examples/declarative/dial/DialLibrary/overlay.svg47
-rw-r--r--examples/statemachine/clockticking/clockticking.pro10
-rw-r--r--examples/statemachine/composition/composition.pro7
-rw-r--r--examples/statemachine/composition/main.cpp104
-rw-r--r--examples/statemachine/errorstateplugins/errorstateplugins.pro11
-rw-r--r--examples/statemachine/eventtransitions/main.cpp16
-rw-r--r--examples/statemachine/factorial/main.cpp64
-rw-r--r--examples/statemachine/helloworld/helloworld.pro10
-rw-r--r--examples/statemachine/pauseandresume/main.cpp102
-rw-r--r--examples/statemachine/pauseandresume/pauseandresume.pro7
-rw-r--r--examples/statemachine/pingpong/main.cpp18
-rw-r--r--examples/statemachine/statemachine.pro8
-rw-r--r--examples/statemachine/tankgame/gameitem.cpp (renamed from examples/statemachine/errorstate/gameitem.cpp)0
-rw-r--r--examples/statemachine/tankgame/gameitem.h (renamed from examples/statemachine/errorstate/gameitem.h)0
-rw-r--r--examples/statemachine/tankgame/gameovertransition.cpp39
-rw-r--r--examples/statemachine/tankgame/gameovertransition.h22
-rw-r--r--examples/statemachine/tankgame/main.cpp (renamed from examples/statemachine/errorstate/main.cpp)0
-rw-r--r--examples/statemachine/tankgame/mainwindow.cpp (renamed from examples/statemachine/errorstate/mainwindow.cpp)138
-rw-r--r--examples/statemachine/tankgame/mainwindow.h (renamed from examples/statemachine/errorstate/mainwindow.h)3
-rw-r--r--examples/statemachine/tankgame/plugin.h (renamed from examples/statemachine/errorstate/plugin.h)0
-rw-r--r--examples/statemachine/tankgame/rocketitem.cpp (renamed from examples/statemachine/errorstate/rocketitem.cpp)0
-rw-r--r--examples/statemachine/tankgame/rocketitem.h (renamed from examples/statemachine/errorstate/rocketitem.h)0
-rw-r--r--examples/statemachine/tankgame/tankgame.pro (renamed from examples/statemachine/errorstate/errorstate.pro)6
-rw-r--r--examples/statemachine/tankgame/tankitem.cpp (renamed from examples/statemachine/errorstate/tankitem.cpp)1
-rw-r--r--examples/statemachine/tankgame/tankitem.h (renamed from examples/statemachine/errorstate/tankitem.h)3
-rw-r--r--examples/statemachine/tankgameplugins/random_ai/random_ai.pro (renamed from examples/statemachine/errorstateplugins/random_ai/random_ai.pro)6
-rw-r--r--examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp (renamed from examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp)0
-rw-r--r--examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h (renamed from examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h)4
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp (renamed from examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp)0
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.h (renamed from examples/statemachine/errorstateplugins/seek_ai/seek_ai.h)16
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro (renamed from examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro)6
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp (renamed from examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp)0
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai/spin_ai.h (renamed from examples/statemachine/errorstateplugins/spin_ai/spin_ai.h)11
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro (renamed from examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro)6
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp (renamed from examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp)0
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h (renamed from examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h)11
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro (renamed from examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro)6
-rw-r--r--examples/statemachine/tankgameplugins/tankgameplugins.pro11
-rw-r--r--examples/statemachine/trafficlight/main.cpp47
-rw-r--r--examples/statemachine/twowaybutton/main.cpp22
-rw-r--r--examples/tools/contiguouscache/contiguouscache.pro9
-rw-r--r--examples/tools/contiguouscache/main.cpp56
-rw-r--r--examples/tools/contiguouscache/randomlistmodel.cpp (renamed from examples/statemachine/clockticking/main.cpp)112
-rw-r--r--examples/tools/contiguouscache/randomlistmodel.h (renamed from examples/statemachine/helloworld/main.cpp)50
-rw-r--r--examples/tools/tools.pro1
-rw-r--r--examples/webkit/fancybrowser/mainwindow.cpp20
-rw-r--r--examples/webkit/fancybrowser/mainwindow.h4
61 files changed, 531 insertions, 993 deletions
diff --git a/examples/animation/animation.pro b/examples/animation/animation.pro
index d5121a1..0a57d3d 100644
--- a/examples/animation/animation.pro
+++ b/examples/animation/animation.pro
@@ -7,9 +7,6 @@ SUBDIRS += \
example \
moveblocks \
padnavigator-ng \
- photobrowser \
- piemenu \
- selectbutton \
states \
stickman \
sub-attaq
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index 06ed3dd..0ce07fc 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -95,7 +95,7 @@ public:
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index b22af55..423d7ad 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -69,7 +69,7 @@ public:
{
}
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
if (QSignalTransition::eventTest(e)) {
QVariant key = static_cast<QSignalEvent*>(e)->arguments().at(0);
@@ -92,7 +92,7 @@ public:
startTimer(1000);
}
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
}
diff --git a/examples/animation/sub-attaq/boat_p.h b/examples/animation/sub-attaq/boat_p.h
index 17fbe5c..6f03e48 100644
--- a/examples/animation/sub-attaq/boat_p.h
+++ b/examples/animation/sub-attaq/boat_p.h
@@ -67,7 +67,7 @@ public:
this->key = key;
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
@@ -93,7 +93,7 @@ public:
this->key = key;
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
@@ -131,7 +131,7 @@ public:
this->key = key;
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp
index c6af924..7650b0f 100644
--- a/examples/animation/sub-attaq/states.cpp
+++ b/examples/animation/sub-attaq/states.cpp
@@ -281,7 +281,7 @@ UpdateScoreTransition::UpdateScoreTransition(GraphicsScene *scene, PlayState *ga
{
}
-bool UpdateScoreTransition::eventTest(QEvent *event) const
+bool UpdateScoreTransition::eventTest(QEvent *event)
{
if (!QSignalTransition::eventTest(event))
return false;
@@ -300,7 +300,7 @@ WinTransition::WinTransition(GraphicsScene *scene, PlayState *game, QAbstractSta
{
}
-bool WinTransition::eventTest(QEvent *event) const
+bool WinTransition::eventTest(QEvent *event)
{
if (!QSignalTransition::eventTest(event))
return false;
@@ -319,7 +319,7 @@ CustomSpaceTransition::CustomSpaceTransition(QWidget *widget, PlayState *game, Q
{
}
-bool CustomSpaceTransition::eventTest(QEvent *event) const
+bool CustomSpaceTransition::eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
diff --git a/examples/animation/sub-attaq/states.h b/examples/animation/sub-attaq/states.h
index 27beb71..a1cb5ff 100644
--- a/examples/animation/sub-attaq/states.h
+++ b/examples/animation/sub-attaq/states.h
@@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition
public:
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
- virtual bool eventTest(QEvent *event) const;
+ virtual bool eventTest(QEvent *event);
private:
PlayState * game;
GraphicsScene *scene;
@@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition
public:
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
- virtual bool eventTest(QEvent *event) const;
+ virtual bool eventTest(QEvent *event);
private:
PlayState * game;
GraphicsScene *scene;
@@ -176,7 +176,7 @@ private:
public:
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
protected:
- virtual bool eventTest(QEvent *event) const;
+ virtual bool eventTest(QEvent *event);
private:
PlayState *game;
int key;
diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml
index 2e214a8..6cd42df 100644
--- a/examples/declarative/dial/DialLibrary/Dial.qml
+++ b/examples/declarative/dial/DialLibrary/Dial.qml
@@ -3,28 +3,32 @@ Item {
width: 210; height: 210
- Image { id: Background; source: "background.svg" }
- Item {
- x: 104; y: 102
- rotation: Needle.rotation
- Image {
- source: "needle_shadow.svg"
- x: -104; y: -102
+ Image { id: Background; source: "background.png" }
+
+ Image {
+ x: 93
+ y: 35
+ source: "needle_shadow.png"
+ transform: Rotation {
+ originX: 11; originY: 67
+ angle: NeedleRotation.angle
}
}
- Item {
+ Image {
id: Needle
- x: 102; y: 98
- rotation: -130
- rotation: Follow {
- spring: 1.4
- damping: .15
- source: Math.min(Math.max(-130, value*2.2 - 130), 133)
- }
- Image {
- source: "needle.svg"
- x: -102; y: -98
+ x: 95
+ y: 33
+ source: "needle.png"
+ transform: Rotation {
+ id: NeedleRotation
+ originX: 7; originY: 65
+ angle: -130
+ angle: Follow {
+ spring: 1.4
+ damping: .15
+ source: Math.min(Math.max(-130, value*2.2 - 130), 133)
+ }
}
}
- Image { source: "overlay.svg" }
+ Image { x: 21; y: 18; source: "overlay.png" }
}
diff --git a/examples/declarative/dial/DialLibrary/background.png b/examples/declarative/dial/DialLibrary/background.png
new file mode 100644
index 0000000..75d555d
--- /dev/null
+++ b/examples/declarative/dial/DialLibrary/background.png
Binary files differ
diff --git a/examples/declarative/dial/DialLibrary/background.svg b/examples/declarative/dial/DialLibrary/background.svg
deleted file mode 100644
index 415320d..0000000
--- a/examples/declarative/dial/DialLibrary/background.svg
+++ /dev/null
@@ -1,385 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
-]>
-<svg version="1.1"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
- x="0px" y="0px" width="210px" height="210px" viewBox="0 0 210 210" enable-background="new 0 0 210 210" xml:space="preserve">
-<defs>
-</defs>
-<radialGradient id="SVGID_1_" cx="0.8066" cy="-16.5908" r="92.0159" gradientTransform="matrix(0.9944 0 0 -0.9944 101.1987 90.0014)" gradientUnits="userSpaceOnUse">
- <stop offset="0.1264" style="stop-color:#E0E0E0"/>
- <stop offset="0.3421" style="stop-color:#C7C7C7"/>
- <stop offset="0.5495" style="stop-color:#B3B3B3"/>
- <stop offset="0.721" style="stop-color:#B1B1B1"/>
- <stop offset="0.7828" style="stop-color:#AAAAAA"/>
- <stop offset="0.8269" style="stop-color:#9E9E9E"/>
- <stop offset="0.8625" style="stop-color:#8D8D8D"/>
- <stop offset="0.893" style="stop-color:#777777"/>
- <stop offset="0.92" style="stop-color:#5C5C5C"/>
- <stop offset="0.9445" style="stop-color:#3C3C3C"/>
- <stop offset="0.9662" style="stop-color:#171717"/>
- <stop offset="0.978" style="stop-color:#000000"/>
-</radialGradient>
-<circle fill="url(#SVGID_1_)" cx="102" cy="98" r="85"/>
-<path opacity="0.5" fill="#FFFFFF" fill-opacity="0.8" enable-background="new " d="M57,169c0,0,20.146,5.732,45.001,5.732
- C126.855,174.732,147,169,147,169s-20.145,12.846-44.999,12.846C77.146,181.846,57,169,57,169z"/>
-<image overflow="visible" opacity="0.75" enable-background="new " width="206" height="206" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM8AAADPCAYAAABSgYVfAAAACXBIWXMAAAsSAAALEgHS3X78AAAA
-GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAIVhJREFUeNrsnQtz27oOhKGH7SRN
-m3P//588p83DdmzptjPiFNksQMqWHdkGZzRO0zbxg58WWIKgSIwYMWLEiHHOUcVbcDXvex9va8Bz
-re9rdaL3vz/iezECnlm9h1Xm++dQnt74uz6ACnjm8p5VBY+VA1V1Imj0Y+/8XQ66GM5o4y04CBgL
-jpr8HbtOCY91pb/vMnAFSAHPSYDxrjrzaEFUTQCOBUyXeczBFiAFPJMCUwMYpRcCdUwIx0ItBkjp
-1cPXAVLAMzkw6WrIo75q+JqBVE0IT+8Asx8u/TV+Tz92AVLAUwrNGGDS1TqPLYGpcVRoipyHqc2e
-XLvh2juP+wxIXUA0XcJ6DSpTZ4BpAZCF8diSf9uCSqH6HPo5YL6D4HQEFn29G487A6R9Jme6OYja
-G4OGOWO1EYIhDAtyLeHPDCSmPlbecyhAqDxMbRCUdG3hz+8EKK1MHkg3pUbtjULjhWMWLEvjQoha
-Ax78vTKh8oiT6zDF0dBsjQvB8lSpu8WQrr1ycHLQjIFlNVxL9bg01KdxwGFmwRR5T+/kPVo9UHXS
-tRmuLXncFoCE8F49QO2VQiNG4o8qkwOFXfrfpP/bAjgYquXWd0rv1lbJj7Xe0xmmQQIgAbEBgLxr
-C/AhSDcDUXvF0FSQyzCVYaDcGY+W4rDcBteD2MT3ymrGmB7ez8b1G5YLWQr051oPF36NyoSKxHKj
-qysDqq4IHGYzeyqjYbkfHvFCxVk40ORCst5RiDEAVWLb7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31
-MXFiHALS2CMhq0y+cww8IryKofTqA5iA59wglZTHlPZ3O8YwsCZ8J2XlQQFMwHNWkNjXtfinOpyi
-abwVwlkJvbUGE8AEPGcHKfeYO4t1anhE/FMmvGQ/gAl4vvQ9LDl5+xTvuwdBn/l+jIBn1u/rqQ4R
-7o/4XoyAJ973gCNGjBgxYsS49vF/AQYAwYoCo3RnAfgAAAAASUVORK5CYII=">
-</image>
-<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-15.9541" y1="83.9062" x2="13.6193" y2="-106.171" gradientTransform="matrix(1 0 0 -1 102.5 88)">
- <stop offset="0" style="stop-color:#B3B3B3"/>
- <stop offset="0.151" style="stop-color:#AFAFAF"/>
- <stop offset="0.301" style="stop-color:#A3A3A3"/>
- <stop offset="0.4506" style="stop-color:#8F8F8F"/>
- <stop offset="0.6001" style="stop-color:#737373"/>
- <stop offset="0.7495" style="stop-color:#4F4F4F"/>
- <stop offset="0.8968" style="stop-color:#232323"/>
- <stop offset="1" style="stop-color:#000000"/>
-</linearGradient>
-<path fill="url(#SVGID_2_)" d="M101,187.999c-50.178,0-91-40.821-91-91c0-50.178,40.822-91,91-91c50.178,0,91,40.822,91,91
- C191.999,147.178,151.178,187.999,101,187.999L101,187.999z M101,13c-46.316,0-84,37.684-84,84c0,46.316,37.684,84,84,84
- c46.316,0,84-37.684,84-84C185,50.683,147.316,13,101,13L101,13z"/>
-<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-79.4551" y1="-54.0073" x2="76.4557" y2="36.0078" gradientTransform="matrix(1 0 0 -1 102.5 88)">
- <stop offset="0" style="stop-color:#ECECEC"/>
- <stop offset="0.0105" style="stop-color:#DDDDDD"/>
- <stop offset="0.0399" style="stop-color:#B7B7B7"/>
- <stop offset="0.0704" style="stop-color:#979797"/>
- <stop offset="0.1021" style="stop-color:#7F7F7F"/>
- <stop offset="0.1353" style="stop-color:#6E6E6E"/>
- <stop offset="0.1712" style="stop-color:#636363"/>
- <stop offset="0.2143" style="stop-color:#606060"/>
- <stop offset="0.4615" style="stop-color:#FFFFFF"/>
- <stop offset="0.5195" style="stop-color:#CFCFCF"/>
- <stop offset="0.5899" style="stop-color:#9A9A9A"/>
- <stop offset="0.6512" style="stop-color:#747474"/>
- <stop offset="0.7002" style="stop-color:#5D5D5D"/>
- <stop offset="0.7308" style="stop-color:#545454"/>
- <stop offset="1" style="stop-color:#ECECEC"/>
-</linearGradient>
-<path fill="url(#SVGID_3_)" d="M101,7C51.294,7,11,47.294,11,97s40.294,90,90,90c49.705,0,90-40.294,90-90S150.705,7,101,7z
- M101,182c-46.945,0-85-38.057-85-85c0-46.944,38.055-85,85-85c46.943,0,85,38.056,85,85C186,143.943,147.943,182,101,182z"/>
-<circle fill="none" cx="102" cy="98.001" r="65"/>
-<text transform="matrix(-0.6383 -0.7436 0.7588 -0.6513 54.624 142.6035)" font-family="'MyriadPro-Regular'" font-size="12">0</text>
-<text transform="matrix(-0.589 -0.7833 0.7993 -0.601 50.7637 138.0234)" font-family="'MyriadPro-Regular'" font-size="12.0005"> </text>
-<text transform="matrix(-0.3613 -0.911 0.9296 -0.3686 42.665 124.7539)" font-family="'MyriadPro-Regular'" font-size="12">1</text>
-<text transform="matrix(-0.275 -0.9406 0.9598 -0.2807 40.4512 119.1719)" font-family="'MyriadPro-Regular'" font-size="12">0</text>
-<text transform="matrix(-0.213 -0.9566 0.9761 -0.2173 38.8223 113.4023)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.0159 -0.9799 0.9999 0.0162 36.96 100.019)" font-family="'MyriadPro-Regular'" font-size="12.0004">2</text>
-<text transform="matrix(0.104 -0.9745 0.9944 0.1061 37.0518 94.0215)" font-family="'MyriadPro-Regular'" font-size="12.0005">0</text>
-<text transform="matrix(0.167 -0.9657 0.9854 0.1704 37.7407 88.0718)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.3752 -0.9053 0.9238 0.3828 40.7725 75.9199)" font-family="'MyriadPro-Regular'" font-size="12">3</text>
-<text transform="matrix(0.4573 -0.8669 0.8845 0.4666 43.0674 70.3799)" font-family="'MyriadPro-Regular'" font-size="11.9993">0</text>
-<text transform="matrix(0.5127 -0.8352 0.8523 0.5231 45.9121 65.1069)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.6672 -0.7178 0.7325 0.6808 52.3262 55.9673)" font-family="'MyriadPro-Regular'" font-size="12">4</text>
-<text transform="matrix(0.7301 -0.6537 0.6671 0.745 56.4102 51.5703)" font-family="'MyriadPro-Regular'" font-size="12">0</text>
-<text transform="matrix(0.7708 -0.6052 0.6176 0.7865 60.9082 47.6182)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.8905 -0.4092 0.4175 0.9087 72.1504 40.165)" font-family="'MyriadPro-Regular'" font-size="12">5</text>
-<text transform="matrix(0.9246 -0.3249 0.3315 0.9435 77.6006 37.6587)" font-family="'MyriadPro-Regular'" font-size="12.0005">0</text>
-<text transform="matrix(0.944 -0.2633 0.2687 0.9632 83.2959 35.7197)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.9797 -0.0248 0.0253 0.9997 97.3081 33.0972)" font-family="'MyriadPro-Regular'" font-size="12">6</text>
-<text transform="matrix(0.9779 0.0643 -0.0656 0.9978 103.3198 32.9438)" font-family="'MyriadPro-Regular'" font-size="11.9994">0</text>
-<text transform="matrix(0.9717 0.1274 -0.13 0.9915 109.2959 33.3921)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.9148 0.3514 -0.3586 0.9335 122.4863 36.2207)" font-family="'MyriadPro-Regular'" font-size="12">7</text>
-<text transform="matrix(0.8783 0.4348 -0.4437 0.8962 128.0967 38.375)" font-family="'MyriadPro-Regular'" font-size="12">0</text>
-<text transform="matrix(0.8481 0.4911 -0.5011 0.8654 133.4463 41.085)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.719 0.6659 -0.6795 0.7337 143.9395 48.2495)" font-family="'MyriadPro-Regular'" font-size="12">8</text>
-<text transform="matrix(0.6551 0.7289 -0.7438 0.6684 148.3438 52.3242)" font-family="'MyriadPro-Regular'" font-size="12">0</text>
-<text transform="matrix(0.6067 0.7696 -0.7853 0.6191 152.3047 56.814)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.4267 0.8822 -0.9002 0.4354 159.2344 67.0146)" font-family="'MyriadPro-Regular'" font-size="11.9996">9</text>
-<text transform="matrix(0.3433 0.9179 -0.9366 0.3503 161.8438 72.4062)" font-family="'MyriadPro-Regular'" font-size="11.9996">0</text>
-<text transform="matrix(0.2823 0.9384 -0.9576 0.2881 163.8945 78.0513)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(0.1113 0.9737 -0.9935 0.1136 166.2334 87.54)" font-family="'MyriadPro-Regular'" font-size="12">1</text>
-<text transform="matrix(0.0217 0.9798 -0.9998 0.0221 166.917 93.5156)" font-family="'MyriadPro-Regular'" font-size="12.0005">0</text>
-<text transform="matrix(-0.067 0.9777 -0.9977 -0.0684 167.0527 99.502)" font-family="'MyriadPro-Regular'" font-size="12.0005">0</text>
-<text transform="matrix(-0.1305 0.9713 -0.9911 -0.1331 166.5859 105.5)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(-0.2564 0.9459 -0.9652 -0.2616 165.5303 112.1348)" font-family="'MyriadPro-Regular'" font-size="12">1</text>
-<text transform="matrix(-0.3429 0.918 -0.9368 -0.3499 163.9658 117.918)" font-family="'MyriadPro-Regular'" font-size="12">1</text>
-<text transform="matrix(-0.4267 0.8822 -0.9002 -0.4354 161.8613 123.5527)" font-family="'MyriadPro-Regular'" font-size="11.9996">0</text>
-<text transform="matrix(-0.4834 0.8525 -0.8699 -0.4932 159.1973 128.9287)" font-family="'MyriadPro-Regular'" font-size="12"> </text>
-<text transform="matrix(-0.5948 0.7788 -0.7947 -0.607 155.5195 135.0195)" font-family="'MyriadPro-Regular'" font-size="12">1</text>
-<text transform="matrix(-0.6637 0.721 -0.7357 -0.6773 151.8789 139.791)" font-family="'MyriadPro-Regular'" font-size="12">2</text>
-<text transform="matrix(-0.7269 0.6572 -0.6707 -0.7418 147.8154 144.2051)" font-family="'MyriadPro-Regular'" font-size="12.0006">0</text>
-<path fill="#333333" d="M141.121,133.456l7.08,6.485l-0.436,0.475l-7.08-6.484L141.121,133.456z"/>
-<path fill="#333333" d="M143.077,132.336l4.927,4.186l-0.541,0.637l-4.926-4.186L143.077,132.336z"/>
-<path fill="#333333" d="M144.354,130.73l5.092,4l-0.518,0.658l-5.091-4L144.354,130.73z"/>
-<path fill="#333333" d="M145.572,129.104l5.234,3.806l-0.492,0.676l-5.233-3.806L145.572,129.104z"/>
-<path fill="#333333" d="M146.73,127.412l5.379,3.6l-0.465,0.694l-5.379-3.601L146.73,127.412z"/>
-<path fill="#333333" d="M147.157,125.37l8.179,5.036l-0.338,0.548l-8.18-5.035L147.157,125.37z"/>
-<path fill="#333333" d="M148.854,123.91l5.637,3.178l-0.41,0.729l-5.637-3.178L148.854,123.91z"/>
-<path fill="#333333" d="M149.814,122.104l5.75,2.963l-0.383,0.742l-5.75-2.963L149.814,122.104z"/>
-<path fill="#333333" d="M150.709,120.241l5.861,2.735l-0.354,0.756l-5.861-2.734L150.709,120.241z"/>
-<path fill="#333333" d="M151.516,118.376l5.965,2.51l-0.322,0.771l-5.965-2.51L151.516,118.376z"/>
-<path fill="#333333" d="M151.539,116.303l8.988,3.389l-0.229,0.603l-8.986-3.388L151.539,116.303z"/>
-<path fill="#333333" d="M152.928,114.539l6.141,2.047l-0.266,0.792l-6.14-2.047L152.928,114.539z"/>
-<path fill="#333333" d="M153.525,112.57l6.211,1.811l-0.232,0.803l-6.212-1.812L153.525,112.57z"/>
-<path fill="#333333" d="M154.046,110.602l6.272,1.562l-0.201,0.812l-6.273-1.563L154.046,110.602z"/>
-<path fill="#333333" d="M154.482,108.585l6.336,1.326l-0.172,0.817l-6.334-1.326L154.482,108.585z"/>
-<path fill="#333333" d="M154.117,106.549l9.461,1.604l-0.107,0.634l-9.461-1.603L154.117,106.549z"/>
-<path fill="#333333" d="M155.132,104.559l6.417,0.833l-0.107,0.828l-6.416-0.833L155.132,104.559z"/>
-<path fill="#333333" d="M155.338,102.516l6.448,0.586l-0.075,0.832l-6.447-0.586L155.338,102.516z"/>
-<path fill="#333333" d="M155.477,100.476l6.459,0.34l-0.043,0.833l-6.459-0.339L155.477,100.476z"/>
-<path fill="#333333" d="M155.529,98.425l6.469,0.103l-0.014,0.835l-6.469-0.103L155.529,98.425z"/>
-<path fill="#333333" d="M154.777,96.482l9.6-0.213l0.014,0.643l-9.598,0.214L154.777,96.482z"/>
-<path fill="#333333" d="M155.406,94.336l6.458-0.391l0.051,0.833l-6.459,0.391L155.406,94.336z"/>
-<path fill="#333333" d="M155.232,92.29l6.438-0.627l0.081,0.831l-6.438,0.627L155.232,92.29z"/>
-<path fill="#333333" d="M154.979,90.257l6.407-0.874l0.112,0.827l-6.407,0.874L154.979,90.257z"/>
-<path fill="#333333" d="M154.639,88.227l6.377-1.121l0.146,0.823l-6.377,1.121L154.639,88.227z"/>
-<path fill="#333333" d="M153.539,86.475l9.384-2.029l0.138,0.629l-9.386,2.029L153.539,86.475z"/>
-<path fill="#333333" d="M153.756,84.251l6.264-1.604l0.207,0.809l-6.264,1.604L153.756,84.251z"/>
-<path fill="#333333" d="M153.188,82.293l6.203-1.852l0.237,0.801l-6.201,1.852L153.188,82.293z"/>
-<path fill="#333333" d="M152.545,80.339l6.13-2.088l0.271,0.791l-6.131,2.088L152.545,80.339z"/>
-<path fill="#333333" d="M151.84,78.426l6.036-2.324l0.301,0.779l-6.036,2.324L151.84,78.426z"/>
-<path fill="#333333" d="M150.427,76.915l8.819-3.784l0.254,0.592l-8.82,3.784L150.427,76.915z"/>
-<path fill="#333333" d="M150.199,74.675l5.841-2.777l0.358,0.754l-5.842,2.777L150.199,74.675z"/>
-<path fill="#333333" d="M149.271,72.855L155,69.852l0.389,0.74l-5.729,3.003L149.271,72.855z"/>
-<path fill="#333333" d="M148.271,71.069l5.614-3.22l0.415,0.726l-5.615,3.219L148.271,71.069z"/>
-<path fill="#333333" d="M147.204,69.314l5.481-3.435l0.442,0.707l-5.481,3.436L147.204,69.314z"/>
-<path fill="#333333" d="M145.529,68.108l7.936-5.401l0.362,0.531l-7.935,5.402L145.529,68.108z"/>
-<path fill="#333333" d="M144.887,65.962l5.215-3.836l0.494,0.673l-5.214,3.836L144.887,65.962z"/>
-<path fill="#333333" d="M143.63,64.343l5.062-4.031l0.521,0.653l-5.062,4.031L143.63,64.343z"/>
-<path fill="#333333" d="M142.307,62.78l4.904-4.228l0.546,0.634l-4.905,4.227L142.307,62.78z"/>
-<path fill="#333333" d="M140.932,61.255l4.74-4.401l0.568,0.612l-4.741,4.401L140.932,61.255z"/>
-<path fill="#333333" d="M139.052,60.387l6.774-6.806l0.456,0.454l-6.774,6.806L139.052,60.387z"/>
-<path fill="#333333" d="M138.008,58.389l4.393-4.752l0.613,0.567l-4.392,4.751L138.008,58.389z"/>
-<path fill="#333333" d="M136.467,57.041l4.207-4.916l0.635,0.543l-4.207,4.916L136.467,57.041z"/>
-<path fill="#333333" d="M134.871,55.746l4.021-5.07l0.654,0.52l-4.021,5.07L134.871,55.746z"/>
-<path fill="#333333" d="M133.227,54.52l3.825-5.224l0.675,0.493l-3.826,5.225L133.227,54.52z"/>
-<path fill="#333333" d="M131.211,54.016l5.371-7.966l0.534,0.36l-5.371,7.965L131.211,54.016z"/>
-<path fill="#333333" d="M129.803,52.251l3.414-5.503l0.711,0.441l-3.414,5.502L129.803,52.251z"/>
-<path fill="#333333" d="M128.047,51.223l3.198-5.626l0.726,0.413l-3.197,5.625L128.047,51.223z"/>
-<path fill="#333333" d="M126.244,50.255l2.982-5.739l0.739,0.386l-2.981,5.738L126.244,50.255z"/>
-<path fill="#333333" d="M124.404,49.366l2.757-5.853l0.755,0.356l-2.756,5.852L124.404,49.366z"/>
-<path fill="#333333" d="M122.325,49.252l3.754-8.835l0.592,0.252l-3.754,8.835L122.325,49.252z"/>
-<path fill="#333333" d="M120.621,47.796l2.304-6.047l0.781,0.297l-2.304,6.047L120.621,47.796z"/>
-<path fill="#333333" d="M118.693,47.118l2.066-6.13l0.791,0.267l-2.066,6.13L118.693,47.118z"/>
-<path fill="#333333" d="M116.725,46.524l1.832-6.212l0.801,0.236l-1.83,6.212L116.725,46.524z"/>
-<path fill="#333333" d="M114.779,46.004l1.582-6.273l0.812,0.204l-1.584,6.273L114.779,46.004z"/>
-<path fill="#333333" d="M112.713,46.28l1.998-9.385l0.629,0.135l-1.999,9.384L112.713,46.28z"/>
-<path fill="#333333" d="M110.762,45.182l1.102-6.377l0.822,0.143l-1.101,6.376L110.762,45.182z"/>
-<path fill="#333333" d="M108.746,44.895l0.854-6.417l0.828,0.109l-0.854,6.418L108.746,44.895z"/>
-<path fill="#333333" d="M106.686,44.667l0.607-6.438l0.831,0.078l-0.606,6.438L106.686,44.667z"/>
-<path fill="#333333" d="M104.646,44.531l0.36-6.458l0.833,0.046l-0.359,6.459L104.646,44.531z"/>
-<path fill="#333333" d="M102.68,45.202l0.183-9.598l0.644,0.013l-0.184,9.598L102.68,45.202z"/>
-<path fill="#333333" d="M100.542,44.489l-0.123-6.469l0.835-0.017l0.123,6.469L100.542,44.489z"/>
-<path fill="#333333" d="M98.505,44.581l-0.37-6.458l0.833-0.048l0.37,6.458L98.505,44.581z"/>
-<path fill="#333333" d="M96.458,44.747l-0.606-6.438l0.831-0.078l0.606,6.438L96.458,44.747z"/>
-<path fill="#333333" d="M94.423,45.004l-0.854-6.418l0.828-0.109l0.854,6.417L94.423,45.004z"/>
-<path fill="#333333" d="M92.632,46.025l-1.633-9.46l0.634-0.109l1.633,9.46L92.632,46.025z"/>
-<path fill="#333333" d="M90.413,45.722l-1.347-6.324l0.816-0.174l1.347,6.324L90.413,45.722z"/>
-<path fill="#333333" d="M88.408,46.207l-1.584-6.273l0.811-0.204l1.583,6.273L88.408,46.207z"/>
-<path fill="#333333" d="M86.447,46.767l-1.83-6.212l0.802-0.236l1.83,6.212L86.447,46.767z"/>
-<path fill="#333333" d="M84.515,47.387l-2.067-6.13l0.791-0.267l2.067,6.129L84.515,47.387z"/>
-<path fill="#333333" d="M82.944,48.742l-3.418-8.972l0.602-0.229l3.418,8.973L82.944,48.742z"/>
-<path fill="#333333" d="M80.687,48.877l-2.53-5.954l0.769-0.327l2.53,5.955L80.687,48.877z"/>
-<path fill="#333333" d="M78.817,49.73l-2.756-5.852l0.755-0.356l2.757,5.853L78.817,49.73z"/>
-<path fill="#333333" d="M77.015,50.641l-2.982-5.738l0.74-0.386l2.982,5.739L77.015,50.641z"/>
-<path fill="#333333" d="M75.205,51.646l-3.198-5.626l0.726-0.413l3.199,5.626L75.205,51.646z"/>
-<path fill="#333333" d="M73.931,53.274l-5.066-8.163l0.547-0.34l5.066,8.164L73.931,53.274z"/>
-<path fill="#333333" d="M71.764,53.824l-3.62-5.368l0.692-0.468l3.62,5.368L71.764,53.824z"/>
-<path fill="#333333" d="M70.097,55.016l-3.826-5.225l0.675-0.493l3.825,5.225L70.097,55.016z"/>
-<path fill="#333333" d="M68.474,56.267l-4.021-5.07l0.655-0.521l4.021,5.07L68.474,56.267z"/>
-<path fill="#333333" d="M66.896,57.584l-4.206-4.916l0.634-0.543l4.207,4.916L66.896,57.584z"/>
-<path fill="#333333" d="M65.941,59.427l-6.515-7.05l0.472-0.437l6.516,7.05L65.941,59.427z"/>
-<path fill="#333333" d="M63.906,60.392l-4.566-4.587l0.592-0.59l4.566,4.587L63.906,60.392z"/>
-<path fill="#333333" d="M62.501,61.867l-4.741-4.401l0.568-0.612l4.741,4.402L62.501,61.867z"/>
-<path fill="#333333" d="M61.145,63.415l-4.906-4.227l0.546-0.634l4.905,4.228L61.145,63.415z"/>
-<path fill="#333333" d="M59.848,64.996l-5.06-4.031l0.521-0.653l5.06,4.031L59.848,64.996z"/>
-<path fill="#333333" d="M59.263,66.991L51.526,61.3l0.381-0.519l7.736,5.691L59.263,66.991z"/>
-<path fill="#333333" d="M57.446,68.317l-5.358-3.63l0.469-0.691l5.358,3.63L57.446,68.317z"/>
-<path fill="#333333" d="M56.349,70.033l-5.492-3.425l0.442-0.709l5.491,3.425L56.349,70.033z"/>
-<path fill="#333333" d="M55.312,71.795l-5.615-3.219l0.415-0.726l5.615,3.22L55.312,71.795z"/>
-<path fill="#333333" d="M54.34,73.605l-5.738-2.993l0.386-0.74l5.739,2.992L54.34,73.605z"/>
-<path fill="#333333" d="M54.141,75.654l-8.667-4.12l0.275-0.58l8.667,4.119L54.141,75.654z"/>
-<path fill="#333333" d="M52.61,77.307l-5.944-2.551l0.33-0.768l5.944,2.551L52.61,77.307z"/>
-<path fill="#333333" d="M51.851,79.216l-6.037-2.314l0.299-0.779l6.037,2.314L51.851,79.216z"/>
-<path fill="#333333" d="M51.177,81.153l-6.13-2.088l0.27-0.791l6.13,2.088L51.177,81.153z"/>
-<path fill="#333333" d="M50.569,83.094l-6.201-1.851l0.238-0.801l6.202,1.852L50.569,83.094z"/>
-<path fill="#333333" d="M50.768,85.146l-9.293-2.38l0.159-0.623l9.293,2.38L50.768,85.146z"/>
-<path fill="#333333" d="M49.584,87.067l-6.325-1.368l0.177-0.816l6.325,1.368L49.584,87.067z"/>
-<path fill="#333333" d="M49.213,89.074l-6.377-1.121l0.146-0.823l6.376,1.121L49.213,89.074z"/>
-<path fill="#333333" d="M48.907,91.083l-6.406-0.874l0.112-0.827l6.407,0.874L48.907,91.083z"/>
-<path fill="#333333" d="M48.687,93.121l-6.438-0.628l0.081-0.831l6.438,0.628L48.687,93.121z"/>
-<path fill="#333333" d="M49.276,95.13l-9.583-0.564l0.038-0.643l9.583,0.564L49.276,95.13z"/>
-<path fill="#333333" d="M48.475,97.23l-6.47-0.144l0.019-0.835l6.47,0.144L48.475,97.23z"/>
-<path fill="#333333" d="M48.483,99.283l-6.47,0.103L42,98.551l6.469-0.103L48.483,99.283z"/>
-<path fill="#333333" d="M48.568,101.321l-6.458,0.35l-0.046-0.833l6.459-0.35L48.568,101.321z"/>
-<path fill="#333333" d="M48.737,103.374l-6.448,0.586l-0.075-0.832l6.448-0.587L48.737,103.374z"/>
-<path fill="#333333" d="M49.688,105.223l-9.521,1.235l-0.083-0.638l9.521-1.236L49.688,105.223z"/>
-<path fill="#333333" d="M49.291,107.421l-6.377,1.08l-0.139-0.823l6.376-1.08L49.291,107.421z"/>
-<path fill="#333333" d="M49.691,109.426l-6.335,1.327l-0.172-0.817l6.335-1.326L49.691,109.426z"/>
-<path fill="#333333" d="M50.159,111.432l-6.273,1.563l-0.202-0.812l6.274-1.562L50.159,111.432z"/>
-<path fill="#333333" d="M50.707,113.372l-6.212,1.81l-0.233-0.802l6.212-1.81L50.707,113.372z"/>
-<path fill="#333333" d="M51.998,115.01l-9.109,3.037l-0.204-0.609l9.11-3.037L51.998,115.01z"/>
-<path fill="#333333" d="M52.037,117.253l-6.058,2.283l-0.294-0.782l6.058-2.281L52.037,117.253z"/>
-<path fill="#333333" d="M52.807,119.146l-5.966,2.509l-0.323-0.771l5.965-2.51L52.807,119.146z"/>
-<path fill="#333333" d="M53.652,121.018l-5.862,2.735l-0.353-0.757l5.862-2.735L53.652,121.018z"/>
-<path fill="#333333" d="M54.565,122.846l-5.749,2.963l-0.382-0.742l5.749-2.963L54.565,122.846z"/>
-<path fill="#333333" d="M56.144,124.195l-8.362,4.716l-0.315-0.562l8.361-4.715L56.144,124.195z"/>
-<path fill="#333333" d="M56.606,126.384l-5.513,3.394l-0.438-0.711l5.513-3.395L56.606,126.384z"/>
-<path fill="#333333" d="M57.731,128.107l-5.379,3.6l-0.464-0.693l5.378-3.601L57.731,128.107z"/>
-<path fill="#333333" d="M58.918,129.779l-5.235,3.805l-0.491-0.676l5.235-3.805L58.918,129.779z"/>
-<path fill="#333333" d="M60.164,131.405l-5.08,4l-0.517-0.655l5.08-4.001L60.164,131.405z"/>
-<path fill="#333333" d="M61.971,132.432l-7.31,6.226l-0.417-0.49l7.31-6.226L61.971,132.432z"/>
-<path fill="#FFF200" d="M137.911,69.32l3.624-2.875c-5.367-6.779-12.527-12.29-21.146-15.7l-1.701,4.304
- C126.523,58.147,133.029,63.156,137.911,69.32z"/>
-<path fill="#FFB700" d="M147.43,91.292l4.574-0.677c-1.314-8.823-4.932-17.174-10.469-24.17l-3.624,2.875
- C142.945,75.68,146.232,83.27,147.43,91.292z"/>
-<path fill="#FFF200" d="M94.898,52.31l-0.677-4.574c-8.823,1.314-17.173,4.932-24.167,10.469l2.875,3.623
- C79.287,56.793,86.878,53.505,94.898,52.31z"/>
-<path fill="#FFB700" d="M72.93,61.827l-2.875-3.623c-6.781,5.367-12.291,12.525-15.702,21.146l4.303,1.701
- C61.755,73.216,66.765,66.707,72.93,61.827z"/>
-<path fill="#59DE00" d="M118.688,55.049l1.701-4.304c-8.621-3.408-17.613-4.285-26.167-3.01l0.677,4.574
- C102.676,51.151,110.85,51.948,118.688,55.049z"/>
-</svg>
diff --git a/examples/declarative/dial/DialLibrary/needle.png b/examples/declarative/dial/DialLibrary/needle.png
new file mode 100644
index 0000000..2d19f75
--- /dev/null
+++ b/examples/declarative/dial/DialLibrary/needle.png
Binary files differ
diff --git a/examples/declarative/dial/DialLibrary/needle.svg b/examples/declarative/dial/DialLibrary/needle.svg
deleted file mode 100644
index dce7d7e..0000000
--- a/examples/declarative/dial/DialLibrary/needle.svg
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
-]>
-<svg version="1.1"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
- x="0px" y="0px" width="210px" height="210px" viewBox="-98 -35 210 210" enable-background="new -98 -35 210 210"
- xml:space="preserve">
-<defs>
-</defs>
-<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-102.5" y1="-13.5" x2="-94.5" y2="-13.5" gradientTransform="matrix(1 0 0 -1 102.5 18)">
- <stop offset="0" style="stop-color:#EC1C24"/>
- <stop offset="0.0782" style="stop-color:#E51B23"/>
- <stop offset="0.3901" style="stop-color:#CA181F"/>
- <stop offset="0.5495" style="stop-color:#F0C7C9"/>
- <stop offset="0.5972" style="stop-color:#D98D90"/>
- <stop offset="0.6452" style="stop-color:#C4595D"/>
- <stop offset="0.687" style="stop-color:#B53339"/>
- <stop offset="0.7206" style="stop-color:#AC1C22"/>
- <stop offset="0.7418" style="stop-color:#A9141A"/>
- <stop offset="1" style="stop-color:#EC1C24"/>
-</linearGradient>
-<path fill="url(#SVGID_1_)" d="M8,61c0,1.104-2.343,2-4,2l0,0c-1.657,0-4-0.896-4-2L2.5,2C2.5,0.896,3,0,4,0l0,0
- c1,0,1.5,0.896,1.5,2L8,61z"/>
-</svg>
diff --git a/examples/declarative/dial/DialLibrary/needle_shadow.png b/examples/declarative/dial/DialLibrary/needle_shadow.png
new file mode 100644
index 0000000..8d8a928
--- /dev/null
+++ b/examples/declarative/dial/DialLibrary/needle_shadow.png
Binary files differ
diff --git a/examples/declarative/dial/DialLibrary/needle_shadow.svg b/examples/declarative/dial/DialLibrary/needle_shadow.svg
deleted file mode 100644
index 6aab197..0000000
--- a/examples/declarative/dial/DialLibrary/needle_shadow.svg
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
-]>
-<svg version="1.1"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
- x="0px" y="0px" width="210px" height="210px" viewBox="-90 -30 210 210" enable-background="new -90 -30 210 210"
- xml:space="preserve">
-<defs>
-</defs>
-<image overflow="visible" opacity="0.5" enable-background="new " width="26" height="81" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAABSCAYAAAClg6/xAAAACXBIWXMAAAsSAAALEgHS3X78AAAA
-GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAydJREFUeNrsmetu2zAMhUVaS9pu
-2Pu/5dY2vaSJ7dkAOZ8y1M3Jjw6zAUKx4ugLJZo+FkPYjhsc1Hidd/1o2tUwhKAhCC0LpQJIjcG0
-TwEDmAU3webBO7EInxXWi53h89AK038/D/xNbCdtBNgMOU32Ie1JgK53OZh6M0PuwHbi8SCQd7AP
-8PIC1iVguj6zJ/vJ7if7AfYgUJ3SIbF21TCdwtmb7wL5Ke09wAazbklYLIR7B949gFdRBu+kPco0
-dub3YwkWTMjjuul0KmwUyE762LkXi7Ac8E681eirArXANDLxFiC4FboaGGcgwckenWM2u4QUlBty
-IxtP2fQXcy03JmE2EHYSNK2BhUQiThmVPIsNGb8zSXlw1o2uCX12Mr9G4GieBDZImj2zYY9PgADn
-VeEfK9bJ3mN7ack8drrS+sVCBCoIYTvwDGERcqObH3OJ2Hpmp3J0QAwRTmvWLAUcE6DkmvHK0E+l
-LGqBUSFzsElXXMgk1JJBPGjuPKzNjWvU8VWw1JRQZuqv8owy0o9a3hu+1DTe9NhgG2yDJZPvWmsW
-qWt04yqtn9L5pT5q1fqlJ3SseGJXSzlPnFrrzXkRGAtTaIUOtoM594QqpWBUUMO2HZx+TxX/1Y6x
-oBnZmUbrmSfnXO3IFTrfrlupj1uikSpkXFch57IwSqybNyAXvneFUqtubE5Ra6RcreC5+gU+pw+p
-IO+2h+cG22BfEFaTiv6N19zS22Su3pL9LVfmRa/IkysYNG8BBjPoOSy1F5JW+/C65s1N9GQe7CN8
-rrv0AnuH784ZTy9gtvDWA2ge9GWy57DUaE5y/hL8os/F2saEVwh6m+ww2WNYKhXaPkv/Qa6rrjLZ
-CoVVT0EGmQd8nexpst+T/RJ7FPhrWOppn6CdE50MG5soo7FedgCY2pP0z98fw1JxGlIhiqUsrZtp
-OcuWsnozzQdZvzeBnQCY1BkM07cX04LPPix1mFEGPEKUHsXOJjqTNx9ndr1xHxgD6QR29qYwJ8co
-8cKHG854i2h1sM9lFqpItuxsZHo3/2imrbqam9tvtLAQblCBr71+DP/98UeAAQDKLu+cxVe7aAAA
-AABJRU5ErkJggg==">
-</image>
-</svg>
diff --git a/examples/declarative/dial/DialLibrary/overlay.png b/examples/declarative/dial/DialLibrary/overlay.png
new file mode 100644
index 0000000..3860a7b
--- /dev/null
+++ b/examples/declarative/dial/DialLibrary/overlay.png
Binary files differ
diff --git a/examples/declarative/dial/DialLibrary/overlay.svg b/examples/declarative/dial/DialLibrary/overlay.svg
deleted file mode 100644
index 8530dd5..0000000
--- a/examples/declarative/dial/DialLibrary/overlay.svg
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
- <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
-]>
-<svg version="1.1"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
- x="0px" y="0px" width="210px" height="210px" viewBox="-21.12 -18.396 210 210" enable-background="new -21.12 -18.396 210 210"
- xml:space="preserve">
-<defs>
-</defs>
-<image overflow="visible" opacity="0.5" enable-background="new " width="48" height="48" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAAAsSAAALEgHS3X78AAAA
-GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA/JJREFUeNrsWolum0AQZQHfOdrc
-//93bZO2OVwTx2YL0hvpaTK7C7iJUhSkJ2wMu/N2jp0ZnGWfx8c43BuPx9+9+s1/FBKOzs4YM0TC
-09kfSsod8JxGblzLjNVn1MY1/9YktNCCAuBrztCECC7YA3ytNxk3gAALXQIToFRkNAkWftfgBdgB
-TKozEdeDgAgmgk+BGWEKMkxEDibQCr5t8EzYAkKINXMwCV59WfV5gwWwBBa4PlUaYRKigVbYqsGm
-wR9gA1SknX0XIq4HgQkEFMGPGhwTVkRkEiHxQgTWDR4JT0Roi3uTRFwPAjMS/qTBaYMvwAkREbMq
-yC88kRAzEgIPDX4D9/guZJ67EHEJJ2YCKwjaCn/W4BznMxAZSqIV/idwh/M9flsrIqazlwktiA8s
-oIGWwAVwhfM5rh9DU7MO5vSMlX7EuAs8x894I+zWXUmwFkrY+BImcwbBbxpcN7jEtVPyCQm1oegk
-oXUDAkw8N+7dKzJOEykTvjBVWjiHBq6BltBXaEFWs1SmpPcJiVBzFc1yQ2NbtYeY+0fRgcAxBBUT
-ugEuDVOa014xoT2lJHLWtYII643wJeXcRcQXxJnFkUUDN/gsBLRJlLSyevcuAqmKIzPRm+E2FW41
-CZlANrQjRJ4LrLz4wQVFpGVgp3YR8D1sdjWtfAUSFUWonRWlLBIxU7pSfqCdMjfSc2ek6i6QqnP0
-qtQuvg2F2jJQG+SUH0mKsQKW5MRWnuQ6ZAie7ue9SLKBlcoA2PlZTp+pEGhlqhMiwoneJBCF+iSU
-obyM55kbpvqqVskTGSsPPqUBYyl33/rk4LnyRN3AUaQIFD+HFFg6oKTmcykSlvPlEbiBwqdMKzaf
-FRxMTaQqu/fqwnSeqw+JQUX8wKPXXHngQauor42C/l/0j7yRtYbms1o9pia8UdRr8OBDm2HeyHBT
-85kaCpGwuhKcw1gp8lAtHDxXHtECJ2KV6kyECnk/0ISYAM9TBZI/H/MJHlh3JdaAFPK6/q07OCX/
-VhvVnnQ/ZC7Om3ahBSs6pB0zKmAWgdTDRXqwMZ/bUca6Rm3d1tm3DX7g8y80D6RxoMm8IqGJcHdv
-Rs0yKx3IEl1vHzAf0fIDmgQtge8gcYtGwiO1cfYqoAQ1YeU0sYrMJUymplRbN9AsAkJCOh/rkBZS
-mnCRnMZKBVKheacqtk2CwC1M6cnQQpJE6N1DHilmaiUs18hb1XfdULvmXhH4BggB0UKlqrqsCwld
-eDhl59o8QgJzdSZR54m6fndKA0LgDgRECxLSzcg3ig7gqHuxo+mKj+b9xGjeFI3mnd1o3p6O5j12
-alfPsv/oHwVdx3uX/3Z8Hh/l+CvAAIH3kc3b00M7AAAAAElFTkSuQmCC" transform="matrix(1 0 0 1 57.8799 59.604)">
-</image>
-<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-26.0957" y1="-12.2373" x2="-17.2345" y2="-44.2323" gradientTransform="matrix(1 0 0 -1 102.5 51.208)">
- <stop offset="0" style="stop-color:#FFFFFF"/>
- <stop offset="1" style="stop-color:#000000"/>
-</linearGradient>
-<circle fill="url(#SVGID_1_)" cx="80.88" cy="79.604" r="15"/>
-<radialGradient id="SVGID_2_" cx="-28.9624" cy="-17.0811" r="25.2655" gradientTransform="matrix(1 0 0 -1 102.5 51.208)" gradientUnits="userSpaceOnUse">
- <stop offset="0" style="stop-color:#FFFFFF"/>
- <stop offset="1" style="stop-color:#616161"/>
-</radialGradient>
-<path fill="url(#SVGID_2_)" d="M80.88,92.603c-7.167,0-12.999-5.832-12.999-13c-0.001-7.166,5.832-12.999,12.999-12.999
- s13,5.832,13,12.999C93.879,86.771,88.047,92.603,80.88,92.603L80.88,92.603z"/>
-<path opacity="0.5" fill="#FFFFFF" enable-background="new " d="M10.697,75.919c27.161-27.154,64.439-42.608,102.867-42.608
- c11.422,0,22.744,1.386,33.739,4.018C133.183,14.903,108.235,0,79.768,0C35.712,0,0,35.714,0,79.768c0,2.589,0.14,5.14,0.387,7.648
- C3.609,83.419,7.044,79.58,10.697,75.919z"/>
-</svg>
diff --git a/examples/statemachine/clockticking/clockticking.pro b/examples/statemachine/clockticking/clockticking.pro
deleted file mode 100644
index bff9cb8..0000000
--- a/examples/statemachine/clockticking/clockticking.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT = core
-TEMPLATE = app
-TARGET =
-win32: CONFIG += console
-mac:CONFIG -= app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/composition/composition.pro b/examples/statemachine/composition/composition.pro
deleted file mode 100644
index 6a976cb..0000000
--- a/examples/statemachine/composition/composition.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/composition/main.cpp b/examples/statemachine/composition/main.cpp
deleted file mode 100644
index 0afff66..0000000
--- a/examples/statemachine/composition/main.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the 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 <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qfinalstate.h>
-#endif
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- QLabel label;
- label.setAlignment(Qt::AlignCenter);
-
- QStateMachine machine;
-
- QState *s1 = new QState();
- s1->setObjectName("s1");
- s1->assignProperty(&label, "text", "In S1, hang on...");
- s1->assignProperty(&label, "geometry", QRect(100, 100, 200, 100));
-
- QState *s1_timer = new QState(s1);
- s1_timer->setObjectName("s1_timer");
- QTimer t1;
- t1.setInterval(2000);
- QObject::connect(s1_timer, SIGNAL(entered()), &t1, SLOT(start()));
- QFinalState *s1_done = new QFinalState(s1);
- s1_done->setObjectName("s1_done");
- s1_timer->addTransition(&t1, SIGNAL(timeout()), s1_done);
- s1->setInitialState(s1_timer);
-
- QState *s2 = new QState();
- s2->setObjectName("s2");
- s2->assignProperty(&label, "text", "In S2, I'm gonna quit on you...");
- s2->assignProperty(&label, "geometry", QRect(300, 300, 300, 100));
-// s2->invokeMethodOnEntry(&label, "setNum", QList<QVariant>() << 123);
-// s2->invokeMethodOnEntry(&label, "showMaximized");
-
- QState *s2_timer = new QState(s2);
- s2_timer->setObjectName("s2_timer");
- QTimer t2;
- t2.setInterval(2000);
- QObject::connect(s2_timer, SIGNAL(entered()), &t2, SLOT(start()));
- QFinalState *s2_done = new QFinalState(s2);
- s2_done->setObjectName("s2_done");
- s2_timer->addTransition(&t2, SIGNAL(timeout()), s2_done);
- s2->setInitialState(s2_timer);
-
- s1->addTransition(s1, SIGNAL(finished()), s2);
-
- QFinalState *s3 = new QFinalState();
- s3->setObjectName("s3");
- s2->addTransition(s2, SIGNAL(finished()), s3);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.addState(s3);
- machine.setInitialState(s1);
- QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit()));
- machine.start();
-
- label.show();
- return app.exec();
-}
diff --git a/examples/statemachine/errorstateplugins/errorstateplugins.pro b/examples/statemachine/errorstateplugins/errorstateplugins.pro
deleted file mode 100644
index 5b6b758..0000000
--- a/examples/statemachine/errorstateplugins/errorstateplugins.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = random_ai \
- spin_ai_with_error \
- spin_ai \
- seek_ai
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS errorstateplugins.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins
-INSTALLS += target sources
diff --git a/examples/statemachine/eventtransitions/main.cpp b/examples/statemachine/eventtransitions/main.cpp
index f564b7e..aba0c73 100644
--- a/examples/statemachine/eventtransitions/main.cpp
+++ b/examples/statemachine/eventtransitions/main.cpp
@@ -46,6 +46,7 @@
#include <qeventtransition.h>
#endif
+//! [0]
class Window : public QWidget
{
public:
@@ -54,7 +55,9 @@ public:
{
QPushButton *button = new QPushButton(this);
button->setGeometry(QRect(100, 100, 100, 100));
+//! [0]
+//! [1]
QStateMachine *machine = new QStateMachine(this);
QState *s1 = new QState();
@@ -62,15 +65,21 @@ public:
QState *s2 = new QState();
s2->assignProperty(button, "text", "Inside");
+//! [1]
+//! [2]
QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter);
enterTransition->setTargetState(s2);
s1->addTransition(enterTransition);
+//! [2]
+//! [3]
QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave);
leaveTransition->setTargetState(s1);
s2->addTransition(leaveTransition);
+//! [3]
+//! [4]
QState *s3 = new QState();
s3->assignProperty(button, "text", "Pressing...");
@@ -81,16 +90,20 @@ public:
QEventTransition *releaseTransition = new QEventTransition(button, QEvent::MouseButtonRelease);
releaseTransition->setTargetState(s2);
s3->addTransition(releaseTransition);
+//! [4]
+//! [5]
machine->addState(s1);
machine->addState(s2);
machine->addState(s3);
+
machine->setInitialState(s1);
- QObject::connect(machine, SIGNAL(finished()), qApp, SLOT(quit()));
machine->start();
}
};
+//! [5]
+//! [6]
int main(int argc, char **argv)
{
QApplication app(argc, argv);
@@ -100,3 +113,4 @@ int main(int argc, char **argv)
return app.exec();
}
+//! [6]
diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp
index 2b63690..1065eb8 100644
--- a/examples/statemachine/factorial/main.cpp
+++ b/examples/statemachine/factorial/main.cpp
@@ -48,6 +48,7 @@
#include <qfinalstate.h>
#endif
+//! [0]
class Factorial : public QObject
{
Q_OBJECT
@@ -55,10 +56,8 @@ class Factorial : public QObject
Q_PROPERTY(int fac READ fac WRITE setFac)
public:
Factorial(QObject *parent = 0)
- : QObject(parent)
+ : QObject(parent), m_x(-1), m_fac(1)
{
- m_fac = 1;
- m_x = -1;
}
int x() const
@@ -71,7 +70,7 @@ public:
if (x == m_x)
return;
m_x = x;
- emit xChanged();
+ emit xChanged(x);
}
int fac() const
@@ -85,28 +84,34 @@ public:
}
Q_SIGNALS:
- void xChanged();
+ void xChanged(int value);
private:
int m_x;
int m_fac;
};
+//! [0]
+//! [1]
class FactorialLoopTransition : public QSignalTransition
{
public:
FactorialLoopTransition(Factorial *fact)
- : QSignalTransition(fact, SIGNAL(xChanged())), m_fact(fact)
+ : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
{}
- virtual bool eventTest(QEvent *) const
+ virtual bool eventTest(QEvent *e)
{
- return m_fact->property("x").toInt() > 1;
+ if (!QSignalTransition::eventTest(e))
+ return false;
+ QSignalEvent *se = static_cast<QSignalEvent*>(e);
+ return se->arguments().at(0).toInt() > 1;
}
- virtual void onTransition(QEvent *)
+ virtual void onTransition(QEvent *e)
{
- int x = m_fact->property("x").toInt();
+ QSignalEvent *se = static_cast<QSignalEvent*>(e);
+ int x = se->arguments().at(0).toInt();
int fac = m_fact->property("fac").toInt();
m_fact->setProperty("fac", x * fac);
m_fact->setProperty("x", x - 1);
@@ -115,17 +120,22 @@ public:
private:
Factorial *m_fact;
};
+//! [1]
+//! [2]
class FactorialDoneTransition : public QSignalTransition
{
public:
FactorialDoneTransition(Factorial *fact)
- : QSignalTransition(fact, SIGNAL(xChanged())), m_fact(fact)
+ : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
{}
- virtual bool eventTest(QEvent *) const
+ virtual bool eventTest(QEvent *e)
{
- return m_fact->property("x").toInt() <= 1;
+ if (!QSignalTransition::eventTest(e))
+ return false;
+ QSignalEvent *se = static_cast<QSignalEvent*>(e);
+ return se->arguments().at(0).toInt() <= 1;
}
virtual void onTransition(QEvent *)
@@ -136,35 +146,37 @@ public:
private:
Factorial *m_fact;
};
+//! [2]
+//! [3]
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
-
Factorial factorial;
-
QStateMachine machine;
+//! [3]
- QState *computing = new QState(machine.rootState());
- computing->addTransition(new FactorialLoopTransition(&factorial));
+//! [4]
+ QState *compute = new QState(machine.rootState());
+ compute->assignProperty(&factorial, "fac", 1);
+ compute->assignProperty(&factorial, "x", 6);
+ compute->addTransition(new FactorialLoopTransition(&factorial));
+//! [4]
+//! [5]
QFinalState *done = new QFinalState(machine.rootState());
FactorialDoneTransition *doneTransition = new FactorialDoneTransition(&factorial);
doneTransition->setTargetState(done);
- computing->addTransition(doneTransition);
-
- QState *initialize = new QState(machine.rootState());
- initialize->assignProperty(&factorial, "x", 6);
- FactorialLoopTransition *enterLoopTransition = new FactorialLoopTransition(&factorial);
- enterLoopTransition->setTargetState(computing);
- initialize->addTransition(enterLoopTransition);
+ compute->addTransition(doneTransition);
+//! [5]
+//! [6]
+ machine.setInitialState(compute);
QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit()));
-
- machine.setInitialState(initialize);
machine.start();
return app.exec();
}
+//! [6]
#include "main.moc"
diff --git a/examples/statemachine/helloworld/helloworld.pro b/examples/statemachine/helloworld/helloworld.pro
deleted file mode 100644
index ac79117..0000000
--- a/examples/statemachine/helloworld/helloworld.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-TARGET =
-QT = core
-win32: CONFIG += console
-mac:CONFIG -= app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/pauseandresume/main.cpp b/examples/statemachine/pauseandresume/main.cpp
deleted file mode 100644
index 5bacb41..0000000
--- a/examples/statemachine/pauseandresume/main.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the 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 <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qfinalstate.h>
-#include <qhistorystate.h>
-#endif
-
-class Window : public QWidget
-{
-public:
- Window(QWidget *parent = 0)
- : QWidget(parent)
- {
- QPushButton *pb = new QPushButton("Go");
- QPushButton *pauseButton = new QPushButton("Pause");
- QPushButton *quitButton = new QPushButton("Quit");
- QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->addWidget(pb);
- vbox->addWidget(pauseButton);
- vbox->addWidget(quitButton);
-
- QStateMachine *machine = new QStateMachine(this);
-
- QState *process = new QState(machine->rootState());
- process->setObjectName("process");
-
- QState *s1 = new QState(process);
- s1->setObjectName("s1");
- QState *s2 = new QState(process);
- s2->setObjectName("s2");
- s1->addTransition(pb, SIGNAL(clicked()), s2);
- s2->addTransition(pb, SIGNAL(clicked()), s1);
-
- QHistoryState *h = new QHistoryState(process);
- h->setDefaultState(s1);
-
- QState *interrupted = new QState(machine->rootState());
- interrupted->setObjectName("interrupted");
- QFinalState *terminated = new QFinalState(machine->rootState());
- terminated->setObjectName("terminated");
- interrupted->addTransition(pauseButton, SIGNAL(clicked()), h);
- interrupted->addTransition(quitButton, SIGNAL(clicked()), terminated);
-
- process->addTransition(pauseButton, SIGNAL(clicked()), interrupted);
- process->addTransition(quitButton, SIGNAL(clicked()), terminated);
-
- process->setInitialState(s1);
- machine->setInitialState(process);
- QObject::connect(machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
- machine->start();
- }
-};
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- Window win;
- win.show();
- return app.exec();
-}
diff --git a/examples/statemachine/pauseandresume/pauseandresume.pro b/examples/statemachine/pauseandresume/pauseandresume.pro
deleted file mode 100644
index 6a976cb..0000000
--- a/examples/statemachine/pauseandresume/pauseandresume.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/statemachine/pingpong/main.cpp b/examples/statemachine/pingpong/main.cpp
index eb8fd5d..331627e 100644
--- a/examples/statemachine/pingpong/main.cpp
+++ b/examples/statemachine/pingpong/main.cpp
@@ -47,6 +47,7 @@
#include <qabstracttransition.h>
#endif
+//! [0]
class PingEvent : public QEvent
{
public:
@@ -60,7 +61,9 @@ public:
PongEvent() : QEvent(QEvent::Type(QEvent::User+3))
{}
};
+//! [0]
+//! [1]
class Pinger : public QState
{
public:
@@ -74,14 +77,16 @@ protected:
fprintf(stdout, "ping?\n");
}
};
+//! [1]
+//! [3]
class PongTransition : public QAbstractTransition
{
public:
PongTransition() {}
protected:
- virtual bool eventTest(QEvent *e) const {
+ virtual bool eventTest(QEvent *e) {
return (e->type() == QEvent::User+3);
}
virtual void onTransition(QEvent *)
@@ -90,14 +95,16 @@ protected:
fprintf(stdout, "ping?\n");
}
};
+//! [3]
+//! [2]
class PingTransition : public QAbstractTransition
{
public:
PingTransition() {}
protected:
- virtual bool eventTest(QEvent *e) const {
+ virtual bool eventTest(QEvent *e) {
return (e->type() == QEvent::User+2);
}
virtual void onTransition(QEvent *)
@@ -106,7 +113,9 @@ protected:
fprintf(stdout, "pong!\n");
}
};
+//! [2]
+//! [4]
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
@@ -114,7 +123,9 @@ int main(int argc, char **argv)
QStateMachine machine;
QState *group = new QState(QState::ParallelStates);
group->setObjectName("group");
+//! [4]
+//! [5]
Pinger *pinger = new Pinger(group);
pinger->setObjectName("pinger");
pinger->addTransition(new PongTransition());
@@ -122,10 +133,13 @@ int main(int argc, char **argv)
QState *ponger = new QState(group);
ponger->setObjectName("ponger");
ponger->addTransition(new PingTransition());
+//! [5]
+//! [6]
machine.addState(group);
machine.setInitialState(group);
machine.start();
return app.exec();
}
+//! [6]
diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro
index ba32c12..5074a3c 100644
--- a/examples/statemachine/statemachine.pro
+++ b/examples/statemachine/statemachine.pro
@@ -1,14 +1,12 @@
TEMPLATE = subdirs
SUBDIRS = \
- clockticking \
- composition \
eventtransitions \
factorial \
- helloworld \
- pauseandresume \
pingpong \
trafficlight \
- twowaybutton
+ twowaybutton \
+ tankgame \
+ tankgameplugins
# install
target.path = $$[QT_INSTALL_EXAMPLES]/statemachine
diff --git a/examples/statemachine/errorstate/gameitem.cpp b/examples/statemachine/tankgame/gameitem.cpp
index 1a2af71..1a2af71 100644
--- a/examples/statemachine/errorstate/gameitem.cpp
+++ b/examples/statemachine/tankgame/gameitem.cpp
diff --git a/examples/statemachine/errorstate/gameitem.h b/examples/statemachine/tankgame/gameitem.h
index 43b8785..43b8785 100644
--- a/examples/statemachine/errorstate/gameitem.h
+++ b/examples/statemachine/tankgame/gameitem.h
diff --git a/examples/statemachine/tankgame/gameovertransition.cpp b/examples/statemachine/tankgame/gameovertransition.cpp
new file mode 100644
index 0000000..cec786e
--- /dev/null
+++ b/examples/statemachine/tankgame/gameovertransition.cpp
@@ -0,0 +1,39 @@
+#include "gameovertransition.h"
+#include "tankitem.h"
+
+#include <QSignalEvent>
+#include <QSignalMapper>
+
+GameOverTransition::GameOverTransition(QAbstractState *targetState)
+ : QSignalTransition(new QSignalMapper(), SIGNAL(mapped(QObject*)))
+{
+ setTargetState(targetState);
+
+ QSignalMapper *mapper = qobject_cast<QSignalMapper *>(senderObject());
+ mapper->setParent(this);
+}
+
+void GameOverTransition::addTankItem(TankItem *tankItem)
+{
+ m_tankItems.append(tankItem);
+
+ QSignalMapper *mapper = qobject_cast<QSignalMapper *>(senderObject());
+ mapper->setMapping(tankItem, tankItem);
+ connect(tankItem, SIGNAL(aboutToBeDestroyed()), mapper, SLOT(map()));
+}
+
+bool GameOverTransition::eventTest(QEvent *e)
+{
+ bool ret = QSignalTransition::eventTest(e);
+
+ if (ret) {
+ QSignalEvent *signalEvent = static_cast<QSignalEvent *>(e);
+ QObject *sender = qvariant_cast<QObject *>(signalEvent->arguments().at(0));
+ TankItem *tankItem = qobject_cast<TankItem *>(sender);
+ m_tankItems.removeAll(tankItem);
+
+ return m_tankItems.size() <= 1;
+ } else {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/examples/statemachine/tankgame/gameovertransition.h b/examples/statemachine/tankgame/gameovertransition.h
new file mode 100644
index 0000000..9a86b83
--- /dev/null
+++ b/examples/statemachine/tankgame/gameovertransition.h
@@ -0,0 +1,22 @@
+#ifndef GAMEOVERTRANSITION_H
+#define GAMEOVERTRANSITION_H
+
+#include <QSignalTransition>
+
+class TankItem;
+class GameOverTransition: public QSignalTransition
+{
+ Q_OBJECT
+public:
+ GameOverTransition(QAbstractState *targetState);
+
+ void addTankItem(TankItem *tankItem);
+
+protected:
+ bool eventTest(QEvent *event);
+
+private:
+ QList<TankItem *> m_tankItems;
+};
+
+#endif
diff --git a/examples/statemachine/errorstate/main.cpp b/examples/statemachine/tankgame/main.cpp
index 26fc1bb..26fc1bb 100644
--- a/examples/statemachine/errorstate/main.cpp
+++ b/examples/statemachine/tankgame/main.cpp
diff --git a/examples/statemachine/errorstate/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp
index 39b8663..fcc0325 100644
--- a/examples/statemachine/errorstate/mainwindow.cpp
+++ b/examples/statemachine/tankgame/mainwindow.cpp
@@ -2,6 +2,7 @@
#include "tankitem.h"
#include "rocketitem.h"
#include "plugin.h"
+#include "gameovertransition.h"
#include <QStateMachine>
#include <QGraphicsView>
@@ -12,6 +13,9 @@
#include <QTimer>
#include <QFileDialog>
#include <QPluginLoader>
+#include <QApplication>
+#include <QInputDialog>
+#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), m_scene(0), m_machine(0), m_runningState(0), m_started(false)
@@ -50,7 +54,7 @@ void MainWindow::init()
{
TankItem *item = new TankItem(this);
- item->setPos(m_scene->sceneRect().topLeft() + QPointF(15.0, 15.0));
+ item->setPos(m_scene->sceneRect().topLeft() + QPointF(30.0, 30.0));
item->setDirection(45.0);
item->setColor(Qt::red);
@@ -60,7 +64,7 @@ void MainWindow::init()
{
TankItem *item = new TankItem(this);
- item->setPos(m_scene->sceneRect().topRight() + QPointF(-15.0, 15.0));
+ item->setPos(m_scene->sceneRect().topRight() + QPointF(-30.0, 30.0));
item->setDirection(135.0);
item->setColor(Qt::green);
@@ -70,7 +74,7 @@ void MainWindow::init()
{
TankItem *item = new TankItem(this);
- item->setPos(m_scene->sceneRect().bottomRight() + QPointF(-15.0, -15.0));
+ item->setPos(m_scene->sceneRect().bottomRight() + QPointF(-30.0, -30.0));
item->setDirection(225.0);
item->setColor(Qt::blue);
@@ -80,7 +84,7 @@ void MainWindow::init()
{
TankItem *item = new TankItem(this);
- item->setPos(m_scene->sceneRect().bottomLeft() + QPointF(15.0, -15.0));
+ item->setPos(m_scene->sceneRect().bottomLeft() + QPointF(30.0, -30.0));
item->setDirection(315.0);
item->setColor(Qt::yellow);
@@ -122,30 +126,45 @@ void MainWindow::init()
stoppedState->assignProperty(this, "started", false);
m_machine->setInitialState(stoppedState);
- QState *spawnsAvailable = new QState(stoppedState);
- spawnsAvailable->setObjectName("spawnsAvailable");
+//! [5]
+ QState *spawnsAvailable = new QState(stoppedState);
spawnsAvailable->assignProperty(addTankAction, "enabled", true);
- QState *noSpawnsAvailable = new QState(stoppedState);
- noSpawnsAvailable->setObjectName("noSpawnsAvailable");
+ QState *noSpawnsAvailable = new QState(stoppedState);
noSpawnsAvailable->assignProperty(addTankAction, "enabled", false);
+//! [5]
+ spawnsAvailable->setObjectName("spawnsAvailable");
+ noSpawnsAvailable->setObjectName("noSpawnsAvailable");
spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable);
- QHistoryState *hs = new QHistoryState(stoppedState);
+//! [3]
+ QHistoryState *hs = new QHistoryState(stoppedState);
hs->setDefaultState(spawnsAvailable);
+//! [3]
+ hs->setObjectName("hs");
stoppedState->setInitialState(hs);
+//! [0]
m_runningState = new QState(QState::ParallelStates, m_machine->rootState());
+//! [0]
m_runningState->setObjectName("runningState");
m_runningState->assignProperty(addTankAction, "enabled", false);
m_runningState->assignProperty(runGameAction, "enabled", false);
m_runningState->assignProperty(stopGameAction, "enabled", true);
+
+ QState *gameOverState = new QState(m_machine->rootState());
+ gameOverState->setObjectName("gameOverState");
+ gameOverState->assignProperty(stopGameAction, "enabled", false);
+ connect(gameOverState, SIGNAL(entered()), this, SLOT(gameOver()));
stoppedState->addTransition(runGameAction, SIGNAL(triggered()), m_runningState);
m_runningState->addTransition(stopGameAction, SIGNAL(triggered()), stoppedState);
+ m_gameOverTransition = new GameOverTransition(gameOverState);
+ m_runningState->addTransition(m_gameOverTransition);
+
QTimer *timer = new QTimer(this);
timer->setInterval(100);
connect(timer, SIGNAL(timeout()), this, SLOT(runStep()));
@@ -175,6 +194,22 @@ void MainWindow::runStep()
}
}
+void MainWindow::gameOver()
+{
+ QList<QGraphicsItem *> items = m_scene->items();
+
+ TankItem *lastTankStanding = 0;
+ foreach (QGraphicsItem *item, items) {
+ if (GameItem *gameItem = qgraphicsitem_cast<GameItem *>(item)) {
+ if (lastTankStanding = qobject_cast<TankItem *>(gameItem))
+ break;
+ }
+ }
+
+ QMessageBox::information(this, "Game over!",
+ QString::fromLatin1("The tank played by '%1' has won!").arg(lastTankStanding->objectName()));
+}
+
void MainWindow::addRocket()
{
TankItem *tankItem = qobject_cast<TankItem *>(sender());
@@ -193,25 +228,74 @@ void MainWindow::addTank()
{
Q_ASSERT(!m_spawns.isEmpty());
- QString fileName = QFileDialog::getOpenFileName(this, "Select plugin file", "plugins/", "*.dll");
- QPluginLoader loader(fileName);
+ QDir pluginsDir(qApp->applicationDirPath());
+#if defined(Q_OS_WIN)
+ if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
+ pluginsDir.cdUp();
+#elif defined(Q_OS_MAC)
+ if (pluginsDir.dirName() == "MacOS") {
+ pluginsDir.cdUp();
+ pluginsDir.cdUp();
+ pluginsDir.cdUp();
+ }
+#endif
+
+ pluginsDir.cd("plugins");
+
+ QStringList itemNames;
+ QList<Plugin *> items;
+ foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
+ QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
+ QObject *possiblePlugin = loader.instance();
+ if (Plugin *plugin = qobject_cast<Plugin *>(possiblePlugin)) {
+ QString objectName = possiblePlugin->objectName();
+ if (objectName.isEmpty())
+ objectName = fileName;
+
+ itemNames.append(objectName);
+ items.append(plugin);
+ }
+ }
+
+ if (items.isEmpty()) {
+ QMessageBox::information(this, "No tank types found", "Please build the errorstateplugins directory");
+ return;
+ }
+
+ bool ok;
+//! [1]
+ QString selectedName = QInputDialog::getItem(this, "Select a tank type", "Tank types",
+ itemNames, 0, false, &ok);
+//! [1]
- Plugin *plugin = qobject_cast<Plugin *>(loader.instance());
- if (plugin != 0) {
- TankItem *tankItem = m_spawns.takeLast();
- m_scene->addItem(tankItem);
- connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket()));
- if (m_spawns.isEmpty())
- emit mapFull();
-
- QState *region = new QState(m_runningState);
- QState *pluginState = plugin->create(region, tankItem);
- region->setInitialState(pluginState);
-
- // If the plugin has an error it is disabled
- QState *errorState = new QState(region);
- errorState->assignProperty(tankItem, "enabled", false);
- pluginState->setErrorState(errorState);
+ if (ok && !selectedName.isEmpty()) {
+ int idx = itemNames.indexOf(selectedName);
+ if (Plugin *plugin = idx >= 0 ? items.at(idx) : 0) {
+ TankItem *tankItem = m_spawns.takeLast();
+ tankItem->setObjectName(selectedName);
+ tankItem->setToolTip(selectedName);
+ m_scene->addItem(tankItem);
+ connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket()));
+ if (m_spawns.isEmpty())
+ emit mapFull();
+
+ m_gameOverTransition->addTankItem(tankItem);
+
+ QState *region = new QState(m_runningState);
+ region->setObjectName(QString::fromLatin1("region%1").arg(m_spawns.size()));
+//! [2]
+ QState *pluginState = plugin->create(region, tankItem);
+//! [2]
+ region->setInitialState(pluginState);
+
+ // If the plugin has an error it is disabled
+//! [4]
+ QState *errorState = new QState(region);
+ errorState->setObjectName(QString::fromLatin1("errorState%1").arg(m_spawns.size()));
+ errorState->assignProperty(tankItem, "enabled", false);
+ pluginState->setErrorState(errorState);
+//! [4]
+ }
}
}
diff --git a/examples/statemachine/errorstate/mainwindow.h b/examples/statemachine/tankgame/mainwindow.h
index 622dabe..40e1595 100644
--- a/examples/statemachine/errorstate/mainwindow.h
+++ b/examples/statemachine/tankgame/mainwindow.h
@@ -7,6 +7,7 @@
class QGraphicsScene;
class QStateMachine;
class QState;
+class GameOverTransition;
class TankItem;
class MainWindow: public QMainWindow
{
@@ -23,6 +24,7 @@ public slots:
void addTank();
void addRocket();
void runStep();
+ void gameOver();
signals:
void mapFull();
@@ -35,6 +37,7 @@ private:
QStateMachine *m_machine;
QState *m_runningState;
+ GameOverTransition *m_gameOverTransition;
QList<TankItem *> m_spawns;
QTime m_time;
diff --git a/examples/statemachine/errorstate/plugin.h b/examples/statemachine/tankgame/plugin.h
index 2b48d43..2b48d43 100644
--- a/examples/statemachine/errorstate/plugin.h
+++ b/examples/statemachine/tankgame/plugin.h
diff --git a/examples/statemachine/errorstate/rocketitem.cpp b/examples/statemachine/tankgame/rocketitem.cpp
index c324980..c324980 100644
--- a/examples/statemachine/errorstate/rocketitem.cpp
+++ b/examples/statemachine/tankgame/rocketitem.cpp
diff --git a/examples/statemachine/errorstate/rocketitem.h b/examples/statemachine/tankgame/rocketitem.h
index 189a1dd..189a1dd 100644
--- a/examples/statemachine/errorstate/rocketitem.h
+++ b/examples/statemachine/tankgame/rocketitem.h
diff --git a/examples/statemachine/errorstate/errorstate.pro b/examples/statemachine/tankgame/tankgame.pro
index b93a691..46cfe2e 100644
--- a/examples/statemachine/errorstate/errorstate.pro
+++ b/examples/statemachine/tankgame/tankgame.pro
@@ -5,9 +5,9 @@
TEMPLATE = app
TARGET =
DEPENDPATH += .
-INCLUDEPATH += C:/dev/kinetic/examples/statemachine/errorstate/. .
+INCLUDEPATH += C:/dev/kinetic/examples/statemachine/tankgame/. .
# Input
-HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h
-SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp
+HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h gameovertransition.h
+SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp gameovertransition.cpp
CONFIG += console
diff --git a/examples/statemachine/errorstate/tankitem.cpp b/examples/statemachine/tankgame/tankitem.cpp
index 5506a7e..c322d21 100644
--- a/examples/statemachine/errorstate/tankitem.cpp
+++ b/examples/statemachine/tankgame/tankitem.cpp
@@ -113,6 +113,7 @@ void TankItem::idle(qreal elapsed)
void TankItem::hitByRocket()
{
+ emit aboutToBeDestroyed();
deleteLater();
}
diff --git a/examples/statemachine/errorstate/tankitem.h b/examples/statemachine/tankgame/tankitem.h
index cefed69..9475397 100644
--- a/examples/statemachine/errorstate/tankitem.h
+++ b/examples/statemachine/tankgame/tankitem.h
@@ -35,11 +35,13 @@ public:
qreal distanceToObstacle() const;
qreal distanceToObstacle(QGraphicsItem **item) const;
+//! [0]
signals:
void tankSpotted(qreal direction, qreal distance);
void collision(const QLineF &collidedLine);
void actionCompleted();
void cannonFired();
+ void aboutToBeDestroyed();
public slots:
void moveForwards(qreal length = 10.0);
@@ -48,6 +50,7 @@ public slots:
void turnTo(qreal degrees = 0.0);
void stop();
void fireCannon();
+//! [0]
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai.pro b/examples/statemachine/tankgameplugins/random_ai/random_ai.pro
index f290250..5bc0b26 100644
--- a/examples/statemachine/errorstateplugins/random_ai/random_ai.pro
+++ b/examples/statemachine/tankgameplugins/random_ai/random_ai.pro
@@ -4,10 +4,10 @@ INCLUDEPATH += ../..
HEADERS = random_ai_plugin.h
SOURCES = random_ai_plugin.cpp
TARGET = $$qtLibraryTarget(random_ai)
-DESTDIR = ../../errorstate/plugins
+DESTDIR = ../../tankgame/plugins
#! [0]
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS random_ai.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/random_ai \ No newline at end of file
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/random_ai \ No newline at end of file
diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp
index c196247..c196247 100644
--- a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp
+++ b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp
diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h
index 3db464b..f5e3b6f 100644
--- a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h
+++ b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h
@@ -4,7 +4,7 @@
#include <QObject>
#include <QState>
-#include <errorstate/plugin.h>
+#include <tankgame/plugin.h>
class SelectActionState: public QState
{
@@ -56,6 +56,8 @@ class RandomAiPlugin: public QObject, public Plugin
Q_OBJECT
Q_INTERFACES(Plugin)
public:
+ RandomAiPlugin() { setObjectName("Random"); }
+
virtual QState *create(QState *parentState, QObject *tank);
};
diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp
index 2fb05d4..2fb05d4 100644
--- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp
diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
index 34d203e..9d4aabc 100644
--- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
@@ -1,7 +1,7 @@
#ifndef SEEK_AI_H
#define SEEK_AI_H
-#include <errorstate/plugin.h>
+#include <tankgame/plugin.h>
#include <QState>
#include <QFinalState>
@@ -81,7 +81,7 @@ public:
}
protected:
- bool eventTest(QEvent *event) const
+ bool eventTest(QEvent *event)
{
bool b = QSignalTransition::eventTest(event);
if (b) {
@@ -105,7 +105,7 @@ protected:
}
private:
- mutable QLineF m_lastLine;
+ QLineF m_lastLine;
QObject *m_tank;
QState *m_turnTo;
};
@@ -137,16 +137,20 @@ public:
ChaseState(QObject *tank, QState *parentState = 0) : QState(parentState), m_tank(tank)
{
QState *fireCannon = new QState(this);
+ fireCannon->setObjectName("fireCannon");
connect(fireCannon, SIGNAL(entered()), tank, SLOT(fireCannon()));
setInitialState(fireCannon);
- m_goToLocation = new GoToLocationState(this);
+ m_goToLocation = new GoToLocationState(tank, this);
+ m_goToLocation->setObjectName("goToLocation");
fireCannon->addTransition(tank, SIGNAL(actionCompleted()), m_goToLocation);
m_turnToDirection = new QState(this);
+ m_turnToDirection->setObjectName("turnToDirection");
m_goToLocation->addTransition(tank, SIGNAL(actionCompleted()), m_turnToDirection);
QFinalState *finalState = new QFinalState(this);
+ finalState->setObjectName("finalState");
m_turnToDirection->addTransition(tank, SIGNAL(actionCompleted()), finalState);
}
@@ -176,7 +180,7 @@ public:
}
protected:
- bool eventTest(QEvent *event) const
+ bool eventTest(QEvent *event)
{
bool b = QSignalTransition::eventTest(event);
if (b) {
@@ -196,6 +200,8 @@ class SeekAi: public QObject, public Plugin
Q_OBJECT
Q_INTERFACES(Plugin)
public:
+ SeekAi() { setObjectName("Seek and destroy"); }
+
virtual QState *create(QState *parentState, QObject *tank);
};
diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro
index 11bd242..0d8bf2e 100644
--- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro
@@ -4,10 +4,10 @@ INCLUDEPATH += ../..
HEADERS = seek_ai.h
SOURCES = seek_ai.cpp
TARGET = $$qtLibraryTarget(seek_ai)
-DESTDIR = ../../errorstate/plugins
+DESTDIR = ../../tankgame/plugins
#! [0]
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS seek_ai.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/seek_ai \ No newline at end of file
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/seek_ai \ No newline at end of file
diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp
index de95f41..de95f41 100644
--- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp
+++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp
diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h
index 4b4629c..d8d3d73 100644
--- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h
+++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h
@@ -1,7 +1,7 @@
#ifndef SPIN_AI_H
#define SPIN_AI_H
-#include <errorstate/plugin.h>
+#include <tankgame/plugin.h>
#include <QObject>
#include <QState>
@@ -18,7 +18,7 @@ public:
public slots:
void spin()
{
- m_tank->setProperty("direction", 90.0);
+ m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0);
}
protected:
@@ -28,6 +28,11 @@ protected:
spin();
}
+ void onExit(QEvent *)
+ {
+ disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin()));
+ }
+
private:
QObject *m_tank;
@@ -38,6 +43,8 @@ class SpinAi: public QObject, public Plugin
Q_OBJECT
Q_INTERFACES(Plugin)
public:
+ SpinAi() { setObjectName("Spin and destroy"); }
+
virtual QState *create(QState *parentState, QObject *tank);
};
diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro
index c2fd937..8ab4da0 100644
--- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro
+++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro
@@ -4,10 +4,10 @@ INCLUDEPATH += ../..
HEADERS = spin_ai.h
SOURCES = spin_ai.cpp
TARGET = $$qtLibraryTarget(spin_ai)
-DESTDIR = ../../errorstate/plugins
+DESTDIR = ../../tankgame/plugins
#! [0]
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS spin_ai.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/spin_ai \ No newline at end of file
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/spin_ai \ No newline at end of file
diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp
index 5499ba3..5499ba3 100644
--- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp
+++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp
diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h
index 9a96a8b..456ba01 100644
--- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h
+++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h
@@ -1,7 +1,7 @@
#ifndef SPIN_AI_WITH_ERROR_H
#define SPIN_AI_WITH_ERROR_H
-#include <errorstate/plugin.h>
+#include <tankgame/plugin.h>
#include <QObject>
#include <QState>
@@ -18,7 +18,7 @@ public:
public slots:
void spin()
{
- m_tank->setProperty("direction", 90.0);
+ m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0);
}
protected:
@@ -28,6 +28,11 @@ protected:
spin();
}
+ void onExit(QEvent *)
+ {
+ disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin()));
+ }
+
private:
QObject *m_tank;
@@ -38,6 +43,8 @@ class SpinAiWithError: public QObject, public Plugin
Q_OBJECT
Q_INTERFACES(Plugin)
public:
+ SpinAiWithError() { setObjectName("Spin and destroy with runtime error in state machine"); }
+
virtual QState *create(QState *parentState, QObject *tank);
};
diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro
index 31f4c7f..124cf98 100644
--- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro
+++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro
@@ -4,10 +4,10 @@ INCLUDEPATH += ../..
HEADERS = spin_ai_with_error.h
SOURCES = spin_ai_with_error.cpp
TARGET = $$qtLibraryTarget(spin_ai_with_error)
-DESTDIR = ../../errorstate/plugins
+DESTDIR = ../../tankgame/plugins
#! [0]
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS spin_ai_with_error.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/spin_ai_with_error \ No newline at end of file
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/spin_ai_with_error \ No newline at end of file
diff --git a/examples/statemachine/tankgameplugins/tankgameplugins.pro b/examples/statemachine/tankgameplugins/tankgameplugins.pro
new file mode 100644
index 0000000..a098e03
--- /dev/null
+++ b/examples/statemachine/tankgameplugins/tankgameplugins.pro
@@ -0,0 +1,11 @@
+TEMPLATE = subdirs
+SUBDIRS = random_ai \
+ spin_ai_with_error \
+ spin_ai \
+ seek_ai
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS tankgameplugins.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins
+INSTALLS += target sources
diff --git a/examples/statemachine/trafficlight/main.cpp b/examples/statemachine/trafficlight/main.cpp
index 3c47a51..8a46fff 100644
--- a/examples/statemachine/trafficlight/main.cpp
+++ b/examples/statemachine/trafficlight/main.cpp
@@ -87,27 +87,6 @@ private:
//! [0]
//! [1]
-class LightState : public QState
-{
-public:
- LightState(LightWidget *light, int duration, QState *parent = 0)
- : QState(parent)
- {
- QTimer *timer = new QTimer(this);
- timer->setInterval(duration);
- timer->setSingleShot(true);
- QState *timing = new QState(this);
- QObject::connect(timing, SIGNAL(entered()), light, SLOT(turnOn()));
- QObject::connect(timing, SIGNAL(entered()), timer, SLOT(start()));
- QObject::connect(timing, SIGNAL(exited()), light, SLOT(turnOff()));
- QFinalState *done = new QFinalState(this);
- timing->addTransition(timer, SIGNAL(timeout()), done);
- setInitialState(timing);
- }
-};
-//! [1]
-
-//! [2]
class TrafficLightWidget : public QWidget
{
public:
@@ -139,6 +118,24 @@ private:
LightWidget *m_yellow;
LightWidget *m_green;
};
+//! [1]
+
+//! [2]
+QState *createLightState(LightWidget *light, int duration, QState *parent = 0)
+{
+ QState *lightState = new QState(parent);
+ QTimer *timer = new QTimer(lightState);
+ timer->setInterval(duration);
+ timer->setSingleShot(true);
+ QState *timing = new QState(lightState);
+ QObject::connect(timing, SIGNAL(entered()), light, SLOT(turnOn()));
+ QObject::connect(timing, SIGNAL(entered()), timer, SLOT(start()));
+ QObject::connect(timing, SIGNAL(exited()), light, SLOT(turnOff()));
+ QFinalState *done = new QFinalState(lightState);
+ timing->addTransition(timer, SIGNAL(timeout()), done);
+ lightState->setInitialState(timing);
+ return lightState;
+}
//! [2]
//! [3]
@@ -154,15 +151,15 @@ public:
vbox->setMargin(0);
QStateMachine *machine = new QStateMachine(this);
- LightState *redGoingYellow = new LightState(widget->redLight(), 3000);
+ QState *redGoingYellow = createLightState(widget->redLight(), 3000);
redGoingYellow->setObjectName("redGoingYellow");
- LightState *yellowGoingGreen = new LightState(widget->yellowLight(), 1000);
+ QState *yellowGoingGreen = createLightState(widget->yellowLight(), 1000);
yellowGoingGreen->setObjectName("yellowGoingGreen");
redGoingYellow->addTransition(redGoingYellow, SIGNAL(finished()), yellowGoingGreen);
- LightState *greenGoingYellow = new LightState(widget->greenLight(), 3000);
+ QState *greenGoingYellow = createLightState(widget->greenLight(), 3000);
greenGoingYellow->setObjectName("greenGoingYellow");
yellowGoingGreen->addTransition(yellowGoingGreen, SIGNAL(finished()), greenGoingYellow);
- LightState *yellowGoingRed = new LightState(widget->yellowLight(), 1000);
+ QState *yellowGoingRed = createLightState(widget->yellowLight(), 1000);
yellowGoingRed->setObjectName("yellowGoingRed");
greenGoingYellow->addTransition(greenGoingYellow, SIGNAL(finished()), yellowGoingRed);
yellowGoingRed->addTransition(yellowGoingRed, SIGNAL(finished()), redGoingYellow);
diff --git a/examples/statemachine/twowaybutton/main.cpp b/examples/statemachine/twowaybutton/main.cpp
index 61a0f32..a2c6e45 100644
--- a/examples/statemachine/twowaybutton/main.cpp
+++ b/examples/statemachine/twowaybutton/main.cpp
@@ -45,34 +45,42 @@
#include <qstatemachine.h>
#endif
+//! [0]
int main(int argc, char **argv)
{
QApplication app(argc, argv);
-
QPushButton button;
-
QStateMachine machine;
- QState *first = new QState();
- first->setObjectName("first");
+//! [0]
+//! [1]
QState *off = new QState();
off->assignProperty(&button, "text", "Off");
off->setObjectName("off");
- first->addTransition(off);
QState *on = new QState();
on->setObjectName("on");
on->assignProperty(&button, "text", "On");
+//! [1]
+
+//! [2]
off->addTransition(&button, SIGNAL(clicked()), on);
on->addTransition(&button, SIGNAL(clicked()), off);
+//! [2]
- machine.addState(first);
+//! [3]
machine.addState(off);
machine.addState(on);
- machine.setInitialState(first);
+//! [3]
+
+//! [4]
+ machine.setInitialState(off);
machine.start();
+//! [4]
+//! [5]
button.resize(100, 50);
button.show();
return app.exec();
}
+//! [5]
diff --git a/examples/tools/contiguouscache/contiguouscache.pro b/examples/tools/contiguouscache/contiguouscache.pro
new file mode 100644
index 0000000..f840514
--- /dev/null
+++ b/examples/tools/contiguouscache/contiguouscache.pro
@@ -0,0 +1,9 @@
+HEADERS = randomlistmodel.h
+SOURCES = randomlistmodel.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS contiguouscache.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache
+INSTALLS += target sources
diff --git a/examples/tools/contiguouscache/main.cpp b/examples/tools/contiguouscache/main.cpp
new file mode 100644
index 0000000..291aaf4
--- /dev/null
+++ b/examples/tools/contiguouscache/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples 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 "randomlistmodel.h"
+#include <QListView>
+#include <QApplication>
+
+int main(int c, char **v)
+{
+ QApplication a(c, v);
+
+ QListView view;
+ view.setUniformItemSizes(true);
+ view.setModel(new RandomListModel(&view));
+ view.show();
+
+ return a.exec();
+}
diff --git a/examples/statemachine/clockticking/main.cpp b/examples/tools/contiguouscache/randomlistmodel.cpp
index ea8e692..b1c7204 100644
--- a/examples/statemachine/clockticking/main.cpp
+++ b/examples/tools/contiguouscache/randomlistmodel.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,86 +38,60 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "randomlistmodel.h"
+#include <stdlib.h>
-#include <QtCore>
-#include <stdio.h>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qabstracttransition.h>
-#endif
+static const int bufferSize(500);
+static const int lookAhead(100);
+static const int halfLookAhead(lookAhead/2);
-class ClockEvent : public QEvent
+RandomListModel::RandomListModel(QObject *parent)
+: QAbstractListModel(parent), m_rows(bufferSize), m_count(10000)
{
-public:
- ClockEvent() : QEvent(QEvent::Type(QEvent::User+2))
- {}
-};
-
-class ClockState : public QState
-{
-public:
- ClockState(QState *parent)
- : QState(parent) {}
-
-protected:
- virtual void onEntry(QEvent *)
- {
- fprintf(stdout, "ClockState entered; posting the initial tick\n");
- machine()->postEvent(new ClockEvent());
- }
-};
+}
-class ClockTransition : public QAbstractTransition
+RandomListModel::~RandomListModel()
{
-public:
- ClockTransition() {}
-
-protected:
- virtual bool eventTest(QEvent *e) const {
- return (e->type() == QEvent::User+2);
- }
- virtual void onTransition(QEvent *)
- {
- fprintf(stdout, "ClockTransition triggered; posting another tick with a delay of 1 second\n");
- machine()->postEvent(new ClockEvent(), 1000);
- }
-};
+}
-class ClockListener : public QAbstractTransition
+int RandomListModel::rowCount(const QModelIndex &) const
{
-public:
- ClockListener() {}
-
-protected:
- virtual bool eventTest(QEvent *e) const {
- return (e->type() == QEvent::User+2);
- }
- virtual void onTransition(QEvent *)
- {
- fprintf(stdout, "ClockListener heard a tick!\n");
- }
-};
+ return m_count;
+}
-int main(int argc, char **argv)
+//! [0]
+QVariant RandomListModel::data(const QModelIndex &index, int role) const
{
- QCoreApplication app(argc, argv);
+ if (role != Qt::DisplayRole)
+ return QVariant();
- QStateMachine machine;
- QState *group = new QState(QState::ParallelStates);
- group->setObjectName("group");
+ int row = index.row();
- ClockState *clock = new ClockState(group);
- clock->setObjectName("clock");
- clock->addTransition(new ClockTransition());
+ if (row > m_rows.lastIndex()) {
+ if (row - m_rows.lastIndex() > lookAhead)
+ cacheRows(row-halfLookAhead, qMin(m_count, row+halfLookAhead));
+ else while (row > m_rows.lastIndex())
+ m_rows.append(fetchRow(m_rows.lastIndex()+1));
+ } else if (row < m_rows.firstIndex()) {
+ if (m_rows.firstIndex() - row > lookAhead)
+ cacheRows(qMax(0, row-halfLookAhead), row+halfLookAhead);
+ else while (row < m_rows.firstIndex())
+ m_rows.prepend(fetchRow(m_rows.firstIndex()-1));
+ }
- QState *listener = new QState(group);
- listener->setObjectName("listener");
- listener->addTransition(new ClockListener());
+ return m_rows.at(row);
+}
- machine.addState(group);
- machine.setInitialState(group);
- machine.start();
+void RandomListModel::cacheRows(int from, int to) const
+{
+ for (int i = from; i <= to; ++i)
+ m_rows.insert(i, fetchRow(i));
+}
+//![0]
- return app.exec();
+//![1]
+QString RandomListModel::fetchRow(int position) const
+{
+ return QString::number(rand() % ++position);
}
+//![1]
diff --git a/examples/statemachine/helloworld/main.cpp b/examples/tools/contiguouscache/randomlistmodel.h
index fbe34b5..d32bf16 100644
--- a/examples/statemachine/helloworld/main.cpp
+++ b/examples/tools/contiguouscache/randomlistmodel.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,41 +38,29 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#ifndef RANDOMLISTMODEL_H
+#define RANDOMLISTMODEL_H
-#include <QtCore>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qfinalstate.h>
-#endif
+#include <QContiguousCache>
+#include <QAbstractListModel>
-class S0 : public QState
+class QTimer;
+class RandomListModel : public QAbstractListModel
{
+ Q_OBJECT
public:
- S0(QState *parent = 0)
- : QState(parent) {}
-
- virtual void onEntry(QEvent *)
- {
- fprintf(stdout, "Hello world!\n");
- }
-};
+ RandomListModel(QObject *parent = 0);
+ ~RandomListModel();
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
+ int rowCount(const QModelIndex & = QModelIndex()) const;
+ QVariant data(const QModelIndex &, int) const;
- QStateMachine machine;
- QState *s0 = new S0();
- QFinalState *s1 = new QFinalState();
- s0->addTransition(s1);
+private:
+ void cacheRows(int, int) const;
+ QString fetchRow(int) const;
- machine.addState(s0);
- machine.addState(s1);
- machine.setInitialState(s0);
-
- QObject::connect(&machine, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit()));
- machine.start();
+ mutable QContiguousCache<QString> m_rows;
+ const int m_count;
+};
- return app.exec();
-}
+#endif
diff --git a/examples/tools/tools.pro b/examples/tools/tools.pro
index 79f0faa..c694dd8 100644
--- a/examples/tools/tools.pro
+++ b/examples/tools/tools.pro
@@ -5,6 +5,7 @@ SUBDIRS = codecs \
customcompleter \
echoplugin \
i18n \
+ contiguouscache \
plugandpaintplugins \
plugandpaint \
regexp \
diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp
index bf61f9c..e24f6cf 100644
--- a/examples/webkit/fancybrowser/mainwindow.cpp
+++ b/examples/webkit/fancybrowser/mainwindow.cpp
@@ -43,6 +43,8 @@
#include <QtWebKit>
#include "mainwindow.h"
+//! [1]
+
MainWindow::MainWindow()
{
progress = 0;
@@ -52,7 +54,9 @@ MainWindow::MainWindow()
file.open(QIODevice::ReadOnly);
jQuery = file.readAll();
file.close();
+//! [1]
+//! [2]
view = new QWebView(this);
view->load(QUrl("http://www.google.com/ncr"));
connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
@@ -70,7 +74,9 @@ MainWindow::MainWindow()
toolBar->addAction(view->pageAction(QWebPage::Reload));
toolBar->addAction(view->pageAction(QWebPage::Stop));
toolBar->addWidget(locationEdit);
+//! [2]
+//! [3]
QMenu *effectMenu = menuBar()->addMenu(tr("&Effect"));
effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks()));
@@ -89,7 +95,9 @@ MainWindow::MainWindow()
setCentralWidget(view);
}
+//! [3]
+//! [4]
void MainWindow::adjustLocation()
{
locationEdit->setText(view->url().toString());
@@ -98,11 +106,12 @@ void MainWindow::adjustLocation()
void MainWindow::changeLocation()
{
QUrl url = QUrl(locationEdit->text());
- locationEdit->setText(url.toString());
view->load(url);
view->setFocus();
}
+//! [4]
+//! [5]
void MainWindow::adjustTitle()
{
if (progress <= 0 || progress >= 100)
@@ -116,20 +125,26 @@ void MainWindow::setProgress(int p)
progress = p;
adjustTitle();
}
+//! [5]
+//! [6]
void MainWindow::finishLoading(bool)
{
progress = 100;
adjustTitle();
view->page()->mainFrame()->evaluateJavaScript(jQuery);
}
+//! [6]
+//! [7]
void MainWindow::highlightAllLinks()
{
QString code = "$('a').each( function () { $(this).css('background-color', 'yellow') } )";
view->page()->mainFrame()->evaluateJavaScript(code);
}
+//! [7]
+//! [8]
void MainWindow::rotateImages(bool toggle)
{
QString code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s') } )";
@@ -140,7 +155,9 @@ void MainWindow::rotateImages(bool toggle)
code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(0deg)') } )";
view->page()->mainFrame()->evaluateJavaScript(code);
}
+//! [8]
+//! [9]
void MainWindow::removeGifImages()
{
QString code = "$('[src*=gif]').remove()";
@@ -164,4 +181,5 @@ void MainWindow::removeEmbeddedElements()
QString code = "$('embed').remove()";
view->page()->mainFrame()->evaluateJavaScript(code);
}
+//! [9]
diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h
index 9362ca7..2e1068c 100644
--- a/examples/webkit/fancybrowser/mainwindow.h
+++ b/examples/webkit/fancybrowser/mainwindow.h
@@ -39,13 +39,14 @@
**
****************************************************************************/
-#include <QMainWindow>
+#include <QtGui>
QT_BEGIN_NAMESPACE
class QWebView;
class QLineEdit;
QT_END_NAMESPACE
+//! [1]
class MainWindow : public QMainWindow
{
Q_OBJECT
@@ -73,4 +74,5 @@ private:
QWebView *view;
QLineEdit *locationEdit;
int progress;
+//! [1]
};