From 46f611bee1dfbf415070022906799af88eedad33 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 30 Nov 2021 14:24:50 +0100 Subject: [PATCH] Fix icon for headers and sources on macOS/Windows On macOS and Windows, we used the system icon for C/C++ source and header files. This was probably done under the assumption that the system would have sensible icons registered for these types via Xcode/ Visual Studio, but actually that assumption is not very well founded. For example I have set emacs as the default editor when double clicking C/C++ files, and then get the same little emacs icon on all .h and .cpp files in Qt Creator, which is not useful. There seem to be more effects on macOS 12 leading to a generic icon too. Fixes: QTCREATORBUG-26586 Change-Id: I88616b28d51f1583324bac9c802c9cc5bbc8ee70 Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/cppeditorplugin.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index 409f297844d..bb60fb921a1 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -450,17 +450,15 @@ void CppEditorPlugin::extensionsInitialized() d->m_cppEditorFactory.addHoverHandler(new ColorPreviewHoverHandler); d->m_cppEditorFactory.addHoverHandler(new ResourcePreviewHoverHandler); - if (!HostOsInfo::isMacHost() && !HostOsInfo::isWindowsHost()) { - FileIconProvider::registerIconOverlayForMimeType( - creatorTheme()->imageFile(Theme::IconOverlayCppSource, ":/cppeditor/images/qt_cpp.png"), - Constants::CPP_SOURCE_MIMETYPE); - FileIconProvider::registerIconOverlayForMimeType( - creatorTheme()->imageFile(Theme::IconOverlayCSource, ":/cppeditor/images/qt_c.png"), - Constants::C_SOURCE_MIMETYPE); - FileIconProvider::registerIconOverlayForMimeType( - creatorTheme()->imageFile(Theme::IconOverlayCppHeader, ":/cppeditor/images/qt_h.png"), - Constants::CPP_HEADER_MIMETYPE); - } + FileIconProvider::registerIconOverlayForMimeType( + creatorTheme()->imageFile(Theme::IconOverlayCppSource, ":/cppeditor/images/qt_cpp.png"), + Constants::CPP_SOURCE_MIMETYPE); + FileIconProvider::registerIconOverlayForMimeType( + creatorTheme()->imageFile(Theme::IconOverlayCSource, ":/cppeditor/images/qt_c.png"), + Constants::C_SOURCE_MIMETYPE); + FileIconProvider::registerIconOverlayForMimeType( + creatorTheme()->imageFile(Theme::IconOverlayCppHeader, ":/cppeditor/images/qt_h.png"), + Constants::CPP_HEADER_MIMETYPE); } void CppEditorPlugin::switchDeclarationDefinition()