diff options
author | Alan Alpert <aalpert@rim.com> | 2013-01-23 14:08:58 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-12 23:25:48 +0100 |
commit | 700910d938c75c978f765ec8438f81e70676999a (patch) | |
tree | 37a8397a13e3217db8140acf85644c8df452aca9 /examples/quick | |
parent | fa8a4beb157f82e02cf8471ade7da0faee7a9fa1 (diff) |
Add QtQml.Models module
The moved Model classes can now be exposed in a QtQml import.
To keep the QtQml import resticted to more core functionality, they are
being exposed in a plugin module.
Change-Id: I0a84642a72c7c9bbf9b6ffd2a6c33549f8e61c29
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'examples/quick')
21 files changed, 75 insertions, 57 deletions
diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml index 4bd5e33ae3..d94231c9b5 100644 --- a/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -41,6 +41,7 @@ import QtQuick 2.0 import QtQuick.XmlListModel 2.0 +import QtQml.Models 2.1 Component { id: albumDelegate @@ -69,7 +70,7 @@ Component { Package.name: 'album' id: albumWrapper; width: 210; height: 220 - VisualDataModel { + DelegateModel { id: visualModel; delegate: PhotoDelegate { } model: RssModel { id: rssModel; tags: tag } } diff --git a/examples/quick/demos/photoviewer/photoviewer.qml b/examples/quick/demos/photoviewer/photoviewer.qml index fa7c83f74e..df344accd5 100644 --- a/examples/quick/demos/photoviewer/photoviewer.qml +++ b/examples/quick/demos/photoviewer/photoviewer.qml @@ -40,6 +40,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 import "PhotoViewerCore" Rectangle { @@ -58,7 +59,7 @@ Rectangle { ListElement { tag: "Prague" } } - VisualDataModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} } + DelegateModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} } GridView { id: albumView; width: parent.width; height: parent.height; cellWidth: 210; cellHeight: 220 diff --git a/examples/quick/demos/stocqt/stocqt.qml b/examples/quick/demos/stocqt/stocqt.qml index ec353737fe..9bcffd972f 100644 --- a/examples/quick/demos/stocqt/stocqt.qml +++ b/examples/quick/demos/stocqt/stocqt.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 import "./content" ListView { @@ -66,7 +67,7 @@ ListView { } } - model: VisualItemModel { + model: ObjectModel { StockListView { id: listView width: root.width diff --git a/examples/quick/draganddrop/doc/src/draganddrop.qdoc b/examples/quick/draganddrop/doc/src/draganddrop.qdoc index 1844c3b4eb..ad32cbcfcd 100644 --- a/examples/quick/draganddrop/doc/src/draganddrop.qdoc +++ b/examples/quick/draganddrop/doc/src/draganddrop.qdoc @@ -49,7 +49,7 @@ \section2 GridView adds drag and drop to a GridView, allowing you to reorder the list. - It uses a VisualDataModel to move a delegate item to the position of another item + It uses a DelegateModel to move a delegate item to the position of another item it is dragged over. \snippet quick/draganddrop/views/gridview.qml 0 diff --git a/examples/quick/draganddrop/views/gridview.qml b/examples/quick/draganddrop/views/gridview.qml index 4df265e8af..f2c9c75e42 100644 --- a/examples/quick/draganddrop/views/gridview.qml +++ b/examples/quick/draganddrop/views/gridview.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 GridView { id: root @@ -50,7 +51,7 @@ GridView { } //! [0] - model: VisualDataModel { + model: DelegateModel { //! [0] id: visualModel model: ListModel { @@ -84,7 +85,7 @@ GridView { delegate: MouseArea { id: delegateRoot - property int visualIndex: VisualDataModel.itemsIndex + property int visualIndex: DelegateModel.itemsIndex width: 80; height: 80 drag.target: icon diff --git a/examples/quick/shadereffects/shadereffects.qml b/examples/quick/shadereffects/shadereffects.qml index 77de356eac..a8f0469b44 100644 --- a/examples/quick/shadereffects/shadereffects.qml +++ b/examples/quick/shadereffects/shadereffects.qml @@ -40,6 +40,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 import "content" Rectangle { @@ -85,7 +86,7 @@ Rectangle { height: 140 clip: true snapMode: ListView.SnapOneItem - model: VisualItemModel { + model: ObjectModel { Text { width: 160 height: 140 diff --git a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml index 09c69df54d..7f353f075a 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 //![0] Rectangle { id: root @@ -111,8 +112,8 @@ Rectangle { onEntered: { visualModel.items.move( - drag.source.VisualDataModel.itemsIndex, - dragArea.VisualDataModel.itemsIndex) + drag.source.DelegateModel.itemsIndex, + dragArea.DelegateModel.itemsIndex) } } //![3] @@ -120,7 +121,7 @@ Rectangle { } //![2] //![4] - VisualDataModel { + DelegateModel { id: visualModel model: PetsModel {} diff --git a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml index 6ff3f7eb96..82639c2016 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: root @@ -112,14 +113,14 @@ Rectangle { onEntered: { visualModel.items.move( - drag.source.VisualDataModel.itemsIndex, - dragArea.VisualDataModel.itemsIndex) + drag.source.DelegateModel.itemsIndex, + dragArea.DelegateModel.itemsIndex) } } } } //![0] - VisualDataModel { + DelegateModel { id: visualModel //![4] property var lessThan: [ diff --git a/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml index c6edcab836..b53fc1b45a 100644 --- a/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml +++ b/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: menuBar @@ -128,7 +129,7 @@ Rectangle { } } //a list of visual items already have delegates handling their display - VisualItemModel { + ObjectModel { id: menuListModel FileMenu { diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml index 929052f0ae..63b2a1c190 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml +++ b/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: menuBar @@ -99,7 +100,7 @@ Rectangle { } //a list of visual items already have delegates handling their display - VisualItemModel{ + ObjectModel{ id: menuListModel FileMenu{ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml index 929052f0ae..63b2a1c190 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: menuBar @@ -99,7 +100,7 @@ Rectangle { } //a list of visual items already have delegates handling their display - VisualItemModel{ + ObjectModel{ id: menuListModel FileMenu{ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml index 39b74e9d49..7bb1d2d30e 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: menuBar @@ -105,7 +106,7 @@ Rectangle { } //a list of visual items already have delegates handling their display - VisualItemModel{ + ObjectModel{ id: menuListModel FileMenu{ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml index 7ffa90c8f4..3600be7868 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: menuBar @@ -129,7 +130,7 @@ Rectangle { } } //a list of visual items already have delegates handling their display - VisualItemModel{ + ObjectModel{ id: menuListModel FileMenu{ diff --git a/examples/quick/views/doc/src/views.qdoc b/examples/quick/views/doc/src/views.qdoc index e48a66514b..658e51c8fc 100644 --- a/examples/quick/views/doc/src/views.qdoc +++ b/examples/quick/views/doc/src/views.qdoc @@ -71,12 +71,12 @@ \snippet quick/views/package/Delegate.qml 0 - A VisualDataModel allows the individual views to access their specific items from + A DelegateModel allows the individual views to access their specific items from the shared package delegate. \snippet quick/views/package/view.qml 0 - \section2 VisualItemModel uses a VisualItemModel for the model instead of a ListModel. + \section2 ObjectModel uses an ObjectModel for the model instead of a ListModel. \snippet quick/views/visualitemmodel/visualitemmodel.qml 0 */ diff --git a/examples/quick/views/visualitemmodel/visualitemmodel.qml b/examples/quick/views/objectmodel/objectmodel.qml index 90adf39b86..b790053c82 100644 --- a/examples/quick/views/visualitemmodel/visualitemmodel.qml +++ b/examples/quick/views/objectmodel/objectmodel.qml @@ -39,9 +39,10 @@ ****************************************************************************/ // This example demonstrates placing items in a view using -// a VisualItemModel +// an ObjectModel import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: root @@ -51,7 +52,7 @@ Rectangle { property bool printDestruction: false //! [0] - VisualItemModel { + ObjectModel { id: itemModel Rectangle { diff --git a/examples/quick/views/package/view.qml b/examples/quick/views/package/view.qml index 58ae5a4bf8..820eb4068c 100644 --- a/examples/quick/views/package/view.qml +++ b/examples/quick/views/package/view.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Rectangle { id: root @@ -64,7 +65,7 @@ Rectangle { ListElement { display: "Eight" } } //![0] - VisualDataModel { + DelegateModel { id: visualModel delegate: Delegate {} model: myModel diff --git a/examples/quick/views/parallax/content/ParallaxView.qml b/examples/quick/views/parallax/content/ParallaxView.qml index 5bfed1a297..e8c67c7434 100644 --- a/examples/quick/views/parallax/content/ParallaxView.qml +++ b/examples/quick/views/parallax/content/ParallaxView.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Item { id: root @@ -63,7 +64,7 @@ Item { orientation: Qt.Horizontal boundsBehavior: Flickable.DragOverBounds - model: VisualItemModel { id: visualModel } + model: ObjectModel { id: visualModel } highlightRangeMode: ListView.StrictlyEnforceRange snapMode: ListView.SnapOneItem diff --git a/examples/quick/views/views.qml b/examples/quick/views/views.qml index d1dda2a777..0724d11456 100644 --- a/examples/quick/views/views.qml +++ b/examples/quick/views/views.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 import "../shared" as Examples /*! @@ -51,50 +52,50 @@ import "../shared" as Examples are focused on the views side, which is the visual representation of the data in the models. \section2 GridView and PathView demonstrate usage of these elements to display views. - \snippet examples/quick/modelviews/gridview/gridview-example.qml 0 + \snippet examples/quick/views/gridview/gridview-example.qml 0 \section2 Dynamic List demonstrates animation of runtime additions and removals to a ListView. The ListView.onAdd signal handler runs an animation when new items are added to the view, and the ListView.onRemove another when they are removed. - \snippet examples/quick/modelviews/listview/dynamiclist.qml 0 - \snippet examples/quick/modelviews/listview/dynamiclist.qml 1 + \snippet examples/quick/views/listview/dynamiclist.qml 0 + \snippet examples/quick/views/listview/dynamiclist.qml 1 \section2 Expanding Delegates demonstrates delegates that expand when activated. It has a complex delegate the size and appearance of which can change, displacing other items in the view. - \snippet examples/quick/modelviews/listview/expandingdelegates.qml 0 - \snippet examples/quick/modelviews/listview/expandingdelegates.qml 1 - \snippet examples/quick/modelviews/listview/expandingdelegates.qml 2 - \snippet examples/quick/modelviews/listview/expandingdelegates.qml 3 + \snippet examples/quick/views/listview/expandingdelegates.qml 0 + \snippet examples/quick/views/listview/expandingdelegates.qml 1 + \snippet examples/quick/views/listview/expandingdelegates.qml 2 + \snippet examples/quick/views/listview/expandingdelegates.qml 3 \section2 Highlight demonstrates adding a custom highlight to a ListView. - \snippet examples/quick/modelviews/listview/highlight.qml 0 + \snippet examples/quick/views/listview/highlight.qml 0 \section2 Highlight Ranges shows the three different highlight range modes of ListView. - \snippet examples/quick/modelviews/listview/highlightranges.qml 0 - \snippet examples/quick/modelviews/listview/highlightranges.qml 1 - \snippet examples/quick/modelviews/listview/highlightranges.qml 2 + \snippet examples/quick/views/listview/highlightranges.qml 0 + \snippet examples/quick/views/listview/highlightranges.qml 1 + \snippet examples/quick/views/listview/highlightranges.qml 2 \section2 Sections demonstrates the various section headers and footers available to ListView. - \snippet examples/quick/modelviews/listview/sections.qml 0 + \snippet examples/quick/views/listview/sections.qml 0 \section2 Packages demonstrates using Packages to transition delegates between two views. It has a Package which defines delegate items for each view and an item that can be transferred between delegates. - \snippet examples/quick/modelviews/package/Delegate.qml 0 + \snippet examples/quick/views/package/Delegate.qml 0 - A VisualDataModel allows the individual views to access their specific items from + A DelegateModel allows the individual views to access their specific items from the shared package delegate. - \snippet examples/quick/modelviews/package/view.qml 0 + \snippet examples/quick/views/package/view.qml 0 - \section2 VisualItemModel uses a VisualItemModel for the model instead of a ListModel. + \section2 ObjectModel uses a ObjectModel for the model instead of a ListModel. - \snippet examples/quick/modelviews/visualitemmodel/visualitemmodel.qml 0 + \snippet examples/quick/views/objectmodel/objectmodel.qml 0 */ Item { @@ -112,7 +113,7 @@ import "../shared" as Examples addExample("Sections", "ListView section headers and footers", Qt.resolvedUrl("listview/sections.qml")) addExample("Packages", "Transitions between a ListView and GridView", Qt.resolvedUrl("package/view.qml")) addExample("PathView", "A simple PathView", Qt.resolvedUrl("pathview/pathview-example.qml")) - addExample("VisualItemModel", "Using a VisualItemModel", Qt.resolvedUrl("visualitemmodel/visualitemmodel.qml")) + addExample("ObjectModel", "Using a ObjectModel", Qt.resolvedUrl("objectmodel/objectmodel.qml")) } } } diff --git a/examples/quick/views/views.qrc b/examples/quick/views/views.qrc index e35f128202..434fa788bf 100644 --- a/examples/quick/views/views.qrc +++ b/examples/quick/views/views.qrc @@ -63,7 +63,7 @@ <file>pathview/pics/VideoPlayer_48.png</file> <file>visualdatamodel/slideshow.qml</file> <file>visualdatamodel/dragselection.qml</file> - <file>visualitemmodel/visualitemmodel.qml</file> + <file>objectmodel/objectmodel.qml</file> <file>views.qml</file> </qresource> </RCC> diff --git a/examples/quick/views/visualdatamodel/dragselection.qml b/examples/quick/views/visualdatamodel/dragselection.qml index ec80cc7c16..5578268961 100644 --- a/examples/quick/views/visualdatamodel/dragselection.qml +++ b/examples/quick/views/visualdatamodel/dragselection.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 Item { id: root @@ -59,7 +60,7 @@ Item { width: 64 height: 64 - enabled: packageRoot.VisualDataModel.inSelected + enabled: packageRoot.DelegateModel.inSelected drag.target: draggable @@ -83,7 +84,7 @@ Item { } DropArea { anchors.fill: parent - onEntered: selectedItems.move(0, visualModel.items.get(packageRoot.VisualDataModel.itemsIndex), selectedItems.count) + onEntered: selectedItems.move(0, visualModel.items.get(packageRoot.DelegateModel.itemsIndex), selectedItems.count) } } Item { @@ -112,7 +113,7 @@ Item { border.width: 2 border.color: "#007423" - state: root.dragging && packageRoot.VisualDataModel.inSelected ? "selected" : "visible" + state: root.dragging && packageRoot.DelegateModel.inSelected ? "selected" : "visible" Text { anchors.fill: parent @@ -126,7 +127,7 @@ Item { Rectangle { anchors { right: parent.right; top: parent.top; margins: 3 } width: 12; height: 12 - color: packageRoot.VisualDataModel.inSelected ? "black" : "white" + color: packageRoot.DelegateModel.inSelected ? "black" : "white" radius: 6 border.color: "white" @@ -134,7 +135,7 @@ Item { MouseArea { anchors.fill: parent - onClicked: packageRoot.VisualDataModel.inSelected = !packageRoot.VisualDataModel.inSelected + onClicked: packageRoot.DelegateModel.inSelected = !packageRoot.DelegateModel.inSelected } } @@ -142,19 +143,19 @@ Item { State { name: "selected" ParentChange { target: content; parent: selectionContainer; x: 3; y: 3 } - PropertyChanges { target: packageRoot; VisualDataModel.inItems: visibleContainer.drag.active } + PropertyChanges { target: packageRoot; DelegateModel.inItems: visibleContainer.drag.active } PropertyChanges { target: gradientStart; color: "#017423" } PropertyChanges { target: gradientStart; color: "#007423" } }, State { name: "visible" - PropertyChanges { target: packageRoot; VisualDataModel.inItems: true } + PropertyChanges { target: packageRoot; DelegateModel.inItems: true } ParentChange { target: content; parent: visibleContainer; x: 3; y: 3 } PropertyChanges { target: gradientStart; color: "#8AC953" } PropertyChanges { target: gradientStart; color: "#8BC953" } } ] transitions: Transition { - PropertyAction { target: packageRoot; properties: "VisualDataModel.inItems" } + PropertyAction { target: packageRoot; properties: "DelegateModel.inItems" } ParentAnimation { target: content NumberAnimation { target: content; properties: "x,y"; duration: 500 } @@ -165,7 +166,7 @@ Item { } } - VisualDataModel { + DelegateModel { id: visualModel model: 35 delegate: packageDelegate diff --git a/examples/quick/views/visualdatamodel/slideshow.qml b/examples/quick/views/visualdatamodel/slideshow.qml index 77fe9809d4..d3a4013503 100644 --- a/examples/quick/views/visualdatamodel/slideshow.qml +++ b/examples/quick/views/visualdatamodel/slideshow.qml @@ -40,6 +40,7 @@ import QtQuick 2.0 import QtQuick.XmlListModel 2.0 +import QtQml.Models 2.1 Rectangle { id: root @@ -50,7 +51,7 @@ Rectangle { color: "black" - VisualDataModel { + DelegateModel { id: visualModel model: XmlListModel { @@ -97,14 +98,14 @@ Rectangle { name: "inDisplay"; ParentChange { target: image; parent: imageContainer; x: 75; y: 75; width: 150; height: 150 } PropertyChanges { target: image; z: 2 } - PropertyChanges { target: delegateItem; VisualDataModel.inItems: false } + PropertyChanges { target: delegateItem; DelegateModel.inItems: false } }, State { when: root.displayItem !== delegateItem name: "inList"; ParentChange { target: image; parent: delegateItem; x: 2; y: 2; width: 75; height: 75 } PropertyChanges { target: image; z: 1 } - PropertyChanges { target: delegateItem; VisualDataModel.inItems: true } + PropertyChanges { target: delegateItem; DelegateModel.inItems: true } } ] @@ -112,7 +113,7 @@ Rectangle { Transition { from: "inList" SequentialAnimation { - PropertyAction { target: delegateItem; property: "VisualDataModel.inPersistedItems"; value: true } + PropertyAction { target: delegateItem; property: "DelegateModel.inPersistedItems"; value: true } ParentAnimation { target: image; via: root @@ -126,7 +127,7 @@ Rectangle { target: image NumberAnimation { target: image; properties: "x,y,width,height"; duration: 1000 } } - PropertyAction { target: delegateItem; property: "VisualDataModel.inPersistedItems"; value: false } + PropertyAction { target: delegateItem; property: "DelegateModel.inPersistedItems"; value: false } } } ] |