diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-03-30 11:33:45 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-03-30 13:47:35 (GMT) |
commit | e20d18f1982dde2b0fa9bd262e5aadd1e451a7fa (patch) | |
tree | dff54c6720e57718626946437047591c52b0e377 /src/gui/widgets/qsplitter.cpp | |
parent | efbbb0ea53dfb8350f3f9b46dd5dc934051cedc7 (diff) | |
download | Qt-e20d18f1982dde2b0fa9bd262e5aadd1e451a7fa.zip Qt-e20d18f1982dde2b0fa9bd262e5aadd1e451a7fa.tar.gz Qt-e20d18f1982dde2b0fa9bd262e5aadd1e451a7fa.tar.bz2 |
Allow styling of pressed splitter
Task-number: 206494
Reviewed-by: Jens Bache-Wiig
Diffstat (limited to 'src/gui/widgets/qsplitter.cpp')
-rw-r--r-- | src/gui/widgets/qsplitter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index bf8af35..06774bc 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -119,7 +119,6 @@ QSplitterHandle::QSplitterHandle(Qt::Orientation orientation, QSplitter *parent) { Q_D(QSplitterHandle); d->s = parent; - d->hover = false; setOrientation(orientation); } @@ -269,8 +268,11 @@ void QSplitterHandle::mouseMoveEvent(QMouseEvent *e) void QSplitterHandle::mousePressEvent(QMouseEvent *e) { Q_D(QSplitterHandle); - if (e->button() == Qt::LeftButton) + if (e->button() == Qt::LeftButton) { d->mouseOffset = d->pick(e->pos()); + d->pressed = true; + update(); + } } /*! @@ -285,6 +287,10 @@ void QSplitterHandle::mouseReleaseEvent(QMouseEvent *e) d->s->setRubberBand(-1); moveSplitter(pos); } + if (e->button() == Qt::LeftButton) { + d->pressed = false; + update(); + } } /*! @@ -303,6 +309,8 @@ void QSplitterHandle::paintEvent(QPaintEvent *) opt.state = QStyle::State_None; if (d->hover) opt.state |= QStyle::State_MouseOver; + if (d->pressed) + opt.state |= QStyle::State_Sunken; if (isEnabled()) opt.state |= QStyle::State_Enabled; parentWidget()->style()->drawControl(QStyle::CE_Splitter, &opt, &p, d->s); |