diff options
Diffstat (limited to 'examples/quick/views')
-rw-r--r-- | examples/quick/views/doc/src/views.qdoc | 4 | ||||
-rw-r--r-- | examples/quick/views/objectmodel/objectmodel.qml (renamed from examples/quick/views/visualitemmodel/visualitemmodel.qml) | 5 | ||||
-rw-r--r-- | examples/quick/views/package/view.qml | 3 | ||||
-rw-r--r-- | examples/quick/views/parallax/content/ParallaxView.qml | 3 | ||||
-rw-r--r-- | examples/quick/views/parallax/parallax.qml | 2 | ||||
-rw-r--r-- | examples/quick/views/views.qml | 91 | ||||
-rw-r--r-- | examples/quick/views/views.qrc | 2 | ||||
-rw-r--r-- | examples/quick/views/visualdatamodel/dragselection.qml | 19 | ||||
-rw-r--r-- | examples/quick/views/visualdatamodel/slideshow.qml | 11 |
9 files changed, 45 insertions, 95 deletions
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/parallax/parallax.qml b/examples/quick/views/parallax/parallax.qml index 4ec482f581..ddcafc1ee1 100644 --- a/examples/quick/views/parallax/parallax.qml +++ b/examples/quick/views/parallax/parallax.qml @@ -69,7 +69,7 @@ Rectangle { anchors { top: parent.top; topMargin: 10; horizontalCenter: parent.horizontalCenter } width: 300; height: 400 clip: true; - source: "../../../demos/samegame/samegame.qml" + source: "../../demos/samegame/samegame.qml" } } } diff --git a/examples/quick/views/views.qml b/examples/quick/views/views.qml index d1dda2a777..1bc6f6a3d8 100644 --- a/examples/quick/views/views.qml +++ b/examples/quick/views/views.qml @@ -39,80 +39,25 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQml.Models 2.1 import "../shared" as Examples -/*! - \title QtQuick Examples - Views - \example quick/views - \brief This is a collection of QML model and view examples - \image qml-modelviews-example.png - - This is a collection of small QML examples relating to model and view functionality. They - 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 - - \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 - - \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 - - \section2 Highlight demonstrates adding a custom highlight to a ListView. - \snippet examples/quick/modelviews/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 - - \section2 Sections demonstrates the various section headers and footers available to ListView. - \snippet examples/quick/modelviews/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 - - A VisualDataModel allows the individual views to access their specific items from - the shared package delegate. - - \snippet examples/quick/modelviews/package/view.qml 0 - - \section2 VisualItemModel uses a VisualItemModel for the model instead of a ListModel. - - \snippet examples/quick/modelviews/visualitemmodel/visualitemmodel.qml 0 - */ - - Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("GridView", "A simple GridView", Qt.resolvedUrl("gridview/gridview-example.qml")) - addExample("Dynamic List", "A dynamically alterable list", Qt.resolvedUrl("listview/dynamiclist.qml")) - addExample("Expanding Delegates", "A ListView with delegates that expand", Qt.resolvedUrl("listview/expandingdelegates.qml")) - addExample("Highlight", "A ListView with a custom highlight", Qt.resolvedUrl("listview/highlight.qml")) - addExample("Highlight Ranges", "The three highlight ranges of ListView", Qt.resolvedUrl("listview/highlightranges.qml")) - 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")) - } +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("GridView", "A simple GridView", Qt.resolvedUrl("gridview/gridview-example.qml")) + addExample("Dynamic List", "A dynamically alterable list", Qt.resolvedUrl("listview/dynamiclist.qml")) + addExample("Expanding Delegates", "A ListView with delegates that expand", Qt.resolvedUrl("listview/expandingdelegates.qml")) + addExample("Highlight", "A ListView with a custom highlight", Qt.resolvedUrl("listview/highlight.qml")) + addExample("Highlight Ranges", "The three highlight ranges of ListView", Qt.resolvedUrl("listview/highlightranges.qml")) + 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("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 } } } ] |