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. Cursor width in QLineEdit when using inputMask
QtWS25 Last Chance

Cursor width in QLineEdit when using inputMask

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.6k 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.
  • K Offline
    K Offline
    Kritika
    wrote on last edited by
    #1

    I am using inputMask in QLineEdit. When I execute this, the pixelWidth of cursor in QLineEdit is increased by approx 8 pixels while cursor is in normal size in other widgets. I want cursor in normal size. How can this be done?

    I have also designed a class inheriting QProxyStyle class to modify pixelWidth of cursor. When I increse cursor width using this, it is working fine but doesn't work while decreasing

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hareen Laks
      wrote on last edited by
      #2

      Your question is unclear to me.

      Can you show some of your code which causes to the erroneous result?

      And if you can show a screenshot of what is happening it is much better.

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

        Hi,

        AFAIK, the different pixel width is normal. It lets the users know that there's an input mask. Otherwise they will have a hard time understand why not every character they input shows on the 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
        • K Offline
          K Offline
          Kritika
          wrote on last edited by
          #4

          So isnt there any solution if i want normal pixelWidth.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kritika
            wrote on last edited by
            #5

            Thanks SGaist.
            Now i think cursor pixelWidth is not an issue to my GUI.
            But I am facing another problem in this. I want this lineEdit with inputMask to work same as we have input field for IP Address, so that cursor can jump after/ before any non-space character on pressing any arrow key. For this i have used QLineEdit::setCursorPosition() method. It is working fine but cursor is not visible at random times. Can anyone tell me about this behaviour of cursor?

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

              I'm not sure I am getting you right. Can you provide a an example ?

              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

              • Login

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