1
0
Fork 0

Launcher: fix appearance of disabled add-ons.

Spotted by Michael Danilov
This commit is contained in:
Automatic Release Builder 2020-10-07 18:35:04 +01:00 committed by James Turner
parent 38f44e0928
commit e0df583c14
2 changed files with 12 additions and 4 deletions

View file

@ -208,18 +208,24 @@ QHash<int, QByteArray> AddonsModel::roleNames() const
return m_roleToName; return m_roleToName;
} }
void AddonsModel::enable(int index, bool enable) void AddonsModel::enable(int row, bool enable)
{ {
if ((index < 0) || (index >= m_addonsList.size())) { if ((row < 0) || (row >= m_addonsList.size())) {
return; return;
} }
auto path = m_addonsList[index]; auto path = m_addonsList[row];
if (!m_addonsMap.contains(path)) if (!m_addonsMap.contains(path))
return; return;
m_addonsMap[path].enable = enable && checkVersion(path); const bool wasEnabled = m_addonsMap[path].enable;
const bool nowEnabled = enable && checkVersion(path);
if (wasEnabled == nowEnabled)
return;
m_addonsMap[path].enable = nowEnabled;
const auto mindex = index(row, 0);
emit dataChanged(mindex, mindex, {EnableRole});
emit modulesChanged(); emit modulesChanged();
} }

View file

@ -75,6 +75,8 @@ Item {
anchors.rightMargin: Style.margin anchors.rightMargin: Style.margin
height: contentRect.height height: contentRect.height
font.strikeout: !model.enable
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }