Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.2, 4.6.2
-
None
Description
When a widget gets moved under the mouse (and not the mouse gets moved by the
user over the widget), then QWidget::underMouse() returns a wrong value - it
tells me the widget is NOT under the mouse, although it is.
Attached you find my test application.
Clicking on the button b1 moves the button b2 to the position where b1 is and
b1 is set to invisible.
Now I ask b2::underMouse - and to be sure, I ask after a singleShot timer
again.
Both underMouse() calls deliver false, which is wrong.
This is Qt4.5.2, openSuse 11.1
example code:
#include <QApplication>
#include <QPushButton>
#include <QTimer>
QPushButton *b1;
QPushButton *b2;
class Object : public QObject
{
Q_OBJECT
public:
public slots:
void clicked()
void later()
{ qWarning("b2 under mouse:%d", b2->underMouse()); }};
int main( int argc, char *argv[] )
{
QApplication app(argc, argv);
Object o;
QWidget *w = new QWidget;
b1 = new QPushButton("b1", w);
b2 = new QPushButton("b2", w);
b1->move(100, 100);
b1->connect(b1, SIGNAL(clicked()), &o, SLOT(clicked()));
w->show();
return app.exec();
}
#include "moc_main.cpp"