Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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

parent eed00705
......@@ -167,8 +167,7 @@ public:
{
if (role == Qt::DecorationRole) {
if (index.column() == KTextEditor::CodeCompletionModel::Icon) {
static const QIcon icon = QIcon::fromTheme(QStringLiteral("CTparents"));
return icon;
return QIcon::fromTheme(QStringLiteral("CTparents"));
}
}
return CompletionItem<CompletionTreeItem>::data(index, role, model);
......
......@@ -298,8 +298,7 @@ bool DisassembleWidget::displayCurrent()
{
// put cursor at start of line and highlight the line
m_disassembleWindow->setCurrentItem(item);
static const QIcon icon = QIcon::fromTheme(QStringLiteral("go-next"));
item->setIcon(Icon, icon);
item->setIcon(Icon, QIcon::fromTheme(QStringLiteral("go-next")));
bFound = true; // need to process all items to clear icons
}
else if(!item->icon(Icon).isNull()) item->setIcon(Icon, QIcon());
......
......@@ -59,12 +59,10 @@ public:
}
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();
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;
......
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