Results 1 to 2 of 2

Thread: Left text alignment for long text on QLineEdit?

  1. #1
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Left text alignment for long text on QLineEdit?

    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 ).
    Last edited by grantbj74; 11th March 2014 at 02:21.

  2. #2
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Left text alignment for long text on QLineEdit?

    Try using the following function:
    It is in QLineEdit documentation. Just tried it and seems to work for me.
    Qt Code:
    1. void QLineEdit::home(bool mark)
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 0
    Last Post: 24th October 2011, 13:52
  2. Check box text too long
    By flogh in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 22nd November 2010, 10:56
  3. Window Title Text left alignment issue.
    By kaushal_gaurav in forum Qt Programming
    Replies: 2
    Last Post: 3rd March 2010, 15:46
  4. left alignment for pushbutton text
    By BalaQT in forum Qt Programming
    Replies: 7
    Last Post: 22nd September 2009, 09:41
  5. how to srcoll a long text in one line from right to left?
    By deweyjew in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2006, 11:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.