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>
bb10
Daniel Teske 2016-12-14 10:24:21 +01:00
parent 920ba35397
commit 4ebc2cf74e
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -231,6 +231,7 @@ public:
public Q_SLOTS:
void scrollItemView(int action);
void hideScrollers();
void updateScrollers();
void viewDestroyed();