summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2011-12-15 16:31:21 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-06 17:21:39 +0100
commit054a4aa7dddacbe31778c5c5e9ffc9d41f803353 (patch)
treee0c1d717913cb5fbd1425106555003abce0dadc5 /src/widgets
parent9eacf32de9c61417887e1550915c310c3187ac10 (diff)
Add roles to the dataChanged slots in views.
This is a source incompatible change. This is for consistency with the signal for the lifetime of Qt5. I could imagine people trying to override a virtual function (in a new class while using the Qt5 library) with the arguments of the signal and have that fail due to the arguments not being correct. It also allows ignoring dataChange events when they are known not to be for roles which are relevant to particular views or delegates. Change-Id: Ica191835125c1c8fdaf665debb62d635e81700dc Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp10
-rw-r--r--src/widgets/itemviews/qabstractitemview.h2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.h2
-rw-r--r--src/widgets/itemviews/qlistview.cpp4
-rw-r--r--src/widgets/itemviews/qlistview.h2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
-rw-r--r--src/widgets/itemviews/qtreeview.h2
8 files changed, 14 insertions, 14 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 38bd22dc24..8394e90ed1 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -673,8 +673,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
disconnect(d->model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed()));
- disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataChanged(QModelIndex,QModelIndex)));
+ disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)),
+ this, SLOT(dataChanged(QModelIndex,QModelIndex,QSet<int>)));
disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_headerDataChanged()));
disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
@@ -713,8 +713,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
connect(d->model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed()));
- connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataChanged(QModelIndex,QModelIndex)));
+ connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)),
+ this, SLOT(dataChanged(QModelIndex,QModelIndex,QSet<int>)));
connect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_headerDataChanged()));
connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
@@ -3222,7 +3222,7 @@ void QAbstractItemView::update(const QModelIndex &index)
inclusive. If just one item is changed \a topLeft == \a
bottomRight.
*/
-void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &)
{
// Single item changed
Q_D(QAbstractItemView);
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 5258b7c4e5..5ab41bae23 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -241,7 +241,7 @@ public Q_SLOTS:
void update(const QModelIndex &index);
protected Q_SLOTS:
- virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
virtual void rowsInserted(const QModelIndex &parent, int start, int end);
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index bec39c4fa5..c9bc3423b0 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2655,7 +2655,7 @@ void QHeaderView::scrollContentsBy(int dx, int dy)
\reimp
\internal
*/
-void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &)
{
Q_D(QHeaderView);
d->invalidateCachedSizeHint();
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index cd3b6e9d15..1ad79a96e1 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -211,7 +211,7 @@ protected:
void updateGeometries();
void scrollContentsBy(int dx, int dy);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
void rowsInserted(const QModelIndex &parent, int start, int end);
QRect visualRect(const QModelIndex &index) const;
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 6a6d33fbc8..d0b5821c93 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -730,10 +730,10 @@ QSize QListView::contentsSize() const
/*!
\reimp
*/
-void QListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles)
{
d_func()->commonListView->dataChanged(topLeft, bottomRight);
- QAbstractItemView::dataChanged(topLeft, bottomRight);
+ QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
}
/*!
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 163485fb1f..f78806fef1 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -147,7 +147,7 @@ protected:
void resizeContents(int width, int height);
QSize contentsSize() const;
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
void rowsInserted(const QModelIndex &parent, int start, int end);
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index acff457de4..5da2185bd1 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -664,7 +664,7 @@ void QTreeView::setFirstColumnSpanned(int row, const QModelIndex &parent, bool s
/*!
\reimp
*/
-void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles)
{
Q_D(QTreeView);
@@ -706,7 +706,7 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
d->updateScrollBars();
d->viewport->update();
}
- QAbstractItemView::dataChanged(topLeft, bottomRight);
+ QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
}
/*!
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index baa3ebca4d..bc68fd413a 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -144,7 +144,7 @@ public:
void sortByColumn(int column, Qt::SortOrder order);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
void selectAll();
Q_SIGNALS: