Commit cbe488d2 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

No need to cache QIcon::fromTheme result ourselves in a static var

parent eed00705
...@@ -167,8 +167,7 @@ public: ...@@ -167,8 +167,7 @@ public:
{ {
if (role == Qt::DecorationRole) { if (role == Qt::DecorationRole) {
if (index.column() == KTextEditor::CodeCompletionModel::Icon) { if (index.column() == KTextEditor::CodeCompletionModel::Icon) {
static const QIcon icon = QIcon::fromTheme(QStringLiteral("CTparents")); return QIcon::fromTheme(QStringLiteral("CTparents"));
return icon;
} }
} }
return CompletionItem<CompletionTreeItem>::data(index, role, model); return CompletionItem<CompletionTreeItem>::data(index, role, model);
......
...@@ -298,8 +298,7 @@ bool DisassembleWidget::displayCurrent() ...@@ -298,8 +298,7 @@ bool DisassembleWidget::displayCurrent()
{ {
// put cursor at start of line and highlight the line // put cursor at start of line and highlight the line
m_disassembleWindow->setCurrentItem(item); m_disassembleWindow->setCurrentItem(item);
static const QIcon icon = QIcon::fromTheme(QStringLiteral("go-next")); item->setIcon(Icon, QIcon::fromTheme(QStringLiteral("go-next")));
item->setIcon(Icon, icon);
bFound = true; // need to process all items to clear icons bFound = true; // need to process all items to clear icons
} }
else if(!item->icon(Icon).isNull()) item->setIcon(Icon, QIcon()); else if(!item->icon(Icon).isNull()) item->setIcon(Icon, QIcon());
......
...@@ -59,12 +59,10 @@ public: ...@@ -59,12 +59,10 @@ public:
} }
QIcon icon() const override QIcon icon() const override
{ {
// note: not the best icon, but can't find anything better
static const QIcon fallbackIcon = QIcon::fromTheme(QStringLiteral("system-run"));
const QIcon icon = m_action->icon(); const QIcon icon = m_action->icon();
if (icon.isNull()) { if (icon.isNull()) {
return fallbackIcon; // note: not the best fallback icon, but can't find anything better
return QIcon::fromTheme(QStringLiteral("system-run"));
} }
return icon; return icon;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment