MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / data

Method data

launcher/ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp:86–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86QVariant AtlOptionalModListModel::data(const QModelIndex &index, int role) const {
87 auto row = index.row();
88 auto mod = m_mods.at(row);
89
90 if (role == Qt::DisplayRole) {
91 if (index.column() == NameColumn) {
92 return mod.name;
93 }
94 if (index.column() == DescriptionColumn) {
95 return mod.description;
96 }
97 }
98 else if (role == Qt::ToolTipRole) {
99 if (index.column() == DescriptionColumn) {
100 return mod.description;
101 }
102 }
103 else if (role == Qt::ForegroundRole) {
104 if (!mod.colour.isEmpty() && m_version.colours.contains(mod.colour)) {
105 return QColor(QString("#%1").arg(m_version.colours[mod.colour]));
106 }
107 }
108 else if (role == Qt::CheckStateRole) {
109 if (index.column() == EnabledColumn) {
110 return m_selection[mod.name] ? Qt::Checked : Qt::Unchecked;
111 }
112 }
113
114 return {};
115}
116
117bool AtlOptionalModListModel::setData(const QModelIndex &index, const QVariant &value, int role) {
118 if (role == Qt::CheckStateRole) {

Callers

nothing calls this directly

Calls 5

QColorClass · 0.85
QStringClass · 0.85
isEmptyMethod · 0.80
atMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected