Results 1 to 3 of 3

Thread: Painting a right-aligned text

  1. #1
    Join Date
    Jul 2010
    Posts
    16
    Qt products
    Qt Jambi
    Platforms
    Unix/X11 Symbian S60 Maemo/MeeGo

    Default Painting a right-aligned text

    Hello,

    How can I paint a text such that it gets positioned on the left of the target QPoint.

    Example:

    some text|

    (where | represents the QPoint)

    I'm currently using drawText but I don't think it allows such positioning.

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Painting a right-aligned text

    Quote Originally Posted by curreli View Post
    I'm currently using drawText but I don't think it allows such positioning
    It does.
    void QPainter::drawText ( const QRectF & rectangle, int flags, const QString & text, QRectF * boundingRect = 0 )
    Use Qt::AlignRight for flags and simply position rectangle according to your given QPoint.

  3. #3
    Join Date
    Jul 2010
    Posts
    16
    Qt products
    Qt Jambi
    Platforms
    Unix/X11 Symbian S60 Maemo/MeeGo

    Default Re: Painting a right-aligned text

    Works fine, thanks a lot!

Similar Threads

  1. Replies: 1
    Last Post: 3rd September 2008, 14:16
  2. Regarding Painting
    By archanasubodh in forum General Programming
    Replies: 6
    Last Post: 8th August 2008, 18:23
  3. About painting
    By Pang in forum Qt Programming
    Replies: 3
    Last Post: 28th March 2007, 17:21
  4. Replies: 1
    Last Post: 12th November 2006, 16:56
  5. Painting Rich Text
    By xanthine in forum Qt Programming
    Replies: 7
    Last Post: 15th April 2006, 23:35

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.