MCPcopy Create free account
hub / github.com/KDAB/KDChart / data

Method data

examples/tools/TableModel.cpp:39–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39QVariant TableModel::data(const QModelIndex &index, int role) const
40{
41 // FIXME kdchart queries (-1, -1) for empty models
42 if (index.row() == -1 || index.column() == -1) {
43 qDebug() << "TableModel::data: row:"
44 << index.row() << ", column:" << index.column()
45 << ", rowCount:" << rowCount() << ", columnCount:"
46 << columnCount() << Qt::endl
47 << "TableModel::data: FIXME fix kdchart views to not query"
48 " model data for invalid indices!";
49 return QVariant();
50 }
51
52 /* qDebug () << "TableModel::data: row: "<< index.row() << ", column: "
53 << index.column() << endl;*/
54 Q_ASSERT(index.row() >= 0 && index.row() < rowCount());
55 Q_ASSERT(index.column() >= 0 && index.column() < columnCount());
56
57 if (role == Qt::DisplayRole || role == Qt::EditRole) {
58 return m_rows[index.row()][index.column()];
59 } else {
60 return QVariant();
61 }
62}
63
64QVariant TableModel::headerData(int section, Qt::Orientation orientation, int role) const
65{

Callers 5

paintMarkersMethod · 0.45
eventFilterMethod · 0.45
saveFileMethod · 0.45
main.cppFile · 0.45

Calls 2

rowMethod · 0.80
columnMethod · 0.45

Tested by

no test coverage detected