I am using Qt 4.7.4 and my application language in RTL. I have set the application layout to RightToLeft. So everything is now right to left except placeholders in QLineEdit.
I tried setAlignment method but it changes the text and placeholder direction in reverse. Then I tried setStylesheet but it does not work for
direction:rtl;
text-align:right;
unicode-bidi:embed;
I think it is a bug, Is there any fix?
The changelog for version 4.7 reads as follows:
QWidget::setLayoutDirection no longer affects the text layout direction (Qt::LeftToRight or Qt::RightToLeft) of QTextEdit, QLineEdit and widgets based on them.
The default text layout direction (Qt::LayoutDirectionAuto) is now detected from keyboard layout and language of the text (conforms to Unicode standards).
To programmatically force the text direction of a QTextEdit, you can change the defaultTextOption of the QTextDocument associated with that widget with a new QTextOption of different textDirection property.
For QLineEdit, the only way so far is sending a Qt::Key_Direction_L/R keyboard event to that widget.
Hope that helps.