Results 1 to 1 of 1

Thread: Am I not understanding QPixmaps? SOLVED!

  1. #1
    Join Date
    Sep 2007
    Qt products

    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!


    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 19:14. Reason: problem solved!

Similar Threads

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


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.