aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
blob: cfcb99a58f4c2cc8b45341755f53d5ddc9331b83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! [0]
mapper = QDataWidgetMapper
mapper.setModel(model)
mapper.addMapping(mySpinBox, 0)
mapper.addMapping(myLineEdit, 1)
mapper.addMapping(myCountryChooser, 2)
mapper.toFirst()
//! [0]


//! [1]
mapper = QDataWidgetMapper()
mapper.setModel(myModel)
mapper.addMapping(nameLineEdit, 0)
mapper.addMapping(ageSpinBox, 1)
//! [1]


//! [2]
mapper = QDataWidgetMapper()
connect(myTableView.selectionModel(), SIGNAL("currentRowChanged(QModelIndex,QModelIndex)"),
        mapper, SLOT(setCurrentModelIndex(QModelIndex)))
//! [2]