maverick_pol
27th February 2008, 12:39
Hi,
I have already enabled updates for the graphicsView, set cacheBackground as the mode for updating the gview. I need to change the background color. WHen I set the colour and invoke update/repaint for the view or viewport nothing happens. When I invoke "fitInView(..sceneRect)" the background is repainted.
How to update the background using update/repaint/etc ?
My view settings:
...
m_view->setCacheMode(QGraphicsView::CacheBackground);
m_view->setOptimizationFlag(QGraphicsView::DontClipPainter );
m_view->setOptimizationFlag(QGraphicsView::DontSavePainter State);
m_view->setViewportUpdateMode(QGraphicsView::FullViewportU pdate);
m_view->setRenderHints( QPainter::HighQualityAntialiasing);
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) ;
....
While initializing the view I can set view->setBackgroundColor(Qt::blue),etc. And it works fine. But how to update the backgroundcolor later?
Thanks.
I have already enabled updates for the graphicsView, set cacheBackground as the mode for updating the gview. I need to change the background color. WHen I set the colour and invoke update/repaint for the view or viewport nothing happens. When I invoke "fitInView(..sceneRect)" the background is repainted.
How to update the background using update/repaint/etc ?
My view settings:
...
m_view->setCacheMode(QGraphicsView::CacheBackground);
m_view->setOptimizationFlag(QGraphicsView::DontClipPainter );
m_view->setOptimizationFlag(QGraphicsView::DontSavePainter State);
m_view->setViewportUpdateMode(QGraphicsView::FullViewportU pdate);
m_view->setRenderHints( QPainter::HighQualityAntialiasing);
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) ;
....
While initializing the view I can set view->setBackgroundColor(Qt::blue),etc. And it works fine. But how to update the backgroundcolor later?
Thanks.