MCPcopy Create free account
hub / github.com/cutechess/cutechess / flags

Method flags

projects/gui/src/engineoptionmodel.cpp:151–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151Qt::ItemFlags EngineOptionModel::flags(const QModelIndex& index) const
152{
153 if (!index.isValid())
154 return Qt::ItemFlags(Qt::NoItemFlags);
155
156 Qt::ItemFlags defaultFlags =
157 Qt::ItemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
158
159 if (index.column() == 0)
160 return defaultFlags;
161 if (index.column() == 2)
162 return Qt::ItemFlags(defaultFlags | Qt::ItemIsEditable);
163
164 if (index.column() == 1)
165 {
166 const auto option = m_options.at(index.row());
167 if (!option->isEditable())
168 return defaultFlags;
169
170 // make check options checkable
171 if (option->value().typeId() == QMetaType::Bool)
172 return Qt::ItemFlags(defaultFlags | Qt::ItemIsUserCheckable);
173
174 return Qt::ItemFlags(defaultFlags | Qt::ItemIsEditable);
175 }
176
177 return defaultFlags;
178}
179
180bool EngineOptionModel::setData(const QModelIndex& index, const QVariant& data,
181 int role)

Callers

nothing calls this directly

Calls 4

atMethod · 0.80
valueMethod · 0.80
isValidMethod · 0.45
isEditableMethod · 0.45

Tested by

no test coverage detected