ProjectExplorer: Don't enforce FlatModel::data's ForegroundRole

Only return a concrete color for the "pseudo disabled" state of the
node, otherwise return QVariant().

This permits the theming of the projecty tree via palette or stylesheet
(as the QmlDesigner does).

Task-number: QTCREATORBUG-24402
Change-Id: I510faf4d58a12947dd665eef6f5c9da8845fc2dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2020-12-22 16:58:18 +01:00
parent 5271a5c782
commit b4c1e48fdc
2 changed files with 2 additions and 6 deletions

View File

@@ -107,9 +107,6 @@ FlatModel::FlatModel(QObject *parent)
for (Project *project : SessionManager::projects())
handleProjectAdded(project);
m_disabledTextColor = Utils::creatorTheme()->color(Utils::Theme::TextColorDisabled);
m_enabledTextColor = Utils::creatorTheme()->color(Utils::Theme::TextColorNormal);
}
QVariant FlatModel::data(const QModelIndex &index, int role) const
@@ -166,7 +163,8 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
return font;
}
case Qt::ForegroundRole:
return node->isEnabled() ? m_enabledTextColor : m_disabledTextColor;
return node->isEnabled() ? QVariant()
: Utils::creatorTheme()->color(Utils::Theme::TextColorDisabled);
case Project::FilePathRole:
return node->filePath().toString();
case Project::isParsingRole:

View File

@@ -118,8 +118,6 @@ private:
QTimer m_timer;
QSet<ExpandData> m_toExpand;
QColor m_enabledTextColor;
QColor m_disabledTextColor;
};
} // namespace Internal