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 3 Apr 2015, 16:23 last edited by p3c0 4 Apr 2015, 09:44
    #1

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

    P 1 Reply Last reply 4 Apr 2015, 05:39
    0
    • Z Zubalama
      3 Apr 2015, 16:23

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

      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 4 Apr 2015, 05:39 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 4 Apr 2015, 08:20 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?

        P 1 Reply Last reply 4 Apr 2015, 08:42
        0
        • Z Zubalama
          4 Apr 2015, 08:20

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

          P Offline
          P Offline
          p3c0
          Moderators
          wrote on 4 Apr 2015, 08:42 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 4 Apr 2015, 09:02 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

            P 1 Reply Last reply 4 Apr 2015, 09:27
            0
            • Z Zubalama
              4 Apr 2015, 09:02

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

              P Offline
              P Offline
              p3c0
              Moderators
              wrote on 4 Apr 2015, 09:27 last edited by
              #6

              @Zubalama Then you need remove instead of getText.

              157

              Z 1 Reply Last reply 4 Apr 2015, 09:31
              1
              • P p3c0
                4 Apr 2015, 09:27

                @Zubalama Then you need remove instead of getText.

                Z Offline
                Z Offline
                Zubalama
                wrote on 4 Apr 2015, 09:31 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 4 Apr 2015, 09:33 last edited by Zubalama 4 Apr 2015, 09:34
                  #8

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

                  P 1 Reply Last reply 4 Apr 2015, 09:37
                  0
                  • Z Zubalama
                    4 Apr 2015, 09:33

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

                    P Offline
                    P Offline
                    p3c0
                    Moderators
                    wrote on 4 Apr 2015, 09:37 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

                    9/9

                    4 Apr 2015, 09:37

                    • Login

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