From 67212a31ee4cc5c026b677329ace9f1fdaa3320c Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 1 Sep 2023 12:28:51 +0200 Subject: [PATCH] Utils: Cache theme icon access These trigger over 120k file exist check on my machine on startup, just for a handful icons. Change-Id: Ic73f0783142ed329c2f8c8b852f622e69fc306da Reviewed-by: Alessandro Portale --- src/libs/utils/fancylineedit.cpp | 10 ++-- src/libs/utils/icon.cpp | 48 +++++++++++++++++++ src/libs/utils/icon.h | 2 + src/libs/utils/utilsicons.cpp | 1 + src/libs/utils/utilsicons.h | 1 + src/libs/utils/wizard.cpp | 3 +- ...droidmanifesteditoriconcontainerwidget.cpp | 6 +-- .../android/splashscreencontainerwidget.cpp | 6 +-- src/plugins/clangcodemodel/clangtextmark.cpp | 2 +- src/plugins/clangtools/diagnosticmark.cpp | 2 +- .../fileapidataextractor.cpp | 5 +- .../editormanager/editormanager.cpp | 2 +- src/plugins/coreplugin/find/findtoolbar.cpp | 2 +- src/plugins/coreplugin/mainwindow.cpp | 37 +++++++------- src/plugins/cppcheck/cppchecktextmark.cpp | 2 +- .../languageclient/diagnosticmanager.cpp | 2 +- .../texteditor/circularclipboardassist.cpp | 6 ++- 17 files changed, 92 insertions(+), 45 deletions(-) diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index e5de16e3e84..09fe9380197 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -431,13 +431,9 @@ void FancyLineEdit::setFiltering(bool on) // KDE has custom icons for this. Notice that icon namings are counter intuitive. // If these icons are not available we use the freedesktop standard name before // falling back to a bundled resource. - QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ? - QLatin1String("edit-clear-locationbar-rtl") : - QLatin1String("edit-clear-locationbar-ltr"), - QIcon::fromTheme(QLatin1String("edit-clear"), - Icons::EDIT_CLEAR.icon())); - - setButtonIcon(Right, icon); + static const QIcon rtl = Icon::fromTheme("edit-clear-locationbar-rtl"); + static const QIcon ltr = Icon::fromTheme("edit-clear-locationbar-ltr"); + setButtonIcon(Right, layoutDirection() == Qt::LeftToRight ? ltr : rtl); setButtonVisible(Right, true); setPlaceholderText(Tr::tr("Filter")); setButtonToolTip(Right, Tr::tr("Clear text")); diff --git a/src/libs/utils/icon.cpp b/src/libs/utils/icon.cpp index 9c7625e32b2..e4945efa9bd 100644 --- a/src/libs/utils/icon.cpp +++ b/src/libs/utils/icon.cpp @@ -6,6 +6,7 @@ #include "qtcassert.h" #include "theme/theme.h" #include "stylehelper.h" +#include "utilsicons.h" #include #include @@ -234,4 +235,51 @@ QIcon Icon::combinedIcon(const QList &icons) return combinedIcon(qIcons); } +QIcon Icon::fromTheme(const QString &name) +{ + static QHash cache; + + auto found = cache.find(name); + if (found != cache.end()) + return *found; + + QIcon icon = QIcon::fromTheme(name); + if (name == "go-next") { + cache.insert(name, !icon.isNull() ? icon : QIcon(":/utils/images/arrow.png")); + } else if (name == "document-open") { + cache.insert(name, !icon.isNull() ? icon : Icons::OPENFILE.icon()); + } else if (name == "edit-copy") { + cache.insert(name, !icon.isNull() ? icon : Icons::COPY.icon()); + } else if (name == "document-new") { + cache.insert(name, !icon.isNull() ? icon : Icons::NEWFILE.icon()); + } else if (name == "document-save") { + cache.insert(name, !icon.isNull() ? icon : Icons::SAVEFILE.icon()); + } else if (name == "edit-undo") { + cache.insert(name, !icon.isNull() ? icon : Icons::UNDO.icon()); + } else if (name == "edit-redo") { + cache.insert(name, !icon.isNull() ? icon : Icons::REDO.icon()); + } else if (name == "edit-cut") { + cache.insert(name, !icon.isNull() ? icon : Icons::CUT.icon()); + } else if (name == "edit-paste") { + cache.insert(name, !icon.isNull() ? icon : Icons::PASTE.icon()); + } else if (name == "zoom-in") { + cache.insert(name, !icon.isNull() ? icon : Icons::ZOOMIN_TOOLBAR.icon()); + } else if (name == "zoom-out") { + cache.insert(name, !icon.isNull() ? icon : Icons::ZOOMOUT_TOOLBAR.icon()); + } else if (name == "zoom-original") { + cache.insert(name, !icon.isNull() ? icon : Icons::EYE_OPEN_TOOLBAR.icon()); + } else if (name == "edit-clear-locationbar-rtl") { + // KDE has custom icons for this. Notice that icon namings are counter intuitive. + // If these icons are not available we use the freedesktop standard name before + // falling back to a bundled resource. + cache.insert(name, !icon.isNull() ? icon : Icons::EDIT_CLEAR.icon()); + } else if (name == "edit-clear-locationbar-ltr") { + cache.insert(name, !icon.isNull() ? icon : Icons::EDIT_CLEAR.icon()); + } else { + cache.insert(name, icon); + } + + return cache[name]; +} + } // namespace Utils diff --git a/src/libs/utils/icon.h b/src/libs/utils/icon.h index b1482410a3d..d26668082bf 100644 --- a/src/libs/utils/icon.h +++ b/src/libs/utils/icon.h @@ -61,6 +61,8 @@ public: static QIcon combinedIcon(const QList &icons); static QIcon combinedIcon(const QList &icons); + static QIcon fromTheme(const QString &name); + private: QList m_iconSourceList; IconStyleOptions m_style = None; diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index 01b1f0c1dbc..60928ae7945 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -288,6 +288,7 @@ const Icon MACOS_TOUCHBAR_BOOKMARK( ":/utils/images/macos_touchbar_bookmark.png"); const Icon MACOS_TOUCHBAR_CLEAR( ":/utils/images/macos_touchbar_clear.png"); + } // namespace Icons QIcon CodeModelIcon::iconForType(CodeModelIcon::Type type) diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h index 5a75267a363..33588dc0d58 100644 --- a/src/libs/utils/utilsicons.h +++ b/src/libs/utils/utilsicons.h @@ -148,6 +148,7 @@ QTCREATOR_UTILS_EXPORT extern const Icon CODEMODEL_FIXIT; QTCREATOR_UTILS_EXPORT extern const Icon MACOS_TOUCHBAR_BOOKMARK; QTCREATOR_UTILS_EXPORT extern const Icon MACOS_TOUCHBAR_CLEAR; + } // namespace Icons namespace CodeModelIcon { diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp index d80ef32c524..bbf22730a4f 100644 --- a/src/libs/utils/wizard.cpp +++ b/src/libs/utils/wizard.cpp @@ -5,6 +5,7 @@ #include "algorithm.h" #include "hostosinfo.h" +#include "icon.h" #include "qtcassert.h" #include "theme/theme.h" #include "utilstr.h" @@ -110,7 +111,7 @@ LinearProgressWidget::LinearProgressWidget(WizardProgress *progress, QWidget *pa m_dotsItemWidget(nullptr), m_disableUpdatesCount(0) { - m_indicatorPixmap = QIcon::fromTheme(QLatin1String("go-next"), QIcon(QLatin1String(":/utils/images/arrow.png"))).pixmap(16); + m_indicatorPixmap = Icon::fromTheme("go-next").pixmap(16); m_wizardProgress = progress; m_mainLayout = new QVBoxLayout(this); m_itemWidgetLayout = new QVBoxLayout(); diff --git a/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp b/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp index 10788598935..b6ccc7aeef0 100644 --- a/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp +++ b/src/plugins/android/androidmanifesteditoriconcontainerwidget.cpp @@ -10,10 +10,11 @@ #include #include +using namespace Utils; + namespace Android { namespace Internal { -namespace { const char extraExtraExtraHighDpiIconPath[] = "/res/drawable-xxxhdpi/"; const char extraExtraHighDpiIconPath[] = "/res/drawable-xxhdpi/"; const char extraHighDpiIconPath[] = "/res/drawable-xhdpi/"; @@ -27,7 +28,6 @@ const QSize highDpiIconSize{72, 72}; const QSize extraHighDpiIconSize{96, 96}; const QSize extraExtraHighDpiIconSize{144, 144}; const QSize extraExtraExtraHighDpiIconSize{192, 192}; -} AndroidManifestEditorIconContainerWidget::AndroidManifestEditorIconContainerWidget( QWidget *parent, @@ -40,7 +40,7 @@ AndroidManifestEditorIconContainerWidget::AndroidManifestEditorIconContainerWidg lowDpiIconSize, Tr::tr("Master icon"), Tr::tr("Select master icon.")); - masterIconButton->setIcon(QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon())); + masterIconButton->setIcon(Icon::fromTheme("document-open")); iconLayout->addWidget(masterIconButton); iconLayout->addStretch(1); diff --git a/src/plugins/android/splashscreencontainerwidget.cpp b/src/plugins/android/splashscreencontainerwidget.cpp index a30af15f24c..e0e203121df 100644 --- a/src/plugins/android/splashscreencontainerwidget.cpp +++ b/src/plugins/android/splashscreencontainerwidget.cpp @@ -185,17 +185,17 @@ SplashScreenContainerWidget::SplashScreenContainerWidget( m_masterImage = new QToolButton(this); m_masterImage->setToolTip(Tr::tr("Select master image to use.")); - m_masterImage->setIcon(QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon())); + m_masterImage->setIcon(Icon::fromTheme("document-open")); formLayout->addRow(Tr::tr("Master image:"), m_masterImage); m_portraitMasterImage = new QToolButton(this); m_portraitMasterImage->setToolTip(Tr::tr("Select portrait master image to use.")); - m_portraitMasterImage->setIcon(QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon())); + m_portraitMasterImage->setIcon(Icon::fromTheme("document-open")); formLayout->addRow(Tr::tr("Portrait master image:"), m_portraitMasterImage); m_landscapeMasterImage = new QToolButton(this); m_landscapeMasterImage->setToolTip(Tr::tr("Select landscape master image to use.")); - m_landscapeMasterImage->setIcon(QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon())); + m_landscapeMasterImage->setIcon(Icon::fromTheme("document-open")); formLayout->addRow(Tr::tr("Landscape master image:"), m_landscapeMasterImage); auto clearAllButton = new QToolButton(this); diff --git a/src/plugins/clangcodemodel/clangtextmark.cpp b/src/plugins/clangcodemodel/clangtextmark.cpp index e62dfad66ec..4f5be51a7c1 100644 --- a/src/plugins/clangcodemodel/clangtextmark.cpp +++ b/src/plugins/clangcodemodel/clangtextmark.cpp @@ -265,7 +265,7 @@ ClangdTextMark::ClangdTextMark(TextEditor::TextDocument *doc, // Copy to clipboard action QList actions; QAction *action = new QAction(); - action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon())); + action->setIcon(Icon::fromTheme("edit-copy")); action->setToolTip(Tr::tr("Copy to Clipboard", "Clang Code Model Marks")); QObject::connect(action, &QAction::triggered, [diag] { const QString text = ClangDiagnosticWidget::createText({diag}, diff --git a/src/plugins/clangtools/diagnosticmark.cpp b/src/plugins/clangtools/diagnosticmark.cpp index 3802ee325cf..90b4e19812d 100644 --- a/src/plugins/clangtools/diagnosticmark.cpp +++ b/src/plugins/clangtools/diagnosticmark.cpp @@ -39,7 +39,7 @@ DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *docum // Copy to clipboard action QList actions; QAction *action = new QAction(); - action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon())); + action->setIcon(Icon::fromTheme("edit-copy")); action->setToolTip(Tr::tr("Copy to Clipboard")); QObject::connect(action, &QAction::triggered, [diagnostic] { const QString text = createFullLocationString(diagnostic.location) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index ebb03d950fc..05574b9a007 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include @@ -516,8 +516,7 @@ FolderNode *createSourceGroupNode(const QString &sourceGroupName, if (!existingNode) { auto node = createCMakeVFolder(sourceDirectory, Node::DefaultFolderPriority + 5, p); node->setListInProject(false); - node->setIcon( - [] { return QIcon::fromTheme("edit-copy", ::Utils::Icons::COPY.icon()); }); + node->setIcon([] { return Icon::fromTheme("edit-copy"); }); existingNode = node.get(); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index d9db4daaab6..6bfb2ffea15 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -431,7 +431,7 @@ void EditorManagerPrivate::init() ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE); // Revert to saved - m_revertToSavedAction->setIcon(QIcon::fromTheme("document-revert")); + m_revertToSavedAction->setIcon(Icon::fromTheme("document-revert")); Command *cmd = ActionManager::registerAction(m_revertToSavedAction, Constants::REVERTTOSAVED, editManagerContext); cmd->setAttribute(Command::CA_UpdateText); diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index 7a4157e5975..187243ab4f9 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -256,7 +256,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind) connect(m_goToCurrentFindAction, &QAction::triggered, this, &FindToolBar::setFocusToCurrentFindSupport); - QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace")); + QIcon icon = Icon::fromTheme("edit-find-replace"); m_findInDocumentAction = new QAction(icon, Tr::tr("Find/Replace"), this); cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT); cmd->setDefaultKeySequence(QKeySequence::Find); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index ce961c5e26c..c95637181fb 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -548,7 +548,7 @@ void MainWindow::registerDefaultActions() connect(m_focusToEditor, &QAction::triggered, this, &MainWindow::setFocusToEditor); // New File Action - QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), Utils::Icons::NEWFILE.icon()); + QIcon icon = Icon::fromTheme("document-new"); m_newAction = new QAction(icon, Tr::tr("&New Project..."), this); cmd = ActionManager::registerAction(m_newAction, Constants::NEW); @@ -584,7 +584,7 @@ void MainWindow::registerDefaultActions() }); // Open Action - icon = QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon()); + icon = Icon::fromTheme("document-open"); m_openAction = new QAction(icon, Tr::tr("&Open File or Project..."), this); cmd = ActionManager::registerAction(m_openAction, Constants::OPEN); cmd->setDefaultKeySequence(QKeySequence::Open); @@ -612,7 +612,7 @@ void MainWindow::registerDefaultActions() ac->setOnAllDisabledBehavior(ActionContainer::Show); // Save Action - icon = QIcon::fromTheme(QLatin1String("document-save"), Utils::Icons::SAVEFILE.icon()); + icon = Icon::fromTheme("document-save"); QAction *tmpaction = new QAction(icon, Tr::tr("&Save"), this); tmpaction->setEnabled(false); cmd = ActionManager::registerAction(tmpaction, Constants::SAVE); @@ -622,7 +622,7 @@ void MainWindow::registerDefaultActions() mfile->addAction(cmd, Constants::G_FILE_SAVE); // Save As Action - icon = QIcon::fromTheme(QLatin1String("document-save-as")); + icon = Icon::fromTheme("document-save-as"); tmpaction = new QAction(icon, Tr::tr("Save &As..."), this); tmpaction->setEnabled(false); cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS); @@ -635,7 +635,7 @@ void MainWindow::registerDefaultActions() DocumentManager::registerSaveAllAction(); // Print Action - icon = QIcon::fromTheme(QLatin1String("document-print")); + icon = Icon::fromTheme("document-print"); tmpaction = new QAction(icon, Tr::tr("&Print..."), this); tmpaction->setEnabled(false); cmd = ActionManager::registerAction(tmpaction, Constants::PRINT); @@ -643,7 +643,7 @@ void MainWindow::registerDefaultActions() mfile->addAction(cmd, Constants::G_FILE_PRINT); // Exit Action - icon = QIcon::fromTheme(QLatin1String("application-exit")); + icon = Icon::fromTheme("application-exit"); m_exitAction = new QAction(icon, Tr::tr("E&xit"), this); m_exitAction->setMenuRole(QAction::QuitRole); cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT); @@ -652,7 +652,7 @@ void MainWindow::registerDefaultActions() connect(m_exitAction, &QAction::triggered, this, &MainWindow::exit); // Undo Action - icon = QIcon::fromTheme(QLatin1String("edit-undo"), Utils::Icons::UNDO.icon()); + icon = Icon::fromTheme("edit-undo"); tmpaction = new QAction(icon, Tr::tr("&Undo"), this); cmd = ActionManager::registerAction(tmpaction, Constants::UNDO); cmd->setDefaultKeySequence(QKeySequence::Undo); @@ -662,7 +662,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Redo Action - icon = QIcon::fromTheme(QLatin1String("edit-redo"), Utils::Icons::REDO.icon()); + icon = Icon::fromTheme("edit-redo"); tmpaction = new QAction(icon, Tr::tr("&Redo"), this); cmd = ActionManager::registerAction(tmpaction, Constants::REDO); cmd->setDefaultKeySequence(QKeySequence::Redo); @@ -672,7 +672,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Cut Action - icon = QIcon::fromTheme(QLatin1String("edit-cut"), Utils::Icons::CUT.icon()); + icon = Icon::fromTheme("edit-cut"); tmpaction = new QAction(icon, Tr::tr("Cu&t"), this); cmd = ActionManager::registerAction(tmpaction, Constants::CUT); cmd->setDefaultKeySequence(QKeySequence::Cut); @@ -680,7 +680,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Copy Action - icon = QIcon::fromTheme(QLatin1String("edit-copy"), Utils::Icons::COPY.icon()); + icon = Icon::fromTheme("edit-copy"); tmpaction = new QAction(icon, Tr::tr("&Copy"), this); cmd = ActionManager::registerAction(tmpaction, Constants::COPY); cmd->setDefaultKeySequence(QKeySequence::Copy); @@ -688,7 +688,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Paste Action - icon = QIcon::fromTheme(QLatin1String("edit-paste"), Utils::Icons::PASTE.icon()); + icon = Icon::fromTheme("edit-paste"); tmpaction = new QAction(icon, Tr::tr("&Paste"), this); cmd = ActionManager::registerAction(tmpaction, Constants::PASTE); cmd->setDefaultKeySequence(QKeySequence::Paste); @@ -696,7 +696,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Select All - icon = QIcon::fromTheme(QLatin1String("edit-select-all")); + icon = Icon::fromTheme("edit-select-all"); tmpaction = new QAction(icon, Tr::tr("Select &All"), this); cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL); cmd->setDefaultKeySequence(QKeySequence::SelectAll); @@ -704,7 +704,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Goto Action - icon = QIcon::fromTheme(QLatin1String("go-jump")); + icon = Icon::fromTheme("go-jump"); tmpaction = new QAction(icon, Tr::tr("&Go to Line..."), this); cmd = ActionManager::registerAction(tmpaction, Constants::GOTO); cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+L"))); @@ -712,16 +712,14 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Zoom In Action - icon = QIcon::hasThemeIcon("zoom-in") ? QIcon::fromTheme("zoom-in") - : Utils::Icons::ZOOMIN_TOOLBAR.icon(); + icon = Icon::fromTheme("zoom-in"); tmpaction = new QAction(icon, Tr::tr("Zoom In"), this); cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_IN); cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl++"))); tmpaction->setEnabled(false); // Zoom Out Action - icon = QIcon::hasThemeIcon("zoom-out") ? QIcon::fromTheme("zoom-out") - : Utils::Icons::ZOOMOUT_TOOLBAR.icon(); + icon = Icon::fromTheme("zoom-out"); tmpaction = new QAction(icon, Tr::tr("Zoom Out"), this); cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_OUT); if (useMacShortcuts) @@ -731,8 +729,7 @@ void MainWindow::registerDefaultActions() tmpaction->setEnabled(false); // Zoom Reset Action - icon = QIcon::hasThemeIcon("zoom-original") ? QIcon::fromTheme("zoom-original") - : Utils::Icons::EYE_OPEN_TOOLBAR.icon(); + icon = Icon::fromTheme("zoom-original"); tmpaction = new QAction(icon, Tr::tr("Original Size"), this); cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_RESET); cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+0") : Tr::tr("Ctrl+0"))); @@ -844,7 +841,7 @@ void MainWindow::registerDefaultActions() mhelp->addSeparator(Constants::G_HELP_ABOUT); // About IDE Action - icon = QIcon::fromTheme(QLatin1String("help-about")); + icon = Icon::fromTheme("help-about"); if (HostOsInfo::isMacHost()) tmpaction = new QAction(icon, Tr::tr("About &%1").arg(QGuiApplication::applicationDisplayName()), diff --git a/src/plugins/cppcheck/cppchecktextmark.cpp b/src/plugins/cppcheck/cppchecktextmark.cpp index 774d09bde76..f4e7802cee2 100644 --- a/src/plugins/cppcheck/cppchecktextmark.cpp +++ b/src/plugins/cppcheck/cppchecktextmark.cpp @@ -65,7 +65,7 @@ CppcheckTextMark::CppcheckTextMark(const Diagnostic &diagnostic) setActionsProvider([diagnostic] { // Copy to clipboard action QAction *action = new QAction; - action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon())); + action->setIcon(Icon::fromTheme("edit-copy")); action->setToolTip(TextEditor::Tr::tr("Copy to Clipboard")); QObject::connect(action, &QAction::triggered, [diagnostic]() { const QString text = QString("%1:%2: %3") diff --git a/src/plugins/languageclient/diagnosticmanager.cpp b/src/plugins/languageclient/diagnosticmanager.cpp index 2e8e2d87396..dd58407f9e0 100644 --- a/src/plugins/languageclient/diagnosticmanager.cpp +++ b/src/plugins/languageclient/diagnosticmanager.cpp @@ -120,7 +120,7 @@ TextEditor::TextMark *DiagnosticManager::createTextMark(TextDocument *doc, const Diagnostic &diagnostic, bool /*isProjectFile*/) const { - static const auto icon = QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()); + static const QIcon icon = Icon::fromTheme("edit-copy"); static const QString tooltip = Tr::tr("Copy to Clipboard"); auto mark = new TextMark(doc, diagnostic, m_client); mark->setActionsProvider([text = diagnostic.message()] { diff --git a/src/plugins/texteditor/circularclipboardassist.cpp b/src/plugins/texteditor/circularclipboardassist.cpp index 4c0956b6c3f..fe569f54e66 100644 --- a/src/plugins/texteditor/circularclipboardassist.cpp +++ b/src/plugins/texteditor/circularclipboardassist.cpp @@ -13,11 +13,13 @@ #include -#include +#include #include #include +using namespace Utils; + namespace TextEditor { namespace Internal { @@ -65,7 +67,7 @@ class ClipboardAssistProcessor: public IAssistProcessor public: IAssistProposal *perform() override { - QIcon icon = QIcon::fromTheme(QLatin1String("edit-paste"), Utils::Icons::PASTE.icon()).pixmap(16); + QIcon icon = Icon::fromTheme("edit-paste"); CircularClipboard * clipboard = CircularClipboard::instance(); QList items; items.reserve(clipboard->size());