summaryrefslogtreecommitdiffstats
path: root/demos/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-28 08:30:54 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-28 08:30:54 (GMT)
commit6652eccc7bf7c749838c9e8df13a827937ddc417 (patch)
tree6806f1bc2e4b9922eb179b69e0f829ef8ffb13c6 /demos/declarative
parent6a9825e8d983efad092be1c97f4bf885fc378aaa (diff)
downloadQt-6652eccc7bf7c749838c9e8df13a827937ddc417.zip
Qt-6652eccc7bf7c749838c9e8df13a827937ddc417.tar.gz
Qt-6652eccc7bf7c749838c9e8df13a827937ddc417.tar.bz2
Remove QML SQL classes
Sadly, these are not being maintained. There's still SQL offline storage for all your SQL needs.
Diffstat (limited to 'demos/declarative')
-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
15 files changed, 0 insertions, 857 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 1e89793..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: Text.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 0cb013e..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: Text.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