Warning, /frameworks/kirigami/examples/simpleexamples/MultipleColumnsGallery.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as QQC2
0009 import QtQuick.Layouts
0010 import org.kde.kirigami as Kirigami
0011 
0012 Kirigami.ScrollablePage {
0013     id: page
0014 
0015     Layout.fillWidth: true
0016     implicitWidth: Kirigami.Units.gridUnit * (Math.floor(Math.random() * 35) + 8)
0017 
0018     title: "Multiple Columns"
0019 
0020     actions: [
0021         Kirigami.Action {
0022             text:"Action for buttons"
0023             icon.name: "bookmarks"
0024             onTriggered: print("Action 1 clicked")
0025         },
0026         Kirigami.Action {
0027             text:"Action 2"
0028             icon.name: "folder"
0029             enabled: false
0030         }
0031     ]
0032 
0033     ColumnLayout {
0034         width: page.width
0035         spacing: Kirigami.Units.smallSpacing
0036 
0037         QQC2.Label {
0038             Layout.fillWidth: true
0039             wrapMode: Text.WordWrap
0040             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."
0041         }
0042         Item {
0043             Layout.minimumWidth: Kirigami.Units.gridUnit *2
0044             Layout.minimumHeight: Layout.minimumWidth
0045         }
0046         QQC2.Label {
0047             Layout.alignment: Qt.AlignHCenter
0048             text: "Page implicitWidth: " + page.implicitWidth
0049         }
0050         QQC2.Button {
0051             text: "Push Another Page"
0052             Layout.alignment: Qt.AlignHCenter
0053             onClicked: applicationWindow()?.pageStack.push(Qt.resolvedUrl("MultipleColumnsGallery.qml"));
0054         }
0055         QQC2.Button {
0056             text: "Pop A Page"
0057             Layout.alignment: Qt.AlignHCenter
0058             onClicked: applicationWindow()?.pageStack.pop();
0059         }
0060         RowLayout {
0061             Layout.alignment: Qt.AlignHCenter
0062             QQC2.TextField {
0063                 id: edit
0064                 text: page.title
0065             }
0066             QQC2.Button {
0067                 text: "Rename Page"
0068                 onClicked: page.title = edit.text;
0069             }
0070         }
0071         Kirigami.SearchField {
0072             id: searchField
0073             Layout.alignment: Qt.AlignHCenter
0074             onAccepted: console.log("Search text is " + text);
0075         }
0076         Kirigami.PasswordField {
0077             id: passwordField
0078             Layout.alignment: Qt.AlignHCenter
0079             onAccepted: console.log("Password")
0080         }
0081     }
0082 }