forked from qt-creator/qt-creator
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 <alessandro.portale@qt.io>
This commit is contained in:
@@ -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"));
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "qtcassert.h"
|
||||
#include "theme/theme.h"
|
||||
#include "stylehelper.h"
|
||||
#include "utilsicons.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
@@ -234,4 +235,51 @@ QIcon Icon::combinedIcon(const QList<Icon> &icons)
|
||||
return combinedIcon(qIcons);
|
||||
}
|
||||
|
||||
QIcon Icon::fromTheme(const QString &name)
|
||||
{
|
||||
static QHash<QString, QIcon> 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
|
||||
|
@@ -61,6 +61,8 @@ public:
|
||||
static QIcon combinedIcon(const QList<QIcon> &icons);
|
||||
static QIcon combinedIcon(const QList<Icon> &icons);
|
||||
|
||||
static QIcon fromTheme(const QString &name);
|
||||
|
||||
private:
|
||||
QList<IconMaskAndColor> m_iconSourceList;
|
||||
IconStyleOptions m_style = None;
|
||||
|
@@ -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)
|
||||
|
@@ -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 {
|
||||
|
@@ -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();
|
||||
|
@@ -10,10 +10,11 @@
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -265,7 +265,7 @@ ClangdTextMark::ClangdTextMark(TextEditor::TextDocument *doc,
|
||||
// Copy to clipboard action
|
||||
QList<QAction *> 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},
|
||||
|
@@ -39,7 +39,7 @@ DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic, TextDocument *docum
|
||||
// Copy to clipboard action
|
||||
QList<QAction *> 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)
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/process.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/utilsicons.h>
|
||||
#include <utils/icon.h>
|
||||
|
||||
#include <projectexplorer/projecttree.h>
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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()),
|
||||
|
@@ -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")
|
||||
|
@@ -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()] {
|
||||
|
@@ -13,11 +13,13 @@
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
#include <utils/icon.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
|
||||
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<AssistProposalItemInterface *> items;
|
||||
items.reserve(clipboard->size());
|
||||
|
Reference in New Issue
Block a user