[Qt] is it possible to call private grabMouseWhileInWindow function?

Den Jean Den.Jean at telenet.be
Sun Jan 4 14:58:21 CET 2009


On Sunday 04 January 2009 14:50:34 Den Jean wrote:
> > Qt mouse grab is very heavy. On windows it can grab input so that only
> void QWidgetPrivate::grabMouseWhileInWindow()
...
> {
>     Q_Q(QWidget);
>     if (!qt_nograb()) {
>         if (mouseGrb)
>             mouseGrb->releaseMouse();
>         Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
>         SetCapture(q->effectiveWinId());
>         mouseGrb = q;
> #ifndef QT_NO_CURSOR
>         mouseGrbCur = new QCursor(mouseGrb->cursor());
> #endif

Note how qt_nograb() is used everywhere. Trolltech advise
to launch apps with -nograb for debugging. For Lazarus launched LCL/Qt apps
we could do this by default ? To ease debugging. Probably need the Qt debug 
libs.

./gui/kernel/qapplication_win.cpp:
...
#if defined(QT_DEBUG)
static bool        appNoGrab        = false;        // mouse/keyboard grabbing
#endif
...
bool qt_nograb()                                // application no-grab option
{
#if defined(QT_DEBUG)
    return appNoGrab;
#else
    return false;
#endif
}
...
#if defined(QT_DEBUG)
            if(arg == "-nograb")
                appNoGrab = !appNoGrab;
            else
#endif // QT_DEBUG






More information about the Qt mailing list