aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-12-24 08:05:14 +0000
committerxiphon <xiphon@protonmail.com>2020-12-24 08:20:38 +0000
commitba4d6993b78a3a0e7c0d0b0f09ab071b1bb5e447 (patch)
tree0d8c1abb14863f854c5aed5991ae391f2efc53bc /components
parentfed00a5662dcbc77c928a06778d7c9001e7d90f9 (diff)
downloadmonzero-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')
-rw-r--r--components/InlineButton.qml35
-rw-r--r--components/LineEdit.qml21
-rw-r--r--components/LineEditMulti.qml27
3 files changed, 32 insertions, 51 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
diff --git a/components/LineEdit.qml b/components/LineEdit.qml
index aad42895..516cee2d 100644
--- a/components/LineEdit.qml
+++ b/components/LineEdit.qml
@@ -29,11 +29,15 @@
import FontAwesome 1.0
import QtQuick 2.9
import QtGraphicalEffects 1.0
+import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
Item {
id: item
+
+ default property alias content: inlineButtons.children
+
property alias input: input
property alias text: input.text
@@ -53,8 +57,6 @@ Item {
property alias validator: input.validator
property alias readOnly : input.readOnly
property alias cursorPosition: input.cursorPosition
- property alias inlineButton: inlineButtonId
- property alias inlineButtonText: inlineButtonId.text
property alias inlineIcon: inlineIcon.visible
property bool copyButton: false
property alias copyButtonText: copyButtonId.text
@@ -239,6 +241,7 @@ Item {
onEditingFinished: item.editingFinished()
onAccepted: item.accepted();
onTextChanged: item.textUpdated()
+ rightPadding: inlineButtons.width + 14
topPadding: 10
bottomPadding: 10
echoMode: isPasswordHidden() ? TextInput.Password : TextInput.Normal
@@ -262,13 +265,15 @@ Item {
onClicked: passwordToggle()
}
}
- }
- MoneroComponents.InlineButton {
- id: inlineButtonId
- visible: item.inlineButtonText ? true : false
- anchors.right: parent.right
- anchors.rightMargin: 8
+ RowLayout {
+ id: inlineButtons
+ anchors.bottom: parent.bottom
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 4
+ spacing: 4
+ }
}
}
}
diff --git a/components/LineEditMulti.qml b/components/LineEditMulti.qml
index 4e971285..7f2e377e 100644
--- a/components/LineEditMulti.qml
+++ b/components/LineEditMulti.qml
@@ -36,13 +36,15 @@ ColumnLayout {
Layout.fillWidth: true
+ default property alias content: inlineButtons.children
+
property alias text: input.text
property alias labelText: inputLabel.text
property alias labelButtonText: labelButton.text
property alias placeholderText: placeholderLabel.text
property int inputPaddingLeft: 10
- property int inputPaddingRight: 10
+ property alias inputPaddingRight: input.rightPadding
property int inputPaddingTop: 10
property int inputPaddingBottom: 10
property int inputRadius: 4
@@ -85,11 +87,6 @@ ColumnLayout {
property alias addressValidation: input.addressValidation
property string backgroundColor: "" // mock
- property alias inlineButton: inlineButtonId
- property bool inlineButtonVisible: false
- property alias inlineButton2: inlineButton2Id
- property bool inlineButton2Visible: false
-
signal labelButtonClicked();
signal inputLabelLinkActivated();
signal editingFinished();
@@ -166,7 +163,7 @@ ColumnLayout {
Layout.fillWidth: true
leftPadding: item.inputPaddingLeft
- rightPadding: item.inputPaddingRight
+ rightPadding: inlineButtons.width + 14
topPadding: item.inputPaddingTop
bottomPadding: item.inputPaddingBottom
@@ -202,18 +199,12 @@ ColumnLayout {
visible: !item.borderDisabled
}
- MoneroComponents.InlineButton {
- id: inlineButtonId
- visible: (inlineButtonId.text || inlineButtonId.icon) && inlineButtonVisible ? true : false
- anchors.right: parent.right
- anchors.rightMargin: 8
- }
-
- MoneroComponents.InlineButton {
- id: inlineButton2Id
- visible: (inlineButton2Id.text || inlineButton2Id.icon) && inlineButton2Visible ? true : false
+ RowLayout {
+ id: inlineButtons
+ anchors.top: parent.top
anchors.right: parent.right
- anchors.rightMargin: inlineButtonVisible ? 48 : 8
+ anchors.margins: 4
+ spacing: 4
}
}
}