Results 1 to 7 of 7

Thread: Mirror Font

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7

    Default Re: Mirror Font

    Excellent!!! thank you Wysota and Lykurg for the precious help.

    Last consideration to close the topic: considering this code is part of a large painter block of code and there is also others global painter trasformation I not want to loose or change
    ( painter.setWorldTransform(QTransform,true);

    Is correct to write the follow code to restore painter state, without resetting al the painter trasformation matri,x doing another trasform after the text drawing?

    Qt Code:
    1. QPainter p(this)
    2. p.scale(-1,1);
    3. p.drawText(...);
    4. p.scale(-1,1); //reset the trasform whith another contrary trasform
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Mirror Font

    That's possible but you also can use QPainter::save() and QPainter::restore():
    Qt Code:
    1. QPainter p(this);
    2. // use p
    3. p.save();
    4. p.scale(-1,1);
    5. p.drawText(...);
    6. p.restore();
    7. // now p is like before "save()".
    To copy to clipboard, switch view to plain text mode 
    This approach is much easier if you do more complex transformations.

  3. The following user says thank you to Lykurg for this useful post:

    _Jack_ (15th May 2010)

Similar Threads

  1. Change Font of QListWidget to Monospace Font
    By pospiech in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 18:23
  2. font incorrectly show - font break.
    By sgh in forum Qt Programming
    Replies: 9
    Last Post: 30th May 2008, 02:35
  3. How to mirror-image text?
    By WinchellChung in forum Newbie
    Replies: 11
    Last Post: 31st July 2007, 17:13
  4. 4.3.0 installer and MinGW mirror problem
    By ucomesdag in forum Installation and Deployment
    Replies: 2
    Last Post: 8th July 2007, 03:17
  5. mirror for QGraphicsItem
    By jobrandt in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2007, 09:09

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.