Do not use QWidget::showFullScreen() etc. (was Re: KDE)

Allen Winter winter at kde.org
Sat Mar 15 01:17:32 GMT 2008


On Thursday 13 March 2008 08:59:29 Allen Winter wrote:
> On Thursday 13 March 2008 04:14:55 Matthias Kretz wrote:
> > On Tuesday 11 March 2008, Lubos Lunak wrote:
> > > > Remove usage of
> > > > QWidget::show[FullScreen|Maximized|Minimized|Normal](), they do more
> > > > then just change the state of the window and all these usage cases
> > > > were wrong (that is, all their usage).
> > > > For changing the state, use something like
> > > > window->setWindowState( window->windowState() | Qt::WindowFullScreen
> > > > ); // set
> > > > window->setWindowState( window->windowState() & ~Qt::WindowFullScreen
> > > > ); // reset
> > > > or simply use the new KToggleFullScreenAction::setFullScreen()
> > > >  helper.
> > >
> > >  People, please do not use QWidget::showFullScreen(),
> > > QWidget::showMaximized(), QWidget::showMinimized() or
> > > QWidget::showNormal(), unless you know what they actually do and you
> > > really want that. Which is probably never. For example,
> > > QWidget::showNormal() is not an inverse of QWidget:showFullScreen(),
> > > and QWidget::showFullScreen() also doesn't just set the window to
> > > fullscreen (#157941). I personally consider these to be broken API,
> > > although TT apparently doesn't share my opinion.
> > >
> > >  Use QWidget::setWindowState() as noted above, or some of the helper
> > > functions.
> >
> > I guess the best way to "enforce" this is to add a krazy check for those
> > functions and adding an explanation to techbase which the krazy checker
> > can link to in its output.
>
> If someone writes the "Qt stuff to avoid" techbase page, I'll write the
> corresponding Krazy checker.  I recall someone telling me that
> QImage::depth() should be avoided as well... iirc.
>

Done.
A new Krazy checker to look for the QWidget methods showNormal(),
showFullScreen(), showMaximized() and showMinimized() will
start running on the EBN starting tomorrow.

Let me know about other Qt methods to add to the checker
and when the Policy techbase doc is ready.

-Allen

 





More information about the kde-core-devel mailing list