summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-11-05 00:53:00 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-11-05 00:53:00 (GMT)
commitaa6f6174374e0abfe94f37ccefce2d0e2b5fe13e (patch)
tree2848c48829255e8a2e85cc50bd84cc6a2a27939c /examples
parentf3cce7a770f25c42d5c85b012df338fc712f5b2e (diff)
parent9e5c80bd52467afa481775fe9695bac7edcf7324 (diff)
downloadQt-aa6f6174374e0abfe94f37ccefce2d0e2b5fe13e.zip
Qt-aa6f6174374e0abfe94f37ccefce2d0e2b5fe13e.tar.gz
Qt-aa6f6174374e0abfe94f37ccefce2d0e2b5fe13e.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/declarative/animations/color-animation.qml5
-rw-r--r--examples/declarative/effects/effects.qml75
-rw-r--r--examples/mainwindows/mdi/mainwindow.cpp2
-rw-r--r--examples/mainwindows/sdi/mainwindow.h2
-rw-r--r--examples/script/customclass/bytearrayclass.cpp17
5 files changed, 19 insertions, 82 deletions
diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml
index edb0659..54608c7 100644
--- a/examples/declarative/animations/color-animation.qml
+++ b/examples/declarative/animations/color-animation.qml
@@ -31,10 +31,7 @@ Item {
Item {
width: parent.width; height: 2 * parent.height
transformOrigin: Item.Center
- rotation: SequentialAnimation {
- running: true; repeat: true
- NumberAnimation { from: 0; to: 360; duration: 10000 }
- }
+ rotation: NumberAnimation { from: 0; to: 360; duration: 10000; running: true; repeat: true }
Image {
source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter
transformOrigin: Item.Center; rotation: -3 * parent.rotation
diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml
index 851b2fe..e6efc75 100644
--- a/examples/declarative/effects/effects.qml
+++ b/examples/declarative/effects/effects.qml
@@ -2,11 +2,12 @@ import Qt 4.6
Rectangle {
color: "white"
- width: 600
- height: 600
+ width: 400
+ height: 200
Image {
id: blur
+ x: 5
source: "pic.png"
effect: Blur {
@@ -24,49 +25,9 @@ Rectangle {
Text { text: "Blur"; anchors.top: blur.bottom; anchors.horizontalCenter: blur.horizontalCenter }
Image {
- id: grayscale
- source: "pic.png"
- x: 200
-
- effect: Grayscale {}
- }
-
- Text { text: "Grayscale"; anchors.top: grayscale.bottom; anchors.horizontalCenter: grayscale.horizontalCenter }
-
- Image {
- id: colorize
- source: "pic.png"
- x: 400
-
- effect: Colorize { color: "blue" }
- }
-
- Text { text: "Colorize"; anchors.top: colorize.bottom; anchors.horizontalCenter: colorize.horizontalCenter }
-
- Image {
- id: pixelize
- source: "pic.png"
- y: 300
-
- effect: Pixelize {
- pixelSize: NumberAnimation {
- id: pixelizeEffect
- from: 0; to: 10
- duration: 1000
- repeat: true
- }
- }
-
- MouseRegion { anchors.fill: parent; onClicked: pixelizeEffect.running = !pixelizeEffect.running }
- }
-
- Text { text: "Pixelize"; anchors.top: pixelize.bottom; anchors.horizontalCenter: pixelize.horizontalCenter }
-
- Image {
id: dropShadow
source: "pic.png"
- x: 200
- y: 300
+ x: 135
effect: DropShadow {
blurRadius: 3
@@ -77,33 +38,21 @@ Rectangle {
MouseRegion { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running }
}
- Text { text: "Drop Shadow"; anchors.top: dropShadow.bottom; anchors.horizontalCenter: dropShadow.horizontalCenter }
-
Image {
- id: bloom
+ id: colorize
source: "pic.png"
- x: 400
- y: 300
+ x: 265
- effect: Bloom {
- blurRadius: 3
- brightness: 128
- strength: NumberAnimation {
- id: bloomEffect
- from: 0; to: 1
- duration: 1000
- repeat: true
- }
- }
-
- MouseRegion { anchors.fill: parent; onClicked: bloomEffect.running = !bloomEffect.running }
+ effect: Colorize { color: "blue" }
}
- Text { text: "Bloom"; anchors.top: bloom.bottom; anchors.horizontalCenter: bloom.horizontalCenter }
+ Text { text: "Colorize"; anchors.top: colorize.bottom; anchors.horizontalCenter: colorize.horizontalCenter }
+
+ Text { text: "Drop Shadow"; anchors.top: dropShadow.bottom; anchors.horizontalCenter: dropShadow.horizontalCenter }
Text {
- x: 100; y: 250
- text: "Clicking Blur, Pixelize, Drop Shadow or Bloom will \ntoggle animation."
+ y: 155; anchors.horizontalCenter: parent.horizontalCenter
+ text: "Clicking Blur or Drop Shadow will \ntoggle animation."
color: "black"
}
diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp
index 712d91f..edb33b7 100644
--- a/examples/mainwindows/mdi/mainwindow.cpp
+++ b/examples/mainwindows/mdi/mainwindow.cpp
@@ -71,7 +71,7 @@ MainWindow::MainWindow()
void MainWindow::closeEvent(QCloseEvent *event)
{
mdiArea->closeAllSubWindows();
- if (activeMdiChild()) {
+ if (mdiArea->currentSubWindow()) {
event->ignore();
} else {
writeSettings();
diff --git a/examples/mainwindows/sdi/mainwindow.h b/examples/mainwindows/sdi/mainwindow.h
index ca478df..a925e2f 100644
--- a/examples/mainwindows/sdi/mainwindow.h
+++ b/examples/mainwindows/sdi/mainwindow.h
@@ -50,12 +50,14 @@ class QMenu;
class QTextEdit;
QT_END_NAMESPACE
+//! [class definition with macro]
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
+//! [class definition with macro]
MainWindow(const QString &fileName);
protected:
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp
index 7291b97..bce69e4 100644
--- a/examples/script/customclass/bytearrayclass.cpp
+++ b/examples/script/customclass/bytearrayclass.cpp
@@ -72,18 +72,6 @@ private:
int m_last;
};
-static qint32 toArrayIndex(const QString &str)
-{
- QByteArray bytes = str.toUtf8();
- char *eptr;
- quint32 pos = strtoul(bytes.constData(), &eptr, 10);
- if ((eptr == bytes.constData() + bytes.size())
- && (QByteArray::number(pos) == bytes)) {
- return pos;
- }
- return -1;
-}
-
//! [0]
ByteArrayClass::ByteArrayClass(QScriptEngine *engine)
: QObject(engine), QScriptClass(engine)
@@ -120,8 +108,9 @@ QScriptClass::QueryFlags ByteArrayClass::queryProperty(const QScriptValue &objec
if (name == length) {
return flags;
} else {
- qint32 pos = toArrayIndex(name);
- if (pos == -1)
+ bool isArrayIndex;
+ qint32 pos = name.toArrayIndex(&isArrayIndex);
+ if (!isArrayIndex)
return 0;
*id = pos;
if ((flags & HandlesReadAccess) && (pos >= ba->size()))