shift-shell/look-and-feel/contents/components/DialerButton.qml

54 lines
1.2 KiB
QML
Raw Normal View History

2016-02-24 19:15:15 +00:00
/*
2021-03-01 20:03:25 +00:00
* SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
2016-02-24 19:15:15 +00:00
*
2021-03-01 20:03:25 +00:00
* SPDX-License-Identifier: LGPL-2.0-or-later
2016-02-24 19:15:15 +00:00
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
2016-02-24 19:15:15 +00:00
PlasmaComponents.Label {
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
2021-09-13 16:40:56 +00:00
font.pixelSize: PlasmaCore.Units.gridUnit * 1.6
2016-02-24 19:15:15 +00:00
property alias sub: longHold.text
property var callback
Layout.fillWidth: true
MouseArea {
anchors.fill: parent
onClicked: {
if (callback) {
callback();
} else {
addNumber(parent.text);
}
}
onPressAndHold: {
if (longHold.visible) {
addNumber(longHold.text);
} else {
addNumber(parent.text);
}
}
}
PlasmaComponents.Label {
id: longHold
anchors {
top: parent.top
right: parent.right
}
height: parent.height
width: parent.width / 3
verticalAlignment: Qt.AlignVCenter
visible: text.length > 0
opacity: 0.7
font.pixelSize: parent.pixelSize * .8
}
}