summaryrefslogtreecommitdiff
path: root/doc/src/snippets/code/doc_src_model-view-programming.qdoc
blob: 3501ce0bd837190038cda16bc7a31eb92a4fc5a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! [0]
QAbstractItemModel *model = index.model();
//! [0]


//! [1]
QModelIndex index = model->index(row, column, ...);
//! [1]


//! [2]
QModelIndex indexA = model->index(0, 0, QModelIndex());
QModelIndex indexB = model->index(1, 1, QModelIndex());
QModelIndex indexC = model->index(2, 1, QModelIndex());
//! [2]


//! [3]
QModelIndex index = model->index(row, column, parent);
//! [3]


//! [4]
QModelIndex indexA = model->index(0, 0, QModelIndex());
QModelIndex indexC = model->index(2, 1, QModelIndex());
//! [4]


//! [5]
QModelIndex indexB = model->index(1, 0, indexA);
//! [5]


//! [6]
QVariant value = model->data(index, role);
//! [6]