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. Fix alignment of a QLineEdit?
Qt 6.11 is out! See what's new in the release blog

Fix alignment of a QLineEdit?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.5k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    stefh
    wrote on last edited by
    #1

    Hi,

    we made a GUI (QT 4.5.0), with some QLineEdits that are right-aligned because they contain Hebrew text.

    But on a Hebrew Windows, doing CTRL+SHIFT makes the text inside the QLineEdit to be left-aligned; which should not be possible in our case.

    Below is is an example of a QLineEdit in our UI file. As you can see, the QLineEdit is read-only.

    Is there any property that can 'fixate' the alignment (= disable the CTRL + SHIFT)?
    Or a work-around like intercepting CTRL + SHIFT? Or ...?

    Thx, br,
    Stef

           <widget class="QLineEdit" name="txtIdentity_Name">
            <property name="geometry">
             <rect>
              <x>30</x>
              <y>30</y>
              <width>331</width>
              <height>20</height>
             </rect>
            </property>
            <property name="font">
             <font/>
            </property>
            <property name="layoutDirection">
             <enum>Qt::LeftToRight</enum>
            </property>
            <property name="text">
             <string/>
            </property>
            <property name="frame">
             <bool>false</bool>
            </property>
            <property name="alignment">
             <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
            </property>
            <property name="readOnly">
             <bool>true</bool>
            </property>
           </widget>
    
    1 Reply Last reply
    0
    • P Offline
      P Offline
      pkj__
      wrote on last edited by
      #2

      Does that lineEdit is having a input mask (something that restricts the input in lineedit to only say numbers)? I think there is a bug for right aligned line edits with input mask.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stefh
        wrote on last edited by
        #3

        Hi!

        there's no input mask, AFAIK. And a search for' setinputmask' in the code didn't return any results either..

        I can put text and numbers in the field, and they are nicely right-aligned. It's just that nasty CTRL - SHIFT that causes a left-alignment..

        grts,
        Stef

        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