diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2023-06-28 15:30:40 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2023-06-30 08:47:17 +0000 |
commit | c4d520c200a59eb216f19434b05d013ac32ff177 (patch) | |
tree | 0b18c30533da261342ee1abf8aabebef5d4d7a98 /examples/quick/views/pathview/pathview-example.qml | |
parent | d158c61cef35c35d8893db9e7db266782ece264d (diff) |
Make views example more in line with our guidelines
The views example is an old example, which shows off many different
features related to ListView, GridView and the QML models.
Unfortunately, there are currently a few things that are broken in it.
One of those things is the FlickrRssModel, which no longer works,
because flickr changed their web API.
This patch makes some improvements, but it's unfortunately not fixing
everything.
The list of fixes are the following:
- Fix a good number of qmllint warnings. Unfortunately, there seems to
be a good number of false positives that remain unfixed.
- Use qsTr() in some places. But I've not adopted it everywhere.
- sections.qml now uses Qt Quick Controls CheckBox'es instead of a
custom component.
- Property bindings are now declared on separate lines.
Pick-to: 6.6
Change-Id: Idfb563f4bd658dc70c1b9975549e872e7c25449e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quick/views/pathview/pathview-example.qml')
-rw-r--r-- | examples/quick/views/pathview/pathview-example.qml | 84 |
1 files changed, 67 insertions, 17 deletions
diff --git a/examples/quick/views/pathview/pathview-example.qml b/examples/quick/views/pathview/pathview-example.qml index 19fd470c04..f1ecd099c1 100644 --- a/examples/quick/views/pathview/pathview-example.qml +++ b/examples/quick/views/pathview/pathview-example.qml @@ -4,24 +4,47 @@ import QtQuick Rectangle { - width: 400; height: 240 + width: 400 + height: 240 color: "white" ListModel { id: appModel - ListElement { name: "Music"; icon: "pics/AudioPlayer_48.png" } - ListElement { name: "Movies"; icon: "pics/VideoPlayer_48.png" } - ListElement { name: "Camera"; icon: "pics/Camera_48.png" } - ListElement { name: "Calendar"; icon: "pics/DateBook_48.png" } - ListElement { name: "Messaging"; icon: "pics/EMail_48.png" } - ListElement { name: "Todo List"; icon: "pics/TodoList_48.png" } - ListElement { name: "Contacts"; icon: "pics/AddressBook_48.png" } + ListElement { + name: "Music" + icon: "pics/AudioPlayer_48.png" + } + ListElement { + name: "Movies" + icon: "pics/VideoPlayer_48.png" + } + ListElement { + name: "Camera" + icon: "pics/Camera_48.png" + } + ListElement { + name: "Calendar" + icon: "pics/DateBook_48.png" + } + ListElement { + name: "Messaging" + icon: "pics/EMail_48.png" + } + ListElement { + name: "Todo List" + icon: "pics/TodoList_48.png" + } + ListElement { + name: "Contacts" + icon: "pics/AddressBook_48.png" + } } Component { id: appDelegate Item { - width: 100; height: 100 + width: 100 + height: 100 scale: PathView.iconScale required property string name @@ -30,11 +53,15 @@ Rectangle { Image { id: myIcon - y: 20; anchors.horizontalCenter: parent.horizontalCenter + y: 20 + anchors.horizontalCenter: parent.horizontalCenter source: parent.icon } Text { - anchors { top: myIcon.bottom; horizontalCenter: parent.horizontalCenter } + anchors { + top: myIcon.bottom + horizontalCenter: parent.horizontalCenter + } text: parent.name } @@ -47,7 +74,11 @@ Rectangle { Component { id: appHighlight - Rectangle { width: 80; height: 80; color: "lightsteelblue" } + Rectangle { + width: 80 + height: 80 + color: "lightsteelblue" + } } PathView { @@ -62,11 +93,30 @@ Rectangle { path: Path { startX: 10 startY: 50 - PathAttribute { name: "iconScale"; value: 0.5 } - PathQuad { x: 200; y: 150; controlX: 50; controlY: 200 } - PathAttribute { name: "iconScale"; value: 1.0 } - PathQuad { x: 390; y: 50; controlX: 350; controlY: 200 } - PathAttribute { name: "iconScale"; value: 0.5 } + PathAttribute { + name: "iconScale" + value: 0.5 + } + PathQuad { + x: 200 + y: 150 + controlX: 50 + controlY: 200 + } + PathAttribute { + name: "iconScale" + value: 1.0 + } + PathQuad { + x: 390 + y: 50 + controlX: 350 + controlY: 200 + } + PathAttribute { + name: "iconScale" + value: 0.5 + } } } } |