PDA

View Full Version : Left text alignment for long text on QLineEdit?



grantbj74
11th March 2014, 01:21
When the text is longer then the QLineEdit. The QLineEdit seems to center the text.

Is there any way to fix this?

Bascally I want to see the start of the text in the edit box, not the middle of it. It's just a read only text box.

I have also tried QTextEdit but seems to have the same problem.

Maybe I have selected wrong settings (has AlignLeft).

Thanks in advance
Brendan

Added after 43 minutes:

I found a solution.

After the text is set on a QLineEdit call setCursorPosition( 0 ).

adutzu89
11th March 2014, 11:20
Try using the following function:
It is in QLineEdit documentation. Just tried it and seems to work for me.

void QLineEdit::home(bool mark)