PDA

View Full Version : hovering problem in QGraphicsItem



wagmare
13th March 2009, 11:12
hi friends,

i tried an QGraphicsPixmapItem() hovering method like the
example : drilldown

i add that item to my QGraphicsScene and its working fine ...... i add that GraphicsView to a dialog say .. mainwindowdialog ...
there also it works fine .. when i hover the mouse over the item it scaled perfectly ..

the problem starts when i set styleSheet to mainwindowdialog in Qt designer

right click->changeStyleSheet
background-color: rgba(107, 121, 118, 220);

then the scaling of the item become slower comparing to the previous time ... i think the paintEvent takes more time to repaint with the new color value when the mouse hover over the item ...
i need to set the background color ... so how can i rectify this problem ...
please help

wysota
13th March 2009, 12:06
Don't use stylesheets, use the palette.

wagmare
13th March 2009, 13:20
Don't use stylesheets, use the palette.

thanks for reply ...
i will change it to QPalette ... but why..not stylesheet ?

wagmare
13th March 2009, 14:38
thanks ... it works fine ...
widget->setPalette(QColor) works fine ... now the rendering speed is normal as previous ... but what is the difference b/w using stylesheet and QPalette in rendering paintEvent ...

wysota
13th March 2009, 18:31
Stylesheet is slower, there is more work involved in it. If you can do something using a palette, use palette.