diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-07-31 02:50:53 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-07-31 02:50:53 (GMT) |
commit | 3359564d5628af68eb19598d1c0d19e5d1abb272 (patch) | |
tree | 3e147072e964223e15ff7397096a97d62670c5bc /examples | |
parent | bf5f7f6db51ef1ddc3fb002d12bfb597c0a748f8 (diff) | |
parent | 9e7796e63a412efa0cbbba518523c163a097cd48 (diff) | |
download | Qt-3359564d5628af68eb19598d1c0d19e5d1abb272.zip Qt-3359564d5628af68eb19598d1c0d19e5d1abb272.tar.gz Qt-3359564d5628af68eb19598d1c0d19e5d1abb272.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
29 files changed, 76 insertions, 62 deletions
diff --git a/examples/declarative/behaviours/MyRect.qml b/examples/declarative/behaviours/MyRect.qml index 1ccf4db..199b33b 100644 --- a/examples/declarative/behaviours/MyRect.qml +++ b/examples/declarative/behaviours/MyRect.qml @@ -2,7 +2,7 @@ import Qt 4.6 Rect { radius: 15 - pen.color: "black" + border.color: "black" width: 100 height: 100 id: Page diff --git a/examples/declarative/flowview/flickr.qml b/examples/declarative/flowview/flickr.qml index 6c47b82..2abf7a1 100644 --- a/examples/declarative/flowview/flickr.qml +++ b/examples/declarative/flowview/flickr.qml @@ -2,7 +2,7 @@ import Qt 4.6 Rect { radius: 5; - pen.width: 1; + border.width: 1; width:400; height: 120; color: background; @@ -35,7 +35,7 @@ Rect { delegate: Item { width: 90; height: 86 Rect { - anchors.centeredIn: parent + anchors.centerIn: parent width: 86; height: 86; color: "white"; radius: 5 Image { source: imagePath; x: 5; y: 5 } diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml index 77b3230..99f5c1e 100644 --- a/examples/declarative/flowview/flowview.qml +++ b/examples/declarative/flowview/flowview.qml @@ -8,7 +8,7 @@ Rect { Rect { id: MyPhone transformOrigin: "Center" - anchors.centeredIn: parent + anchors.centerIn: parent width: 800 height: 480 clip: true @@ -45,7 +45,7 @@ Rect { delegate: Package { Item { id: List; Package.name: "list"; width:120; height: 400; } Item { id: Grid; Package.name: "grid"; width:400; height: 120; } - Item { id: MyContent; width:400; height: 120; qml: weblet } + Loader { id: MyContent; width:400; height: 120; source: weblet } StateGroup { states: [ diff --git a/examples/declarative/flowview/rect.qml b/examples/declarative/flowview/rect.qml index 9d81fa4..3fecf17 100644 --- a/examples/declarative/flowview/rect.qml +++ b/examples/declarative/flowview/rect.qml @@ -1,4 +1,4 @@ import Qt 4.6 -Rect { radius: 5; pen.width: 1; width:400; height: 120; color: background; } +Rect { radius: 5; border.width: 1; width:400; height: 120; color: background; } diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index 23ae466..8fff22b 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -22,7 +22,7 @@ Item { Text { font.bold: true color: "white" - anchors.centeredIn: Image + anchors.centerIn: Image text: Container.text } width: Image.width diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 788e067..8b12527 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -24,7 +24,7 @@ Rect { Rect { id: background x: 1; y: 2; width: parent.width-2; height: parent.height-4 - color: "#FEFFEE"; pen.color: "#FFBE4F"; radius: 5 + color: "#FEFFEE"; border.color: "#FFBE4F"; radius: 5 } // This mouse region covers the entire delegate. // When clicked it changes mode to 'Details'. If we are already diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml index 007b998..96c2a76 100644 --- a/examples/declarative/loader/Browser.qml +++ b/examples/declarative/loader/Browser.qml @@ -30,7 +30,7 @@ Rect { } Item { width: 32; height: 32 - Image { source: "images/fileopen.png"; anchors.centeredIn: parent; visible: folders.isFolder(index)} + Image { source: "images/fileopen.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} } Text { id: NameText @@ -82,15 +82,15 @@ Rect { id: TitleBar width: parent.width height: 32 - color: activePalette.button; pen.color: activePalette.mid + color: activePalette.button; border.color: activePalette.mid Rect { id: UpButton width: 30 height: TitleBar.height - pen.color: activePalette.mid; color: "transparent" + border.color: activePalette.mid; color: "transparent" MouseRegion { anchors.fill: parent; onClicked: folders.folder = up(folders.folder) } - Image { anchors.centeredIn: parent; source: "images/up.png" } + Image { anchors.centerIn: parent; source: "images/up.png" } } Text { diff --git a/examples/declarative/loader/Button.qml b/examples/declarative/loader/Button.qml index 7a17601..999e180 100644 --- a/examples/declarative/loader/Button.qml +++ b/examples/declarative/loader/Button.qml @@ -8,9 +8,9 @@ Rect { height: Text.height + 10 width: Text.width + 20 - pen.width: 1 + border.width: 1 radius: 4 color: "grey" MouseRegion { anchors.fill: parent; onClicked: Container.clicked() } - Text { id: Text; anchors.centeredIn:parent; font.size: 10; text: parent.text } + Text { id: Text; anchors.centerIn:parent; font.size: 10; text: parent.text } } diff --git a/examples/declarative/loader/loader.qml b/examples/declarative/loader/loader.qml index 447d73a..f507651 100644 --- a/examples/declarative/loader/loader.qml +++ b/examples/declarative/loader/loader.qml @@ -1,8 +1,10 @@ import Qt 4.6 Rect { - id: Shell width: 300 height: 400 - qml: "Browser.qml" + Loader { + anchors.fill: parent + source: "Browser.qml" + } } diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml index 0948a32..d9db106 100644 --- a/examples/declarative/mouseregion/mouse.qml +++ b/examples/declarative/mouseregion/mouse.qml @@ -6,7 +6,7 @@ Rect { Rect { width: 50; height: 50 color: "red" - Text { text: "Click"; anchors.centeredIn: parent } + Text { text: "Click"; anchors.centerIn: parent } MouseRegion { onPressed: { print('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') } onReleased: { print('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') } @@ -21,7 +21,7 @@ Rect { Rect { y: 100; width: 50; height: 50 color: "blue" - Text { text: "Drag"; anchors.centeredIn: parent } + Text { text: "Drag"; anchors.centerIn: parent } MouseRegion { drag.target: parent drag.axis: "x" diff --git a/examples/declarative/slideswitch/display.qml b/examples/declarative/slideswitch/display.qml index db67dab..bd9b122 100644 --- a/examples/declarative/slideswitch/display.qml +++ b/examples/declarative/slideswitch/display.qml @@ -5,6 +5,6 @@ Rect { width: 150 height: 150 Switch { - anchors.centeredIn: parent + anchors.centerIn: parent } } diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml index 77bacab..4b52991 100644 --- a/examples/declarative/snow/ImageBatch.qml +++ b/examples/declarative/snow/ImageBatch.qml @@ -43,7 +43,7 @@ GridView { Image { id: Image; source: url; preserveAspect: true; smooth: true; anchors.fill: parent; opacity: (status == 0)?1:0; opacity: Behavior { NumberAnimation { properties: "opacity" } } } - Loading { anchors.centeredIn: parent; visible: Image.status } + Loading { anchors.centerIn: parent; visible: Image.status } states: State { name: "selected" diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml index aa5185f..aed426f 100644 --- a/examples/declarative/snow/snow.qml +++ b/examples/declarative/snow/snow.qml @@ -21,7 +21,7 @@ Rect { property int selectedY: selectedItemRow * imageHeight Item { - anchors.centeredIn: parent + anchors.centerIn: parent HorizontalLayout { id: MyLayout property real targetX: -(selectedX + imageWidth / 2) diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index 431f0bc..c4c71b5 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -6,19 +6,19 @@ Rect { // A target region. Clicking in here sets the state to '' - the default state Rect { x: 0; y: 0; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } } } // Another target region. Clicking in here sets the state to 'Position1' Rect { x: 150; y: 50; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } } } // Another target region. Clicking in here sets the state to 'Position2' Rect { x: 0; y: 200; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } } } // Rect which will be moved when my state changes diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 7bc7f6c..63ed4d9 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -6,19 +6,19 @@ Rect { // A target region. Clicking in here sets the state to '' - the default state Rect { x: 0; y: 0; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } } } // Another target region. Clicking in here sets the state to 'Position1' Rect { x: 150; y: 50; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } } } // Another target region. Clicking in here sets the state to 'Position2' Rect { x: 0; y: 200; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } } } // Rect which will be moved when my state changes diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml index 42feeb1..d3f626f 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml @@ -16,16 +16,16 @@ FocusRealm { width: groupBox.width-20 height: groupBox.height-20 color: "white" - pen.color: "black" - Item { + border.color: "black" + Loader { id: subItem - qml: groupBox.contents + source: groupBox.contents anchors.top: parent.top anchors.topMargin: 10 anchors.right: parent.right anchors.rightMargin: 10 - width: qmlItem.width - height: qmlItem.height + width: item.width + height: item.height } } Rect { diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml index e3081b9..cf50fb0 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml @@ -6,11 +6,11 @@ Item { clip: true width: 230 height: 30 - Item { + Loader { id: removeButton - qml: "RemoveButton.qml" - width: qmlItem.width - height: qmlItem.height + source: "RemoveButton.qml" + width: item.width + height: item.height anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom diff --git a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml index 42feeb1..d3f626f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml @@ -16,16 +16,16 @@ FocusRealm { width: groupBox.width-20 height: groupBox.height-20 color: "white" - pen.color: "black" - Item { + border.color: "black" + Loader { id: subItem - qml: groupBox.contents + source: groupBox.contents anchors.top: parent.top anchors.topMargin: 10 anchors.right: parent.right anchors.rightMargin: 10 - width: qmlItem.width - height: qmlItem.height + width: item.width + height: item.height } } Rect { diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml index 46e09a0..cc115e3 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml @@ -56,33 +56,33 @@ Item { MouseRegion { anchors.fill: label onClicked: { - Details.qml = 'Contact.qml'; + Details.source = 'Contact.qml'; wrapper.state='opened'; } } - Item { + Loader { id: Details anchors.fill: parent opacity: 0 //! [setting qml] //! [binding] Bind { - target: Details.qmlItem + target: Details.item property: "contactId" value: model.recid } Bind { - target: Details.qmlItem + target: Details.item property: "label" value: model.label } Bind { - target: Details.qmlItem + target: Details.item property: "phone" value: model.phone } Bind { - target: Details.qmlItem + target: Details.item property: "email" value: model.email } diff --git a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml index 42feeb1..d3f626f 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml @@ -16,16 +16,16 @@ FocusRealm { width: groupBox.width-20 height: groupBox.height-20 color: "white" - pen.color: "black" - Item { + border.color: "black" + Loader { id: subItem - qml: groupBox.contents + source: groupBox.contents anchors.top: parent.top anchors.topMargin: 10 anchors.right: parent.right anchors.rightMargin: 10 - width: qmlItem.width - height: qmlItem.height + width: item.width + height: item.height } } Rect { diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 05e1f07..f7a5a47 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -7,7 +7,7 @@ Rect { width: 400 height: 500 radius: 7 - pen.color: "black" + border.color: "black" id: Page Image { x: 10 diff --git a/examples/ipc/ipc.pro b/examples/ipc/ipc.pro index 0698f89..9098936 100644 --- a/examples/ipc/ipc.pro +++ b/examples/ipc/ipc.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs -SUBDIRS = sharedmemory +# no QSharedMemory +!vxworks:!qnx:SUBDIRS = sharedmemory !wince*: SUBDIRS += localfortuneserver localfortuneclient # install diff --git a/examples/itemviews/chart/chart.pro b/examples/itemviews/chart/chart.pro index d202451..7a9d197 100644 --- a/examples/itemviews/chart/chart.pro +++ b/examples/itemviews/chart/chart.pro @@ -4,7 +4,7 @@ RESOURCES = chart.qrc SOURCES = main.cpp \ mainwindow.cpp \ pieview.cpp -unix:!mac:LIBS+= -lm +unix:!mac:!vxworks:LIBS+= -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/itemviews/chart diff --git a/examples/network/network.pro b/examples/network/network.pro index 8c45745..adf998f 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -2,7 +2,6 @@ TEMPLATE = subdirs SUBDIRS = blockingfortuneclient \ broadcastreceiver \ broadcastsender \ - network-chat \ download \ downloadmanager \ fortuneclient \ @@ -14,6 +13,9 @@ SUBDIRS = blockingfortuneclient \ googlesuggest \ torrent +# no QProcess +!vxworks:!qnx:SUBDIRS += network-chat + contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient # install diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro index 76c9e82..98b9bd1 100644 --- a/examples/painting/painterpaths/painterpaths.pro +++ b/examples/painting/painterpaths/painterpaths.pro @@ -3,7 +3,7 @@ HEADERS = renderarea.h \ SOURCES = main.cpp \ renderarea.cpp \ window.cpp -unix:!mac:LIBS += -lm +unix:!mac:!vxworks:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/painting/painterpaths diff --git a/examples/qws/qws.pro b/examples/qws/qws.pro index fb3c3c7..95e1b44 100644 --- a/examples/qws/qws.pro +++ b/examples/qws/qws.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs -SUBDIRS = framebuffer mousecalibration simpledecoration +# no /dev/fbX +!qnx:!vxworks:SUBDIRS = framebuffer +SUBDIRS += mousecalibration simpledecoration # install sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS README *.pro diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp index 81a0b8a..2044a16 100644 --- a/examples/script/customclass/bytearrayclass.cpp +++ b/examples/script/customclass/bytearrayclass.cpp @@ -100,7 +100,7 @@ ByteArrayClass::ByteArrayClass(QScriptEngine *engine) QScriptValue global = engine->globalObject(); proto.setPrototype(global.property("Object").property("prototype")); - ctor = engine->newFunction(construct); + ctor = engine->newFunction(construct, proto); ctor.setData(qScriptValueFromValue(engine, this)); } //! [0] @@ -224,7 +224,10 @@ QScriptValue ByteArrayClass::construct(QScriptContext *ctx, QScriptEngine *) ByteArrayClass *cls = qscriptvalue_cast<ByteArrayClass*>(ctx->callee().data()); if (!cls) return QScriptValue(); - int size = ctx->argument(0).toInt32(); + QScriptValue arg = ctx->argument(0); + if (arg.instanceOf(ctx->callee())) + return cls->newInstance(qscriptvalue_cast<QByteArray>(arg)); + int size = arg.toInt32(); return cls->newInstance(size); } //! [2] @@ -240,7 +243,7 @@ QScriptValue ByteArrayClass::toScriptValue(QScriptEngine *eng, const QByteArray void ByteArrayClass::fromScriptValue(const QScriptValue &obj, QByteArray &ba) { - ba = qscriptvalue_cast<QByteArray>(obj.data()); + ba = qvariant_cast<QByteArray>(obj.data().toVariant()); } diff --git a/examples/script/customclass/main.cpp b/examples/script/customclass/main.cpp index 05aefd5..3b98f5c 100644 --- a/examples/script/customclass/main.cpp +++ b/examples/script/customclass/main.cpp @@ -52,6 +52,7 @@ int main(int argc, char **argv) eng.globalObject().setProperty("ByteArray", baClass->constructor()); qDebug() << "ba = new ByteArray(4):" << eng.evaluate("ba = new ByteArray(4)").toString(); + qDebug() << "ba instanceof ByteArray:" << eng.evaluate("ba instanceof ByteArray").toBool(); qDebug() << "ba.length:" << eng.evaluate("ba.length").toNumber(); qDebug() << "ba[1] = 123; ba[1]:" << eng.evaluate("ba[1] = 123; ba[1]").toNumber(); qDebug() << "ba[7] = 224; ba.length:" << eng.evaluate("ba[7] = 224; ba.length").toNumber(); @@ -65,6 +66,9 @@ int main(int argc, char **argv) qDebug() << "ba.toBase64().toLatin1String():" << eng.evaluate("b64.toLatin1String()").toString(); qDebug() << "ba.valueOf():" << eng.evaluate("ba.valueOf()").toString(); qDebug() << "ba.chop(2); ba.length:" << eng.evaluate("ba.chop(2); ba.length").toNumber(); + qDebug() << "ba2 = new ByteArray(ba):" << eng.evaluate("ba2 = new ByteArray(ba)").toString(); + qDebug() << "ba2.equals(ba):" << eng.evaluate("ba2.equals(ba)").toBool(); + qDebug() << "ba2.equals(new ByteArray()):" << eng.evaluate("ba2.equals(new ByteArray())").toBool(); return 0; } diff --git a/examples/threads/mandelbrot/mandelbrot.pro b/examples/threads/mandelbrot/mandelbrot.pro index 437f449..7870ca8 100644 --- a/examples/threads/mandelbrot/mandelbrot.pro +++ b/examples/threads/mandelbrot/mandelbrot.pro @@ -4,7 +4,7 @@ SOURCES = main.cpp \ mandelbrotwidget.cpp \ renderthread.cpp -unix:!mac:LIBS += -lm +unix:!mac:!vxworks:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot |