Results 1 to 2 of 2

Thread: Painting in QCanvasView

  1. #1
    Join Date
    Feb 2007
    Posts
    31
    Thanks
    11

    Default Painting in QCanvasView

    I'm trying to learn... I went out and bought the book "C++ GUI Programming with Qt 4" - and then realized that my project at work is in Qt 3. I'm making some mods to the project but upgrading to Qt 4 is not an option.

    I'm trying to understand how painting is done in QCanvasView. I'm using a QCanvas that has a bright red background and stores a large (dark) image in a QPixmap. When I have an image loaded, it flickers a lot as you scroll through the CanvasView. I set breakpoints during a repaint, and noticed that QCanvasView first shows the QCanvas background color before it shows the pixmap. Can I get it to stop painting the background color when there is an image loaded?

    Thanks a lot,
    Jim

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Painting in QCanvasView

    No, but you can use QCanvas::setBackgroundPixmap to set the pixmap as the background. This should prevent the solid background from being drawn. Also try repainting as little as you can (for instance avoid marking the whole canvas as changed).

Similar Threads

  1. QCanvasView question
    By JimBrown in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2007, 22:34
  2. About painting
    By Pang in forum Qt Programming
    Replies: 3
    Last Post: 28th March 2007, 17:21
  3. Painting lines
    By therealjag in forum Newbie
    Replies: 34
    Last Post: 23rd March 2006, 22:43
  4. Painting to QTextEdit
    By gesslar in forum Qt Programming
    Replies: 8
    Last Post: 18th February 2006, 18:40
  5. Trouble with image painting (QPainter + QImage)
    By krivenok in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2006, 20:25

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.