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
->setOptimizationFlag
(QGraphicsView::DontSavePainterState);
m_view
->setViewportUpdateMode
(QGraphicsView::FullViewportUpdate);
m_view
->setRenderHints
( QPainter::HighQualityAntialiasing);
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
....
...
m_view->setCacheMode(QGraphicsView::CacheBackground);
m_view->setOptimizationFlag(QGraphicsView::DontClipPainter);
m_view->setOptimizationFlag(QGraphicsView::DontSavePainterState);
m_view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
m_view->setRenderHints( QPainter::HighQualityAntialiasing);
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
....
To copy to clipboard, switch view to plain text mode
While initializing the view I can set view->setBackgroundColor(Qt::blue),etc. And it works fine. But how to update the backgroundcolor later?
Thanks.
Bookmarks