Important: Please read the Qt Code of Conduct -

Fix alignment of a QLineEdit?

  • 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,

           <widget class="QLineEdit" name="txtIdentity_Name">
            <property name="geometry">
            <property name="font">
            <property name="layoutDirection">
            <property name="text">
            <property name="frame">
            <property name="alignment">
            <property name="readOnly">

  • 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.

  • 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..


Log in to reply