editbox improvements #217
|
@ -98,6 +98,14 @@
|
|||
<translation>Löschen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>InplaceEditText</name>
|
||||
<message>
|
||||
<location filename="../qml/widgets/InplaceEditText.qml" line="85"/>
|
||||
<source>Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListOverlay</name>
|
||||
<message>
|
||||
|
|
|
@ -98,6 +98,14 @@
|
|||
<translation>Delete</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>InplaceEditText</name>
|
||||
<message>
|
||||
<location filename="../qml/widgets/InplaceEditText.qml" line="85"/>
|
||||
<source>Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListOverlay</name>
|
||||
<message>
|
||||
|
|
|
@ -98,6 +98,14 @@
|
|||
<translation>Effacer</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>InplaceEditText</name>
|
||||
<message>
|
||||
<location filename="../qml/widgets/InplaceEditText.qml" line="85"/>
|
||||
<source>Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListOverlay</name>
|
||||
<message>
|
||||
|
|
|
@ -98,6 +98,14 @@
|
|||
<translation>Deletar</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>InplaceEditText</name>
|
||||
<message>
|
||||
<location filename="../qml/widgets/InplaceEditText.qml" line="85"/>
|
||||
<source>Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListOverlay</name>
|
||||
<message>
|
||||
|
|
|
@ -9,8 +9,6 @@ TextFieldStyle {
|
|||
|
||||
background: Rectangle {
|
||||
radius: 2
|
||||
implicitWidth: root.width
|
||||
implicitHeight: ptToPx(10 * gcd.themeScale)
|
||||
color: windowItem.cwtch_background_color
|
||||
border.color: windowItem.cwtch_color
|
||||
}
|
||||
|
|
|
@ -5,37 +5,45 @@ import QtQuick.Controls.Material 2.0
|
|||
import QtQuick.Layouts 1.3
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
Item {
|
||||
id: root
|
||||
width: parent.width
|
||||
height: lbl.visible ? lbl.height : txt.height + (gcd.os == "android" ? btn.height + 3 : 0) //lbl.height
|
||||
implicitHeight: height //lbl.height
|
||||
|
||||
property alias text: lbl.text
|
||||
signal updated
|
||||
|
||||
|
||||
Text { // DISPLAY THE TEXT IN READONLY MODE
|
||||
id: lbl
|
||||
text: root.text
|
||||
fontSizeMode: Text.HorizontalFit
|
||||
font.pixelSize: 36
|
||||
minimumPixelSize: 8
|
||||
Layout.minimumWidth: parent.width
|
||||
Layout.maximumWidth: parent.width
|
||||
width: parent.width / 2
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
textFormat: Text.PlainText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Image {
|
||||
id: img
|
||||
anchors.left: lbl.right
|
||||
anchors.leftMargin: 3
|
||||
source: "qrc:/qml/images/fontawesome/solid/edit.svg"
|
||||
height: 16
|
||||
sourceSize.height: 16
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: lbl
|
||||
MouseArea {
|
||||
anchors.fill: lbl
|
||||
|
||||
onClicked: {
|
||||
lbl.visible = false
|
||||
txt.visible = true
|
||||
txt.text = lbl.text
|
||||
txt.selectAll()
|
||||
txt.focus = true
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
lbl.visible = img.visible = false
|
||||
txt.visible = true
|
||||
if (gcd.os == "android") btn.visible = true
|
||||
txt.text = lbl.text
|
||||
txt.selectAll()
|
||||
txt.focus = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,10 +52,9 @@ ColumnLayout {
|
|||
text: root.text
|
||||
visible: false
|
||||
selectByMouse: true
|
||||
Layout.minimumWidth: parent.width
|
||||
Layout.maximumWidth: parent.width
|
||||
font.pixelSize: lbl.font.pixelSize
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (!activeFocus) {
|
||||
|
@ -63,9 +70,21 @@ ColumnLayout {
|
|||
|
||||
function save() {
|
||||
root.text = txt.text
|
||||
txt.visible = false
|
||||
lbl.visible = true
|
||||
txt.visible = btn.visible = false
|
||||
lbl.visible = img.visible = true
|
||||
root.updated(txt.text)
|
||||
}
|
||||
}
|
||||
|
||||
SimpleButton {
|
||||
id: btn
|
||||
anchors.top: txt.bottom
|
||||
anchors.topMargin: 3
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: false
|
||||
text: qsTr("Update")
|
||||
|
||||
|
||||
onClicked: txt.save()
|
||||
}
|
||||
}
|
|
@ -101,10 +101,10 @@ ColumnLayout {
|
|||
InplaceEditText { // USER NICKNAME
|
||||
id: lblNick
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width
|
||||
Layout.minimumWidth: parent.width
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
onUpdated: {
|
||||
nick = lblNick.text
|
||||
gcd.updateNick(lblNick.text)
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue