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 <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2021-11-30 14:24:50 +01:00
parent 355105b7a2
commit 46f611bee1

View File

@@ -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()