Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLineEdit using input mask with blank space replacement , cursor select replacement char
QtWS25 Last Chance

QLineEdit using input mask with blank space replacement , cursor select replacement char

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlineditinputmask
15 Posts 2 Posters 9.5k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    Technically, the cursor has to be movable to that fifth position, otherwise how do you want to do the selection with the keyboard ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BluTiGeS
      wrote on last edited by
      #7

      Hi,

      no it does not since it is a block curso which means it has the current character highlighted.
      On a Line Edit Cursor for sure it makes sense to select the 5 th character.

      But if using a input mask the cursor changes to a block cursor, and therefore the last input mask cahracter shall be the end and not the following 5th in this case.

      So if the mask 0000;0 is set the following happens ;

      () = means block cursor

      (0)000
      => press right
      0(0)00
      => press right
      00(0)0
      => press right
      0000(0) ==> all okay up to now

      => press right again, the character after the input mask is selected, but this shall not be with block cursor.
      0000** ()**

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #8

        Ok, I see what you mean now.

        The behavior while selecting the values of the mask behaves correctly (from you description). The selection stops at the last char (at least on OS X it does)

        Note that that "fifth char" accessibility doesn't look like a bug to me. Take for example the use of backspace to delete the content you just entered, you would not be able to do that if there wasn't that "space".

        By the way, can you explain what problem you are encountering ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BluTiGeS
          wrote on last edited by
          #9

          The Problem I have is that I use qt in a embedded device and if the user is able to select this 5th Character it might confuse the user since it cannot be changed.

          So it is a useability issue from my point of view.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #10

            What's the purpose of that line edit ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • B Offline
              B Offline
              BluTiGeS
              wrote on last edited by
              #11

              It is used as a min and max 4 Character ID.

              So 0000 - 9999 shall be able to put in.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #12

                Then why not use a QSpinBox ? You can hide the arrows if you don't want them.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  BluTiGeS
                  wrote on last edited by
                  #13

                  Does a QSpinBox Provide 0000 also? I need these 4 Characters displayed also if they are zero.

                  I thougt the QSpinBox just counts from 0 to x. But I need 0000 to xxxx.

                  But anyway same issue is with IP input mask 000.000.000.000;0 etc.. But the blank space Character replacement is the issue.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    QSpinBox uses a QLineEdit so you can set a mask on it.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      BluTiGeS
                      wrote on last edited by
                      #15

                      Thanks for your answer, but this also would not work for other line edits.
                      In QT creator I cannot find the input mask setting for the QSpinBox, this would be helpful in a shared project, so everyone directly would see the input Mask like in the QlinEdit.

                      But anyway you solution would be a workaorund but does not explain why this issue .
                      The only explanation like you already mentioned is because of useage of backspace deletion.

                      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