X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fabstractitemview.cpp;h=dced67b3ab351617ca7dc17af282c31fe989b8f2;hp=c3290cb534587d7f6ab445e62235f0187f5002fd;hb=694f9bfbf7f1af19108461c7e00d133e55082bce;hpb=61c8d84d1c849373e0f115dc748ed45cff95287d diff --git a/src/uisupport/abstractitemview.cpp b/src/uisupport/abstractitemview.cpp index c3290cb5..dced67b3 100644 --- a/src/uisupport/abstractitemview.cpp +++ b/src/uisupport/abstractitemview.cpp @@ -21,35 +21,36 @@ #include "abstractitemview.h" AbstractItemView::AbstractItemView(QWidget *parent) - : QWidget(parent), + : QWidget(parent), _model(0), _selectionModel(0) { } -void AbstractItemView::setModel(QAbstractItemModel *model) { - if(_model) { - disconnect(_model, 0, this, 0); - } - _model = model; - connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), - this, SLOT(dataChanged(QModelIndex, QModelIndex))); - connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); - connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(rowsInserted(QModelIndex, int, int))); -} +void AbstractItemView::setModel(QAbstractItemModel *model) +{ + if (_model) { + disconnect(_model, 0, this, 0); + } + _model = model; + connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(dataChanged(QModelIndex, QModelIndex))); + connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), + this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); + connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), + this, SLOT(rowsInserted(QModelIndex, int, int))); +} -void AbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) { - if(_selectionModel) { - disconnect(_selectionModel, 0, this, 0); - } - _selectionModel = selectionModel; - connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), - this, SLOT(currentChanged(QModelIndex, QModelIndex))); - connect(selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), - this, SLOT(selectionChanged(QItemSelection, QItemSelection))); +void AbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) +{ + if (_selectionModel) { + disconnect(_selectionModel, 0, this, 0); + } + _selectionModel = selectionModel; + connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + this, SLOT(currentChanged(QModelIndex, QModelIndex))); + connect(selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + this, SLOT(selectionChanged(QItemSelection, QItemSelection))); } -