Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.2
-
None
Description
When a widget is hidden/shown with the cursor over it then a mouse move event is sent on Windows. This only happens when the widget being hidden is not a native widget, if it is a native one then only the enter/leave is sent as expected.
#include <QtGui> class MyWidget : public QWidget { public: MyWidget(const QColor &col, QWidget *parent = 0) : QWidget(parent) { setAutoFillBackground(true); QPalette pal = palette(); pal.setColor(QPalette::Window, col); setPalette(pal); setMouseTracking(true); } protected: void enterEvent(QEvent *e) { qDebug() << "Enter Event" << this; } void leaveEvent(QEvent *e) { qDebug() << "Leave Event" << this; } void mouseMoveEvent(QMouseEvent *e) { qDebug() << "Mouse Move Event" << this; } }; int main(int argc, char **argv) { QApplication a(argc, argv); //a.setAttribute(Qt::AA_NativeWindows); MyWidget w(Qt::blue); w.setFixedSize(500, 500); QPushButton *pb = new QPushButton("Hide", &w); QPushButton *pb2 = new QPushButton("Show", &w); pb2->move(100, 0); MyWidget *child = new MyWidget(Qt::red, &w); child->setFixedSize(200, 200); child->move(50, 50); QObject::connect(pb, SIGNAL(clicked()), child, SLOT(hide())); QObject::connect(pb2, SIGNAL(clicked()), child, SLOT(show())); w.show(); return a.exec(); }