Results 1 to 4 of 4

Thread: QPainter rotate function

  1. #1
    Join Date
    Jan 2006
    Posts
    7
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default QPainter rotate function

    Hi,

    I have problem with QCanvas since the beginning of my development time with qt. My newest problem is with QPainter inside QCanvasPolygonalItem's subclass.

    Here is my code.
    Qt Code:
    1. void drawShape(QPainter* p)
    2. {
    3. p.rotate(45);
    4. p.drawRect(x(), y(), width(), height() ); // or something similiar, I forget
    5. p.rotate(-45); // as suggested in documentation
    6. }
    To copy to clipboard, switch view to plain text mode 

    I found it flickering at runtime. anyone could help me with this problem? since flickering is my only problem with QCanvas.

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter rotate function

    To avoid flickering use the Double buffereing technique.
    Paint to another pixmap and use bitblt to draw it to the canvas

    The technique is explained in the C++ GUI Programming with Qt 3
    Last edited by sunil.thaha; 16th January 2006 at 06:34.
    We can't solve problems by using the same kind of thinking we used when we created them

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter rotate function

    Quote Originally Posted by sunil.thaha
    To avoid flickering use the Double buffereing technique.
    Paint to another pixmap and use bitblt to draw it to the canvas
    QCanvas has built-in support for double buffering.

    void QCanvas::setDoubleBuffering ( bool y ) [virtual]
    If y is TRUE (the default) double-buffering is switched on; otherwise double-buffering is switched off.
    Turning off double-buffering causes the redrawn areas to flicker a little and also gives a (usually small) performance improvement.

  4. #4
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter rotate function

    Thanks Jacek
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 15:22
  2. Regading Driver to connect Postgresql Database
    By dummystories in forum Installation and Deployment
    Replies: 38
    Last Post: 12th March 2009, 08:19
  3. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 13:57
  4. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 18:33
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 13:52

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.