diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-04-24 16:43:14 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-04-24 16:43:14 +0300 |
commit | 29400a683f96867133b28299c0d0bd6bcf40df35 (patch) | |
tree | b616dfb91ce111d61a34a67b28069561306575da /src/plugins/styles | |
parent | 42e4ae042a4c86e58bcb8b6d2d59ba4a988285b4 (diff) | |
parent | 9c60c8b122e5eb74fe74e11b929c30aa19ec0dd3 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.10' into tqtc/lts-5.15-opensourcev5.15.10-lts-lgpl
Change-Id: Ic1bb4240ca70a8a361fa0267476707446579221d
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 34 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 10 |
2 files changed, 14 insertions, 30 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index adbeec8da7..4171e08286 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -3730,9 +3730,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // button in a 'pressed' state (the 'momentary push in' does // not show its state otherwise): [pb highlight:isPressed]; - // For default/checked button this will give the required - // button accent color: - pb.keyEquivalent = isHighlighted ? @"\r" : @""; + + if (cw.type == QMacStylePrivate::Button_SquareButton) { + pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff; + } else { + // For default/checked button this will give the required + // button accent color: + pb.keyEquivalent = isHighlighted ? @"\r" : @""; + } d->drawNSViewInRect(pb, frameRect, p, ^(CGContextRef, const CGRect &r) { [pb.cell drawBezelWithFrame:r inView:pb.superview]; @@ -3785,7 +3790,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter btn.palette.setColor(QPalette::ButtonText, Qt::white); } - if (!isDarkMode() && QOperatingSystemVersion::current() > QOperatingSystemVersion::MacOSBigSur) { + if (isEnabled && !isDarkMode() && QOperatingSystemVersion::current() > QOperatingSystemVersion::MacOSBigSur) { if (!isDefault && !(btn.state & State_On)) { // On macOS 12 it's a gray button, white text color (if set in the // previous statement) would be almost invisible. @@ -4093,27 +4098,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } p->restore(); } - - // TODO Needs size adjustment to fit the focus ring - if (tabOpt->state & State_HasFocus) { - QMacStylePrivate::CocoaControlType focusRingType; - switch (tp) { - case QStyleOptionTab::Beginning: - focusRingType = verticalTabs ? QMacStylePrivate::SegmentedControl_Last - : QMacStylePrivate::SegmentedControl_First; - break; - case QStyleOptionTab::Middle: - focusRingType = QMacStylePrivate::SegmentedControl_Middle; - break; - case QStyleOptionTab::End: - focusRingType = verticalTabs ? QMacStylePrivate::SegmentedControl_First - : QMacStylePrivate::SegmentedControl_Last; - break; - case QStyleOptionTab::OnlyOneTab: - focusRingType = QMacStylePrivate::SegmentedControl_Single; - break; - } - } } break; case CE_TabBarTabLabel: diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 11cffd8c0c..3148abf567 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -325,7 +325,7 @@ void QWindowsXPStylePrivate::cleanupVistaTreeViewTheming() /* \internal Closes all open theme data handles to ensure that we don't leak - resources, and that we don't refere to old handles when for + resources, and that we don't refer to old handles when for example the user changes the theme style. */ void QWindowsXPStylePrivate::cleanupHandleMap() @@ -572,7 +572,7 @@ bool QWindowsXPStylePrivate::hasAlphaChannel(const QRect &rect) The rule of thumb for premultiplied pixmaps is that the color values of a pixel can never be higher than the alpha values, so we use this to our advantage here, and fix all instances where - this occures. + this occurs. */ bool QWindowsXPStylePrivate::fixAlphaChannel(const QRect &rect) { @@ -600,7 +600,7 @@ bool QWindowsXPStylePrivate::fixAlphaChannel(const QRect &rect) Swaps the alpha values on certain pixels: 0xFF?????? -> 0x00?????? 0x00?????? -> 0xFF?????? - Used to determin the mask of a non-alpha transparent pixmap in + Used to determine the mask of a non-alpha transparent pixmap in the native doublebuffer, and swap the alphas so we may paint the image as a Premultiplied QImage with drawImage(), and obtain the mask transparency. @@ -784,7 +784,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa It should only be used when the painteengine doesn't provide a proper HDC for direct painting (e.g. when doing a grabWidget(), painting to other pixmaps etc), or when special transformations are needed (e.g. - flips (horizonal mirroring only, vertical are handled by the theme + flips (horizontal mirroring only, vertical are handled by the theme engine). \a correctionFactor is an additional factor used to scale up controls @@ -3957,7 +3957,7 @@ static QList<PropPair> all_props; directly. Since we cannot rely on the pixel data we get from Microsoft when drawing into the DIB section, we use this function to - see the actual data we got, and can determin the appropriate + see the actual data we got, and can determine the appropriate action. */ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h) |