Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.5.3
-
None
Description
In some cases, the event QEvent::HoverLeave is never sent to a widget inside graphics view. The widgets keep the hover state even when the mouse has left the widget.
This can be reproduced with the styles Oxygen and Windows XP.
Here is an exemple to reproduce the problem. If you click on the last pixel of the border of the top button, the button below remains in hover state.
#include <QtGui>
class VerboseButton : public QPushButton
{
bool event(QEvent* e)
{
if (QEvent::HoverEnter == e->type())
else if(QEvent::HoverLeave == e->type())
{ qDebug("QEvent::HoverLeave"); }else if(QEvent::HoverMove == e->type())
{ qDebug("QEvent::HoverMove"); }else if(QEvent::Enter == e->type())
{ qDebug("QEvent::Enter"); }else if(QEvent::Leave == e->type())
{ qDebug("QEvent::Leave"); } return QPushButton::event(e);
}
};
class Scene : public QGraphicsScene
{
Q_OBJECT
public:
Scene()
public slots:
void hideButton()
void showButton()
{ topButton->show(); }private:
QGraphicsProxyWidget *topButton;
};
#include "main.moc"
int main(int argc, char **argv){
QApplication app(argc, argv);
QGraphicsView view;
Scene scene;
view.setScene(&scene);
view.resize(600, 600);
view.show();
return app.exec();
}