[Qt-interest] Problem: X Error: BadWindow (invalid Window parameter) 3 ...
Zeljko
zeljko at holobit.net
Thu Feb 5 16:08:36 CET 2009
Bjoern Erik Nilsen wrote:
>> The algorithm can easily be improved further, but I will leave that as
>> an exercise for the reader :-)
>
> Just come to think of it, this approach won't work as expected when
> having mouse grabbers (grabMouse() or press-and-hold on a mouse button).
> In that case the Qt::WA_UnderMouse is updated slightly different. The
> attribute is basically updated whenever the widget gets enter/leave
> events.
>
> If you are in doubt whether you can use it or not, I suggest you stick
> with widgetAt()/topLevelAt() to make sure your application continues to
> work as intended.
>
> Anyways, I'm not able to trigger any X errors using
> widgetAt()/topLevelAt(), so your application is very much appreciated in
> my inbox :-)
Don't need, I've found why/where/how it happens .... before each call to
widgetAt() I'm calling QCursor::pos(), so it happens when QCursor::pos() is
called when program is inside widgetAt() call.
Regular rule:
--> QCursor::pos() enter
<-- QCursor::pos() exit .. (gives point for widgetAt())
--> widgetAt() enter
<-- widgetAt() exit
Problem rule:
--> widgetAt() enter
--> QCursor::pos() enter
<-- QCursor::pos() exit
.....never gets widgetAt() EXIT HERE !!!
I've fixed that via mutexes in my app, but asking shouldn't qt be be prone
in such case ?
zac.
More information about the Qt-interest-old
mailing list