QTabBar: Repaint when releasing mouse on selected tab

Some styles, most notably QMacStyle, require this to
properly reflect the pressed state.

Change-Id: Ie841d97afbe3cfdfde1254a7069876a1a0af2e52
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Gabriel de Dietrich 2018-04-02 14:30:10 -07:00
parent cff9142942
commit 8396162027

View File

@ -2166,8 +2166,12 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
QStyleOptionTabBarBase optTabBase;
optTabBase.initFrom(this);
optTabBase.documentMode = d->documentMode;
if (style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease)
const bool selectOnRelease =
(style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease);
if (selectOnRelease)
setCurrentIndex(i);
if (!selectOnRelease || !d->validIndex(i) || d->currentIndex == i)
repaint(tabRect(i));
}
/*!\reimp