Qt4 & enter/exit modal functions

Hamish Rodda rodda at kde.org
Mon May 23 14:28:01 BST 2005


On Mon, 23 May 2005 09:31 pm, Matthias Ettrich wrote:
> On Monday 16 May 2005 14:26, Lars Knoll wrote:
> > On Sunday 15 May 2005 13:52, Hamish Rodda wrote:
> > > Hi,
> > >
> > > In the course of porting kdelibs to Qt4, we've come across the
> > > no-longer-available qt_enter_modal and qt_leave_modal functions, which
> > > were internal to qt and accessed via defines in the files which wanted
> > > to use them.
> > >
> > > The functionality seems to have been moved to QApplicationPrivate
> > > (enterModal and leaveModal), and the quick & dirty patch to change our
> > > code to this is attached.  However, this introduces a dependancy on
> > > internal headers which is no good if the internal headers ever have a
> > > BIC change during KDE4.
> > >
> > > So, does anyone know a better way to do this?  And, is it ok to commit
> > > this in the interim, because it holds back quite a bit from
> > > compilation...
> >
> > What about using QEventLoop::processEvents(QEventLoop::ExcludeUserInput)?
> > Would that be enough for you?
>
> The KDE code fakes a modal event using private API and then calls
> QApplication::enter_loop(). enter_loop() is an obsolete function, it does
> the following:
>
>     QEventLoop eventLoop;
>     eventLoop.exec();
>
>
> Hamish, if you drop the idea of faking a modal widget and simply do
>
>     QEventLoop eventLoop;
>     connect(this, SIGNAL(leaveModality()), &eventLoop, SLOT(quit()));
>     eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
>
> you should get exactly want you want. Emit the leaveModality() signal when
> you are done, and the temporary event loop will terminate.

Thanks, it seems that Zack has already taken care of that throughout 
kdelibs :)

Cheers,
Hamish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050523/e6823c70/attachment.sig>


More information about the kde-core-devel mailing list