aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Ferdinand <sa.ferdinand@gmail.com>2017-12-06 00:54:34 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-29 23:04:01 +0100
commit3d65a5d90d4deb6bcd76c5c033137509267d1ad4 (patch)
treee65a62d11d79064fe1a08a328ff448293346a5ca
parentb09dfc2511088211e996b0f22948d01b8c5c95b8 (diff)
downloadmonzero-gui-3d65a5d90d4deb6bcd76c5c033137509267d1ad4.tar.gz
monzero-gui-3d65a5d90d4deb6bcd76c5c033137509267d1ad4.tar.xz
monzero-gui-3d65a5d90d4deb6bcd76c5c033137509267d1ad4.zip
LineEdit; included copy button
-rw-r--r--components/LineEdit.qml49
1 files changed, 46 insertions, 3 deletions
diff --git a/components/LineEdit.qml b/components/LineEdit.qml
index 5f636a06..debc396d 100644
--- a/components/LineEdit.qml
+++ b/components/LineEdit.qml
@@ -40,6 +40,7 @@ Item {
property alias inlineButton: inlineButtonId
property alias inlineButtonText: inlineButtonId.text
property alias inlineIcon: inlineIcon.visible
+ property alias copyButton: copyButton.visible
property int fontSize: 18 * scaleRatio
property bool showBorder: true
property bool error: false
@@ -51,12 +52,12 @@ Item {
property bool labelFontBold: false
property alias labelWrapMode: inputLabel.wrapMode
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
- signal labelLinkActivated();
+ signal labelLinkActivated(); // input label, rich text <a> signal
signal editingFinished()
signal accepted();
signal textUpdated();
- height: (inputLabel.height + inputItem.height + 10) * scaleRatio
+ height: (inputLabel.height + inputItem.height + 2) * scaleRatio
onTextUpdated: {
// check to remove placeholder text when there is content
@@ -88,8 +89,8 @@ Item {
Text {
id: inputLabel
anchors.top: parent.top
- anchors.topMargin: 10 * scaleRatio
anchors.left: parent.left
+ anchors.topMargin: 2
font.family: Style.fontRegular.name
font.pixelSize: labelFontSize
font.bold: labelFontBold
@@ -104,6 +105,48 @@ Item {
}
}
+ Rectangle{
+ id: copyButton
+ color: "#808080"
+ radius: 3
+ height: 20
+ width: 44
+ anchors.right: parent.right
+ visible: false
+
+ Text {
+ id: copyButtonText
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: Style.fontRegular.name
+ font.pixelSize: 12
+ font.bold: true
+ text: "Copy"
+ color: "black"
+ }
+
+ MouseArea {
+ cursorShape: Qt.PointingHandCursor
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: {
+ if (addressLine.text.length > 0) {
+ console.log(addressLine.text + " copied to clipboard")
+ clipboard.setText(addressLine.text)
+ appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3)
+ }
+ }
+ onEntered: {
+ copyButton.color = "#707070";
+ copyButtonText.opacity = 0.8;
+ }
+ onExited: {
+ copyButtonText.opacity = 1.0;
+ copyButton.color = "#808080";
+ }
+ }
+ }
+
Item{
id: inputItem
height: 48 * scaleRatio