diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-05-10 11:51:53 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-05-10 20:19:25 +0000 |
commit | fb7cd193ab5d2a2f88b017134c1446099900f318 (patch) | |
tree | 479da76511ea9d9cc605b7f5547c2cd91b5574e5 /ui | |
parent | 4072db70ad1197c4978ab9892cc00c21267a561d (diff) |
Qt: Keep the OverlayScrollBar from disappearing.
Make sure we disable transience in both the parent and child scroll bar.
This keeps the child from disappearing on Yosemite when "System
Preferences → General → Show scroll bars: When scrolling" is enabled.
Add some comments about what will be required to properly handle
transience.
Change-Id: I6fc37ef1783b6c8dea179f08ad6c4343c7cf8095
Reviewed-on: https://code.wireshark.org/review/15336
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/overlay_scroll_bar.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ui/qt/overlay_scroll_bar.cpp b/ui/qt/overlay_scroll_bar.cpp index d24adc81ff..cfeee7c0f0 100644 --- a/ui/qt/overlay_scroll_bar.cpp +++ b/ui/qt/overlay_scroll_bar.cpp @@ -47,8 +47,20 @@ class OsbProxyStyle : public QProxyStyle { public: - // Hack to keep the scrollbar from disappearing on OS X. We should - // handle this more gracefully. + // Disable transient behavior. Mainly for OS X but possibly applies to + // other platforms. If we want to enable transience we'll have to + // handle the following at a minimum: + // + // setProperty("visible") from QScrollbarStyleAnimation. + // Other visibility changes. + // HoverEnter & HoverLeave events from QAbstractScrollArea. + // Size (and possibly opacity) changes while painting. + // + // Another approach would be to flip the child-parent relationship + // and make the parent a normal scroll bar with a manually-placed + // packet map child. This might make the packet list geometry a bit + // wonky, however. + virtual int styleHint(StyleHint hint, const QStyleOption *option = NULL, const QWidget *widget = NULL, QStyleHintReturn *returnData = NULL) const { #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) if (hint == SH_ScrollBar_Transient) return false; @@ -72,6 +84,7 @@ OverlayScrollBar::OverlayScrollBar(Qt::Orientation orientation, QWidget *parent) child_sb_.raise(); child_sb_.installEventFilter(this); + child_sb_.setStyle(new OsbProxyStyle); // XXX Do we need to connect anything else? connect(this, SIGNAL(rangeChanged(int,int)), this, SLOT(setChildRange(int,int))); |