Warning, /frameworks/qqc2-desktop-style/tests/buttonIcons.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Layouts 1.15
0009 import QtQuick.Controls 2.15 as Controls
0010 
0011 import org.kde.kirigami 2.20 as Kirigami
0012 
0013 Kirigami.ApplicationWindow {
0014     id: root
0015 
0016     width: 600
0017     height: 600
0018 
0019     Kirigami.Theme.inherit: false
0020     Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
0021 
0022     header: Controls.MenuBar {
0023         Controls.Menu {
0024             title: "&File"
0025 
0026             Controls.MenuItem {
0027                 checkable: true
0028                 text: "Item1"
0029                 icon.name: "go-next"
0030                 icon.color: "red"
0031             }
0032             Controls.MenuItem {
0033                 text: "Item2"
0034                 icon.name: "folder-video"
0035             }
0036             Controls.MenuSeparator {
0037             }
0038             Controls.MenuItem {
0039                 checkable: true
0040                 text: "Item3"
0041             }
0042             Controls.Menu {
0043                 title: "Submenu"
0044 
0045                 Controls.MenuItem {
0046                     checkable: true
0047                     text: "Item1"
0048                     icon.name: "go-next"
0049                     icon.color: "red"
0050                 }
0051                 Controls.MenuItem {
0052                     text: "Item2"
0053                     icon.name: "folder-video"
0054                 }
0055                 Controls.MenuItem {
0056                     text: "Item3"
0057                 }
0058             }
0059         }
0060         Controls.Menu {
0061             title: "Edit"
0062 
0063             Controls.MenuItem {
0064                 text: "Item1"
0065                 icon.name: "go-next"
0066             }
0067             Controls.MenuItem {
0068                 text: "Item2"
0069                 icon.name: "go-next"
0070             }
0071         }
0072     }
0073 
0074     Rectangle {
0075         id: background
0076 
0077         anchors.centerIn: parent
0078         width: childrenRect.width
0079         height: childrenRect.height
0080 
0081         color: Kirigami.Theme.backgroundColor
0082         Kirigami.Theme.inherit: false
0083         Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
0084 
0085         ColumnLayout {
0086             spacing: Kirigami.Units.smallSpacing
0087 
0088             Controls.ComboBox {
0089                 Kirigami.Theme.inherit: true
0090                 currentIndex: 1
0091                 model: ["View", "Window", "Button", "Selection", "Tooltip", "Complementary"]
0092                 onCurrentTextChanged: background.Kirigami.Theme.colorSet = currentText
0093             }
0094             Controls.Button {
0095                 Kirigami.Theme.inherit: true
0096                 text: "text"
0097                 icon.name: "go-previous"
0098             }
0099             Controls.Button {
0100                 id: coloredIconButton
0101                 text: "text"
0102                 icon.name: "go-previous"
0103             }
0104             RowLayout {
0105                 spacing: Kirigami.Units.smallSpacing
0106 
0107                 Controls.Label {
0108                     text: "RGB color for icon:"
0109                 }
0110                 Controls.SpinBox {
0111                     id: red
0112                     editable: true
0113                     from: 0
0114                     to: 255
0115                     onValueModified: {
0116                         coloredIconButton.icon.color = Qt.rgba(red.value/255, green.value/255, blue.value/255, 1);
0117                     }
0118                 }
0119                 Controls.SpinBox {
0120                     id: green
0121                     Kirigami.Theme.inherit: true
0122                     editable: true
0123                     from: 0
0124                     to: 255
0125                     onValueModified: {
0126                         coloredIconButton.icon.color = Qt.rgba(red.value/255, green.value/255, blue.value/255, 1);
0127                     }
0128                 }
0129                 Controls.SpinBox {
0130                     id: blue
0131                     editable: true
0132                     from: 0
0133                     to: 255
0134                     onValueModified: {
0135                         coloredIconButton.icon.color = Qt.rgba(red.value/255, green.value/255, blue.value/255, 1);
0136                     }
0137                 }
0138             }
0139             Controls.ToolButton {
0140                 text: "text"
0141                 icon.name: "go-previous"
0142             }
0143         }
0144     }
0145 }