How to get QLineEdit to elide and align left?
-
QLineEdit seems to align long content to the right while truncating the content on the left. Seems as though it should be the reverse. the default alignment is already Qt.AlignLeft | Qt.AlignVCenter. How can I make it so the far left characters are already shown?
Thanks!
-
Afaics it depends on the cursor position
-
@Christian-Ehrlicher said in How to get QLineEdit to elide and align left?:
Afaics it depends on the cursor position
I tried lineEdit->home(true) but there was no effect.
-
It's working fine for me here:
Are you sure you call it after your set the text?
-
@Christian-Ehrlicher said in How to get QLineEdit to elide and align left?:
It's working fine for me here:
Are you sure you call it after your set the text?
I can verify that setting the cursor position works using the following simple example, which means that my problem is somewhere else in my code:
def test_QLineEdit_alignment(): app = QApplication(sys.argv) w = QLineEdit() w.setReadOnly(True) w.resize(50, 20) w.setText('1234567890 1234567890') w.setCursorPosition(0) w.show() app.exec() test_QLineEdit_alignment()
Thanks!