diff options
Diffstat (limited to 'src/gui/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2634d44..398e11d 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -529,6 +529,7 @@ public: QPointer<QFocusFrame> focusWidget; CFAbsoluteTime defaultButtonStart; QMacStyle *q; + bool mouseDown; }; QT_BEGIN_INCLUDE_NAMESPACE @@ -1477,7 +1478,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti #endif QMacStylePrivate::QMacStylePrivate(QMacStyle *style) - : timerID(-1), progressFrame(0), q(style) + : timerID(-1), progressFrame(0), q(style), mouseDown(false) { defaultButtonStart = CFAbsoluteTimeGetCurrent(); memset(&buttonState, 0, sizeof(ButtonState)); @@ -1494,7 +1495,7 @@ bool QMacStylePrivate::animatable(QMacStylePrivate::Animates as, const QWidget * { if (as == AquaPushButton) { QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w)); - if (w->window()->isActiveWindow() && pb) { + if (w->window()->isActiveWindow() && pb && !mouseDown) { if (static_cast<const QPushButton *>(w) != defaultButton) { // Changed on its own, update the value. const_cast<QMacStylePrivate *>(this)->stopAnimate(as, defaultButton); @@ -1514,8 +1515,7 @@ void QMacStylePrivate::stopAnimate(QMacStylePrivate::Animates as, QWidget *w) if (as == AquaPushButton && defaultButton) { QPushButton *tmp = defaultButton; defaultButton = 0; - if (tmp->isVisible()) - tmp->update(); + tmp->update(); } else if (as == AquaProgressBar) { progressBars.removeAll(w); } @@ -1841,10 +1841,15 @@ bool QMacStylePrivate::eventFilter(QObject *o, QEvent *e) break; case QEvent::MouseButtonPress: // It is very confusing to keep the button pulsing, so just stop the animation. + if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton) + mouseDown = true; stopAnimate(AquaPushButton, btn); break; - case QEvent::FocusOut: case QEvent::MouseButtonRelease: + if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton) + mouseDown = false; + // fall through + case QEvent::FocusOut: case QEvent::Show: case QEvent::WindowActivate: { QList<QPushButton *> list = qFindChildren<QPushButton *>(btn->window()); @@ -2184,7 +2189,7 @@ void QMacStyle::polish(QWidget* w) } if (qobject_cast<QMenu*>(w) || qobject_cast<QComboBoxPrivateContainer *>(w)) { - w->setWindowOpacity(0.94); + w->setWindowOpacity(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 ? 0.985 : 0.94); if (!w->testAttribute(Qt::WA_SetPalette)) { QPixmap px(64, 64); HIThemeMenuDrawInfo mtinfo; @@ -3849,13 +3854,16 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; case CE_TabBarTabShape: - if (const QStyleOptionTabV3 *tabOpt = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { - if (tabOpt->documentMode) { - p->save(); - QRect tabRect = tabOpt->rect; - drawTabShape(p, tabOpt); - p->restore(); - return; + if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) { + + if (const QStyleOptionTabV3 *tabOptV3 = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { + if (tabOptV3->documentMode) { + p->save(); + QRect tabRect = tabOptV3->rect; + drawTabShape(p, tabOptV3); + p->restore(); + return; + } } #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) |