1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/*
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
Kirigami.ScrollablePage {
id: page
Layout.fillWidth: true
implicitWidth: Kirigami.Units.gridUnit * (Math.floor(Math.random() * 35) + 8)
title: "Multiple Columns"
actions.contextualActions: [
Kirigami.Action {
text:"Action for buttons"
icon.name: "bookmarks"
onTriggered: print("Action 1 clicked")
},
Kirigami.Action {
text:"Action 2"
icon.name: "folder"
enabled: false
}
]
ColumnLayout {
width: page.width
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: "This page is used to test multiple columns: you can push and pop an arbitrary number of pages, each new page will have a random implicit width between 8 and 35 grid units.\nIf you enlarge the window enough, you can test how the application behaves with multiple columns."
}
Item {
Layout.minimumWidth: Kirigami.Units.gridUnit *2
Layout.minimumHeight: Layout.minimumWidth
}
QQC2.Label {
Layout.alignment: Qt.AlignHCenter
text: "Page implicitWidth: " + page.implicitWidth
}
QQC2.Button {
text: "Push Another Page"
Layout.alignment: Qt.AlignHCenter
onClicked: pageStack.push(Qt.resolvedUrl("MultipleColumnsGallery.qml"));
}
QQC2.Button {
text: "Pop A Page"
Layout.alignment: Qt.AlignHCenter
onClicked: pageStack.pop();
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
QQC2.TextField {
id: edit
text: page.title
}
QQC2.Button {
text: "Rename Page"
onClicked: page.title = edit.text;
}
}
Kirigami.SearchField {
id: searchField
Layout.alignment: Qt.AlignHCenter
onAccepted: console.log("Search text is " + text);
}
Kirigami.PasswordField {
id: passwordField
Layout.alignment: Qt.AlignHCenter
onAccepted: console.log("Password")
}
}
}
|