14#define QMAC_QAQUASTYLE_SIZE_CONSTRAIN
17#include <QtCore/qoperatingsystemversion.h>
18#include <QtCore/qvariant.h>
19#include <QtCore/qvarlengtharray.h>
21#include <QtCore/private/qcore_mac_p.h>
23#include <QtGui/qpainterpath.h>
24#include <QtGui/private/qcoregraphics_p.h>
25#include <QtGui/qpa/qplatformfontdatabase.h>
26#include <QtGui/qpa/qplatformtheme.h>
28#include <QtWidgets/private/qstyleanimation_p.h>
31#include <QtWidgets/qmdisubwindow.h>
33#if QT_CONFIG(scrollbar)
34#include <QtWidgets/qscrollbar.h>
37#include <QtWidgets/private/qtabbar_p.h>
40#include <QtWidgets/qwizard.h>
66 if ((self = [super
init])) {
68 self.indeterminate = YES;
69 self.usesThreadedAnimation = NO;
70 self.alphaValue = 0.0;
78 if (_animators == 0) {
80 [
super startAnimation:self];
88 if (_animators == 0) {
89 [
super stopAnimation:self];
91 [
self removeFromSuperviewWithoutNeedingDisplay];
95- (
void)drawWithFrame:(CGRect)rect inView:(NSView *)view
98 self.alphaValue = 1.0;
100 [view addSubview:self];
101 if (!CGRectEqualToRect(
self.frame,
rect))
103 [
self drawRect:rect];
104 self.alphaValue = 0.0;
131 if ((self = [super
init])) {
133 self.titlePosition = NSNoTitle;
134 self.boxType = NSBoxCustom;
135 self.cornerRadius = 3;
136 self.borderColor = [NSColor.controlColor colorWithAlphaComponent:0.1];
137 self.fillColor = [NSColor.darkGrayColor colorWithAlphaComponent:0.2];
143- (
void)drawRect:(NSRect)rect
145 [
super drawRect:rect];
185 return isDarkMode() ? darkGradient : lightGradient;
201 return isDarkMode() ? darkGradient : lightGradient;
204#if QT_CONFIG(tabwidget)
230 tabBarRect.
setY(tabBarRect.
y() + tabBarRect.
height() / 2);
234 tabBarRect = tabBarRect.
adjusted(0, 2, 0, -2);
237 tabBarRect = tabBarRect.
adjusted(tabBarRect.
width() / 2, 2, tabBarRect.
width() / 2, -2);
242 for (
const QRect &qtRect : clipPath)
243 cgRects.push_back(qtRect.toCGRect());
245 CGContextClipToRects(
ctx, &cgRects[0],
size_t(cgRects.
size()));
273static const QColor lightTabBarTabBackgroundActive(190, 190, 190);
274static const QColor darkTabBarTabBackgroundActive(38, 38, 38);
275static const QColor tabBarTabBackgroundActive() {
return isDarkMode() ? darkTabBarTabBackgroundActive : lightTabBarTabBackgroundActive; }
277static const QColor lightTabBarTabBackgroundActiveHovered(178, 178, 178);
278static const QColor darkTabBarTabBackgroundActiveHovered(32, 32, 32);
279static const QColor tabBarTabBackgroundActiveHovered() {
return isDarkMode() ? darkTabBarTabBackgroundActiveHovered : lightTabBarTabBackgroundActiveHovered; }
281static const QColor lightTabBarTabBackgroundActiveSelected(211, 211, 211);
282static const QColor darkTabBarTabBackgroundActiveSelected(52, 52, 52);
283static const QColor tabBarTabBackgroundActiveSelected() {
return isDarkMode() ? darkTabBarTabBackgroundActiveSelected : lightTabBarTabBackgroundActiveSelected; }
285static const QColor lightTabBarTabBackground(227, 227, 227);
286static const QColor darkTabBarTabBackground(38, 38, 38);
287static const QColor tabBarTabBackground() {
return isDarkMode() ? darkTabBarTabBackground : lightTabBarTabBackground; }
289static const QColor lightTabBarTabBackgroundSelected(246, 246, 246);
290static const QColor darkTabBarTabBackgroundSelected(52, 52, 52);
291static const QColor tabBarTabBackgroundSelected() {
return isDarkMode() ? darkTabBarTabBackgroundSelected : lightTabBarTabBackgroundSelected; }
293static const QColor lightTabBarTabLineActive(160, 160, 160);
294static const QColor darkTabBarTabLineActive(90, 90, 90);
295static const QColor tabBarTabLineActive() {
return isDarkMode() ? darkTabBarTabLineActive : lightTabBarTabLineActive; }
297static const QColor lightTabBarTabLineActiveHovered(150, 150, 150);
298static const QColor darkTabBarTabLineActiveHovered(90, 90, 90);
299static const QColor tabBarTabLineActiveHovered() {
return isDarkMode() ? darkTabBarTabLineActiveHovered : lightTabBarTabLineActiveHovered; }
301static const QColor lightTabBarTabLine(210, 210, 210);
302static const QColor darkTabBarTabLine(90, 90, 90);
303static const QColor tabBarTabLine() {
return isDarkMode() ? darkTabBarTabLine : lightTabBarTabLine; }
305static const QColor lightTabBarTabLineSelected(189, 189, 189);
306static const QColor darkTabBarTabLineSelected(90, 90, 90);
307static const QColor tabBarTabLineSelected() {
return isDarkMode() ? darkTabBarTabLineSelected : lightTabBarTabLineSelected; }
309static const QColor tabBarCloseButtonBackgroundHovered(162, 162, 162);
310static const QColor tabBarCloseButtonBackgroundPressed(153, 153, 153);
311static const QColor tabBarCloseButtonBackgroundSelectedHovered(192, 192, 192);
312static const QColor tabBarCloseButtonBackgroundSelectedPressed(181, 181, 181);
313static const QColor tabBarCloseButtonCross(100, 100, 100);
314static const QColor tabBarCloseButtonCrossSelected(115, 115, 115);
316static const int closeButtonSize = 14;
317static const qreal closeButtonCornerRadius = 2.0;
320#if QT_CONFIG(accessibility)
327 return isOnKeyWindow ?
QColor(73, 73, 73, 100) :
QColor(56, 56, 56, 100);
329 return isOnKeyWindow ?
QColor(0, 0, 0, 28) :
QColor(0, 0, 0, 21);
341 { 0.5, 1.5, 2.5, 3.5 }
346 { 0.5, -1.5, 0.5, 2.5 },
351 { 1.5, -1.5, 1.5, 4.5 },
353 { 1.5, 0.5, 1.5, 2.5 }
390 auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name;
391 if (![NSAppearance.currentAppearance.name isEqualToString:requiredAppearanceName]) {
392 previous = NSAppearance.currentAppearance;
393 NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName];
401 NSAppearance.currentAppearance = previous;
405 NSAppearance *previous = nil;
412 const qreal length = sb->maximum - sb->minimum + sb->pageStep;
421 scroller.frame = sb->rect.toCGRect();
423 scroller.knobProportion = proportion;
427static bool setupSlider(NSSlider *slider,
const QStyleOptionSlider *sl)
429 if (sl->minimum >= sl->maximum)
432 slider.frame = sl->rect.toCGRect();
434 slider.minValue = sl->minimum;
435 slider.maxValue = sl->maximum;
436 slider.intValue = sl->sliderPosition;
440 int interval = sl->tickInterval;
442 interval = sl->pageStep;
444 interval = sl->singleStep;
448 slider.numberOfTickMarks = 1 + ((sl->maximum - sl->minimum) / interval);
452 slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionAbove : NSTickMarkPositionBelow;
454 slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionLeading : NSTickMarkPositionTrailing;
456 slider.numberOfTickMarks = 0;
461 [slider layoutSubtreeIfNeeded];
474 typedef bool (*TestContentBorderPositionFunction)(
QWindow *, int);
475 return (
reinterpret_cast<TestContentBorderPositionFunction
>(
function))(
window, windowY);
480static void drawTabCloseButton(
QPainter *
p,
bool hover,
bool selected,
bool pressed,
bool documentMode)
483 QRect rect(0, 0, closeButtonSize, closeButtonSize);
492 background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
494 background =
QColor(255, 255, 255, pressed ? 150 : 100);
496 background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered;
498 background = background.
lighter(pressed ? 135 : 140);
502 p->setBrush(background);
503 p->drawRoundedRect(
rect, closeButtonCornerRadius, closeButtonCornerRadius);
507 const int margin = 3;
509 crossPen.
setColor(selected ? (documentMode ? tabBarCloseButtonCrossSelected :
Qt::
white) : tabBarCloseButtonCross);
513 p->drawLine(margin, margin,
width - margin,
height - margin);
514 p->drawLine(margin,
height - margin,
width - margin, margin);
519 const auto tabDirection = QMacStylePrivate::tabDirection(shape);
520 if (QMacStylePrivate::verticalTabs(tabDirection)) {
521 int newX, newY, newRot;
523 newX = tabRect.
width();
528 newY = tabRect.
y() + tabRect.
height();
543 if (QMacStylePrivate::verticalTabs(QMacStylePrivate::tabDirection(tabOpt->shape)))
544 rect =
rect.adjusted(-tabOverlap, 0, 0, 0);
546 rect =
rect.adjusted(0, -tabOverlap, 0, 0);
563 if (tabOpt->documentMode && isUnified) {
569 p->fillRect(bodyRect, tabBarTabBackgroundActiveSelected());
571 p->fillRect(topLineRect, tabBarTabLineSelected());
573 p->fillRect(bodyRect, tabBarTabBackgroundSelected());
580 p->fillRect(bodyRect, tabBarTabBackgroundActiveHovered());
589 const QColor separatorLineColor = active ? tabBarTabLineActive() : tabBarTabLine();
590 p->fillRect(leftLineRect, separatorLineColor);
591 p->fillRect(rightLineRect, separatorLineColor);
597 if (QMacStylePrivate::verticalTabs(QMacStylePrivate::tabDirection(tbb->shape)))
600 r.setHeight(
w->height());
609 const QColor bodyColor = active ? tabBarTabBackgroundActive() : tabBarTabBackground();
610 p->fillRect(bodyRect, bodyColor);
614 const QColor topLineColor = active ? tabBarTabLineActive() : tabBarTabLine();
615 p->fillRect(topLineRect, topLineColor);
619 bool isDocument =
false;
620 if (
const QTabBar *tabBar = qobject_cast<const QTabBar*>(
w))
621 isDocument = tabBar->documentMode();
623 p->fillRect(bottomLineRect, bottomLineColor);
636#if QT_CONFIG(treeview)
649 int l = original.
length();
656 }
else if (original.
at(currPos) ==
QLatin1Char(
'(') && l >= 4 &&
662 while (finalDest >
n && returnText.
at(finalDest -
n - 1).
isSpace())
669 returnText[finalDest] = original.
at(currPos);
683 return [nswindow isMainWindow];
799 qDebug(
"Not sure how to return this...");
813#if QT_CONFIG(pushbutton)
814 if (qobject_cast<const QPushButton *>(widg))
817 else if (qobject_cast<const QRadioButton *>(widg))
819#if QT_CONFIG(checkbox)
820 else if (qobject_cast<const QCheckBox *>(widg))
823#if QT_CONFIG(combobox)
824 else if (qobject_cast<const QComboBox *>(widg))
827#if QT_CONFIG(toolbutton)
828 else if (qobject_cast<const QToolButton *>(widg))
831 else if (qobject_cast<const QSlider *>(widg))
833#if QT_CONFIG(progressbar)
834 else if (qobject_cast<const QProgressBar *>(widg))
837#if QT_CONFIG(lineedit)
838 else if (qobject_cast<const QLineEdit *>(widg))
841#if QT_CONFIG(itemviews)
842 else if (qobject_cast<const QHeaderView *>(widg))
845#if QT_CONFIG(menubar)
846 else if (qobject_cast<const QMenuBar *>(widg))
849#if QT_CONFIG(sizegrip)
850 else if (qobject_cast<const QSizeGrip *>(widg))
858#if QT_CONFIG(pushbutton)
896 if (rdo->
text().find(
'\n') != -1)
919#if QT_CONFIG(mdiarea)
920 if (widg && qobject_cast<QMdiSubWindow *>(widg->
parentWidget()))
944 if (szHint ==
QSize(-1, -1)) {
945#if QT_CONFIG(toolbutton)
984 const QStyleOptionSlider *sld = qstyleoption_cast<const QStyleOptionSlider *>(
opt);
992 else if (isBigSurOrAbove)
1034#if QT_CONFIG(progressbar)
1036 int finalValue = -1;
1038 if (
const QProgressBar *pb = qobject_cast<const QProgressBar *>(widg))
1039 orient = pb->orientation();
1048 ret.setHeight(finalValue);
1050 ret.setWidth(finalValue);
1054#if QT_CONFIG(combobox)
1056 if (!widg || !qobject_cast<QComboBox *>(widg->
parentWidget())) {
1066#if QT_CONFIG(treeview)
1067 if (isTreeView(widg))
1073 ret =
QSize(-1, [[NSApp mainMenu] menuBarHeight]);
1078 if (
ret.height() <= 0)
1089#if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
1094 if (large ==
QSize(-1, -1)) {
1095 if (small !=
QSize(-1, -1))
1097 if (mini !=
QSize(-1, -1))
1100 }
else if (small ==
QSize(-1, -1)) {
1101 if (mini !=
QSize(-1, -1))
1104 }
else if (mini ==
QSize(-1, -1)) {
1124 qreal hOffset = 0.0;
1125 qreal vOffset = 0.0;
1128 case Button_SquareButton:
1129 case SegmentedControl_Middle:
1131 auto innerRect = targetRect;
1132 if (
cw.type == Button_SquareButton)
1134 if (
cw.type == TextField)
1138 focusRingPath.
addRect(innerRect);
1139 focusRingPath.
addRoundedRect(outerRect, outerRadius, outerRadius);
1142 case Button_CheckBox: {
1148 vOffset = 0.5 *
qreal(targetRect.
height() - cbSize);
1149 const auto cbInnerRect =
QRectF(0, 0, cbSize, cbSize);
1152 focusRingPath.
addRoundedRect(cbOuterRect, cbOuterRadius, cbOuterRadius);
1153 focusRingPath.
addRoundedRect(cbInnerRect, cbInnerRadius, cbInnerRadius);
1156 case Button_RadioButton: {
1161 vOffset = 0.5 *
qreal(targetRect.
height() - rbSize);
1162 const auto rbInnerRect =
QRectF(0, 0, rbSize, rbSize);
1168 case Button_PullDown:
1169 case Button_PushButton: {
1171 auto *pb =
static_cast<NSButton *
>(cocoaControl(
cw));
1173 pb.frame = frameRect.toCGRect();
1174 focusRect = QRectF::fromCGRect([pb alignmentRectForFrame:pb.frame]);
1178 focusRect.
adjust(0, 3, 0, -3);
1183 focusRect = focusRect.
adjusted(0, 0, 0, -1);
1185 focusRect = focusRect.
adjusted(0, -1, 0, 0);
1187 if (isBigSurOrAbove)
1189 const qreal innerRadius =
cw.type == Button_PushButton ? 3 : 4;
1191 hOffset = focusRect.
left();
1192 vOffset = focusRect.
top();
1195 focusRingPath.
addRoundedRect(innerRect, innerRadius, innerRadius);
1196 focusRingPath.
addRoundedRect(outerRect, outerRadius, outerRadius);
1199 case Button_PopupButton:
1200 case SegmentedControl_Single: {
1201 QRectF focusRect = targetRect;
1202 if (isBigSurOrAbove)
1205 focusRect.
adjust(0, 0, 0, -1);
1206 const qreal innerRadius =
cw.type == Button_PushButton ? 3 : 4;
1208 hOffset = focusRect.
left();
1209 vOffset = focusRect.
top();
1212 focusRingPath.
addRoundedRect(innerRect, innerRadius, innerRadius);
1213 focusRingPath.
addRoundedRect(outerRect, outerRadius, outerRadius);
1217 case SegmentedControl_First:
1218 case SegmentedControl_Last: {
1219 hOffset = targetRect.
left();
1220 vOffset = targetRect.
top();
1221 const qreal innerRadius = 8;
1230 const auto topLeftCorner =
QRectF(
rect.topLeft(),
QSizeF(tRadius, tRadius));
1231 path.arcMoveTo(topLeftCorner, 180);
1232 path.arcTo(topLeftCorner, 180, -90);
1236 const auto rightEdge =
rect.right() - bRadius;
1237 path.arcTo(rightEdge,
rect.top(), bRadius, bRadius, 90, -90);
1238 path.arcTo(rightEdge,
rect.bottom() - bRadius, bRadius, bRadius, 0, -90);
1240 path.arcTo(
rect.left(),
rect.bottom() - tRadius, tRadius, tRadius, 270, -90);
1243 path.closeSubpath();
1248 const auto innerPath = cbFocusFramePath(innerRect, 0, innerRadius);
1249 focusRingPath.
addPath(innerPath);
1250 const auto outerPath = cbFocusFramePath(outerRect, 2 *
focusRingWidth, outerRadius);
1251 focusRingPath.
addPath(outerPath);
1258 auto focusRingColor =
qt_mac_toQColor(NSColor.keyboardFocusIndicatorColor.CGColor);
1263 focusRingColor.setAlphaF(0.39);
1269 if (
cw.type == SegmentedControl_First) {
1272 p->translate(hOffset, vOffset);
1273 p->fillPath(focusRingPath, focusRingColor);
1279 static const qreal CornerPointOffset = 5.5;
1280 static const qreal CornerControlOffset = 2.1;
1284 path.moveTo(
r.left(),
r.top() + CornerPointOffset);
1285 path.cubicTo(
r.left(),
r.top() + CornerControlOffset,
1286 r.left() + CornerControlOffset,
r.top(),
1287 r.left() + CornerPointOffset,
r.top());
1289 path.lineTo(
r.right() - CornerPointOffset,
r.top());
1290 path.cubicTo(
r.right() - CornerControlOffset,
r.top(),
1291 r.right(),
r.top() + CornerControlOffset,
1292 r.right(),
r.top() + CornerPointOffset);
1294 path.lineTo(
r.right(),
r.bottom() - CornerPointOffset);
1295 path.cubicTo(
r.right(),
r.bottom() - CornerControlOffset,
1296 r.right() - CornerControlOffset,
r.bottom(),
1297 r.right() - CornerPointOffset,
r.bottom());
1299 path.lineTo(
r.left() + CornerPointOffset,
r.bottom());
1300 path.cubicTo(
r.left() + CornerControlOffset,
r.bottom(),
1301 r.left(),
r.bottom() - CornerControlOffset,
1302 r.left(),
r.bottom() - CornerPointOffset);
1303 path.lineTo(
r.left(),
r.top() + CornerPointOffset);
1310 struct WindowButtons {
1315 static const WindowButtons buttons[] = {
1321 for (
const auto &wb : buttons)
1329#if QT_CONFIG(tabbar)
1340 tr.setRect(0, 0,
tr.height(),
tr.width());
1344 const int hpadding = 4;
1347 verticalShift = -verticalShift;
1348 tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
1351 if (!
opt->leftButtonSize.isEmpty()) {
1352 const int buttonSize =
verticalTabs ?
opt->leftButtonSize.height() :
opt->leftButtonSize.width();
1353 tr.setLeft(
tr.left() + 4 + buttonSize);
1355 if (
opt->rightButtonSize.isEmpty())
1356 tr.setRight(
tr.right() - 4 - buttonSize);
1359 if (!
opt->rightButtonSize.isEmpty()) {
1360 const int buttonSize =
verticalTabs ?
opt->rightButtonSize.height() :
opt->rightButtonSize.width();
1361 tr.setRight(
tr.right() - 4 - buttonSize);
1363 if (
opt->leftButtonSize.isEmpty())
1364 tr.setLeft(
tr.left() + 4 + buttonSize);
1382 if (
opt->documentMode) {
1384 const int textWidth =
1386 *iconRect =
QRect(
tr.center().x() - textWidth / 2 - stylePadding - tabIconSize.
width(),
1387 tr.center().y() - tabIconSize.
height() / 2,
1390 *iconRect =
QRect(
tr.left() + stylePadding,
tr.center().y() - tabIconSize.
height() / 2,
1396 tr.setLeft(
tr.left() + stylePadding + tabIconSize.
width() + 4);
1397 tr.setRight(
tr.right() - stylePadding - tabIconSize.
width() - 4);
1446#if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
1467 bool guess_size =
false;
1481 QSize *sz =
nullptr;
1489 *insz = sz ? *sz :
QSize(-1, -1);
1490#ifdef DEBUG_SIZE_CONSTRAINT
1492 const char *size_desc =
"Unknown";
1494 size_desc =
"Small";
1495 else if (sz == &large)
1496 size_desc =
"Large";
1497 else if (sz == &mini)
1499 qDebug(
"%s - %s: %s taken (%d, %d) [%d, %d]",
1501 widg ? widg->metaObject()->className() :
"*Unknown*", size_desc, widg->
width(), widg->
height(),
1518 return ((
cw.type << 2) |
cw.size) ^
seed;
1559 const auto frameSize = defaultFrameSize();
1561 frameRect =
rect.adjusted(3, 1, -3, -1)
1563 .adjusted(-6.5, 0, 6.5, 0);
1627 *buttonType = NSButtonTypeSwitch;
1628 *bezelStyle = NSBezelStyleRegularSquare;
1631 *buttonType = NSButtonTypeOnOff;
1632 *bezelStyle = NSBezelStyleDisclosure;
1635 *buttonType = NSButtonTypeRadio;
1636 *bezelStyle = NSBezelStyleRegularSquare;
1639 *buttonType = NSButtonTypePushOnPushOff;
1640 *bezelStyle = NSBezelStyleShadowlessSquare;
1643 *buttonType = NSButtonTypeMomentaryPushIn;
1644 *bezelStyle = NSBezelStyleRounded;
1655 if (
const auto *
btn = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
1671 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
1672 if (combo->editable)
1687 CGRect innerBounds = outerBounds;
1692 switch (cocoaWidget.
size) {
1694 innerBounds.origin.x += 3;
1695 innerBounds.origin.y += 3;
1696 innerBounds.size.width -= 6;
1697 innerBounds.size.height -= 7;
1700 innerBounds.origin.x += 2;
1701 innerBounds.origin.y += 2;
1702 innerBounds.size.width -= 5;
1703 innerBounds.size.height -= 6;
1707 innerBounds.origin.x += 2;
1708 innerBounds.origin.y += 2;
1709 innerBounds.size.width -= 5;
1710 innerBounds.size.height -= 6;
1713 switch (cocoaWidget.
size) {
1715 innerBounds.origin.x += 3;
1716 innerBounds.origin.y += 3;
1717 innerBounds.size.width -= 7;
1718 innerBounds.size.height -= 8;
1721 innerBounds.origin.x += 3;
1722 innerBounds.origin.y += 3;
1723 innerBounds.size.width -= 4;
1724 innerBounds.size.height -= 8;
1728 innerBounds.origin.x += 3;
1729 innerBounds.origin.y += 2;
1730 innerBounds.size.width -= 6;
1731 innerBounds.size.height -= 8;
1748 ret =
ret.adjusted(0, 0, -25, 0).translated(2, 4.5);
1752 ret =
ret.adjusted(0, 0, -22, 0).translated(2, 3);
1756 ret =
ret.adjusted(0, 0, -19, 0).translated(2, 2.5);
1757 ret.setHeight(10.5);
1765 ret.adjust(10, 1, -23, -4);
1768 ret.adjust(10, 4, -20, -3);
1771 ret.adjust(9, 0, -19, 0);
1810 NSBox *
box = [[NSBox alloc] init];
1813 box.titlePosition = NSNoTitle;
1824 NSButton *bc = [[NSButton alloc] init];
1832 NSPopUpButton *bc = [[NSPopUpButton alloc] init];
1842 const NSWindowButton
button = [=] {
1845 return NSWindowCloseButton;
1847 return NSWindowMiniaturizeButton;
1849 return NSWindowZoomButton;
1855 const auto styleMask = NSWindowStyleMaskTitled
1856 | NSWindowStyleMaskClosable
1857 | NSWindowStyleMaskMiniaturizable
1858 | NSWindowStyleMaskResizable;
1859 bv = [NSWindow standardWindowButton:button forStyleMask:styleMask];
1864 bv = [[NSComboBox alloc] init];
1867 bv = [[NSProgressIndicator alloc] init];
1873 bv = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
1878 bv = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
1881 bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)];
1886 bv = [[NSSlider alloc] initWithFrame:NSMakeRect(0, 0, 20, 200)];
1889 bv = [[NSSplitView alloc] init];
1895 bv = [[NSTextField alloc] init];
1901 if ([bv isKindOfClass:[NSControl class]]) {
1902 auto *ctrl =
static_cast<NSControl *
>(bv);
1905 ctrl.controlSize = NSControlSizeSmall;
1908 ctrl.controlSize = NSControlSizeMini;
1915 auto *
pi =
static_cast<NSProgressIndicator *
>(bv);
1919 pi.controlSize = NSControlSizeSmall;
1922 pi.controlSize = NSControlSizeMini;
1932 NSButtonType buttonType;
1933 NSBezelStyle bezelStyle;
1934 if (
widget.getCocoaButtonTypeAndBezelStyle(&buttonType, &bezelStyle)) {
1937 auto *
button =
static_cast<NSButton *
>(bv);
1938 button.buttonType = buttonType;
1939 button.bezelStyle = bezelStyle;
1941 button.allowsMixedState = YES;
1953 cell = [[NSStepperCell alloc] init];
1956 NSButtonCell *bc = [[NSButtonCell alloc] init];
1957 bc.buttonType = NSButtonTypeOnOff;
1958 bc.bezelStyle = NSBezelStyleDisclosure;
1968 cell.controlSize = NSControlSizeSmall;
1971 cell.controlSize = NSControlSizeMini;
1984 __attribute__((noescape)) DrawRectBlock drawRectBlock)
const
1998 view.wantsLayer = YES;
2016 const CGRect dirtyRect =
rect.toCGRect();
2019 drawRectBlock(
ctx, dirtyRect);
2021 [view drawRect:dirtyRect];
2023 [view removeFromSuperviewWithoutNeedingDisplay];
2039 NSPreferredScrollerStyleDidChangeNotification, []() {
2053 for (NSView *
b :
d->cocoaControls)
2055 d->cocoaControls.clear();
2081 d->smallSystemFont = *ssf;
2083 d->smallSystemFont =
QFont();
2088 || qobject_cast<QMenu*>(
w)
2090 || qobject_cast<QComboBoxPrivateContainer *>(
w)
2094 || qobject_cast<QMdiSubWindow *>(
w)
2098 w->setAutoFillBackground(
false);
2101#if QT_CONFIG(tabbar)
2102 if (
QTabBar *tb = qobject_cast<QTabBar*>(
w)) {
2103 if (tb->documentMode()) {
2117 if (
QRubberBand *rubber = qobject_cast<QRubberBand*>(
w)) {
2118 rubber->setWindowOpacity(0.25);
2123 if (qobject_cast<QScrollBar*>(
w)) {
2126 w->setMouseTracking(
true);
2134 qobject_cast<QMenu*>(
w) &&
2139 w->setWindowOpacity(1.0);
2142#if QT_CONFIG(combobox)
2143 if (
QComboBox *combo = qobject_cast<QComboBox *>(
w)) {
2144 if (!combo->isEditable()) {
2151#if QT_CONFIG(tabbar)
2152 if (qobject_cast<QTabBar*>(
w)) {
2160 if (
QRubberBand *rubber = qobject_cast<QRubberBand*>(
w)) {
2161 rubber->setWindowOpacity(1.0);
2171 if (qobject_cast<QScrollBar*>(
w)) {
2174 w->setMouseTracking(
false);
2185#if QT_CONFIG(tabbar)
2188 ret = closeButtonSize;
2204 if (sz ==
QSize(-1, -1))
2212 if (sz ==
QSize(-1, -1))
2254#if QT_CONFIG(mainwindow)
2258 && qobject_cast<const QAbstractScrollArea *>(
widget))
2263 if (qstyleoption_cast<const QStyleOptionComboBox *>(
opt) != 0)
2288 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
2289 int space = (sl->orientation ==
Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
2290 int ticks = sl->tickPosition;
2307 thick += (space * 2) / (
n + 2);
2331 style |= NSWindowStyleMaskUtilityWindow;
2332 ret = int([NSWindow frameRectForContentRect:NSZeroRect
2333 styleMask:style].size.height);
2347#if QT_CONFIG(tabbar)
2348 const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(
opt);
2349 if (tb && tb->documentMode)
2386 ret =
static_cast<int>([NSScroller
2387 scrollerWidthForControlSize:static_cast<NSControlSize>(size)
2388 scrollerStyle:[NSScroller preferredScrollerStyle]]);
2561 if (
styleNames.toStringList().contains(
"macOS"))
2631 NSUserDefaults*
defaults = [NSUserDefaults standardUserDefaults];
2632 bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
2633 const QStyleOptionSlider *sliderOpt = qstyleoption_cast<const QStyleOptionSlider*>(
opt);
2672#if QT_CONFIG(tabbar)
2673 if (
const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
2683 ret = !cmb->editable;
2697#if QT_CONFIG(tabwidget)
2698 if (
const QTabWidget *tab = qobject_cast<const QTabWidget*>(
w)) {
2699 if (tab->documentMode()) {
2705#if QT_CONFIG(tabbar)
2706 if (
const QTabBar *tab = qobject_cast<const QTabBar*>(
w)) {
2707 if (tab->documentMode()) {
2730 const uchar fillR = 192, fillG = 191, fillB = 190;
2745 const int w = sbpl/4,
h =
img.height();
2751 for (
int y = 0;
y <
h; ++
y) {
2752 srow = sptr+((
y*sbpl)/4);
2753 drow = dptr+((
y*dbpl)/4);
2754 for (
int x = 0;
x <
w; ++
x) {
2755 const int redDiff =
qRed(*srow) - fillR;
2756 const int greenDiff =
qGreen(*srow) - fillG;
2757 const int blueDiff =
qBlue(*srow) - fillB;
2758 const int diff = (redDiff * redDiff) + (greenDiff * greenDiff) + (blueDiff * blueDiff);
2759 (*drow++) = (diff < 10) ? 0xffffffff : 0xff000000;
2794#if QT_CONFIG(dialogbuttonbox)
2829#if QT_CONFIG(wizard)
2846#if QT_CONFIG(tabbar)
2855 if ((qobject_cast<const QScrollBar *>(
w) &&
w->parent() &&
2856 qobject_cast<QAbstractScrollArea*>(
w->parent()->parent()))
2861 ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay;
2864#if QT_CONFIG(itemviews)
2898 int imgh =
img.height();
2899 int imgw =
img.width();
2901 for (
int y = 0;
y < imgh; ++
y) {
2902 for (
int x = 0;
x < imgw; ++
x) {
2903 pixel =
img.pixel(
x,
y);
2925 static bool recursionGuard =
false;
2930 recursionGuard =
true;
2932 recursionGuard =
false;
2955 QWindow *
window =
w &&
w->window() ?
w->window()->windowHandle() :
nullptr;
2956 d->resolveCurrentNSView(
window);
2964 const int xOffset = 1;
2966 const qreal penWidth =
qMax(halfSize / 3.0, 1.25);
2967#if QT_CONFIG(toolbutton)
2968 if (
const QToolButton *tb = qobject_cast<const QToolButton *>(
w)) {
2972 halfSize -= penWidth;
2995 path.moveTo(-halfSize, -halfSize * 0.5);
2996 path.lineTo(0.0, halfSize * 0.5);
2997 path.lineTo(halfSize, -halfSize * 0.5);
3001 p->strokePath(
path, arrowPen);
3004#if QT_CONFIG(tabbar)
3006 if (
const QStyleOptionTabBarBase *tbb
3007 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
3008 if (tbb->documentMode) {
3010 drawTabBase(
p, tbb,
w);
3014#if QT_CONFIG(tabwidget)
3016 region -= tbb->tabBarRect.adjusted(3, 0, -3, 0);
3018 p->setClipRegion(region);
3019 QStyleOptionTabWidgetFrame twf;
3020 twf.QStyleOption::operator=(*tbb);
3021 twf.shape = tbb->shape;
3022 switch (QMacStylePrivate::tabDirection(twf.shape)) {
3024 twf.rect = twf.rect.adjusted(0, 0, 0, 10);
3027 twf.rect = twf.rect.adjusted(0, -10, 0, 0);
3030 twf.rect = twf.rect.adjusted(0, 0, 10, 0);
3033 twf.rect = twf.rect.adjusted(0, -10, 0, 0);
3046 if (
const auto *
groupBox = qstyleoption_cast<const QStyleOptionFrame *>(
opt))
3051#if QT_CONFIG(tabwidget)
3057 auto *
box =
static_cast<NSBox *
>(
d->cocoaControl(
cw));
3071 auto adjustedRect =
opt->
rect;
3072 bool needTranslation =
false;
3086 adjustedRect.
adjust(0, 0, 6, 6);
3087 needTranslation =
true;
3090#if QT_CONFIG(tabwidget)
3092 clipTabBarFrame(
opt,
this,
ctx);
3094 CGContextTranslateCTM(
ctx, 0,
rect.origin.y +
rect.size.height);
3095 CGContextScaleCTM(
ctx, 1, -1);
3100 if (needTranslation)
3101 CGContextTranslateCTM(
ctx, -3.0, 5.0);
3124 p->fillPath(
path, dark);
3129 if (qobject_cast<const QMdiSubWindow*>(
w)) {
3142 p->setPen(
QColor(160, 160, 160));
3145 p->setPen(
QColor(145, 145, 145));
3155 static const int RectHeight = 2;
3157 while (y < opt->
rect.height() - RectHeight - 5) {
3159 path.addEllipse(
x,
y, RectHeight, RectHeight);
3163 while (x < opt->
rect.width() - RectHeight - 5) {
3165 path.addEllipse(
x,
y, RectHeight, RectHeight);
3172 p->fillPath(
path, dark);
3204 kCTFontUIFontMenuItemMark;
3211 CGContextSaveGState(cg);
3212 CGContextSetShouldSmoothFonts(cg, NO);
3220 CGContextScaleCTM(cg, 1, -1);
3222 CGContextTranslateCTM(cg,
opt->
rect.
x(), vOffset);
3226 static const CFStringRef
keys[] = { kCTFontAttributeName, kCTForegroundColorAttributeName };
3227 static const int numValues =
sizeof(
keys) /
sizeof(
keys[0]);
3228 const CFTypeRef
values[] = { (CFTypeRef)checkmarkFont, (CFTypeRef)checkmarkColor };
3229 static_assert((
sizeof(
values) /
sizeof(
values[0])) == numValues);
3231 numValues, NULL, NULL);
3236 CTLineDraw((CTLineRef)
line, cg);
3239 CGContextRestoreGState(cg);
3248 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
w);
3250 auto *tb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3251 tb.enabled = isEnabled;
3254 [tb highlight:isPressed];
3255 const auto vOffset = [=] {
3263 CGContextTranslateCTM(
ctx, 0, vOffset);
3264 [tb.cell drawInteriorWithFrame:rect inView:tb];
3274 NSButtonCell *triangleCell =
static_cast<NSButtonCell *
>(
d->cocoaCell(
cw));
3275 [triangleCell setState:(opt->state & State_Open) ? NSControlStateValueOn : NSControlStateValueOff];
3277 [triangleCell setBackgroundStyle:((opt->state & State_Selected) && viewHasFocus) ? NSBackgroundStyleEmphasized : NSBackgroundStyleNormal];
3279 d->setupNSGraphicsContext(cg, NO);
3282 CGRect
rect = CGRectMake(qtRect.
x() + 1, qtRect.
y(), qtRect.
width(), qtRect.
height());
3283 CGContextTranslateCTM(cg,
rect.origin.x,
rect.origin.y +
rect.size.height);
3284 CGContextScaleCTM(cg, 1, -1);
3285 CGContextTranslateCTM(cg, -
rect.origin.x, -
rect.origin.y);
3287 [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]];
3289 d->restoreNSGraphicsContext(cg);
3293 QPen oldPen =
p->pen();
3309 auto *tf =
static_cast<NSTextField *
>(
d->cocoaControl(
cw));
3310 tf.enabled = isEnabled;
3311 tf.editable = !isReadOnly;
3313 static_cast<NSTextFieldCell *
>(tf.cell).bezelStyle = isRounded ? NSTextFieldRoundedBezel : NSTextFieldSquareBezel;
3314 tf.frame =
opt->
rect.toCGRect();
3316 if (!isDarkMode()) {
3321 CGContextRef cgContext = NSGraphicsContext.currentContext.CGContext;
3325 if (cgContext ? bool(CGBitmapContextGetColorSpace(cgContext)) : false) {
3326 tf.drawsBackground = YES;
3327 const QColor bgColor = frame->palette.brush(QPalette::Base).color();
3328 tf.backgroundColor = [NSColor colorWithSRGBRed:bgColor.redF()
3329 green:bgColor.greenF()
3330 blue:bgColor.blueF()
3331 alpha:bgColor.alphaF()];
3332 if (bgColor.alpha() != 255) {
3339 [tf.cell drawWithFrame:
rect inView:tf];
3366#if QT_CONFIG(lineedit)
3387#if QT_CONFIG(tabbar)
3390 QTabBar *tabBar = qobject_cast<QTabBar*>(
w->parentWidget());
3395 tabBar = qobject_cast<QTabBar *>(
const_cast<QWidget*
>(
w));
3396 closeBtn =
decltype(closeBtn)(
property(
"_q_styleSheetRealCloseButton").value<
void *>());
3402 if (!documentMode ||
3408 drawTabCloseButton(
p, hover, selected, pressed, documentMode);
3424 p->fillRect(
opt->
rect, linearGrad);
3455 int imgh =
img.height();
3456 int imgw =
img.width();
3459 for (
int y = 0;
y < imgh; ++
y) {
3460 for (
int x = 0;
x < imgw; ++
x) {
3461 pixel =
img.pixel(
x,
y);
3468 pixel = hsvColor.
rgb();
3478 CGContextTranslateCTM(cg,
rect.size.height, 0);
3479 CGContextRotateCTM(cg,
M_PI_2);
3481 if (vertical != reverse) {
3482 CGContextTranslateCTM(cg,
rect.size.width, 0);
3483 CGContextScaleCTM(cg, -1, 1);
3494 QWindow *
window =
w &&
w->window() ?
w->window()->windowHandle() :
nullptr;
3495 d->resolveCurrentNSView(
window);
3504 bool noVerticalHeader =
true;
3505#if QT_CONFIG(tableview)
3507 if (
const QTableView *
table = qobject_cast<const QTableView *>(
w->parentWidget()))
3508 noVerticalHeader = !
table->verticalHeader()->isVisible();
3517 p->fillRect(ir, pressed ?
header->palette.dark() :
header->palette.button());
3531 myTb.
state &= ~State_AutoRaise;
3532#if QT_CONFIG(accessibility)
3533 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar)) {
3534 QRect cr = tb->rect;
3537 bool needText =
false;
3550 if (tb->icon.isNull() && !tb->text.isEmpty())
3566 QPixmap pixmap = tb->icon.pixmap(tb->rect.size().boundedTo(tb->iconSize),
p->device()->devicePixelRatio(),
3567 iconMode, iconState);
3603 QPen pen =
p->pen();
3650 d->autoDefaultButton =
nullptr;
3654 const bool isHighlighted =
isActive &&
3661 const auto cs =
d->effectiveAquaSizeConstrain(
btn,
w);
3663 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3668 pb.frame = frameRect.toCGRect();
3670 pb.enabled = isEnabled;
3675 [pb highlight:isPressed];
3679 pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff;
3683 pb.keyEquivalent = isHighlighted ?
@"\r" :
@"";
3686 d->drawNSViewInRect(pb, frameRect,
p, ^(
CGContextRef,
const CGRect &
r) {
3687 [pb.cell drawBezelWithFrame:r inView:pb.superview];
3695 const auto ir = frameRect.
toRect();
3696 int arrowYOffset = 0;
3701 arrowYOffset -= ir.
top();
3751 if ((!hasIcon && !hasMenu) || (hasIcon && !hasText)) {
3779 int iconLeftOffset = freeContentRect.
x() + (freeContentRect.
width() - contentW) / 2;
3780 int iconTopOffset = freeContentRect.
y() + (freeContentRect.
height() - pixmapSize.
height()) / 2;
3781 QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmapSize.
width(), pixmapSize.
height());
3784 int newOffset = iconDestRect.
x() + iconDestRect.
width()
3797#if QT_CONFIG(combobox)
3799 if (
const auto *
cb = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
3800 auto comboCopy = *
cb;
3807#if QT_CONFIG(tabbar)
3809 if (
const auto *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
3810 if (tabOpt->documentMode) {
3812 bool isUnified =
false;
3814 QRect tabRect = tabOpt->rect;
3820 drawTabShape(
p, tabOpt, isUnified, tabOverlap);
3830 const auto tabDirection = QMacStylePrivate::tabDirection(tabOpt->shape);
3834 QStyleOptionTab::TabPosition tp = tabOpt->position;
3835 QStyleOptionTab::SelectedPosition
sp = tabOpt->selectedPosition;
3837 if (tp == QStyleOptionTab::Beginning)
3838 tp = QStyleOptionTab::End;
3839 else if (tp == QStyleOptionTab::End)
3840 tp = QStyleOptionTab::Beginning;
3842 if (
sp == QStyleOptionTab::NextIsSelected)
3843 sp = QStyleOptionTab::PreviousIsSelected;
3844 else if (
sp == QStyleOptionTab::PreviousIsSelected)
3845 sp = QStyleOptionTab::NextIsSelected;
3854 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
w);
3856 const bool needsInactiveHack = (!
isActive && isSelected);
3858 const auto ct = !needsInactiveHack && (isSelected || tp == QStyleOptionTab::OnlyOneTab) ?
3863 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
3865 auto vOffset = isPopupButton ? 1 : 2;
3866 if (isBigSurOrAbove) {
3874 const auto outerAdjust = isPopupButton ? 1 : 4;
3875 const auto innerAdjust = isPopupButton ? 20 : 10;
3876 QRectF frameRect = tabOpt->rect;
3880 frameRect = frameRect.
translated(0, vOffset);
3882 case QStyleOptionTab::Beginning:
3885 frameRect = frameRect.
adjusted(-innerAdjust, 0, outerAdjust, 0);
3887 frameRect = frameRect.
adjusted(-outerAdjust, 0, innerAdjust, 0);
3889 if (isSelected && isBigSurOrAbove) {
3892 frameRect = frameRect.
adjusted(0, 0, 1, 0);
3896 case QStyleOptionTab::Middle:
3897 frameRect = frameRect.
adjusted(-innerAdjust, 0, innerAdjust, 0);
3899 if (isSelected && isBigSurOrAbove) {
3902 frameRect = frameRect.
adjusted(-1, 0, 1, 0);
3905 case QStyleOptionTab::Moving:
3906 case QStyleOptionTab::End:
3909 frameRect = frameRect.
adjusted(-innerAdjust, 0, outerAdjust, 0);
3911 frameRect = frameRect.
adjusted(-outerAdjust, 0, innerAdjust, 0);
3913 if (isSelected && isBigSurOrAbove) {
3915 frameRect = frameRect.
adjusted(-1, 0, 0, 0);
3918 case QStyleOptionTab::OnlyOneTab:
3919 frameRect = frameRect.
adjusted(-outerAdjust, 0, outerAdjust, 0);
3922 pb.frame = frameRect.toCGRect();
3924 if (!isPopupButton) {
3928 pb.buttonType = NSButtonTypePushOnPushOff;
3931 pb.enabled = isEnabled;
3932 [pb highlight:isPressed];
3937 pb.state = (
isActive && isSelected) ? NSControlStateValueOn : NSControlStateValueOff;
3939 pb.state = (
isActive && isSelected && !isPressed) ? NSControlStateValueOn : NSControlStateValueOff;
3942 CGContextClipToRect(
ctx,
opt->
rect.toCGRect());
3943 if (!isSelected || needsInactiveHack) {
3947 CGContextScaleCTM(
ctx, -1, 1);
3948 CGContextTranslateCTM(
ctx, -frameRect.
left(), 0);
3951 CGContextScaleCTM(
ctx, 1, -1);
3952 CGContextTranslateCTM(
ctx, 0, -frameRect.
right());
3955 CGContextScaleCTM(
ctx, 1, -1);
3956 CGContextTranslateCTM(
ctx, 0, -frameRect.
left());
3963 CGContextTranslateCTM(
ctx, 0, frameRect.
right());
3965 CGContextTranslateCTM(
ctx, -frameRect.
left(), 0);
3973 NSPopUpArrowPosition
oldPosition = NSPopUpArrowAtCenter;
3974 NSPopUpButtonCell *pbCell = nil;
3976 if (isPopupButton && (tp == QStyleOptionTab::OnlyOneTab || isBigSurOrAbove)) {
3980 pbCell =
static_cast<NSPopUpButtonCell *
>(pb.cell);
3982 pbCell.arrowPosition = NSPopUpNoArrow;
3983 if (pb.state == NSControlStateValueOff) {
3985 rAdjusted.origin.
x -= 3;
3986 rAdjusted.size.width += 6;
3987 if (isBigSurOrAbove) {
3988 if (tp == QStyleOptionTab::End)
3989 rAdjusted.origin.x -= 2;
3994 [pb.cell drawBezelWithFrame:rAdjusted inView:pb.superview];
4000 if (needsInactiveHack) {
4002 const qreal pixelRatio =
p->device()->devicePixelRatio();
4007 d->drawNSViewInRect(pb, frameRect, &tabPainter, ^(
CGContextRef ctx,
const CGRect &
r) {
4009 drawBezelBlock(
ctx,
r);
4014 const qreal inactiveGray = 0.898;
4015 const int inactiveGray8 =
qRound(inactiveGray * 255.0);
4016 const QRgb inactiveGrayRGB =
qRgb(inactiveGray8, inactiveGray8, inactiveGray8);
4017 for (
int l = 0; l < tabPixmap.
height(); ++l) {
4019 for (
int i = 0;
i < tabPixmap.
width(); ++
i) {
4021 line[i] = inactiveGrayRGB;
4030 p->drawImage(
opt->
rect, tabPixmap);
4032 d->drawNSViewInRect(pb, frameRect,
p, drawBezelBlock);
4035 if (!isSelected &&
sp != QStyleOptionTab::NextIsSelected
4036 && tp != QStyleOptionTab::End
4037 && tp != QStyleOptionTab::OnlyOneTab) {
4040 p->setOpacity(isEnabled ? 0.105 : 0.06);
4041 p->setPen(separatorPen);
4057 if (
const auto *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4058 QStyleOptionTab myTab = *tab;
4060 const auto tabDirection = QMacStylePrivate::tabDirection(tab->shape);
4071 if (
const auto *tabBar = qobject_cast<const QTabBar *>(
w))
4072 if (!tabBar->tabTextColor(tabBar->currentIndex()).isValid())
4073 myTab.palette.setColor(foregroundRole,
Qt::white);
4080 int heightOffset = 0;
4083 }
else if (nonDefaultFont) {
4084 if (
p->fontMetrics().height() == myTab.rect.height())
4087 myTab.rect.setHeight(myTab.rect.height() + heightOffset);
4093#if QT_CONFIG(dockwidget)
4095 if (
const auto *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(
opt)) {
4096 const bool isVertical = dwOpt->verticalTitleBar;
4100 p->
translate(effectiveRect.left(), effectiveRect.top() + effectiveRect.width());
4102 p->translate(-effectiveRect.left(), -effectiveRect.top());
4111 p->fillRect(effectiveRect, linearGrad);
4115 p->drawLine(effectiveRect.bottomLeft(), effectiveRect.bottomRight());
4117 if (!dwOpt->title.isEmpty()) {
4121 effectiveRect.top() + titleRect.left() -
opt->
rect.
left(),
4125 const auto text =
p->fontMetrics().elidedText(dwOpt->title,
Qt::ElideRight, titleRect.width());
4134 const auto *ff = qobject_cast<const QFocusFrame *>(
w);
4135 const auto *ffw = ff ? ff->widget() :
nullptr;
4136 const auto ct = [=] {
4138 if (qobject_cast<const QCheckBox*>(ffw))
4140 if (qobject_cast<const QRadioButton*>(ffw))
4142 if (qobject_cast<const QLineEdit*>(ffw) || qobject_cast<const QTextEdit*>(ffw))
4144 if (
const auto *pb = qobject_cast<const QPushButton *>(ffw)) {
4153 if (pb->menu() !=
nullptr)
4179 p->fillRect(mi->rect, mi->palette.highlight());
4185 p->drawLine(mi->rect.x() + 2, mi->rect.y() + mi->rect.height() / 2 - 1,
4186 mi->rect.x() + mi->rect.width() - 4,
4187 mi->rect.y() + mi->rect.height() / 2 - 1);
4189 p->drawLine(mi->rect.x() + 2, mi->rect.y() + mi->rect.height() / 2,
4190 mi->rect.x() + mi->rect.width() - 4,
4191 mi->rect.y() + mi->rect.height() / 2);
4194 const int scrollerVOffset = 5;
4195 const int left = mi->rect.x() + (mi->rect.width() - scrollerSize.
width()) / 2;
4200 bottom = mi->rect.y() + scrollerVOffset;
4203 bottom = mi->rect.bottom() - scrollerVOffset;
4219 CGColorRef separatorColor = [NSColor quaternaryLabelColor].CGColor;
4220 const QRect separatorRect =
QRect(mi->rect.left(), mi->rect.center().y(), mi->rect.width(), 2);
4225 const int maxpmw = mi->maxIconWidth;
4228 int xpos = mi->rect.x() + 18;
4229 int checkcol = maxpmw;
4231 p->setPen(mi->palette.text().color());
4233 p->setPen(mi->palette.highlightedText().color());
4235 p->setPen(mi->palette.buttonText().color());
4259 if (!mi->icon.isNull()) {
4265#if QT_CONFIG(combobox)
4266 if (
const QComboBox *comboBox = qobject_cast<const QComboBox *>(
w)) {
4271 QRect cr(xpos, mi->rect.y(), checkcol, mi->rect.height());
4276 xpos +=
size.width() + 6;
4282 int yPos = mi->rect.y();
4287 const int tabwidth = isSubMenu ? 9 : mi->reservedShortcutWidth;
4295 if (tabIndex >= 0) {
4297 rightMarginText =
s.
mid(tabIndex + 1);
4302 if (!rightMarginText.
isEmpty()) {
4306 p->drawText(xp, yPos, tabwidth, mi->rect.height(), text_flags |
Qt::AlignRight, rightMarginText);
4311 if (seq.
count() == 1) {
4313 const int maxKeyWidth =
p->fontMetrics().maxWidth();
4316 p->drawText(xp + tabwidth - maxKeyWidth, yPos, maxKeyWidth, mi->rect.height(), text_flags,
key);
4318 p->drawText(xp, yPos, tabwidth - maxKeyWidth, mi->rect.height(),
4321 p->drawText(xp, yPos, tabwidth, mi->rect.height(), text_flags, rightMarginText);
4328 QFont myFont = mi->font;
4346 NSFont *
f = (NSFont *)(CTFontRef)fontEngine->handle();
4349 const auto pc =
p->pen().color();
4350 NSColor *
c = [NSColor colorWithSRGBRed:pc.redF()
4358 d->setupNSGraphicsContext(cgCtx, YES);
4364 [s.toNSString() drawAtPoint:CGPointMake(xpos, yPos)
4365 withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c,
4366 NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0],
4367 NSUnderlineStyleAttributeName: [NSNumber numberWithInt: myFont.underline() ? NSUnderlineStyleSingle
4368 : NSUnderlineStyleNone]}];
4370 d->restoreNSGraphicsContext(cgCtx);
4373 p->drawText(xpos, yPos, mi->rect.width() - xm - tabwidth + 1,
4374 mi->rect.height(), text_flags,
s);
4384 const QBrush bg = selected ? mi->palette.highlight() : mi->palette.window();
4385 p->fillRect(mi->rect, bg);
4390 if (!mi->icon.isNull()) {
4395 mi->icon.pixmap(
QSize(iconExtent, iconExtent),
p->device()->devicePixelRatio(),
4412 const bool isIndeterminate = (pb->minimum == 0 && pb->maximum == 0);
4414 const bool inverted = pb->invertedAppearance;
4422 const CGRect cgRect =
rect.toCGRect();
4424 const auto aquaSize =
d->effectiveAquaSizeConstrain(
opt,
w);
4429 if (isIndeterminate) {
4442 [ipi startAnimation];
4445 d->setupNSGraphicsContext(cg, NO);
4446 d->setupVerticalInvertedXform(cg, reverse, vertical, cgRect);
4447 [ipi drawWithFrame:cgRect inView:d->backingStoreNSView];
4448 d->restoreNSGraphicsContext(cg);
4452 [ipi stopAnimation];
4456 auto *
pi =
static_cast<NSProgressIndicator *
>(
d->cocoaControl(
cw));
4458 d->setupVerticalInvertedXform(
ctx, reverse, vertical,
rect);
4459 pi.minValue = pb->minimum;
4460 pi.maxValue = pb->maximum;
4461 pi.doubleValue = pb->progress;
4469#ifndef QT_NO_MDIAREA
4470 if (!
w || !qobject_cast<QMdiSubWindow *>(
w->parentWidget()))
4481 p->setPen(lineColor);
4483 const int NumLines = 3;
4484 for (
int l = 0; l < NumLines; ++l) {
4485 const int offset = (l * 4 + 3);
4505 auto *sv =
static_cast<NSSplitView *
>(
d->cocoaControl(
cw));
4506 sv.frame =
opt->
rect.toCGRect();
4508 [sv drawDividerInRect:rect];
4511 QPen oldPen =
p->pen();
4521 if (
const QStyleOptionRubberBand *rubber = qstyleoption_cast<const QStyleOptionRubberBand *>(
opt)) {
4523 if (!rubber->opaque) {
4526 strokeColor.
setHsvF(0, 0, 0.86, 1.0);
4527 fillColor.
setHsvF(0, 0, 0.53, 0.25);
4529 p->fillRect(
opt->
rect, strokeColor);
4531 QPen oldPen =
p->pen();
4533 QPen pen(strokeColor);
4535 p->setBrush(fillColor);
4538 p->drawRect(adjusted);
4540 p->setBrush(oldBrush);
4547#ifndef QT_NO_TOOLBAR
4549 const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(
opt);
4557#if QT_CONFIG(mainwindow)
4558 if (
QMainWindow * mainWindow = qobject_cast<QMainWindow *>(
w->window())) {
4559 if (toolBar && toolBar->toolBarArea ==
Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) {
4572 if (isEndOfUnifiedArea) {
4593 linearGrad.
setColorAt(0, mainWindowGradientBegin);
4594 linearGrad.
setColorAt(1, mainWindowGradientEnd);
4595 p->fillRect(
opt->
rect, linearGrad);
4638#if QT_CONFIG(itemviews)
4640 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
4644 if (vopt->features & QStyleOptionViewItem::HasDecoration)
4645 rect.adjust(-fw, 0, 0, 0);
4664 const auto cs =
d->effectiveAquaSizeConstrain(
btn,
widget);
4666 auto frameRect =
cw.adjustedControlFrame(
btn->
rect);
4668 frameRect -=
cw.titleMargins();
4670 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
4671 frameRect = QRectF::fromCGRect([pb alignmentRectForFrame:frameRect.toCGRect()]);
4677 rect = frameRect.toRect();
4728#if QT_CONFIG(tabwidget)
4730 if (
const QStyleOptionTabWidgetFrame *twf
4731 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4732 switch (twf->shape) {
4739 rect =
QRect(
QPoint(0, twf->rect.height() - twf->leftCornerWidgetSize.height()),
4740 twf->leftCornerWidgetSize);
4749 if (
const QStyleOptionTabWidgetFrame *twf
4750 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4751 switch (twf->shape) {
4754 rect =
QRect(
QPoint(twf->rect.width() - twf->rightCornerWidgetSize.width(), 0),
4755 twf->rightCornerWidgetSize);
4759 rect =
QRect(
QPoint(twf->rect.width() - twf->rightCornerWidgetSize.width(),
4760 twf->rect.height() - twf->rightCornerWidgetSize.height()),
4761 twf->rightCornerWidgetSize);
4771 if (
const auto *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
4772 if (twf->lineWidth != 0) {
4773 switch (QMacStylePrivate::tabDirection(twf->shape)) {
4775 rect.adjust(+1, +14, -1, -1);
4778 rect.adjust(+1, +1, -1, -14);
4781 rect.adjust(+14, +1, -1, -1);
4784 rect.adjust(+1, +1, -14, -1);
4790 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4791 QRect dummyIconRect;
4797 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
4810 verticalShift = -verticalShift;
4812 qSwap(horizontalShift, verticalShift);
4813 horizontalShift *= -1;
4814 verticalShift *= -1;
4817 horizontalShift = -horizontalShift;
4819 tr.adjust(0, 0, horizontalShift, verticalShift);
4822 tr.setBottom(
tr.bottom() - verticalShift);
4823 tr.setRight(
tr.right() - horizontalShift);
4827 int w =
size.width();
4828 int h =
size.height();
4829 int midHeight =
static_cast<int>(
qCeil(
float(
tr.height() -
h) / 2));
4830 int midWidth = ((
tr.width() -
w) / 2);
4832 bool atTheTop =
true;
4833 switch (tab->shape) {
4844 rect =
QRect(tab->rect.x() + hpadding, midHeight,
w,
h);
4846 rect =
QRect(tab->rect.right() -
w - hpadding, midHeight,
w,
h);
4851 rect =
QRect(midWidth,
tr.y() + tab->rect.height() - hpadding -
h,
w,
h);
4860#if QT_CONFIG(combobox)
4862 rect.adjust(-1, -2, 0, 0);
4865 rect.adjust(-1, -1, 0, +1);
4878#ifndef QT_NO_TOOLBAR
4889 rect.adjust(+3, +2, -3, -4);
4913 = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
4919 rect.adjust(+6, +4, -6, -8);
4921 rect.adjust(+5, +4, -5, -6);
4923 rect.adjust(+1, 0, -1, -2);
4929 rect.adjust(0, +4, 0, -8);
4931 rect.adjust(0, +4, 0, -6);
4933 rect.adjust(0, 0, 0, -2);
4942 rect.adjust(0, +6, 0 , -5);
4944 rect.adjust(0, +6, 0 , -7);
4948 if (
const QStyleOptionSlider *sliderOpt
4949 = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4952 int above =
SIZE(3, 0, 2);
4953 int below =
SIZE(4, 3, 0);
4955 rect.adjust(0, +above, 0, -below);
4957 rect.adjust(+above, 0, -below, 0);
4960 int below =
SIZE(3, 2, 0);
4962 rect.setHeight(
rect.height() - below);
4964 rect.setWidth(
rect.width() - below);
4967 int above =
SIZE(3, 2, 0);
4982 rect.adjust(0, +1, 0, -1);
4985 rect.adjust(+1, 0, -1, 0);
4995 qstyleoption_cast<const QStyleOptionGroupBox *>(
opt)) {
5005 delta =
SIZE(8, 4, 4);
5007 delta =
SIZE(15, 12, 12);
5014#if QT_CONFIG(tabwidget)
5016 if (
const QStyleOptionTabWidgetFrame *tabWidgetOpt =
5017 qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
5023 rect = tabWidgetOpt->rect;
5029#if QT_CONFIG(dockwidget)
5039 = qstyleoption_cast<const QStyleOptionDockWidget*>(
opt);
5040 bool canClose = dwOpt == 0 ? true : dwOpt->
closable;
5047 if (verticalTitleBar)
5058 sz +=
QSize(buttonMargin, buttonMargin);
5059 if (verticalTitleBar)
5075 sz +=
QSize(buttonMargin, buttonMargin);
5076 if (verticalTitleBar)
5091 if (dw->isFloating())
5092 icon = dw->windowIcon();
5096 if (verticalTitleBar)
5116 if (verticalTitleBar) {
5146 CGContextSaveGState(cg);
5147 [NSGraphicsContext saveGraphicsState];
5149 [NSGraphicsContext setCurrentContext:
5150 [NSGraphicsContext graphicsContextWithCGContext:cg flipped:flipped]];
5155 [NSGraphicsContext restoreGraphicsState];
5156 CGContextRestoreGState(cg);
5166 d->resolveCurrentNSView(
window);
5169 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5172 const bool drawKnob = sb->subControls &
SC_ScrollBarSlider && sb->minimum != sb->maximum;
5173 if (!drawTrack && !drawKnob)
5181 static const CGFloat knobWidths[] = { 7.0, 5.0, 5.0 };
5182 static const CGFloat expandedKnobWidths[] = { 11.0, 9.0, 9.0 };
5183 const auto cocoaSize =
d->effectiveAquaSizeConstrain(
opt,
widget);
5184 const CGFloat maxExpandScale = expandedKnobWidths[cocoaSize] / knobWidths[cocoaSize];
5190 bool wasActive =
false;
5194 bool shouldExpand =
false;
5201 const QStyle::State oldState =
static_cast<QStyle::State
>(
styleObject->
property(
"_q_stylestate").
value<QStyle::State::Int>());
5209 oldPos != sb->sliderPosition ||
5210 oldMin != sb->minimum ||
5211 oldMax != sb->maximum ||
5212 oldRect != sb->rect ||
5213 oldState != sb->state ||
5214 oldActiveControls != sb->activeSubControls) {
5231 d->startAnimation(anim);
5246 if (oldActiveControls)
5253 shouldExpand =
isTransient && (
opt->activeSubControls || wasActive);
5255 if (!anim && !oldActiveControls) {
5258 d->startAnimation(anim);
5261 expandScale = 1.0 + (maxExpandScale - 1.0) * anim->
currentValue();
5265 expandScale = maxExpandScale;
5271 d->setupNSGraphicsContext(cg, NO );
5275 NSScroller *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5278 const bool hasDarkBg = bgColor.
red() < 128 && bgColor.
green() < 128 && bgColor.
blue() < 128;
5282 scroller.knobStyle = hasDarkBg? NSScrollerKnobStyleLight : NSScrollerKnobStyleDark;
5284 scroller.knobStyle = NSScrollerKnobStyleDefault;
5293 CGContextBeginTransparencyLayerWithRect(cg,
scroller.frame,
nullptr);
5294 CGContextSetAlpha(cg, opacity);
5300 CGRect trackRect =
scroller.bounds;
5302 trackRect.origin.y += expandOffset;
5304 trackRect.origin.x += expandOffset;
5305 [scroller drawKnobSlotInRect:trackRect highlight:NO];
5315 const CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:scroller.controlSize scrollerStyle:scroller.scrollerStyle];
5316 const CGFloat knobWidth = knobWidths[cocoaSize] * expandScale;
5318 const CGRect scrollerKnobRect = CGRectInset([
scroller rectForPart:NSScrollerKnob], 1, 1);
5319 const CGFloat knobLength = isHorizontal ? scrollerKnobRect.size.width : scrollerKnobRect.size.height;
5320 const CGFloat knobPos = isHorizontal ? scrollerKnobRect.origin.x : scrollerKnobRect.origin.y;
5321 const CGFloat knobOffset =
qRound((scrollerWidth + expandOffset - knobWidth) / 2.0);
5322 const CGFloat knobRadius = knobWidth / 2.0;
5325 knobRect = CGRectMake(knobPos, knobOffset, knobLength, knobWidth);
5327 knobRect = CGRectMake(knobOffset, knobPos, knobWidth, knobLength);
5328 QCFType<CGPathRef> knobPath = CGPathCreateWithRoundedRect(knobRect, knobRadius, knobRadius,
nullptr);
5329 CGContextAddPath(cg, knobPath);
5330 CGContextSetAlpha(cg, 0.5);
5331 CGColorRef knobColor = hasDarkBg ? NSColor.whiteColor.CGColor : NSColor.blackColor.CGColor;
5332 CGContextSetFillColorWithColor(cg, knobColor);
5333 CGContextFillPath(cg);
5335 [scroller drawKnob];
5342 CGContextSetBlendMode(cg, kCGBlendModePlusDarker);
5343 [scroller drawKnob];
5349 CGContextEndTransparencyLayer(cg);
5351 d->restoreNSGraphicsContext(cg);
5355 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5358 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5360 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5373 const CGRect knobRect = [slider.cell knobRectFlipped:slider.isFlipped];
5374 pressPoint.x = CGRectGetMidX(knobRect);
5375 pressPoint.y = CGRectGetMidY(knobRect);
5384 [slider.cell startTrackingAt:pressPoint inView:slider];
5385 [slider.cell startTrackingAt:pressPoint inView:slider];
5391 const bool verticalFlip = !isHorizontal && !sl->upsideDown;
5394 if (sl->upsideDown) {
5395 CGContextTranslateCTM(ctx, rect.size.width, rect.origin.y);
5396 CGContextScaleCTM(ctx, -1, 1);
5398 CGContextTranslateCTM(ctx, 0, rect.origin.y);
5400 }
else if (verticalFlip) {
5401 CGContextTranslateCTM(
ctx,
rect.origin.x,
rect.size.height);
5402 CGContextScaleCTM(
ctx, 1, -1);
5405 if (hasDoubleTicks) {
5408 CGContextTranslateCTM(
ctx, 0, 4);
5410 CGContextTranslateCTM(
ctx, 1, 0);
5417 const bool drawAllParts = drawKnob && drawBar && (!hasTicks || drawTicks);
5418 if (drawAllParts && !hasDoubleTicks && (!verticalFlip || drawTicks)) {
5422 if (verticalFlip && drawTicks) {
5425 slider.intValue = slider.maxValue - slider.intValue + slider.minValue;
5427 [slider drawRect:CGRectZero];
5431 NSSliderCell *cell = slider.cell;
5433 const int numberOfTickMarks = slider.numberOfTickMarks;
5436 slider.numberOfTickMarks = 0;
5438 const CGRect barRect = [cell barRectFlipped:slider.isFlipped];
5440 if (!isHorizontal && !sl->upsideDown && (hasDoubleTicks || !hasTicks)) {
5448 [cell drawBarInside:barRect flipped:true];
5450 [cell drawBarInside:barRect flipped:!verticalFlip];
5454 slider.numberOfTickMarks = numberOfTickMarks;
5457 if (hasTicks && drawTicks) {
5458 if (!drawBar && hasDoubleTicks)
5459 slider.numberOfTickMarks = numberOfTickMarks;
5461 [cell drawTickMarks];
5463 if (hasDoubleTicks) {
5465 CGAffineTransform tickMarksFlip;
5466 const CGRect tickMarkRect = [cell rectOfTickMarkAtIndex:0];
5468 tickMarksFlip = CGAffineTransformMakeTranslation(0,
rect.size.height - tickMarkRect.size.height - 3);
5469 tickMarksFlip = CGAffineTransformScale(tickMarksFlip, 1, -1);
5471 tickMarksFlip = CGAffineTransformMakeTranslation(
rect.size.width - tickMarkRect.size.width / 2, 0);
5472 tickMarksFlip = CGAffineTransformScale(tickMarksFlip, -1, 1);
5474 CGContextConcatCTM(
ctx, tickMarksFlip);
5475 [cell drawTickMarks];
5476 CGContextConcatCTM(
ctx, CGAffineTransformInvert(tickMarksFlip));
5483 slider.numberOfTickMarks = 0;
5492 [slider.cell stopTracking:pressPoint at:pressPoint inView:slider mouseIsUp:NO];
5493 [slider.cell stopTracking:pressPoint at:pressPoint inView:slider mouseIsUp:NO];
5497#if QT_CONFIG(spinbox)
5499 if (
const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
5516 d->setupNSGraphicsContext(cg, NO);
5518 const auto aquaSize =
d->effectiveAquaSizeConstrain(
opt,
widget);
5520 NSStepperCell *cell =
static_cast<NSStepperCell *
>(
d->cocoaCell(
cw));
5523 const CGRect newRect = [cell drawingRectForBounds:updown.toCGRect()];
5527 const CGFloat x = CGRectGetMidX(newRect);
5528 const CGFloat y = upPressed ? -3 : 3;
5529 const CGPoint pressPoint = CGPointMake(
x,
y);
5532 if (upPressed || downPressed)
5533 [cell startTrackingAt:pressPoint inView:d->backingStoreNSView];
5535 [cell drawWithFrame:newRect inView:d->backingStoreNSView];
5537 if (upPressed || downPressed)
5538 [cell stopTracking:pressPoint at:pressPoint inView:d->backingStoreNSView mouseIsUp:NO];
5540 d->restoreNSGraphicsContext(cg);
5545#if QT_CONFIG(combobox)
5547 if (
const auto *combo = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
5552 const auto cs =
d->effectiveAquaSizeConstrain(combo,
widget);
5554 auto *cc =
static_cast<NSControl *
>(
d->cocoaControl(
cw));
5555 cc.enabled = isEnabled;
5556 QRectF frameRect =
cw.adjustedControlFrame(combo->rect);;
5559 auto *pb =
static_cast<NSPopUpButton *
>(cc);
5567 pb.frame = frameRect.toCGRect();
5568 [pb highlight:isPressed];
5569 d->drawNSViewInRect(pb, frameRect,
p, ^(
CGContextRef,
const CGRect &
r) {
5570 [pb.cell drawBezelWithFrame:r inView:pb.superview];
5574 auto *
cb =
static_cast<NSComboBox *
>(cc);
5575 const auto frameRect =
cw.adjustedControlFrame(combo->rect);
5576 cb.frame = frameRect.toCGRect();
5579 if (NSButtonCell *cell =
static_cast<NSButtonCell *
>([cc.cell qt_valueForPrivateKey:
@"_buttonCell"])) {
5580 cell.highlighted = isPressed;
5587 [cb.cell drawWithFrame:r inView:cb];
5597 focusRect = QRectF::fromCGRect([cc alignmentRectForFrame:cc.frame]);
5600 focusRect = focusRect.translated(0, 1);
5602 focusRect = focusRect.translated(2, -1);
5612 if (
const auto *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(
opt)) {
5623 QPainterPath outerFramePath =
d->windowPanelPath(outerFrameRect);
5626 const auto frameAdjust = 1.0 /
p->device()->devicePixelRatio();
5627 const auto innerFrameRect = outerFrameRect.adjusted(frameAdjust, frameAdjust, -frameAdjust, 0);
5628 QPainterPath innerFramePath =
d->windowPanelPath(innerFrameRect);
5635 p->fillPath(innerFramePath,
g);
5648 for (
const auto sc : buttons) {
5649 const auto ct =
d->windowButtonCocoaControl(sc);
5651 auto *wb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
5652 wb.enabled = (sc & titlebar->subControls) &&
isActive;
5653 [wb highlight:(titlebar->state & State_Sunken) && (sc & titlebar->activeSubControls)];
5658 auto *wbCell =
static_cast<NSButtonCell *
>(wb.cell);
5659 [wbCell drawWithFrame:rect inView:wb];
5666 if (!titlebar->icon.isNull()) {
5675 if (!titlebar->text.isEmpty())
5682 = qstyleoption_cast<const QStyleOptionGroupBox *>(
opt)) {
5693 if (didModifySubControls)
5696 if (didModifySubControls) {
5700 const QFont savedFont =
p->font();
5701 if (!flat &&
d->smallSystemFont)
5702 p->setFont(*
d->smallSystemFont);
5705 p->setFont(savedFont);
5711 = qstyleoption_cast<const QStyleOptionToolButton *>(
opt)) {
5712#if QT_CONFIG(accessibility)
5713 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar)) {
5722 d->drawToolbarButtonArrow(tb,
p);
5728 isKey = [view.window isKeyWindow];
5732 path.addRoundedRect(
QRectF(tb->rect.x(), tb->rect.y(), tb->rect.width(), tb->rect.height() + 4), 4, 4);
5740 auto bflags = tb->state;
5743 auto mflags = tb->state;
5753 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5755 auto *pb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
5756 pb.bezelStyle = NSBezelStyleShadowlessSquare;
5757 pb.frame =
opt->
rect.toCGRect();
5758 pb.buttonType = NSButtonTypePushOnPushOff;
5759 pb.enabled = isEnabled;
5760 [pb highlight:isPressed];
5761 pb.state = isHighlighted && !isPressed ? NSControlStateValueOn : NSControlStateValueOff;
5764 [pb.cell drawBezelWithFrame:rect inView:pb];
5778 d->drawToolbarButtonArrow(tb,
p);
5790 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(
opt))
5791 QStyleHelper::drawDial(dial,
p);
5815 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5816 if (!sl->rect.contains(pt))
5822 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5824 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5828 NSSliderCell *cell = slider.cell;
5829 const auto barRect = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]);
5830 const auto knobRect = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]);
5831 if (knobRect.contains(pt)) {
5833 }
else if (barRect.contains(pt)) {
5835 }
else if (hasTicks) {
5841 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5842 if (!sb->rect.contains(pt)) {
5849 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5851 auto *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5860 const auto knobRect = QRectF::fromCGRect([
scroller rectForPart:NSScrollerKnob]);
5863 if (pt.
x() < knobRect.left())
5865 else if (pt.
x() > knobRect.right())
5870 if (pt.
y() < knobRect.top())
5872 else if (pt.
y() > knobRect.bottom())
5893 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5895 const bool isReverseHorizontal = isHorizontal && (sb->direction ==
Qt::RightToLeft);
5897 NSScrollerPart part = NSScrollerNoPart;
5899 part = NSScrollerKnob;
5901 part = NSScrollerKnobSlot;
5905 part = NSScrollerDecrementPage;
5907 part = NSScrollerIncrementPage;
5911 if (part != NSScrollerNoPart) {
5913 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5915 auto *
scroller =
static_cast<NSScroller *
>(
d->cocoaControl(
cw));
5917 ret = QRectF::fromCGRect([
scroller rectForPart:part]).toRect();
5922 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
5926 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
5928 auto *slider =
static_cast<NSSlider *
>(
d->cocoaControl(
cw));
5932 NSSliderCell *cell = slider.cell;
5934 ret = QRectF::fromCGRect([cell knobRectFlipped:slider.isFlipped]).toRect();
5936 ret.setTop(sl->rect.top());
5937 ret.setBottom(sl->rect.bottom());
5939 ret.setLeft(sl->rect.left());
5940 ret.setRight(sl->rect.right());
5943 ret = QRectF::fromCGRect([cell barRectFlipped:slider.isFlipped]).toRect();
5945 const auto tickMarkRect = QRectF::fromCGRect([cell rectOfTickMarkAtIndex:0]);
5947 ret =
QRect(sl->rect.left(), tickMarkRect.top(), sl->rect.width(), tickMarkRect.height());
5949 ret =
QRect(tickMarkRect.left(), sl->rect.top(), tickMarkRect.width(), sl->rect.height());
5954 if (sl->upsideDown) {
5955 ret =
QRect(sl->rect.right() -
ret.right(), sl->rect.top(),
ret.width(), sl->rect.height());
5957 ret.setTop(sl->rect.top());
5958 ret.setBottom(sl->rect.bottom());
5961 if (!sl->upsideDown) {
5962 ret =
QRect(sl->rect.left(), sl->rect.bottom() -
ret.bottom(), sl->rect.width(),
ret.height());
5964 ret.setLeft(sl->rect.left());
5965 ret.setRight(sl->rect.right());
5971 if (
const auto *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(
opt)) {
5978 qreal labelWidth = titlebar->fontMetrics.horizontalAdvance(titlebar->text) + 1;
5979 qreal labelHeight = titlebar->fontMetrics.height();
5983 if (!titlebar->icon.isNull()) {
5992 labelWidth, labelHeight);
5994 const auto currentButton =
d->windowButtonCocoaControl(sc);
6003 auto *wb =
static_cast<NSButton *
>(
d->cocoaControl(
cw));
6004 if (ct == currentButton)
6005 buttonSize = QSizeF::fromCGSize(wb.frame.size);
6018 const auto cs =
d->effectiveAquaSizeConstrain(combo,
widget);
6024 ret = editRect.toAlignedRect();
6027 ret = editRect.toAlignedRect();
6029 ret.setWidth(combo->rect.right() -
ret.right());
6032 if (combo->editable) {
6034 const int comboTop = combo->rect.top();
6037 qRound(inner.origin.x - combo->rect.left() + inner.size.width),
6038 editRect.bottom() - comboTop + 2);
6040 ret =
QRect(combo->rect.x() + 4 - 11,
6041 combo->rect.y() + 1,
6042 editRect.width() + 10 + 11,
6055 bool hasNoText = !checkable &&
groupBox->text.isEmpty();
6063 const int margin = flat || hasNoText ? 0 : 9;
6066 const QFontMetricsF fm = flat || fontIsSet || !
d->smallSystemFont
6070 const int tw =
qCeil(
s.width());
6076 if (flat && checkable)
6082 int newSum = indicatorWidth + 1;
6083 int newLeft = labelRect.
left() + (rtl ? -newSum : newSum);
6090 int newLeft = labelRect.
left() - (rtl ? 3 : -3);
6094 int newLeft = labelRect.
left() - (rtl ? 3 : 2);
6102 int left = rtl ? labelRect.
right() - indicatorWidth : labelRect.
left() - 1;
6103 int top = flat ?
ret.top() + 1 :
ret.top() + 5;
6125 ret.adjust(3, -5, -3, -4);
6127 ret.adjust(3, 3, -3, -4);
6137#if QT_CONFIG(spinbox)
6139 if (
const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
6168 const int x = spin->rect.width() - spinner_w;
6169 ret.setRect(
x + spin->rect.x(),
y + spin->rect.y(), spinner_w, spin->rect.height() -
y * 2);
6176 hackTranslateX = -2;
6179 hackTranslateX = -1;
6186 NSStepperCell *cell =
static_cast<NSStepperCell *
>(
d->cocoaCell(
cw));
6187 const CGRect outRect = [cell drawingRectForBounds:ret.toCGRect()];
6188 ret = QRectF::fromCGRect(outRect).toRect();
6192 ret.setHeight(
ret.height() / 2);
6201 ret.translate(hackTranslateX, 0);
6206 ret = spin->rect.adjusted(fw, fw, -fw, -fw);
6208 ret.setWidth(spin->rect.width() - spinBoxSep - spinner_w);
6222#if QT_CONFIG(accessibility)
6223 if (QStyleHelper::hasAncestor(
opt->
styleObject, QAccessible::ToolBar))
6226 ret.adjust(-1, 0, 0, 0);
6241 bool useAquaGuideline =
true;
6244#if QT_CONFIG(spinbox)
6246 if (
const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
6249 sz +=
QSize(buttonWidth, 0);
6288#if QT_CONFIG(tabwidget)
6289 if (
const QStyleOptionTabWidgetFrame *twf
6290 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
6293 const int gapBetweenTabbarAndStackWidget = 2 + 14 - overlap;
6295 const auto tabDirection = QMacStylePrivate::tabDirection(twf->shape);
6298 extra =
QSize(2, gapBetweenTabbarAndStackWidget + 1);
6300 extra =
QSize(gapBetweenTabbarAndStackWidget + 1, 2);
6306#if QT_CONFIG(tabbar)
6308 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
6311 const auto tabDirection = QMacStylePrivate::tabDirection(tab->shape);
6317 int defaultTabHeight;
6318 const auto cs =
d->effectiveAquaSizeConstrain(
opt,
widget);
6321 if (tab->documentMode)
6322 defaultTabHeight = 24;
6324 defaultTabHeight = 21;
6327 defaultTabHeight = 18;
6330 defaultTabHeight = 16;
6336 const bool widthSet = !differentFont && tab->icon.isNull();
6339 sz.
rwidth() = textSize.width();
6340 sz.
rheight() =
qMax(defaultTabHeight, textSize.height());
6349 int maxWidgetHeight =
qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
6350 int maxWidgetWidth =
qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
6352 int widgetWidth = 0;
6353 int widgetHeight = 0;
6355 if (tab->leftButtonSize.isValid()) {
6357 widgetWidth += tab->leftButtonSize.width();
6358 widgetHeight += tab->leftButtonSize.height();
6360 if (tab->rightButtonSize.isValid()) {
6362 widgetWidth += tab->rightButtonSize.width();
6363 widgetHeight += tab->rightButtonSize.height();
6378 bool isFlat =
false;
6391 if (macsz.
width() != -1)
6420 int maxpmw = mi->maxIconWidth;
6421#if QT_CONFIG(combobox)
6430 h = mi->fontMetrics.height() + 2;
6431 if (!mi->icon.isNull()) {
6432#if QT_CONFIG(combobox)
6453#if QT_CONFIG(combobox)
6454 if (comboBox && comboBox->
isVisible()) {
6478 if (
const auto *tb = qstyleoption_cast<const QStyleOptionToolButton *>(
opt))
6483 if (
const auto *
cb = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
6484 const auto controlSize =
d->effectiveAquaSizeConstrain(
opt,
widget);
6485 if (!
cb->editable) {
6512 if (
proxy() ==
this) {
6526 useAquaGuideline =
false;
6530 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
6531 const int minimumSize = 24;
6538#if QT_CONFIG(itemviews)
6540 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
6555 if (macsz.
width() != -1)
6557 if (macsz.
height() != -1)
6565 if (combo->editable) {
6566 const auto widgetSize =
d->aquaSizeConstrain(
opt,
widget);
6569 cw.size = widgetSize;
6592#if QT_CONFIG(graphicsview)
6593 if (
QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusWidget)) {
6597 if (
proxy->widget())
6598 focusWidget =
proxy->widget()->focusWidget();
6604#if QT_CONFIG(spinbox)
6605 if (
const auto sb = qobject_cast<QAbstractSpinBox *>(focusWidget))
6612 if (!
d->focusWidget)
6614 d->focusWidget->setWidget(
f);
6615 }
else if (
d->focusWidget) {
6616 d->focusWidget->setWidget(0);
6620 d->focusWidget->setWidget(0);
6639 p.translate(pix2.
width(), 0);
6688 switch (
CT2(control1, control2)) {
nonatomic NSInteger animators
void setCurrentTime(int msecs)
The QApplication class manages the GUI application's control flow and main settings.
static QPalette palette()
Returns the current application palette.
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or \nullptr if no widget in this ap...
static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Returns a copy of the given image converted to a bitmap using the specified image conversion flags.
const QColor & color() const
Returns the brush color.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
constexpr bool isSpace() const noexcept
Returns true if the character is a separator character (Separator_* categories or certain code points...
The QColor class provides colors based on RGB, HSV or CMYK values.
void setAlphaF(float alpha)
Sets the alpha of this color to alpha.
QColor darker(int f=200) const noexcept
QRgb rgb() const noexcept
Returns the RGB value of the color.
float greenF() const noexcept
Returns the green color component of this color.
QRgb rgba() const noexcept
Returns the RGB value of the color, including its alpha.
int red() const noexcept
Returns the red color component of this color.
int blue() const noexcept
Returns the blue color component of this color.
int green() const noexcept
Returns the green color component of this color.
float redF() const noexcept
Returns the red color component of this color.
void setHsv(int h, int s, int v, int a=255)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
QColor lighter(int f=150) const noexcept
float alphaF() const noexcept
Returns the alpha color component of this color.
float blueF() const noexcept
Returns the blue color component of this color.
void setHsvF(float h, float s, float v, float a=1.0)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
void getHsv(int *h, int *s, int *v, int *a=nullptr) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
The QComboBox widget is a combined button and popup list.
QSize iconSize
the size of the icons shown in the combobox.
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
int pixelMetric(PixelMetric m, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
\reimp
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=nullptr) const override
\reimp
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=nullptr) const override
\reimp
void unpolish(QWidget *widget) override
\reimp
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
\reimp
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=nullptr) const override
\reimp
int styleHint(StyleHint sh, const QStyleOption *opt=nullptr, const QWidget *w=nullptr, QStyleHintReturn *shret=nullptr) const override
\reimp
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override
\reimp
void polish(QPalette &) override
\reimp
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=nullptr) const override
\reimp
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QFocusFrame widget provides a focus frame which can be outside of a widget's normal paintable are...
qreal pointSizeF() const
Returns the point size of the matched window system font.
\reentrant \inmodule QtGui
qreal height() const
Returns the height of the font.
QSizeF size(int flags, const QString &str, int tabstops=0, int *tabarray=nullptr) const
Returns the size in pixels of the characters in the given text.
\reentrant \inmodule QtGui
int height() const
Returns the height of the font.
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=nullptr) const
Returns the size in pixels of text.
int descent() const
Returns the descent of the font.
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
static QFontPrivate * get(const QFont &font)
QFontEngine * engineForScript(int script) const
int pointSize() const
Returns the point size of the font.
void setPointSizeF(qreal)
Sets the point size to pointSize.
The QFrame class is the base class of widgets that can have a frame.
int midLineWidth
the width of the mid-line
int frameStyle() const
Returns the frame style.
int lineWidth
the line width
Shape frameShape
the frame shape value from the frame style
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QGraphicsScene * scene() const
Returns the current scene for the item, or \nullptr if the item is not stored in a scene.
virtual int type() const
Returns the type of an item as an int.
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene's current focus item, or \nullptr if no it...
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
static QPlatformTheme * platformTheme()
static QPlatformNativeInterface * platformNativeInterface()
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.
QIcon windowIcon
the default window icon
T value(const Key &key) const noexcept
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
qint64 cacheKey() const
Returns a number that identifies the contents of this QIcon object.
State
This enum describes the state for which a pixmap is intended to be used.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
qsizetype bytesPerLine() const
Returns the number of bytes per image scanline.
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
int width() const
Returns the width of the image.
uchar * bits()
Returns a pointer to the first pixel data.
int height() const
Returns the height of the image.
@ Format_ARGB32_Premultiplied
void fill(uint pixel)
Fills the entire image with the given pixelValue.
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the image.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
static QKeySequence fromString(const QString &str, SequenceFormat format=PortableText)
int count() const
Returns the number of keys in the key sequence.
void setFinalStop(const QPointF &stop)
void setStart(const QPointF &start)
qsizetype removeAll(const AT &t)
void append(parameter_type t)
void drawNSViewInRect(NSView *view, const QRectF &rect, QPainter *p, __attribute__((noescape)) DrawRectBlock drawRectBlock=nil) const
static const int PushButtonRightOffset
QHash< CocoaControl, NSCell * > cocoaCells
void drawFocusRing(QPainter *p, const QRectF &targetRect, int hMargin, int vMargin, const CocoaControl &cw) const
CocoaControlType windowButtonCocoaControl(QStyle::SubControl sc) const
@ Button_WindowMiniaturize
@ ProgressIndicator_Determinate
@ ProgressIndicator_Indeterminate
void resolveCurrentNSView(QWindow *window) const
NSView * cocoaControl(CocoaControl widget) const
QHash< CocoaControl, NSView * > cocoaControls
void drawToolbarButtonArrow(const QStyleOption *opt, QPainter *p) const
NSCell * cocoaCell(CocoaControl widget) const
static CGRect comboboxInnerBounds(const CGRect &outterBounds, const CocoaControl &cocoaWidget)
static QList< QPointer< QObject > > scrollBars
NSView * backingStoreNSView
void setupNSGraphicsContext(CGContextRef cg, bool flipped) const
QPainterPath windowPanelPath(const QRectF &r) const
static const int PushButtonLeftOffset
static const int PushButtonContentPadding
static QRectF comboboxEditBounds(const QRectF &outterBounds, const CocoaControl &cw)
QStyleHelper::WidgetSizePolicy effectiveAquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct=QStyle::CT_CustomBase, QSize szHint=QSize(-1, -1), QSize *insz=0) const
void restoreNSGraphicsContext(CGContextRef cg) const
QStyleHelper::WidgetSizePolicy aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct=QStyle::CT_CustomBase, QSize szHint=QSize(-1, -1), QSize *insz=0) const
void setupVerticalInvertedXform(CGContextRef cg, bool reverse, bool vertical, const CGRect &rect) const
virtual void drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
int pixelMetric(PixelMetric pm, const QStyleOption *opt=0, const QWidget *widget=nullptr) const
\reimp
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const
\reimp
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const
\reimp
virtual int styleHint(StyleHint sh, const QStyleOption *opt=0, const QWidget *w=nullptr, QStyleHintReturn *shret=nullptr) const
\reimp
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=nullptr) const
\reimp
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=nullptr) const
\reimp
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=nullptr) const
\reimp
void polish(QWidget *w)
\reimp
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const
\reimp
void unpolish(QWidget *w)
\reimp
QPalette standardPalette() const
Returns the style's standard palette.
bool event(QEvent *e)
This virtual function receives events to an object and should return true if the event e was recogniz...
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
\reimp
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const
\reimp
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt, const QWidget *widget=nullptr) const
\reimp
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=nullptr) const
\reimp
The QMainWindow class provides a main application window.
QWidget * centralWidget() const
Returns the central widget for the main window.
qreal currentValue() const
static QObjectPrivate * get(QObject *o)
T findChild(const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
QString objectName
the name of this object
QVariant property(const char *name) const
Returns the value of the object's name property.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
static constexpr QOperatingSystemVersionBase MacOSCatalina
\variable QOperatingSystemVersion::MacOSCatalina
static constexpr QOperatingSystemVersionBase MacOSMojave
\variable QOperatingSystemVersion::MacOSMojave
static QOperatingSystemVersion current()
[0]
static constexpr QOperatingSystemVersionBase MacOSBigSur
\variable QOperatingSystemVersion::MacOSBigSur
qreal devicePixelRatio() const
The QPainterPathStroker class is used to generate fillable outlines for a given painter path.
void setDashPattern(Qt::PenStyle)
Sets the dash pattern for the generated outlines to style.
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path.
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
void addPath(const QPainterPath &path)
Adds the given path to this path as a closed subpath.
void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
The QPainter class performs low-level painting on widgets and other paint devices.
The QPalette class contains color groups for each widget state.
const QBrush & button() const
Returns the button brush of the current color group.
const QBrush & text() const
Returns the text foreground brush of the current color group.
const QBrush & dark() const
Returns the dark brush of the current color group.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
const QBrush & window() const
Returns the window (general background) brush of the current color group.
const QBrush & base() const
Returns the base brush of the current color group.
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QImage toImage() const
Converts the pixmap to a QImage.
int width() const
Returns the width of the pixmap.
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the pixmap.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
\inmodule QtCore\reentrant
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
The QProgressBar widget provides a horizontal or vertical progress bar.
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QRectF translated(qreal dx, qreal dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr void translate(qreal dx, qreal dy) noexcept
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\inmodule QtCore\reentrant
constexpr QPoint bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr void moveCenter(const QPoint &p) noexcept
Moves the rectangle, leaving the center point at the given position.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint topRight() const noexcept
Returns the position of the rectangle's top-right corner.
constexpr void moveLeft(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setRect(int x, int y, int w, int h) noexcept
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr QRect transposed() const noexcept
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr QPoint bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
constexpr void moveTo(int x, int t) noexcept
Moves the rectangle, leaving the top-left corner at the given position (x, y).
constexpr void moveTop(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr void setY(int y) noexcept
Sets the top edge of the rectangle to the given y coordinate.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QRegion class specifies a clip region for a painter.
QRect boundingRect() const noexcept
Returns the bounding rectangle of this region.
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
ControlType controlType() const noexcept
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr int & rheight() noexcept
Returns a reference to the height.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
constexpr QSize transposed() const noexcept
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString right(qsizetype n) const
Returns a substring that contains the n rightmost characters of the string.
QByteArray toLatin1() const &
void truncate(qsizetype pos)
Truncates the string at the given position index.
bool isNull() const
Returns true if this string is null; otherwise returns false.
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
qsizetype length() const
Returns the number of characters in this string.
The QStyleHintReturnMask class provides style hints that return a QRegion.
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionToolButton::features
\variable QStyleOptionMenuItem::menuItemType
QStyle::SubControls subControls
QStyle::SubControls activeSubControls
\variable QStyleOptionFocusRect::backgroundColor
\variable QStyleOptionFrame::features
\variable QStyleOptionButton::features
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
Qt::LayoutDirection direction
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
ContentsType
This enum describes the available contents types.
virtual QPalette standardPalette() const
Returns the style's standard palette.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
StyleHint
This enum describes the available style hints.
@ SH_TitleBar_ShowToolTipsOnButtons
@ SH_ComboBox_ListMouseTracking
@ SH_TabBar_CloseButtonPosition
@ SH_Slider_PageSetButtons
@ SH_ScrollView_FrameOnlyAroundContents
@ SH_MainWindow_SpaceBelowMenuBar
@ SH_ItemView_PaintAlternatingRowColorsForEmptyArea
@ SH_ItemView_ChangeHighlightOnFocus
@ SH_ItemView_MovementWithoutUpdatingSelection
@ SH_MenuBar_AltKeyNavigation
@ SH_Menu_SubMenuUniDirection
@ SH_ScrollBar_RollBetweenButtons
@ SH_TabBar_AllowWheelScrolling
@ SH_Menu_FlashTriggeredItem
@ SH_Menu_SubMenuPopupDelay
@ SH_ItemView_ArrowKeysNavigateIntoChildren
@ SH_Slider_AbsoluteSetButtons
@ SH_Menu_SubMenuResetWhenReenteringParent
@ SH_ComboBox_PopupFrameStyle
@ SH_Header_ArrowAlignment
@ SH_ToolBox_SelectedPageTitleBold
@ SH_TabBar_PreferNoArrows
@ SH_Menu_SubMenuSloppySelectOtherActions
@ SH_FormLayoutWrapPolicy
@ SH_Widget_ShareActivation
@ SH_ComboBox_LayoutDirection
@ SH_ComboBox_AllowWheelScrolling
@ SH_Menu_AllowActiveAndDisabled
@ SH_TabBar_SelectMouseType
@ SH_Menu_FillScreenWithScroll
@ SH_FontDialog_SelectAssociatedText
@ SH_ToolTipLabel_Opacity
@ SH_ScrollBar_LeftClickAbsolutePosition
@ SH_DialogButtonBox_ButtonsHaveIcons
@ SH_MenuBar_MouseTracking
@ SH_FormLayoutFieldGrowthPolicy
@ SH_ScrollBar_ContextMenu
@ SH_FormLayoutFormAlignment
@ SH_Menu_SubMenuDontStartSloppyOnLeave
@ SH_MessageBox_CenterButtons
@ SH_TitleBar_ModifyNotification
@ SH_Slider_StopMouseOverSlider
@ SH_SpinBox_ButtonsInsideFrame
@ SH_GroupBox_TextLabelVerticalAlignment
@ SH_PrintDialog_RightAlignButtons
@ SH_BlinkCursorWhenTextSelected
@ SH_ListViewExpand_SelectMouseType
@ SH_ItemView_EllipsisLocation
@ SH_MessageBox_TextInteractionFlags
@ SH_RichText_FullWidthSelection
@ SH_FormLayoutLabelAlignment
@ SH_ItemView_ShowDecorationSelected
@ SH_DockWidget_ButtonsHaveFrame
@ SH_Menu_SpaceActivatesItem
@ SH_FocusFrame_AboveWidget
@ SH_Workspace_FillSpaceOnMaximize
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment,...
virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const
Returns the area within the given rectangle in which to draw the provided text according to the speci...
StandardPixmap
This enum describes the available standard pixmaps.
@ SP_TitleBarNormalButton
@ SP_MessageBoxInformation
@ SP_ToolBarVerticalExtensionButton
@ SP_ToolBarHorizontalExtensionButton
ControlElement
This enum represents a control element.
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=nullptr) const =0
Returns the sub-area for the given element as described in the provided style option.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction.
PixelMetric
This enum describes the various available pixel metrics.
@ PM_DockWidgetFrameWidth
@ PM_DockWidgetTitleMargin
@ PM_ExclusiveIndicatorHeight
@ PM_ButtonShiftHorizontal
@ PM_MdiSubWindowFrameWidth
@ PM_DockWidgetTitleBarButtonMargin
@ PM_ScrollView_ScrollBarOverlap
@ PM_DockWidgetSeparatorExtent
@ PM_TabCloseIndicatorWidth
@ PM_CheckBoxLabelSpacing
@ PM_LayoutVerticalSpacing
@ PM_TabBarTabShiftVertical
@ PM_LayoutHorizontalSpacing
@ PM_ButtonDefaultIndicator
@ PM_SliderControlThickness
@ PM_MenuDesktopFrameWidth
@ PM_DialogButtonsSeparator
@ PM_ToolBarExtensionExtent
@ PM_TabCloseIndicatorHeight
@ PM_DialogButtonsButtonHeight
@ PM_DialogButtonsButtonWidth
@ PM_RadioButtonLabelSpacing
@ PM_TabBarTabShiftHorizontal
@ PM_ExclusiveIndicatorWidth
@ PM_ToolTipLabelFrameWidth
ComplexControl
This enum describes the available complex controls.
PrimitiveElement
This enum describes the various primitive elements.
@ PE_IndicatorToolBarHandle
@ PE_IndicatorHeaderArrow
@ PE_PanelScrollAreaCorner
@ PE_IndicatorDockWidgetResizeHandle
@ PE_IndicatorRadioButton
@ PE_IndicatorToolBarSeparator
@ PE_IndicatorMenuCheckMark
@ PE_IndicatorItemViewItemCheck
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const =0
Draws the given element with the provided painter with the style options specified by option.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
SubElement
This enum represents a sub-area of a widget.
@ SE_RadioButtonLayoutItem
@ SE_TreeViewDisclosureItem
@ SE_TabBarTabRightButton
@ SE_TabWidgetRightCorner
@ SE_ProgressBarLayoutItem
@ SE_DockWidgetTitleBarText
@ SE_DockWidgetFloatButton
@ SE_PushButtonLayoutItem
@ SE_DockWidgetCloseButton
@ SE_TabWidgetTabContents
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
const QStyle * proxy() const
SubControl
This enum describes the available sub controls.
@ SC_TitleBarNormalButton
@ SC_ComboBoxListBoxPopup
int hoveredTabIndex() const
The QTabBar class provides a tab bar, e.g.
QWidget * tabButton(int index, ButtonPosition position) const
Returns the widget set a tab index and position or \nullptr if one is not set.
bool documentMode
Whether or not the tab bar is rendered in a mode suitable for the main window.
Shape
This enum type lists the built-in shapes supported by QTabBar.
The QTableView class provides a default model/view implementation of a table view.
constexpr size_type size() const noexcept
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
uint toUInt(bool *ok=nullptr) const
Returns the variant as an unsigned int if the variant has userType() \l QMetaType::UInt,...
QRect toRect() const
Returns the variant as a QRect if the variant has userType() \l QMetaType::QRect; otherwise returns a...
EGLImageKHR int int EGLuint64KHR * modifiers
const QStyleOptionButton * btn
[3]
QBrush brushForToolButton(bool isOnKeyWindow)
QRect rotateTabPainter(QPainter *p, QStyleOptionTab::Shape shape, QRect tabRect)
void drawTabShape(QPainter *p, const QStyleOptionTab *tabOpt, bool isUnified, int tabOverlap)
void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb)
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)
WidgetSizePolicy widgetSizePolicy(const QWidget *widget, const QStyleOption *opt)
QColor backgroundColor(const QPalette &pal, const QWidget *widget)
Combined button and popup list for selecting options.
@ TextSelectableByKeyboard
@ WA_TranslucentBackground
@ ToolButtonTextUnderIcon
@ ToolButtonTextBesideIcon
FontHash * qt_app_fonts_hash()
#define QByteArrayLiteral(str)
#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__)
QColor qt_mac_toQColor(CGColorRef color)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
static const QColor darkModeSeparatorLine(88, 88, 88)
static QStyleHelper::WidgetSizePolicy getControlSize(const QStyleOption *option, const QWidget *widget)
static const qreal focusRingWidth
static const int toolButtonArrowSize
static QStyleHelper::WidgetSizePolicy qt_aqua_guess_size(const QWidget *widg, QSize large, QSize small, QSize mini)
static const QColor darkMainWindowGradientBegin(47, 47, 47)
static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QStyleOption *opt, const QWidget *widg, QSize szHint, QStyleHelper::WidgetSizePolicy sz)
static const QColor lightMainWindowGradientEnd(200, 200, 200)
static const QColor lightMainWindowGradientBegin(240, 240, 240)
static QLinearGradient titlebarGradientActive()
static const QColor titlebarSeparatorLineInactive(131, 131, 131)
static const int headerSectionArrowHeight
static bool setupSlider(NSSlider *slider, const QStyleOptionSlider *sl)
static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
static bool setupScroller(NSScroller *scroller, const QStyleOptionSlider *sb)
static const qreal titleBarIconTitleSpacing
static QLinearGradient titlebarGradientInactive()
static QPixmap darkenPixmap(const QPixmap &pixmap)
static const int qt_mac_aqua_metrics[]
static const QColor titlebarSeparatorLineActive(111, 111, 111)
static const qreal titleBarButtonSpacing
static const int toolButtonArrowMargin
@ ProgressBarShadowOutset
@ SmallProgressBarShadowOutset
@ LargeProgressBarThickness
@ NormalProgressBarThickness
QMacStylePrivate::CocoaControlType cocoaControlType(const QStyleOption *opt, const QWidget *w)
static const QMarginsF pullDownButtonShadowMargins[3]
static const qreal popupButtonDefaultHeight[3]
static const QColor darkMainWindowGradientEnd(47, 47, 47)
static QString qt_mac_removeMnemonics(const QString &original)
static const qreal pushButtonDefaultHeight[3]
static void setLayoutItemMargins(int left, int top, int right, int bottom, QRect *rect, Qt::LayoutDirection dir)
static const qreal comboBoxDefaultHeight[3]
static const QMarginsF pushButtonShadowMargins[3]
const int pushButtonBevelRectOffsets[3]
static const QMarginsF comboBoxFocusRingMargins[3]
static const int headerSectionSeparatorInset
static int qt_mac_aqua_get_metric(QAquaMetric m)
static const int DisclosureOffset
static const qreal titleBarTitleRightMargin
static bool qt_macWindowMainWindow(const QWidget *window)
#define return_SIZE(large, small, mini)
#define SIZE(large, small, mini)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLenum GLsizei GLsizei GLint * values
[15]
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * label
[43]
GLenum GLsizeiptr fontSize
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei const GLint * box
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * table
struct CGContext * CGContextRef
static constexpr QSize frameSize(const T &frame)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
static bool isWindow(QObject *object)
#define QT_NAMESPACE_ALIAS_OBJC_CLASS(name)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr QRgb qRgb(int r, int g, int b)
constexpr int qRed(QRgb rgb)
constexpr int qGreen(QRgb rgb)
constexpr QRgb qRgba(int r, int g, int b, int a)
constexpr int qBlue(QRgb rgb)
constexpr int qAlpha(QRgb rgb)
static const struct TessellationWindingOrderTab cw[]
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
constexpr bool verticalTabs(QTabBar::Shape shape) noexcept
#define QT_CONFIG(feature)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
static QStringList styleNames()
QObject * styleObject(const QStyleOption *option)
static bool isTransient(const QWindow *w)
if(qFloatDistance(a, b)<(1<< 7))
[0]
QFile defaults(defaultsPath)
\inmodule QtCore \reentrant
bool contains(const AT &t) const noexcept
QSizeF defaultFrameSize() const
QRectF adjustedControlFrame(const QRectF &rect) const
bool operator==(const CocoaControl &other) const
bool getCocoaButtonTypeAndBezelStyle(NSButtonType *buttonType, NSBezelStyle *bezelStyle) const
QStyleHelper::WidgetSizePolicy size
QMarginsF titleMargins() const