Warning, /education/marble/src/apps/marble-maps/MenuIcon.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2017 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 import QtQuick 2.3
0007 import QtQuick.Window 2.2
0008 import QtQuick.Layouts 1.3
0009 
0010 Item {
0011     id: root
0012     anchors.left: parent.left
0013     anchors.right: parent.right
0014     height: container.height + 2 * Screen.pixelDensity
0015 
0016     property bool checkable: false
0017     property bool checked: false
0018     property bool hasSettings: false
0019     property alias text: text.text
0020     property alias icon: image.source
0021 
0022     signal triggered()
0023     signal settingsTriggered()
0024 
0025     Rectangle {
0026         anchors.fill: parent
0027         visible: root.checkable && root.checked
0028         color: palette.highlight
0029         radius: 3
0030     }
0031 
0032     Item {
0033         id: container
0034         property real padding: Screen.pixelDensity * 1
0035         anchors.top: parent.top
0036         anchors.left: parent.left
0037         anchors.right: parent.right
0038         height: row.height
0039         anchors.margins: padding
0040 
0041         RowLayout {
0042             id: row
0043             anchors.left: parent.left
0044             anchors.right: settingsButton.left
0045             spacing: Screen.pixelDensity * 2
0046 
0047             Image {
0048                 id: image
0049                 sourceSize.height: text.height
0050                 fillMode: Image.PreserveAspectFit
0051                 anchors.verticalCenter: parent.verticalCenter
0052             }
0053 
0054             Text {
0055                 id: text
0056                 Layout.fillWidth: true
0057                 font.pointSize: 18
0058                 color: root.checkable && root.checked ? palette.highlightedText : palette.text
0059                 elide: Text.ElideRight
0060             }
0061         }
0062 
0063         MouseArea {
0064             anchors.fill: parent
0065             onClicked: {
0066                 if (root.checkable) {
0067                     root.checked = !root.checked
0068                 }
0069                 root.triggered()
0070             }
0071         }
0072 
0073         Image {
0074             id: settingsButton
0075             visible: root.hasSettings
0076             anchors.right: parent.right
0077             anchors.verticalCenter: parent.verticalCenter
0078             sourceSize.height: 0.67 * text.height
0079             fillMode: Image.PreserveAspectFit
0080 
0081             source: "qrc:/settings.png"
0082             MouseArea {
0083                 anchors.fill: parent
0084                 onClicked: root.settingsTriggered()
0085             }
0086         }
0087     }
0088 }