melawy-plasma-plasmoid-Onze.../com.github.adhec.OnzeMenuKDE/contents/ui/AToolButton.qml

57 lines
1.4 KiB
QML
Raw Normal View History

2023-04-17 20:56:22 +05:00
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
Rectangle{
id:item
2023-07-02 11:51:48 +05:00
implicitHeight: Math.floor( PlasmaCore.Units.gridUnit * 1.8)
width: Math.floor(lb.implicitWidth + PlasmaCore.Units.smallSpacing * 5 + icon.width)
2023-04-17 20:56:22 +05:00
border.width: 1
border.color: mouseItem.containsMouse ? theme.highlightColor : colorWithAlpha(theme.textColor,0.2)
2023-07-02 11:51:48 +05:00
radius: 2
2023-04-17 20:56:22 +05:00
color: theme.backgroundColor
2023-07-02 11:51:48 +05:00
smooth: plasmoid.configuration.iconSmooth
2023-04-17 20:56:22 +05:00
property alias text: lb.text
property bool flat: false
property alias iconName: icon.source
property bool mirror: false
signal clicked
RowLayout{
id: row
anchors.fill: parent
2023-07-02 11:51:48 +05:00
anchors.leftMargin: PlasmaCore.Units.smallSpacing * 2
anchors.rightMargin: PlasmaCore.Units.smallSpacing * 2
spacing: PlasmaCore.Units.smallSpacing
2023-04-17 20:56:22 +05:00
LayoutMirroring.enabled: mirror
Label{
id: lb
color: theme.textColor
}
PlasmaCore.IconItem {
id: icon
2023-07-02 11:51:48 +05:00
implicitHeight: PlasmaCore.Units.gridUnit
2023-04-17 20:56:22 +05:00
implicitWidth: implicitHeight
2023-07-02 11:51:48 +05:00
smooth: plasmoid.configuration.iconSmooth
2023-04-17 20:56:22 +05:00
}
}
MouseArea {
id: mouseItem
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: item.clicked()
}
}