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:
parent
cff9142942
commit
8396162027
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user