Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Recommendation on editing Label Content by mouse click



  • Hi,
    I am experimenting with the example code. I would like to edit the content of the Valuecharecteristics.jpg which corresponds to

    Label {
                    id: characteristicValue
                    font.pointSize: characteristicName.font.pointSize*0.7
                    textContent: ("Value: " + modelData.characteristicValue)
                    anchors.bottom: characteristicHandle.top
                    horizontalAlignment: Text.AlignHCenter
                    anchors.topMargin: 5
                }
    

    section of file . Ideally, I would like to click on the value and edit the content.

    I have tried using TextInput. But it does not look good. The window appears in elsewhere and is not quite obvious. Is there any other QML types which are better suited for the purpose? I am quite new to Qt and if you could point me to any links or better QML type, that would be very helpful.
    Many Thanks,
    Tony



  • I think if you want to edit the value of Label, I suggest u use TextInput or TextField. So u can use virtual keyboard to input values.

    you can customizing the TextInput or TextField if u don't like the apperance of the component

    https://doc.qt.io/archives/qt-5.11/qtquickcontrols2-customize.html#customizing-button

    Or there is another way: Write a customed virtual keyboard. And listen the component which is focused. get the class name of the focused component, if the class equal which you want to input, pop up your customed virtual keyboard.



  • Sorry, for some reason I did not get notification on replies in this thread. Thank you @sonicss


Log in to reply