[Development] QApplication::setWindowIconFromTheme()?

René J.V. Bertin rjvbertin at gmail.com
Tue May 24 17:05:35 CEST 2016


Hello,

I'm seeing lots of cross-platform code that does things like

qApp->setWindowIcon(QIcon::fromTheme(QStringLiteral("foo")))

which works fine on platforms where fromTheme() has actual icon themes in its search path. On platforms where the application icon is set statically (OS X, MS Windows) and where applications do not have icon theme seach paths by default, this will more often than not lead to a runtime disposal of the application icon. On OS X, such applications show up with a generic icon in the Dock and app switcher.

Would it be possible to discuss the addition of a convenience method as shown below?

void QApplication::setWindowIconFromTheme(QString &name)
{
	setWindowIcon(QIcon::fromTheme(name, windowIcon()));
}

R



More information about the Development mailing list