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