summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-08-12 18:45:11 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-08-12 18:45:11 +0200
commit935a2c15d38a60e43da50e7744d5faff2e81be8f (patch)
tree4bdfa2c9ea16af199543c150c6edd5f28b3d3fa7
parent8c2b9783397236d645ee38623be5209010cc4797 (diff)
Remove the layoutsBlocked code.
-rw-r--r--src/qgraphicslistview.cpp48
-rw-r--r--src/qgraphicslistview.h4
-rw-r--r--src/qgraphicslistview_p.h2
3 files changed, 8 insertions, 46 deletions
diff --git a/src/qgraphicslistview.cpp b/src/qgraphicslistview.cpp
index b77e56b..53fb8e0 100644
--- a/src/qgraphicslistview.cpp
+++ b/src/qgraphicslistview.cpp
@@ -173,8 +173,6 @@ void QtGraphicsListViewItem::paint(QPainter *painter, const QStyleOptionGraphics
void QtGraphicsListViewItem::itemChanged(const QList<int> &roles)
{
Q_UNUSED(roles);
- // ### if the size changed, we need to let the layout know
- prepareGeometryChange();
update();
}
@@ -385,7 +383,7 @@ QtGraphicsListViewPrivate::QtGraphicsListViewPrivate()
#if CACHING_ENABLED
cachedIndexOffset(0), cachedCoordinateOffset(0),
#endif
- cachedDataIndex(-1), layoutsBlocked(false),
+ cachedDataIndex(-1),
creator(new QtGraphicsListViewItemCreator<QtGraphicsListViewItem>())
{
}
@@ -428,7 +426,7 @@ void QtGraphicsListViewPrivate::_q_selectionsDestroyed()
*/
void QtGraphicsListViewPrivate::_q_itemsChanged(int index, int count, const QList<int> &roles)
{
- Q_Q(QtGraphicsListView);
+ //Q_Q(QtGraphicsListView);
checkCache(index, count);
//qDebug() << "QtGraphicsListViewPrivate::_q_itemsChanged" << index << count;
for (int i = 0; i < items.count(); ++i) {
@@ -438,7 +436,8 @@ void QtGraphicsListViewPrivate::_q_itemsChanged(int index, int count, const QLis
if (itemIndex >= index + count) // change happened above
break;
}
- q->updateLayout(); // ### FIXME: be more discriminate
+ // update the layout only if the items geometries change
+ //q->updateLayout(); // ### FIXME: be more discriminate
}
/*!
@@ -468,11 +467,9 @@ void QtGraphicsListViewPrivate::_q_itemsRemoved(int index, int count)
*/
void QtGraphicsListViewPrivate::_q_reset()
{
- Q_Q(QtGraphicsListView);
+ //Q_Q(QtGraphicsListView);
checkCache(0, 0);
//qDebug() << "QtGraphicsListViewPrivate::_q_reset";
- if (!layoutsBlocked)
- q->updateLayout();
}
/*!
@@ -910,8 +907,8 @@ int QtGraphicsListView::itemAt(const QPointF &position) const
void QtGraphicsListView::updateLayout()
{
Q_D(QtGraphicsListView);
- if (!d->layoutTimer.isActive() && !d->layoutsBlocked)
- doLayout();//d->layoutTimer.start(0, this);
+ if (!d->layoutTimer.isActive())
+ doLayout(); //d->layoutTimer.start(0, this);
}
/*!
@@ -1233,24 +1230,6 @@ void QtGraphicsListView::initStyleOption(QStyleOptionViewItemV4 *option) const
}
/*!
- */
-/*
-bool QtGraphicsListView::layoutsBlocked() const
-{
- Q_D(const QtGraphicsListView);
- return d->layoutsBlocked;
-}
-*/
-/*!
- */
-/*
-void QtGraphicsListView::setLayoutsBlocked(bool block)
-{
- Q_D(QtGraphicsListView);
- d->layoutsBlocked = block;
-}
-*/
-/*!
\reimp
*/
bool QtGraphicsListView::event(QEvent *event)
@@ -1261,7 +1240,7 @@ bool QtGraphicsListView::event(QEvent *event)
event->accept();
return true;
}
- // delayed layout mechanism
+ // delayed layout mechanism ### FIXME
if (event->type() == QEvent::Timer && static_cast<QTimerEvent*>(event)->timerId() == d->layoutTimer.timerId())
doLayout();
return QGraphicsWidget::event(event);
@@ -1326,17 +1305,6 @@ QGraphicsObject* QtGraphicsListView::itemForIndex(int index) const
return 0;
}
-/*!
- */
-void QtGraphicsListView::itemGeometryChanged(QtGraphicsListViewItem *item)
-{
- Q_D(QtGraphicsListView);
- if (item && !d->layoutsBlocked) {
- // ### we may want a delayed mechanism for this
- updateLayout();
- }
-}
-
QT_END_NAMESPACE
#include "moc_qgraphicslistview.cpp"
diff --git a/src/qgraphicslistview.h b/src/qgraphicslistview.h
index 67f1ff1..4459226 100644
--- a/src/qgraphicslistview.h
+++ b/src/qgraphicslistview.h
@@ -145,15 +145,11 @@ public:
QGraphicsObject *itemForIndex(int index) const;
- //bool layoutsBlocked() const; // ### FIXME: should not be needed
- //void setLayoutsBlocked(bool block);
-
public Q_SLOTS:
void setFirstIndex(int index);
void setOffset(qreal offset);
void setOffsetToEnsureIndexIsVisible(int index);
void setFirstIndexToEnsureIndexIsVisible(int index);
- void itemGeometryChanged(QtGraphicsListViewItem *item); // ### experimental
void updateLayout();
Q_SIGNALS:
diff --git a/src/qgraphicslistview_p.h b/src/qgraphicslistview_p.h
index 0a2d3e2..87e9a77 100644
--- a/src/qgraphicslistview_p.h
+++ b/src/qgraphicslistview_p.h
@@ -106,8 +106,6 @@ public:
mutable QHash<int, QVariant> cachedDataHash;
mutable int cachedDataIndex;
- bool layoutsBlocked;
-
QList<QPair<int, QGraphicsObject*> > items;
QtGraphicsListViewItemCreatorBase *creator;
QBasicTimer layoutTimer;