MCPcopy Create free account
hub / github.com/Kitware/VTK / data

Method data

Examples/GUI/Qt/CellGridSource/ArrayGroupModel.cxx:104–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104QVariant ArrayGroupModel::data(const QModelIndex& index, int role) const
105{
106 if (role != Qt::DisplayRole)
107 {
108 return QVariant();
109 }
110 if (index.row() < 0 || index.column() < 0 || index.row() >= this->rowCount(index.parent()) ||
111 index.column() >= this->columnCount(index.parent()))
112 {
113 return QVariant();
114 }
115 auto& colData(this->ColumnToArrayComponent[index.column()]);
116 auto* array = colData.Array;
117 if (auto* dataArray = vtkDataArray::SafeDownCast(array))
118 {
119 std::vector<double> tuple;
120 tuple.resize(dataArray->GetNumberOfComponents());
121 dataArray->GetTuple(index.row(), tuple.data());
122 return tuple[colData.Component];
123 }
124 else if (auto* stringArray = vtkStringArray::SafeDownCast(array))
125 {
126 std::string value =
127 stringArray->GetValue(stringArray->GetNumberOfComponents() * index.row() + colData.Component);
128 return QString::fromStdString(value);
129 }
130 return QVariant();
131}
132
133bool ArrayGroupModel::setData(const QModelIndex& index, const QVariant& value, int role)
134{

Callers 13

mainFunction · 0.45
slotOpenXMLFileMethod · 0.45
slotOpenXMLFileMethod · 0.45
slotOpenSQLiteDBMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
setDataMethod · 0.45
ComputeCellCenterFunction · 0.45
HighlightPointUnderMouseFunction · 0.45
UpdateLUTMethod · 0.45
mainFunction · 0.45

Calls 8

rowCountMethod · 0.95
columnCountMethod · 0.95
rowMethod · 0.45
parentMethod · 0.45
resizeMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetTupleMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected