Results 1 to 1 of 1

Thread: Am I not understanding QPixmaps? SOLVED!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Am I not understanding QPixmaps? SOLVED!

    Hi All,

    Using MSVS C++ 2008 Express, with Qt 4.4.1, I'm trying to use a QPixmap (in a QGraphicsScene with a QGraphicsView) to represent a dynamic map. It has a colored background (via fill()), and I draw lines on it (via painter's drawPolylines()). First time my method to draw the map is called, it works fine. Subsequent calls to it appear to do nothing, as the displayed QPixmap lines do not change. I even tried removing the code after the fill() just to see the fill() happen - it didn't! Am I not supposed to be using a QPixmap this way? Code snippet below; am I missing something obvious? THANKS!

    bjh

    Qt Code:
    1. void Window::drawMap()
    2. {
    3. // draw the pixmap of the map!
    4. gui_pixmap->fill("blanchedalmond");
    5. for (int i=0; i<iDBLinkCount; i++)
    6. {
    7. drawOnePolyline(i, DBLinkRank[i]);
    8. }
    9. drawTextNames(100);
    10. //scene->update();
    11. }
    To copy to clipboard, switch view to plain text mode 

    Problem solved. I was using the QPixmap as a BackgroundBrush, and neglected to add these two statements to where the map gets redrawn:
    Qt Code:
    1. backBrush->setTexture(*gui_pixmap);
    2. view->setBackgroundBrush(*backBrush);
    To copy to clipboard, switch view to plain text mode 

    Sorry to have posted without looking at my code more thoroughly!
    Last edited by bjh; 18th September 2008 at 20:14. Reason: problem solved!

Similar Threads

  1. understanding QwtPlot::transform()
    By b.mourat in forum Qwt
    Replies: 1
    Last Post: 25th May 2008, 08:43
  2. how to merge QPixmaps
    By tommy in forum Qt Programming
    Replies: 2
    Last Post: 27th March 2008, 13:02
  3. Are transparent QPixmaps possible?
    By eric in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2007, 21:43
  4. QThread - general understanding
    By soul_rebel in forum Qt Programming
    Replies: 10
    Last Post: 22nd August 2007, 00:15
  5. Replies: 7
    Last Post: 18th July 2006, 22:33

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.