Skip to content

Commit 092cb98

Browse files
MaarrkHTRamsey
authored andcommitted
Allow custom build to override application window icon on Linux
1 parent 24fe55c commit 092cb98

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/QGCApplication.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ QGCApplication::QGCApplication(int &argc, char *argv[], bool unitTesting, bool s
104104
setOrganizationName(QGC_ORG_NAME);
105105
setOrganizationDomain(QGC_ORG_DOMAIN);
106106
setApplicationVersion(QString(QGC_APP_VERSION_STR));
107-
#ifdef Q_OS_LINUX
108-
setWindowIcon(QIcon(":/res/qgroundcontrol.ico"));
109-
#endif
110107

111108
// Set settings format
112109
QSettings::setDefaultFormat(QSettings::IniFormat);
@@ -274,6 +271,14 @@ void QGCApplication::_initForNormalAppBoot()
274271
// Image provider for Optical Flow
275272
_qmlAppEngine->addImageProvider(_qgcImageProviderId, new QGCImageProvider());
276273

274+
// Set the window icon now that custom plugin has a chance to override it
275+
#ifdef Q_OS_LINUX
276+
QUrl windowIcon = QUrl("qrc:/res/qgroundcontrol.ico");
277+
windowIcon = _qmlAppEngine->interceptUrl(windowIcon, QQmlAbstractUrlInterceptor::UrlString);
278+
// The interceptor needs "qrc:/path" but QIcon expects ":/path"
279+
setWindowIcon(QIcon(":" + windowIcon.path()));
280+
#endif
281+
277282
// Safe to show popup error messages now that main window is created
278283
_showErrorsInToolbar = true;
279284

0 commit comments

Comments
 (0)