MCPcopy Create free account
hub / github.com/apitrace/apitrace / valueForName

Method valueForName

gui/argumentseditor.cpp:337–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337QVariant ArgumentsEditor::valueForName(const QString &name,
338 const QVariant &originalValue,
339 bool *changed) const
340{
341 QVariant val;
342
343 *changed = false;
344
345 //Handle string arrays specially
346 if (isVariantStringArray(originalValue)) {
347 ApiArray array = originalValue.value<ApiArray>();
348 return arrayFromEditor(array, changed);
349 }
350
351 if (!isVariantEditable(originalValue)) {
352 return originalValue;
353 }
354
355 for (int topRow = 0; topRow < m_model->rowCount(); ++topRow) {
356 QModelIndex nameIdx = m_model->index(topRow, 0, QModelIndex());
357 QString argName = nameIdx.data().toString();
358 /* we display shaders in a separate widget so
359 * the ordering might be different */
360 if (argName == name) {
361 if (originalValue.userType() == QMetaType::type("ApiArray")) {
362 ApiArray array = originalValue.value<ApiArray>();
363 val = arrayFromIndex(nameIdx, array, changed);
364 } else {
365 QModelIndex valIdx = m_model->index(topRow, 1, QModelIndex());
366 val = valIdx.data();
367 if (val != originalValue)
368 *changed = true;
369 }
370 }
371 }
372 return val;
373}
374
375QVariant ArgumentsEditor::arrayFromIndex(const QModelIndex &parentIndex,
376 const ApiArray &origArray,

Callers

nothing calls this directly

Calls 7

isVariantStringArrayFunction · 0.85
isVariantEditableFunction · 0.85
QModelIndexClass · 0.85
rowCountMethod · 0.45
indexMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected