diff options
author | Daniel Teske <qt@squorn.de> | 2016-12-14 10:24:21 +0100 |
---|---|---|
committer | Daniel Teske <qt@squorn.de> | 2017-07-10 14:21:07 +0000 |
commit | 4ebc2cf74e557b65a8ce1dc518ca92f399ce89e8 (patch) | |
tree | 33c51348e619c43d375c9aef4c1884aba433bc7e /src | |
parent | 920ba35397623a0743fe25e90094e4e86dd64822 (diff) |
macOS QComboBox: Don't show scrollers if they aren't needed
Task-number: QTBUG-13925
Task-number: QTBUG-18788
Change-Id: Id155ea26824e1cb470cc6174704436d99fb7ac87
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 13 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox_p.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 21b3eab0ad..a8a54d8d67 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -490,6 +490,14 @@ void QComboBoxPrivateContainer::scrollItemView(int action) #endif } +void QComboBoxPrivateContainer::hideScrollers() +{ + if (top) + top->hide(); + if (bottom) + bottom->hide(); +} + /* Hides or shows the scrollers when we emulate a popupmenu */ @@ -2731,6 +2739,11 @@ void QComboBox::showPopup() if (needHorizontalScrollBar) { listRect.adjust(0, 0, 0, sb->height()); } + + // Hide the scrollers here, so that the listrect gets the full height of the container + // If the scrollers are truly needed, the later call to container->updateScrollers() + // will make them visible again. + container->hideScrollers(); container->setGeometry(listRect); #ifndef Q_OS_MAC diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 2340f06954..8d3b46a950 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -231,6 +231,7 @@ public: public Q_SLOTS: void scrollItemView(int action); + void hideScrollers(); void updateScrollers(); void viewDestroyed(); |