summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-10-28 22:52:03 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-10-28 22:52:03 (GMT)
commit6849c2f7f7ed0d024b8d8fd506fe59405c636082 (patch)
tree12bae696891b7f443a10af3e178635434923afb7
parent2a3ebb69d4a91ae233dd015debf9f323a86b79d3 (diff)
parent88632908b8923e626f36b6132ac179553d39c333 (diff)
downloadQt-6849c2f7f7ed0d024b8d8fd506fe59405c636082.zip
Qt-6849c2f7f7ed0d024b8d8fd506fe59405c636082.tar.gz
Qt-6849c2f7f7ed0d024b8d8fd506fe59405c636082.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--demos/declarative/contacts/Button.qml60
-rw-r--r--demos/declarative/contacts/Contact.qml116
-rw-r--r--demos/declarative/contacts/ContactField.qml60
-rw-r--r--demos/declarative/contacts/FieldText.qml154
-rw-r--r--demos/declarative/contacts/RemoveButton.qml122
-rw-r--r--demos/declarative/contacts/SearchBar.qml26
-rw-r--r--demos/declarative/contacts/contacts.qml319
-rw-r--r--demos/declarative/contacts/contacts.sqlitebin86016 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/cancel.pngbin1038 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/email.pngbin977 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/new.pngbin688 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/ok.pngbin655 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/phone.pngbin624 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/search.pngbin635 -> 0 bytes
-rw-r--r--demos/declarative/contacts/pics/trash.pngbin989 -> 0 bytes
-rw-r--r--demos/declarative/flickr/common/ImageDetails.qml4
-rw-r--r--demos/declarative/flickr/flickr-desktop.qml2
-rw-r--r--demos/declarative/flickr/flickr-mobile.qml2
-rw-r--r--demos/declarative/flickr/mobile/Button.qml2
-rw-r--r--demos/declarative/flickr/mobile/ImageDetails.qml14
-rw-r--r--demos/declarative/flickr/mobile/ListDelegate.qml6
-rw-r--r--demos/declarative/flickr/mobile/TitleBar.qml4
-rw-r--r--demos/declarative/minehunt/minehunt.qml2
-rw-r--r--demos/declarative/samegame/samegame.qml2
-rw-r--r--demos/declarative/twitter/content/AuthView.qml4
-rw-r--r--demos/declarative/twitter/content/FatDelegate.qml2
-rw-r--r--demos/declarative/twitter/content/HomeTitleBar.qml6
-rw-r--r--demos/declarative/twitter/twitter.qml4
-rw-r--r--demos/declarative/webbrowser/fieldtext/FieldText.qml2
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml6
-rw-r--r--doc/src/declarative/elements.qdoc3
-rw-r--r--doc/src/declarative/extending.qdoc2
-rw-r--r--doc/src/declarative/qmlmodels.qdoc2
-rw-r--r--doc/src/declarative/qmlreference.qdoc9
-rw-r--r--doc/src/declarative/qmlstates.qdoc1
-rw-r--r--doc/src/declarative/qtbinding.qdoc1
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc6
-rw-r--r--doc/src/declarative/qtprogrammers.qdoc2
-rw-r--r--doc/src/tutorials/declarative.qdoc674
-rw-r--r--examples/declarative/dynamic/PerspectiveItem.qml12
-rw-r--r--examples/declarative/dynamic/dynamic.qml6
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml36
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2/RemoveButton.qml20
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2a/RemoveButton.qml22
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml41
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml107
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml114
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml114
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml59
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml32
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml112
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml35
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml112
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1b/BlueRect.qml35
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml114
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml34
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml120
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml39
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml50
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml61
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml144
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml116
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml53
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml58
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml145
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml120
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml59
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml46
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml124
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml137
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml31
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml59
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml60
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml47
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml58
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml145
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml119
-rwxr-xr-xexamples/declarative/tutorials/contacts/shared/contactGenSQL.pl82
-rw-r--r--examples/declarative/tutorials/contacts/shared/contacts.sqlitebin86016 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/email.txt7
-rw-r--r--examples/declarative/tutorials/contacts/shared/english-f.txt143
-rw-r--r--examples/declarative/tutorials/contacts/shared/english-m.txt130
-rw-r--r--examples/declarative/tutorials/contacts/shared/english-s.txt1003
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/cancel.pngbin1038 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/email.pngbin977 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/new.pngbin688 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/ok.pngbin655 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/phone.pngbin624 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/search.pngbin635 -> 0 bytes
-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/trash.pngbin989 -> 0 bytes
-rw-r--r--src/declarative/debugger/qmldebug.cpp17
-rw-r--r--src/declarative/extra/extra.pri8
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp429
-rw-r--r--src/declarative/extra/qmlsqlconnection.h116
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp788
-rw-r--r--src/declarative/extra/qmlsqlquery.h143
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp5
-rw-r--r--src/declarative/fx/qfximage.cpp8
-rw-r--r--src/declarative/fx/qfxitem.cpp232
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp4
-rw-r--r--src/declarative/fx/qfxtext.cpp6
-rw-r--r--src/declarative/qml/parser/qmljs.g2
-rw-r--r--src/declarative/qml/parser/qmljsgrammar.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsgrammar_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsparser.cpp2
-rw-r--r--src/declarative/qml/qml.pri2
-rw-r--r--src/declarative/qml/qmlcompiler.cpp4
-rw-r--r--src/declarative/qml/qmlcomponent.cpp25
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp67
-rw-r--r--src/declarative/qml/qmlenginedebug_p.h4
-rw-r--r--src/declarative/qml/qmlwatcher.cpp2
-rw-r--r--src/declarative/qml/qmlwatcher_p.h3
-rw-r--r--src/declarative/util/qmllistmodel.cpp6
-rw-r--r--src/declarative/util/qmlstate.cpp2
-rw-r--r--src/declarative/util/qmltransition.cpp2
-rw-r--r--src/declarative/util/qmlview.cpp2
-rw-r--r--tests/auto/declarative/anchors/anchors.pro1
-rw-r--r--tests/auto/declarative/animatedimage/animatedimage.pro1
-rw-r--r--tests/auto/declarative/animations/animations.pro1
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp25
-rw-r--r--tests/auto/declarative/behaviors/behaviors.pro1
-rw-r--r--tests/auto/declarative/datetimeformatter/datetimeformatter.pro2
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/examples/examples.pro3
-rw-r--r--tests/auto/declarative/layouts/layouts.pro1
-rw-r--r--tests/auto/declarative/listview/listview.pro2
-rw-r--r--tests/auto/declarative/numberformatter/numberformatter.pro2
-rw-r--r--tests/auto/declarative/pathview/pathview.pro2
-rw-r--r--tests/auto/declarative/qfxloader/qfxloader.pro2
-rw-r--r--tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro4
-rw-r--r--tests/auto/declarative/qfxtext/qfxtext.pro2
-rw-r--r--tests/auto/declarative/qfxtextedit/qfxtextedit.pro2
-rw-r--r--tests/auto/declarative/qfxtextinput/data/cursorTest.qml8
-rw-r--r--tests/auto/declarative/qfxtextinput/qfxtextinput.pro2
-rw-r--r--tests/auto/declarative/qfxwebview/qfxwebview.pro2
-rw-r--r--tests/auto/declarative/qmldom/qmldom.pro2
-rw-r--r--tests/auto/declarative/qmlecmascript/qmlecmascript.pro1
-rw-r--r--tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/qmllanguage.pro3
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp46
-rw-r--r--tests/auto/declarative/qmllist/qmllist.pro2
-rw-r--r--tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro2
-rw-r--r--tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro2
-rw-r--r--tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro2
-rw-r--r--tests/auto/declarative/qmltimer/qmltimer.pro2
-rw-r--r--tests/auto/declarative/repeater/repeater.pro3
-rw-r--r--tests/auto/declarative/sql/data/4-iteration-index.js27
-rw-r--r--tests/auto/declarative/sql/sql.pro2
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp2
-rw-r--r--tests/auto/declarative/states/states.pro2
-rw-r--r--tests/auto/declarative/visual/visual.pro3
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspectormode.cpp9
-rw-r--r--tools/qmldebugger/standalone/engine.cpp2
-rw-r--r--tools/qmldebugger/standalone/expressionquerywidget.cpp43
-rw-r--r--tools/qmldebugger/standalone/expressionquerywidget.h10
-rw-r--r--tools/qmldebugger/standalone/objectpropertiesview.cpp76
-rw-r--r--tools/qmldebugger/standalone/objectpropertiesview.h2
-rw-r--r--tools/qmldebugger/standalone/objecttree.cpp1
-rw-r--r--tools/qmldebugger/standalone/objecttree.h4
-rw-r--r--tools/qmldebugger/standalone/watchtable.cpp3
160 files changed, 541 insertions, 7439 deletions
diff --git a/demos/declarative/contacts/Button.qml b/demos/declarative/contacts/Button.qml
deleted file mode 100644
index 9719231..0000000
--- a/demos/declarative/contacts/Button.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-import Qt 4.6
-
-Item {
- id: button
- width: 30
- height: 30
- property var icon: ""
- signal clicked
- Rectangle {
- id: buttonRect
- anchors.fill: parent
- color: "lightgreen"
- radius: 5
- Image {
- id: iconImage
- source: button.icon
- anchors.horizontalCenter: buttonRect.horizontalCenter
- anchors.verticalCenter: buttonRect.verticalCenter
- }
- MouseRegion {
- id: buttonMouseRegion
- anchors.fill: buttonRect
- onClicked: { button.clicked() }
- }
- states: [
- State {
- name: "pressed"
- when: buttonMouseRegion.pressed == true
- PropertyChanges {
- target: buttonRect
- color: "green"
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "pressed"
- ColorAnimation {
- property: "color"
- duration: 200
- }
- },
- Transition {
- from: "pressed"
- to: "*"
- ColorAnimation {
- property: "color"
- duration: 1000
- }
- }
- ]
- }
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
-}
diff --git a/demos/declarative/contacts/Contact.qml b/demos/declarative/contacts/Contact.qml
deleted file mode 100644
index e12cd3b..0000000
--- a/demos/declarative/contacts/Contact.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactDetails
- anchors.fill: parent
-
- property var contactId: ""
- property var label: ""
- property var phone: ""
- property var email: ""
-
- onLabelChanged: { labelField.value = label }
- onEmailChanged: { emailField.value = email }
- onPhoneChanged: { phoneField.value = phone }
-
- resources: [
- SqlQuery {
- id: updateContactQuery
- connection: contactDatabase
- query: "UPDATE contacts SET label = :l, email = :e, phone = :p WHERE recid = :r"
- bindings: [
- SqlBind {
- name: ":r"
- value: contactId
- },
- SqlBind {
- name: ":l"
- value: labelField.value
- },
- SqlBind {
- name: ":e"
- value: emailField.value
- },
- SqlBind {
- name: ":p"
- value: phoneField.value
- }
- ]
- },
- SqlQuery {
- id: insertContactQuery
- connection: contactDatabase
- query: "INSERT INTO contacts (label, email, phone) VALUES(:l, :e, :p)"
- bindings: [
- SqlBind {
- name: ":l"
- value: labelField.value
- },
- SqlBind {
- name: ":e"
- value: emailField.value
- },
- SqlBind {
- name: ":p"
- value: phoneField.value
- }
- ]
- },
- SqlQuery {
- id: removeContactQuery
- connection: contactDatabase
- query: "DELETE FROM contacts WHERE recid = :r"
- bindings: SqlBind {
- name: ":r"
- value: contactId
- }
- }
- ]
- function refresh() {
- labelField.value = label;
- emailField.value = email;
- phoneField.value = phone;
- }
- function update() {
- updateContactQuery.exec();
- }
- function insert() {
- insertContactQuery.exec();
- }
- function remove() {
- removeContactQuery.exec();
- }
- Column {
- id: layout
- width: childrenRect.width
- height: childrenRect.height
- anchors.centerIn: parent
- spacing: 5
- ContactField {
- id: labelField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- label: "Name"
- }
- ContactField {
- id: phoneField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "pics/phone.png"
- label: "Phone"
- }
- ContactField {
- id: emailField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "pics/email.png"
- label: "Email"
- }
- }
-}
diff --git a/demos/declarative/contacts/ContactField.qml b/demos/declarative/contacts/ContactField.qml
deleted file mode 100644
index 6cf7baa..0000000
--- a/demos/declarative/contacts/ContactField.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactField
- clip: true
- height: 30
- property var label: "Name"
- property var icon: ""
- property var value: ""
- onValueChanged: { fieldText.text = contactField.value }
- RemoveButton {
- id: removeButton
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- expandedWidth: contactField.width
- onConfirmed: { print('Clear field text'); fieldText.text='' }
- }
- FieldText {
- id: fieldText
- width: contactField.width-70
- anchors.right: removeButton.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- label: contactField.label
- text: contactField.value
- onConfirmed: { contactField.value=fieldText.text }
- }
- Image {
- anchors.right: fieldText.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- source: contactField.icon
- }
- states: [
- State {
- name: "editingText"
- when: fieldText.state == 'editing'
- PropertyChanges {
- target: removeButton.anchors
- rightMargin: -35
- }
- PropertyChanges {
- target: fieldText
- width: contactField.width
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "width,rightMargin"
- duration: 200
- }
- }
- ]
-}
diff --git a/demos/declarative/contacts/FieldText.qml b/demos/declarative/contacts/FieldText.qml
deleted file mode 100644
index 2e8b60d..0000000
--- a/demos/declarative/contacts/FieldText.qml
+++ /dev/null
@@ -1,154 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: fieldText
- height: 30
- radius: 5
- color: "black"
- property var text: ""
- property var label: ""
- onTextChanged: { reset() }
- signal confirmed
-
- Script {
-
- function edit() {
- if (!contacts.mouseGrabbed) {
- fieldText.state='editing';
- contacts.mouseGrabbed=true;
- }
- }
- function confirm() {
- fieldText.text = textEdit.text;
- fieldText.state='';
- contacts.mouseGrabbed=false;
- fieldText.confirmed();
- }
- function reset() {
- textEdit.text = fieldText.text;
- fieldText.state='';
- contacts.mouseGrabbed=false;
- }
-
- }
-
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/cancel.png"
- opacity: 0
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/ok.png"
- opacity: 0
- }
- TextEdit {
- id: textEdit
- anchors.left: parent.left
- anchors.leftMargin: 0
- anchors.right: parent.right
- anchors.rightMargin: 0
- anchors.verticalCenter: parent.verticalCenter
- color: "white"
- font.bold: true
- readOnly: true
- wrap: false
- }
- Text {
- id: textLabel
- x: 5
- width: parent.width-10
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: "AlignHCenter"
- color: contactDetails.state == "editing" ? "#505050" : "#AAAAAA"
- font.italic: true
- font.bold: true
- text: fieldText.label
- opacity: textEdit.text == '' ? 1 : 0
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
- MouseRegion {
- anchors.fill: cancelIcon
- onClicked: { reset() }
- }
- MouseRegion {
- anchors.fill: confirmIcon
- onClicked: { confirm() }
- }
- MouseRegion {
- id: editRegion
- anchors.fill: textEdit
- onClicked: { edit() }
- }
- states: [
- State {
- name: "editing"
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: fieldText
- color: "white"
- }
- PropertyChanges {
- target: textEdit
- color: "black"
- }
- PropertyChanges {
- target: textEdit
- readOnly: false
- }
- PropertyChanges {
- target: textEdit
- focus: true
- }
- PropertyChanges {
- target: editRegion
- opacity: 0
- }
- PropertyChanges {
- target: textEdit.anchors
- leftMargin: 34
- }
- PropertyChanges {
- target: textEdit.anchors
- rightMargin: 34
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "opacity,leftMargin,rightMargin"
- duration: 200
- }
- ColorAnimation {
- property: "color"
- duration: 150
- }
- }
- ]
-}
diff --git a/demos/declarative/contacts/RemoveButton.qml b/demos/declarative/contacts/RemoveButton.qml
deleted file mode 100644
index 2c3cc9e..0000000
--- a/demos/declarative/contacts/RemoveButton.qml
+++ /dev/null
@@ -1,122 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- property var expandedWidth: 230
- signal confirmed
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- contacts.mouseGrabbed=false;
- } else {
- if (!contacts.mouseGrabbed) {
- removeButton.state = 'opened';
- contacts.mouseGrabbed=true;
- }
- }
- }
- }
-
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle(); removeButton.confirmed() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: removeButton.expandedWidth
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/demos/declarative/contacts/SearchBar.qml b/demos/declarative/contacts/SearchBar.qml
deleted file mode 100644
index b326fd3..0000000
--- a/demos/declarative/contacts/SearchBar.qml
+++ /dev/null
@@ -1,26 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: searchBar
- color: "white"
- property var text: searchEdit.text
- Image {
- id: searchIcon
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/search.png"
- }
- TextEdit {
- id: searchEdit
- anchors.left: searchIcon.right
- anchors.right: parent.right
- anchors.leftMargin: 5
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- readOnly: false
- wrap: false
- focus: true
- text: ""
- }
-}
diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml
deleted file mode 100644
index 2b0d983..0000000
--- a/demos/declarative/contacts/contacts.qml
+++ /dev/null
@@ -1,319 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: contacts
- width: 240
- height: 320
- color: "black"
- property var mode: "list"
- property var mouseGrabbed: false
- resources: [
- SqlConnection {
- id: contactDatabase
- name: "qmlConnection"
- driver: "QSQLITE"
- databaseName: "contacts.sqlite"
- },
- SqlQuery {
- id: contactList
- connection: contactDatabase
- query: "SELECT recid, label, email, phone FROM contacts WHERE lower(label) LIKE lower(:searchTerm) ORDER BY label, recid"
- bindings: SqlBind {
- name: ":searchTerm"
- value: '%' + searchBar.text + '%'
- }
- },
- Component {
- id: contactDelegate
- Item {
- id: wrapper
- x: 0
- width: ListView.view.width
- height: 34
- Text {
- id: label
- x: 40
- y: 12
- width: parent.width-30
- text: model.label
- color: "white"
- font.bold: true
- children: [
- MouseRegion {
- anchors.fill: parent
- onClicked: {
- Details.source = 'Contact.qml';
- wrapper.state ='opened';
- contacts.mode = 'edit';
- }
- }
- ]
- states: [
- State {
- name: "currentItem"
- when: wrapper.ListView.isCurrentItem
- PropertyChanges {
- target: label
- color: "black"
- }
- }
- ]
- transitions: [
- Transition {
- ColorAnimation {
- duration: 250
- property: "color"
- }
- }
- ]
- }
- Loader {
- id: Details
- anchors.fill: wrapper
- opacity: 0
- Binding {
- target: Details.item
- property: "contactId"
- value: model.recid
- }
- Binding {
- target: Details.item
- property: "label"
- value: model.label
- }
- Binding {
- target: Details.item
- property: "phone"
- value: model.phone
- }
- Binding {
- target: Details.item
- property: "email"
- value: model.email
- }
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: wrapper
- height: contactListView.height
- }
- PropertyChanges {
- target: contactListView
- viewportY: wrapper.y
- }
- PropertyChanges {
- target: contactListView
- interactive: 0
- }
- PropertyChanges {
- target: label
- opacity: 0
- }
- PropertyChanges {
- target: Details
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- duration: 500
- properties: "viewportY,height,opacity"
- }
- }
- ]
- Connection {
- sender: confirmEditButton
- signal: "clicked()"
- script: {
- if (wrapper.state == 'opened' && !contacts.mouseGrabbed) {
- Details.item.update();
- wrapper.state = '';
- contacts.mode = 'list';
- contactList.exec();
- }
-
- }
- }
- Connection {
- sender: cancelEditButton
- signal: "clicked()"
- script: {
- if (wrapper.state == 'opened' && !contacts.mouseGrabbed) {
- wrapper.state = '';
- contacts.mode = 'list';
- }
-
- }
- }
- Connection {
- sender: removeContactButton
- signal: "confirmed()"
- script: {
- if (wrapper.state == 'opened' && !contacts.mouseGrabbed) {
- Details.item.remove();
- wrapper.state = '';
- contacts.mode = 'list';
- contactList.exec();
- }
-
- }
- }
- }
- }
- ]
- Button {
- id: newContactButton
- anchors.top: parent.top
- anchors.topMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- icon: "pics/new.png"
- onClicked: { newContactItem.refresh(); contacts.mode = 'new' }
- opacity: contacts.mode == 'list' ? 1 : 0
- }
- Button {
- id: confirmEditButton
- anchors.top: parent.top
- anchors.topMargin: 5
- anchors.left: parent.left
- anchors.leftMargin: 5
- icon: "pics/ok.png"
- opacity: contacts.mode == 'list' || contacts.mouseGrabbed ? 0 : 1
- }
- Button {
- id: cancelEditButton
- anchors.top: parent.top
- anchors.topMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- icon: "pics/cancel.png"
- opacity: contacts.mode == 'list' || contacts.mouseGrabbed ? 0 : 1
- }
- RemoveButton {
- id: removeContactButton
- anchors.top: parent.top
- anchors.topMargin: 5
- anchors.horizontalCenter: parent.horizontalCenter
- opacity: (contacts.mode == 'edit' && (!contacts.mouseGrabbed || removeContactButton.state =='opened')) ? 1 : 0
- }
- ListView {
- id: contactListView
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: cancelEditButton.bottom
- anchors.bottom: searchBarWrapper.top
- anchors.topMargin: 5
- clip: true
- model: contactList
- delegate: contactDelegate
- highlight: [
- Rectangle {
- id: contactHighlight
- border.width: 0
- color: 'white'
- opacity: contacts.mode == 'list' ? 1 : 0
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
- ]
- highlightFollowsCurrentItem: true
- focus: false
- }
- FocusScope {
- id: newContactWrapper
- anchors.fill: contactListView
- opacity: 0
- focus: contacts.mode == 'new'
- Contact {
- id: newContactItem
- anchors.fill: parent
- }
- }
- Connection {
- sender: confirmEditButton
- signal: "clicked()"
- script: {
- if (contacts.mode == 'new' && contacts.mouseGrabbed != 'true') {
- newContactItem.insert();
- contacts.mode = 'list';
- contactList.exec();
- }
- }
- }
- Connection {
- sender: cancelEditButton
- signal: "clicked()"
- script: {
- if (contacts.mode == 'new' && contacts.mouseGrabbed != 'true') {
- contacts.mode = 'list';
- }
- }
- }
- FocusScope {
- id: searchBarWrapper
- height: 30
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottomMargin: 0
- focus: false
- SearchBar {
- id: searchBar
- anchors.fill: parent
- }
- states: [
- State {
- name: "searchHidden"
- when: searchBar.text == '' || contacts.mode != 'list'
- PropertyChanges {
- target: searchBarWrapper.anchors
- bottomMargin: -30
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "*"
- NumberAnimation {
- property: "bottomMargin"
- duration: 250
- }
- }
- ]
- }
- focus: contacts.mode != 'new'
- Keys.forwardTo: { contacts.mode == "list" ? [searchBarWrapper, contactListView] : [contactListView]}
- states: [
- State {
- name: "editNewState"
- when: contacts.mode == 'new'
- PropertyChanges {
- target: contactListView
- opacity: 0
- }
- PropertyChanges {
- target: newContactWrapper
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "*"
- NumberAnimation {
- property: "opacity"
- duration: 500
- }
- }
- ]
-}
diff --git a/demos/declarative/contacts/contacts.sqlite b/demos/declarative/contacts/contacts.sqlite
deleted file mode 100644
index d33e0c7..0000000
--- a/demos/declarative/contacts/contacts.sqlite
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/cancel.png b/demos/declarative/contacts/pics/cancel.png
deleted file mode 100644
index ecc9533..0000000
--- a/demos/declarative/contacts/pics/cancel.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/email.png b/demos/declarative/contacts/pics/email.png
deleted file mode 100644
index 04b3865..0000000
--- a/demos/declarative/contacts/pics/email.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/new.png b/demos/declarative/contacts/pics/new.png
deleted file mode 100644
index c7ebac3..0000000
--- a/demos/declarative/contacts/pics/new.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/ok.png b/demos/declarative/contacts/pics/ok.png
deleted file mode 100644
index 5795f04..0000000
--- a/demos/declarative/contacts/pics/ok.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/phone.png b/demos/declarative/contacts/pics/phone.png
deleted file mode 100644
index fc9c222..0000000
--- a/demos/declarative/contacts/pics/phone.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/search.png b/demos/declarative/contacts/pics/search.png
deleted file mode 100644
index cc74e69..0000000
--- a/demos/declarative/contacts/pics/search.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/contacts/pics/trash.png b/demos/declarative/contacts/pics/trash.png
deleted file mode 100644
index 2042595..0000000
--- a/demos/declarative/contacts/pics/trash.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml
index cc00773..19cad06 100644
--- a/demos/declarative/flickr/common/ImageDetails.qml
+++ b/demos/declarative/flickr/common/ImageDetails.qml
@@ -44,7 +44,7 @@ Flipable {
onClicked: { container.state='Back' }
}
- Text { id: titleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight"
+ Text { id: titleText; style: Text.Raised; styleColor: "black"; color: "white"; elide: Text.ElideRight
x: 220; y: 30; width: parent.width - 240; text: container.photoTitle; font.pointSize: 22 }
LikeOMeter { x: 40; y: 250; rating: container.rating }
@@ -69,7 +69,7 @@ Flipable {
text: container.photoTags == "" ? "" : "<b>Tags:</b> " }
Text { id: tags; color: "white"; width: parent.width-x-20;
anchors.left: tagsLabel.right; anchors.top: date.bottom;
- elide: "ElideRight"; text: container.photoTags }
+ elide: Text.ElideRight; text: container.photoTags }
ScrollBar { id: scrollBar; x: 720; y: flickable.y; width: 7; height: flickable.height; opacity: 0;
flickableArea: flickable; clip: true }
diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml
index d1ad6e1..337f77c 100644
--- a/demos/declarative/flickr/flickr-desktop.qml
+++ b/demos/declarative/flickr/flickr-desktop.qml
@@ -187,6 +187,6 @@ Item {
id: categoryText; anchors.horizontalCenter: parent.horizontalCenter; y: 15;
text: "Flickr - " +
(rssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + rssModel.tags)
- font.pointSize: 20; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
+ font.pointSize: 20; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
}
}
diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml
index 48fe7df..0a89c4f 100644
--- a/demos/declarative/flickr/flickr-mobile.qml
+++ b/demos/declarative/flickr/flickr-mobile.qml
@@ -10,7 +10,7 @@ Item {
id: background
anchors.fill: parent; color: "#343434";
- Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 }
+ Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
Common.RssModel { id: rssModel }
Common.Loading { anchors.centerIn: parent; visible: rssModel.status == 2 }
diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml
index a4a96d4..770330c 100644
--- a/demos/declarative/flickr/mobile/Button.qml
+++ b/demos/declarative/flickr/mobile/Button.qml
@@ -26,7 +26,7 @@ Item {
Text {
color: "white"
anchors.centerIn: buttonImage; font.bold: true
- text: container.text; style: "Raised"; styleColor: "black"
+ text: container.text; style: Text.Raised; styleColor: "black"
}
states: [
State {
diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml
index 26052b9..1963bf5 100644
--- a/demos/declarative/flickr/mobile/ImageDetails.qml
+++ b/demos/declarative/flickr/mobile/ImageDetails.qml
@@ -39,13 +39,13 @@ Flipable {
right: parent.right; rightMargin: 20
top: parent.top; topMargin: 180
}
- Text { font.bold: true; color: "white"; elide: "ElideRight"; text: container.photoTitle }
- Text { color: "white"; elide: "ElideRight"; text: "<b>Size:</b> " + container.photoWidth + 'x' + container.photoHeight }
- Text { color: "white"; elide: "ElideRight"; text: "<b>Type:</b> " + container.photoType }
- Text { color: "white"; elide: "ElideRight"; text: "<b>Author:</b> " + container.photoAuthor }
- Text { color: "white"; elide: "ElideRight"; text: "<b>Published:</b> " + container.photoDate }
- Text { color: "white"; elide: "ElideRight"; text: container.photoTags == "" ? "" : "<b>Tags:</b> " }
- Text { color: "white"; elide: "ElideRight"; elide: "ElideRight"; text: container.photoTags }
+ Text { font.bold: true; color: "white"; elide: Text.ElideRight; text: container.photoTitle }
+ Text { color: "white"; elide: Text.ElideRight; text: "<b>Size:</b> " + container.photoWidth + 'x' + container.photoHeight }
+ Text { color: "white"; elide: Text.ElideRight; text: "<b>Type:</b> " + container.photoType }
+ Text { color: "white"; elide: Text.ElideRight; text: "<b>Author:</b> " + container.photoAuthor }
+ Text { color: "white"; elide: Text.ElideRight; text: "<b>Published:</b> " + container.photoDate }
+ Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "<b>Tags:</b> " }
+ Text { color: "white"; elide: Text.ElideRight; elide: Text.ElideRight; text: container.photoTags }
}
}
diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml
index 090e91a..75c4572 100644
--- a/demos/declarative/flickr/mobile/ListDelegate.qml
+++ b/demos/declarative/flickr/mobile/ListDelegate.qml
@@ -14,9 +14,9 @@ Component {
}
Column {
x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2
- Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: "ElideRight"; style: "Raised"; styleColor: "black" }
- Text { text: photoAuthor; color: "white"; width: parent.width; elide: "ElideLeft"; color: "#cccccc"; style: "Raised"; styleColor: "black" }
- Text { text: photoDate; color: "white"; width: parent.width; elide: "ElideRight"; color: "#cccccc"; style: "Raised"; styleColor: "black" }
+ Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
+ Text { text: photoAuthor; color: "white"; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: photoDate; color: "white"; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
}
}
}
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml
index 108faf7..07b9762 100644
--- a/demos/declarative/flickr/mobile/TitleBar.qml
+++ b/demos/declarative/flickr/mobile/TitleBar.qml
@@ -25,9 +25,9 @@ Item {
left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10
verticalCenter: parent.verticalCenter
}
- elide: "ElideLeft"
+ elide: Text.ElideLeft
text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags)
- font.bold: true; color: "White"; style: "Raised"; styleColor: "Black"
+ font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black"
}
Button {
diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml
index 67d2813..e71ce90 100644
--- a/demos/declarative/minehunt/minehunt.qml
+++ b/demos/declarative/minehunt/minehunt.qml
@@ -121,7 +121,7 @@ Item {
]
Image {
source: "pics/No-Ones-Laughing-3.jpg"
- fillMode: "Tile"
+ fillMode: Image.Tile
}
Description {
text: "Use the 'minehunt' executable to run this demo!"
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
index ea7c14c..38a781a 100644
--- a/demos/declarative/samegame/samegame.qml
+++ b/demos/declarative/samegame/samegame.qml
@@ -13,7 +13,7 @@ Rectangle {
Image {
id: background
anchors.fill: parent; source: "content/pics/background.png"
- fillMode: "PreserveAspectCrop"
+ fillMode: Image.PreserveAspectCrop
}
Item {
diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml
index 73ce308..320eef6 100644
--- a/demos/declarative/twitter/content/AuthView.qml
+++ b/demos/declarative/twitter/content/AuthView.qml
@@ -12,7 +12,7 @@ Item {
Text {
width: 100
text: "Screen name:"
- font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
+ font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Qt.AlignRight
}
@@ -42,7 +42,7 @@ Item {
Text {
width: 100
text: "Password:"
- font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
+ font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Qt.AlignRight
}
diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml
index 32a921e..194ffb3 100644
--- a/demos/declarative/twitter/content/FatDelegate.qml
+++ b/demos/declarative/twitter/content/FatDelegate.qml
@@ -38,7 +38,7 @@ Component {
+ '<a href="app://@'+userScreenName+'"><b>'+userScreenName + "</b></a> from " +source
+ "<br /><b>" + addTags(statusText) + "</b></html>";
textFormat: Qt.RichText
- color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true
+ color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true
anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6
onLinkActivated: handleLink(link)
}
diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml
index 3108a9b..b0995f3 100644
--- a/demos/declarative/twitter/content/HomeTitleBar.qml
+++ b/demos/declarative/twitter/content/HomeTitleBar.qml
@@ -52,9 +52,9 @@ Item {
anchors.left: parent.left; anchors.right: tagButton.left
anchors.leftMargin: 58; anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
- elide: "ElideLeft"
+ elide: Text.ElideLeft
text: "Timeline for " + rssModel.authName
- font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
+ font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
}
Button {
@@ -67,7 +67,7 @@ Item {
id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter;
anchors.top: tagButton.bottom; anchors.topMargin: 2
text: {140 - editor.text.length;} visible: titleBar.state == "Posting"
- font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
+ font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
}
Item {
id: txtEdit;
diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml
index e9752ff..fdeb839 100644
--- a/demos/declarative/twitter/twitter.qml
+++ b/demos/declarative/twitter/twitter.qml
@@ -29,14 +29,14 @@ Item {
id: background
anchors.fill: parent; color: "#343434";
- Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 }
+ Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
Twitter.RssModel { id: rssModel }
Common.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'}
Text {
width: 180
text: "Could not access twitter using this screen name and password pair.";
- color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true
+ color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true
visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent
}
diff --git a/demos/declarative/webbrowser/fieldtext/FieldText.qml b/demos/declarative/webbrowser/fieldtext/FieldText.qml
index 2adfbbf..b1c1938 100644
--- a/demos/declarative/webbrowser/fieldtext/FieldText.qml
+++ b/demos/declarative/webbrowser/fieldtext/FieldText.qml
@@ -79,7 +79,7 @@ Item {
x: 5
width: parent.width-10
anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: "AlignHCenter"
+ horizontalAlignment: Text.AlignHCenter
color: fieldText.state == "editing" ? "#505050" : "#AAAAAA"
font.italic: true
font.bold: true
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 53ac214..3b1ea57 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -65,11 +65,11 @@ Item {
id: headerText
text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...'
- elide: "ElideRight"
+ elide: Text.ElideRight
color: "white"
styleColor: "black"
- style: "Raised"
+ style: Text.Raised
font.family: "Helvetica"
font.pointSize: 10
@@ -81,7 +81,7 @@ Item {
anchors.rightMargin: 4
anchors.top: header.top
anchors.topMargin: 4
- horizontalAlignment: "AlignHCenter"
+ horizontalAlignment: Text.AlignHCenter
}
Item {
width: parent.width
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 4fa4ec5..0eda95e 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -85,10 +85,9 @@ The following table lists the QML elements provided by the Qt Declarative module
\o
\list
\o \l Binding
-\o \l ListModel
+\o \l ListModel, \l ListElement
\o \l VisualItemModel
\o \l XmlListModel and XmlRole
-\o \l SqlQuery, \l SqlConnection, and \l SqlBind
\o \l DateTimeFormatter
\o \l NumberFormatter
\endlist
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index b872632..7a4e51c 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -604,7 +604,7 @@ public:
\title Extending types from QML
Many of the elements available for use in QML are implemented in
-\l {QML for C++ Programmers}{C++}. These types are know as "core types". QML
+\l {Extending QML}{C++}. These types are know as "core types". QML
allows programmers to build new, fully functional elements without using C++.
Existing core types can be extended, and new types defined entirely in the QML
language.
diff --git a/doc/src/declarative/qmlmodels.qdoc b/doc/src/declarative/qmlmodels.qdoc
index 45df29b..a14345b 100644
--- a/doc/src/declarative/qmlmodels.qdoc
+++ b/doc/src/declarative/qmlmodels.qdoc
@@ -51,7 +51,7 @@ have items modified, inserted, removed or moved dynamically.
Data is provided to the delegate via named data roles which the
delegate may bind to. The roles are exposed as properties of the
-\model property, though this property is set as a default property
+\e model property, though this property is set as a default property
of the delegate so, unless there is a naming clash with a
property in the delegate, the roles are usually accessed unqualified.
diff --git a/doc/src/declarative/qmlreference.qdoc b/doc/src/declarative/qmlreference.qdoc
index 6a874b6..a56813c 100644
--- a/doc/src/declarative/qmlreference.qdoc
+++ b/doc/src/declarative/qmlreference.qdoc
@@ -60,9 +60,8 @@
\list
\o \l {Introduction to the QML language}
\o \l {tutorial}{Tutorial: 'Hello World'}
- \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'}
\o \l {advtutorial.html}{Advanced Tutorial: 'Same Game'}
- \o \l {qmlexamples}{Examples}
+ \o \l {QML Examples and Walkthroughs}
\endlist
\section1 Core QML Features:
@@ -82,7 +81,11 @@
QML Reference:
\list
- \o \l {QML Format Reference}
\o \l {elements}{QML Elements}
\endlist
+
+ \section1 Deprecated
+ \list
+ \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'}
+ \endlist
*/
diff --git a/doc/src/declarative/qmlstates.qdoc b/doc/src/declarative/qmlstates.qdoc
index 078b718..261e3f5 100644
--- a/doc/src/declarative/qmlstates.qdoc
+++ b/doc/src/declarative/qmlstates.qdoc
@@ -55,5 +55,6 @@ Other things you can do in a state change:
\o change an item's parent with ParentChange
\o change an item's anchors with AnchorChanges
\o run some script with StateChangeScript
+\endlist
*/
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index 18685ac..61520f7 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -211,7 +211,6 @@ Rectangle {
}
}
\endcode
-\endtable
To detect when a C++ property value - in this case the \c CustomPalette's \c text property -
changes, the property must have a corresponding NOTIFY signal. The NOTIFY signal specifies a signal
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index 5d8623b..c31156d 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -100,10 +100,4 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+
\o \l {QML Elements}
\o \l {Extending QML}
\endlist
-
-\section1 Deprecated
-\list
-\o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'}
-\endlist
-
*/
diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc
index ea27d7e..4c28255 100644
--- a/doc/src/declarative/qtprogrammers.qdoc
+++ b/doc/src/declarative/qtprogrammers.qdoc
@@ -109,7 +109,7 @@ just as QTextEdit, QWebView, and QListView are built upon
those same UI-agnostic components.
The encapsulation of the look and feel that QWidgets gives is important, and for this
-the QML concept of \l components serves the same purpose. If you are building a complete
+the QML concept of \l {qmldocuments.html}{components} serves the same purpose. If you are building a complete
suite of applications which should have a consistent look and feel, you should build
a set of reusable components with the look and feel you desire.
diff --git a/doc/src/tutorials/declarative.qdoc b/doc/src/tutorials/declarative.qdoc
deleted file mode 100644
index bbc3d15..0000000
--- a/doc/src/tutorials/declarative.qdoc
+++ /dev/null
@@ -1,674 +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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page tutorials-declarative-contacts.html
- \startpage {index.html}{Qt Reference Documentation}
- \nextpage {tutorials/declarative/contacts/part1}{Chapter 1}
-
- \title Declarative UI Tutorial
- \ingroup howto
- \ingroup tutorials
- \brief An introduction to using Qt Declarative UI to put together a
- simple animated application.
-
- \omit
- At the time of writing the tutorial Declarative UI was still under
- development. It is extremely likely that an update will be required
- prior to 4.6 release.
- \endomit
-
- This tutorial gives an introduction to using the Qt Declarative UI
- animation framework.
-
- In this process we will learn about some of the basics of using
- Declarative UI, such as
-
- \list
- \o Basic drawing
- \o States and Transitions
- \o Reuse of components
- \o Models and Views
- \endlist
-
- An existing knowledge of Qt is not required.
-
- The tutorial's source code is located in Qt's
- \c examples/declarative/tutorials/contacts directory.
- It is split up into a number of sub directories, and within each
- sub directory the files are numbered in an order of increasing features.
-
- The code in this example is not compiled, but interpreted at run time.
- This means you should use the qmlviewer application provided with
- Qt to run the examples.
-
- \list
- \o \l{tutorials/declarative/contacts/part1}{Drawing and Animation}
- \o \l{tutorials/declarative/contacts/part2}{Reusing QML Components}
- \o \l{tutorials/declarative/contacts/part3}{Models, Views and Delegates}
- \endlist
-*/
-
-/*!
- \page tutorials-declarative-contacts-part1.html
- \contentspage {Declarative UI Tutorial}{Contents}
- \nextpage {tutorials/declarative/contacts/part2}{Chapter 2}
- \example tutorials/declarative/contacts/part1
- \title Drawing and Animation
- \tableofcontents
-
- The first part of this tutorial covers basic drawing of elements on the
- screen and causing them to animate.
-
- \section1 Drawing
-
- In this first chapter we will build a button that indicates something
- can be removed and asks for confirmation. When clicked it will expand
- from a small button with a trash can icon, to a wide button with a
- confirm icon on the left, the text "Remove" in the middle, and a
- cancel icon on the right.
-
- \image declarative-removebutton.gif
-
- Because Declarative UI is declarative, you don't pass instructions on
- what to paint in a sequential manner as you may be used to. Instead
- elements and how they appear on the screen are declared in much the
- same was as elements on a web page are declared. This is done using
- the Qt Markup Language which we will refer to by the abbreviation QML
- for the remainder of the tutorial.
-
- We will start by drawing a simple red rectangle with rounded corners.
-
- \image declarative-roundrect.png
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/1/RemoveButton.qml 0
-
- This is one of the simplest of QML components. It describes a rectangle with
- some simple properties. In QML all components start with a capital
- letter, and their properties with lower case letters.
-
- Apart from the properties all QML components share, the \l{Rectangle}{Rectangle} component has the properties
-
- \list
- \o color - The background color of the rectangle
- \o tintColor - The overlay color of the rectangle
- \o gradientColor - The color at the base of the rectangle to blend upwards
- \o pen - The description of how to draw the border of the rectangle
- \o radius - The corner radius used to draw rounded rectangles.
- \endlist
-
- There are also a number of properties all QML components shares, described
- in the \l{Item}{Item} element reference documentation. The rectangle drawn in the
- above code uses the properties;
-
- \list
- \o id - An identifier of the component
- \o width - the width of the component when drawn
- \o height - the height of the component when drawn
- \endlist
-
- Currently we have described a rectangle with a width and height of 30 pixels, filled in with
- the color red and with rounded corners using a radius of 5.
-
- \section1 Layout
-
- The next step of the tutorial adds an image over the rectangle. We
- will do this by adding an \l{Image}{Image} component as a child of the
- \l{Rectangle}{Rectangle} component. All QML components have a list of children which
- are drawn in order after the parent component has been drawn.
- By having the \l{Image}{Image}
- component as a child of the \l{Rectangle}{Rectangle} component we ensure it is drawn
- over the \l{Rectangle}{Rectangle} component. Children also are affected by the opacity
- of the parent component and calculate their position in within the bounds of
- the parent component.
-
- \image declarative-removebutton-close.png
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/2/RemoveButton.qml 0
-
- The trashIcon image is added as a child of the Rectangle. In this case
- the children property isn't explicitly used because the default property
- of the \l{Rectangle}{Rectangle} component is its children. Some elements often don't have children
- and use some other default component. When this is the case its possible
- to explicitly list the sub component as a child as follows:
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/2a/RemoveButton.qml 0
-
- The \l{Image}{Image} element allows loading an image file for display. The source
- specified is a URL, and in this case refers to a portable network graphics
- file in a relative directory to where the QML file was loaded from.
-
- Also new in this code is the use of anchors. In QML components can either
- have their position and size specified explicitly using x, y, width
- and height, or they can instead specify the size and position in relation
- to either parent or sibling elements. The \l{Image}{Image} component uses
- a combination of both styles. It has a fixed size, but specifies its
- position to align to the right of its parent and for its vertical center
- to align with the vertical center of its parent. Setting a property
- by the identifier of a separate property binds them. This means
- that if while running the example the position of the \l{Rectangle}{Rectangle} component's
- vertical center changed, so to would the vertical center of
- the \l{Image}{Image} component.
-
- The parent value is a special identifier that always refers to the
- parent component of a component.
-
- Anchors are most useful when the size of items might change based on
- the component state or contents. However they are limited in that they
- must always refer to a parent or sibling component. See
- \l{anchor-layout}{Anchor-based Layout} for more information on using
- anchors in QML.
-
- At this point the initial state of the RemoveButton is complete. A small
- rounded rectangle with a trash icon. Next we will design the open
- state for the button.
-
- \image declarative-removebutton-open.png
-
- This is a wider rectangle with two images and some text. The code to
- draw this state of the button could be written as follows:
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml 0
-
- The rectangle width is now wider by 200 pixels. Also the trashIcon has
- been replaced. Normally we wouldn't
- remove the trashIcon when developing an alternate state of the RemoveButton,
- however since this is a tutorial its been done so that its easier to
- understand the alternate state we are aiming for and how it relates to
- transitioning between states.
-
- We also introduce the \l{Text}{Text} element.
- Left and Right anchors are specified in terms of the neighboring icons
- because we want text to fill the space between the icons. This
- means as the parent removeButton gets wider, so will the text component.
- It also means that if we animate a width change on the removeButton,
- any bindings, that is the values specified by an expression such as
- \c{parent.left} will be evaluated and animated as well.
-
- \section1 Defining States
-
- When designing a component with multiple states, it should be developed
- in the initial state and the changes that would be made specified
- as an additional state. Its not normally possible to add new children
- to an element when changing state
- This means that all possible child components should be included
- in the initial state, and those that should not be visible in the initial
- state should have their opacity set to zero. Thus
- for the RemoveButton we specify the starting size of the RemoveButton
- and hide any items that should not initially be visible.
-
- The code snippet below shows what the start of the duel state specification
- might look like.
-
- \code
- Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- src: "../../shared/pics/trash.png"
- opacity: 1
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- src: "../../shared/pics/cancel.png"
- opacity: 0
- }
- \endcode
-
- The code above includes components from both states of the RemoveButton,
- but by setting opacity="0" for the cancelIcon it means that the
- components of the second state won't be drawn yet.
- The base state of a component always has an empty name, however new
- states can be added that describe how a component and its children
- should be changed. For the RemoveButton there is only one non-base state
- required. In this tutorial we will name it the 'opened' state.
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml states
-
- In the opened state the width of the button itself changes from the base
- width of 30 to the new width of 230. Also the opacity of the children
- are changed so that the trash icon is now hidden and the other elements
- are now visible.
-
- \section1 Changing States
-
- To trigger the change we will react to the 'clicked' signal of a
- MouseRegion component.
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml mouse region
-
- MouseRegion components handle mouse actions within their geometry. This
- geometry behaves the same way as painted components, such that children
- cover their parents and later siblings will cover earlier siblings and
- all the children of the earlier sibling, should they overlap.
-
- When a component has a signal, such as clicked, the action for the signal
- can be specified using \c{onSignalName}, as is done above. In this
- case when the clicked signal is emitted by the MouseRegion component,
- a function called \c{toggle()} is called. It might also have been written
-
- \code
- onClicked: { removeButton.state='opened' }
- \endcode
-
- However in this case we are using a function because it allows multiple
- mouse regions to use the same functionality, and also makes it
- easier to specify complex behavior in response to a signal.
-
- An alternative would be to explicitly state the connection:
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml mouse region
-
- This will connect to the \c{clicked()} signal of the trashMouseRegion component
- and execute the associated script.
-
- The \c{toggle()} function is a new function specified as part of the remove
- button element.
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml script
-
- Any QML component can have a set of resources specified. One of those
- resources is any Script that might be needed. See the
- \l{QtScript Module} for more information on how to write
- script code in Qt.
-
- It is possible to refer to identified QML components
- within the script. Hence the function for our RemoveButton will check
- if the state is already open to determine what the new state should be.
-
- \section1 Animation
-
- Currently the RemoveButton is functional, but snaps between our two states.
- Fortunately making the transition between states smooth is very simple.
- We only need one more bit of code at the end of our removeButton component.
-
- \snippet declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml transition
-
- All QML components have a transitions property. This describes how
- properties of items within the component should change. In this case
- we specify that if the x, width or opacity of the removeButton or its
- children change due to a change in state, that they should take 200ms
- to complete their transition.
-
- \omit
- TODO More on types of animation, e.g. ColorAnimation, Behaviors.
- \endomit
-
- In the next chapter we will show how we can use the remove button in
- other QML components.
-*/
-
-/*!
- \page tutorials-declarative-contacts-part2.html
- \contentspage {Declarative UI Tutorial}{Contents}
- \previouspage {tutorials/declarative/contacts/part1}{Chapter 1}
- \nextpage {tutorials/declarative/contacts/part3}{Chapter 3}
- \example tutorials/declarative/contacts/part2
- \title Reusing QML Components
- \tableofcontents
-
- The second part of this tutorial covers how to reuse QML components and
- have them interact with each other. The RemoveButton developed in the
- previous chapter is intended to be part of a more complex control for
- editing a field of our contact. This ContactField in turn is intended
- to be used in a contact editing control.
-
- \image declarative-reuse-3.png
-
- \section1 Loading QML Components
-
- Reusing the RemoveButton itself is very simple. When parsing a QML file
- if a Component is referred to that isn't already in the system, Qt
- will try to load it from a file of the same name with the ".qml" extension.
-
- \snippet declarative/tutorials/contacts/2_Reuse/1/ContactField.qml load
-
- The above QML code will attempt to load the RemoveButton component from
- a file with the name "RemoveButton.qml" from the following search paths.
-
- \list
- \o Any imported directories. These are listed at the start of the file using
- \c { import "path" }.
- \o the directory of the QML code file
- \endlist
-
- All the properties of the button are
- accessible and can be overridden from defaults. The loaded component
- can also refer to elements further up in the tree, so that code within
- RemoveButton.qml could refer to the contactField component.
- Only properties of the top level element in RemoveButton.qml are visible to
- the contact field.
-
- There are also two other ways to reuse components in QML. A component
- can be reused from within the same QML file using Component and Loader
- elements. The next code snippet produces three red rounded rectangles
- within a large blue rectangle.
-
- \image declarative-reuse-bluerect.png
-
- \snippet declarative/tutorials/contacts/2_Reuse/1b/BlueRect.qml all
-
- This can be useful when the component is not complex enough to justify its
- own file. The third way to reuse components allows for delaying loading
- of the QML until some later event. \l{Loader}{Loader} includes
- a special child, item, which has its definition provided by the
- contents of the source property of the loader.
-
- \snippet declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml load
-
- This last method is useful if the contents of a item need to change at
- run time or if the initial complexity of the loaded QML needs to be
- reduced in order to improve the time it takes to start the application. In
- chapter three this method is used to improve performance of
- scrolling through very large numbers of items.
-
- Because of its simplicity, the first method is the recommended in most
- cases and will be the focus of the remainder of this chapter.
-
- \section1 Properties and Signals
-
- The next task is to be able to control aspects of the RemoveButton from
- the components that use it. In particular controlling how far it
- expands and how it reacts when the user clicks on the confirm icon
- of the remove button. When reusing a component in a separate QML file
- only the attributes of the root element are visible. To allow controlling
- attributes of child elements within an imported component we need to define
- some properties and signals for the RemoveButton.
-
- \snippet declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml define properties and signals
-
- The children of the remove button can use these properties and signals. The
- opened state can now bind the expanded width to the expandedWidth property.
-
- \snippet declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml use width
-
- Also when the confirm icon is clicked, as well as toggling the state it will
- emit the confirmed signal of the RemoveButton component.
-
- \snippet declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml use signal
-
- These properties and signals can also be accessed from the contact field the same
- way standard system component properties and signals are accessed.
-
- \snippet declarative/tutorials/contacts/2_Reuse/2/ContactField.qml use properties and signals
-
- Now when the remove button is expanded, it will expand to the width of the
- contact field. Also when the user confirms the remove action, the
- text section of the contact field will be cleared.
-
- \section1 States
-
- Its also possible to access the state of included components. The FieldText
- component we will use in this tutorial is also been written specifically
- for our contacts application. In
- this case we want it to expand when editing. One way to do this would
- be to anchor the field text component to the center of its parent and
- then let its own width change push the remove button away, however that
- would make it difficult to have the remove button also push the field
- text to the left when the remove button expands. Instead we will anchor
- the right edge of the field text to the left edge of the remove button
- and use a state change in the contact field itself to move the
- remove button and the field icon out of
- view.
-
- \snippet declarative/tutorials/contacts/2_Reuse/3/ContactField.qml all
-
- Apart from accessing the fieldText.state, the above code also uses the when
- attribute of its own editingText state. This is an alternative to using
- a signal to change state. When the value of the expression for the
- when attribute changes, Qt will detect if the contactField needs to enter
- that state. In the FieldText element a similar approach is used to fade
- out the label of the FieldText when the user enters some text of their own.
-
- \snippet declarative/tutorials/contacts/2_Reuse/3/FieldText.qml behavior
-
- \c{fieldText} is the enclosing component and \c{textEdit} is a TextEdit element
- provided by Qt. In the QML code above, the opacity of the textLabel is
- only 1 if the text for the textEdit is empty. This is a form of
- short cut to using states for an element, useful if only one property
- is changing as it is for the textLabel. To animate a property change is
- similar to animating a state change. Using the Behavior element we can
- specify how the property changes if it does change state, allowing for
- a smooth transition.
-
- \section1 Key and Mouse Focus
-
- Setting focus to true on a component does not always mean
- that the component has focus. This is due to the declarative nature
- of QML, and can be affected by multiple components both indicating
- focus to be true. At the time of writing this tutorial both key and mouse
- focus handling are still being improved. Hence we will only lightly cover
- the topic.
-
- For an item to have key focus in QML it is required that:
-
- \list
- \o If there is a FocusScope ancestor of the component that it has focus as well.
- \o That it is the most recent component within the focus realms descendent's
- to receive focus
- \endlist
-
- The read-only property focus can be used to determine whether a
- component will receive key input. Any un-handled keys will be passed to
- the components parent, which in turn will pass keys it doesn't handle up to its
- own ancestors.
-
- Some components such as ListView components are also FocusScope components, as they
- handle focus among the child list items.
-
- At this stage of the tutorial it is sufficient to use the setting of 'focus'
- as we only have a list of line edits and only one should be active at any given time.
-
- Currently if multiple contact fields were put into our contact editor,
- any of the FieldText components could be clicked and opened, and
- any of the RemoveButton components could be clicked and opened, all
- at the same time. This leads to situations where the users actions
- are ambiguous
-
- \image declarative-reuse-focus.png
-
- To counteract this we will add a property of the root element to indicate
- when an element has 'grabbed' mouse interaction, preventing other
- clickable elements from reacting.
-
- \snippet declarative/tutorials/contacts/2_Reuse/4/Contact.qml grab property
-
- The code that we want to disable then simply needs to check this property before
- acting.
-
- \snippet declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml grab
-
- \note Handling Key and Mouse focus in QML is quite likely to change before
- the Qt 4.6 release.
-*/
-
-/*!
- \page tutorials-declarative-contacts-part3.html
- \contentspage {Declarative UI Tutorial}{Contents}
- \previouspage {tutorials/declarative/contacts/part2}{Chapter 2}
- \example tutorials/declarative/contacts/part3
- \title Models, Views and Delegates
- \tableofcontents
-
- In the previous chapters we designed a component to display and
- edit a contact. The next step is to display a list of those contacts
- and allow the user to expand individual contacts for editing.
-
- As the previous elements will not be changed in this section, they have
- been moved to a lib directory for this tutorial and the relevant
- import path has been used.
-
- \section1 Simple List View
-
- Displaying lists requires three components. A model that holds the
- data displayed, a delegate to indicate how elements are drawn and
- a view to arrange the elements.
-
- \image declarative-tutorial-list.gif
-
- For the purposes of this tutorial we will be using an SQL query as our
- data model. This can be declared in the resources section of
- the parent item.
-
- \snippet declarative/tutorials/contacts/3_Collections/1/ContactView.qml model
-
- The SqlConnection component describes how to connect to the database in
- much the same ways as the QSqlDatabase::addDatabase() function is used.
- In this case an SQLite database is used as it can be connected to as a
- file, reducing complexity in setting up a database server or credentials.
-
- The SqlQuery component allows various forms of queries to be described.
- When the query is a select statement, the component also acts as a model
- allowing it to provide data to a ListView component. The query above
- retrieves the fields recid, label, email and phone from a contacts table,
- and orders the results by the label of the contact first, and then by
- the recid for any contacts with equivalent labels.
-
- The ListView component is suitable for displaying models and is declared
- much like any other QML component. The ListView component also has
- a delegate property that defines how to construct components for items in the list.
-
- \snippet declarative/tutorials/contacts/3_Collections/1/ContactView.qml delegate
-
- Unlike a child element, this describes a template on how to build the component
- for each element, much in the same way that components are loaded from
- files such as RemoveButton.qml. The are constructed or destroyed as items
- scroll into our out of the visible area of the list.
-
- The entire view component will look like:
-
- \snippet declarative/tutorials/contacts/3_Collections/1/ContactView.qml view
-
- This gives us a list of contacts that the user can flick through.
-
- \section1 Animating Delegates
-
- The next step is to allow the user to click on a contact to edit the
- contact. We will take advantage of QML to open a Contact component
- in the list rather than as a new dialog or view. This is very
- similar to how the contents of the FieldText and RemoveButton components
- are swapped in and out.
-
- \image declarative-tutorial-list-open.gif
-
- \snippet declarative/tutorials/contacts/3_Collections/2/ContactView.qml components
-
- The first step is to have two children of our delegate component that can
- be swapped between. The plain Text component and the Contact component built
- in the previous chapters. We also add a MouseRegion that can be clicked upon
- to change the state of the delegate component.
-
- \snippet declarative/tutorials/contacts/3_Collections/2/ContactView.qml states
-
- This defines the open state of the delegate. It changes the height of the delegate
- component to that of the whole list view, pushing the other items off each end of
- the list. It sets the listview's scroll viewportY of the ListView to the
- y value of the delegate so that the top of the delegate matches the top of the list view.
- The next step is to lock the list view. This prevents the user being able to flick
- the list view. The final to properties that are set should
- be familiar from previous chapters, setting the opacity of the items such
- that the new item is visible and the old item hidden.
-
- We then add a transition so that this becomes animated:
-
- \snippet declarative/tutorials/contacts/3_Collections/2/ContactView.qml transitions
-
- This allows the user to click on an item to enter the open state. Elsewhere on our
- contact view we add a button so that the user can leave the detailed view of the contact.
-
- \snippet declarative/tutorials/contacts/3_Collections/2/ContactView.qml button
-
- And connect it's clicked value to some script to set the state of the delegate
- back to its default state.
-
- \snippet declarative/tutorials/contacts/3_Collections/2/ContactView.qml connections
-
- Something worth noting at this point is that every delegate created has this connection.
- It is important to check whether the delegate is the one in the open state, and
- taking some effort to ensure only one is, before acting on the signal from the button.
-
- \section1 Performance Considerations
-
- We have now made a contact application that can view a list of contacts, open one,
- and close it again. Its now time to take a moment and consider the implications
- of a list view delegate. It is created for each and every item in the list,
- and while the list cleans up after itself and only has delegate components constructed
- for visible items and any single point of animation, the list can scroll very quickly.
- This means potentially thousands of delegate components will be constructed and
- destroyed when the user is flicking through the list.
-
- Its important then to try and minimize the complexity of the delegate. This
- can be done by delaying the loading of the component. By using the qml property
- of the \l{Item}{Item} component, we can delay building the Contact.qml item until the user
- attempts to open the list.
-
- \snippet declarative/tutorials/contacts/3_Collections/3/ContactView.qml setting qml
-
- \l{Loader}{Loader} has a source property that represents the filename for the contents of
- a special item child of the \l{Loader}{Loader}. By setting the source property of the Details
- component on clicking the mouse region, the more complex component isn't loaded
- until needed. The down side about this though is the properties of Contact
- cannot be set until the item is loaded. This requires using the Bind element.
-
-
- \snippet declarative/tutorials/contacts/3_Collections/3/ContactView.qml binding
-
- Unlike binding a value to the property of a component directly, the Bind element
- allows both the target and the property set to themselves be to dynamic values.
- This means that when the source property is set, it will change the
- item property of the Details component. This in turn triggers the Bind
- elements to set the required properties of the item, which is now
- an instance of the Contact component.
-*/
diff --git a/examples/declarative/dynamic/PerspectiveItem.qml b/examples/declarative/dynamic/PerspectiveItem.qml
new file mode 100644
index 0000000..9e09dd2
--- /dev/null
+++ b/examples/declarative/dynamic/PerspectiveItem.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Image {
+ id: tree
+ property bool created: false
+ opacity: y+height > window.height/2 ? 1 : 0.25
+ onCreatedChanged: if (created && y+height<=window.height/2) { tree.destroy() }
+ scale: y+height > window.height/2 ? (y+height-250)*0.01 : 1
+ transformOrigin: "Center"
+ source: image;
+ z: y
+}
diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml
index 885e037..ea4e0cd 100644
--- a/examples/declarative/dynamic/dynamic.qml
+++ b/examples/declarative/dynamic/dynamic.qml
@@ -79,17 +79,17 @@ Item {
}
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
- file: "GenericItem.qml"
+ file: "PerspectiveItem.qml"
image: "images/tree_s.png"
}
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
- file: "GenericItem.qml"
+ file: "PerspectiveItem.qml"
image: "images/rabbit_brown.png"
}
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
- file: "GenericItem.qml"
+ file: "PerspectiveItem.qml"
image: "images/rabbit_bw.png"
}
}
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml
deleted file mode 100644
index 050f05f..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml
+++ /dev/null
@@ -1,36 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- width: layout.width
- height: layout.height
- color: "white"
- Column {
- id: layout
- width: childrenRect.width
- GroupBox {
- contents: "1/RemoveButton.qml"
- label: "Rectangle Component"
- }
- GroupBox {
- contents: "2/RemoveButton.qml"
- label: "Closed Remove Item Button"
- }
- GroupBox {
- contents: "2a/RemoveButton.qml"
- label: "Alternative Closed Button"
- }
- GroupBox {
- contents: "3/RemoveButton.qml"
- label: "Open Remove Item Button"
- }
- GroupBox {
- contents: "4/RemoveButton.qml"
- label: "State Based Button"
- }
- GroupBox {
- contents: "5/RemoveButton.qml"
- label: "Animated Button"
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2/RemoveButton.qml
deleted file mode 100644
index e323381..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2/RemoveButton.qml
+++ /dev/null
@@ -1,20 +0,0 @@
-import Qt 4.6
-
-//! [0]
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- }
-}
-//! [0]
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2a/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2a/RemoveButton.qml
deleted file mode 100644
index acada5b..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/2a/RemoveButton.qml
+++ /dev/null
@@ -1,22 +0,0 @@
-import Qt 4.6
-
-//! [0]
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- children: [
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- }
- ]
-}
-//! [0]
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml
deleted file mode 100644
index 247d266..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-import Qt 4.6
-
-//! [0]
-Rectangle {
- id: removeButton
- width: 230
- height: 30
- color: "red"
- radius: 5
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- }
-}
-//! [0]
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml
deleted file mode 100644
index ed74c4c..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml
+++ /dev/null
@@ -1,107 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
-//! [script]
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
-//! [script]
-//! [mouse region]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
-//! [mouse region]
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
-//! [states]
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: 230
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
-//! [states]
-}
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml
deleted file mode 100644
index 7dc95c8..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml
+++ /dev/null
@@ -1,114 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
-//! [script]
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
-//! [script]
-//! [mouse region]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- id: trashMouseRegion
- anchors.fill: parent
- }
- Connection {
- sender: trashMouseRegion
- signal: clicked()
- script: {
- toggle()
- }
- }
- }
-//! [mouse region]
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
-//! [states]
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: 230
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
-//! [states]
-}
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml
deleted file mode 100644
index 75d5aaa..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml
+++ /dev/null
@@ -1,114 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: 230
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
-//! [transition]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-//! [transition]
-}
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
deleted file mode 100644
index 327c2bf..0000000
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import Qt 4.6
-
-FocusScope {
- id: groupBox
- width: Math.max(270, subItem.width+40)
- height: Math.max(70, subItem.height+40)
-
- property var contents
- property var label
-
- Rectangle {
- id: wrapper
- x: 5
- y: 10
- radius: 10
- width: groupBox.width-20
- height: groupBox.height-20
- color: "white"
- border.color: "black"
- Loader {
- id: subItem
- source: groupBox.contents
- anchors.top: parent.top
- anchors.topMargin: 10
- anchors.right: parent.right
- anchors.rightMargin: 10
- width: item.width
- height: item.height
- }
- }
- Rectangle {
- x: 20
- y: 0
- height: text.height
- width: text.width+10
- color: "white"
- Text {
- x: 5
- id: text
- text: label
- font.bold: true
- }
- }
- Rectangle {
- color: "black"
- anchors.fill: parent
- opacity: parent.focus ? 0 : 0.3
- MouseRegion {
- anchors.fill: parent
- onClicked: { parent.parent.focus=true }
- }
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml
deleted file mode 100644
index 9508018..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml
+++ /dev/null
@@ -1,32 +0,0 @@
-import Qt 4.6
-
-//! [load]
-Item {
- id: contactField
- clip: true
- width: 230
- height: 30
- RemoveButton {
- id: removeButton
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- }
-//! [load]
- Text {
- id: fieldText
- width: contactField.width-80
- anchors.right: removeButton.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- font.bold: true
- color: "black"
- text: "123123"
- }
- Image {
- source: "../../shared/pics/phone.png"
- anchors.right: fieldText.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml
deleted file mode 100644
index 5ac62ce..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml
+++ /dev/null
@@ -1,112 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: 230
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml
deleted file mode 100644
index e50dcc5..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml
+++ /dev/null
@@ -1,35 +0,0 @@
-import Qt 4.6
-
-//! [load]
-Item {
- id: contactField
- clip: true
- width: 230
- height: 30
- Loader {
- id: removeButton
- source: "RemoveButton.qml"
- width: item.width
- height: item.height
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- }
-//! [load]
- Text {
- id: fieldText
- width: contactField.width-80
- anchors.right: removeButton.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- font.bold: true
- color: "black"
- text: "123123"
- }
- Image {
- source: "../../shared/pics/phone.png"
- anchors.right: fieldText.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml
deleted file mode 100644
index 5ac62ce..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml
+++ /dev/null
@@ -1,112 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: 230
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1b/BlueRect.qml b/examples/declarative/tutorials/contacts/2_Reuse/1b/BlueRect.qml
deleted file mode 100644
index 7bcdf50..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/1b/BlueRect.qml
+++ /dev/null
@@ -1,35 +0,0 @@
-import Qt 4.6
-
-//! [all]
-Rectangle {
- width: 100
- height: 100
- color: "blue"
- resources: [
- Component {
- id: redRectangle
- Rectangle {
- width: 30
- height: 30
- color: "red"
- radius: 5
- }
- }
- ]
- Loader {
- sourceComponent: redRectangle
- anchors.right: parent.right
- anchors.top: parent.top
- }
- Loader {
- sourceComponent: redRectangle
- anchors.left: parent.left
- anchors.top: parent.top
- }
- Loader {
- sourceComponent: redRectangle
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- }
-}
-//! [all]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml
deleted file mode 100644
index eb694ce..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml
+++ /dev/null
@@ -1,114 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- resources: [
- Script {
-
- function toggle() {
- print('removeButton.toggle()');
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: 230
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml
deleted file mode 100644
index ce6a289..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactField
- clip: true
- width: 230
- height: 30
-//! [use properties and signals]
- RemoveButton {
- id: removeButton
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- expandedWidth: contactField.width
- onConfirmed: { fieldText.text='' }
- }
-//! [use properties and signals]
- Text {
- id: fieldText
- width: contactField.width-80
- anchors.right: removeButton.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- font.bold: true
- color: "black"
- text: "123123"
- }
- Image {
- source: "../../shared/pics/phone.png"
- anchors.right: fieldText.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml
deleted file mode 100644
index b1cd72e..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-import Qt 4.6
-
-//! [define properties and signals]
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- property var expandedWidth: 230
- signal confirmed
-//! [define properties and signals]
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
-//! [use signal]
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle(); removeButton.confirmed() }
- }
-//! [use signal]
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
-//! [use width]
- PropertyChanges {
- target: removeButton
- width: removeButton.expandedWidth
- }
-//! [use width]
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml
deleted file mode 100644
index a913dda..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml
+++ /dev/null
@@ -1,39 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- width: layout.width
- height: layout.height
- color: "white"
- Grid {
- id: layout
- columns: 2
- rows: 4
- width: childrenRect.width
- GroupBox {
- contents: "1/ContactField.qml"
- label: "Loading: simple"
- }
- GroupBox {
- contents: "1a/ContactField.qml"
- label: "Loading: qml property"
- }
- GroupBox {
- contents: "2/ContactField.qml"
- label: "Using properties"
- }
- GroupBox {
- id: prev
- contents: "3/ContactField.qml"
- label: "Defining signals"
- }
- GroupBox {
- contents: "3/Contact.qml"
- label: "Multiple Items"
- }
- GroupBox {
- contents: "4/Contact.qml"
- label: "Mouse Grabbing"
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml
deleted file mode 100644
index f253763..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactDetails
- width: 230
- height: layout.height
-
- property var contactId: ""
- property var label: ""
- property var phone: ""
- property var email: ""
-
- onLabelChanged: { labelField.value = label }
- onEmailChanged: { emailField.value = email }
- onPhoneChanged: { phoneField.value = phone }
-
- Column {
- id: layout
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: 5
- ContactField {
- id: labelField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- label: "Name"
- }
- ContactField {
- id: phoneField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/phone.png"
- label: "Phone"
- }
- ContactField {
- id: emailField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/email.png"
- label: "Email"
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml
deleted file mode 100644
index 1517a74..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-import Qt 4.6
-
-//! [all]
-Item {
- id: contactField
- clip: true
- width: 230
- height: 30
- property var label: "Name"
- property var icon: "../../shared/pics/phone.png"
- property var value: ""
- RemoveButton {
- id: removeButton
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- expandedWidth: contactField.width
- onConfirmed: { fieldText.text='' }
- }
- FieldText {
- id: fieldText
- width: contactField.width-70
- anchors.right: removeButton.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- label: contactField.label
- text: contactField.value
- }
- Image {
- anchors.right: fieldText.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- source: contactField.icon
- }
- states: [
- State {
- name: "editingText"
- when: fieldText.state == 'editing'
- PropertyChanges {
- target: removeButton.anchors
- rightMargin: -35
- }
- PropertyChanges {
- target: fieldText
- width: contactField.width
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "width,rightMargin"
- duration: 200
- }
- }
- ]
-}
-//! [all]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
deleted file mode 100644
index 3a8bb7f..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
+++ /dev/null
@@ -1,144 +0,0 @@
-import Qt 4.6
-
-//! [value change]
-Rectangle {
- id: fieldText
- height: 30
- radius: 5
- color: "white"
- property var text: ""
- onTextChanged: { reset() }
-//! [value change]
- property var label: ""
- signal confirmed
- resources: [
- Script {
-
- function edit() {
- fieldText.state='editing';
- }
- function confirm() {
- fieldText.text = textEdit.text;
- fieldText.state='';
- fieldText.confirmed();
- }
- function reset() {
- textEdit.text = fieldText.text;
- fieldText.state='';
- }
-
- }
- ]
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- }
- TextEdit {
- id: textEdit
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- color: "black"
- font.bold: true
- readOnly: true
- wrap: false
- }
-//! [behavior]
- Text {
- id: textLabel
- x: 5
- width: parent.width-10
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: "AlignHCenter"
- color: "#505050"
- font.italic: true
- text: fieldText.label
- opacity: textEdit.text == '' ? 1 : 0
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
-//! [behavior]
- MouseRegion {
- anchors.fill: cancelIcon
- onClicked: { reset() }
- }
- MouseRegion {
- anchors.fill: confirmIcon
- onClicked: { confirm() }
- }
- MouseRegion {
- id: editRegion
- anchors.fill: textEdit
- onClicked: { edit() }
- }
- states: [
- State {
- name: "editing"
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: textEdit
- readOnly: false
- }
- PropertyChanges {
- target: textEdit
- focus: true
- }
- PropertyChanges {
- target: editRegion
- opacity: 0
- }
- PropertyChanges {
- target: textEdit.anchors
- leftMargin: 39
- }
- PropertyChanges {
- target: textEdit.anchors
- rightMargin: 39
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "opacity,leftMargin,rightMargin"
- duration: 200
- }
- ColorAnimation {
- property: "color"
- duration: 150
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
deleted file mode 100644
index 1276c6b..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-import Qt 4.6
-
-//! [all]
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- property var expandedWidth: 230
- signal confirmed
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- } else {
- removeButton.state = 'opened';
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle(); removeButton.confirmed() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: removeButton.expandedWidth
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
-//! [all]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml
deleted file mode 100644
index db85d2a..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml
+++ /dev/null
@@ -1,53 +0,0 @@
-import Qt 4.6
-
-//! [grab property]
-Item {
- id: contactDetails
- width: 230
- height: layout.height
- property var mouseGrabbed: false
-//! [grab property]
-
- property var contactId: ""
- property var label: ""
- property var phone: ""
- property var email: ""
-
- onLabelChanged: { labelField.value = label }
- onEmailChanged: { emailField.value = email }
- onPhoneChanged: { phoneField.value = phone }
-
- Column {
- id: layout
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: 5
- ContactField {
- id: labelField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- label: "Name"
- }
- ContactField {
- id: phoneField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/phone.png"
- label: "Phone"
- }
- ContactField {
- id: emailField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/email.png"
- label: "Email"
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml
deleted file mode 100644
index ccd756e..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactField
- clip: true
- height: 30
- property var label: "Name"
- property var icon: "../../shared/pics/phone.png"
- property var value: ""
- RemoveButton {
- id: removeButton
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- expandedWidth: contactField.width
- onConfirmed: { fieldText.text='' }
- }
- FieldText {
- id: fieldText
- width: contactField.width-70
- anchors.right: removeButton.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- label: contactField.label
- text: contactField.value
- }
- Image {
- anchors.right: fieldText.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- source: contactField.icon
- }
- states: [
- State {
- name: "editingText"
- when: fieldText.state == 'editing'
- PropertyChanges {
- target: removeButton.anchors
- rightMargin: -35
- }
- PropertyChanges {
- target: fieldText
- width: contactField.width
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "width,rightMargin"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
deleted file mode 100644
index 8f98ede..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
+++ /dev/null
@@ -1,145 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: fieldText
- height: 30
- radius: 5
- color: "white"
- property var text: ""
- property var label: ""
- onTextChanged: { reset() }
- signal confirmed
- resources: [
- Script {
-
- function edit() {
- if (!contactDetails.mouseGrabbed) {
- fieldText.state='editing';
- contactDetails.mouseGrabbed=true;
- }
- }
- function confirm() {
- fieldText.text = textEdit.text;
- fieldText.state='';
- contactDetails.mouseGrabbed=false;
- fieldText.confirmed();
- }
- function reset() {
- textEdit.text = fieldText.text;
- fieldText.state='';
- contactDetails.mouseGrabbed=false;
- }
-
- }
- ]
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- }
- TextEdit {
- id: textEdit
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- color: "black"
- font.bold: true
- readOnly: true
- wrap: false
- }
- Text {
- id: textLabel
- x: 5
- width: parent.width-10
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: "AlignHCenter"
- color: "#505050"
- font.italic: true
- text: fieldText.label
- opacity: textEdit.text == '' ? 1 : 0
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
- MouseRegion {
- anchors.fill: cancelIcon
- onClicked: { reset() }
- }
- MouseRegion {
- anchors.fill: confirmIcon
- onClicked: { confirm() }
- }
- MouseRegion {
- id: editRegion
- anchors.fill: textEdit
- onClicked: { edit() }
- }
- states: [
- State {
- name: "editing"
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: textEdit
- readOnly: false
- }
- PropertyChanges {
- target: textEdit
- focus: true
- }
- PropertyChanges {
- target: editRegion
- opacity: 0
- }
- PropertyChanges {
- target: textEdit.anchors
- leftMargin: 39
- }
- PropertyChanges {
- target: textEdit.anchors
- rightMargin: 39
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "opacity,leftMargin,rightMargin"
- duration: 200
- }
- ColorAnimation {
- property: "color"
- duration: 150
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml
deleted file mode 100644
index 8938184..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- property var expandedWidth: 230
- signal confirmed
- resources: [
-//! [grab]
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- contactDetails.mouseGrabbed=false;
- } else {
- if (!contactDetails.mouseGrabbed) {
- removeButton.state = 'opened';
- contactDetails.mouseGrabbed=true;
- }
- }
- }
-
- }
-//! [grab]
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle(); removeButton.confirmed() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- width: removeButton.expandedWidth
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml
deleted file mode 100644
index 327c2bf..0000000
--- a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import Qt 4.6
-
-FocusScope {
- id: groupBox
- width: Math.max(270, subItem.width+40)
- height: Math.max(70, subItem.height+40)
-
- property var contents
- property var label
-
- Rectangle {
- id: wrapper
- x: 5
- y: 10
- radius: 10
- width: groupBox.width-20
- height: groupBox.height-20
- color: "white"
- border.color: "black"
- Loader {
- id: subItem
- source: groupBox.contents
- anchors.top: parent.top
- anchors.topMargin: 10
- anchors.right: parent.right
- anchors.rightMargin: 10
- width: item.width
- height: item.height
- }
- }
- Rectangle {
- x: 20
- y: 0
- height: text.height
- width: text.width+10
- color: "white"
- Text {
- x: 5
- id: text
- text: label
- font.bold: true
- }
- }
- Rectangle {
- color: "black"
- anchors.fill: parent
- opacity: parent.focus ? 0 : 0.3
- MouseRegion {
- anchors.fill: parent
- onClicked: { parent.parent.focus=true }
- }
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml
deleted file mode 100644
index 25cb539..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-import Qt 4.6
-
-import "../lib"
-Item {
- id: contacts
- width: 240
- height: 230
- property var mouseGrabbed: false
- resources: [
-//! [model]
- SqlConnection {
- id: contactDatabase
- name: "qmlConnection"
- driver: "QSQLITE"
- databaseName: "../../shared/contacts.sqlite"
- },
- SqlQuery {
- id: contactList
- connection: contactDatabase
- query: "SELECT recid, label, email, phone FROM contacts ORDER BY label, recid"
- }
-//! [model]
- ]
-//! [view]
- ListView {
- id: contactListView
- anchors.fill: parent
- clip: true
- model: contactList
- focus: true
-//! [delegate]
- delegate: [
- Text {
- x: 45
- y: 12
- width: contactListView.width-45
- height: 30
- color: "black"
- font.bold: true
- text: model.label
- }
- ]
-//! [delegate]
- }
-//! [view]
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml
deleted file mode 100644
index 8ee51c3..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml
+++ /dev/null
@@ -1,124 +0,0 @@
-import Qt 4.6
-
-import "../lib"
-Item {
- id: contacts
- width: 240
- height: 230
- property var mouseGrabbed: false
- resources: [
- SqlConnection {
- id: contactDatabase
- name: "qmlConnection"
- driver: "QSQLITE"
- databaseName: "../../shared/contacts.sqlite"
- },
- SqlQuery {
- id: contactList
- connection: contactDatabase
- query: "SELECT recid, label, email, phone FROM contacts ORDER BY label, recid"
- }
- ]
-//! [button]
- Button {
- id: cancelEditButton
- anchors.top: parent.top
- anchors.topMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/cancel.png"
- opacity: mouseGrabbed ? 0 : 1
- }
-//! [button]
- ListView {
- id: contactListView
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: cancelEditButton.bottom
- anchors.bottom: parent.bottom
- clip: true
- model: contactList
- focus: true
- delegate: [
-//! [components]
- Item {
- id: wrapper
- x: 0
- width: ListView.view.width
- height: 34
- Text {
- id: label
- x: 45
- y: 12
- width: parent.width-45
- color: "black"
- font.bold: true
- text: model.label
- }
- MouseRegion {
- anchors.fill: label
- onClicked: { wrapper.state='opened'; }
- }
- Contact {
- id: Details
- anchors.fill: parent
- contactId: model.recid
- label: model.label
- email: model.email
- phone: model.phone
- opacity: 0
- }
-//! [components]
-//! [states]
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: wrapper
- height: contactListView.height
- }
- PropertyChanges {
- target: contactListView
- explicit: true
- yPosition: wrapper.y
- }
- PropertyChanges {
- target: contactListView
- interactive: 0
- }
- PropertyChanges {
- target: label
- opacity: 0
- }
- PropertyChanges {
- target: Details
- opacity: 1
- }
- }
- ]
-//! [states]
-//! [transitions]
- transitions: [
- Transition {
- NumberAnimation {
- duration: 500
- properties: "yPosition,height,opacity"
- }
- }
- ]
-//! [transitions]
-//! [connections]
- Connection {
- sender: cancelEditButton
- signal: "clicked()"
- script: {
- if (wrapper.state == 'opened') {
- wrapper.state = '';
- }
- }
- }
-//! [connections]
- }
- ]
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
deleted file mode 100644
index 76dc3e2..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
+++ /dev/null
@@ -1,137 +0,0 @@
-import Qt 4.6
-
-import "../lib"
-Item {
- id: contacts
- width: 240
- height: 230
- property var mouseGrabbed: false
- resources: [
- SqlConnection {
- id: contactDatabase
- name: "qmlConnection"
- driver: "QSQLITE"
- databaseName: "../../shared/contacts.sqlite"
- },
- SqlQuery {
- id: contactList
- connection: contactDatabase
- query: "SELECT recid, label, email, phone FROM contacts ORDER BY label, recid"
- }
- ]
- Button {
- id: cancelEditButton
- anchors.top: parent.top
- anchors.topMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/cancel.png"
- opacity: mouseGrabbed ? 0 : 1
- }
- ListView {
- id: contactListView
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: cancelEditButton.bottom
- anchors.bottom: parent.bottom
- clip: true
- model: contactList
- focus: true
- delegate: [
- Item {
- id: wrapper
- x: 0
- width: ListView.view.width
- height: 34
- Text {
- id: label
- x: 45
- y: 12
- width: parent.width-45
- color: "black"
- font.bold: true
- text: model.label
- }
-//! [setting qml]
- MouseRegion {
- anchors.fill: label
- onClicked: {
- Details.source = 'Contact.qml';
- wrapper.state='opened';
- }
- }
- Loader {
- id: Details
- anchors.fill: parent
- opacity: 0
-//! [setting qml]
-//! [binding]
- Binding {
- target: Details.item
- property: "contactId"
- value: model.recid
- }
- Binding {
- target: Details.item
- property: "label"
- value: model.label
- }
- Binding {
- target: Details.item
- property: "phone"
- value: model.phone
- }
- Binding {
- target: Details.item
- property: "email"
- value: model.email
- }
-//! [binding]
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: wrapper
- height: contactListView.height
- }
- PropertyChanges {
- target: contactListView
- explicit: true
- yPosition: wrapper.y
- }
- PropertyChanges {
- target: contactListView
- interactive: 0
- }
- PropertyChanges {
- target: label
- opacity: 0
- }
- PropertyChanges {
- target: Details
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- duration: 500
- properties: "yPosition,height,opacity"
- }
- }
- ]
- Connection {
- sender: cancelEditButton
- signal: "clicked()"
- script: {
- if (wrapper.state == 'opened') {
- wrapper.state = '';
- }
- }
- }
- }
- ]
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml b/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml
deleted file mode 100644
index cd14a08..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- width: layout.width
- height: layout.height
- color: "white"
- Binding {
- id: currentItem
- value: true
- }
- // relies on the current focus behavior whereby setting focus=true on a
- // component removes focus from any previous element
- Grid {
- id: layout
- width: childrenRect.width
- height: childrenRect.height
- GroupBox {
- contents: "1/ContactView.qml"
- label: "list only"
- }
- GroupBox {
- contents: "2/ContactView.qml"
- label: "dynamic delegate"
- }
- GroupBox {
- contents: "3/ContactView.qml"
- label: "delayed loading"
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml
deleted file mode 100644
index 327c2bf..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-import Qt 4.6
-
-FocusScope {
- id: groupBox
- width: Math.max(270, subItem.width+40)
- height: Math.max(70, subItem.height+40)
-
- property var contents
- property var label
-
- Rectangle {
- id: wrapper
- x: 5
- y: 10
- radius: 10
- width: groupBox.width-20
- height: groupBox.height-20
- color: "white"
- border.color: "black"
- Loader {
- id: subItem
- source: groupBox.contents
- anchors.top: parent.top
- anchors.topMargin: 10
- anchors.right: parent.right
- anchors.rightMargin: 10
- width: item.width
- height: item.height
- }
- }
- Rectangle {
- x: 20
- y: 0
- height: text.height
- width: text.width+10
- color: "white"
- Text {
- x: 5
- id: text
- text: label
- font.bold: true
- }
- }
- Rectangle {
- color: "black"
- anchors.fill: parent
- opacity: parent.focus ? 0 : 0.3
- MouseRegion {
- anchors.fill: parent
- onClicked: { parent.parent.focus=true }
- }
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml
deleted file mode 100644
index 9719231..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-import Qt 4.6
-
-Item {
- id: button
- width: 30
- height: 30
- property var icon: ""
- signal clicked
- Rectangle {
- id: buttonRect
- anchors.fill: parent
- color: "lightgreen"
- radius: 5
- Image {
- id: iconImage
- source: button.icon
- anchors.horizontalCenter: buttonRect.horizontalCenter
- anchors.verticalCenter: buttonRect.verticalCenter
- }
- MouseRegion {
- id: buttonMouseRegion
- anchors.fill: buttonRect
- onClicked: { button.clicked() }
- }
- states: [
- State {
- name: "pressed"
- when: buttonMouseRegion.pressed == true
- PropertyChanges {
- target: buttonRect
- color: "green"
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "pressed"
- ColorAnimation {
- property: "color"
- duration: 200
- }
- },
- Transition {
- from: "pressed"
- to: "*"
- ColorAnimation {
- property: "color"
- duration: 1000
- }
- }
- ]
- }
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml
deleted file mode 100644
index 58a542b..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactDetails
- anchors.fill: parent
-
- property var contactId: ""
- property var label: ""
- property var phone: ""
- property var email: ""
-
- onLabelChanged: { labelField.value = label }
- onEmailChanged: { emailField.value = email }
- onPhoneChanged: { phoneField.value = phone }
-
- Column {
- id: layout
- anchors.fill: parent
- spacing: 5
- ContactField {
- id: labelField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- label: "Name"
- }
- ContactField {
- id: phoneField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/phone.png"
- label: "Phone"
- }
- ContactField {
- id: emailField
- anchors.left: layout.left
- anchors.leftMargin: 5
- anchors.right: layout.right
- anchors.rightMargin: 5
- icon: "../../shared/pics/email.png"
- label: "Email"
- }
- }
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml
deleted file mode 100644
index ccd756e..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-import Qt 4.6
-
-Item {
- id: contactField
- clip: true
- height: 30
- property var label: "Name"
- property var icon: "../../shared/pics/phone.png"
- property var value: ""
- RemoveButton {
- id: removeButton
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- expandedWidth: contactField.width
- onConfirmed: { fieldText.text='' }
- }
- FieldText {
- id: fieldText
- width: contactField.width-70
- anchors.right: removeButton.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- label: contactField.label
- text: contactField.value
- }
- Image {
- anchors.right: fieldText.left
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- source: contactField.icon
- }
- states: [
- State {
- name: "editingText"
- when: fieldText.state == 'editing'
- PropertyChanges {
- target: removeButton.anchors
- rightMargin: -35
- }
- PropertyChanges {
- target: fieldText
- width: contactField.width
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "width,rightMargin"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
deleted file mode 100644
index 228a00d..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
+++ /dev/null
@@ -1,145 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: fieldText
- height: 30
- radius: 5
- color: "white"
- property var text: ""
- property var label: ""
- onTextChanged: { reset() }
- signal confirmed
- resources: [
- Script {
-
- function edit() {
- if (!contacts.mouseGrabbed) {
- fieldText.state='editing';
- contacts.mouseGrabbed=true;
- }
- }
- function confirm() {
- fieldText.text = textEdit.text;
- fieldText.state='';
- contacts.mouseGrabbed=false;
- fieldText.confirmed();
- }
- function reset() {
- textEdit.text = fieldText.text;
- fieldText.state='';
- contacts.mouseGrabbed=false;
- }
-
- }
- ]
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- }
- TextEdit {
- id: textEdit
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.right: parent.right
- anchors.rightMargin: 5
- anchors.verticalCenter: parent.verticalCenter
- color: "black"
- font.bold: true
- readOnly: true
- wrap: false
- }
- Text {
- id: textLabel
- x: 5
- width: parent.width-10
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: "AlignHCenter"
- color: "#505050"
- font.italic: true
- text: fieldText.label
- opacity: textEdit.text == '' ? 1 : 0
- opacity: Behavior {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
- MouseRegion {
- anchors.fill: cancelIcon
- onClicked: { reset() }
- }
- MouseRegion {
- anchors.fill: confirmIcon
- onClicked: { confirm() }
- }
- MouseRegion {
- id: editRegion
- anchors.fill: textEdit
- onClicked: { edit() }
- }
- states: [
- State {
- name: "editing"
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: textEdit
- readOnly: false
- }
- PropertyChanges {
- target: textEdit
- focus: true
- }
- PropertyChanges {
- target: editRegion
- opacity: 0
- }
- PropertyChanges {
- target: textEdit.anchors
- leftMargin: 39
- }
- PropertyChanges {
- target: textEdit.anchors
- rightMargin: 39
- }
- }
- ]
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "opacity,leftMargin,rightMargin"
- duration: 200
- }
- ColorAnimation {
- property: "color"
- duration: 150
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml
deleted file mode 100644
index 3c77cd8..0000000
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml
+++ /dev/null
@@ -1,119 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: removeButton
- width: 30
- height: 30
- color: "red"
- radius: 5
- property var expandedWidth: 230
- signal confirmed
- resources: [
- Script {
- function toggle() {
- if (removeButton.state == 'opened') {
- removeButton.state = '';
- contacts.mouseGrabbed=false;
- } else {
- if (!contacts.mouseGrabbed) {
- removeButton.state = 'opened';
- contacts.mouseGrabbed=true;
- }
- }
- }
-
- }
- ]
- Image {
- id: trashIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/trash.png"
- opacity: 1
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/cancel.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle() }
- }
- }
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "../../shared/pics/ok.png"
- opacity: 0
- MouseRegion {
- anchors.fill: parent
- onClicked: { toggle(); removeButton.confirmed() }
- }
- }
- Text {
- id: text
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: confirmIcon.right
- anchors.leftMargin: 4
- anchors.right: cancelIcon.left
- anchors.rightMargin: 4
- font.bold: true
- color: "white"
- horizontalAlignment: "AlignHCenter"
- text: "Remove"
- opacity: 0
- }
- states: [
- State {
- name: "opened"
- PropertyChanges {
- target: removeButton
- explicit: true
- width: removeButton.expandedWidth
- }
- PropertyChanges {
- target: text
- opacity: 1
- }
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: trashIcon
- opacity: 0
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "opened"
- reversible: true
- NumberAnimation {
- properties: "opacity,x,width"
- duration: 200
- }
- }
- ]
-}
diff --git a/examples/declarative/tutorials/contacts/shared/contactGenSQL.pl b/examples/declarative/tutorials/contacts/shared/contactGenSQL.pl
deleted file mode 100755
index 2d328da..0000000
--- a/examples/declarative/tutorials/contacts/shared/contactGenSQL.pl
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/perl
-
-use warnings;
-use strict;
-
-my $count = shift;
-
-open(MFIRST, "<english-m.txt") or die "Could not open male names";
-open(FFIRST, "<english-f.txt") or die "Could not open female names";
-open(SURNAME, "<english-s.txt") or die "Could not open surnames names";
-open(ISP, "<email.txt") or die "Could not open isp names";
-
-my @mnames = <MFIRST>;
-my @fnames = <FFIRST>;
-my @surnames = <SURNAME>;
-my @isps = <ISP>;
-
-print "BEGIN;\n";
-print "CREATE TABLE contacts (recid INTEGER PRIMARY KEY, label TEXT, phone TEXT, email TEXT);\n";
-print "CREATE INDEX contactSortOrder ON contacts(label, recid);\n";
-
-my $i = 0;
-while ($i < $count) {
- $i++;
- my $fn = randomFirstName();
- my $sn = randomLastName();
- my $em = randomEmail($fn, $sn);
- my $ph = randomPhoneNumber();
-
- $fn =~ s/'/''/g;
- $sn =~ s/'/''/g;
- $em =~ s/'/''/g;
- print "INSERT INTO contacts (label, email, phone) VALUES('$fn $sn', '$em', '$ph');\n"
-}
-
-print "COMMIT;\n";
-
-
-sub randomFirstName
-{
- my $name;
- if (int(rand 2) == 1) {
- $name = $mnames[int(rand @mnames)];
- } else {
- $name = $fnames[int(rand @fnames)];
- }
- chomp $name;
- $name;
-}
-
-sub randomLastName
-{
- my $name = $surnames[int(rand @surnames)];
- chomp $name;
- $name;
-}
-
-sub randomEmail
-{
- my ($fn, $ln) = @_;
- my $isp = $isps[int(rand @isps)];
- chomp $isp;
- my $path = int(rand 3);
- my $email;
- if ($path == 0) {
- $email = "$fn.$ln\@$isp";
- } elsif ($path == 1) {
- $email = "$fn\@$isp";
- } elsif ($path == 2) {
- $email = "$ln\@$isp";
- }
-}
-
-sub randomPhoneNumber
-{
- my @digits = qw(1 2 3 4 5 6 7 8 9 0);
- my $phonenumber;
- for (1 .. 8) {
- $phonenumber .= $digits[int(rand @digits)];
- }
- $phonenumber;
-}
diff --git a/examples/declarative/tutorials/contacts/shared/contacts.sqlite b/examples/declarative/tutorials/contacts/shared/contacts.sqlite
deleted file mode 100644
index d903775..0000000
--- a/examples/declarative/tutorials/contacts/shared/contacts.sqlite
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/email.txt b/examples/declarative/tutorials/contacts/shared/email.txt
deleted file mode 100644
index de9894b..0000000
--- a/examples/declarative/tutorials/contacts/shared/email.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-emails.com
-emails.net
-mailserver.org
-mailserver.net
-mailserver.com
-BobsMail.com
-BillMail.com
diff --git a/examples/declarative/tutorials/contacts/shared/english-f.txt b/examples/declarative/tutorials/contacts/shared/english-f.txt
deleted file mode 100644
index 7da5474..0000000
--- a/examples/declarative/tutorials/contacts/shared/english-f.txt
+++ /dev/null
@@ -1,143 +0,0 @@
-Aimee
-Aleksandra
-Alice
-Alicia
-Allison
-Alyssa
-Amy
-Andrea
-Angel
-Angela
-Ann
-Anna
-Anne
-Anne
-Marie
-Annie
-Ashley
-Barbara
-Beatrice
-Beth
-Betty
-Brenda
-Brooke
-Candace
-Cara
-Caren
-Carol
-Caroline
-Carolyn
-Carrie
-Cassandra
-Catherine
-Charlotte
-Chrissy
-Christen
-Christina
-Christine
-Christy
-Claire
-Claudia
-Courtney
-Crystal
-Cynthia
-Dana
-Danielle
-Deanne
-Deborah
-Deirdre
-Denise
-Diane
-Dianne
-Dorothy
-Eileen
-Elena
-Elizabeth
-Emily
-Erica
-Erin
-Frances
-Gina
-Giulietta
-Heather
-Helen
-Jane
-Janet
-Janice
-Jenna
-Jennifer
-Jessica
-Joanna
-Joyce
-Julia
-Juliana
-Julie
-Justine
-Kara
-Karen
-Katharine
-Katherine
-Kathleen
-Kathryn
-Katrina
-Kelly
-Kerry
-Kim
-Kimberly
-Kristen
-Kristina
-Kristine
-Laura
-Laurel
-Lauren
-Laurie
-Leah
-Linda
-Lisa
-Lori
-Marcia
-Margaret
-Maria
-Marina
-Marisa
-Martha
-Mary
-Mary
-Ann
-Maya
-Melanie
-Melissa
-Michelle
-Monica
-Nancy
-Natalie
-Nicole
-Nina
-Pamela
-Patricia
-Rachel
-Rebecca
-Renee
-Sandra
-Sara
-Sharon
-Sheri
-Shirley
-Sonia
-Stefanie
-Stephanie
-Susan
-Suzanne
-Sylvia
-Tamara
-Tara
-Tatiana
-Terri
-Theresa
-Tiffany
-Tracy
-Valerie
-Veronica
-Vicky
-Vivian
-Wendy
diff --git a/examples/declarative/tutorials/contacts/shared/english-m.txt b/examples/declarative/tutorials/contacts/shared/english-m.txt
deleted file mode 100644
index 3c7b13e..0000000
--- a/examples/declarative/tutorials/contacts/shared/english-m.txt
+++ /dev/null
@@ -1,130 +0,0 @@
-Aaron
-Adam
-Adrian
-Alan
-Alejandro
-Alex
-Allen
-Andrew
-Andy
-Anthony
-Art
-Arthur
-Barry
-Bart
-Ben
-Benjamin
-Bill
-Bobby
-Brad
-Bradley
-Brendan
-Brett
-Brian
-Bruce
-Bryan
-Carlos
-Chad
-Charles
-Chris
-Christopher
-Chuck
-Clay
-Corey
-Craig
-Dan
-Daniel
-Darren
-Dave
-David
-Dean
-Dennis
-Denny
-Derek
-Don
-Doug
-Duane
-Edward
-Eric
-Eugene
-Evan
-Frank
-Fred
-Gary
-Gene
-George
-Gordon
-Greg
-Harry
-Henry
-Hunter
-Ivan
-Jack
-James
-Jamie
-Jason
-Jay
-Jeff
-Jeffrey
-Jeremy
-Jim
-Joe
-Joel
-John
-Jonathan
-Joseph
-Justin
-Keith
-Ken
-Kevin
-Larry
-Logan
-Marc
-Mark
-Matt
-Matthew
-Michael
-Mike
-Nat
-Nathan
-Patrick
-Paul
-Perry
-Peter
-Philip
-Phillip
-Randy
-Raymond
-Ricardo
-Richard
-Rick
-Rob
-Robert
-Rod
-Roger
-Ross
-Ruben
-Russell
-Ryan
-Sam
-Scot
-Scott
-Sean
-Shaun
-Stephen
-Steve
-Steven
-Stewart
-Stuart
-Ted
-Thomas
-Tim
-Toby
-Todd
-Tom
-Troy
-Victor
-Wade
-Walter
-Wayne
-William
diff --git a/examples/declarative/tutorials/contacts/shared/english-s.txt b/examples/declarative/tutorials/contacts/shared/english-s.txt
deleted file mode 100644
index 1f3682d..0000000
--- a/examples/declarative/tutorials/contacts/shared/english-s.txt
+++ /dev/null
@@ -1,1003 +0,0 @@
-Adams
-Adamson
-Adler
-Akers
-Akin
-Aleman
-Alexander
-Allen
-Allison
-Allwood
-Anderson
-Andreou
-Anthony
-Appelbaum
-Applegate
-Arbore
-Arenson
-Armold
-Arntzen
-Askew
-Athanas
-Atkinson
-Ausman
-Austin
-Averitt
-Avila-Sakar
-Badders
-Baer
-Baggerly
-Bailliet
-Baird
-Baker
-Ball
-Ballentine
-Ballew
-Banks
-Baptist-Nguyen
-Barbee
-Barber
-Barchas
-Barcio
-Bardsley
-Barkauskas
-Barnes
-Barnett
-Barnwell
-Barrera
-Barreto
-Barroso
-Barrow
-Bart
-Barton
-Bass
-Bates
-Bavinger
-Baxter
-Bazaldua
-Becker
-Beeghly
-Belforte
-Bellamy
-Bellavance
-Beltran
-Belusar
-Bennett
-Benoit
-Bensley
-Berger
-Berggren
-Bergman
-Berry
-Bertelson
-Bess
-Beusse
-Bickford
-Bierner
-Bird
-Birdwell
-Bixby
-Blackmon
-Blackwell
-Blair
-Blankinship
-Blanton
-Block
-Blomkalns
-Bloomfield
-Blume
-Boeckenhauer
-Bolding
-Bolt
-Bolton
-Book
-Boucher
-Boudreau
-Bowman
-Boyd
-Boyes
-Boyles
-Braby
-Braden
-Bradley
-Brady
-Bragg
-Brandow
-Brantley
-Brauner
-Braunhardt
-Bray
-Bredenberg
-Bremer
-Breyer
-Bricout
-Briggs
-Brittain
-Brockman
-Brockmoller
-Broman
-Brooks
-Brown
-Brubaker
-Bruce
-Brumfield
-Brumley
-Bruning
-Buck
-Budd
-Buhler
-Buhr
-Burleson
-Burns
-Burton
-Bush
-Butterfield
-Byers
-Byon
-Byrd
-Bzostek
-Cabrera
-Caesar
-Caffey
-Caffrey
-Calhoun
-Call
-Callahan
-Campbell
-Cano
-Capri
-Carey
-Carlisle
-Carlson
-Carmichael
-Carnes
-Carr
-Carreira
-Carroll
-Carson
-Carswell
-Carter
-Cartwright
-Cason
-Cates
-Catlett
-Caudle
-Cavallaro
-Cave
-Cazamias
-Chabot
-Chance
-Chapman
-Characklis
-Cheatham
-Chen
-Chern
-Cheville
-Chong
-Christensen
-Church
-Claibourn
-Clark
-Clasen
-Claude
-Close
-Coakley
-Coffey
-Cohen
-Cole
-Collier
-Conant
-Connell
-Conte
-Conway
-Cooley
-Cooper
-Copeland
-Coram
-Corbett
-Cort
-Cortes
-Cousins
-Cowsar
-Cox
-Coyne
-Crain
-Crankshaw
-Craven
-Crawford
-Cressman
-Crestani
-Crier
-Crocker
-Cromwell
-Crouse
-Crowder
-Crowe
-Culpepper
-Cummings
-Cunningham
-Currie
-Cusey
-Cutcher
-Cyprus
-D'Ascenzo
-Dabak
-Dakoulas
-Daly
-Dana
-Danburg
-Danenhauer
-Darley
-Darrouzet
-Dartt
-Daugherty
-Davila
-Davis
-Dawkins
-Day
-DeHart
-DeMoss
-DeMuth
-DeVincentis
-Deaton
-Dees
-Degenhardt
-Deggeller
-Deigaard
-Delabroy
-Delaney
-Demir
-Denison
-Denney
-Derr
-Deuel
-Devitt
-Diamond
-Dickinson
-Dietrich
-Dilbeck
-Dobson
-Dodds
-Dodson
-Doherty
-Dooley
-Dorsey
-Dortch
-Doughty
-Dove
-Dowd
-Dowling
-Drescher
-Drucker
-Dryer
-Dryver
-Duckworth
-Dunbar
-Dunham
-Dunn
-Duston
-Dettweiler
-Dyson
-Eason
-Eaton
-Ebert
-Eckhoff
-Edelman
-Edmonds
-Eichhorn
-Eisbach
-Elders
-Elias
-Elijah
-Elizabeth
-Elliott
-Elliston
-Elms
-Emerson
-Engelberg
-Engle
-Eplett
-Epp
-Erickson
-Estades
-Etezadi
-Evans
-Ewing
-Fair
-Farfan
-Fargason
-Farhat
-Farry
-Fawcett
-Faye
-Federle
-Felcher
-Feldman
-Ferguson
-Fergusson
-Fernandez
-Ferrer
-Fine
-Fineman
-Fisher
-Flanagan
-Flathmann
-Fleming
-Fletcher
-Folk
-Fortune
-Fossati
-Foster
-Foulston
-Fowler
-Fox
-Francis
-Frantom
-Franz
-Frazer
-Fredericks
-Frey
-Freymann
-Fuentes
-Fuller
-Fundling
-Furlong
-Gainer
-Galang
-Galeazzi
-Gamse
-Gannaway
-Garcia
-Gardner
-Garneau
-Gartler
-Garverick
-Garza
-Gatt
-Gattis
-Gayman
-Geiger
-Gelder
-George
-Gerbino
-Gerbode
-Gibson
-Gifford
-Gillespie
-Gillingham
-Gilpin
-Gilyot
-Girgis
-Gjertsen
-Glantz
-Glaze
-Glenn
-Glotzbach
-Gobble
-Gockenbach
-Goff
-Goffin
-Golden
-Goldwyn
-Gomez
-Gonzalez
-Good
-Graham
-Gramm
-Granlund
-Grant
-Gray
-Grayson
-Greene
-Greenslade
-Greenwood
-Greer
-Griffin
-Grinstein
-Grisham
-Gross
-Grove
-Guthrie
-Guyton
-Haas
-Hackney
-Haddock
-Hagelstein
-Hagen
-Haggard
-Haines
-Hale
-Haley
-Hall
-Halladay
-Hamill
-Hamilton
-Hammer
-Hancock
-Hane
-Hansen
-Harding
-Harless
-Harms
-Harper
-Harrigan
-Harris
-Harrison
-Hart
-Harton
-Hartz
-Harvey
-Hastings
-Hauenstein
-Haushalter
-Haven
-Hawes
-Hawkins
-Hawley
-Haygood
-Haylock
-Hazard
-Heath
-Heidel
-Heins
-Hellums
-Hendricks
-Henry
-Henson
-Herbert
-Herman
-Hernandez
-Herrera
-Hertzmann
-Hewitt
-Hightower
-Hildebrand
-Hill
-Hindman
-Hirasaki
-Hirsh
-Hochman
-Hocker
-Hoffman
-Hoffmann
-Holder
-Holland
-Holloman
-Holstein
-Holt
-Holzer
-Honeyman
-Hood
-Hooks
-Hopper
-Horne
-House
-Houston
-Howard
-Howell
-Howley
-Huang
-Hudgings
-Huffman
-Hughes
-Humphrey
-Hunt
-Hunter
-Hurley
-Huston
-Hutchinson
-Hyatt
-Irving
-Jacobs
-Jaramillo
-Jaranson
-Jarboe
-Jarrell
-Jenkins
-Johnson
-Johnston
-Jones
-Joy
-Juette
-Julicher
-Jumper
-Kabir
-Kamberova
-Kamen
-Kamine
-Kampe
-Kane
-Kang
-Kapetanovic
-Kargatis
-Karlin
-Karlsson
-Kasbekar
-Kasper
-Kastensmidt
-Katz
-Kauffman
-Kavanagh
-Kaydos
-Kearsley
-Keleher
-Kelly
-Kelty
-Kendrick
-Key
-Kicinski
-Kiefer
-Kielt
-Kim
-Kimmel
-Kincaid
-King
-Kinney
-Kipp
-Kirby
-Kirk
-Kirkland
-Kirkpatrick
-Klamczynski
-Klein
-Kopnicky
-Kotsonis
-Koutras
-Kramer
-Kremer
-Krohn
-Kuhlken
-Kunitz
-LaLonde
-LaValle
-LaWare
-Lacy
-Lam
-Lamb
-Lampkin
-Lane
-Langston
-Lanier
-Larsen
-Lassiter
-Latchford
-Lawera
-LeBlanc
-LeGrand
-Leatherbury
-Lebron
-Ledman
-Lee
-Leinenbach
-Leslie
-Levy
-Lewis
-Lichtenstein
-Lisowski
-Liston
-Litvak
-Llano-Restrepo
-Lloyd
-Lock
-Lodge
-Logan
-Lomonaco
-Long
-Lopez
-Lopez-Bassols
-Loren
-Loughridge
-Love
-Ludtke
-Luers
-Lukes
-Luxemburg
-MacAllister
-MacLeod
-Mackey
-Maddox
-Magee
-Mallinson
-Mann
-Manning
-Manthos
-Marie
-Marrow
-Marshall
-Martin
-Martinez
-Martisek
-Massey
-Mathis
-Matt
-Maxwell
-Mayer
-Mazurek
-McAdams
-McAfee
-McAlexander
-McBride
-McCarthy
-McClure
-McCord
-McCoy
-McCrary
-McCrossin
-McDonald
-McElfresh
-McFarland
-McGarr
-McGhee
-McGoldrick
-McGrath
-McGuire
-McKinley
-McMahan
-McMahon
-McMath
-McNally
-Mcdonald
-Meade
-Meador
-Mebane
-Medrano
-Melton
-Merchant
-Merwin
-Millam
-Millard
-Miller
-Mills
-Milstead
-Minard
-Miner
-Minkoff
-Minnotte
-Minyard
-Mirza
-Mitchell
-Money
-Monk
-Montgomery
-Monton
-Moore
-Moren
-Moreno
-Morris
-Morse
-Moss
-Moyer
-Mueller
-Mull
-Mullet
-Mullins
-Munn
-Murdock
-Murphey
-Murphy
-Murray
-Murry
-Mutchler
-Myers
-Myrick
-Nassar
-Nathan
-Nazzal
-Neal
-Nederveld
-Nelson
-Nguyen
-Nichols
-Nielsen
-Nockton
-Nolan
-Noonan
-Norbury
-Nordlander
-Norris
-Norvell
-Noyes
-Nugent
-Nunn
-O'Brien
-O'Connell
-O'Neill
-O'Steen
-Ober
-Odegard
-Oliver
-Ollmann
-Olson
-Ongley
-Ordway
-Ortiz
-Ouellette
-Overcash
-Overfelt
-Overley
-Owens
-Page
-Paige
-Pardue
-Parham
-Parker
-Parks
-Patterson
-Patton
-Paul
-Payne
-Peck
-Penisson
-Percer
-Perez
-Perlioni
-Perrino
-Peterman
-Peters
-Pfeiffer
-Phelps
-Philip
-Philippe
-Phillips
-Pickett
-Pippenger
-Pistole
-Platzek
-Player
-Poddar
-Poirier
-Poklepovic
-Polk
-Polking
-Pond
-Popish
-Porter
-Pound
-Pounds
-Powell
-Powers
-Prado
-Preston
-Price
-Prichep
-Priour
-Prischmann
-Pryor
-Puckett
-Raglin
-Ralston
-Rampersad
-Ratner
-Rawles
-Ray
-Read
-Reddy
-Reed
-Reese
-Reeves
-Reichenbach
-Reifel
-Rein
-Reiten
-Reiter
-Reitmeier
-Reynolds
-Richardson
-Rider
-Rhinehart
-Ritchie
-Rittenbach
-Roberts
-Robinson
-Rodriguez
-Rogers
-Roper
-Rosemblun
-Rosen
-Rosenberg
-Rosenblatt
-Ross
-Roth
-Rowatt
-Roy
-Royston
-Rozendal
-Rubble
-Ruhlin
-Rupert
-Russell
-Ruthruff
-Ryan
-Rye
-Sabry
-Sachitano
-Sachs
-Sammartino
-Sands
-Saunders
-Savely
-Scales
-Schaefer
-Schafer
-Scheer
-Schild
-Schlitt
-Schmitz
-Schneider
-Schoenberger
-Schoppe
-Scott
-Seay
-Segura
-Selesnick
-Self
-Seligmann
-Sewall
-Shami
-Shampine
-Sharp
-Shaw
-Shefelbine
-Sheldon
-Sherrill
-Shidle
-Shifley
-Shillingsburg
-Shisler
-Shopbell
-Shupack
-Sievert
-Simpson
-Sims
-Sissman
-Smayling
-Smith
-Snyder
-Solomon
-Solon
-Soltero
-Sommers
-Sonneborn
-Sorensen
-Southworth
-Spear
-Speight
-Spencer
-Spruell
-Spudich
-Stacy
-Staebel
-Steele
-Steinhour
-Steinke
-Stepp
-Stevens
-Stewart
-Stickel
-Stine
-Stivers
-Stobb
-Stone
-Stratmann
-Stubbers
-Stuckey
-Stugart
-Sullivan
-Sultan
-Sumrall
-Sunley
-Sunshine
-Sutton
-Swaim
-Swales
-Sweed
-Swick
-Swift
-Swindell
-Swint
-Symonds
-Syzdek
-Szafranski
-Takimoto
-Talbott
-Talwar
-Tanner
-Taslimi
-Tate
-Tatum
-Taylor
-Tchainikov
-Terk
-Thacker
-Thomas
-Thompson
-Thomson
-Thornton
-Thurman
-Thurow
-Tilley
-Tolle
-Towns
-Trafton
-Tran
-Trevas
-Trevino
-Triggs
-Truchard
-Tunison
-Turner
-Twedell
-Tyler
-Tyree
-Unger
-Van
-Vanderzanden
-Vanlandingham
-Varanasi
-Varela
-Varman
-Venier
-Verspoor
-Vick
-Visinsky
-Voltz
-Wagner
-Wake
-Walcott
-Waldron
-Walker
-Wallace
-Walters
-Walton
-Ward
-Wardle
-Warnes
-Warren
-Washington
-Watson
-Watters
-Webber
-Weidenfeller
-Weien
-Weimer
-Weiner
-Weinger
-Weinheimer
-Weirich
-Welch
-Wells
-Wendt
-West
-Westmoreland
-Wex
-Whitaker
-White
-Whitley
-Wiediger
-Wilburn
-Williams
-Williamson
-Willman
-Wilson
-Winger
-Wise
-Wisur
-Witt
-Wong
-Woodbury
-Wooten
-Workman
-Wright
-Wyatt
-Yates
-Yeamans
-Yen
-York
-Yotov
-Younan
-Young
-Zeldin
-Zettner
-Ziegler
-Zitterkopf
-Zucker
diff --git a/examples/declarative/tutorials/contacts/shared/pics/cancel.png b/examples/declarative/tutorials/contacts/shared/pics/cancel.png
deleted file mode 100644
index ecc9533..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/cancel.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/pics/email.png b/examples/declarative/tutorials/contacts/shared/pics/email.png
deleted file mode 100644
index 04b3865..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/email.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/pics/new.png b/examples/declarative/tutorials/contacts/shared/pics/new.png
deleted file mode 100644
index c7ebac3..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/new.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/pics/ok.png b/examples/declarative/tutorials/contacts/shared/pics/ok.png
deleted file mode 100644
index 5795f04..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/ok.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/pics/phone.png b/examples/declarative/tutorials/contacts/shared/pics/phone.png
deleted file mode 100644
index fc9c222..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/phone.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/pics/search.png b/examples/declarative/tutorials/contacts/shared/pics/search.png
deleted file mode 100644
index cc74e69..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/search.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/tutorials/contacts/shared/pics/trash.png b/examples/declarative/tutorials/contacts/shared/pics/trash.png
deleted file mode 100644
index 2042595..0000000
--- a/examples/declarative/tutorials/contacts/shared/pics/trash.png
+++ /dev/null
Binary files differ
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index 2537ec0..5a8cda0 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -67,26 +67,30 @@ int QmlEngineDebugPrivate::getId()
void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugEnginesQuery *q)
{
QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->enginesQuery.remove(q->m_queryId);
+ if (p && q)
+ p->enginesQuery.remove(q->m_queryId);
}
void QmlEngineDebugPrivate::remove(QmlEngineDebug *c,
QmlDebugRootContextQuery *q)
{
QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->rootContextQuery.remove(q->m_queryId);
+ if (p && q)
+ p->rootContextQuery.remove(q->m_queryId);
}
void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugObjectQuery *q)
{
QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->objectQuery.remove(q->m_queryId);
+ if (p && q)
+ p->objectQuery.remove(q->m_queryId);
}
void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugExpressionQuery *q)
{
QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->expressionQuery.remove(q->m_queryId);
+ if (p && q)
+ p->expressionQuery.remove(q->m_queryId);
}
Q_DECLARE_METATYPE(QmlDebugObjectReference);
@@ -118,9 +122,10 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
prop.m_binding = data.binding;
prop.m_hasNotifySignal = data.hasNotifySignal;
prop.m_valueTypeName = data.valueTypeName;
- if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic)
+ if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic
+ || data.type == QmlEngineDebugServer::QmlObjectProperty::List) {
prop.m_value = data.value;
- else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) {
+ } else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) {
QmlDebugObjectReference obj;
obj.m_debugId = prop.m_value.toInt();
prop.m_value = qVariantFromValue(obj);
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri
index 502504a..5e5e74e 100644
--- a/src/declarative/extra/extra.pri
+++ b/src/declarative/extra/extra.pri
@@ -25,11 +25,3 @@ contains(QT_CONFIG, xmlpatterns) {
HEADERS += extra/qmlxmllistmodel.h
}
-# SQL is permanently enabled :-/
-#contains(QT_CONFIG, sql) {
- QT+= sql
- SOURCES += extra/qmlsqlquery.cpp \
- extra/qmlsqlconnection.cpp
- HEADERS += extra/qmlsqlquery.h \
- extra/qmlsqlconnection.h
-#}
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
deleted file mode 100644
index bed92ef..0000000
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ /dev/null
@@ -1,429 +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 QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmlsqlconnection.h"
-#include "private/qobject_p.h"
-
-#include <QSqlError>
-#include <QSqlDriver>
-#include <QDebug>
-
-#include <qml.h>
-#include <qmlcontext.h>
-
-QT_BEGIN_NAMESPACE
-
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,SqlConnection,QmlSqlConnection)
-
-class QmlSqlConnectionPrivate: public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QmlSqlConnection)
-public:
- QmlSqlConnectionPrivate() : port(0) {}
-
- int port;
- QString name, databaseName, connectionOptions;
- QString hostName, userName, password, driver;
-};
-
-/*!
- \qmlclass SqlConnection QmlSqlConnection
- \brief The SqlConnection element describes a connection to an SQL database.
-
- The SqlConnection element works in a similar way to
- QSqlDatabase::addDatabase(). It allows setting the database properties
- such that the connection does not need to be set up in C++ code.
- It differs from QSqlDatabase::addDatabase() in that it will automatically
- open the database.
-
- The database can then either be used from an SqlQuery element using its id
- as a bind, or using its name. If the database is set up externally to
- Qml the query should connect using its name.
-
- \qml
- SqlConnection {
- id: myConnection
- name: "qmlConnection"
- driver: "QSQLITE"
- databaseName: "mydb.sqlite"
- }
- SqlQuery { id: listmodel; connection: myConnection; query: "SELECT * FROM mytable" }
- SqlQuery { id: othermodel; connection: "qmlConnection"; query: "SELECT * FROM myothertable" }
- \endqml
-*/
-
-/*!
- \qmlproperty QString SqlConnection::name
-
- Defines the connection's name. The name allows the connection to be
- retrieved using the connection property of SqlQuery or when
- QSqlDatabase::database()
-*/
-
-/*!
- \qmlproperty list<string> SqlConnection::tables
-
- Defines the set of tables that exist in the database for the connection.
-*/
-
-/*!
- \qmlproperty string SqlConnection::databaseName
-
- Defines the connection's database name. This is used when opening the
- connection to the database.
-*/
-
-/*!
- \qmlproperty string SqlConnection::driver
-
- Defines the driver type of the connection. This is used when opening the
- connection to the database.
-*/
-
-/*!
- \qmlproperty string SqlConnection::connectOptions
-
- Defines the options used when connecting to the database. These are used
- when opening the connection to the database.
-*/
-
-/*!
- \qmlproperty string SqlConnection::hostName
-
- Defines the connection's host name. This is used when opening the
- connection to the database.
-*/
-
-/*!
- \qmlproperty int SqlConnection::port
-
- Defines the connection's port number. This is used when opening the
- connection to the database.
-*/
-
-/*!
- \qmlproperty string SqlConnection::userName
-
- Defines the connection's user name. This is used when opening the
- connection to the database.
-*/
-
-/*!
- \qmlproperty string SqlConnection::password
-
- Defines the connection's password. This is used when opening the
- connection to the database.
-*/
-
-/*!
- \qmlproperty string SqlConnection::lastError
-
- Defines the last error, if one occurred, when working with the database.
- If the error occurred in conjunction with an SQL query the error will be
- defined by SqlQuery::lastError.
-*/
-
-/*!
- \internal
- \class QmlSqlConnection
- \brief The QmlSqlConnection class manages a connection to an SQL database.
-*/
-
-/*!
- Constructs a QmlSqlConnection with the given \a parent.
-*/
-QmlSqlConnection::QmlSqlConnection(QObject *parent)
-: QObject(*(new QmlSqlConnectionPrivate), parent)
-{
-}
-
-/*!
- Destroys the QmlSqlConnection.
-*/
-QmlSqlConnection::~QmlSqlConnection()
-{
- QSqlDatabase db = database();
- if (db.isOpen())
- db.close();
-}
-
-/*!
- Returns the connection's name.
- This is equivalent to QSqlDatabase::connectionName().
- \sa setName()
-*/
-QString QmlSqlConnection::name() const
-{
- Q_D(const QmlSqlConnection);
- return d->name;
-}
-
-/*!
- Returns the connection's database name.
- This is equivalent to QSqlDatabase::databaseName().
- \sa setDatabaseName()
-*/
-QString QmlSqlConnection::databaseName() const
-{
- Q_D(const QmlSqlConnection);
- return d->databaseName;
-}
-
-/*!
- Returns the connect options string used for this connection.
-
- \sa setConnectOptions()
-*/
-QString QmlSqlConnection::connectOptions() const
-{
- Q_D(const QmlSqlConnection);
- return d->connectionOptions;
-}
-
-/*!
- Returns the connection's host name.
- \sa setHostName()
-*/
-QString QmlSqlConnection::hostName() const
-{
- Q_D(const QmlSqlConnection);
- return d->hostName;
-}
-
-/*!
- Returns the connection's port number. The value is undefined if the port
- number has not been set.
-
- \sa setPort()
-*/
-int QmlSqlConnection::port() const
-{
- Q_D(const QmlSqlConnection);
- return d->port;
-}
-
-/*!
- Returns the connection's user name.
-
- \sa setUserName()
-*/
-QString QmlSqlConnection::userName() const
-{
- Q_D(const QmlSqlConnection);
- return d->userName;
-}
-
-/*!
- Returns the connection's password.
-
- \sa setPassword)()
-*/
-QString QmlSqlConnection::password() const
-{
- Q_D(const QmlSqlConnection);
- return d->password;
-}
-
-/*!
- Returns the connection's driver name.
-
- \sa setDriver()
-*/
-QString QmlSqlConnection::driver() const
-{
- Q_D(const QmlSqlConnection);
- return d->driver;
-}
-
-/*!
- Returns a list of the database's tables.
-*/
-QStringList QmlSqlConnection::tables() const
-{
- return database().tables();
-}
-
-/*!
- Sets the connection's name to the given \a name.
-
- \sa name()
-*/
-void QmlSqlConnection::setName(const QString &name)
-{
- Q_D(QmlSqlConnection);
- d->name = name;
-}
-
-/*!
- Set's the connection's database name to the given \a name.
-
- \sa databaseName()
-*/
-void QmlSqlConnection::setDatabaseName(const QString &name)
-{
- Q_D(QmlSqlConnection);
- d->databaseName = name;
-}
-
-/*!
- Sets the connection's options to the given \a options.
-
- \sa connectOptions(), QSqlDatabase::setConnectOptions()
-*/
-void QmlSqlConnection::setConnectOptions(const QString &options)
-{
- Q_D(QmlSqlConnection);
- d->connectionOptions = options;
-}
-
-/*!
- Sets the connection's host name to the given \a name.
-
- \sa hostName()
-*/
-void QmlSqlConnection::setHostName(const QString &name)
-{
- Q_D(QmlSqlConnection);
- d->hostName = name;
-}
-
-/*!
- Sets the connection's port number to the given \a port.
-
- \sa port()
-*/
-void QmlSqlConnection::setPort(int port)
-{
- Q_D(QmlSqlConnection);
- d->port = port;
-}
-
-/*!
- Sets the connection's user name to the given \a name.
-
- \sa userName()
-*/
-void QmlSqlConnection::setUserName(const QString &name)
-{
- Q_D(QmlSqlConnection);
- d->userName = name;
-}
-
-/*!
- Sets the connection's password to the given \a password.
-
- \sa password()
-*/
-void QmlSqlConnection::setPassword(const QString &password)
-{
- Q_D(QmlSqlConnection);
- d->password = password;
-}
-
-/*!
- Returns information about the last error that occurred on the database.
-
- Failures that occur in conjunction with an individual query are
- reported by QmlSqlQuery::lastError()
-*/
-QString QmlSqlConnection::lastError() const
-{
- return database().lastError().text();
-}
-
-/*!
- Sets the connection's driver to the specified driver \a type.
-
- \sa driver(), QSqlDatabase::addDatabase()
-*/
-void QmlSqlConnection::setDriver(const QString &type)
-{
- Q_D(QmlSqlConnection);
- d->driver = type;
-}
-
-/*!
- Returns the database object associated with this connection.
- If the database is not yet open, it will open the database
- passed on the settings specified for the SQL connection.
-*/
-QSqlDatabase QmlSqlConnection::database() const
-{
- Q_D(const QmlSqlConnection);
-
- QSqlDatabase db;
- if (QSqlDatabase::connectionNames().contains(d->name)) {
- db = QSqlDatabase::database(d->name);
- } else {
- db = QSqlDatabase::addDatabase(
- d->driver.isEmpty()
- ? QLatin1String("QSQLITE")
- : d->driver,
- d->name.isEmpty()
- ? QLatin1String(QSqlDatabase::defaultConnection)
- : d->name);
- }
- if (db.isOpen())
- return db;
- if ((d->driver.isEmpty() || d->driver == QLatin1String("QSQLITE")) &&
- qmlContext(this)) {
- // SQLITE uses files for databases, hence use relative pathing
- // if possible.
- QUrl url = qmlContext(this)->resolvedUrl(QUrl(d->databaseName));
- if (url.isRelative() || url.scheme() == QLatin1String("file"))
- db.setDatabaseName(url.toLocalFile());
- else
- db.setDatabaseName(d->databaseName);
- } else {
- db.setDatabaseName(d->databaseName);
- }
- db.setConnectOptions(d->connectionOptions);
- db.setHostName(d->hostName);
- db.setPassword(d->password);
- db.setPort(d->port);
- db.setUserName(d->userName);
- if (!db.open())
- qWarning() << "Failed to open database" << lastError();
-
- return db;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmlsqlconnection.h b/src/declarative/extra/qmlsqlconnection.h
deleted file mode 100644
index 740bbc2..0000000
--- a/src/declarative/extra/qmlsqlconnection.h
+++ /dev/null
@@ -1,116 +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 QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLSQLCONNECTION_H
-#define QMLSQLCONNECTION_H
-
-#include <QtDeclarative/qml.h>
-#include <QtSql/QSqlDatabase>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QSqlDatabase;
-class QmlSqlConnectionPrivate;
-class Q_DECLARATIVE_EXPORT QmlSqlConnection : public QObject, public QmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
-
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QStringList tables READ tables)
- Q_PROPERTY(QString databaseName READ databaseName WRITE setDatabaseName)
- Q_PROPERTY(QString driver READ driver WRITE setDriver)
- Q_PROPERTY(QString connectOptions READ connectOptions WRITE setConnectOptions)
- Q_PROPERTY(QString hostName READ hostName WRITE setHostName)
- Q_PROPERTY(int port READ port WRITE setPort)
- Q_PROPERTY(QString userName READ userName WRITE setUserName)
- Q_PROPERTY(QString password READ password WRITE setPassword)
- Q_PROPERTY(QString lastError READ lastError)
-public:
- QmlSqlConnection(QObject *parent = 0);
- ~QmlSqlConnection();
-
- QString name() const;
- void setName(const QString &);
-
- QStringList tables() const;
-
- QString databaseName() const;
- void setDatabaseName(const QString &);
-
- QString connectOptions() const;
- void setConnectOptions(const QString &);
-
- QString hostName() const;
- void setHostName(const QString &);
-
- int port() const;
- void setPort(int);
-
- QString userName() const;
- void setUserName(const QString &);
-
- QString password() const;
- void setPassword(const QString &);
-
- QString driver() const;
- void setDriver(const QString &);
-
- QString lastError() const;
-
- QSqlDatabase database() const;
-private:
- Q_DISABLE_COPY(QmlSqlConnection)
- Q_DECLARE_PRIVATE(QmlSqlConnection)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlSqlConnection)
-
-QT_END_HEADER
-
-#endif // QMLXMLLISTMODEL_H
-
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
deleted file mode 100644
index fe6e220..0000000
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ /dev/null
@@ -1,788 +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 QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmlsqlquery.h"
-#include "qmlsqlconnection.h"
-#include "private/qobject_p.h"
-
-#include <QDebug>
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QSqlField>
-#include <QSqlRecord>
-#include <QSqlDatabase>
-#include <QSqlDriver>
-
-#include <QContiguousCache>
-#include <QTimerEvent>
-
-QT_BEGIN_NAMESPACE
-
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,SqlBind,QmlSqlBind)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,SqlQuery,QmlSqlQuery)
-
-class QmlSqlBindPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QmlSqlBind)
-public:
- QmlSqlBindPrivate() {}
-
- QString name;
- QVariant value;
-};
-
-/*!
- \qmlclass SqlBind QmlSqlBind
- \brief The SqlBind element specifies a value binding for an SqlQuery element.
-
- By using bindings its possible to cause a SqlQuery to update itself
- when values bound through the SqlBind change. Hence in the example
- below the results for the SqlQuery will change as searchText changes.
-
- If the query is not a SELECT statement, the effects of the bound
- values will only apply when the SqlQuery exec() slot is called.
-
- \qml
- SqlQuery {
- query: "SELECT * FROM mytable WHERE name LIKE :value"
- bindings: SqlBind {
- name: ":value"
- value: searchText + '%'
- }
- }
- SqlQuery {
- query: "SELECT * FROM mytable WHERE type = ?"
- bindings: SqlBind {
- value: "simple"
- }
- }
- \endqml
-*/
-
-/*!
- \internal
- \class QmlSqlBind
- \brief The QmlSqlBind class specifies a value binding for a QmlSqlQuery.
-*/
-
-/*!
- \fn void QmlSqlBind::valueChanged()
-
- This signal is emitted when the value property of the SqlBind changes.
-*/
-
-/*!
- \qmlproperty QString SqlBind::name
-
- Defines the placeholder name of the bind. If no name is specified the
- bind will use its position within the SqlQuery's bindings to bind
- into the query.
-*/
-
-/*!
- \qmlproperty QVariant SqlBind::value
-
- Defines the value to bind into the query.
-*/
-
-/*!
- Constructs a QmlSqlVind with the given \a parent
-*/
-QmlSqlBind::QmlSqlBind(QObject *parent)
-: QObject(*(new QmlSqlBindPrivate()), parent)
-{
-}
-
-/*!
- Destroys the QmlSqlBind.
-*/
-QmlSqlBind::~QmlSqlBind()
-{
-}
-
-/*!
- Returns the binding's name.
-
- \sa setName()
-*/
-QString QmlSqlBind::name() const
-{
- Q_D(const QmlSqlBind);
- return d->name;
-}
-
-/*!
- Returns the binding's value.
-
- \sa setValue()
-*/
-QVariant QmlSqlBind::value() const
-{
- Q_D(const QmlSqlBind);
- return d->value;
-}
-
-/*!
- Sets the binding's name to the given \a name.
-
- \sa name()
-*/
-void QmlSqlBind::setName(const QString &name)
-{
- Q_D(QmlSqlBind);
- d->name = name;
-}
-
-/*!
- Sets the binding's value to the given \a value.
-
- \sa value()
-*/
-void QmlSqlBind::setValue(const QVariant &value)
-{
- Q_D(QmlSqlBind);
- if (d->value != value) {
- d->value = value;
- emit valueChanged();
- }
-}
-
-class QmlSqlQueryPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QmlSqlQuery)
-public:
- QmlSqlQueryPrivate(QmlSqlQuery *owner)
- : isSel(false), query(NULL), requireCache(false), count(-1),
- cacheNear(100), cacheRetain(100), cacheSize(1000),
- cacheInterval(250), scheduledRow(-1), cacheTimer(-1),
- binds(owner) {}
- void prepareQuery() const;
- void bindQuery() const;
- void grabRoles() const;
-
- void clearCache();
- void initCache() const;
- void hitCache(int row) const;
-
- void enactShift(int row) const;
-
- QString queryText;
- bool isSel;
- QVariant connectionVariant;
- mutable QSqlQuery *query;
- mutable bool requireCache;
- mutable int count;
- mutable QList<int> roles;
- mutable QStringList roleNames;
-
- typedef QContiguousCache<QVariant> Column;
- mutable QVector< Column * > cache;
-
- int cacheNear, cacheRetain, cacheSize, cacheInterval;
-
- mutable int scheduledRow;
- mutable int cacheTimer;
-
- class QmlSqlBindList : public QmlList<QmlSqlBind *>
- {
- public:
- QmlSqlBindList(QmlSqlQuery *owner)
- : q(owner){}
-
- void append(QmlSqlBind *o) {
- m_contents.append(o);
- QObject::connect(o, SIGNAL(valueChanged()), q, SLOT(resetBinds()));
- }
- void clear() { m_contents.clear(); }
- int count() const { return m_contents.count(); }
- void removeAt(int pos) { return m_contents.removeAt(pos); }
- QmlSqlBind *at(int pos) const { return m_contents.at(pos); }
- void insert(int pos, QmlSqlBind *o) { m_contents.insert(pos, o); }
- private:
- QList<QmlSqlBind *> m_contents;
- QmlSqlQuery *q;
- };
-
- QmlSqlBindList binds;
-};
-
-/*!
- \qmlclass SqlQuery QmlSqlQuery
- \brief The SqlQuery element describes a query into an SQL database.
-
- The SqlQuery element has three parts. The first is the query itself,
- which can either be specified using the query property or by the
- default text for the element. The second specifies the connection
- to the database. This can either be a bound id from an SqlConnection
- or the connections name. If the connection is specified in a QML
- SqlConnection it is recommend to bind to the id to help ensure the
- database is complete before attempting to attach to it. If no
- connectoin is specified the default connection is used.
-
- It is also possible to bind values into the query using the bindings
- property. See SqlBind for more information on how to bind values into
- the query.
-
- If the query is a select statement it can be used as a model for a ListView.
- The roles will be the columns of the result set. Use the SQL AS keyword
- in the query if you want to override the column names from that of the
- table selected. You should also use the AS keyword if there is no
- appropriate table column name for the result column.
-
- \qml
- SqlQuery { connection: qmlConnectionId; query: "DELETE FROM mytable" }
- SqlQuery {
- connection: "connectionName"
- query: "SELECT * FROM mytable"
- }
- SqlQuery { query: "SELECT id AS recordId, (firstName || ' ' || lastName) AS fullName FROM mytable" }
- \endqml
-*/
-
-/*
- \class QmlSqlQuery
- \brief the QmlSqlQuery class manages a query into an SQL database.
-*/
-
-/*!
- \qmlproperty QString SqlQuery::query
-
- Defines the query text.
-*/
-
-/*!
- \qmlproperty QVariant SqlQuery::connection
-
- Defines the connection to an SQL database used by the query.
-*/
-
-/*!
- \qmlproperty QString SqlQuery::lastError
-
- Defines the last error, if one occurred, when working with the query.
-*/
-
-/*!
- \qmlproperty list<SqlBind> SqlQuery::bindings
-
- The bindings property contains the list of values to bind into the
- query. See SqlBind for more information.
-*/
-
-/*!
- Constructs a QmlSqlQuery with the given \a parent.
-*/
-QmlSqlQuery::QmlSqlQuery(QObject *parent)
-: QListModelInterface(*(new QmlSqlQueryPrivate(this)), parent)
-{
-}
-
-/*!
- Destroys the QmlSqlQuery.
-*/
-QmlSqlQuery::~QmlSqlQuery()
-{
- Q_D(QmlSqlQuery);
- if (d->query)
- delete d->query;
-}
-
-/*!
- Returns the query's bound variables.
-*/
-QmlList<QmlSqlBind *> *QmlSqlQuery::bindings()
-{
- Q_D(QmlSqlQuery);
- return &d->binds;
-}
-
-/*!
- Returns the query's bound variables.
-*/
-const QmlList<QmlSqlBind *> *QmlSqlQuery::bindings() const
-{
- Q_D(const QmlSqlQuery);
- return &d->binds;
-}
-
-/*!
- Returns the query text.
-
- \sa setQuery()
-*/
-QString QmlSqlQuery::query() const
-{
- Q_D(const QmlSqlQuery);
- return d->queryText;
-}
-
-/*!
- Sets the query text to the given \a text.
-*/
-void QmlSqlQuery::setQuery(const QString &text)
-{
- Q_D(QmlSqlQuery);
- if (text != d->queryText) {
- d->queryText = text;
-
- static const QLatin1String select("select");
- d-> isSel = text.trimmed().indexOf(select, 0, Qt::CaseInsensitive) == 0;
-
- if (d->query)
- resetQuery();
- }
-}
-
-/*!
- Returns the query's connection specifier.
-
- \sa setConnection()
-*/
-QVariant QmlSqlQuery::connection() const
-{
- Q_D(const QmlSqlQuery);
- return d->connectionVariant;
-}
-
-/*!
- Sets the query's connection specifier.
-
- \sa connection()
-*/
-void QmlSqlQuery::setConnection(const QVariant &connection)
-{
- Q_D(QmlSqlQuery);
- if (connection != d->connectionVariant) {
- d->connectionVariant = connection;
- if (d->query)
- resetQuery();
- else if (d->count == 0) // data has been requested
- d->prepareQuery();
- }
-}
-
-/*!
- Returns the set of values for a given set of requested \a roles for the
- specified \a row of the query result set. Returns an empty hash if the
- query is not a select statement.
-
- \sa count(), roles(), toString()
-*/
-QHash<int,QVariant> QmlSqlQuery::data(int row, const QList<int> &roles) const
-{
- Q_D(const QmlSqlQuery);
- if (!d->query)
- d->prepareQuery();
- QHash<int, QVariant> result;
-
- if (!d->isSel)
- return result;
-
- Q_ASSERT(row >= 0 && row <= d->count);
-
- if (!d->requireCache)
- d->query->seek(row);
- else
- d->hitCache(row);
-
- for (int i = 0; i < roles.count(); ++i) {
- int column = roles[i];
- if (d->requireCache)
- result.insert(column, d->cache[column]->at(row));
- else
- result.insert(column, d->query->value(column));
- }
- return result;
-}
-
-/*!
- Returns the number of rows in the query result set. Returns 0 if
- the query is not a select statement.
-
- \sa data(), roles(), toString()
-*/
-int QmlSqlQuery::count() const
-{
- Q_D(const QmlSqlQuery);
- if (!d->query)
- d->prepareQuery();
- return d->count;
-}
-
-/*!
- Returns the list of role integer identifiers for the query result set.
- Returns and empty list if the query is not a select statement.
-
- \sa data(), count(), toString()
-*/
-QList<int> QmlSqlQuery::roles() const
-{
- Q_D(const QmlSqlQuery);
- if (!d->query)
- d->prepareQuery();
-
- if (!d->isSel)
- return QList<int>();
-
- if (d->roleNames.isEmpty() && !d->requireCache) {
- d->query->seek(0);
- d->grabRoles();
- }
-
- return d->roles;
-}
-
-/*!
- Returns the corresponding role name for the given \a role identifier.
-
- \sa data(), roles(), toString()
-*/
-QString QmlSqlQuery::toString(int role) const
-{
- Q_D(const QmlSqlQuery);
- if (!d->query)
- d->prepareQuery();
-
- if (d->roleNames.isEmpty() && !d->requireCache) {
- d->query->seek(0);
- d->grabRoles();
- }
-
- return d->roleNames[role];
-}
-
-/*!
- Returns information about the last error that occurred on the query.
-*/
-QString QmlSqlQuery::lastError() const
-{
- Q_D(const QmlSqlQuery);
- if (d->query)
- return d->query->lastError().text();
- return QString();
-}
-
-/*!
- \reimp
-*/
-void QmlSqlQuery::componentComplete()
-{
- Q_D(QmlSqlQuery);
- if (!d->query)
- d->prepareQuery();
-}
-
-/*!
- \internal
- Rebinds the query, and if needed, emits rows inserted or rows
- added so any attached ListView elements will correctly.
-
- This slot is called automatically when the SqlBind elements in
- the bindings property of the query change.
-*/
-void QmlSqlQuery::resetBinds()
-{
- Q_D(QmlSqlQuery);
- if (!d->query)
- return;
- int oldcount = d->count;
- d->clearCache();
- d->roles.clear();
- d->roleNames.clear();
- d->bindQuery();
- if (d->isSel) {
- if (!d->query->isActive()) {
- if (!d->query->exec())
- qWarning() << "failed to execute query" << d->query->lastQuery() << d->query->boundValues() << d->query->lastError().text();
- }
- d->initCache(); // may finish query
- emitChanges(oldcount);
- }
-}
-
-/*!
- Executes the query. For SELECT statements this is normally only required
- if the database changes outside of the SQL query element. Statements that
- modify the database, such as UPDATE and INSERT, will not be applied until
- this function is called.
-*/
-void QmlSqlQuery::exec()
-{
- Q_D(QmlSqlQuery);
- if (!d->query)
- d->prepareQuery();
- Q_ASSERT(d->query);
-
- if (d->isSel) {
- int oldcount = d->count;
- d->clearCache();
- d->roles.clear();
- d->roleNames.clear();
- if (!d->query->exec())
- qWarning() << "failed to execute query" << d->query->lastQuery() << d->query->boundValues() << d->query->lastError().text();
- d->initCache(); // may finish query
- emitChanges(oldcount);
- } else {
- if (!d->query->exec())
- qWarning() << "failed to execute query" << d->query->lastQuery() << d->query->boundValues() << d->query->lastError().text();
- d->query->finish();
- }
-}
-
-/*!
- \internal
-
- Resets the query and query cache.
-*/
-void QmlSqlQuery::resetQuery()
-{
- Q_D(QmlSqlQuery);
- Q_ASSERT(d->query != 0);
- delete d->query;
- d->query = 0;
- d->clearCache();
- d->roles.clear();
- d->roleNames.clear();
- int oldcount = d->count;
- d->prepareQuery();
- emitChanges(oldcount);
-}
-
-/*!
- \internal
-
- emits row number changes based of differences between the given
- \a oldcount and the current count of the query result set.
-*/
-void QmlSqlQuery::emitChanges(int oldcount)
-{
- Q_D(QmlSqlQuery);
- if (d->count > oldcount)
- emit itemsInserted(oldcount, d->count-oldcount);
- else if (d->count < oldcount)
- emit itemsRemoved(d->count, oldcount-d->count);
- if (d->count > 0 && oldcount > 0)
- emit itemsChanged(0, qMin(d->count, oldcount), roles());
-}
-
-/*
- \internal
-
- Handles delayed caching of the query.
-*/
-void QmlSqlQuery::timerEvent(QTimerEvent *event)
-{
- Q_D(QmlSqlQuery);
- if (event->timerId() == d->cacheTimer) {
- killTimer(d->cacheTimer);
- d->cacheTimer = -1;
- d->enactShift(d->scheduledRow);
- d->scheduledRow = -1;
- }
-}
-
-/*
- Prepares the query. If the query starts with SELECT it is assumed to
- be a SELECT statement and the query is also executed.
-*/
-void QmlSqlQueryPrivate::prepareQuery() const
-{
- QObject *object = qvariant_cast<QObject*>(connectionVariant);
- QmlSqlConnection *connection = qobject_cast<QmlSqlConnection *>(object);
- QString connectionString = qvariant_cast<QString>(connectionVariant);
-
- Q_ASSERT(query == 0);
- QSqlDatabase db = connection ? connection->database()
- : QSqlDatabase::database(connectionString.isEmpty()
- ? QLatin1String(QSqlDatabase::defaultConnection)
- : connectionString, false);
-
- if (!db.isOpen()) {
- count = 0;
- return;
- }
-
- query = new QSqlQuery(db);
-
- requireCache =
- query->driver()->hasFeature(QSqlDriver::SimpleLocking)
- || !query->driver()->hasFeature(QSqlDriver::QuerySize);
-
- if (requireCache)
- query->setForwardOnly(true);
- if (!query->prepare(queryText))
- qWarning() << "failed to prepare query" << query->lastQuery() << query->lastError().text();
- bindQuery();
- if (isSel) {
- if (!query->exec())
- qWarning() << "failed to execute query" << query->lastQuery() << query->boundValues() << query->lastError().text();
- initCache();
- }
-}
-
-/*
- Binds values into the prepared query using the bindings property of the SqlQuery element.
-*/
-void QmlSqlQueryPrivate::bindQuery() const
-{
- for (int i = 0; i < binds.count(); ++i) {
- QmlSqlBind *bind = binds.at(i);
- if (bind->name().isEmpty()) {
- query->bindValue(i, bind->value());
- } else {
- query->bindValue(bind->name(), bind->value());
- }
- }
-}
-
-/*
- Clears cached query results
-*/
-void QmlSqlQueryPrivate::clearCache()
-{
- for (int i = 0; i < cache.size(); ++i)
- delete cache[i];
- cache.resize(0);
-}
-
-/*
- If caching is required, initializes the cache with
- column definitions and initial rows.
-
- Otherwise caches the count for the query.
-*/
-void QmlSqlQueryPrivate::initCache() const
-{
- if (requireCache) {
- int row = 0;
- if (query->next()) {
- if (roleNames.isEmpty()) {
- grabRoles();
- cache.resize(roleNames.count());
- for (int i = 0; i < cache.size(); ++i)
- cache[i] = new Column(cacheSize);
- }
- Q_ASSERT(cache.size() > 0);
- do {
- for (int i = 0; i < cache.size(); ++i)
- cache[i]->insert(row, query->value(i));
- row++;
- } while (!cache[0]->isFull() && query->next());
- while(query->next()) row++;
- }
- count = row;
- query->finish();
- } else {
- count = query->size();
- }
-}
-
-/*
- Schedules future background cache loading based of
- the given row.
-
- Should only be called if caching is active.
-*/
-void QmlSqlQueryPrivate::hitCache(int row) const
-{
- Q_Q(const QmlSqlQuery);
-
- Q_ASSERT(cache.size() > 0 && requireCache);
- if (cache[0]->containsIndex(row)) {
- int fi = cache[0]->firstIndex();
- int li = cache[0]->lastIndex();
- if (fi > 0 && row < fi + cacheNear)
- scheduledRow = qMax(0, row + cacheRetain - cacheSize);
- else if (li < count-1 && row > li - cacheNear)
- scheduledRow = qMax(0, row - cacheRetain);
-
- if (scheduledRow != -1 && cacheTimer == -1)
- cacheTimer = ((QmlSqlQuery *)q)->startTimer(cacheInterval);
- } else {
- if (cacheTimer != -1) {
- ((QmlSqlQuery *)q)->killTimer(cacheTimer);
- cacheTimer = -1;
- }
- scheduledRow = -1;
- qDebug() << "cache miss for row:" << row << "count:" << count;
- enactShift(row);
- }
-}
-
-/*
- Load items from sql centered around row.
-*/
-void QmlSqlQueryPrivate::enactShift(int targetRow) const
-{
- Q_ASSERT(query && cache.size());
- query->exec();
- int row = targetRow < cache[0]->firstIndex() ? targetRow : qMax(targetRow, cache[0]->lastIndex()+1);
-
- if (query->seek(row)) {
- do {
- for (int i = 0; i < cache.size(); ++i) {
- cache[i]->insert(row, query->value(i));
- }
- row++;
- } while(row < targetRow + cacheSize && query->next());
- }
-}
-
-/*
- Gets the column names for the roles of the SqlQuery element.
-
- The query must be active and on a valid row.
-*/
-void QmlSqlQueryPrivate::grabRoles() const
-{
- Q_ASSERT(query);
- Q_ASSERT(query->isValid());
- Q_ASSERT(roleNames.isEmpty());
- Q_ASSERT(roles.isEmpty());
-
- QSqlRecord record = query->record();
- for (int i = 0; i < record.count(); ++i) {
- roleNames.append(record.fieldName(i));
- roles.append(i);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmlsqlquery.h b/src/declarative/extra/qmlsqlquery.h
deleted file mode 100644
index 0f27709..0000000
--- a/src/declarative/extra/qmlsqlquery.h
+++ /dev/null
@@ -1,143 +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 QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLSQLQUERYMODEL_H
-#define QMLSQLQUERYMODEL_H
-
-#include <QtDeclarative/qml.h>
-#include <QtDeclarative/QListModelInterface>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QmlSqlBindPrivate;
-class Q_DECLARATIVE_EXPORT QmlSqlBind : public QObject, public QmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
-
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QVariant value READ value WRITE setValue)
-
- Q_CLASSINFO("DefaultValue", "value")
-
-public:
- QmlSqlBind(QObject *parent = 0);
- ~QmlSqlBind();
-
- QString name() const;
- QVariant value() const;
-
- void setName(const QString &name);
- void setValue(const QVariant &);
-
-Q_SIGNALS:
- void valueChanged();
-
-private:
- Q_DISABLE_COPY(QmlSqlBind)
- Q_DECLARE_PRIVATE(QmlSqlBind)
-};
-
-class QSqlQuery;
-class QmlSqlQueryPrivate;
-class Q_DECLARATIVE_EXPORT QmlSqlQuery : public QListModelInterface, public QmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
-
- Q_PROPERTY(QString query READ query WRITE setQuery)
- Q_PROPERTY(QVariant connection READ connection WRITE setConnection)
- Q_PROPERTY(QString lastError READ lastError)
-
- Q_PROPERTY(QmlList<QmlSqlBind *> *bindings READ bindings)
-public:
- QmlSqlQuery(QObject *parent = 0);
- ~QmlSqlQuery();
-
- QString query() const;
- void setQuery(const QString &);
-
- QVariant connection() const;
- void setConnection(const QVariant &);
-
- virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
- virtual int count() const;
- virtual QList<int> roles() const;
- virtual QString toString(int role) const;
-
- QString lastError() const;
-
- //### missing classBegin
- virtual void componentComplete();
-
- QmlList<QmlSqlBind *> *bindings();
- const QmlList<QmlSqlBind *> *bindings() const;
-
-public Q_SLOTS:
- void exec();
-
-protected:
- void timerEvent(QTimerEvent *);
-
-private Q_SLOTS:
- void resetBinds();
- void resetQuery();
-
-private:
- void emitChanges(int oldcount);
-
- Q_DISABLE_COPY(QmlSqlQuery)
- Q_DECLARE_PRIVATE(QmlSqlQuery)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlSqlBind)
-QML_DECLARE_TYPE(QmlSqlQuery)
-
-QT_END_HEADER
-
-#endif
-
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index df89f56..a3c96fd 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -406,6 +406,11 @@ void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role)
}
/*!
+ \class QmlXmlListModel
+ \internal
+*/
+
+/*!
\qmlclass XmlListModel
\brief The XmlListModel element allows you to specify a model using XPath expressions.
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 860af66..45a481c 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -82,7 +82,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
\o fillMode: Tile
\qml
Image {
- fillMode: "Tile"
+ fillMode: Image.Tile
width: 160; height: 160
source: "pics/qtlogo.png"
}
@@ -92,7 +92,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
\o fillMode: TileVertically
\qml
Image {
- fillMode: "TileVertically"
+ fillMode: Image.TileVertically
width: 160; height: 160
source: "pics/qtlogo.png"
}
@@ -102,7 +102,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
\o fillMode: TileHorizontally
\qml
Image {
- fillMode: "TileHorizontally"
+ fillMode: Image.TileHorizontally
width: 160; height: 160
source: "pics/qtlogo.png"
}
@@ -161,7 +161,7 @@ void QFxImage::setPixmap(const QPixmap &pix)
}
/*!
- \qmlproperty FillMode Image::fillMode
+ \qmlproperty enumeration Image::fillMode
Set this property to define what happens when the image set for the item is smaller
than the size of the item.
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 7d60336..72833e1 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -79,6 +79,19 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
#include "qfxeffects.cpp"
/*!
+ \qmlclass Transform
+ \brief The Transform elements provide a way of building advanced transformations on Items.
+
+ The Transform elements let you create and control advanced transformations that can be configured
+ independently using specialized properties.
+
+ You can assign any number of Transform elements to an Item. Each Transform is applied in order,
+ one at a time, to the Item it's assigned to.
+
+ \sa Rotation, Scale
+*/
+
+/*!
\qmlclass Scale
\brief The Scale object provides a way to scale an Item.
@@ -1272,46 +1285,68 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj)
*/
/*!
- \fn void QFxItem::baselineOffsetChanged()
-
- This signal is emitted when the baseline offset of the item
- is changed.
+ \property QFxItem::baseline
+ \internal
*/
/*!
- \fn void QFxItem::widthChanged()
+ \property QFxItem::effect
+ \internal
+*/
- This signal is emitted when the width of the item changes.
+/*!
+ \property QFxItem::focus
+ \internal
*/
/*!
- \fn void QFxItem::heightChanged()
+ \property QFxItem::wantsFocus
+ \internal
+*/
- This signal is emitted when the height of the item changes.
+/*!
+ \property QFxItem::transformOrigin
+ \internal
*/
/*!
- \fn void QFxItem::stateChanged(const QString &state)
+ \fn void QFxItem::childrenRectChanged()
+ \internal
+*/
- This signal is emitted when the \a state of the item changes.
+/*!
+ \fn void QFxItem::baselineOffsetChanged()
+ \internal
+*/
- \sa states-transitions
+/*!
+ \fn void QFxItem::widthChanged()
+ \internal
*/
/*!
- \fn void QFxItem::parentChanged()
+ \fn void QFxItem::heightChanged()
+ \internal
+*/
- This signal is emitted when the parent of the item changes.
+/*!
+ \fn void QFxItem::stateChanged(const QString &state)
+ \internal
+*/
- \sa setParentItem()
+/*!
+ \fn void QFxItem::parentChanged()
+ \internal
*/
/*!
\fn void QFxItem::focusChanged()
+ \internal
+*/
- This signal is emitted when the item's focus state changes.
-
- \sa QFxItem::setFocus()
+/*!
+ \fn void QFxItem::wantsFocusChanged()
+ \internal
*/
static inline void qfxitem_registerAnchorLine() {
@@ -1441,15 +1476,12 @@ QFxItem *QFxItem::parentItem() const
/*!
\property QFxItem::children
-
- This property contains the list of visual children of this item.
+ \internal
*/
/*!
\property QFxItem::resources
-
- This property contains non-visual resources that you want to
- reference by name.
+ \internal
*/
/*!
@@ -1469,8 +1501,10 @@ bool QFxItem::isComponentComplete() const
/*!
\property QFxItem::anchors
- \brief The anchors (alignments) used by the item.
+ \internal
*/
+
+/*! \internal */
QFxAnchors *QFxItem::anchors()
{
Q_D(QFxItem);
@@ -1663,15 +1697,10 @@ void QFxItemPrivate::transform_clear()
/*!
\property QFxItem::data
+ \internal
+*/
- The data property is allows you to freely mix the visual children
- and the non-visual resources of an item. If you assign a visual
- item to the data list it becomes a child and if you assign any
- other object type, it is added as a resource.
-
- data is a behind-the-scenes property: you should never need to
- explicitly specify it.
- */
+/*! \internal */
QmlList<QObject *> *QFxItem::data()
{
Q_D(QFxItem);
@@ -1839,9 +1868,7 @@ void QFxItem::geometryChanged(const QRectF &newGeometry,
}
}
-/*!
- \reimp
-*/
+/*! \internal */
void QFxItem::keyPressEvent(QKeyEvent *event)
{
Q_D(QFxItem);
@@ -1851,9 +1878,7 @@ void QFxItem::keyPressEvent(QKeyEvent *event)
event->ignore();
}
-/*!
- \reimp
-*/
+/*! \internal */
void QFxItem::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QFxItem);
@@ -1863,6 +1888,7 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event)
event->ignore();
}
+/*! \internal */
void QFxItem::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QFxItem);
@@ -1872,6 +1898,7 @@ void QFxItem::inputMethodEvent(QInputMethodEvent *event)
event->ignore();
}
+/*! \internal */
QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const
{
Q_D(const QFxItem);
@@ -1955,6 +1982,7 @@ QFxAnchorLine QFxItem::verticalCenter() const
return d->anchorLines()->vCenter;
}
+
/*!
\internal
*/
@@ -1966,50 +1994,32 @@ QFxAnchorLine QFxItem::baseline() const
/*!
\property QFxItem::top
-
- One of the anchor lines of the item.
-
- For more information see \l {anchor-layout}{Anchor Layouts}.
+ \internal
*/
/*!
\property QFxItem::bottom
-
- One of the anchor lines of the item.
-
- For more information see \l {anchor-layout}{Anchor Layouts}.
+ \internal
*/
/*!
\property QFxItem::left
-
- One of the anchor lines of the item.
-
- For more information see \l {anchor-layout}{Anchor Layouts}.
+ \internal
*/
/*!
\property QFxItem::right
-
- One of the anchor lines of the item.
-
- For more information see \l {anchor-layout}{Anchor Layouts}.
+ \internal
*/
/*!
\property QFxItem::horizontalCenter
-
- One of the anchor lines of the item.
-
- For more information see \l {anchor-layout}{Anchor Layouts}.
+ \internal
*/
/*!
\property QFxItem::verticalCenter
-
- One of the anchor lines of the item.
-
- For more information see \l {anchor-layout}{Anchor Layouts}.
+ \internal
*/
/*!
@@ -2112,9 +2122,6 @@ qreal QFxItem::baselineOffset() const
return d->_baselineOffset;
}
-/*!
- \internal
-*/
void QFxItem::setBaselineOffset(qreal offset)
{
Q_D(QFxItem);
@@ -2245,7 +2252,7 @@ void QFxItem::setBaselineOffset(qreal offset)
Returns a value indicating whether mouse input should
remain with this item exclusively.
- \sa setKeepMouseGrab
+ \sa setKeepMouseGrab()
*/
bool QFxItem::keepMouseGrab() const
{
@@ -2278,6 +2285,8 @@ void QFxItem::setKeepMouseGrab(bool keep)
}
/*!
+ \internal
+
This function emits the \e focusChanged signal.
Subclasses overriding this function should call up
@@ -2289,12 +2298,14 @@ void QFxItem::focusChanged(bool flag)
emit focusChanged();
}
+/*! \internal */
QmlList<QFxItem *> *QFxItem::fxChildren()
{
Q_D(QFxItem);
return &(d->children);
}
+/*! \internal */
QmlList<QObject *> *QFxItem::resources()
{
Q_D(QFxItem);
@@ -2315,15 +2326,14 @@ QmlList<QObject *> *QFxItem::resources()
}
\endqml
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstate}{States}
*/
/*!
\property QFxItem::states
- This property holds a list of states defined by the item.
-
- \sa {states-transitions}{States and Transitions}
+ \internal
*/
+/*! \internal */
QmlList<QmlState *>* QFxItem::states()
{
Q_D(QFxItem);
@@ -2344,15 +2354,15 @@ QmlList<QmlState *>* QFxItem::states()
}
\endqml
- \sa {states-transitions}{States and Transitions}
+ \sa {state-transitions}{Transitions}
*/
/*!
\property QFxItem::transitions
- This property holds a list of transitions defined by the item.
-
- \sa {states-transitions}{States and Transitions}
+ \internal
*/
+
+/*! \internal */
QmlList<QmlTransition *>* QFxItem::transitions()
{
Q_D(QFxItem);
@@ -2423,34 +2433,15 @@ QmlList<QmlTransition *>* QFxItem::transitions()
set), \c state will be a blank string. Likewise, you can return an
item to its base state by setting its current state to \c ''.
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstates}{States}
*/
/*!
\property QFxItem::state
-
- This property holds the name of the current state of the item.
-
- This property is often used in scripts to change between states. For
- example:
-
- \qml
- Script {
- function toggle() {
- if (button.state == 'On')
- button.state = 'Off';
- else
- button.state = 'On';
- }
- }
- \endqml
-
- If the item is in its base state (i.e. no explicit state has been
- set), \c state will be a blank string. Likewise, you can return an
- item to its base state by setting its current state to \c ''.
-
- \sa {states-transitions}{States and Transitions}
+ \internal
*/
+
+/*! \internal */
QString QFxItem::state() const
{
Q_D(const QFxItem);
@@ -2460,6 +2451,7 @@ QString QFxItem::state() const
return d->_stateGroup->state();
}
+/*! \internal */
void QFxItem::setState(const QString &state)
{
Q_D(QFxItem);
@@ -2475,8 +2467,10 @@ void QFxItem::setState(const QString &state)
/*!
\property QFxItem::transform
- This property holds a list of transformations set on the item.
+ \internal
*/
+
+/*! \internal */
QmlList<QGraphicsTransform *>* QFxItem::transform()
{
Q_D(QFxItem);
@@ -2484,6 +2478,8 @@ QmlList<QGraphicsTransform *>* QFxItem::transform()
}
/*!
+ \internal
+
classBegin() is called when the item is constructed, but its
properties have not yet been set.
@@ -2500,6 +2496,8 @@ void QFxItem::classBegin()
}
/*!
+ \internal
+
componentComplete() is called when all items in the component
have been constructed. It is often desireable to delay some
processing until the component is complete an all bindings in the
@@ -2584,9 +2582,7 @@ QPointF QFxItemPrivate::computeTransformOrigin() const
}
}
-/*!
- \reimp
-*/
+/*! \internal */
bool QFxItem::sceneEvent(QEvent *event)
{
bool rv = QGraphicsItem::sceneEvent(event);
@@ -2599,9 +2595,7 @@ bool QFxItem::sceneEvent(QEvent *event)
return rv;
}
-/*!
- \reimp
-*/
+/*! \internal */
QVariant QFxItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
@@ -2612,9 +2606,7 @@ QVariant QFxItem::itemChange(GraphicsItemChange change,
return QGraphicsItem::itemChange(change, value);
}
-/*!
- \reimp
-*/
+/*! \internal */
QRectF QFxItem::boundingRect() const
{
Q_D(const QFxItem);
@@ -2668,18 +2660,33 @@ void QFxItem::setTransformOrigin(TransformOrigin origin)
By default smooth transformations are off.
*/
+
+/*!
+ Returns true if the item should be drawn with antialiasing and
+ smooth pixmap filtering, false otherwise.
+
+ The default is false.
+
+ \sa setSmoothTransform()
+*/
bool QFxItem::smoothTransform() const
{
Q_D(const QFxItem);
return d->smooth;
}
-void QFxItem::setSmoothTransform(bool s)
+/*!
+ Sets whether the item should be drawn with antialiasing and
+ smooth pixmap filtering to \a smooth.
+
+ \sa smoothTransform()
+*/
+void QFxItem::setSmoothTransform(bool smooth)
{
Q_D(QFxItem);
- if (d->smooth == s)
+ if (d->smooth == smooth)
return;
- d->smooth = s;
+ d->smooth = smooth;
update();
}
@@ -2806,6 +2813,8 @@ bool QFxItem::heightValid() const
This property indicates whether the item has has an active focus request.
*/
+
+/*! \internal */
bool QFxItem::wantsFocus() const
{
return focusItem() != 0;
@@ -2816,11 +2825,14 @@ bool QFxItem::wantsFocus() const
This property indicates whether the item has keyboard input focus. Set this
property to true to request focus.
*/
+
+/*! \internal */
bool QFxItem::hasFocus() const
{
return QGraphicsItem::hasFocus();
}
+/*! \internal */
void QFxItem::setFocus(bool focus)
{
if (focus)
@@ -2831,6 +2843,7 @@ void QFxItem::setFocus(bool focus)
/*!
\reimp
+ \internal
*/
void QFxItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
{
@@ -2838,6 +2851,7 @@ void QFxItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
/*!
\reimp
+ \internal
*/
bool QFxItem::event(QEvent *ev)
{
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index 4b31fd4..315a273 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -319,8 +319,8 @@ void QFxMouseRegion::setEnabled(bool a)
\code
Text {
text: mr.pressedButtons & Qt.RightButton ? "right" : ""
- horizontalAlignment: "AlignHCenter"
- verticalAlignment: "AlignVCenter"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
MouseRegion {
id: mr
acceptedButtons: Qt.LeftButton | Qt.RightButton
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index 763256b..4a01cbd 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -231,9 +231,9 @@ QColor QFxText::color() const
\qml
Row {
Text { font.pointSize: 24; text: "Normal" }
- Text { font.pointSize: 24; text: "Raised"; style: "Raised"; styleColor: "#AAAAAA" }
- Text { font.pointSize: 24; text: "Outline"; style: "Outline"; styleColor: "red" }
- Text { font.pointSize: 24; text: "Sunken"; style: "Sunken"; styleColor: "#AAAAAA" }
+ Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" }
+ Text { font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" }
+ Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" }
}
\endqml
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g
index eb9a8ab..c5b2764 100644
--- a/src/declarative/qml/parser/qmljs.g
+++ b/src/declarative/qml/parser/qmljs.g
@@ -2949,7 +2949,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
const int errorState = state_stack[tos];
// automatic insertion of `;'
- if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
+ if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
SavedToken &tk = token_buffer[0];
tk.token = yytoken;
tk.dval = yylval;
diff --git a/src/declarative/qml/parser/qmljsgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp
index da3ce2a..2b92b82 100644
--- a/src/declarative/qml/parser/qmljsgrammar.cpp
+++ b/src/declarative/qml/parser/qmljsgrammar.cpp
@@ -4,7 +4,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 QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h
index b297f81..20d7188 100644
--- a/src/declarative/qml/parser/qmljsgrammar_p.h
+++ b/src/declarative/qml/parser/qmljsgrammar_p.h
@@ -4,7 +4,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 QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp
index 402aaeb..dd2553f 100644
--- a/src/declarative/qml/parser/qmljsparser.cpp
+++ b/src/declarative/qml/parser/qmljsparser.cpp
@@ -1713,7 +1713,7 @@ case 337: {
const int errorState = state_stack[tos];
// automatic insertion of `;'
- if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
+ if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
SavedToken &tk = token_buffer[0];
tk.token = yytoken;
tk.dval = yylval;
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index cbc2f85..6c00beb 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -116,6 +116,8 @@ HEADERS += qml/qmlparser_p.h \
# for qtscript debugger
contains(QT_CONFIG, scripttools):QT += scripttools
+QT += sql
+
include(parser/parser.pri)
include(rewriter/rewriter.pri)
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index ad74446..7a417bb 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -150,6 +150,8 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
}
/*!
+ \macro COMPILE_EXCEPTION
+ \internal
Inserts an error into the QmlCompiler error list, and returns false
(failure).
@@ -175,6 +177,8 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
}
/*!
+ \macro COMPILE_CHECK
+ \internal
Returns false if \a is false, otherwise does nothing.
*/
#define COMPILE_CHECK(a) \
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 3767695..6181f41 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -75,7 +75,7 @@ int statusId = qRegisterMetaType<QmlComponent::Status>("QmlComponent::Status");
\brief The Component element encapsulates a QML component description.
Components are reusable, encapsulated Qml element with a well-defined interface.
- They are often defined in \l {components}{Component Files}.
+ They are often defined in \l {qmldocuments.html}{Component Files}.
The \e Component element allows defining components within a QML file.
This can be useful for reusing a small component within a single QML
@@ -274,6 +274,10 @@ bool QmlComponent::isLoading() const
return status() == Loading;
}
+/*!
+ Returns he progress of loading the component, from 0.0 (nothing loaded)
+ to 1.0 (finished).
+*/
qreal QmlComponent::progress() const
{
Q_D(const QmlComponent);
@@ -281,6 +285,13 @@ qreal QmlComponent::progress() const
}
/*!
+ \fn void QmlComponent::progressChanged(qreal progress)
+
+ Emitted whenever the component's loading progress changes. \a progress will be the
+ current progress between 0.0 (nothing loaded) and 1.0 (finished).
+*/
+
+/*!
\fn void QmlComponent::statusChanged(QmlComponent::Status status)
Emitted whenever the component's status changes. \a status will be the
@@ -375,8 +386,9 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url)
QmlCompositeTypeData *typeData =
QmlEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url);
- if (typeData->status == QmlCompositeTypeData::Waiting) {
-
+ if (typeData->status == QmlCompositeTypeData::Waiting
+ || typeData->status == QmlCompositeTypeData::WaitingResources)
+ {
d->typeData = typeData;
d->typeData->addWaiter(d);
@@ -421,7 +433,9 @@ void QmlComponent::loadUrl(const QUrl &url)
QmlCompositeTypeData *data =
QmlEnginePrivate::get(d->engine)->typeManager.get(d->url);
- if (data->status == QmlCompositeTypeData::Waiting) {
+ if (data->status == QmlCompositeTypeData::Waiting
+ || data->status == QmlCompositeTypeData::WaitingResources)
+ {
d->typeData = data;
d->typeData->addWaiter(d);
d->progress = data->progress;
@@ -676,6 +690,9 @@ QmlComponentAttached::~QmlComponentAttached()
next = 0;
}
+/*!
+ \internal
+*/
QmlComponentAttached *QmlComponent::qmlAttachedProperties(QObject *obj)
{
QmlComponentAttached *a = new QmlComponentAttached(obj);
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 664ca3f..63be6b0 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -57,8 +57,8 @@ QmlEngineDebugServer::QmlEngineDebugServer(QObject *parent)
: QmlDebugService(QLatin1String("QmlEngine"), parent),
m_watch(new QmlWatcher(this))
{
- QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QByteArray,QVariant)),
- this, SLOT(propertyChanged(int,int,QByteArray,QVariant)));
+ QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)),
+ this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant)));
}
QDataStream &operator<<(QDataStream &ds,
@@ -110,9 +110,11 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
if (binding)
rv.binding = binding->expression();
+ QVariant value = prop.read(obj);
+ rv.value = valueContents(value);
+
if (prop.type() < QVariant::UserType) {
rv.type = QmlObjectProperty::Basic;
- rv.value = prop.read(obj);
} else if (QmlMetaType::isObject(prop.userType())) {
rv.type = QmlObjectProperty::Object;
} else if (QmlMetaType::isList(prop.userType()) ||
@@ -123,6 +125,32 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
return rv;
}
+QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const
+{
+ if (value.type() < QVariant::UserType)
+ return value;
+
+ int userType = value.userType();
+
+ if (QmlMetaType::isList(userType) || QmlMetaType::isQmlList(userType)) {
+ int count = QmlMetaType::listCount(value);
+ QVariantList contents;
+ for (int i=0; i<count; i++)
+ contents << valueContents(QmlMetaType::listAt(value, i));
+ return contents;
+ } else if (QmlMetaType::isObject(userType)) {
+ QObject *o = QmlMetaType::toQObject(value);
+ if (o) {
+ QString name = o->objectName();
+ if (name.isEmpty())
+ name = QLatin1String("<unnamed>");
+ return name;
+ }
+ }
+
+ return QLatin1String("<unknown value>");
+}
+
void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
QObject *object, bool recur)
{
@@ -188,32 +216,6 @@ void QmlEngineDebugServer::buildObjectList(QDataStream &message,
}
}
-QVariant QmlEngineDebugServer::serializableVariant(const QVariant &value)
-{
- if (value.type() < QVariant::UserType)
- return value;
-
- if (!value.toString().isEmpty())
- return value.toString();
-
- QVariant v;
- if (value.type() == QVariant::UserType || QmlMetaType::isObject(value.userType())) {
- QObject *o = QmlMetaType::toQObject(value);
- if (o) {
- QString objectName = o->objectName();
- if (objectName.isEmpty())
- objectName = QLatin1String("<unnamed>");
- v = QString::fromUtf8(o->metaObject()->className()) +
- QLatin1String(": ") + objectName;
- }
- }
-
- if (v.isNull())
- v = QString::fromUtf8(value.typeName());
-
- return v;
-}
-
QmlEngineDebugServer::QmlObjectData
QmlEngineDebugServer::objectData(QObject *object)
{
@@ -357,7 +359,7 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
if (undefined)
result = QLatin1String("<undefined>");
else
- result = serializableVariant(value);
+ result = valueContents(value);
delete exprObj;
} else {
result = QLatin1String("<unknown context>");
@@ -371,13 +373,12 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
}
}
-void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArray &property, const QVariant &value)
+void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value)
{
QByteArray reply;
- QVariant v = serializableVariant(value);
QDataStream rs(&reply, QIODevice::WriteOnly);
- rs << QByteArray("UPDATE_WATCH") << id << objectId << property << v;
+ rs << QByteArray("UPDATE_WATCH") << id << objectId << QString::fromUtf8(property.name()) << valueContents(value);
sendMessage(reply);
}
diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h
index 075a711..a8572eb 100644
--- a/src/declarative/qml/qmlenginedebug_p.h
+++ b/src/declarative/qml/qmlenginedebug_p.h
@@ -97,14 +97,14 @@ protected:
virtual void messageReceived(const QByteArray &);
private Q_SLOTS:
- void propertyChanged(int id, int objectId, const QByteArray &property, const QVariant &value);
+ void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value);
private:
void buildObjectList(QDataStream &, QmlContext *);
void buildObjectDump(QDataStream &, QObject *, bool);
QmlObjectData objectData(QObject *);
QmlObjectProperty propertyData(QObject *, int);
- QVariant serializableVariant(const QVariant &value);
+ QVariant valueContents(const QVariant &defaultValue) const;
static QList<QmlEngine *> m_engines;
QmlWatcher *m_watch;
diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qmlwatcher.cpp
index ca99472..8cd51e0 100644
--- a/src/declarative/qml/qmlwatcher.cpp
+++ b/src/declarative/qml/qmlwatcher.cpp
@@ -112,7 +112,7 @@ void QmlWatchProxy::notifyValueChanged()
else
v = m_property.read(m_object);
- emit m_watch->propertyChanged(m_id, m_debugId, QByteArray(m_property.name()), v);
+ emit m_watch->propertyChanged(m_id, m_debugId, m_property, v);
}
diff --git a/src/declarative/qml/qmlwatcher_p.h b/src/declarative/qml/qmlwatcher_p.h
index 99cae88..0bfcd71 100644
--- a/src/declarative/qml/qmlwatcher_p.h
+++ b/src/declarative/qml/qmlwatcher_p.h
@@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE
class QmlWatchProxy;
class QmlExpression;
class QmlContext;
+class QMetaProperty;
class QmlWatcher : public QObject
{
@@ -79,7 +80,7 @@ public:
void removeWatch(int id);
Q_SIGNALS:
- void propertyChanged(int id, int objectId, const QByteArray &property, const QVariant &value);
+ void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value);
private:
friend class QmlWatchProxy;
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 7ccccec..9c9fa6a 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -809,6 +809,12 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
QML_DEFINE_CUSTOM_TYPE(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, ListModel, QmlListModel, QmlListModelParser)
+/*!
+ \qmlclass ListElement
+ \brief The ListElement element defines a data item in a ListModel.
+
+ \sa ListModel
+*/
// ### FIXME
class QmlListElement : public QObject
{
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 7e4e992..425480c 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -134,7 +134,7 @@ QmlStateOperation::QmlStateOperation(QObjectPrivate &dd, QObject *parent)
inadvisible. Not only would this have the same effect as going directly to the second state
it may cause the program to crash.
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstates}{States}, {state-transitions}{Transitions}
*/
/*!
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 66275d9..97a3b74 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\qmlclass Transition QmlTransition
\brief The Transition element defines animated transitions that occur on state changes.
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstates}{States}, {state-transitions}{Transitions}
*/
/*!
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp
index f91d0db..329a9b2 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -386,7 +386,7 @@ void QmlView::continueExecute()
*/
/*! \fn void QmlView::initialSize(QSize size)
- This signal is emitted when the initial size of the root item is known.
+ This signal is emitted when the initial \a size of the root item is known.
*/
/*! \fn void QmlView::errors(const QList<QmlError> &errors)
diff --git a/tests/auto/declarative/anchors/anchors.pro b/tests/auto/declarative/anchors/anchors.pro
index 7b22cfb..1e25a90 100644
--- a/tests/auto/declarative/anchors/anchors.pro
+++ b/tests/auto/declarative/anchors/anchors.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
SOURCES += tst_anchors.cpp
+macx:CONFIG -= app_bundle
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/animatedimage/animatedimage.pro b/tests/auto/declarative/animatedimage/animatedimage.pro
index 8a92863..4ff9db4 100644
--- a/tests/auto/declarative/animatedimage/animatedimage.pro
+++ b/tests/auto/declarative/animatedimage/animatedimage.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
SOURCES += tst_animatedimage.cpp
+macx:CONFIG -= app_bundle
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/animations/animations.pro b/tests/auto/declarative/animations/animations.pro
index 419da4e..e13ecb9 100644
--- a/tests/auto/declarative/animations/animations.pro
+++ b/tests/auto/declarative/animations/animations.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
SOURCES += tst_animations.cpp
+macx:CONFIG -= app_bundle
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
index 336f0d3..a6f67b8 100644
--- a/tests/auto/declarative/animations/tst_animations.cpp
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -21,6 +21,15 @@ private slots:
void mixedTypes();
};
+#define QTIMED_COMPARE(lhs, rhs) do { \
+ for (int ii = 0; ii < 5; ++ii) { \
+ if (lhs == rhs) \
+ break; \
+ QTest::qWait(50); \
+ } \
+ QCOMPARE(lhs, rhs); \
+} while (false)
+
void tst_animations::simpleNumber()
{
QFxRect rect;
@@ -29,8 +38,8 @@ void tst_animations::simpleNumber()
animation.setProperty("x");
animation.setTo(200);
animation.start();
- QTest::qWait(animation.duration() + 50);
- QCOMPARE(rect.x(), qreal(200));
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.x(), qreal(200));
rect.setX(0);
animation.start();
@@ -47,8 +56,8 @@ void tst_animations::simpleColor()
animation.setProperty("color");
animation.setTo(QColor("red"));
animation.start();
- QTest::qWait(animation.duration() + 50);
- QCOMPARE(rect.color(), QColor("red"));
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.color(), QColor("red"));
rect.setColor(QColor("blue"));
animation.start();
@@ -71,8 +80,8 @@ void tst_animations::alwaysRunToEnd()
QTest::qWait(1500);
animation.stop();
QVERIFY(rect.x() != qreal(200));
- QTest::qWait(500 + 50);
- QCOMPARE(rect.x(), qreal(200));
+ QTest::qWait(500);
+ QTIMED_COMPARE(rect.x(), qreal(200));
}
void tst_animations::dotProperty()
@@ -83,8 +92,8 @@ void tst_animations::dotProperty()
animation.setProperty("border.width");
animation.setTo(10);
animation.start();
- QTest::qWait(animation.duration() + 50);
- QCOMPARE(rect.border()->width(), 10);
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.border()->width(), 10);
rect.border()->setWidth(0);
animation.start();
diff --git a/tests/auto/declarative/behaviors/behaviors.pro b/tests/auto/declarative/behaviors/behaviors.pro
index c96d2c0..8886b0c 100644
--- a/tests/auto/declarative/behaviors/behaviors.pro
+++ b/tests/auto/declarative/behaviors/behaviors.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
SOURCES += tst_behaviors.cpp
+macx:CONFIG -= app_bundle
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/datetimeformatter/datetimeformatter.pro b/tests/auto/declarative/datetimeformatter/datetimeformatter.pro
index e3d6cd0..62eb303 100644
--- a/tests/auto/declarative/datetimeformatter/datetimeformatter.pro
+++ b/tests/auto/declarative/datetimeformatter/datetimeformatter.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_datetimeformatter.cpp
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 8b1c9cd..b9ab3ca 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -21,6 +21,7 @@ SUBDIRS += anchors \
qmllist \
qmllistaccessor \
qmlmetaproperty \
+ qmlpropertymap \
qmltimer \
repeater \
sql \
diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro
index c50018e..b9bcd28 100644
--- a/tests/auto/declarative/examples/examples.pro
+++ b/tests/auto/declarative/examples/examples.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
-SOURCES += tst_examples.cpp
macx:CONFIG -= app_bundle
+
+SOURCES += tst_examples.cpp
diff --git a/tests/auto/declarative/layouts/layouts.pro b/tests/auto/declarative/layouts/layouts.pro
index f7e7622..f38e155 100644
--- a/tests/auto/declarative/layouts/layouts.pro
+++ b/tests/auto/declarative/layouts/layouts.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
SOURCES += tst_layouts.cpp
+macx:CONFIG -= app_bundle
# Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/listview/listview.pro b/tests/auto/declarative/listview/listview.pro
index bf68268..23b0706 100644
--- a/tests/auto/declarative/listview/listview.pro
+++ b/tests/auto/declarative/listview/listview.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_listview.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/numberformatter/numberformatter.pro b/tests/auto/declarative/numberformatter/numberformatter.pro
index ba391ed..ed7ef22 100644
--- a/tests/auto/declarative/numberformatter/numberformatter.pro
+++ b/tests/auto/declarative/numberformatter/numberformatter.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_numberformatter.cpp
diff --git a/tests/auto/declarative/pathview/pathview.pro b/tests/auto/declarative/pathview/pathview.pro
index 28bbe49..bddd1e6 100644
--- a/tests/auto/declarative/pathview/pathview.pro
+++ b/tests/auto/declarative/pathview/pathview.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_pathview.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/qfxloader/qfxloader.pro b/tests/auto/declarative/qfxloader/qfxloader.pro
index 643c18c..aee52cc 100644
--- a/tests/auto/declarative/qfxloader/qfxloader.pro
+++ b/tests/auto/declarative/qfxloader/qfxloader.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qfxloader.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro b/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro
index e9b0417..218eeff 100644
--- a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro
+++ b/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro
@@ -1,9 +1,9 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
QT += network
-SOURCES += tst_qfxpixmapcache.cpp
-HEADERS =
macx:CONFIG -= app_bundle
+SOURCES += tst_qfxpixmapcache.cpp
+
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov
diff --git a/tests/auto/declarative/qfxtext/qfxtext.pro b/tests/auto/declarative/qfxtext/qfxtext.pro
index f705334..1f3fe37 100644
--- a/tests/auto/declarative/qfxtext/qfxtext.pro
+++ b/tests/auto/declarative/qfxtext/qfxtext.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qfxtext.cpp
diff --git a/tests/auto/declarative/qfxtextedit/qfxtextedit.pro b/tests/auto/declarative/qfxtextedit/qfxtextedit.pro
index 90546a4..b5e0464 100644
--- a/tests/auto/declarative/qfxtextedit/qfxtextedit.pro
+++ b/tests/auto/declarative/qfxtextedit/qfxtextedit.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qfxtextedit.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/qfxtextinput/data/cursorTest.qml b/tests/auto/declarative/qfxtextinput/data/cursorTest.qml
new file mode 100644
index 0000000..ddc98cc
--- /dev/null
+++ b/tests/auto/declarative/qfxtextinput/data/cursorTest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Rectangle { width: 300; height: 300; color: "white"
+ TextInput { text: "Hello world!"; id: textInputObject; objectName: "textInputObject"
+ resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance";} } ]
+ cursorDelegate: cursor
+ }
+}
diff --git a/tests/auto/declarative/qfxtextinput/qfxtextinput.pro b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro
index 396e66d..fe2e3e3 100644
--- a/tests/auto/declarative/qfxtextinput/qfxtextinput.pro
+++ b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qfxtextinput.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/qfxwebview/qfxwebview.pro b/tests/auto/declarative/qfxwebview/qfxwebview.pro
index ee78950..b75e057 100644
--- a/tests/auto/declarative/qfxwebview/qfxwebview.pro
+++ b/tests/auto/declarative/qfxwebview/qfxwebview.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qfxwebview.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/qmldom/qmldom.pro b/tests/auto/declarative/qmldom/qmldom.pro
index d566354..7ff317d 100644
--- a/tests/auto/declarative/qmldom/qmldom.pro
+++ b/tests/auto/declarative/qmldom/qmldom.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmldom.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlecmascript/qmlecmascript.pro b/tests/auto/declarative/qmlecmascript/qmlecmascript.pro
index ff4d20f..46ae045 100644
--- a/tests/auto/declarative/qmlecmascript/qmlecmascript.pro
+++ b/tests/auto/declarative/qmlecmascript/qmlecmascript.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
macx:CONFIG -= app_bundle
+
SOURCES += tst_qmlecmascript.cpp \
testtypes.cpp
HEADERS += testtypes.h
diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml
new file mode 100644
index 0000000..93c7630
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Image {}
diff --git a/tests/auto/declarative/qmllanguage/qmllanguage.pro b/tests/auto/declarative/qmllanguage/qmllanguage.pro
index 4e4be9c..80228a9 100644
--- a/tests/auto/declarative/qmllanguage/qmllanguage.pro
+++ b/tests/auto/declarative/qmllanguage/qmllanguage.pro
@@ -1,9 +1,10 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmllanguage.cpp \
testtypes.cpp
HEADERS += testtypes.h
-macx:CONFIG -= app_bundle
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index 2746e98..6494c40 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -7,6 +7,9 @@
#include <QtCore/qdir.h>
#include "testtypes.h"
+#include "../../../shared/util.h"
+#include "../../network-settings.h"
+
/*
This test case covers QML language issues. This covers everything that does
involve evaluating ECMAScript expressions and bindings.
@@ -69,6 +72,8 @@ private slots:
void importsBuiltin();
void importsLocal_data();
void importsLocal();
+ void importsRemote_data();
+ void importsRemote();
void importsInstalled_data();
void importsInstalled();
void importsOrder_data();
@@ -805,6 +810,8 @@ void tst_qmllanguage::testType(const QString& qml, const QString& type)
{
QmlComponent component(&engine, qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports
+ QTRY_VERIFY(!component.isLoading());
+
if (type.isEmpty()) {
QVERIFY(component.isError());
} else {
@@ -824,8 +831,12 @@ QML_DEFINE_TYPE(com.nokia.Test, 1, 8, 9, Test, TestType2)
QML_DEFINE_TYPE(com.nokia.Test, 1, 12, 13, Test, TestType2)
QML_DEFINE_TYPE(com.nokia.Test, 1, 9, 11, OldTest, TestType)
+// Import tests (QT-558)
+
void tst_qmllanguage::importsBuiltin_data()
{
+ // QT-610
+
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
@@ -842,7 +853,7 @@ void tst_qmllanguage::importsBuiltin_data()
"Test {}"
<< "TestType";
QTest::newRow("qualified wrong")
- << "import com.nokia.Test 1.0 as T\n"
+ << "import com.nokia.Test 1.0 as T\n" // QT-610
"Test {}"
<< "";
QTest::newRow("qualified right")
@@ -934,7 +945,7 @@ void tst_qmllanguage::importsLocal_data()
// import locals
QTest::newRow("local import")
- << "import \"subdir\"\n"
+ << "import \"subdir\"\n" // QT-613
"Test {}"
<< "QFxRect";
QTest::newRow("local import as")
@@ -959,20 +970,47 @@ void tst_qmllanguage::importsLocal()
testType(qml,type);
}
+void tst_qmllanguage::importsRemote_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ QString serverdir = "http://"
+ + QtNetworkSettings::serverName()
+ + "/qtest/declarative/qmllanguage";
+
+ QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QFxRect";
+ QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QFxText";
+ QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QFxImage";
+}
+
+void tst_qmllanguage::importsRemote()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
void tst_qmllanguage::importsInstalled_data()
{
+ // QT-610
+
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
// import installed
- QTest::newRow("installed import")
+ QTest::newRow("installed import 1")
<< "import com.nokia.installedtest 1.0\n"
"InstalledTest {}"
<< "QFxRect";
- QTest::newRow("installed import")
+ QTest::newRow("installed import 2")
<< "import com.nokia.installedtest 1.4\n"
"InstalledTest {}"
<< "QFxText";
+ QTest::newRow("installed import visibility") // QT-614
+ << "import com.nokia.installedtest 1.4\n"
+ "PrivateType {}"
+ << "";
}
void tst_qmllanguage::importsInstalled()
diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllist/qmllist.pro
index e5558f1..b2145ed 100644
--- a/tests/auto/declarative/qmllist/qmllist.pro
+++ b/tests/auto/declarative/qmllist/qmllist.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmllist.cpp
diff --git a/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro b/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro
index 4aa0450..ce2915e 100644
--- a/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro
+++ b/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmllistaccessor.cpp
diff --git a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro
index af67373..542c14e 100644
--- a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro
+++ b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmlmetaproperty.cpp
diff --git a/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro b/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro
index 94f138f..967ab76 100644
--- a/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro
+++ b/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro
@@ -1,3 +1,5 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmlpropertymap.cpp
diff --git a/tests/auto/declarative/qmltimer/qmltimer.pro b/tests/auto/declarative/qmltimer/qmltimer.pro
index e7edd96..2b244ed 100644
--- a/tests/auto/declarative/qmltimer/qmltimer.pro
+++ b/tests/auto/declarative/qmltimer/qmltimer.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
SOURCES += tst_qmltimer.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/repeater/repeater.pro b/tests/auto/declarative/repeater/repeater.pro
index 1d30b7b..968904b 100644
--- a/tests/auto/declarative/repeater/repeater.pro
+++ b/tests/auto/declarative/repeater/repeater.pro
@@ -1,7 +1,8 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
-SOURCES += tst_repeater.cpp
macx:CONFIG -= app_bundle
+SOURCES += tst_repeater.cpp
+
# Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/sql/data/4-iteration-index.js b/tests/auto/declarative/sql/data/4-iteration-index.js
new file mode 100644
index 0000000..298737d
--- /dev/null
+++ b/tests/auto/declarative/sql/data/4-iteration-index.js
@@ -0,0 +1,27 @@
+var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
+var r=0;
+
+db.transaction(
+ function(tx) {
+ tx.executeSql('SELECT * FROM Greeting', [],
+ function(tx, rs) {
+ var r1=""
+ for(var i = 0; i < rs.rows.length; i++) {
+ r1 += rs.rows[i].salutation + ", " + rs.rows[i].salutee + ";"
+ }
+ if (r1 != "hello, world;hello, world;hello, world;hello, world;")
+ r = "SELECTED DATA WRONG: "+r1;
+ },
+ function(tx, error) { if (r==0) r="SELECT FAILED: "+error.message }
+ );
+ },
+ function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message },
+ function(tx, result) { if (r==0) r="passed" }
+);
+
+
+function test()
+{
+ if (r == 0) r = "transaction_not_finished";
+ return r;
+}
diff --git a/tests/auto/declarative/sql/sql.pro b/tests/auto/declarative/sql/sql.pro
index 36a867f..48e06a2 100644
--- a/tests/auto/declarative/sql/sql.pro
+++ b/tests/auto/declarative/sql/sql.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_sql.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp
index 22e9ba4..0ebdccd 100644
--- a/tests/auto/declarative/sql/tst_sql.cpp
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -86,7 +86,7 @@ QString tst_sql::dbDir() const
void tst_sql::checkDatabasePath()
{
// Check default storage path (we can't use it since we don't want to mess with user's data)
- QVERIFY(engine->offlineStoragePath().contains("Nokia"));
+ QVERIFY(engine->offlineStoragePath().contains("tst_sql"));
QVERIFY(engine->offlineStoragePath().contains("OfflineStorage"));
}
diff --git a/tests/auto/declarative/states/states.pro b/tests/auto/declarative/states/states.pro
index 0474ea5..a1f3b02 100644
--- a/tests/auto/declarative/states/states.pro
+++ b/tests/auto/declarative/states/states.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
SOURCES += tst_states.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/declarative/visual/visual.pro b/tests/auto/declarative/visual/visual.pro
index a06fa21..7ae2bed 100644
--- a/tests/auto/declarative/visual/visual.pro
+++ b/tests/auto/declarative/visual/visual.pro
@@ -1,6 +1,7 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
-SOURCES += tst_visual.cpp
macx:CONFIG -= app_bundle
+SOURCES += tst_visual.cpp
+
DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
diff --git a/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp b/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp
index aec661c..5881cd1 100644
--- a/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp
+++ b/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp
@@ -168,10 +168,17 @@ void QmlInspectorMode::connectionStateChanged()
switch (m_conn->state()) {
default:
case QAbstractSocket::UnconnectedState:
+ {
emit statusMessage(tr("[Inspector] disconnected.\n\n"));
m_addressEdit->setEnabled(true);
m_portSpinBox->setEnabled(true);
+
+ delete m_engineQuery;
+ m_engineQuery = 0;
+ delete m_contextQuery;
+ m_contextQuery = 0;
break;
+ }
case QAbstractSocket::HostLookupState:
emit statusMessage(tr("[Inspector] resolving host..."));
break;
@@ -378,7 +385,7 @@ void QmlInspectorMode::initWidgets()
m_propertiesWidget = new ObjectPropertiesView;
m_watchTableView = new WatchTableView(m_watchTableModel);
m_frameRateWidget = new CanvasFrameRate;
- m_expressionWidget = new ExpressionQueryWidget;
+ m_expressionWidget = new ExpressionQueryWidget(ExpressionQueryWidget::ShellMode);
// FancyMainWindow uses widgets' window titles for tab labels
m_objectTreeWidget->setWindowTitle(tr("Object Tree"));
diff --git a/tools/qmldebugger/standalone/engine.cpp b/tools/qmldebugger/standalone/engine.cpp
index a1fd009..f1eada8 100644
--- a/tools/qmldebugger/standalone/engine.cpp
+++ b/tools/qmldebugger/standalone/engine.cpp
@@ -86,7 +86,7 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent)
connect(m_watchTableView, SIGNAL(objectActivated(int)),
m_objTree, SLOT(setCurrentObject(int)));
- m_exprQueryWidget = new ExpressionQueryWidget(m_client);
+ m_exprQueryWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode, m_client);
connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
m_exprQueryWidget, SLOT(setCurrentObject(QmlDebugObjectReference)));
diff --git a/tools/qmldebugger/standalone/expressionquerywidget.cpp b/tools/qmldebugger/standalone/expressionquerywidget.cpp
index f8f5aef..e064189 100644
--- a/tools/qmldebugger/standalone/expressionquerywidget.cpp
+++ b/tools/qmldebugger/standalone/expressionquerywidget.cpp
@@ -11,9 +11,9 @@
#include "expressionquerywidget.h"
-ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *parent)
+ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QmlEngineDebug *client, QWidget *parent)
: QWidget(parent),
- m_style(Compact),
+ m_mode(mode),
m_client(client),
m_query(0),
m_textEdit(new QTextEdit),
@@ -28,7 +28,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa
updateTitle();
- if (m_style == Compact) {
+ if (m_mode == SeparateEntryMode) {
m_lineEdit = new QLineEdit;
connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression()));
QHBoxLayout *hbox = new QHBoxLayout;
@@ -42,6 +42,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa
m_lineEdit->installEventFilter(this);
} else {
m_textEdit->installEventFilter(this);
+ appendPrompt();
}
}
@@ -53,7 +54,10 @@ void ExpressionQueryWidget::setEngineDebug(QmlEngineDebug *client)
void ExpressionQueryWidget::clear()
{
m_textEdit->clear();
- m_lineEdit->clear();
+ if (m_lineEdit)
+ m_lineEdit->clear();
+ if (m_mode == ShellMode)
+ appendPrompt();
}
void ExpressionQueryWidget::updateTitle()
@@ -73,7 +77,7 @@ void ExpressionQueryWidget::appendPrompt()
{
m_textEdit->moveCursor(QTextCursor::End);
- if (m_style == Compact) {
+ if (m_mode == SeparateEntryMode) {
m_textEdit->insertPlainText("\n");
} else {
m_textEdit->setTextColor(Qt::gray);
@@ -98,6 +102,12 @@ void ExpressionQueryWidget::checkCurrentContext()
void ExpressionQueryWidget::showCurrentContext()
{
+ if (m_mode == ShellMode) {
+ // clear the initial prompt
+ if (m_textEdit->document()->lineCount() == 1)
+ m_textEdit->clear();
+ }
+
m_textEdit->moveCursor(QTextCursor::End);
m_textEdit->setTextColor(Qt::darkGreen);
m_textEdit->append(m_currObject.className()
@@ -111,7 +121,7 @@ void ExpressionQueryWidget::executeExpression()
if (!m_client)
return;
- if (m_style == Compact)
+ if (m_mode == SeparateEntryMode)
m_expr = m_lineEdit->text().trimmed();
else
m_expr = m_expr.trimmed();
@@ -136,20 +146,31 @@ void ExpressionQueryWidget::showResult()
{
if (m_query) {
m_textEdit->moveCursor(QTextCursor::End);
+ QVariant value = m_query->result();
QString result;
- if (m_query->result().isNull())
+
+ if (value.isNull()) {
result = QLatin1String("<no value>");
- else
- result = m_query->result().toString();
+ } else {
+ if (value.canConvert(QVariant::String)) {
+ result = value.toString();
+ } else {
+ QDebug debug(&result);
+ debug << value;
+ }
+ }
- if (m_style == Compact) {
+ if (m_mode == SeparateEntryMode) {
m_textEdit->setTextColor(Qt::black);
m_textEdit->setFontWeight(QFont::Bold);
m_textEdit->insertPlainText(m_expr + " : ");
m_textEdit->setFontWeight(QFont::Normal);
m_textEdit->insertPlainText(result);
} else {
- m_textEdit->append(result);
+ m_textEdit->setTextColor(Qt::darkGreen);
+ m_textEdit->insertPlainText(" => ");
+ m_textEdit->setTextColor(Qt::black);
+ m_textEdit->insertPlainText(result);
}
appendPrompt();
m_expr.clear();
diff --git a/tools/qmldebugger/standalone/expressionquerywidget.h b/tools/qmldebugger/standalone/expressionquerywidget.h
index 6fab059..3fe0295 100644
--- a/tools/qmldebugger/standalone/expressionquerywidget.h
+++ b/tools/qmldebugger/standalone/expressionquerywidget.h
@@ -16,12 +16,12 @@ class ExpressionQueryWidget : public QWidget
{
Q_OBJECT
public:
- enum Style {
- Compact,
- Shell
+ enum Mode {
+ SeparateEntryMode,
+ ShellMode
};
- ExpressionQueryWidget(QmlEngineDebug *client = 0, QWidget *parent = 0);
+ ExpressionQueryWidget(Mode mode = SeparateEntryMode, QmlEngineDebug *client = 0, QWidget *parent = 0);
void setEngineDebug(QmlEngineDebug *client);
void clear();
@@ -42,7 +42,7 @@ private:
void showCurrentContext();
void updateTitle();
- Style m_style;
+ Mode m_mode;
QmlEngineDebug *m_client;
QmlDebugExpressionQuery *m_query;
diff --git a/tools/qmldebugger/standalone/objectpropertiesview.cpp b/tools/qmldebugger/standalone/objectpropertiesview.cpp
index f86a69e..d6fefa0 100644
--- a/tools/qmldebugger/standalone/objectpropertiesview.cpp
+++ b/tools/qmldebugger/standalone/objectpropertiesview.cpp
@@ -16,19 +16,25 @@ class PropertiesViewItem : public QObject, public QTreeWidgetItem
{
Q_OBJECT
public:
- PropertiesViewItem(QTreeWidget *widget);
- PropertiesViewItem(QTreeWidgetItem *parent);
+ enum Type {
+ BindingType,
+ OtherType
+ };
+
+ PropertiesViewItem(QTreeWidget *widget, Type type = OtherType);
+ PropertiesViewItem(QTreeWidgetItem *parent, Type type = OtherType);
QmlDebugPropertyReference property;
+ Type type;
};
-PropertiesViewItem::PropertiesViewItem(QTreeWidget *widget)
- : QTreeWidgetItem(widget)
+PropertiesViewItem::PropertiesViewItem(QTreeWidget *widget, Type type)
+ : QTreeWidgetItem(widget), type(type)
{
}
-PropertiesViewItem::PropertiesViewItem(QTreeWidgetItem *parent)
- : QTreeWidgetItem(parent)
+PropertiesViewItem::PropertiesViewItem(QTreeWidgetItem *parent, Type type)
+ : QTreeWidgetItem(parent), type(type)
{
}
@@ -109,6 +115,42 @@ void ObjectPropertiesView::queryFinished()
setObject(obj);
}
+void ObjectPropertiesView::setPropertyValue(PropertiesViewItem *item, const QVariant &value, bool makeGray)
+{
+ if (value.type() == QVariant::List || value.type() == QVariant::StringList) {
+ PropertiesViewItem *bindingItem = static_cast<PropertiesViewItem*>(item->takeChild(item->childCount() - 1));
+ if (bindingItem && bindingItem->type != PropertiesViewItem::BindingType) {
+ delete bindingItem;
+ bindingItem = 0;
+ }
+
+ qDeleteAll(item->takeChildren());
+
+ QVariantList variants = value.toList();
+ item->setText(1, tr("<%1 items>", "%1 = number of items").arg(variants.count()));
+ item->setText(2, QString::fromUtf8(value.typeName()));
+
+ PropertiesViewItem *child;
+ for (int i=0; i<variants.count(); i++) {
+ child = new PropertiesViewItem(item);
+ setPropertyValue(child, variants[i], makeGray);
+ }
+
+ if (bindingItem)
+ item->addChild(bindingItem);
+
+ item->setExpanded(false);
+ } else {
+ item->setText(1, (value.isNull() ? QLatin1String("<null>") : value.toString()));
+ item->setExpanded(true);
+ }
+
+ if (makeGray) {
+ for (int i=0; i<m_tree->columnCount(); i++)
+ item->setForeground(i, Qt::gray);
+ }
+}
+
void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object)
{
m_object = object;
@@ -123,20 +165,17 @@ void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object)
item->setText(0, p.name());
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
- if (!p.hasNotifySignal()) {
- item->setForeground(0, Qt::gray);
- item->setForeground(1, Qt::gray);
- }
+
+ setPropertyValue(item, p.value(), !p.hasNotifySignal());
+ item->setText(2, p.valueTypeName());
+ // binding is set after property value to ensure it is added to the end of the
+ // list, if the value is a list
if (!p.binding().isEmpty()) {
- PropertiesViewItem *binding = new PropertiesViewItem(item);
+ PropertiesViewItem *binding = new PropertiesViewItem(item, PropertiesViewItem::BindingType);
binding->setText(1, p.binding());
binding->setForeground(1, Qt::darkGreen);
}
-
- item->setText(2, p.valueTypeName());
-
- item->setExpanded(true);
}
}
@@ -177,11 +216,8 @@ void ObjectPropertiesView::valueChanged(const QByteArray &name, const QVariant &
for (int i=0; i<m_tree->topLevelItemCount(); i++) {
PropertiesViewItem *item = static_cast<PropertiesViewItem *>(m_tree->topLevelItem(i));
if (item->property.name() == name) {
- if (value.isNull()) {
- item->setText(1, QLatin1String("<null>"));
- } else {
- item->setText(1, value.toString());
- }
+ setPropertyValue(item, value, !item->property.hasNotifySignal());
+ return;
}
}
}
diff --git a/tools/qmldebugger/standalone/objectpropertiesview.h b/tools/qmldebugger/standalone/objectpropertiesview.h
index 6a1fc03..306e5b9 100644
--- a/tools/qmldebugger/standalone/objectpropertiesview.h
+++ b/tools/qmldebugger/standalone/objectpropertiesview.h
@@ -10,6 +10,7 @@ QT_BEGIN_NAMESPACE
class QTreeWidget;
class QTreeWidgetItem;
class QmlDebugConnection;
+class PropertiesViewItem;
class ObjectPropertiesView : public QWidget
{
@@ -36,6 +37,7 @@ private slots:
private:
void setObject(const QmlDebugObjectReference &object);
void setWatched(const QString &property, bool watched);
+ void setPropertyValue(PropertiesViewItem *item, const QVariant &value, bool makeGray);
QmlEngineDebug *m_client;
QmlDebugObjectQuery *m_query;
diff --git a/tools/qmldebugger/standalone/objecttree.cpp b/tools/qmldebugger/standalone/objecttree.cpp
index 4059e77..6c132b6 100644
--- a/tools/qmldebugger/standalone/objecttree.cpp
+++ b/tools/qmldebugger/standalone/objecttree.cpp
@@ -61,6 +61,7 @@ void ObjectTree::objectFetched()
{
dump(m_query->object(), 0);
buildTree(m_query->object(), 0);
+ setCurrentItem(topLevelItem(0));
delete m_query;
m_query = 0;
diff --git a/tools/qmldebugger/standalone/objecttree.h b/tools/qmldebugger/standalone/objecttree.h
index 95820f3..ba2e78f 100644
--- a/tools/qmldebugger/standalone/objecttree.h
+++ b/tools/qmldebugger/standalone/objecttree.h
@@ -27,8 +27,8 @@ signals:
void expressionWatchRequested(const QmlDebugObjectReference &, const QString &);
public slots:
- void reload(int objectDebugId);
- void setCurrentObject(int debugId);
+ void reload(int objectDebugId); // set the root object
+ void setCurrentObject(int debugId); // select an object in the tree
protected:
virtual void mousePressEvent(QMouseEvent *);
diff --git a/tools/qmldebugger/standalone/watchtable.cpp b/tools/qmldebugger/standalone/watchtable.cpp
index a7fd052..19f034e 100644
--- a/tools/qmldebugger/standalone/watchtable.cpp
+++ b/tools/qmldebugger/standalone/watchtable.cpp
@@ -265,7 +265,8 @@ void WatchTableModel::removeAllWatches()
for (int i=0; i<m_columns.count(); i++) {
if (m_client)
m_client->removeWatch(m_columns[i].watch);
- delete m_columns[i].watch;
+ else
+ delete m_columns[i].watch;
}
m_columns.clear();
m_values.clear();