diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-18 13:05:51 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-18 13:26:57 (GMT) |
commit | 5f9cf976110a0847053f1104376ad8831f9ceb48 (patch) | |
tree | ad87451c35cd5f348f84d754def5cc93b688a45e /src/gui/widgets | |
parent | 3adbf7ce04766c25b68d23087ed9a281d05f29b5 (diff) | |
download | Qt-5f9cf976110a0847053f1104376ad8831f9ceb48.zip Qt-5f9cf976110a0847053f1104376ad8831f9ceb48.tar.gz Qt-5f9cf976110a0847053f1104376ad8831f9ceb48.tar.bz2 |
Fix the QSplitter not showing correctly in QGraphicsView
This was due to the usage of mapToGlobal. It is now fixed by making
the rubberband child of the window() of the splitter and using
mapTo(window())
Task-number: QTBUG-8504
Reviewed-by: gabi
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qsplitter.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 965094e..f4076eb 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -1276,7 +1276,6 @@ void QSplitter::childEvent(QChildEvent *c) if (!c->child()->isWidgetType()) return; QWidget *w = static_cast<QWidget*>(c->child()); - if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) { d->insertWidget_helper(d->list.count(), w, false); } else if (c->polished() && !d->blockChildAdd) { @@ -1313,18 +1312,16 @@ void QSplitter::setRubberBand(int pos) const int rBord = 3; // customizable? int hw = handleWidth(); if (!d->rubberBand) { - d->rubberBand = new QRubberBand(QRubberBand::Line); + QBoolBlocker b(d->blockChildAdd); + d->rubberBand = new QRubberBand(QRubberBand::Line, this); // For accessibility to identify this special widget. d->rubberBand->setObjectName(QLatin1String("qt_rubberband")); } - if (d->orient == Qt::Horizontal) - d->rubberBand->setGeometry(QRect(QPoint(pos + hw / 2 - rBord, r.y()), - QSize(2 * rBord, r.height())).translated(mapToGlobal(QPoint()))); - else - d->rubberBand->setGeometry(QRect(QPoint(r.x(), pos + hw / 2 - rBord), - QSize(r.width(), 2 * rBord)).translated(mapToGlobal(QPoint()))); - if (!d->rubberBand->isVisible()) - d->rubberBand->show(); + + const QRect newGeom = d->orient == Qt::Horizontal ? QRect(QPoint(pos + hw / 2 - rBord, r.y()), QSize(2 * rBord, r.height())) + : QRect(QPoint(r.x(), pos + hw / 2 - rBord), QSize(r.width(), 2 * rBord)); + d->rubberBand->setGeometry(newGeom); + d->rubberBand->show(); } /*! @@ -1555,16 +1552,14 @@ QSize QSplitter::sizeHint() const ensurePolished(); int l = 0; int t = 0; - QObjectList childList = children(); - for (int i = 0; i < childList.size(); ++i) { - if (QWidget *w = qobject_cast<QWidget *>(childList.at(i))) { - if (w->isHidden()) - continue; - QSize s = w->sizeHint(); - if (s.isValid()) { - l += d->pick(s); - t = qMax(t, d->trans(s)); - } + for (int i = 0; i < d->list.size(); ++i) { + QWidget *w = d->list.at(i)->widget; + if (w->isHidden()) + continue; + QSize s = w->sizeHint(); + if (s.isValid()) { + l += d->pick(s); + t = qMax(t, d->trans(s)); } } return orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l); |