Hiding scrollbar on MacOSX 10.7 if policy is set to ScrollBarAlwaysOff

On Mac OS X 10.7 (if System Preferences -> General -> Show scroll bar is
"When scrolling") scroll bar was shown even if policy was set to
ScrollBarAlwaysOff.

This is a regression from 5.0.0.

Change-Id: I161b350874c085a1397df7b398af8f3fb0fbeacf
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
Cyril Oblikov 2013-02-20 17:19:15 +03:00 committed by The Qt Project
parent b05f19f232
commit 057fabab7c

View File

@ -329,13 +329,13 @@ void QAbstractScrollAreaPrivate::layoutChildren()
{
Q_Q(QAbstractScrollArea);
bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar);
bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn && !transient)
bool needh = (hbarpolicy != Qt::ScrollBarAlwaysOff) && ((hbarpolicy == Qt::ScrollBarAlwaysOn && !transient)
|| ((hbarpolicy == Qt::ScrollBarAsNeeded || transient)
&& hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty());
&& hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty()));
bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn && !transient)
bool needv = (vbarpolicy != Qt::ScrollBarAlwaysOff) && ((vbarpolicy == Qt::ScrollBarAlwaysOn && !transient)
|| ((vbarpolicy == Qt::ScrollBarAsNeeded || transient)
&& vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty());
&& vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty()));
QStyleOption opt(0);
opt.init(q);
@ -1456,9 +1456,9 @@ void QAbstractScrollAreaPrivate::flashScrollBars()
{
Q_Q(QAbstractScrollArea);
bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar);
if (hbarpolicy == Qt::ScrollBarAsNeeded || transient)
if ((hbarpolicy != Qt::ScrollBarAlwaysOff) && (hbarpolicy == Qt::ScrollBarAsNeeded || transient))
hbar->d_func()->flash();
if (vbarpolicy == Qt::ScrollBarAsNeeded || transient)
if ((vbarpolicy != Qt::ScrollBarAlwaysOff) && (vbarpolicy == Qt::ScrollBarAsNeeded || transient))
vbar->d_func()->flash();
}