[SOLVED] how to add text in a textinput using mousearea

  • I want to add a specific letter or word on a textinput when mousarea is clicked, How can i do that?

    TextInput {
    id: text_input1
    x: 46
    y: 105
    width: 281
    height: 66
    text: ""
    font.pixelSize: 30

    MouseArea {
    id: mouse_area2
    x: 7
    y: 253
    width: 29
    height: 42
    onClicked: {
    //i want to set a letter when this mousearea is clicked

    and when i continously click the mousearea the text set in my mousearea will be added again to the textinput

  • @
    onClicked: {
    text_input1.text += "letter"

    For continuous mouse click see onPressAndHold signal.

    But I think you should start a timer onClicked or onPressAndHold and on every onTimeout you add more text with @ text_input1.text += "letter"@ and onRealese you stop the timer.

  • wow, thank you sir, i was planning to use this on my virtual keyboard,
    Thanks :D

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.