[Qt] QTabWidget problem
Den Jean
Den.Jean at telenet.be
Thu Jan 29 20:52:27 CET 2009
On Wednesday 28 January 2009 08:42:46 zeljko wrote:
> Hi all,
>
> After latest patches about focuspolicy (I've completely removed handling of
> tab & backtab from qt, now LCL controls that part), we have pending problem
> with QTabWidget. QTabWidget::keyPressEvent(QKeyEvent *e) drive us into
> problem since it handles Tab key before that event is passed to LCL, and
> sets focus to tabbar.
I am not convinced the analysis is correct, focus is probably not nil.
The Qt tab dialog
see example program qt-x11-opensource-src-4.4.3/examples/dialogs/tabdialog
works correctly, you can tab from child field to
child field and Ctrl-tab to next page.
> Original code is here (shorten)
> void QTabWidget::keyPressEvent(QKeyEvent *e)
> .... blablablbalbla
>
> }
> if (!qApp->focusWidget()) <--------- THIS IS PROBLEM
> d->tabs->setFocus(); <--------- THIS IS PROBLEM
> } else {
> e->ignore();
> }
>
> So, QT always handles tab key at this place, and if qApp->focusWidget()
> returns NULL our focus is jailed into tabbar, and we must use mouse to get
> out of tabbar. That's because we set QtClickFocus on all widgets with
> TabStop=TRUE, and tabbar searches for widget with QtStrongFocus or
> QtTabFocus.
Though the binding does not allow overriding of virtual methods in pascal
and we sometimes need to manually write qlcl* to override stuff, note however
that almost all these methods are called upon from the eventfilter, if you
carefully craft your eventfilter, the unwanted call to keyPressEvent can be
avoided.
Anyhow if you let Qt do its work -> it works fine, it you want to silence
(shut up) Qt and let LCL do this work, well you should be able to this with
the eventfilters. The fact that it does not work now, is proof that
your existing eventfilters manage to shut up Qt, but the correct LCL calls are
not there!
I will look into your eventfilters
kind regards,
Den Jean
More information about the Qt
mailing list