From 5cb2fbe088ee5b15c2a35ba175e3c39a2fac5c03 Mon Sep 17 00:00:00 2001 From: ABBAPOH Date: Sat, 25 Feb 2012 23:52:09 +0400 Subject: Now QSplitter can have 0-pixel handle Change-Id: Iad920ffcd5d7f4c01504d41d1740f130b7aa53dd Reviewed-by: Thiago Macieira Reviewed-by: Girish Ramakrishnan --- src/widgets/widgets/qsplitter.cpp | 8 ++++---- src/widgets/widgets/qsplitter_p.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 285099a4cb..44c450ca47 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -232,14 +232,14 @@ void QSplitterHandle::resizeEvent(QResizeEvent *event) { Q_D(const QSplitterHandle); - // When splitters are only 1 pixel large we increase the + // When splitters are only 1 or 0 pixel large we increase the // actual grab area to five pixels // Note that QSplitter uses contentsRect for layouting // and ensures that handles are drawn on top of widgets // We simply use the contents margins for draggin and only // paint the mask area - bool useTinyMode = (d->s->handleWidth() == 1); + bool useTinyMode = (d->s->handleWidth() <= 1); setAttribute(Qt::WA_MouseNoMask, useTinyMode); if (useTinyMode) { if (orientation() == Qt::Horizontal) @@ -1528,14 +1528,14 @@ void QSplitter::setSizes(const QList &list) By default, this property contains a value that depends on the user's platform and style preferences. - If you set handleWidth to 1, the actual grab area will grow to overlap a + If you set handleWidth to 1 or 0, the actual grab area will grow to overlap a few pixels of it's respective widgets. */ int QSplitter::handleWidth() const { Q_D(const QSplitter); - if (d->handleWidth > 0) { + if (d->handleWidth >= 0) { return d->handleWidth; } else { return style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this); diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h index c9db6ef9af..d9a0cdecb7 100644 --- a/src/widgets/widgets/qsplitter_p.h +++ b/src/widgets/widgets/qsplitter_p.h @@ -83,7 +83,7 @@ class QSplitterPrivate : public QFramePrivate Q_DECLARE_PUBLIC(QSplitter) public: QSplitterPrivate() : rubberBand(0), opaque(true), firstShow(true), - childrenCollapsible(true), compatMode(false), handleWidth(0), blockChildAdd(false) {} + childrenCollapsible(true), compatMode(false), handleWidth(-1), blockChildAdd(false) {} QPointer rubberBand; mutable QList list; -- cgit v1.2.3