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 select char left from cursor in TextInput?
QtWS25 Last Chance

[Solved]How to select char left from cursor in TextInput?

Scheduled Pinned Locked Moved QML and Qt Quick
textinput
9 Posts 2 Posters 2.7k Views
  • 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.
  • Z Offline
    Z Offline
    Zubalama
    wrote on last edited by p3c0
    #1

    I want to select 1 character left from cursor in textInput, how can I do that?

    p3c0P 1 Reply Last reply
    0
    • Z Zubalama

      I want to select 1 character left from cursor in textInput, how can I do that?

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @Zubalama Try this:

      inpuT.getText(inpuT.length-1,inpuT.length)
      ///inpuT = id of TextInput.
      

      157

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zubalama
        wrote on last edited by
        #3

        @Zubalama said:

        select 1 character left from cursor in textInput

        input.text=input.text-input.getText(input.length-1,input.length) why it returns "nan"? just nan?

        p3c0P 1 Reply Last reply
        0
        • Z Zubalama

          @Zubalama said:

          select 1 character left from cursor in textInput

          input.text=input.text-input.getText(input.length-1,input.length) why it returns "nan"? just nan?

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @Zubalama Why are you subtracting text again from it ?
          Just inpuT.getText(inpuT.length-1,inpuT.length) should work.

          157

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zubalama
            wrote on last edited by
            #5

            because I'm trying to make backspace button, and onClick won't work because I'm trying to do it for remote control

            p3c0P 1 Reply Last reply
            0
            • Z Zubalama

              because I'm trying to make backspace button, and onClick won't work because I'm trying to do it for remote control

              p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #6

              @Zubalama Then you need remove instead of getText.

              157

              Z 1 Reply Last reply
              1
              • p3c0P p3c0

                @Zubalama Then you need remove instead of getText.

                Z Offline
                Z Offline
                Zubalama
                wrote on last edited by
                #7

                @p3c0 thank you I love you for that, respect and I mean you are the greatest man I've ever heard of =)) thank you again

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  Zubalama
                  wrote on last edited by Zubalama
                  #8

                  1 more question how do I make topic "solved"?

                  p3c0P 1 Reply Last reply
                  0
                  • Z Zubalama

                    1 more question how do I make topic "solved"?

                    p3c0P Offline
                    p3c0P Offline
                    p3c0
                    Moderators
                    wrote on last edited by
                    #9

                    @Zubalama There's a Topic Tools box at the bottom. Inside it contains Mark Solved option. If it doesn't work then edit the post title and prepend [Solved]. If you don't get it, let us know.

                    157

                    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