PDA

View Full Version : Check if current item is undemouse() crash!?!?!?



ruben.rodrigues
16th August 2011, 10:27
Hi!

I want to see if the current widget is also under the mouse. I used the function this->mouseGrabber()->underMouse() which gives me a segmentation fault.

then I tried this one:


QWidget *w = new QWidget(this->mouseGrabber());

if(w->underMouse()){
//Do something
}

but it return me false...I believe this should work

Jonny174
16th August 2011, 13:04
Try:


QWidget *w = dynamic_cast<QWidget *>( this->mouseGrabber() );

if (w)
{
if (w->underMouse())
{
//Do something
}
}

stampede
16th August 2011, 13:45
I want to see if the current widget is also under the mouse.
Why not just :


if( this->underMouse() ){
// do something
}