summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/itemviews/qlistview.cpp6
-rw-r--r--src/gui/itemviews/qlistview_p.h3
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp21
3 files changed, 29 insertions, 1 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 109d760..d680af8 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -2403,6 +2403,12 @@ QVector<QModelIndex> QListModeViewBase::intersectingSet(const QRect &area) const
return ret;
}
+void QListModeViewBase::dataChanged(const QModelIndex &, const QModelIndex &)
+{
+ dd->doDelayedItemsLayout();
+}
+
+
QRect QListModeViewBase::mapToViewport(const QRect &rect) const
{
if (isWrapping())
diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h
index 3f8f9db..31459b0 100644
--- a/src/gui/itemviews/qlistview_p.h
+++ b/src/gui/itemviews/qlistview_p.h
@@ -130,6 +130,7 @@ public:
virtual void clear() = 0;
virtual void setRowCount(int) = 0;
virtual QVector<QModelIndex> intersectingSet(const QRect &area) const = 0;
+ virtual void dataChanged(const QModelIndex &, const QModelIndex &) = 0;
virtual int horizontalScrollToValue(int index, QListView::ScrollHint hint,
bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const;
@@ -141,7 +142,6 @@ public:
virtual int verticalOffset() const { return verticalScrollBar()->value(); }
virtual void updateHorizontalScrollBar(const QSize &step);
virtual void updateVerticalScrollBar(const QSize &step);
- virtual void dataChanged(const QModelIndex &, const QModelIndex &) { }
virtual void appendHiddenRow(int row);
virtual void removeHiddenRow(int row);
virtual void setPositionForIndex(const QPoint &, const QModelIndex &) { }
@@ -217,6 +217,7 @@ public:
void clear();
void setRowCount(int rowCount) { flowPositions.resize(rowCount); }
QVector<QModelIndex> intersectingSet(const QRect &area) const;
+ void dataChanged(const QModelIndex &, const QModelIndex &);
int horizontalScrollToValue(int index, QListView::ScrollHint hint,
bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const;
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 65ab12d..727e6d3 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -119,6 +119,7 @@ private slots:
void task262152_setModelColumnNavigate();
void taskQTBUG_2233_scrollHiddenItems_data();
void taskQTBUG_2233_scrollHiddenItems();
+ void taskQTBUG_633_changeModelData();
};
// Testing get/set functions
@@ -1832,5 +1833,25 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
}
}
+void tst_QListView::taskQTBUG_633_changeModelData()
+{
+ QListView view;
+ view.setFlow(QListView::LeftToRight);
+ QStandardItemModel model(5,1);
+ for (int i = 0; i < model.rowCount(); ++i) {
+ model.setData( model.index(i, 0), QString::number(i));
+ }
+
+ view.setModel(&model);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ model.setData( model.index(1, 0), QLatin1String("long long text"));
+ QTest::qWait(100); //leave time for relayouting the items
+ QRect rectLongText = view.visualRect(model.index(1,0));
+ QRect rect2 = view.visualRect(model.index(2,0));
+ QVERIFY( ! rectLongText.intersects(rect2) );
+}
+
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"