Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] how to add text in a textinput using mousearea
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jr_jags
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by
      #2

      @
      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.

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • J Offline
        J Offline
        jr_jags
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved