summary refs log tree commit diff
path: root/resources/qml/components
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml/components')
-rw-r--r--resources/qml/components/FlatButton.qml37
1 files changed, 27 insertions, 10 deletions
diff --git a/resources/qml/components/FlatButton.qml b/resources/qml/components/FlatButton.qml

index 72184d28..2c9ea061 100644 --- a/resources/qml/components/FlatButton.qml +++ b/resources/qml/components/FlatButton.qml
@@ -6,6 +6,7 @@ import QtGraphicalEffects 1.12 import QtQuick 2.9 import QtQuick.Controls 2.5 +import QtQuick.Layouts 1.2 import im.nheko 1.0 // FIXME(Nico): Don't use hardcoded colors. @@ -16,6 +17,8 @@ Button { implicitWidth: Math.ceil(control.contentItem.implicitWidth + control.contentItem.implicitHeight) hoverEnabled: true + property string iconImage: "" + DropShadow { anchors.fill: control.background horizontalOffset: 3 @@ -27,16 +30,30 @@ Button { source: control.background } - contentItem: Text { - text: control.text - //font: control.font - font.capitalization: Font.AllUppercase - font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5) - //font.capitalization: Font.AllUppercase - color: Nheko.colors.light - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight + contentItem: RowLayout { + spacing: 0 + anchors.centerIn: parent + Image { + Layout.leftMargin: Nheko.paddingMedium + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + Layout.preferredHeight: fontMetrics.font.pixelSize * 1.5 + Layout.preferredWidth: fontMetrics.font.pixelSize * 1.5 + visible: !!iconImage + source: iconImage + } + + Text { + Layout.alignment: Qt.AlignHCenter + text: control.text + //font: control.font + font.capitalization: Font.AllUppercase + font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5) + //font.capitalization: Font.AllUppercase + color: Nheko.colors.light + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } } background: Rectangle {