Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_itemviews_qdatawidgetmapper.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
7mapper->addMapping(mySpinBox, 0);
8mapper->addMapping(myLineEdit, 1);
9mapper->addMapping(myCountryChooser, 2);
12
13
16mapper->setModel(myModel);
17mapper->addMapping(nameLineEdit, 0);
20
21
24connect(myTableView->selectionModel(), &QItemSelectionModel::currentRowChanged,
The QDataWidgetMapper class provides mapping between a section of a data model to widgets.
void toFirst()
Populates the widgets with data from the first row of the model if the orientation is horizontal (the...
void addMapping(QWidget *widget, int section)
Adds a mapping between a widget and a section from the model.
void setCurrentModelIndex(const QModelIndex &index)
Sets the current index to the row of the index if the orientation is horizontal (the default),...
void setModel(QAbstractItemModel *model)
Sets the current model to model.
void currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
This signal is emitted if the current item changes and its row is different to the row of the previou...
QSpinBox * ageSpinBox
QSqlQueryModel * model
[16]
QDataWidgetMapper * mapper
[0]
connect(myTableView->selectionModel(), &QItemSelectionModel::currentRowChanged, mapper, &QDataWidgetMapper::setCurrentModelIndex)