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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2015 Gábor Péterffy <peterffy95@gmail.com>
0004 //
0005 
0006 
0007 import QtQuick 2.3
0008 import QtQuick.Controls 1.3
0009 import QtQuick.Window 2.2
0010 import QtQuick.Layouts 1.1
0011 
0012 Item {
0013     id: root
0014 
0015     width: image.width + 10
0016     height: image.height + 10
0017 
0018     property alias imageSource: image.source
0019     signal clicked()
0020 
0021     SystemPalette{
0022         id: palette
0023         colorGroup: SystemPalette.Active
0024     }
0025 
0026     Rectangle {
0027         id: background
0028         anchors.fill: parent
0029         color: touchArea.pressed ? palette.button : palette.highlight
0030 
0031         Image {
0032             id: image
0033             anchors.centerIn: parent
0034             anchors.margins: 10
0035 
0036             width: Screen.pixelDensity * 6
0037             height: width
0038             fillMode: Image.PreserveAspectFit
0039 
0040             MouseArea {
0041                 id: touchArea
0042                 anchors.fill: parent
0043                 onClicked: {
0044                     if (root.enabled) {
0045                         root.clicked();
0046                     }
0047                 }
0048             }
0049         }
0050     }
0051 }