diff --git a/qml/styles/CwtchTextFieldStyle.qml b/qml/styles/CwtchTextFieldStyle.qml index 768af1cd..5b17266d 100644 --- a/qml/styles/CwtchTextFieldStyle.qml +++ b/qml/styles/CwtchTextFieldStyle.qml @@ -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 } diff --git a/qml/widgets/InplaceEditText.qml b/qml/widgets/InplaceEditText.qml index ea0403f4..9ed92bab 100644 --- a/qml/widgets/InplaceEditText.qml +++ b/qml/widgets/InplaceEditText.qml @@ -5,37 +5,45 @@ import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 -ColumnLayout { +Item { id: root - width: parent.width + height: lbl.height + implicitHeight: 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: { + console.log("click") + lbl.visible = img.visible = false + txt.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) { @@ -64,7 +71,7 @@ ColumnLayout { function save() { root.text = txt.text txt.visible = false - lbl.visible = true + lbl.visible = img.visible = true root.updated(txt.text) } } diff --git a/qml/widgets/MyProfile.qml b/qml/widgets/MyProfile.qml index aa0c9432..ff160cb2 100644 --- a/qml/widgets/MyProfile.qml +++ b/qml/widgets/MyProfile.qml @@ -101,10 +101,11 @@ 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 + //nick = lblNick.text gcd.updateNick(lblNick.text) } }