Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QDataWidgetMapper::setModel ( QAbstractItemModel model  ) 

Sets the current model to model. If another model was set, all mappings to that old model are cleared.

See also:
model()

Definition at line 314 of file qdatawidgetmapper.cpp.

References clearMapping(), QObject::connect(), QObject::destroyed(), and QObject::disconnect().

{
    Q_D(QDataWidgetMapper);

    if (d->model == model)
        return;

    if (d->model) {
        disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
                   SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
        disconnect(d->model, SIGNAL(destroyed()), this,
                   SLOT(_q_modelDestroyed()));
    }
    clearMapping();
    d->rootIndex = QModelIndex();
    d->currentTopLeft = QModelIndex();

    d->model = model;

    connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
    connect(model, SIGNAL(destroyed()), SLOT(_q_modelDestroyed()));
}


Generated by  Doxygen 1.6.0   Back to index