summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 16:42:20 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 16:46:27 +0200
commit424e2e68f9a3f556ad2d06e2fbceac0d48c060be (patch)
tree6ab9619e0da615431c748017ea42d4dc61b28869 /src
parent5f48e2a16b0b64536a205320fbf7a22f7461d80d (diff)
ItemViews: _q_fetchMore now uses a timer instead of invokeMethod
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp11
-rw-r--r--src/gui/itemviews/qabstractitemview.h1
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h3
3 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index cefe8a5b07..dd8430430d 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2200,6 +2200,8 @@ void QAbstractItemView::resizeEvent(QResizeEvent *event)
void QAbstractItemView::timerEvent(QTimerEvent *event)
{
Q_D(QAbstractItemView);
+ if (event->timerId() == d->fetchMoreTimer.timerId())
+ d->fetchMore();
if (event->timerId() == d->autoScrollTimer.timerId())
doAutoScroll();
else if (event->timerId() == d->updateTimer.timerId())
@@ -2415,7 +2417,7 @@ void QAbstractItemView::updateEditorGeometries()
void QAbstractItemView::updateGeometries()
{
updateEditorGeometries();
- QMetaObject::invokeMethod(this, "_q_fetchMore", Qt::QueuedConnection);
+ d_func()->fetchMoreTimer.start(0, this); //fetch more later
}
/*!
@@ -2960,7 +2962,7 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde
void QAbstractItemView::rowsInserted(const QModelIndex &, int, int)
{
if (!isVisible())
- QMetaObject::invokeMethod(this, "_q_fetchMore", Qt::QueuedConnection);
+ d_func()->fetchMoreTimer.start(0, this); //fetch more later
else
updateEditorGeometries();
}
@@ -3183,7 +3185,7 @@ void QAbstractItemView::currentChanged(const QModelIndex &current, const QModelI
update(current);
edit(current, CurrentChanged, 0);
if (current.row() == (d->model->rowCount(d->root) - 1))
- d->_q_fetchMore();
+ d->fetchMore();
} else {
d->shouldScrollToCurrentOnShow = d->autoScroll;
}
@@ -3604,8 +3606,9 @@ QAbstractItemViewPrivate::contiguousSelectionCommand(const QModelIndex &index,
}
}
-void QAbstractItemViewPrivate::_q_fetchMore()
+void QAbstractItemViewPrivate::fetchMore()
{
+ fetchMoreTimer.stop();
if (!model->canFetchMore(root))
return;
int last = model->rowCount(root) - 1;
diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h
index f98dd16eed..da6f0ea7dc 100644
--- a/src/gui/itemviews/qabstractitemview.h
+++ b/src/gui/itemviews/qabstractitemview.h
@@ -353,7 +353,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
- Q_PRIVATE_SLOT(d_func(), void _q_fetchMore())
friend class QTreeViewPrivate; // needed to compile with MSVC
friend class QAccessibleItemRow;
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 026912af06..2950bcdc7b 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -116,7 +116,7 @@ public:
virtual void _q_modelDestroyed();
virtual void _q_layoutChanged();
- void _q_fetchMore();
+ void fetchMore();
bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const;
bool shouldForwardEvent(QAbstractItemView::EditTrigger trigger, const QEvent *event) const;
@@ -388,6 +388,7 @@ public:
private:
mutable QBasicTimer delayedLayout;
+ mutable QBasicTimer fetchMoreTimer;
};
QT_BEGIN_INCLUDE_NAMESPACE