summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-08-27 19:52:37 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-08-27 19:52:37 +0200
commit8c162f244297d9d6ab65bbbeba44c0470b17b102 (patch)
treefd741d8b7abae3b50ce89fc8a4a4691229cfc0ed
parenta5e91d977f3dc663d40945db3ccdfa7a71086e6e (diff)
Keep the scrollbar independent from the view in QtListWidgetNG.
-rw-r--r--src/qlistwidgetng.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qlistwidgetng.cpp b/src/qlistwidgetng.cpp
index 08b0381..2a221d2 100644
--- a/src/qlistwidgetng.cpp
+++ b/src/qlistwidgetng.cpp
@@ -49,7 +49,7 @@ void QtListWidgetNGPrivate::_q_itemsInserted(int index, int count)
{
Q_UNUSED(index);
Q_UNUSED(count);
- _q_updateScrollbars(); // ### FIXME
+ //_q_updateScrollbars(); // ### FIXME
}
void QtListWidgetNGPrivate::_q_itemsRemoved(int index, int count)
@@ -70,7 +70,7 @@ void QtListWidgetNGPrivate::_q_itemsChanged(int from, int count, const QList<int
Q_UNUSED(from);
Q_UNUSED(count);
Q_UNUSED(roles);
- _q_updateScrollbars(); // ### FIXME
+ //_q_updateScrollbars(); // ### FIXME
}
void QtListWidgetNGPrivate::_q_showView()
@@ -158,7 +158,6 @@ void QtListWidgetNGPrivate::_q_viewChanged(QtGraphicsListView *current, QtGraphi
if (previous) {
q->scene()->removeItem(previous);
}
- scrollbar->setParentItem(current); // ### FIXME
if (current) {
q->scene()->addItem(current);
current->grabKeyboard();
@@ -176,12 +175,11 @@ void QtListWidgetNGPrivate::_q_updateScrollbars()
QRect r = q->viewport()->geometry();
q->scene()->setSceneRect(0, 0, r.width(), r.height());
- qreal w = scrollbar->boundingRect().width();
+ qreal w = scrollbar->effectiveSizeHint(Qt::PreferredSize).width();
scrollbar->setGeometry(QRect(r.width() - w, 0, w, r.height()));
// first set the geometry to allow maximumVerticalScrollValue to use it
controller->view()->setGeometry(QRect(0, 0, r.width(), r.height()));
- //controller->view()->doLayout();
qreal maximum = 0;
scrollbar->setPageStep(controller->pageStepValue(&maximum));
scrollbar->setMaximum(maximum);
@@ -192,6 +190,8 @@ void QtListWidgetNGPrivate::_q_updateScrollbars()
scrollbar->show();
controller->view()->setGeometry(QRect(0, 0, r.width() - w, r.height())); // ###
}
+
+ controller->view()->doLayout();
}
/*!
@@ -203,6 +203,7 @@ void QtListWidgetNGPrivate::initialize()
q->setScene(new QGraphicsScene(q));
// scrollbar
scrollbar = new QtGraphicsScrollBar(Qt::Vertical);
+ q->scene()->addItem(scrollbar);
// other parts
if (!controller)
controller = new QtListController(q);