Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Cursor width in QLineEdit when using inputMask

    General and Desktop
    3
    6
    2194
    Loading More Posts
    • 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
      Kritika last edited by

      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 Reply Quote 0
      • H
        Hareen Laks last edited by

        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 Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          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 Reply Quote 0
          • K
            Kritika last edited by

            So isnt there any solution if i want normal pixelWidth.

            1 Reply Last reply Reply Quote 0
            • K
              Kritika last edited by

              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 Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 Reply Quote 0
                • First post
                  Last post