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

void QTreeView::setModel ( QAbstractItemModel model  )  [virtual]

Reimplemented from QAbstractItemView.

Reimplemented in QTreeWidget.

Definition at line 137 of file qtreeview.cpp.

References QObject::connect(), QObject::disconnect(), rowsRemoved(), and QAbstractItemView::setModel().

Referenced by QTreeWidget::QTreeWidget().

{
    Q_D(QTreeView);
    if (d->selectionModel && d->model){ // support row editing
        disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
                   d->model, SLOT(submit()));
        disconnect(d->model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
                   this, SLOT(rowsRemoved(const QModelIndex &, int, int)));
    }
    d->viewItems.clear();
    d->expandedIndexes.clear();
    d->hiddenIndexes.clear();
    d->header->setModel(model);
    QAbstractItemView::setModel(model);
    if (d->model)
        connect(d->model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
            this, SLOT(rowsRemoved(const QModelIndex &, int, int)));
}


Generated by  Doxygen 1.6.0   Back to index