diff options
73 files changed, 2 insertions, 7165 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 Binary files differdeleted file mode 100644 index d33e0c7..0000000 --- a/demos/declarative/contacts/contacts.sqlite +++ /dev/null diff --git a/demos/declarative/contacts/pics/cancel.png b/demos/declarative/contacts/pics/cancel.png Binary files differdeleted file mode 100644 index ecc9533..0000000 --- a/demos/declarative/contacts/pics/cancel.png +++ /dev/null diff --git a/demos/declarative/contacts/pics/email.png b/demos/declarative/contacts/pics/email.png Binary files differdeleted file mode 100644 index 04b3865..0000000 --- a/demos/declarative/contacts/pics/email.png +++ /dev/null diff --git a/demos/declarative/contacts/pics/new.png b/demos/declarative/contacts/pics/new.png Binary files differdeleted file mode 100644 index c7ebac3..0000000 --- a/demos/declarative/contacts/pics/new.png +++ /dev/null diff --git a/demos/declarative/contacts/pics/ok.png b/demos/declarative/contacts/pics/ok.png Binary files differdeleted file mode 100644 index 5795f04..0000000 --- a/demos/declarative/contacts/pics/ok.png +++ /dev/null diff --git a/demos/declarative/contacts/pics/phone.png b/demos/declarative/contacts/pics/phone.png Binary files differdeleted file mode 100644 index fc9c222..0000000 --- a/demos/declarative/contacts/pics/phone.png +++ /dev/null diff --git a/demos/declarative/contacts/pics/search.png b/demos/declarative/contacts/pics/search.png Binary files differdeleted file mode 100644 index cc74e69..0000000 --- a/demos/declarative/contacts/pics/search.png +++ /dev/null diff --git a/demos/declarative/contacts/pics/trash.png b/demos/declarative/contacts/pics/trash.png Binary files differdeleted file mode 100644 index 2042595..0000000 --- a/demos/declarative/contacts/pics/trash.png +++ /dev/null diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 3ea5989..0eda95e 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -88,7 +88,6 @@ The following table lists the QML elements provided by the Qt Declarative module \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/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/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/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 Binary files differdeleted file mode 100644 index d903775..0000000 --- a/examples/declarative/tutorials/contacts/shared/contacts.sqlite +++ /dev/null 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 Binary files differdeleted file mode 100644 index ecc9533..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/cancel.png +++ /dev/null diff --git a/examples/declarative/tutorials/contacts/shared/pics/email.png b/examples/declarative/tutorials/contacts/shared/pics/email.png Binary files differdeleted file mode 100644 index 04b3865..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/email.png +++ /dev/null diff --git a/examples/declarative/tutorials/contacts/shared/pics/new.png b/examples/declarative/tutorials/contacts/shared/pics/new.png Binary files differdeleted file mode 100644 index c7ebac3..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/new.png +++ /dev/null diff --git a/examples/declarative/tutorials/contacts/shared/pics/ok.png b/examples/declarative/tutorials/contacts/shared/pics/ok.png Binary files differdeleted file mode 100644 index 5795f04..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/ok.png +++ /dev/null diff --git a/examples/declarative/tutorials/contacts/shared/pics/phone.png b/examples/declarative/tutorials/contacts/shared/pics/phone.png Binary files differdeleted file mode 100644 index fc9c222..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/phone.png +++ /dev/null diff --git a/examples/declarative/tutorials/contacts/shared/pics/search.png b/examples/declarative/tutorials/contacts/shared/pics/search.png Binary files differdeleted file mode 100644 index cc74e69..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/search.png +++ /dev/null diff --git a/examples/declarative/tutorials/contacts/shared/pics/trash.png b/examples/declarative/tutorials/contacts/shared/pics/trash.png Binary files differdeleted file mode 100644 index 2042595..0000000 --- a/examples/declarative/tutorials/contacts/shared/pics/trash.png +++ /dev/null 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/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) |