Results 1 to 3 of 3

Thread: QPainter::rotate and Qwt problems

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPainter::rotate and Qwt problems

    You have to take care about the origin of your rotation. Your code rotates around the top left position of the plot cancas.

    Rotating the text around the center of a rectangle would work like this ( untested, out of my memory ):

    Qt Code:
    1. QRectF textRect QwtScaleMap::transform(xMap, yMap, QRectF(-14,-595,100,100) );
    2. painter->save();
    3. painter->translate( textRect.center() );
    4. painter->rotate( -90 - i * 7.2);
    5.  
    6. textRect.moveCenter( QPointF( 0.0, 0.0 ) );
    7. QwtPainter::drawText(painter, textRect, Qt::AlignLeft | Qt::AlignBottom, QString::number);
    8.  
    9. painter->restore();
    To copy to clipboard, switch view to plain text mode 
    But in your case I guess you want to align the rotated text to a specific position not to the center of some pointless rectangle.

    HTH,
    Uwe

  2. The following user says thank you to Uwe for this useful post:

    alex_sh (20th October 2011)

Similar Threads

  1. Problems with QPainter
    By franco.amato in forum Qt Programming
    Replies: 13
    Last Post: 15th March 2010, 07:29
  2. Problems with QPainter
    By franco.amato in forum Qt Programming
    Replies: 11
    Last Post: 23rd November 2009, 20:54
  3. Qt3-QPainter rotate exception
    By Raccoon29 in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2007, 17:43
  4. Replies: 3
    Last Post: 30th April 2006, 19:22
  5. QPainter rotate function
    By ir210 in forum Newbie
    Replies: 3
    Last Post: 17th January 2006, 04:31

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.