PDA

View Full Version : Hidden QPushButton on top of graphics scene (Maemo)



Miihkali
19th October 2009, 21:44
This probably belongs to maemo community but I guess it's worth a shot...

There is a QPushButton derived button drawn on top of graphics scene. It's rendered as expected and works as expected. The problem is that when I hide the button with setVisible(false) the button is hidden but a white rectangle remains in the button position. This seems to happen only if the button is drawn on top of graphics scene. If it's drawn on main window the hiding works ok.

I tried to set Qt::WA_TranslucentBackground attribute to button yet similar problem remains after hiding it. In this case the remaining rectangle is transparent instead of white but it's not transparent relative to scene. Instead it shows the main window that is underneath the scene (the scene is drawn on a separate dialog that is drawn on top of main window).

See the attached screenshot for clarification. There are three buttons, one visible and two hidden. The lower image shows the situation with Qt::WA_TranslucentBackground attribute set.

Hiding the button works fine on Windows and on Ubuntu but the problem exists on Qt 4.5.2 running on Maemo 4.1.2.

wysota
19th October 2009, 23:55
You may try calling QGraphicsScene::invalidate() with the geometry of your button after hiding it. Alternatively make your button embedded into the scene through QGraphicsProxyWidget.

Miihkali
20th October 2009, 09:40
Nope, neither didn't help. However, I noticed that background is drawn badly only if the button is hidden before drawing takes place. If I show and hide the button again it is drawn correctly.