mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-22 10:44:46 +00:00
LineEdit; included copy button
This commit is contained in:
parent
b09dfc2511
commit
3d65a5d90d
1 changed files with 46 additions and 3 deletions
|
@ -40,6 +40,7 @@ Item {
|
||||||
property alias inlineButton: inlineButtonId
|
property alias inlineButton: inlineButtonId
|
||||||
property alias inlineButtonText: inlineButtonId.text
|
property alias inlineButtonText: inlineButtonId.text
|
||||||
property alias inlineIcon: inlineIcon.visible
|
property alias inlineIcon: inlineIcon.visible
|
||||||
|
property alias copyButton: copyButton.visible
|
||||||
property int fontSize: 18 * scaleRatio
|
property int fontSize: 18 * scaleRatio
|
||||||
property bool showBorder: true
|
property bool showBorder: true
|
||||||
property bool error: false
|
property bool error: false
|
||||||
|
@ -51,12 +52,12 @@ Item {
|
||||||
property bool labelFontBold: false
|
property bool labelFontBold: false
|
||||||
property alias labelWrapMode: inputLabel.wrapMode
|
property alias labelWrapMode: inputLabel.wrapMode
|
||||||
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
|
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
|
||||||
signal labelLinkActivated();
|
signal labelLinkActivated(); // input label, rich text <a> signal
|
||||||
signal editingFinished()
|
signal editingFinished()
|
||||||
signal accepted();
|
signal accepted();
|
||||||
signal textUpdated();
|
signal textUpdated();
|
||||||
|
|
||||||
height: (inputLabel.height + inputItem.height + 10) * scaleRatio
|
height: (inputLabel.height + inputItem.height + 2) * scaleRatio
|
||||||
|
|
||||||
onTextUpdated: {
|
onTextUpdated: {
|
||||||
// check to remove placeholder text when there is content
|
// check to remove placeholder text when there is content
|
||||||
|
@ -88,8 +89,8 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
id: inputLabel
|
id: inputLabel
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 10 * scaleRatio
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
anchors.topMargin: 2
|
||||||
font.family: Style.fontRegular.name
|
font.family: Style.fontRegular.name
|
||||||
font.pixelSize: labelFontSize
|
font.pixelSize: labelFontSize
|
||||||
font.bold: labelFontBold
|
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{
|
Item{
|
||||||
id: inputItem
|
id: inputItem
|
||||||
height: 48 * scaleRatio
|
height: 48 * scaleRatio
|
||||||
|
|
Loading…
Reference in a new issue