diff options
| author | xiphon <xiphon@protonmail.com> | 2020-12-24 08:05:14 +0000 |
|---|---|---|
| committer | xiphon <xiphon@protonmail.com> | 2020-12-24 08:20:38 +0000 |
| commit | ba4d6993b78a3a0e7c0d0b0f09ab071b1bb5e447 (patch) | |
| tree | 0d8c1abb14863f854c5aed5991ae391f2efc53bc /components/InlineButton.qml | |
| parent | fed00a5662dcbc77c928a06778d7c9001e7d90f9 (diff) | |
| download | monzero-gui-ba4d6993b78a3a0e7c0d0b0f09ab071b1bb5e447.tar.gz monzero-gui-ba4d6993b78a3a0e7c0d0b0f09ab071b1bb5e447.tar.xz monzero-gui-ba4d6993b78a3a0e7c0d0b0f09ab071b1bb5e447.zip | |
LineEdit: fix padding, fix inline buttons layout, multiple btns support
Diffstat (limited to 'components/InlineButton.qml')
| -rw-r--r-- | components/InlineButton.qml | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/components/InlineButton.qml b/components/InlineButton.qml index 299f1ae6..107614d5 100644 --- a/components/InlineButton.qml +++ b/components/InlineButton.qml @@ -30,30 +30,26 @@ import QtQuick 2.9 import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 +import FontAwesome 1.0 + import "." as MoneroComponents import "./effects/" as MoneroEffects Item { id: inlineButton - height: parent.height - anchors.top: parent.top - anchors.bottom: parent.bottom property bool small: false - property string shadowPressedColor: "#B32D00" - property string shadowReleasedColor: "#FF4304" - property string pressedColor: "#FF4304" - property string releasedColor: "#FF6C3C" - property string icon: "" property string textColor: MoneroComponents.Style.inlineButtonTextColor - property int fontSize: small ? 14 : 16 - property int rectHeight: small ? 24 : 24 - property int rectHMargin: small ? 16 : 22 property alias text: inlineText.text property alias fontPixelSize: inlineText.font.pixelSize property alias fontFamily: inlineText.font.family + property bool isFontAwesomeIcon: fontFamily == FontAwesome.fontFamily || fontFamily == FontAwesome.fontFamilySolid property alias buttonColor: rect.color - property alias buttonHeight: rect.height + + Layout.rightMargin: isFontAwesomeIcon ? 0 : 4 + height: isFontAwesomeIcon ? 30 : 24 + width: isFontAwesomeIcon ? height : inlineText.width + 16 + signal clicked() function doClick() { @@ -64,20 +60,16 @@ Item { Rectangle{ id: rect + anchors.fill: parent color: MoneroComponents.Style.buttonInlineBackgroundColor - height: 24 - width: inlineText.text ? (inlineText.width + 16) : inlineButton.icon ? (inlineImage.width + 16) : rect.height radius: 4 - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: 4 MoneroComponents.TextPlain { id: inlineText font.family: MoneroComponents.Style.fontBold.name font.bold: true - font.pixelSize: inlineButton.fontSize + font.pixelSize: inlineButton.isFontAwesomeIcon ? 22 : inlineButton.small ? 14 : 16 color: inlineButton.textColor anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter @@ -90,13 +82,6 @@ Item { } } - Image { - id: inlineImage - visible: inlineButton.icon !== "" - anchors.centerIn: parent - source: inlineButton.icon - } - MouseArea { id: buttonArea cursorShape: rect.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor |
