diff --git a/examples/gallery/contents/ui/MainPage.qml b/examples/gallery/contents/ui/MainPage.qml index 2a9686b6..8ff4424c 100644 --- a/examples/gallery/contents/ui/MainPage.qml +++ b/examples/gallery/contents/ui/MainPage.qml @@ -1,141 +1,126 @@ /* * Copyright 2015 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.1 import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.2 import org.kde.kirigami 1.0 as Kirigami Kirigami.ScrollablePage { id: pageRoot implicitWidth: Kirigami.Units.gridUnit * 20 background: Rectangle { color: Kirigami.Theme.viewBackgroundColor } title: "Gallery" //flickable: mainListView actions { contextualActions: [ Kirigami.Action { text:"Action 1" iconName: "document-decrypt" onTriggered: showPassiveNotification("Action 1 clicked") }, Kirigami.Action { id: shareAction visible: checkableAction.checked text:"Action 2" iconName: "document-share" onTriggered: showPassiveNotification("Action 2 clicked") }, Kirigami.Action { id: checkableAction text:"Checkable" checkable: true iconName: "dashboard-show" onCheckedChanged: showPassiveNotification("Checked: " + checked) } ] } ListView { id: mainListView model: ListModel { ListElement { text: "Button" component: "Button" } ListElement { text: "CheckBox" component: "CheckBox" } ListElement { text: "Radio Button" component: "RadioButton" } ListElement { text: "Progress Bar" component: "ProgressBar" } ListElement { text: "Slider" component: "Slider" } ListElement { text: "Switch" component: "Switch" } ListElement { text: "Text Field" component: "TextField" } ListElement { text: "Multiple Columns" component: "MultipleColumns" } ListElement { text: "List View" component: "ListView" } ListElement { text: "Non Scrollable Page" component: "NonScrollable" } ListElement { text: "Colors" component: "Colors" } } - delegate: Kirigami.SwipeListItem { + delegate: Kirigami.BasicListItem { id: listItem - Kirigami.Label { - height: Math.max(implicitHeight, Kirigami.Units.iconSizes.smallMedium) - anchors.verticalCenter: parent.verticalCenter - x: y - text: model.text - color: listItem.checked || (listItem.pressed && !listItem.checked && !listItem.sectionDelegate) ? listItem.activeTextColor : listItem.textColor - } + label: model.text property Item ownPage onClicked: { if (!model.component) { return; } root.pageStack.pop(pageRoot); ownPage = root.pageStack.push(Qt.resolvedUrl("gallery/" + model.component + "Gallery.qml")); } checked: ownPage && root.pageStack.lastItem == ownPage - actions: [ - Kirigami.Action { - iconName: "document-decrypt" - onTriggered: showPassiveNotification(model.text + " Action 1 clicked") - }, - Kirigami.Action { - iconName: "mail-reply-sender" - onTriggered: showPassiveNotification(model.text + " Action 2 clicked") - }] } } } diff --git a/examples/gallery/contents/ui/gallery/ListViewGallery.qml b/examples/gallery/contents/ui/gallery/ListViewGallery.qml index 6217e0de..5438bcd7 100644 --- a/examples/gallery/contents/ui/gallery/ListViewGallery.qml +++ b/examples/gallery/contents/ui/gallery/ListViewGallery.qml @@ -1,74 +1,90 @@ /* * Copyright 2015 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls 1.2 as Controls import QtQuick.Layouts 1.2 -import org.kde.kirigami 1.0 +import org.kde.kirigami 1.0 as Kirigami -ScrollablePage { +Kirigami.ScrollablePage { id: page Layout.fillWidth: true title: "Long List view" actions { - main: Action { + main: Kirigami.Action { iconName: sheet.opened ? "dialog-cancel" : "document-edit" text: "Main Action Text" checked: sheet.opened checkable: true onCheckedChanged: sheet.opened = checked; } } supportsRefreshing: true onRefreshingChanged: { if (refreshing) { refreshRequestTimer.running = true; } else { showPassiveNotification("Example refreshing completed") } } background: Rectangle { color: Theme.viewBackgroundColor } - OverlaySheet { + Kirigami.OverlaySheet { id: sheet ListView { model: 100 implicitWidth: Units.gridUnit * 30 - delegate: BasicListItem { + delegate: Kirigami.BasicListItem { label: "Item in sheet" + modelData } } } ListView { Timer { id: refreshRequestTimer interval: 3000 onTriggered: page.refreshing = false } model: 200 - delegate: BasicListItem { - label: "Item " + modelData + delegate: Kirigami.SwipeListItem { + id: listItem + Kirigami.Label { + height: Math.max(implicitHeight, Kirigami.Units.iconSizes.smallMedium) + anchors.verticalCenter: parent.verticalCenter + x: y + text: "Item " + modelData + color: listItem.checked || (listItem.pressed && !listItem.checked && !listItem.sectionDelegate) ? listItem.activeTextColor : listItem.textColor + } + actions: [ + Kirigami.Action { + iconName: "document-decrypt" + onTriggered: showPassiveNotification(model.text + " Action 1 clicked") + }, + Kirigami.Action { + iconName: "mail-reply-sender" + onTriggered: showPassiveNotification(model.text + " Action 2 clicked") + }] } } }