diff options
author | Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> | 2012-04-11 20:12:48 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-05 13:13:58 +0200 |
commit | 10c6f015f45092040c281bb90a65179f598a00b1 (patch) | |
tree | 66dc70987e76dcb39cc2cb11f799ddee44082d90 /src/widgets/styles/qmacstyle_mac_p.h | |
parent | a0e617f669668c3a26e21195f96547a36b030364 (diff) |
Support for overlay-scrollbars on Mac
On Lion scroll bars are within the scroll area itself and are not being
shown as long as the user is not scrolling.
This patch draws the new scroll bars and makes them fade away. Further
it introduces a pixel metric checking for this behaviour. It's used by
QAbstractScrollArea to put the viewport to the correct place.
Task-number: QTBUG-21673
Change-Id: Id530265043549318ac420b392de6b8642deaa4c6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac_p.h')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac_p.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index 8f7edd51d5..260411851f 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -155,13 +155,14 @@ public: static const int BevelButtonW; static const int BevelButtonH; static const int PushButtonContentPadding; - + static const qreal ScrollBarFadeOutDuration; + static const qreal ScrollBarFadeOutDelay; // Stuff from QAquaAnimate: bool addWidget(QWidget *); void removeWidget(QWidget *); - enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen }; + enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen, AquaScrollBar }; bool animatable(Animates, const QWidget *) const; void stopAnimate(Animates, QWidget *); void startAnimate(Animates, QWidget *); @@ -210,6 +211,28 @@ public: QPointer<QPushButton> defaultButton; //default push buttons int timerID; QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation + QList<QPointer<QWidget> > scrollBars; //existing scroll bars that need animation + + struct OverlayScrollBarInfo { + OverlayScrollBarInfo() + : lastValue(-1), + lastMinimum(-1), + lastMaximum(-1), + lastUpdate(QDateTime::currentDateTime()), + hovered(false), + lastHovered(QDateTime::fromTime_t(0)), + cleared(false) + {} + int lastValue; + int lastMinimum; + int lastMaximum; + QSize lastSize; + QDateTime lastUpdate; + bool hovered; + QDateTime lastHovered; + bool cleared; + }; + QMap<const QWidget*, OverlayScrollBarInfo> scrollBarInfos; struct ButtonState { int frame; @@ -220,6 +243,10 @@ public: CFAbsoluteTime defaultButtonStart; QMacStyle *q; bool mouseDown; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + void* receiver; + void *nsscroller; +#endif }; QT_END_NAMESPACE |