[Development] Speaking about Icons.

Olivier Goffart olivier at woboq.com
Mon May 14 20:04:44 CEST 2012


On Monday 14 May 2012 17:48:07 Olivier Goffart wrote:
> On Monday 14 May 2012 17:05:46 Corentin Jabot wrote:
> > Hi.
> > 
> > The methods setWindowIcon are not yet implemented in Qt5.
> > That concerns QWindow, QWidget and QApplication.
> > 
> > I guess the reason for that is that QIcon is part of QtWidget and not
> > QtGui. QIcon seems not movable, it use a lot of QWidget styles stuffs
> > 
> > For that reason the not-implemented QWindow::setWindowIcon ( as well
> > as QPlatformWindow::setWindowIcon) take a QImage as parameter.
> > So it will only use one image for all sizes the system required, and
> > icon will certainly look ugly as they are upscale/downscale too much.
> > 
> > For that reason I think we need something like a QWindowIcon or a
> > QApplicationIcon to stores a different QImage for different size.
> > It's a sub-optimal solution, because the setWindowIcon will have
> > different signature in QtGui and QtWidget.
> > 
> > So ..
> > 
> > Can you think of something better ?
> > What should be the features & api of QWindow Icon.  ?
> > Is it still time for this change in 5.0 ? or should we wait 5.1 ?  I
> > think in both case, we have to start using it privately if we want
> > keep QWidget::setWindowIcon working.
> > 
> > This change is mostly required for linux, since windows will use the
> > icon provided by the RC file and Mac using the one declared by
> > Info.plist.
> > 
> > 
> > I worked on a small ugly change about this issue
> > https://codereview.qt-project.org/#change,25373 , just to see what
> > would need to be done.
> 
> This has already been discussed there:
> http://lists.qt-project.org/pipermail/development/2012-January/001127.html
> 
> IMHO:
> 
>  - QIcon is the exact candidate for that.
> 
>  - There is nothing that is tying QIcon to QtWidget, it really belongs to
> QtGui.
> 
>  - As for QIcon::fromTheme, some API could be added to the Theme QPA plugin,
> and its implementation moved there.
> 
>  (- But QIcon only make sens on Desktop so Nokia has nothing to care)
> 
> So I think QIcon should be moved to QtGui.

I went ahead and made the patch to move QIcon to QtGui
https://codereview.qt-project.org/#change,26180

-- 
Olivier

Woboq - Qt services and support - http://woboq.com




More information about the Development mailing list